diff --git a/deploy/bundle.js b/deploy/bundle.js index b6114b5..e0c9b47 100644 --- a/deploy/bundle.js +++ b/deploy/bundle.js @@ -1,2 +1,2 @@ /*! For license information please see bundle.js.LICENSE.txt */ -(()=>{"use strict";var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{var t;e.g.importScripts&&(t=e.g.location+"");var n=e.g.document;if(!t&&n&&(n.currentScript&&(t=n.currentScript.src),!t)){var i=n.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=i[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=t})();const t=[{name:"BrainStem",url:"./BrainStem.glb"},{name:"DamagedHelmet",url:"./DamagedHelmet.glb"}],n="166",i=1,r=2,a=3,s=0,o=1,l=2,c=100,h=101,d=102,u=200,p=201,f=202,m=203,g=204,v=205,_=206,x=207,y=208,S=209,w=210,b=211,M=212,T=213,E=214,A=0,P=1,R=2,C=0,L=1,D=2,I=3,U=4,O=5,N=6,F=7,B="attached",z=301,k=302,H=306,V=1e3,G=1001,W=1002,j=1003,X=1004,Y=1005,q=1006,Z=1007,K=1008,J=1009,Q=1010,$=1011,ee=1012,te=1013,ne=1014,ie=1015,re=1016,ae=1017,se=1018,oe=1020,le=35902,ce=1021,he=1022,de=1023,ue=1024,pe=1025,fe=1026,me=1027,ge=1028,ve=1029,_e=1030,xe=1031,ye=1033,Se=33776,we=33777,be=33778,Me=33779,Te=35840,Ee=35841,Ae=35842,Pe=35843,Re=36196,Ce=37492,Le=37496,De=37808,Ie=37809,Ue=37810,Oe=37811,Ne=37812,Fe=37813,Be=37814,ze=37815,ke=37816,He=37817,Ve=37818,Ge=37819,We=37820,je=37821,Xe=36492,Ye=36494,qe=36495,Ze=36283,Ke=36284,Je=36285,Qe=36286,$e=2300,et=2301,tt=2302,nt="",it="srgb",rt="srgb-linear",at="display-p3",st="display-p3-linear",ot="linear",lt="srgb",ct="rec709",ht="p3",dt=7680,ut=512,pt=513,ft=514,mt=515,gt=516,vt=517,_t=518,xt=519,yt=35044,St="300 es",wt=2e3,bt=2001;class Mt{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>8&255]+Tt[e>>16&255]+Tt[e>>24&255]+"-"+Tt[255&t]+Tt[t>>8&255]+"-"+Tt[t>>16&15|64]+Tt[t>>24&255]+"-"+Tt[63&n|128]+Tt[n>>8&255]+"-"+Tt[n>>16&255]+Tt[n>>24&255]+Tt[255&i]+Tt[i>>8&255]+Tt[i>>16&255]+Tt[i>>24&255]).toLowerCase()}function Rt(e,t,n){return Math.max(t,Math.min(n,e))}function Ct(e,t){return(e%t+t)%t}function Lt(e,t,n){return(1-n)*e+n*t}function Dt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function It(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const Ut=Et,Ot=function(e){return e*At};class Nt{constructor(e=0,t=0){Nt.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 new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){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}sub(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){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Rt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ft{constructor(e,t,n,i,r,a,s,o,l){Ft.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=s,c[3]=t,c[4]=r,c[5]=o,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],c=n[4],h=n[7],d=n[2],u=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],x=i[7],y=i[2],S=i[5],w=i[8];return r[0]=a*f+s*v+o*y,r[3]=a*m+s*_+o*S,r[6]=a*g+s*x+o*w,r[1]=l*f+c*v+h*y,r[4]=l*m+c*_+h*S,r[7]=l*g+c*x+h*w,r[2]=d*f+u*v+p*y,r[5]=d*m+u*_+p*S,r[8]=d*g+u*x+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8];return t*a*c-t*s*l-n*r*c+n*s*o+i*r*l-i*a*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=c*a-s*l,d=s*o-c*r,u=l*r-a*o,p=t*h+n*d+i*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=h*f,e[1]=(i*l-c*n)*f,e[2]=(s*n-i*a)*f,e[3]=d*f,e[4]=(c*t-i*o)*f,e[5]=(i*r-s*t)*f,e[6]=u*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*r)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(Bt.makeScale(e,t)),this}rotate(e){return this.premultiply(Bt.makeRotation(-e)),this}translate(e,t){return this.premultiply(Bt.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const Bt=new Ft;function zt(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function kt(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Ht(){const e=kt("canvas");return e.style.display="block",e}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;const Vt={};function Gt(e){e in Vt||(Vt[e]=!0,console.warn(e))}const Wt=(new Ft).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),jt=(new Ft).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Xt={[rt]:{transfer:ot,primaries:ct,toReference:e=>e,fromReference:e=>e},[it]:{transfer:lt,primaries:ct,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[st]:{transfer:ot,primaries:ht,toReference:e=>e.applyMatrix3(jt),fromReference:e=>e.applyMatrix3(Wt)},[at]:{transfer:lt,primaries:ht,toReference:e=>e.convertSRGBToLinear().applyMatrix3(jt),fromReference:e=>e.applyMatrix3(Wt).convertLinearToSRGB()}},Yt=new Set([rt,st]),qt={enabled:!0,_workingColorSpace:rt,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!Yt.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;const i=Xt[t].toReference;return(0,Xt[n].fromReference)(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return Xt[e].primaries},getTransfer:function(e){return e===nt?ot:Xt[e].transfer}};function Zt(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Kt(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let Jt;class Qt{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Jt&&(Jt=kt("canvas")),Jt.width=e.width,Jt.height=e.height;const n=Jt.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Jt}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){const t=kt("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}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 V:e.x=e.x-Math.floor(e.x);break;case G:e.x=e.x<0?0:1;break;case W: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 V:e.y=e.y-Math.floor(e.y);break;case G:e.y=e.y<0?0:1;break;case W: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)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}rn.DEFAULT_IMAGE=null,rn.DEFAULT_MAPPING=300,rn.DEFAULT_ANISOTROPY=1;class an{constructor(e=0,t=0,n=0,i=1){an.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){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}sub(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){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const a=.01,s=.1,o=e.elements,l=o[0],c=o[4],h=o[8],d=o[1],u=o[5],p=o[9],f=o[2],m=o[6],g=o[10];if(Math.abs(c-d)o&&e>v?ev?o=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,t*n);e=Math.sin(e*a)/r,s=Math.sin(s*a)/r}const r=s*n;if(o=o*e+d*r,l=l*e+u*r,c=c*e+p*r,h=h*e+f*r,e===1-s){const e=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=e,l*=e,c*=e,h*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[a],d=r[a+1],u=r[a+2],p=r[a+3];return e[t]=s*p+c*h+o*u-l*d,e[t+1]=o*p+c*d+l*h-s*u,e[t+2]=l*p+c*u+s*d-o*h,e[t+3]=c*p-s*h-o*d-l*u,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),c=s(i/2),h=s(r/2),d=o(n/2),u=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],c=t[6],h=t[10],d=n+s+h;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(c-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>h){const e=2*Math.sqrt(1+n-s-h);this._w=(c-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>h){const e=2*Math.sqrt(1+s-n-h);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+c)/e}else{const e=2*Math.sqrt(1+h-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Rt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,c=t._w;return this._x=n*c+a*s+i*l-r*o,this._y=i*c+a*o+r*s-n*l,this._z=r*c+a*l+n*o-i*s,this._w=a*c-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let s=a*e._w+n*e._x+i*e._y+r*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=n,this._y=i,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(o),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}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._onChangeCallback(),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}}class dn{constructor(e=0,t=0,n=0){dn.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){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(pn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(pn.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*n),c=2*(s*t-r*i),h=2*(r*n-a*t);return this.x=t+o*l+a*h-s*c,this.y=n+o*c+s*l-r*h,this.z=i+o*h+r*c-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return un.copy(this).projectOnVector(e),this.sub(un)}reflect(e){return this.sub(un.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Rt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const un=new dn,pn=new hn;class fn{constructor(e=new dn(1/0,1/0,1/0),t=new dn(-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,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,gn),gn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mn),Tn.subVectors(this.max,Mn),_n.subVectors(e.a,Mn),xn.subVectors(e.b,Mn),yn.subVectors(e.c,Mn),Sn.subVectors(xn,_n),wn.subVectors(yn,xn),bn.subVectors(_n,yn);let t=[0,-Sn.z,Sn.y,0,-wn.z,wn.y,0,-bn.z,bn.y,Sn.z,0,-Sn.x,wn.z,0,-wn.x,bn.z,0,-bn.x,-Sn.y,Sn.x,0,-wn.y,wn.x,0,-bn.y,bn.x,0];return!!Pn(t,_n,xn,yn,Tn)&&(t=[1,0,0,0,1,0,0,0,1],!!Pn(t,_n,xn,yn,Tn)&&(En.crossVectors(Sn,wn),t=[En.x,En.y,En.z],Pn(t,_n,xn,yn,Tn)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,gn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(gn).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()||(mn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mn)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const mn=[new dn,new dn,new dn,new dn,new dn,new dn,new dn,new dn],gn=new dn,vn=new fn,_n=new dn,xn=new dn,yn=new dn,Sn=new dn,wn=new dn,bn=new dn,Mn=new dn,Tn=new dn,En=new dn,An=new dn;function Pn(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){An.fromArray(e,a);const s=r.x*Math.abs(An.x)+r.y*Math.abs(An.y)+r.z*Math.abs(An.z),o=t.dot(An),l=n.dot(An),c=i.dot(An);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const Rn=new fn,Cn=new dn,Ln=new dn;class Dn{constructor(e=new dn,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Rn.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Cn.subVectors(e,this.center);const t=Cn.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Cn,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Ln.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Cn.copy(e.center).add(Ln)),this.expandByPoint(Cn.copy(e.center).sub(Ln))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const In=new dn,Un=new dn,On=new dn,Nn=new dn,Fn=new dn,Bn=new dn,zn=new dn;class kn{constructor(e=new dn,t=new dn(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,In)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=In.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(In.copy(this.origin).addScaledVector(this.direction,t),In.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Un.copy(e).add(t).multiplyScalar(.5),On.copy(t).sub(e).normalize(),Nn.copy(this.origin).sub(Un);const r=.5*e.distanceTo(t),a=-this.direction.dot(On),s=Nn.dot(this.direction),o=-Nn.dot(On),l=Nn.lengthSq(),c=Math.abs(1-a*a);let h,d,u,p;if(c>0)if(h=a*o-s,d=a*s-o,p=r*c,h>=0)if(d>=-p)if(d<=p){const e=1/c;h*=e,d*=e,u=h*(h+a*d+2*s)+d*(a*h+d+2*o)+l}else d=r,h=Math.max(0,-(a*d+s)),u=-h*h+d*(d+2*o)+l;else d=-r,h=Math.max(0,-(a*d+s)),u=-h*h+d*(d+2*o)+l;else d<=-p?(h=Math.max(0,-(-a*r+s)),d=h>0?-r:Math.min(Math.max(-r,-o),r),u=-h*h+d*(d+2*o)+l):d<=p?(h=0,d=Math.min(Math.max(-r,-o),r),u=d*(d+2*o)+l):(h=Math.max(0,-(a*r+s)),d=h>0?r:Math.min(Math.max(-r,-o),r),u=-h*h+d*(d+2*o)+l);else d=a>0?-r:r,h=Math.max(0,-(a*d+s)),u=-h*h+d*(d+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Un).addScaledVector(On,d),u}intersectSphere(e,t){In.subVectors(e.center,this.origin);const n=In.dot(this.direction),i=In.dot(In)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+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){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,s,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),c>=0?(r=(e.min.y-d.y)*c,a=(e.max.y-d.y)*c):(r=(e.max.y-d.y)*c,a=(e.min.y-d.y)*c),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a=0?(s=(e.min.z-d.z)*h,o=(e.max.z-d.z)*h):(s=(e.max.z-d.z)*h,o=(e.min.z-d.z)*h),n>o||s>i?null:((s>n||n!=n)&&(n=s),(o=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,In)}intersectTriangle(e,t,n,i,r){Fn.subVectors(t,e),Bn.subVectors(n,e),zn.crossVectors(Fn,Bn);let a,s=this.direction.dot(zn);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}Nn.subVectors(this.origin,e);const o=a*this.direction.dot(Bn.crossVectors(Nn,Bn));if(o<0)return null;const l=a*this.direction.dot(Fn.cross(Nn));if(l<0)return null;if(o+l>s)return null;const c=-a*Nn.dot(zn);return c<0?null:this.at(c/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Hn{constructor(e,t,n,i,r,a,s,o,l,c,h,d,u,p,f,m){Hn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l,c,h,d,u,p,f,m)}set(e,t,n,i,r,a,s,o,l,c,h,d,u,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=d,g[3]=u,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 Hn).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Vn.setFromMatrixColumn(e,0).length(),r=1/Vn.setFromMatrixColumn(e,1).length(),a=1/Vn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=a*c,n=a*h,i=s*c,r=s*h;t[0]=o*c,t[4]=-o*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}else if("YXZ"===e.order){const e=o*c,n=o*h,i=l*c,r=l*h;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){const e=o*c,n=o*h,i=l*c,r=l*h;t[0]=e-r*s,t[4]=-a*h,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*c,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){const e=a*c,n=a*h,i=s*c,r=s*h;t[0]=o*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=a*c,t[9]=-s*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=a*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=s*c,t[10]=r*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(Wn,e,jn)}lookAt(e,t,n){const i=this.elements;return qn.subVectors(e,t),0===qn.lengthSq()&&(qn.z=1),qn.normalize(),Xn.crossVectors(n,qn),0===Xn.lengthSq()&&(1===Math.abs(n.z)?qn.x+=1e-4:qn.z+=1e-4,qn.normalize(),Xn.crossVectors(n,qn)),Xn.normalize(),Yn.crossVectors(qn,Xn),i[0]=Xn.x,i[4]=Yn.x,i[8]=qn.x,i[1]=Xn.y,i[5]=Yn.y,i[9]=qn.y,i[2]=Xn.z,i[6]=Yn.z,i[10]=qn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],c=n[1],h=n[5],d=n[9],u=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],_=n[7],x=n[11],y=n[15],S=i[0],w=i[4],b=i[8],M=i[12],T=i[1],E=i[5],A=i[9],P=i[13],R=i[2],C=i[6],L=i[10],D=i[14],I=i[3],U=i[7],O=i[11],N=i[15];return r[0]=a*S+s*T+o*R+l*I,r[4]=a*w+s*E+o*C+l*U,r[8]=a*b+s*A+o*L+l*O,r[12]=a*M+s*P+o*D+l*N,r[1]=c*S+h*T+d*R+u*I,r[5]=c*w+h*E+d*C+u*U,r[9]=c*b+h*A+d*L+u*O,r[13]=c*M+h*P+d*D+u*N,r[2]=p*S+f*T+m*R+g*I,r[6]=p*w+f*E+m*C+g*U,r[10]=p*b+f*A+m*L+g*O,r[14]=p*M+f*P+m*D+g*N,r[3]=v*S+_*T+x*R+y*I,r[7]=v*w+_*E+x*C+y*U,r[11]=v*b+_*A+x*L+y*O,r[15]=v*M+_*P+x*D+y*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],c=e[2],h=e[6],d=e[10],u=e[14];return e[3]*(+r*o*h-i*l*h-r*s*d+n*l*d+i*s*u-n*o*u)+e[7]*(+t*o*u-t*l*d+r*a*d-i*a*u+i*l*c-r*o*c)+e[11]*(+t*l*h-t*s*u-r*a*h+n*a*u+r*s*c-n*l*c)+e[15]*(-i*s*c-t*o*h+t*s*d+i*a*h-n*a*d+n*o*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=e[9],d=e[10],u=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=h*m*l-f*d*l+f*o*u-s*m*u-h*o*g+s*d*g,_=p*d*l-c*m*l-p*o*u+a*m*u+c*o*g-a*d*g,x=c*f*l-p*h*l+p*s*u-a*f*u-c*s*g+a*h*g,y=p*h*o-c*f*o-p*s*d+a*f*d+c*s*m-a*h*m,S=t*v+n*_+i*x+r*y;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/S;return e[0]=v*w,e[1]=(f*d*r-h*m*r-f*i*u+n*m*u+h*i*g-n*d*g)*w,e[2]=(s*m*r-f*o*r+f*i*l-n*m*l-s*i*g+n*o*g)*w,e[3]=(h*o*r-s*d*r-h*i*l+n*d*l+s*i*u-n*o*u)*w,e[4]=_*w,e[5]=(c*m*r-p*d*r+p*i*u-t*m*u-c*i*g+t*d*g)*w,e[6]=(p*o*r-a*m*r-p*i*l+t*m*l+a*i*g-t*o*g)*w,e[7]=(a*d*r-c*o*r+c*i*l-t*d*l-a*i*u+t*o*u)*w,e[8]=x*w,e[9]=(p*h*r-c*f*r-p*n*u+t*f*u+c*n*g-t*h*g)*w,e[10]=(a*f*r-p*s*r+p*n*l-t*f*l-a*n*g+t*s*g)*w,e[11]=(c*s*r-a*h*r-c*n*l+t*h*l+a*n*u-t*s*u)*w,e[12]=y*w,e[13]=(c*f*i-p*h*i+p*n*d-t*f*d-c*n*m+t*h*m)*w,e[14]=(p*s*i-a*f*i-p*n*o+t*f*o+a*n*m-t*s*m)*w,e[15]=(a*h*i-c*s*i+c*n*o-t*h*o-a*n*d+t*s*d)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,c=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,c*s+n,c*o-i*a,0,l*o-i*s,c*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,c=a+a,h=s+s,d=r*l,u=r*c,p=r*h,f=a*c,m=a*h,g=s*h,v=o*l,_=o*c,x=o*h,y=n.x,S=n.y,w=n.z;return i[0]=(1-(f+g))*y,i[1]=(u+x)*y,i[2]=(p-_)*y,i[3]=0,i[4]=(u-x)*S,i[5]=(1-(d+g))*S,i[6]=(m+v)*S,i[7]=0,i[8]=(p+_)*w,i[9]=(m-v)*w,i[10]=(1-(d+f))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Vn.set(i[0],i[1],i[2]).length();const a=Vn.set(i[4],i[5],i[6]).length(),s=Vn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Gn.copy(this);const o=1/r,l=1/a,c=1/s;return Gn.elements[0]*=o,Gn.elements[1]*=o,Gn.elements[2]*=o,Gn.elements[4]*=l,Gn.elements[5]*=l,Gn.elements[6]*=l,Gn.elements[8]*=c,Gn.elements[9]*=c,Gn.elements[10]*=c,t.setFromRotationMatrix(Gn),n.x=r,n.y=a,n.z=s,this}makePerspective(e,t,n,i,r,a,s=2e3){const o=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let u,p;if(s===wt)u=-(a+r)/(a-r),p=-2*a*r/(a-r);else{if(s!==bt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);u=-a/(a-r),p=-a*r/(a-r)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=d,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,a,s=2e3){const o=this.elements,l=1/(t-e),c=1/(n-i),h=1/(a-r),d=(t+e)*l,u=(n+i)*c;let p,f;if(s===wt)p=(a+r)*h,f=-2*h;else{if(s!==bt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);p=r*h,f=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-d,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Vn=new dn,Gn=new Hn,Wn=new dn(0,0,0),jn=new dn(1,1,1),Xn=new dn,Yn=new dn,qn=new dn,Zn=new Hn,Kn=new hn;class Jn{constructor(e=0,t=0,n=0,i=Jn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],c=i[9],h=i[2],d=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(Rt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Rt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Rt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Rt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Rt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,u));break;case"XZY":this._z=Math.asin(-Rt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Zn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Zn,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Kn.setFromEuler(this),this.setFromQuaternion(Kn,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}}Jn.DEFAULT_ORDER="XYZ";class Qn{constructor(){this.mask=1}set(e){this.mask=1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function a(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){mi.subVectors(i,t),gi.subVectors(n,t),vi.subVectors(e,t);const a=mi.dot(mi),s=mi.dot(gi),o=mi.dot(vi),l=gi.dot(gi),c=gi.dot(vi),h=a*l-s*s;if(0===h)return r.set(0,0,0),null;const d=1/h,u=(l*o-s*c)*d,p=(a*c-s*o)*d;return r.set(1-u-p,p,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,_i)&&_i.x>=0&&_i.y>=0&&_i.x+_i.y<=1}static getInterpolation(e,t,n,i,r,a,s,o){return null===this.getBarycoord(e,t,n,i,_i)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,_i.x),o.addScaledVector(a,_i.y),o.addScaledVector(s,_i.z),o)}static isFrontFacing(e,t,n,i){return mi.subVectors(n,t),gi.subVectors(e,t),mi.cross(gi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return mi.subVectors(this.c,this.b),gi.subVectors(this.a,this.b),.5*mi.cross(gi).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ti.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ti.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Ti.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Ti.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ti.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,s;xi.subVectors(i,n),yi.subVectors(r,n),wi.subVectors(e,n);const o=xi.dot(wi),l=yi.dot(wi);if(o<=0&&l<=0)return t.copy(n);bi.subVectors(e,i);const c=xi.dot(bi),h=yi.dot(bi);if(c>=0&&h<=c)return t.copy(i);const d=o*h-c*l;if(d<=0&&o>=0&&c<=0)return a=o/(o-c),t.copy(n).addScaledVector(xi,a);Mi.subVectors(e,r);const u=xi.dot(Mi),p=yi.dot(Mi);if(p>=0&&u<=p)return t.copy(r);const f=u*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),t.copy(n).addScaledVector(yi,s);const m=c*p-u*h;if(m<=0&&h-c>=0&&u-p>=0)return Si.subVectors(r,i),s=(h-c)/(h-c+(u-p)),t.copy(i).addScaledVector(Si,s);const g=1/(m+f+d);return a=f*g,s=d*g,t.copy(n).addScaledVector(xi,a).addScaledVector(yi,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Ei={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},Ai={h:0,s:0,l:0},Pi={h:0,s:0,l:0};function Ri(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class Ci{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=it){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,qt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=qt.workingColorSpace){return this.r=e,this.g=t,this.b=n,qt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=qt.workingColorSpace){if(e=Ct(e,1),t=Rt(t,0,1),n=Rt(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Ri(r,i,e+1/3),this.g=Ri(r,i,e),this.b=Ri(r,i,e-1/3)}return qt.toWorkingColorSpace(this,i),this}setStyle(e,t=it){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)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=it){const n=Ei[e.toLowerCase()];return void 0!==n?this.setHex(n,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=Zt(e.r),this.g=Zt(e.g),this.b=Zt(e.b),this}copyLinearToSRGB(e){return this.r=Kt(e.r),this.g=Kt(e.g),this.b=Kt(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=it){return qt.fromWorkingColorSpace(Li.copy(this),e),65536*Math.round(Rt(255*Li.r,0,255))+256*Math.round(Rt(255*Li.g,0,255))+Math.round(Rt(255*Li.b,0,255))}getHexString(e=it){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=qt.workingColorSpace){qt.fromWorkingColorSpace(Li.copy(this),t);const n=Li.r,i=Li.g,r=Li.b,a=Math.max(n,i,r),s=Math.min(n,i,r);let o,l;const c=(s+a)/2;if(s===a)o=0,l=0;else{const e=a-s;switch(l=c<=.5?e/(a+s):e/(2-a-s),a){case n:o=(i-r)/e+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==c&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==dt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==dt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==dt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,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++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Ui extends Ii{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ci(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.envMapRotation=new Jn,this.combine=A,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.envMapRotation.copy(e.envMapRotation),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}}const Oi=Ni();function Ni(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=1199570944,s[32]=2147483648;for(let e=33;e<63;++e)s[e]=2147483648+(e-32<<23);s[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}const Fi={toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Rt(e,-65504,65504),Oi.floatView[0]=e;const t=Oi.uint32View[0],n=t>>23&511;return Oi.baseTable[n]+((8388607&t)>>Oi.shiftTable[n])},fromHalfFloat:function(e){const t=e>>10;return Oi.uint32View[0]=Oi.mantissaTable[Oi.offsetTable[t]+(1023&e)]+Oi.exponentTable[t],Oi.floatView[0]}},Bi=new dn,zi=new Nt;class ki{constructor(e,t,n=!1){if(Array.isArray(e))throw new 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=n,this.usage=yt,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ie,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return Gt("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const 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;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2)return}Qi.copy(r).invert(),$i.copy(e.ray).applyMatrix4(Qi),null!==n.boundingBox&&!1===$i.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,$i)}}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=d.length;rn.far?null:{distance:c,point:fr.clone(),object:e}}(e,t,n,i,nr,ir,rr,pr);if(h){r&&(or.fromBufferAttribute(r,o),lr.fromBufferAttribute(r,l),cr.fromBufferAttribute(r,c),h.uv=Ti.getInterpolation(pr,nr,ir,rr,or,lr,cr,new Nt)),a&&(or.fromBufferAttribute(a,o),lr.fromBufferAttribute(a,l),cr.fromBufferAttribute(a,c),h.uv1=Ti.getInterpolation(pr,nr,ir,rr,or,lr,cr,new Nt)),s&&(hr.fromBufferAttribute(s,o),dr.fromBufferAttribute(s,l),ur.fromBufferAttribute(s,c),h.normal=Ti.getInterpolation(pr,nr,ir,rr,hr,dr,ur,new dn),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a:o,b:l,c,normal:new dn,materialIndex:0};Ti.getNormal(nr,ir,rr,e.normal),h.face=e}return h}class vr extends Ji{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],c=[],h=[];let d=0,u=0;function p(e,t,n,i,r,a,p,f,m,g,v){const _=a/m,x=p/g,y=a/2,S=p/2,w=f/2,b=m+1,M=g+1;let T=0,E=0;const A=new dn;for(let a=0;a0?1:-1,c.push(A.x,A.y,A.z),h.push(o/m),h.push(1-a/g),T+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class br extends fi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Hn,this.projectionMatrix=new Hn,this.projectionMatrixInverse=new Hn,this.coordinateSystem=wt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}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)}}const Mr=new dn,Tr=new Nt,Er=new Nt;class Ar extends br{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}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){const t=.5*this.getFilmHeight()/e;this.fov=2*At*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Et*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*At*Math.atan(Math.tan(.5*Et*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Mr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Mr.x,Mr.y).multiplyScalar(-e/Mr.z),Mr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Mr.x,Mr.y).multiplyScalar(-e/Mr.z)}getViewSize(e,t){return this.getViewBounds(e,Tr,Er),t.subVectors(Er,Tr)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Et*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}const s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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}}const Pr=-90;class Rr extends fi{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ar(Pr,1,e,t);i.layers=this.layers,this.add(i);const r=new Ar(Pr,1,e,t);r.layers=this.layers,this.add(r);const a=new Ar(Pr,1,e,t);a.layers=this.layers,this.add(a);const s=new Ar(Pr,1,e,t);s.layers=this.layers,this.add(s);const o=new Ar(Pr,1,e,t);o.layers=this.layers,this.add(o);const l=new Ar(Pr,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,s,o]=t;for(const e of t)this.remove(e);if(e===wt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(e!==bt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,s,o,l,c]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,s),e.setRenderTarget(n,3,i),e.render(t,o),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,d,u),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class Cr extends rn{constructor(e,t,n,i,r,a,s,o,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:z,n,i,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Lr extends on{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Cr(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:q}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new vr(5,5,5),s=new wr({name:"CubemapFromEquirect",uniforms:_r(n),vertexShader:i,fragmentShader:r,side:1,blending:0});s.uniforms.tEquirect.value=t;const o=new mr(a,s),l=t.minFilter;return t.minFilter===K&&(t.minFilter=q),new Rr(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}const Dr=new dn,Ir=new dn,Ur=new Ft;class Or{constructor(e=new dn(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Dr.subVectors(n,t).cross(Ir.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Dr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Ur.getNormalMatrix(e),i=this.coplanarPoint(Dr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Nr=new Dn,Fr=new dn;class Br{constructor(e=new Or,t=new Or,n=new Or,i=new Or,r=new Or,a=new Or){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3){const n=this.planes,i=e.elements,r=i[0],a=i[1],s=i[2],o=i[3],l=i[4],c=i[5],h=i[6],d=i[7],u=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],_=i[14],x=i[15];if(n[0].setComponents(o-r,d-l,m-u,x-g).normalize(),n[1].setComponents(o+r,d+l,m+u,x+g).normalize(),n[2].setComponents(o+a,d+c,m+p,x+v).normalize(),n[3].setComponents(o-a,d-c,m-p,x-v).normalize(),n[4].setComponents(o-s,d-h,m-f,x-_).normalize(),t===wt)n[5].setComponents(o+s,d+h,m+f,x+_).normalize();else{if(t!==bt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(s,h,f,_).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),Nr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),Nr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Nr)}intersectsSprite(e){return Nr.center.set(0,0,0),Nr.radius=.7071067811865476,Nr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Nr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Fr.y=i.normal.y>0?e.max.y:e.min.y,Fr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Fr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function zr(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function kr(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.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\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform 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\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_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\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = 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\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn 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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn 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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = 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\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( 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\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - 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\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Gr={common:{diffuse:{value:new Ci(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ft},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ft}},envmap:{envMap:{value:null},envMapRotation:{value:new Ft},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ft}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ft}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ft},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ft},normalScale:{value:new Nt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ft},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ft}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ft}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ft}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ci(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 Ci(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0},uvTransform:{value:new Ft}},sprite:{diffuse:{value:new Ci(16777215)},opacity:{value:1},center:{value:new Nt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ft},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0}}},Wr={basic:{uniforms:xr([Gr.common,Gr.specularmap,Gr.envmap,Gr.aomap,Gr.lightmap,Gr.fog]),vertexShader:Vr.meshbasic_vert,fragmentShader:Vr.meshbasic_frag},lambert:{uniforms:xr([Gr.common,Gr.specularmap,Gr.envmap,Gr.aomap,Gr.lightmap,Gr.emissivemap,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.fog,Gr.lights,{emissive:{value:new Ci(0)}}]),vertexShader:Vr.meshlambert_vert,fragmentShader:Vr.meshlambert_frag},phong:{uniforms:xr([Gr.common,Gr.specularmap,Gr.envmap,Gr.aomap,Gr.lightmap,Gr.emissivemap,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.fog,Gr.lights,{emissive:{value:new Ci(0)},specular:{value:new Ci(1118481)},shininess:{value:30}}]),vertexShader:Vr.meshphong_vert,fragmentShader:Vr.meshphong_frag},standard:{uniforms:xr([Gr.common,Gr.envmap,Gr.aomap,Gr.lightmap,Gr.emissivemap,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.roughnessmap,Gr.metalnessmap,Gr.fog,Gr.lights,{emissive:{value:new Ci(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Vr.meshphysical_vert,fragmentShader:Vr.meshphysical_frag},toon:{uniforms:xr([Gr.common,Gr.aomap,Gr.lightmap,Gr.emissivemap,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.gradientmap,Gr.fog,Gr.lights,{emissive:{value:new Ci(0)}}]),vertexShader:Vr.meshtoon_vert,fragmentShader:Vr.meshtoon_frag},matcap:{uniforms:xr([Gr.common,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.fog,{matcap:{value:null}}]),vertexShader:Vr.meshmatcap_vert,fragmentShader:Vr.meshmatcap_frag},points:{uniforms:xr([Gr.points,Gr.fog]),vertexShader:Vr.points_vert,fragmentShader:Vr.points_frag},dashed:{uniforms:xr([Gr.common,Gr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Vr.linedashed_vert,fragmentShader:Vr.linedashed_frag},depth:{uniforms:xr([Gr.common,Gr.displacementmap]),vertexShader:Vr.depth_vert,fragmentShader:Vr.depth_frag},normal:{uniforms:xr([Gr.common,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,{opacity:{value:1}}]),vertexShader:Vr.meshnormal_vert,fragmentShader:Vr.meshnormal_frag},sprite:{uniforms:xr([Gr.sprite,Gr.fog]),vertexShader:Vr.sprite_vert,fragmentShader:Vr.sprite_frag},background:{uniforms:{uvTransform:{value:new Ft},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Vr.background_vert,fragmentShader:Vr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ft}},vertexShader:Vr.backgroundCube_vert,fragmentShader:Vr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Vr.cube_vert,fragmentShader:Vr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Vr.equirect_vert,fragmentShader:Vr.equirect_frag},distanceRGBA:{uniforms:xr([Gr.common,Gr.displacementmap,{referencePosition:{value:new dn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Vr.distanceRGBA_vert,fragmentShader:Vr.distanceRGBA_frag},shadow:{uniforms:xr([Gr.lights,Gr.fog,{color:{value:new Ci(0)},opacity:{value:1}}]),vertexShader:Vr.shadow_vert,fragmentShader:Vr.shadow_frag}};Wr.physical={uniforms:xr([Wr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ft},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ft},clearcoatNormalScale:{value:new Nt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ft},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ft},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ft},sheen:{value:0},sheenColor:{value:new Ci(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ft},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ft},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ft},transmissionSamplerSize:{value:new Nt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ft},attenuationDistance:{value:0},attenuationColor:{value:new Ci(0)},specularColor:{value:new Ci(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ft},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ft},anisotropyVector:{value:new Nt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ft}}]),vertexShader:Vr.meshphysical_vert,fragmentShader:Vr.meshphysical_frag};const jr={r:0,b:0,g:0},Xr=new Jn,Yr=new Hn;function qr(e,t,n,i,r,a,s){const o=new Ci(0);let l,c,h=!0===a?0:1,d=null,u=0,p=null;function f(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function m(t,n){t.getRGB(jr,yr(e)),i.buffers.color.setClear(jr.r,jr.g,jr.b,n,s)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),h=t,m(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,m(o,h)},render:function(t){let n=!1;const r=f(t);null===r?m(o,h):r&&r.isColor&&(m(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,s),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=f(n);i&&(i.isCubeTexture||i.mapping===H)?(void 0===c&&(c=new mr(new vr(1,1,1),new wr({name:"BackgroundCubeMaterial",uniforms:_r(Wr.backgroundCube.uniforms),vertexShader:Wr.backgroundCube.vertexShader,fragmentShader:Wr.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Xr.copy(n.backgroundRotation),Xr.x*=-1,Xr.y*=-1,Xr.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Xr.y*=-1,Xr.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Yr.makeRotationFromEuler(Xr)),c.material.toneMapped=qt.getTransfer(i.colorSpace)!==lt,d===i&&u===i.version&&p===e.toneMapping||(c.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new mr(new Hr(2,2),new wr({name:"BackgroundMaterial",uniforms:_r(Wr.background.uniforms),vertexShader:Wr.background.vertexShader,fragmentShader:Wr.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=qt.getTransfer(i.colorSpace)!==lt,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),d===i&&u===i.version&&p===e.toneMapping||(l.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}}}function Zr(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e=0){const n=r[t];let i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return a.attributesNum!==o||a.index!==i}(n,m,l,g),v&&function(e,t,n,i){const r={},s=t.attributes;let o=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}a.attributes=r,a.attributesNum=o,a.index=i}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(v||s)&&(s=!1,function(n,i,r,a){h();const s=a.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const i in o){const r=o[i];if(r.location>=0){let o=s[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const i=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,m=h===e.INT||h===e.UNSIGNED_INT||o.gpuType===te;if(o.isInterleavedBufferAttribute){const t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp";const o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===de||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===re&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==J&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==ie&&!r)},precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function Qr(e){const t=this;let n=null,i=0,r=!1,a=!1;const s=new Or,o=new Ft,l={value:null,needsUpdate:!1};function c(e,n,i,r){const a=null!==e?e.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const t=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0),t.numPlanes=i,t.numIntersection=0);else{const e=a?0:i,t=4*e;let r=f.clippingState||null;l.value=r,r=c(d,o,t,h);for(let e=0;e!==t;++e)r[e]=n[e];f.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function $r(e){let t=new WeakMap;function n(e,t){return 303===t?e.mapping=z:304===t&&(e.mapping=k),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(303===a||304===a){if(t.has(r))return n(t.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const s=new Lr(a.height);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}class ea extends br{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const ta=[.125,.215,.35,.446,.526,.582],na=new ea,ia=new Ci;let ra=null,aa=0,sa=0,oa=!1;const la=(1+Math.sqrt(5))/2,ca=1/la,ha=[new dn(-la,ca,0),new dn(la,ca,0),new dn(-ca,0,la),new dn(ca,0,la),new dn(0,la,-ca),new dn(0,la,ca),new dn(-1,1,-1),new dn(1,1,-1),new dn(-1,1,1),new dn(1,1,1)];class da{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,n=.1,i=100){ra=this._renderer.getRenderTarget(),aa=this._renderer.getActiveCubeFace(),sa=this._renderer.getActiveMipmapLevel(),oa=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=ma(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=fa(),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;ee-4?o=ta[s-e+4-1]:0===s&&(o=0),i.push(o);const l=1/(a-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*u),_=new Float32Array(m*p*u),x=new Float32Array(g*p*u);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];v.set(i,f*p*e),_.set(d,m*p*e);const r=[e,e,e,e,e,e];x.set(r,g*p*e)}const y=new Ji;y.setAttribute("position",new ki(v,f)),y.setAttribute("uv",new ki(_,m)),y.setAttribute("faceIndex",new ki(x,g)),t.push(y),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new dn(0,1,0);return new wr({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new mr(this._lodPlanes[0],e);this._renderer.compile(t,na)}_sceneToCubeUV(e,t,n,i){const r=new Ar(90,1,t,n),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(ia),o.toneMapping=C,o.autoClear=!1;const h=new Ui({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new mr(new vr,h);let u=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,u=!0):(h.color.copy(ia),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,a[t],0),r.lookAt(s[t],0,0)):1===n?(r.up.set(0,0,a[t]),r.lookAt(0,s[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,s[t]));const l=this._cubeSize;pa(i,n*l,t>2?l:0,l,l),o.setRenderTarget(i),u&&o.render(d,r),o.render(e,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=c,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===z||e.mapping===k;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=ma()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=fa());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new mr(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const s=this._cubeSize;pa(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,na)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:ev-4?i-v+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(t),o.render(c,na)}}function ua(e,t,n){const i=new on(e,t,n);return i.texture.mapping=H,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function pa(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function fa(){return new wr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function ma(){return new wr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function ga(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,s=303===a||304===a,o=a===z||a===k;if(s||o){let a=t.get(r);const l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new da(e)),a=s?n.fromEquirectangular(r,a):n.fromCubemap(r,a),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;if(void 0!==a)return a.texture;{const l=r.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new da(e)),a=s?n.fromEquirectangular(r):n.fromCubemap(r),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function va(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&Gt("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function _a(e,t,n,i){const r={},a=new WeakMap;function s(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const e in o.attributes)t.remove(o.attributes[e]);for(const e in o.morphAttributes){const n=o.morphAttributes[e];for(let e=0,i=n.length;et.maxTextureSize&&(y=Math.ceil(x/t.maxTextureSize),x=t.maxTextureSize);const S=new Float32Array(x*y*4*h),w=new ln(S,x,y,h);w.type=ie,w.needsUpdate=!0;const b=4*_;for(let T=0;T0)return e;const r=t*n;let a=Ra[r];if(void 0===a&&(a=new Float32Array(r),Ra[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function Oa(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function Is(e,t){const n=function(e){const t=qt.getPrimaries(qt.workingColorSpace),n=qt.getPrimaries(e);let i;switch(t===n?i="":t===ht&&n===ct?i="LinearDisplayP3ToLinearSRGB":t===ct&&n===ht&&(i="LinearSRGBToLinearDisplayP3"),e){case rt:case st:return[i,"LinearTransferOETF"];case it:case at:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[i,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function Us(e,t){let n;switch(t){case L:n="Linear";break;case D:n="Reinhard";break;case I:n="OptimizedCineon";break;case U:n="ACESFilmic";break;case N:n="AgX";break;case F:n="Neutral";break;case O:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Os(e){return""!==e}function Ns(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).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 Fs(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Bs=/^[ \t]*#include +<([\w\d./]+)>/gm;function zs(e){return e.replace(Bs,Hs)}const ks=new Map;function Hs(e,t){let n=Vr[t];if(void 0===n){const e=ks.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=Vr[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return zs(n)}const Vs=/#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 Gs(e){return e.replace(Vs,Ws)}function Ws(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(x+="\n"),y=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v].filter(Os).join("\n"),y.length>0&&(y+="\n")):(x=[js(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Os).join("\n"),y=[js(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+p:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==C?"#define TONE_MAPPING":"",n.toneMapping!==C?Vr.tonemapping_pars_fragment:"",n.toneMapping!==C?Us("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Vr.colorspace_pars_fragment,Is("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Os).join("\n")),c=zs(c),c=Ns(c,n),c=Fs(c,n),h=zs(h),h=Ns(h,n),h=Fs(h,n),c=Gs(c),h=Gs(h),!0!==n.isRawShaderMaterial&&(S="#version 300 es\n",x=[g,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,y=["#define varying in",n.glslVersion===St?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===St?"":"#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"+y);const w=S+x+c,b=S+y+h,M=Rs(o,o.VERTEX_SHADER,w),T=Rs(o,o.FRAGMENT_SHADER,b);function E(t){if(e.debug.checkShaderErrors){const n=o.getProgramInfoLog(_).trim(),i=o.getShaderInfoLog(M).trim(),r=o.getShaderInfoLog(T).trim();let a=!0,s=!0;if(!1===o.getProgramParameter(_,o.LINK_STATUS))if(a=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(o,_,M,T);else{const e=Ds(o,M,"vertex"),i=Ds(o,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(_,o.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==r||(s=!1);s&&(t.diagnostics={runnable:a,programLog:n,vertexShader:{log:i,prefix:x},fragmentShader:{log:r,prefix:y}})}o.deleteShader(M),o.deleteShader(T),L=new Ps(o,_),D=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,q=a.clearcoat>0,Z=a.dispersion>0,K=a.iridescence>0,J=a.sheen>0,Q=a.transmission>0,$=Y&&!!a.anisotropyMap,ee=q&&!!a.clearcoatMap,te=q&&!!a.clearcoatNormalMap,ne=q&&!!a.clearcoatRoughnessMap,ie=K&&!!a.iridescenceMap,re=K&&!!a.iridescenceThicknessMap,ae=J&&!!a.sheenColorMap,se=J&&!!a.sheenRoughnessMap,oe=!!a.specularMap,le=!!a.specularColorMap,ce=!!a.specularIntensityMap,he=Q&&!!a.transmissionMap,de=Q&&!!a.thicknessMap,ue=!!a.gradientMap,pe=!!a.alphaMap,fe=a.alphaTest>0,me=!!a.alphaHash,ge=!!a.extensions;let ve=C;a.toneMapped&&(null!==D&&!0!==D.isXRRenderTarget||(ve=e.toneMapping));const _e={shaderID:b,shaderType:a.type,shaderName:a.name,vertexShader:E,fragmentShader:A,defines:a.defines,customVertexShaderID:P,customFragmentShaderID:R,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:U,batchingColor:U&&null!==v._colorsTexture,instancing:I,instancingColor:I&&null!==v.instanceColor,instancingMorph:I&&null!==v.morphTexture,supportsVertexTextures:u,outputColorSpace:null===D?e.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:rt,alphaToCoverage:!!a.alphaToCoverage,map:O,matcap:N,envMap:F,envMapMode:F&&S.mapping,envMapCubeUVHeight:w,aoMap:B,lightMap:z,bumpMap:k,normalMap:V,displacementMap:u&&G,emissiveMap:W,normalMapObjectSpace:V&&1===a.normalMapType,normalMapTangentSpace:V&&0===a.normalMapType,metalnessMap:j,roughnessMap:X,anisotropy:Y,anisotropyMap:$,clearcoat:q,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,dispersion:Z,iridescence:K,iridescenceMap:ie,iridescenceThicknessMap:re,sheen:J,sheenColorMap:ae,sheenRoughnessMap:se,specularMap:oe,specularColorMap:le,specularIntensityMap:ce,transmission:Q,transmissionMap:he,thicknessMap:de,gradientMap:ue,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:pe,alphaTest:fe,alphaHash:me,combine:a.combine,mapUv:O&&m(a.map.channel),aoMapUv:B&&m(a.aoMap.channel),lightMapUv:z&&m(a.lightMap.channel),bumpMapUv:k&&m(a.bumpMap.channel),normalMapUv:V&&m(a.normalMap.channel),displacementMapUv:G&&m(a.displacementMap.channel),emissiveMapUv:W&&m(a.emissiveMap.channel),metalnessMapUv:j&&m(a.metalnessMap.channel),roughnessMapUv:X&&m(a.roughnessMap.channel),anisotropyMapUv:$&&m(a.anisotropyMap.channel),clearcoatMapUv:ee&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:te&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ie&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:re&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:ae&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:se&&m(a.sheenRoughnessMap.channel),specularMapUv:oe&&m(a.specularMap.channel),specularColorMapUv:le&&m(a.specularColorMap.channel),specularIntensityMapUv:ce&&m(a.specularIntensityMap.channel),transmissionMapUv:he&&m(a.transmissionMap.channel),thicknessMapUv:de&&m(a.thicknessMap.channel),alphaMapUv:pe&&m(a.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(V||Y),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!x.attributes.uv&&(O||pe),fog:!!_,useFog:!0===a.fog,fogExp2:!!_&&_.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:T,morphTextureStride:L,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,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:ve,decodeVideoTexture:O&&!0===a.map.isVideoTexture&&qt.getTransfer(a.map.colorSpace)===lt,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ge&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ge&&!0===a.extensions.multiDraw||U)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return _e.vertexUv1s=c.has(1),_e.vertexUv2s=c.has(2),_e.vertexUv3s=c.has(3),c.clear(),_e},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){o.disableAll(),t.supportsVertexTextures&&o.enable(0),t.instancing&&o.enable(1),t.instancingColor&&o.enable(2),t.instancingMorph&&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.vertexUv1s&&o.enable(13),t.vertexUv2s&&o.enable(14),t.vertexUv3s&&o.enable(15),t.vertexTangents&&o.enable(16),t.anisotropy&&o.enable(17),t.alphaHash&&o.enable(18),t.batching&&o.enable(19),t.dispersion&&o.enable(20),t.batchingColor&&o.enable(21),e.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.doubleSided&&o.enable(10),t.flipSided&&o.enable(11),t.useDepthPacking&&o.enable(12),t.dithering&&o.enable(13),t.transmission&&o.enable(14),t.sheen&&o.enable(15),t.opaque&&o.enable(16),t.pointsUvs&&o.enable(17),t.decodeVideoTexture&&o.enable(18),t.alphaToCoverage&&o.enable(19),e.push(o.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=f[e.type];let n;if(t){const e=Wr[t];n=Sr.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e0?i.push(h):!0===s.transparent?r.push(h):n.push(h)},unshift:function(e,t,s,o,l,c){const h=a(e,t,s,o,l,c);s.transmission>0?i.unshift(h):!0===s.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||Qs),i.length>1&&i.sort(t||$s),r.length>1&&r.sort(t||$s)}}}function to(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new eo,e.set(t,[r])):n>=i.length?(r=new eo,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function no(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new dn,color:new Ci};break;case"SpotLight":n={position:new dn,direction:new dn,color:new Ci,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new dn,color:new Ci,distance:0,decay:0};break;case"HemisphereLight":n={direction:new dn,skyColor:new Ci,groundColor:new Ci};break;case"RectAreaLight":n={color:new Ci,position:new dn,halfWidth:new dn,halfHeight:new dn}}return e[t.id]=n,n}}}let io=0;function ro(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function ao(e){const t=new no,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Nt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Nt,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let e=0;e<9;e++)i.probe.push(new dn);const r=new dn,a=new Hn,s=new Hn;return{setup:function(r){let a=0,s=0,o=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,d=0,u=0,p=0,f=0,m=0,g=0,v=0,_=0;r.sort(ro);for(let e=0,x=r.length;e0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=Gr.LTC_FLOAT_1,i.rectAreaLTC2=Gr.LTC_FLOAT_2):(i.rectAreaLTC1=Gr.LTC_HALF_1,i.rectAreaLTC2=Gr.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=s,i.ambient[2]=o;const x=i.hash;x.directionalLength===l&&x.pointLength===c&&x.spotLength===h&&x.rectAreaLength===d&&x.hemiLength===u&&x.numDirectionalShadows===p&&x.numPointShadows===f&&x.numSpotShadows===m&&x.numSpotMaps===g&&x.numLightProbes===_||(i.directional.length=l,i.spot.length=h,i.rectArea.length=d,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=f,i.spotLightMatrix.length=m+g-v,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=v,i.numLightProbes=_,x.directionalLength=l,x.pointLength=c,x.spotLength=h,x.rectAreaLength=d,x.hemiLength=u,x.numDirectionalShadows=p,x.numPointShadows=f,x.numSpotShadows=m,x.numSpotMaps=g,x.numLightProbes=_,i.version=io++)},setupView:function(e,t){let n=0,o=0,l=0,c=0,h=0;const d=t.matrixWorldInverse;for(let t=0,u=e.length;t=r.length?(a=new so(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}class lo extends Ii{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}}class co extends Ii{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 ho(e,t,n){let r=new Br;const c=new Nt,h=new Nt,d=new an,u=new lo({depthPacking:3201}),p=new co,f={},m=n.maxTextureSize,g={[s]:1,[o]:0,[l]:2},v=new wr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Nt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),_=v.clone();_.defines.HORIZONTAL_PASS=1;const x=new Ji;x.setAttribute("position",new ki(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new mr(x,v),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i;let w=this.type;function b(n,i){const r=t.update(y);v.defines.VSM_SAMPLES!==n.blurSamples&&(v.defines.VSM_SAMPLES=n.blurSamples,_.defines.VSM_SAMPLES=n.blurSamples,v.needsUpdate=!0,_.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new on(c.x,c.y)),v.uniforms.shadow_pass.value=n.map.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,v,y,null),_.uniforms.shadow_pass.value=n.mapPass.texture,_.uniforms.resolution.value=n.mapSize,_.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,_,y,null)}function M(t,n,i,r){let s=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)s=o;else if(s=!0===i.isPointLight?p:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=s.uuid,t=n.uuid;let i=f[e];void 0===i&&(i={},f[e]=i);let r=i[t];void 0===r&&(r=s.clone(),i[t]=r,n.addEventListener("dispose",E)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=r===a?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:g[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(e.properties.get(s).light=i),s}function T(n,i,s,o,l){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&l===a)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=t.update(n),a=n.material;if(Array.isArray(a)){const t=r.groups;for(let c=0,h=t.length;cm||c.y>m)&&(c.x>m&&(h.x=Math.floor(m/g.x),c.x=h.x*g.x,l.mapSize.x=h.x),c.y>m&&(h.y=Math.floor(m/g.y),c.y=h.y*g.y,l.mapSize.y=h.y)),null===l.map||!0===p||!0===f){const e=this.type!==a?{minFilter:j,magFilter:j}:{};null!==l.map&&l.map.dispose(),l.map=new on(c.x,c.y,e),l.map.texture.name=o.name+".shadowMap",l.camera.updateProjectionMatrix()}e.setRenderTarget(l.map),e.clear();const v=l.getViewportCount();for(let e=0;e=1):-1!==q.indexOf("OpenGL ES")&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),X=Y>=2);let Z=null,K={};const J=e.getParameter(e.SCISSOR_BOX),Q=e.getParameter(e.VIEWPORT),$=(new an).fromArray(J),ee=(new an).fromArray(Q);function te(t,n,i,r){const a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;sn||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===d&&(d=f(n,a));const s=t?f(n,a):d;return s.width=n,s.height=a,s.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),s}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function g(e){return e.generateMipmaps&&e.minFilter!==j&&e.minFilter!==q}function v(t){e.generateMipmap(t)}function _(n,i,r,a,s=!1){if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;if(i===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),i===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),i===e.RGBA){const t=s?ot:qt.getTransfer(a);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===lt?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return o!==e.R16F&&o!==e.R32F&&o!==e.RG16F&&o!==e.RG32F&&o!==e.RGBA16F&&o!==e.RGBA32F||t.get("EXT_color_buffer_float"),o}function x(t,n){let i;return t?null===n||n===ne||n===oe?i=e.DEPTH24_STENCIL8:n===ie?i=e.DEPTH32F_STENCIL8:n===ee&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===ne||n===oe?i=e.DEPTH_COMPONENT24:n===ie?i=e.DEPTH_COMPONENT32F:n===ee&&(i=e.DEPTH_COMPONENT16),i}function y(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==j&&e.minFilter!==q?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 S(e){const t=e.target;t.removeEventListener("dispose",S),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=u.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&b(e),0===Object.keys(r).length&&u.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function w(t){const n=t.target;n.removeEventListener("dispose",w),function(t){const n=i.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i0&&a.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}const E={[V]:e.REPEAT,[G]:e.CLAMP_TO_EDGE,[W]:e.MIRRORED_REPEAT},A={[j]:e.NEAREST,[X]:e.NEAREST_MIPMAP_NEAREST,[Y]:e.NEAREST_MIPMAP_LINEAR,[q]:e.LINEAR,[Z]:e.LINEAR_MIPMAP_NEAREST,[K]:e.LINEAR_MIPMAP_LINEAR},P={[ut]:e.NEVER,[xt]:e.ALWAYS,[pt]:e.LESS,[mt]:e.LEQUAL,[ft]:e.EQUAL,[_t]:e.GEQUAL,[gt]:e.GREATER,[vt]:e.NOTEQUAL};function R(n,a){if(a.type!==ie||!1!==t.has("OES_texture_float_linear")||a.magFilter!==q&&a.magFilter!==Z&&a.magFilter!==Y&&a.magFilter!==K&&a.minFilter!==q&&a.minFilter!==Z&&a.minFilter!==Y&&a.minFilter!==K||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,E[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,E[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,E[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,A[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,A[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,P[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(a.magFilter===j)return;if(a.minFilter!==Y&&a.minFilter!==K)return;if(a.type===ie&&!1===t.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function C(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",S));const r=n.source;let a=u.get(r);void 0===a&&(a={},u.set(r,a));const o=function(e){const t=[];return 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.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&b(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return i}function L(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);const c=C(t,s),h=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);const d=i.get(h);if(h.version!==d.__version||!0===c){n.activeTexture(e.TEXTURE0+o);const t=qt.getPrimaries(qt.workingColorSpace),i=s.colorSpace===nt?null:qt.getPrimaries(s.colorSpace),u=s.colorSpace===nt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=m(s.image,!1,r.maxTextureSize);p=z(s,p);const f=a.convert(s.format,s.colorSpace),S=a.convert(s.type);let w,b=_(s.internalFormat,f,S,s.colorSpace,s.isVideoTexture);R(l,s);const M=s.mipmaps,T=!0!==s.isVideoTexture,E=void 0===d.__version||!0===c,A=h.dataReady,P=y(s,p);if(s.isDepthTexture)b=x(s.format===me,s.type),E&&(T?n.texStorage2D(e.TEXTURE_2D,1,b,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,b,p.width,p.height,0,f,S,null));else if(s.isDataTexture)if(M.length>0){T&&E&&n.texStorage2D(e.TEXTURE_2D,P,b,M[0].width,M[0].height);for(let t=0,i=M.length;t0){const i=po(w.width,w.height,s.format,s.type);for(const r of s.layerUpdates){const a=w.data.subarray(r*i/w.data.BYTES_PER_ELEMENT,(r+1)*i/w.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,r,w.width,w.height,1,f,a,0,0)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,w.width,w.height,p.depth,f,w.data,0,0)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,b,w.width,w.height,p.depth,0,w.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?A&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,w.width,w.height,p.depth,f,S,w.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,b,w.width,w.height,p.depth,0,f,S,w.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,P,b,M[0].width,M[0].height);for(let t=0,i=M.length;t0){const t=po(p.width,p.height,s.format,s.type);for(const i of s.layerUpdates){const r=p.data.subarray(i*t/p.data.BYTES_PER_ELEMENT,(i+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,f,S,r)}s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,f,S,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,b,p.width,p.height,p.depth,0,f,S,p.data);else if(s.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,P,b,p.width,p.height,p.depth),A&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,f,S,p.data)):n.texImage3D(e.TEXTURE_3D,0,b,p.width,p.height,p.depth,0,f,S,p.data);else if(s.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,P,b,p.width,p.height);else{let t=p.width,i=p.height;for(let r=0;r>=1,i>>=1}}else if(M.length>0){if(T&&E){const t=k(M[0]);n.texStorage2D(e.TEXTURE_2D,P,b,t.width,t.height)}for(let t=0,i=M.length;t>h),i=Math.max(1,r.height>>h);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?n.texImage3D(c,h,p,t,i,r.depth,0,d,u,null):n.texImage2D(c,h,p,t,i,0,d,u,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),B(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,c,i.get(s).__webglTexture,0,F(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,c,i.get(s).__webglTexture,h),n.bindFramebuffer(e.FRAMEBUFFER,null)}function I(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=x(n.stencilBuffer,a),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=F(n);B(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,s,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function z(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==rt&&n!==nt&&(qt.getTransfer(n)===lt?i===de&&r===J||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function k(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){const e=M;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),M+=1,e},this.resetTextureUnits=function(){M=0},this.setTexture2D=T,this.setTexture2DArray=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?L(a,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?L(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;const l=C(t,s),c=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+o);const t=qt.getPrimaries(qt.workingColorSpace),i=s.colorSpace===nt?null:qt.getPrimaries(s.colorSpace),d=s.colorSpace===nt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const u=s.isCompressedTexture||s.image[0].isCompressedTexture,p=s.image[0]&&s.image[0].isDataTexture,f=[];for(let e=0;e<6;e++)f[e]=u||p?p?s.image[e].image:s.image[e]:m(s.image[e],!0,r.maxCubemapSize),f[e]=z(s,f[e]);const x=f[0],S=a.convert(s.format,s.colorSpace),w=a.convert(s.type),b=_(s.internalFormat,S,w,s.colorSpace),M=!0!==s.isVideoTexture,T=void 0===h.__version||!0===l,E=c.dataReady;let A,P=y(s,x);if(R(e.TEXTURE_CUBE_MAP,s),u){M&&T&&n.texStorage2D(e.TEXTURE_CUBE_MAP,P,b,x.width,x.height);for(let t=0;t<6;t++){A=f[t].mipmaps;for(let i=0;i0&&P++;const t=k(f[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,P,b,t.width,t.height)}for(let t=0;t<6;t++)if(p){M?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,f[t].width,f[t].height,S,w,f[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,b,f[t].width,f[t].height,0,S,w,f[t].data);for(let i=0;i1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),h){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n0){o.__webglFramebuffer=[];for(let t=0;t0&&!1===B(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let n=0;n0)if(!1===B(t)){const r=t.textures,a=t.width,s=t.height;let o=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),d=r.length>1;if(d)for(let t=0;to+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==s&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(_o)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new vo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class yo{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new rn;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new wr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new mr(new Hr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class So extends Mt{constructor(e,t){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,c=null,h=null,d=null,u=null,p=null;const f=new yo,m=t.getContextAttributes();let g=null,v=null;const _=[],x=[],y=new Nt;let S=null;const w=new Ar;w.layers.enable(1),w.viewport=new an;const b=new Ar;b.layers.enable(2),b.viewport=new an;const M=[w,b],T=new go;T.layers.enable(1),T.layers.enable(2);let E=null,A=null;function P(e){const t=x.indexOf(e.inputSource);if(-1===t)return;const n=_[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function R(){i.removeEventListener("select",P),i.removeEventListener("selectstart",P),i.removeEventListener("selectend",P),i.removeEventListener("squeeze",P),i.removeEventListener("squeezestart",P),i.removeEventListener("squeezeend",P),i.removeEventListener("end",R),i.removeEventListener("inputsourceschange",C);for(let e=0;e<_.length;e++){const t=x[e];null!==t&&(x[e]=null,_[e].disconnect(t))}E=null,A=null,f.reset(),e.setRenderTarget(g),u=null,d=null,h=null,i=null,v=null,O.stop(),n.isPresenting=!1,e.setPixelRatio(S),e.setSize(y.width,y.height,!1),n.dispatchEvent({type:"sessionend"})}function C(e){for(let t=0;t=0&&(x[i]=null,_[i].disconnect(n))}for(let t=0;t=x.length){x.push(n),i=e;break}if(null===x[e]){x[e]=n,i=e;break}}if(-1===i)break}const r=_[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=_[e];return void 0===t&&(t=new xo,_[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=_[e];return void 0===t&&(t=new xo,_[e]=t),t.getGripSpace()},this.getHand=function(e){let t=_[e];return void 0===t&&(t=new xo,_[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(g=e.getRenderTarget(),i.addEventListener("select",P),i.addEventListener("selectstart",P),i.addEventListener("selectend",P),i.addEventListener("squeeze",P),i.addEventListener("squeezestart",P),i.addEventListener("squeezeend",P),i.addEventListener("end",R),i.addEventListener("inputsourceschange",C),!0!==m.xrCompatible&&await t.makeXRCompatible(),S=e.getPixelRatio(),e.getSize(y),void 0===i.renderState.layers){const n={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:u}),e.setPixelRatio(1),e.setSize(u.framebufferWidth,u.framebufferHeight,!1),v=new on(u.framebufferWidth,u.framebufferHeight,{format:de,type:J,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let n=null,a=null,s=null;m.depth&&(s=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=m.stencil?me:fe,a=m.stencil?oe:ne);const o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(o),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),v=new on(d.textureWidth,d.textureHeight,{format:de,type:J,depthTexture:new ba(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:!1===d.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),O.setContext(i),O.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};const L=new dn,D=new dn;function I(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===i)return;null!==f.texture&&(e.near=f.depthNear,e.far=f.depthFar),T.near=b.near=w.near=e.near,T.far=b.far=w.far=e.far,E===T.near&&A===T.far||(i.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,A=T.far,w.near=E,w.far=A,b.near=E,b.far=A,w.updateProjectionMatrix(),b.updateProjectionMatrix(),e.updateProjectionMatrix());const t=e.parent,n=T.cameras;I(T,t);for(let e=0;e0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,wo.copy(s),wo.x*=-1,wo.y*=-1,wo.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(wo.y*=-1,wo.z*=-1),e.envMapRotation.value.setFromMatrix4(bo.makeRotationFromEuler(wo)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,yr(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,s,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,o)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,s):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function To(e,t,n,i){let r={},a={},s=[];const o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return i[a]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==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 h(t){const n=t.target;n.removeEventListener("dispose",h);const i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,d){let u=r[n.id];void 0===u&&(function(e){const t=e.uniforms;let n=0;for(let e=0,i=t.length;e0&&(n+=16-i),e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Ao{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=yt,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Pt()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return Gt("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei)return;sl.applyMatrix4(e.matrixWorld);const o=t.ray.origin.distanceTo(sl);return ot.far?void 0:{distance:o,point:ol.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,object:e}}const hl=new dn,dl=new dn;class ul extends ll{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,object:s})}}class Sl{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let a;a=t||e*n[r-1];let s,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),s=n[i]-a,s<0)o=i+1;else{if(!(s>0)){l=i;break}l=i-1}if(i=l,n[i]===a)return i/(r-1);const c=n[i];return(i+(a-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const a=this.getPoint(i),s=this.getPoint(r),o=t||(a.isVector2?new Nt:new dn);return o.copy(s).sub(a).normalize(),o}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new dn,i=[],r=[],a=[],s=new dn,o=new Hn;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new dn)}r[0]=new dn,a[0]=new dn;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),a[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(i[t-1],i[t]),s.length()>Number.EPSILON){s.normalize();const e=Math.acos(Rt(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(Rt(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class wl extends Sl{constructor(e=0,t=0,n=1,i=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new Nt){const n=t,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?s=i[(l-1)%r]:(Ml.subVectors(i[0],i[1]).add(i[0]),s=Ml);const h=i[l%r],d=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return n.set(Rl(s,o.x,l.x,c.x,h.x),Rl(s,o.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t0&&v(!0),t>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new Gi(h,3)),this.setAttribute("normal",new Gi(d,3)),this.setAttribute("uv",new Gi(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ol(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Nl extends Ji{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],a=[];function s(e,t,n,i){const r=i+1,a=[];for(let i=0;i<=r;i++){a[i]=[];const s=e.clone().lerp(n,i/r),o=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)a[i][e]=0===e&&i===r?s:s.clone().lerp(o,e/l)}for(let e=0;e.9&&s<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new Gi(r,3)),this.setAttribute("normal",new Gi(r.slice(),3)),this.setAttribute("uv",new Gi(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Nl(e.vertices,e.indices,e.radius,e.details)}}class Fl extends Nl{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 Fl(e.radius,e.detail)}}class Bl extends Ji{constructor(e=.5,t=1,n=32,i=1,r=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},n=Math.max(3,n);const s=[],o=[],l=[],c=[];let h=e;const d=(t-e)/(i=Math.max(1,i)),u=new dn,p=new Nt;for(let e=0;e<=i;e++){for(let e=0;e<=n;e++){const i=r+e/n*a;u.x=h*Math.cos(i),u.y=h*Math.sin(i),o.push(u.x,u.y,u.z),l.push(0,0,1),p.x=(u.x/t+1)/2,p.y=(u.y/t+1)/2,c.push(p.x,p.y)}h+=d}for(let e=0;e0)&&u.push(t,r,l),(e!==n-1||o0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class jl extends Ii{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ci(16777215),this.specular=new Ci(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ci(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Nt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jn,this.combine=A,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Xl extends Ii{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Nt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Yl extends Ii{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ci(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ci(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Nt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jn,this.combine=A,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function ql(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function Zl(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n}function Kl(e,t,n){const i=e.length,r=new e.constructor(i);for(let a=0,s=0;s!==i;++a){const i=n[a]*t;for(let n=0;n!==t;++n)r[s++]=e[i+n]}return r}function Jl(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do{s=a[i],void 0!==s&&(t.push(a.time),n.push.apply(n,s)),a=e[r++]}while(void 0!==a);else if(void 0!==s.toArray)do{s=a[i],void 0!==s&&(t.push(a.time),s.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{s=a[i],void 0!==s&&(t.push(a.time),n.push(s)),a=e[r++]}while(void 0!==a)}class Ql{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e=r)break e;{const s=t[1];e=r)break t}a=n,n=0}}for(;n>>1;et;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&(s=i,ArrayBuffer.isView(s)&&!(s instanceof DataView)))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}var s;return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===tt,r=e.length-1;let a=1;for(let s=1;s0){e[a]=e[r];for(let e=r*n,i=a*n,s=0;s!==n;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}nc.prototype.TimeBufferType=Float32Array,nc.prototype.ValueBufferType=Float32Array,nc.prototype.DefaultInterpolation=et;class ic extends nc{constructor(e,t,n){super(e,t,n)}}ic.prototype.ValueTypeName="bool",ic.prototype.ValueBufferType=Array,ic.prototype.DefaultInterpolation=$e,ic.prototype.InterpolantFactoryMethodLinear=void 0,ic.prototype.InterpolantFactoryMethodSmooth=void 0;class rc extends nc{}rc.prototype.ValueTypeName="color";class ac extends nc{}ac.prototype.ValueTypeName="number";class sc extends Ql{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(i-t);let l=e*s;for(let e=l+s;l!==e;l+=4)hn.slerpFlat(r,0,a,l-s,a,l,o);return r}}class oc extends nc{InterpolantFactoryMethodLinear(e){return new sc(this.times,this.values,this.getValueSize(),e)}}oc.prototype.ValueTypeName="quaternion",oc.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends nc{constructor(e,t,n){super(e,t,n)}}lc.prototype.ValueTypeName="string",lc.prototype.ValueBufferType=Array,lc.prototype.DefaultInterpolation=$e,lc.prototype.InterpolantFactoryMethodLinear=void 0,lc.prototype.InterpolantFactoryMethodSmooth=void 0;class cc extends nc{}cc.prototype.ValueTypeName="vector";class hc{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Pt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(dc(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(nc.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let e=0;e1){const e=a[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const a=[];for(const e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const a=[],s=[];Jl(n,a,s,i),0!==a.length&&r.push(new e(t,a,s))}},i=[],r=e.name||"default",a=e.fps||30,s=e.blendMode;let o=e.length||-1;const l=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==gc[e])return void gc[e].push({onLoad:t,onProgress:n,onError:i});gc[e]=[],gc[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,o=this.responseType;fetch(a).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=gc[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,s=0!==a;let o=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:a});for(let e=0,t=n.length;e{e.error(t)}))}()}});return new Response(l)}throw new vc(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)})).then((e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,s)));case"json":return e.json();default:if(void 0===s)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{uc.add(e,t);const n=gc[e];delete gc[e];for(let e=0,i=n.length;e{const n=gc[e];if(void 0===n)throw this.manager.itemError(e),t;delete gc[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class xc extends mc{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=uc.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;const s=kt("img");function o(){c(),uc.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(e),s.src=e,s}}class yc extends mc{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Ho,s=new _c(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(r.withCredentials),s.load(e,(function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:G,a.wrapT=void 0!==n.wrapT?n.wrapT:G,a.magFilter=void 0!==n.magFilter?n.magFilter:q,a.minFilter=void 0!==n.minFilter?n.minFilter:q,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(a.colorSpace=n.colorSpace),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=K),1===n.mipmapCount&&(a.minFilter=q),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)}),n,i),a}}class Sc extends mc{constructor(e){super(e)}load(e,t,n,i){const r=new rn,a=new xc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}class wc extends fi{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ci(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(t.object.target=this.target.uuid),t}}const bc=new Hn,Mc=new dn,Tc=new dn;class Ec{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Nt(512,512),this.map=null,this.mapPass=null,this.matrix=new Hn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Br,this._frameExtents=new Nt(1,1),this._viewportCount=1,this._viewports=[new an(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Mc.setFromMatrixPosition(e.matrixWorld),t.position.copy(Mc),Tc.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Tc),t.updateMatrixWorld(),bc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(bc)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Ac extends Ec{constructor(){super(new Ar(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*At*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Pc extends wc{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(fi.DEFAULT_UP),this.updateMatrix(),this.target=new fi,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new Ac}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Rc=new Hn,Cc=new dn,Lc=new dn;class Dc extends Ec{constructor(){super(new Ar(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Nt(4,2),this._viewportCount=6,this._viewports=[new an(2,1,1,1),new an(0,1,1,1),new an(3,1,1,1),new an(1,1,1,1),new an(3,0,1,1),new an(1,0,1,1)],this._cubeDirections=[new dn(1,0,0),new dn(-1,0,0),new dn(0,0,1),new dn(0,0,-1),new dn(0,1,0),new dn(0,-1,0)],this._cubeUps=[new dn(0,1,0),new dn(0,1,0),new dn(0,1,0),new dn(0,1,0),new dn(0,0,1),new dn(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Cc.setFromMatrixPosition(e.matrixWorld),n.position.copy(Cc),Lc.copy(n.position),Lc.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Lc),n.updateMatrixWorld(),i.makeTranslation(-Cc.x,-Cc.y,-Cc.z),Rc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Rc)}}class Ic extends wc{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Dc}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Uc extends Ec{constructor(){super(new ea(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Oc extends wc{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(fi.DEFAULT_UP),this.updateMatrix(),this.target=new fi,this.shadow=new Uc}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Nc extends wc{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Fc extends wc{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Bc{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n{t&&t(n),r.manager.itemEnd(e)})).catch((e=>{i&&i(e)})):(setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a);const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader;const o=fetch(e,s).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return uc.add(e,n),t&&t(n),r.manager.itemEnd(e),n})).catch((function(t){i&&i(t),uc.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)}));uc.add(e,o),r.manager.itemStart(e)}}const kc="\\[\\]\\.:\\/",Hc=new RegExp("["+kc+"]","g"),Vc="[^"+kc+"]",Gc="[^"+kc.replace("\\.","")+"]",Wc=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Vc)+/(WCOD+)?/.source.replace("WCOD",Gc)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Vc)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Vc)+"$"),jc=["material","materials","bones","map"];class Xc{constructor(e,t,n){this.path=t,this.parsedPath=n||Xc.parseTrackName(t),this.node=Xc.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Xc.Composite(e,t,n):new Xc(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Hc,"")}static parseTrackName(e){const t=Wc.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==jc.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i{var t;switch(e.type){default:break;case"ambient":const n=new Nc(new Ci(e.color),0);this._lightSources.push(n);break;case"rectArea":const r=new dn(e.position.x,e.position.y,e.position.z);if(this.lightSourceScale&&r.length()this._scene.add(e)))}removeFromScene(){this._lightSources.forEach((e=>this._scene.remove(e)))}reload(){this.removeFromScene(),this.addToScene()}}nh.noLightSources=[],nh.defaultLightSources=[{type:"ambient",color:"#ffffff"},{type:"rectArea",position:{x:0,y:5,z:3},color:"#ffffff",intensity:60,castShadow:!0},{type:"rectArea",position:{x:-5,y:3,z:2},color:"#ffffff",intensity:60,castShadow:!1}],nh.fifeLightSources=[{type:"ambient",color:"#ffffff"},{type:"rectArea",position:{x:0,y:5,z:0},color:"#ffffff",intensity:40,castShadow:!0},{type:"rectArea",position:{x:5,y:5,z:5},color:"#ffffff",intensity:60,castShadow:!0},{type:"rectArea",position:{x:-5,y:5,z:5},color:"#ffffff",intensity:60,castShadow:!0},{type:"rectArea",position:{x:5,y:5,z:-5},color:"#ffffff",intensity:60,castShadow:!0},{type:"rectArea",position:{x:-5,y:5,z:-5},color:"#ffffff",intensity:60,castShadow:!0}];const ih={uniforms:{tDiffuse:{value:null},colorTransform:{value:new Hn},colorBase:{value:new an(0,0,0,0)},multiplyChannels:{value:0},uvTransform:{value:new Ft}},vertexShader:"\n varying vec2 vUv;\n uniform mat3 uvTransform;\n \n void main() {\n vUv = (uvTransform * vec3(uv, 1.0)).xy;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform mat4 colorTransform;\n uniform vec4 colorBase;\n uniform float multiplyChannels;\n varying vec2 vUv;\n \n void main() {\n vec4 color = texture2D(tDiffuse, vUv);\n #if PREMULTIPLIED_ALPHA == 1\n if (color.a > 0.0) color.rgb /= color.a;\n #endif\n color = colorTransform * color + colorBase;\n color.rgb = mix(color.rgb, vec3(color.r * color.g * color.b), multiplyChannels);\n #if LINEAR_TO_SRGB == 1\n color.rgb = mix(color.rgb * 12.92, 1.055 * pow(color.rgb, vec3(0.41666)) - 0.055, step(0.0031308, color.rgb));\n #endif\n gl_FragColor = color;\n }"},rh=new Hn,ah=(new Hn).set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0),sh=(new Hn).set(0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0),oh=(new Hn).set(1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1),lh=((new Hn).set(0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1),(new Hn).set(0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1),(new Hn).set(1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1)),ch=new an(0,0,0,0),hh=new an(0,0,0,1),dh=new Ft,uh=(new Ft).set(1,0,0,0,-1,1,0,0,1),ph="additive";class fh extends wr{constructor(e,t=ph,n=!1,i=!1){const r=t===ph?{blendSrc:y,blendDst:u,blendEquation:c,blendSrcAlpha:_,blendDstAlpha:u,blendEquationAlpha:c}:{};super(Object.assign({uniforms:Sr.clone(ih.uniforms),vertexShader:ih.vertexShader,fragmentShader:ih.fragmentShader,defines:{LINEAR_TO_SRGB:n?1:0,PREMULTIPLIED_ALPHA:i?1:0},transparent:!0,depthTest:!1,depthWrite:!1},r)),this.update(e)}update(e){return void 0!==(null==e?void 0:e.texture)&&(this.uniforms.tDiffuse.value=null==e?void 0:e.texture),void 0!==(null==e?void 0:e.colorTransform)&&(this.uniforms.colorTransform.value=null==e?void 0:e.colorTransform),void 0!==(null==e?void 0:e.colorBase)&&(this.uniforms.colorBase.value=null==e?void 0:e.colorBase),void 0!==(null==e?void 0:e.multiplyChannels)&&(this.uniforms.multiplyChannels.value=null==e?void 0:e.multiplyChannels),void 0!==(null==e?void 0:e.uvTransform)&&(this.uniforms.uvTransform.value=null==e?void 0:e.uvTransform),void 0!==(null==e?void 0:e.blending)&&(this.blending=null==e?void 0:e.blending),void 0!==(null==e?void 0:e.blendSrc)&&(this.blendSrc=null==e?void 0:e.blendSrc),void 0!==(null==e?void 0:e.blendDst)&&(this.blendDst=null==e?void 0:e.blendDst),void 0!==(null==e?void 0:e.blendEquation)&&(this.blendEquation=null==e?void 0:e.blendEquation),void 0!==(null==e?void 0:e.blendSrcAlpha)&&(this.blendSrcAlpha=null==e?void 0:e.blendSrcAlpha),void 0!==(null==e?void 0:e.blendDstAlpha)&&(this.blendDstAlpha=null==e?void 0:e.blendDstAlpha),void 0!==(null==e?void 0:e.blendEquationAlpha)&&(this.blendEquationAlpha=null==e?void 0:e.blendEquationAlpha),this}}const mh={uniforms:{tDiffuse:{value:null},rangeMin:{value:new Nt(1/512,1/512)},rangeMax:{value:new Nt(1/512,1/512)}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform vec2 rangeMin;\n uniform vec2 rangeMax;\n varying vec2 vUv;\n \n void main() {\n vec4 baseColor = texture2D(tDiffuse, vUv);\n vec2 blur = mix(rangeMax, rangeMin, baseColor.a);\n vec4 sum = vec4( 0.0 );\n sum += texture2D(tDiffuse, vUv - 1.0 * blur) * 0.051;\n sum += texture2D(tDiffuse, vUv - 0.75 * blur) * 0.0918;\n sum += texture2D(tDiffuse, vUv - 0.5 * blur) * 0.12245;\n sum += texture2D(tDiffuse, vUv - 0.25 * blur) * 0.1531;\n sum += baseColor * 0.1633;\n sum += texture2D(tDiffuse, vUv + 0.25 * blur) * 0.1531;\n sum += texture2D(tDiffuse, vUv + 0.5 * blur) * 0.12245;\n sum += texture2D(tDiffuse, vUv + 0.75 * blur) * 0.0918;\n sum += texture2D(tDiffuse, vUv + 1.0 * blur) * 0.051;\n gl_FragColor = sum;\n }"};new Nt(.1,.9),new Nt(.1,.9);class gh extends wr{constructor(e){super({defines:Object.assign({},gh._linearDepthShader.defines),uniforms:Sr.clone(gh._linearDepthShader.uniforms),vertexShader:gh._linearDepthShader.vertexShader,fragmentShader:gh._linearDepthShader.fragmentShader,blending:0}),this.update(e)}update(e){if(void 0!==(null==e?void 0:e.depthTexture)&&(this.uniforms.tDepth.value=null==e?void 0:e.depthTexture),void 0!==(null==e?void 0:e.camera)){const t=(null==e?void 0:e.camera)||(null==e?void 0:e.camera);this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far}return void 0!==(null==e?void 0:e.depthFilter)&&(this.uniforms.depthFilter.value=null==e?void 0:e.depthFilter),this}}gh._linearDepthShader={uniforms:{tDepth:{value:null},depthFilter:{value:new an(1,0,0,0)},cameraNear:{value:.1},cameraFar:{value:1}},defines:{PERSPECTIVE_CAMERA:1,ALPHA_DEPTH:0},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"uniform sampler2D tDepth;\n uniform vec4 depthFilter;\n uniform float cameraNear;\n uniform float cameraFar;\n varying vec2 vUv;\n \n #include \n \n float getLinearDepth(const in vec2 screenPosition) {\n float fragCoordZ = dot(texture2D(tDepth, screenPosition), depthFilter);\n #if PERSPECTIVE_CAMERA == 1\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return fragCoordZ;\n #endif\n }\n \n void main() {\n float depth = getLinearDepth(vUv);\n gl_FragColor = vec4(vec3(1.0 - depth), 1.0);\n }"};class vh{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const _h=new ea(-1,1,1,-1,0,1),xh=new class extends Ji{constructor(){super(),this.setAttribute("position",new Gi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Gi([0,2,0,0,2,0],2))}};class yh{constructor(e){this._mesh=new mr(xh,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,_h)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Sh{constructor(e=Math){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.grad4=[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]],this.p=[];for(let t=0;t<256;t++)this.p[t]=Math.floor(256*e.random());this.perm=[];for(let e=0;e<512;e++)this.perm[e]=this.p[255&e];this.simplex=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]}dot(e,t,n){return e[0]*t+e[1]*n}dot3(e,t,n,i){return e[0]*t+e[1]*n+e[2]*i}dot4(e,t,n,i,r){return e[0]*t+e[1]*n+e[2]*i+e[3]*r}noise(e,t){let n,i,r;const a=(e+t)*(.5*(Math.sqrt(3)-1)),s=Math.floor(e+a),o=Math.floor(t+a),l=(3-Math.sqrt(3))/6,c=(s+o)*l,h=e-(s-c),d=t-(o-c);let u,p;h>d?(u=1,p=0):(u=0,p=1);const f=h-u+l,m=d-p+l,g=h-1+2*l,v=d-1+2*l,_=255&s,x=255&o,y=this.perm[_+this.perm[x]]%12,S=this.perm[_+u+this.perm[x+p]]%12,w=this.perm[_+1+this.perm[x+1]]%12;let b=.5-h*h-d*d;b<0?n=0:(b*=b,n=b*b*this.dot(this.grad3[y],h,d));let M=.5-f*f-m*m;M<0?i=0:(M*=M,i=M*M*this.dot(this.grad3[S],f,m));let T=.5-g*g-v*v;return T<0?r=0:(T*=T,r=T*T*this.dot(this.grad3[w],g,v)),70*(n+i+r)}noise3d(e,t,n){let i,r,a,s;const o=(e+t+n)*(1/3),l=Math.floor(e+o),c=Math.floor(t+o),h=Math.floor(n+o),d=1/6,u=(l+c+h)*d,p=e-(l-u),f=t-(c-u),m=n-(h-u);let g,v,_,x,y,S;p>=f?f>=m?(g=1,v=0,_=0,x=1,y=1,S=0):p>=m?(g=1,v=0,_=0,x=1,y=0,S=1):(g=0,v=0,_=1,x=1,y=0,S=1):fS?32:0)+(y>w?16:0)+(S>w?8:0)+(y>b?4:0)+(S>b?2:0)+(w>b?1:0),T=a[M][0]>=3?1:0,E=a[M][1]>=3?1:0,A=a[M][2]>=3?1:0,P=a[M][3]>=3?1:0,R=a[M][0]>=2?1:0,C=a[M][1]>=2?1:0,L=a[M][2]>=2?1:0,D=a[M][3]>=2?1:0,I=a[M][0]>=1?1:0,U=a[M][1]>=1?1:0,O=a[M][2]>=1?1:0,N=a[M][3]>=1?1:0,F=y-T+l,B=S-E+l,z=w-A+l,k=b-P+l,H=y-R+2*l,V=S-C+2*l,G=w-L+2*l,W=b-D+2*l,j=y-I+3*l,X=S-U+3*l,Y=w-O+3*l,q=b-N+3*l,Z=y-1+4*l,K=S-1+4*l,J=w-1+4*l,Q=b-1+4*l,$=255&m,ee=255&g,te=255&v,ne=255&_,ie=s[$+s[ee+s[te+s[ne]]]]%32,re=s[$+T+s[ee+E+s[te+A+s[ne+P]]]]%32,ae=s[$+R+s[ee+C+s[te+L+s[ne+D]]]]%32,se=s[$+I+s[ee+U+s[te+O+s[ne+N]]]]%32,oe=s[$+1+s[ee+1+s[te+1+s[ne+1]]]]%32;let le=.6-y*y-S*S-w*w-b*b;le<0?c=0:(le*=le,c=le*le*this.dot4(r[ie],y,S,w,b));let ce=.6-F*F-B*B-z*z-k*k;ce<0?h=0:(ce*=ce,h=ce*ce*this.dot4(r[re],F,B,z,k));let he=.6-H*H-V*V-G*G-W*W;he<0?d=0:(he*=he,d=he*he*this.dot4(r[ae],H,V,G,W));let de=.6-j*j-X*X-Y*Y-q*q;de<0?u=0:(de*=de,u=de*de*this.dot4(r[se],j,X,Y,q));let ue=.6-Z*Z-K*K-J*J-Q*Q;return ue<0?p=0:(ue*=ue,p=ue*ue*this.dot4(r[oe],Z,K,J,Q)),27*(c+h+d+u+p)}}const wh=new Sc,bh=e=>{const t=new Uint8Array([Math.floor(255*e.r),Math.floor(255*e.g),Math.floor(255*e.b),255]),n=new Ho(t,1,1);return n.needsUpdate=!0,n},Mh=(e,t,n)=>{n&&e(bh(n)),t&&wh.load(t,e)};class Th{constructor(){this.bounds=new fn(new dn(-1,-1,-1),new dn(1,1,1)),this.size=new dn(2,2,2),this.center=new dn(0,0,0),this.maxSceneDistanceFromCenter=Math.sqrt(3),this.maxSceneDistanceFrom0=Math.sqrt(3)}copyFrom(e){this.bounds.copy(e.bounds),this.size.copy(e.size),this.center.copy(e.center),this.maxSceneDistanceFromCenter=e.maxSceneDistanceFromCenter,this.maxSceneDistanceFrom0=e.maxSceneDistanceFrom0}updateFromObject(e){e.updateMatrixWorld(),this.bounds.setFromObject(e),this.updateFromBox(this.bounds)}updateFromBox(e){this.bounds!==e&&this.bounds.copy(e),this.bounds.getSize(this.size),this.bounds.getCenter(this.center),this.maxSceneDistanceFromCenter=this.size.length()/2,this.maxSceneDistanceFrom0=new dn(Math.max(Math.abs(this.bounds.min.x),Math.abs(this.bounds.max.x)),Math.max(Math.abs(this.bounds.min.y),Math.abs(this.bounds.max.y)),Math.max(Math.abs(this.bounds.min.z),Math.abs(this.bounds.max.z))).length()}updateCameraViewVolumeFromBounds(e){e.updateMatrixWorld();const t=this.bounds.clone().applyMatrix4(e.matrixWorldInverse);e instanceof ea?((e,t)=>{e.left=t.min.x,e.right=t.max.x,e.bottom=t.min.y,e.top=t.max.y,e.near=Math.min(-t.min.z,-t.max.z),e.far=Math.max(-t.min.z,-t.max.z),e.updateProjectionMatrix()})(e,t):e instanceof Ar&&((e,t)=>{const n=Math.min(-t.min.z,-t.max.z),i=Math.max(-t.min.z,-t.max.z);if(n<.001)return;const r=Math.max(Math.abs(t.min.x),Math.abs(t.max.x)),a=Math.max(Math.abs(t.min.y),Math.abs(t.max.y));e.aspect=r/a,e.fov=Ot(2*Math.atan2(a,n)),e.near=n,e.far=i,e.updateProjectionMatrix()})(e,t)}getNearAndFarForPerspectiveCamera(e,t=1){const n=e.clone().sub(this.center).length();return[Math.max(.01,n-this.maxSceneDistanceFromCenter-.01),n+this.maxSceneDistanceFromCenter*t+.01]}}const Eh=e=>e.capabilities.maxSamples;class Ah{changed(e){var t,n;const i=!(null===(t=this._lastCameraProjection)||void 0===t?void 0:t.equals(e.projectionMatrix))||!(null===(n=this._lastCameraWorld)||void 0===n?void 0:n.equals(e.matrixWorld));return this._lastCameraProjection=e.projectionMatrix.clone(),this._lastCameraWorld=e.matrixWorld.clone(),i}}class Ph{constructor(){this._originalClearColor=new Ci,this._originalClearAlpha=0,this._originalAutoClear=!1,this._originalRenderTarget=null,this._screenSpaceQuad=new yh(void 0),this._emptyScene=new Eo,this._defaultCamera=new Ar}renderWithOverrideMaterial(e,t,n,i,r,a,s){this._backup(e),this._prepareRenderer(e,r,a,s);const o=t.overrideMaterial;t.overrideMaterial=i,e.render(t,n),t.overrideMaterial=o,this._restore(e)}clear(e,t,n,i){this._backup(e),this._prepareRenderer(e,t,n,i),e.render(this._emptyScene,this._defaultCamera),this._restore(e)}render(e,t,n,i,r,a){this._backup(e),this._prepareRenderer(e,i,r,a),e.render(t,n),this._restore(e)}renderScreenSpace(e,t,n,i,r){this._backup(e),this._prepareRenderer(e,n,i,r),this._screenSpaceQuad.material=t,this._screenSpaceQuad.render(e),this._restore(e)}_prepareRenderer(e,t,n,i){e.setRenderTarget(t),e.autoClear=!1,null!=n&&(e.setClearColor(n),e.setClearAlpha(i||0),e.clear())}_backup(e){e.getClearColor(this._originalClearColor),this._originalClearAlpha=e.getClearAlpha(),this._originalAutoClear=e.autoClear,this._originalRenderTarget=e.getRenderTarget()}_restore(e){e.setClearColor(this._originalClearColor),e.setClearAlpha(this._originalClearAlpha),e.setRenderTarget(this._originalRenderTarget),e.autoClear=this._originalAutoClear}}class Rh{constructor(e,t){var n;this._passRenderer=null!==(n=null==t?void 0:t.passRenderer)&&void 0!==n?n:new Ph,this._blurMaterial=new wr(null!=e?e:mh),this._blurMaterial.depthTest=!1}dispose(){this._blurMaterial.dispose()}render(e,t,n,i){this._blurMaterial.uniforms.tDiffuse.value=t[0].texture,this._blurMaterial.uniforms.rangeMin.value.x=n[0],this._blurMaterial.uniforms.rangeMin.value.y=0,this._blurMaterial.uniforms.rangeMax.value.x=i[0],this._blurMaterial.uniforms.rangeMax.value.y=0,this._passRenderer.renderScreenSpace(e,this._blurMaterial,t[1]),this._blurMaterial.uniforms.tDiffuse.value=t[1].texture,this._blurMaterial.uniforms.rangeMin.value.x=0,this._blurMaterial.uniforms.rangeMin.value.y=n[1],this._blurMaterial.uniforms.rangeMax.value.x=0,this._blurMaterial.uniforms.rangeMax.value.y=i[1],this._passRenderer.renderScreenSpace(e,this._blurMaterial,t[2])}}const Ch=e.p+"9ba94fd0181997dfa7e8.png",Lh="OnlyShadow",Dh="Transparent",Ih="Parquet",Uh="Pavement",Oh={},Nh=e=>{let t=Oh[e];if(!t){switch(e){default:t=new Gl;break;case Lh:t=new Vl,t.opacity=.5;break;case Dh:t=new Gl,t.transparent=!0,t.opacity=0;break;case"White":t=new Gl;break;case Ih:{const e=new Wl;Mh((t=>{Fh(t),e.map=t}),"TexturesCom_Wood_ParquetChevron7_1K_albedo.jpg",new Ci(1,.6,.2)),Mh((t=>{Fh(t),e.normalMap=t}),"TexturesCom_Wood_ParquetChevron7_1K_normal.jpg"),Mh((t=>{Fh(t),e.roughnessMap=t}),"TexturesCom_Wood_ParquetChevron7_1K_roughness.jpg"),e.aoMapIntensity=0,e.roughness=1,e.metalness=0,e.envMapIntensity=.5,t=e;break}case Uh:{const e=new Wl;Mh((t=>{Fh(t),e.map=t}),"TexturesCom_Pavement_HerringboneNew_1K_albedo.jpg",new Ci(.6,.3,0)),Mh((t=>{Fh(t),e.normalMap=t}),"TexturesCom_Pavement_HerringboneNew_1K_normal.jpg"),Mh((t=>{Fh(t),e.roughnessMap=t}),"TexturesCom_Pavement_HerringboneNew_1K_roughness.jpg"),Mh((t=>{Fh(t),e.aoMap=t}),"TexturesCom_Pavement_HerringboneNew_1K_ao.jpg"),e.aoMapIntensity=1,e.roughness=1,e.metalness=0,e.envMapIntensity=.5,t=e;break}}Oh[e]=t}return t},Fh=e=>{e.anisotropy=16,e.wrapS=V,e.wrapT=V,e.repeat.set(1e5,1e5)},Bh=e=>{const t=Math.atan2(e.y,e.x)/(2*Math.PI)+.5,n=Math.asin(e.z)/Math.PI+.5;return new Nt(t,n)};class zh{get colorRenderTarget(){var e;return this._colorRenderTarget=null!==(e=this._colorRenderTarget)&&void 0!==e?e:new on,this._colorRenderTarget}environmentMapDecodeTarget(e){var t;const n=e.capabilities.isWebGL2?ie:J;return this._environmentMapDecodeTarget=null!==(t=this._environmentMapDecodeTarget)&&void 0!==t?t:new on(1,1,{type:n}),this._environmentMapDecodeTarget}environmentMapDecodeMaterial(e){var t,n;return e?(this._equirectangularDecodeMaterial=null!==(t=this._equirectangularDecodeMaterial)&&void 0!==t?t:new Gh(!0,!1),this._equirectangularDecodeMaterial):(this._pmremDecodeMaterial=null!==(n=this._pmremDecodeMaterial)&&void 0!==n?n:new Gh(!1,!1),this._pmremDecodeMaterial)}get camera(){var e;return this._camera=null!==(e=this._camera)&&void 0!==e?e:new ea(-1,1,1,-1,-1,1),this._camera}scaleTexture(e,t,n,i){var r;this.colorRenderTarget.setSize(n,i),this._planeMesh=null!==(r=this._planeMesh)&&void 0!==r?r:new mr(new Hr(2,2),new Ui({map:t}));const a=e.getRenderTarget();e.setRenderTarget(this.colorRenderTarget),e.render(this._planeMesh,this.camera),e.setRenderTarget(a);const s=this.environmentMapDecodeTarget(e).texture,o=new Uint8Array(n*i*4);return e.readRenderTargetPixels(this.colorRenderTarget,0,0,n,i,o),{texture:s,pixels:o,sRgbaPixels:!1}}newGrayscaleTexture(e,t,n,i){var r;const a=this.environmentMapDecodeMaterial("PMREM.cubeUv"===t.name),s=this.environmentMapDecodeTarget(e);s.setSize(n,i),a.setSourceTexture(t),this._planeMesh=null!==(r=this._planeMesh)&&void 0!==r?r:new mr(new Hr(2,2),a);const o=e.getRenderTarget();e.setRenderTarget(s),e.render(this._planeMesh,this.camera),e.setRenderTarget(o);const l=s.texture,c=s.texture.type===ie,h=c?new Float32Array(n*i*4):new Uint8Array(n*i*4);return e.readRenderTargetPixels(s,0,0,n,i,h),{texture:l,pixels:h,sRgbaPixels:c}}}const kh={tDiffuse:{value:null}},Hh="\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",Vh="\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n \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\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 ); // pos x\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n }\n return 0.5 * ( uv + 1.0 );\n }\n\n void main() {\n #if PMREM_DECODE == 1\n float altitude = (vUv.y - 0.5) * 3.141593;\n float azimuth = vUv.x * 2.0 * 3.141593;\n vec3 direction = vec3(\n cos(altitude) * cos(azimuth) * -1.0, \n sin(altitude), \n cos(altitude) * sin(azimuth) * -1.0\n );\n float face = getFace(direction);\n vec2 uv = getUV(direction, face) / vec2(3.0, 4.0);\n if (face > 2.5) {\n uv.y += 0.25;\n face -= 3.0;\n }\n uv.x += face / 3.0;\n vec4 color = texture2D(tDiffuse, uv);\n #else\n vec4 color = texture2D(tDiffuse, vUv);\n #endif \n #if GRAYSCALE_CONVERT == 1\n float grayscale = dot(color.rgb, vec3(0.2126, 0.7152, 0.0722));\n //float grayscale = dot(color.rgb, vec3(1.0/3.0));\n gl_FragColor = vec4(vec3(grayscale), 1.0);\n #else\n gl_FragColor = vec4(color.rgb, 1.0);\n #endif\n }";class Gh extends wr{constructor(e,t){super({uniforms:Sr.clone(kh),vertexShader:Hh,fragmentShader:Vh,defines:{PMREM_DECODE:e?1:0,GRAYSCALE_CONVERT:t?1:0}})}setSourceTexture(e){this.uniforms.tDiffuse.value=e}}class Wh{constructor(e){var t,n,i,r;this.samplePoints=[],this.sampleUVs=[],this.grayscaleTexture={texture:new rn,pixels:new Uint8Array(0),sRgbaPixels:!1},this.detectorTexture=new rn,this.detectorArray=new Float32Array(0),this.lightSamples=[],this.lightGraph=new Xh(0),this.lightSources=[],this._grayScale=new dn(.2126,.7152,.0722),this._createEquirectangularSamplePoints=e=>{const t=[];for(let n=0;nBh(e)))}detectLightSources(e,t,n){var i;this.textureData=n,this._textureConverter=null!==(i=this._textureConverter)&&void 0!==i?i:new zh,this.grayscaleTexture=this._textureConverter.newGrayscaleTexture(e,t,this._width,this._height),this.detectorArray=this._redFromRgbaToNormalizedFloatArray(this.grayscaleTexture.pixels,this.grayscaleTexture.sRgbaPixels),this.detectorTexture=this._grayscaleTextureFromFloatArray(this.detectorArray,this._width,this._height),this.lightSamples=this._filterLightSamples(this._sampleThreshold),this.lightGraph=this._findClusterSegments(this.lightSamples,this._sampleThreshold),this.lightGraph.findConnectedComponents(),this.lightSources=this.createLightSourcesFromLightGraph(this.lightSamples,this.lightGraph),this.lightSources.sort(((e,t)=>t.maxIntensity-e.maxIntensity))}_redFromRgbaToNormalizedFloatArray(e,t,n){const i=new Float32Array(e.length/4);let r=1,a=0;for(let t=0;te&&t.push(new jh(this.samplePoints[n],i))}return t}_detectorTextureLuminanceValueFromUV(e){const t=Math.floor(e.x*this._width),n=Math.floor(e.y*this._height)*this._width+t;return this.detectorArray[n]}_originalLuminanceValueFromUV(e){if(!(this.textureData&&this.textureData.data&&this.textureData._width&&this.textureData._height))return 256*this._detectorTextureLuminanceValueFromUV(e);const t=Math.floor(e.x*this.textureData._width),n=Math.floor(e.y*this.textureData._height);let i=0;for(let e=Math.max(0,t-2);e1){l=!1;break}}else c=0}l&&(r.adjacent[a].push(s),r.adjacent[s].push(a),r.edges.push([a,s]))}return r}createLightSourcesFromLightGraph(e,t){const n=t.components.filter((e=>e.length>1)).map((t=>new Yh(t.map((t=>e[t])))));return n.forEach((e=>e.calculateLightSourceProperties((e=>this._originalLuminanceValueFromUV(e))))),n}}class jh{constructor(e,t){this.position=e,this.uv=t}}class Xh{constructor(e){this.edges=[],this.adjacent=[],this.components=[],this.noOfNodes=e;for(let t=0;tt.length-e.length))}_dfs(e,t,n){t[e]=!0,n.push(e);for(const i of this.adjacent[e])t[i]||this._dfs(i,t,n)}}class Yh{constructor(e){this.position=new dn,this.uv=new Nt,this.averageIntensity=0,this.maxIntensity=0,this.size=0,this.lightSamples=e}calculateLightSourceProperties(e){this.position=new dn,this.averageIntensity=0,this.maxIntensity=0;for(const t of this.lightSamples){this.position.add(t.position);const n=e(t.uv);this.averageIntensity+=n,this.maxIntensity=Math.max(this.maxIntensity,n)}this.averageIntensity/=this.lightSamples.length,this.position.normalize(),this.uv=Bh(this.position);let t=0;for(const e of this.lightSamples)t+=e.position.distanceTo(this.position);t/=this.lightSamples.length,this.size=t/Math.PI}}class qh{constructor(e){this._lightSourceDetector=e}static createPlane(e,t){const n=new Hr(2,1),i=null!=t?t:new Ui({color:12632256,side:2}),r=new mr(n,i);return r.position.z=-.1,e.add(r),r}createDebugScene(e,t){this._scene=e,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,t)}_createLightGraphInMap(e,t,n,i){const r=[],a=[];for(let e=0;ee.uv)),o=a.map((e=>e.uv)),l=e.filter((e=>!s.includes(e)&&!o.includes(e)));this._createSamplePointsInMap(l,.005,16711680),this._createSamplePointsInMap(s,.01,255),this._createSamplePointsInMap(o,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const c=this._lightSourceDetector.lightSources.map((e=>e.uv));this._createSamplePointsInMap(c,.015,16776960);let h=this._lightSourceDetector.lightSources;void 0!==i&&i>=0&&i{var t;const n=new mr(i,r);n.position.copy(this._uvToMapPosition(e)),n.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(n)}))}_createCirclesInMap(e,t){const n=new Ui({color:t,transparent:!0,opacity:.5});e.forEach((e=>{var t;const i=new Ul(e.size,8,4),r=new mr(i,n);r.position.copy(this._uvToMapPosition(e.uv)),r.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(r)}))}_createClusterLinesInMap(e,t,n){var i;const r=new el({color:n}),a=[];t.forEach((t=>{for(let n=1;n.5){const e=(i.y+r.y)/2,t=i.x{(new _c).setResponseType("arraybuffer").load(this._path+e,(e=>{this.parseData_(e),t(this._cubeTexture)}))}))}parseHeader_(e){const t=new DataView(e,0,30);this._size=t.getUint16(0),this._maxLod=t.getUint8(2),this._colorSpace=t.getUint16(3)?rt:it,this._type=t.getUint16(5),this._format=t.getUint16(7),this._lightDirection.x=t.getFloat32(9),this._lightDirection.y=t.getFloat32(13),this._lightDirection.z=t.getFloat32(17)}parseBufferData_(e,t){let n=this._size;const i=Math.log2(this._size)+1;this._cubeTextures=[];for(let r=0;r{t.isMesh&&(e.add(t.geometry),e.add(t.material))}));for(const t of e)t.dispose()}}function nd(e){const t=new Ui;return t.color.setScalar(e),t}var id=Uint8Array,rd=Uint16Array,ad=Int32Array,sd=new id([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),od=new id([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ld=new id([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cd=function(e,t){for(var n=new rd(31),i=0;i<31;++i)n[i]=t+=1<>1|(21845&gd)<<1;vd=(61680&(vd=(52428&vd)>>2|(13107&vd)<<2))>>4|(3855&vd)<<4,md[gd]=((65280&vd)>>8|(255&vd)<<8)>>1}var _d=function(e,t,n){for(var i=e.length,r=0,a=new rd(t);r>l]=c}else for(s=new rd(i),r=0;r>15-e[r]);return s},xd=new id(288);for(gd=0;gd<144;++gd)xd[gd]=8;for(gd=144;gd<256;++gd)xd[gd]=9;for(gd=256;gd<280;++gd)xd[gd]=7;for(gd=280;gd<288;++gd)xd[gd]=8;var yd=new id(32);for(gd=0;gd<32;++gd)yd[gd]=5;var Sd=_d(xd,9,1),wd=_d(yd,5,1),bd=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},Md=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},Td=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Ed=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ad=function(e,t,n){var i=new Error(t||Ed[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,Ad),!n)throw i;return i},Pd=function(e,t,n,i){var r=e.length,a=i?i.length:0;if(!r||t.f&&!t.l)return n||new id(0);var s=!n,o=s||2!=t.i,l=t.i;s&&(n=new id(3*r));var c,h=function(e){var t=n.length;if(e>t){var i=new id(Math.max(2*t,e));i.set(n),n=i}},d=t.f||0,u=t.p||0,p=t.b||0,f=t.l,m=t.d,g=t.m,v=t.n,_=8*r;do{if(!f){d=Md(e,u,1);var x=Md(e,u+1,3);if(u+=3,!x){var y=e[(c=u,(L=4+((c+7)/8|0))-4)]|e[L-3]<<8,S=L+y;if(S>r){l&&Ad(0);break}o&&h(p+y),n.set(e.subarray(L,S),p),t.b=p+=y,t.p=u=8*S,t.f=d;continue}if(1==x)f=Sd,m=wd,g=9,v=5;else if(2==x){var w=Md(e,u,31)+257,b=Md(e,u+10,15)+4,M=w+Md(e,u+5,31)+1;u+=14;for(var T=new id(M),E=new id(19),A=0;A>4)<16)T[A++]=L;else{var I=0,U=0;for(16==L?(U=3+Md(e,u,3),u+=2,I=T[A-1]):17==L?(U=3+Md(e,u,7),u+=3):18==L&&(U=11+Md(e,u,127),u+=7);U--;)T[A++]=I}}var O=T.subarray(0,w),N=T.subarray(w);g=bd(O),v=bd(N),f=_d(O,g,1),m=_d(N,v,1)}else Ad(1);if(u>_){l&&Ad(0);break}}o&&h(p+131072);for(var F=(1<>4;if((u+=15&I)>_){l&&Ad(0);break}if(I||Ad(2),k<256)n[p++]=k;else{if(256==k){z=u,f=null;break}var H=k-254;if(k>264){var V=sd[A=k-257];H=Md(e,u,(1<>4;if(G||Ad(3),u+=15&G,N=fd[W],W>3&&(V=od[W],N+=Td(e,u)&(1<_){l&&Ad(0);break}o&&h(p+131072);var j=p+H;if(pe.length)&&(n=e.length),new id(e.subarray(t,n))}(n,0,p):n.subarray(0,p)},Rd=new id(0);function Cd(e,t){return Pd(e.subarray((n=e,i=t&&t.dictionary,(8!=(15&n[0])||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Ad(6,"invalid zlib data"),(n[1]>>5&1)==+!i&&Ad(6,"invalid zlib data: "+(32&n[1]?"need":"unexpected")+" dictionary"),2+(n[1]>>3&4)),-4),{i:2},t&&t.out,t&&t.dictionary);var n,i}var Ld="undefined"!=typeof TextDecoder&&new TextDecoder;try{Ld.decode(Rd,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;class Dd extends yc{constructor(e){super(e),this.type=re}parse(e){const t=65536,n=14,i=65537,r=Math.pow(2.7182818,2.2),a={l:0,c:0,lc:0};function s(e,t,n,i,r){for(;n>n&(1<>6}const h={c:0,lc:0};function d(e,t,n,i){e=e<<8|F(n,i),t+=8,h.c=e,h.lc=t}const u={c:0,lc:0};function p(e,t,n,i,r,a,s,o,l){if(e==t){i<8&&(d(n,i,r,a),n=h.c,i=h.lc);let e=n>>(i-=8);if(e=new Uint8Array([e])[0],o.value+e>l)return!1;const t=s[o.value-1];for(;e-- >0;)s[o.value++]=t}else{if(!(o.value32767?t-65536:t}const g={a:0,b:0};function v(e,t){const n=m(e),i=m(t),r=n+(1&i)+(i>>1),a=r,s=r-i;g.a=a,g.b=s}function _(e,t){const n=f(e),i=f(t),r=n-(i>>1)&65535,a=i+r-32768&65535;g.a=a,g.b=r}function x(e,t,n,i,r,a,s){const o=s<16384,l=n>r?r:n;let c,h,d=1;for(;d<=l;)d<<=1;for(d>>=1,c=d,d>>=1;d>=1;){h=0;const s=h+a*(r-c),l=a*d,u=a*c,p=i*d,f=i*c;let m,x,y,S;for(;h<=s;h+=u){let r=h;const a=h+i*(n-c);for(;r<=a;r+=f){const n=r+p,i=r+l,a=i+p;o?(v(e[r+t],e[i+t]),m=g.a,y=g.b,v(e[n+t],e[a+t]),x=g.a,S=g.b,v(m,x),e[r+t]=g.a,e[n+t]=g.b,v(y,S),e[i+t]=g.a,e[a+t]=g.b):(_(e[r+t],e[i+t]),m=g.a,y=g.b,_(e[n+t],e[a+t]),x=g.a,S=g.b,_(m,x),e[r+t]=g.a,e[n+t]=g.b,_(y,S),e[i+t]=g.a,e[a+t]=g.b)}if(n&d){const n=r+l;o?v(e[r+t],e[n+t]):_(e[r+t],e[n+t]),m=g.a,e[n+t]=g.b,e[r+t]=m}}if(r&d){let r=h;const a=h+i*(n-c);for(;r<=a;r+=f){const n=r+p;o?v(e[r+t],e[n+t]):_(e[r+t],e[n+t]),m=g.a,e[n+t]=g.b,e[r+t]=m}}c=d,d>>=1}return h}function y(e,t,r,f,m,g){const v=r.value,_=N(t,r),x=N(t,r);r.value+=4;const y=N(t,r);if(r.value+=4,_<0||_>=i||x<0||x>=i)throw new Error("Something wrong with HUF_ENCSIZE");const S=new Array(i),w=new Array(16384);if(function(e){for(let t=0;t<16384;t++)e[t]={},e[t].len=0,e[t].lit=0,e[t].p=null}(w),function(e,t,n,r,l,c){const h=t;let d=0,u=0;for(;r<=l;r++){if(h.value-t.value>n)return!1;s(6,d,u,e,h);const i=a.l;if(d=a.c,u=a.lc,c[r]=i,63==i){if(h.value-t.value>n)throw new Error("Something wrong with hufUnpackEncTable");s(8,d,u,e,h);let i=a.l+6;if(d=a.c,u=a.lc,r+i>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;i--;)c[r++]=0;r--}else if(i>=59){let e=i-59+2;if(r+e>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;e--;)c[r++]=0;r--}}!function(e){for(let e=0;e<=58;++e)o[e]=0;for(let t=0;t0;--e){const n=t+o[e]>>1;o[e]=t,t=n}for(let t=0;t0&&(e[t]=n|o[n]++<<6)}}(c)}(e,r,f-(r.value-v),_,x,S),y>8*(f-(r.value-v)))throw new Error("Something wrong with hufUncompress");!function(e,t,i,r){for(;t<=i;t++){const i=c(e[t]),a=l(e[t]);if(i>>a)throw new Error("Invalid table entry");if(a>n){const e=r[i>>a-n];if(e.len)throw new Error("Invalid table entry");if(e.lit++,e.p){const t=e.p;e.p=new Array(e.lit);for(let n=0;n0;s--){const s=r[(i<=n;){const a=t[g>>v-n&16383];if(a.len)v-=a.len,p(a.lit,s,g,v,i,r,f,m,_),g=u.c,v=u.lc;else{if(!a.p)throw new Error("hufDecode issues");let t;for(t=0;t=n&&c(e[a.p[t]])==(g>>v-n&(1<>=y,v-=y;v>0;){const e=t[g<a||(t[r++]=e[n++],r>a));)t[r++]=e[i++]}function b(e){let t=e.byteLength;const n=new Array;let i=0;const r=new DataView(e);for(;t>0;){const e=r.getInt8(i++);if(e<0){const a=-e;t-=a+1;for(let e=0;e>8==255?r+=255&i:(n[r]=i,r++),e.value++}function T(e){const t=.5*Math.cos(.7853975),n=.5*Math.cos(3.14159/16),i=.5*Math.cos(3.14159/8),r=.5*Math.cos(3*3.14159/16),a=.5*Math.cos(.981746875),s=.5*Math.cos(3*3.14159/8),o=.5*Math.cos(1.374445625),l=new Array(4),c=new Array(4),h=new Array(4),d=new Array(4);for(let u=0;u<8;++u){const p=8*u;l[0]=i*e[p+2],l[1]=s*e[p+2],l[2]=i*e[p+6],l[3]=s*e[p+6],c[0]=n*e[p+1]+r*e[p+3]+a*e[p+5]+o*e[p+7],c[1]=r*e[p+1]-o*e[p+3]-n*e[p+5]-a*e[p+7],c[2]=a*e[p+1]-n*e[p+3]+o*e[p+5]+r*e[p+7],c[3]=o*e[p+1]-a*e[p+3]+r*e[p+5]-n*e[p+7],h[0]=t*(e[p+0]+e[p+4]),h[3]=t*(e[p+0]-e[p+4]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],d[0]=h[0]+h[1],d[1]=h[3]+h[2],d[2]=h[3]-h[2],d[3]=h[0]-h[1],e[p+0]=d[0]+c[0],e[p+1]=d[1]+c[1],e[p+2]=d[2]+c[2],e[p+3]=d[3]+c[3],e[p+4]=d[3]-c[3],e[p+5]=d[2]-c[2],e[p+6]=d[1]-c[1],e[p+7]=d[0]-c[0]}for(let u=0;u<8;++u)l[0]=i*e[16+u],l[1]=s*e[16+u],l[2]=i*e[48+u],l[3]=s*e[48+u],c[0]=n*e[8+u]+r*e[24+u]+a*e[40+u]+o*e[56+u],c[1]=r*e[8+u]-o*e[24+u]-n*e[40+u]-a*e[56+u],c[2]=a*e[8+u]-n*e[24+u]+o*e[40+u]+r*e[56+u],c[3]=o*e[8+u]-a*e[24+u]+r*e[40+u]-n*e[56+u],h[0]=t*(e[u]+e[32+u]),h[3]=t*(e[u]-e[32+u]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],d[0]=h[0]+h[1],d[1]=h[3]+h[2],d[2]=h[3]-h[2],d[3]=h[0]-h[1],e[0+u]=d[0]+c[0],e[8+u]=d[1]+c[1],e[16+u]=d[2]+c[2],e[24+u]=d[3]+c[3],e[32+u]=d[3]-c[3],e[40+u]=d[2]-c[2],e[48+u]=d[1]-c[1],e[56+u]=d[0]-c[0]}function E(e){for(let t=0;t<64;++t){const n=e[0][t],i=e[1][t],r=e[2][t];e[0][t]=n+1.5747*r,e[1][t]=n-.1873*i-.4682*r,e[2][t]=n+1.8556*i}}function A(e,t,n){for(let a=0;a<64;++a)t[n+a]=Fi.toHalfFloat((i=e[a])<=1?Math.sign(i)*Math.pow(Math.abs(i),2.2):Math.sign(i)*Math.pow(r,Math.abs(i)-1));var i}function P(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function R(e){const t=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),n=new Uint8Array(b(t)),i=new Uint8Array(n.length);return S(n),w(n,i),new DataView(i.buffer)}function C(e){const t=Cd(e.array.slice(e.offset.value,e.offset.value+e.size)),n=new Uint8Array(t.length);return S(t),w(t,n),new DataView(n.buffer)}function L(e){const n=e.viewer,i={value:e.offset.value},r=new Uint16Array(e.columns*e.lines*(e.inputChannels.length*e.type)),a=new Uint8Array(8192);let s=0;const o=new Array(e.inputChannels.length);for(let t=0,n=e.inputChannels.length;t=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(l<=c)for(let e=0;e>3]&1<<(7&r))&&(n[i++]=r);const r=i-1;for(;i0;){const e=U(t.buffer,n),i=B(t,n),r=i>>2&3,o=new Int8Array([(i>>4)-1])[0],l=B(t,n);a.push({name:e,index:o,type:l,compression:r}),s-=e.length+3}const o=Q.channels,l=new Array(e.inputChannels.length);for(let t=0;t=0&&(c.idx[i.index]=t),e.offset=t)}}let h,d,u;if(r.acCompressedSize>0)switch(r.acCompression){case 0:h=new Uint16Array(r.totalAcUncompressedCount),y(e.array,t,n,r.acCompressedSize,h,r.totalAcUncompressedCount);break;case 1:const i=Cd(e.array.slice(n.value,n.value+r.totalAcUncompressedCount));h=new Uint16Array(i.buffer),n.value+=r.totalAcUncompressedCount}if(r.dcCompressedSize>0){const t={array:e.array,offset:n,size:r.dcCompressedSize};d=new Uint16Array(C(t).buffer),n.value+=r.dcCompressedSize}r.rleRawSize>0&&(u=b(Cd(e.array.slice(n.value,n.value+r.rleCompressedSize)).buffer),n.value+=r.rleCompressedSize);let p=0;const f=new Array(l.length);for(let e=0;e>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:Math.pow(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}function G(e,t){const n=e.getUint16(t.value,!0);return t.value+=2,n}function W(e,t){return V(G(e,t))}function j(e,t,n,i,r){return"string"===i||"stringvector"===i||"iccProfile"===i?function(e,t,n){const i=(new TextDecoder).decode(new Uint8Array(e).slice(t.value,t.value+n));return t.value=t.value+n,i}(t,n,r):"chlist"===i?function(e,t,n,i){const r=n.value,a=[];for(;n.value>4]}}(e,n):"lineOrder"===i?function(e,t){return["INCREASING_Y","DECREASING_Y","RANDOM_Y"][B(e,t)]}(e,n):"float"===i?k(e,n):"v2f"===i?function(e,t){return[k(e,t),k(e,t)]}(e,n):"v3f"===i?function(e,t){return[k(e,t),k(e,t),k(e,t)]}(e,n):"int"===i?O(e,n):"rational"===i?function(e,t){return[O(e,t),N(e,t)]}(e,n):"timecode"===i?function(e,t){return[N(e,t),N(e,t)]}(e,n):"preview"===i?(n.value+=r,"skipped"):void(n.value+=r)}function X(e,t,n,i){const r=new Array(e);for(let a=0;ae.width?e.width-a:e.blockWidth,e.lines=s+e.blockHeight>e.height?e.height-s:e.blockHeight;const o=e.columns*e.totalBytes,l=e.sizee.height?e.height-r:e.blockHeight;const a=e.columns*e.totalBytes,s=e.size=e.height)continue;const l=t*a,c=(e.height-1-o)*e.outLineWidth;for(let t=0;te:a.scanOrder=e=>a.height-1-e,4==a.outputChannels?(a.format=de,a.colorSpace=rt):(a.format=ge,a.colorSpace=nt),e.spec.singleTile){a.blockHeight=e.tiles.ySize,a.blockWidth=e.tiles.xSize;const n=function(e,t,n){let i=0;switch(e.levelMode){case"ONE_LEVEL":i=1;break;case"MIPMAP_LEVELS":i=function(e,t){const n=Math.log2(e);return"ROUND_DOWN"==t?Math.floor(n):Math.ceil(n)}(Math.max(t,n),e.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return i}(e.tiles,a.width,a.height),r=X(n,a.width,e.tiles.xSize,e.tiles.roundingMode),s=X(n,a.height,e.tiles.ySize,e.tiles.roundingMode);a.tileCount=r[0]*s[0];for(let e=0;e(r=o.indexOf("\n"))&&a=e.byteLength||!(l=n(e)))&&t(1,"no header found"),(c=l.match(/^#\?(\S+)/))||t(3,"bad initial token"),o.valid|=1,o.programtype=c[1],o.string+=l+"\n";l=n(e),!1!==l;)if(o.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(i))&&(o.gamma=parseFloat(c[1])),(c=l.match(r))&&(o.exposure=parseFloat(c[1])),(c=l.match(a))&&(o.valid|=2,o.format=c[1]),(c=l.match(s))&&(o.valid|=4,o.height=parseInt(c[1],10),o.width=parseInt(c[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=l+"\n";return 2&o.valid||t(3,"missing format specifier"),4&o.valid||t(3,"missing image size specifier"),o}(a),o=s.width,l=s.height,c=function(e,n,i){const r=n;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");const a=new Uint8Array(4*n*i);a.length||t(4,"unable to allocate buffer space");let s=0,o=0;const l=4*r,c=new Uint8Array(4),h=new Uint8Array(l);let d=i;for(;d>0&&oe.byteLength&&t(1),c[0]=e[o++],c[1]=e[o++],c[2]=e[o++],c[3]=e[o++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||t(3,"bad rgbe scanline format");let n,i=0;for(;i128;if(r&&(n-=128),(0===n||i+n>l)&&t(3,"bad scanline data"),r){const t=e[o++];for(let e=0;e0?this.environmentName:r),s=this.currentEnvironment!==a;return this.showBackground=null!==(i=null==t?void 0:t.showEnvironment)&&void 0!==i&&i,this.currentEnvironment=a,this.currentEnvironment&&(null==t?void 0:t.environmentRotation)&&(this.currentEnvironment.rotation=t.environmentRotation),this.currentEnvironment&&(null==t?void 0:t.environmentIntensity)&&(this.currentEnvironment.intensity=t.environmentIntensity),e.userData.showEnvironmentBackground=this.showBackground,e.userData.environmentDefinition=this.currentEnvironment,s}loadDefaultEnvironment(e,t,n){var i;const r=null!=n?n:"room environment",a=null!==(i=t&&t())&&void 0!==i?i:new Ud;this.environemtMap.set(r,new $h(a)),e&&(this.environmentName=r),this.updateUI()}loadEnvmap(e,t,n){this.loadAndSetCubeTexture((t=>{this.environemtMap.set(e,new $h(t)),n&&(this.environmentName=e),this.updateUI()}),t)}loadExr(e,t,n){this.loadExrAndSetTexture(((t,i)=>{this.environemtMap.set(e,new $h(t,{textureData:i})),n&&(this.environmentName=e),this.updateUI()}),t)}loadHdr(e,t,n){this.loadHdrAndSetTexture(((t,i)=>{this.environemtMap.set(e,new $h(t,{textureData:i})),n&&(this.environmentName=e),this.updateUI()}),t)}loadAndSetCubeTexture(e,t){t&&(this.envMapReader||(this.envMapReader=new ed),this.envMapReader.load(t).then((t=>{t&&e(t)})))}loadExrAndSetTexture(e,t){t&&(this.exrLoader||(this.exrLoader=new Dd),this.exrLoader.load(t,((t,n)=>{e(t,n)})))}loadHdrAndSetTexture(e,t){t&&(this.rgbeLoader||(this.rgbeLoader=new Id),this.rgbeLoader.load(t,((t,n)=>{e(t,n)})))}addGUI(e){this.uiFolder=e,this.updateUI()}updateUI(){if(this.uiFolder){const e=Array.from(this.environemtMap.keys());if(this.environmentController){let t="";e.forEach((e=>{t+=``})),this.environmentController.domElement.children[0].innerHTML=t,this.environmentController.setValue(this.environmentName),this.environmentController.updateDisplay()}else this.environmentController=this.uiFolder.add(this,"environmentName",e)}}}class Nd extends mr{constructor(){const e=Nd.SkyShader,t=new wr({name:e.name,uniforms:Sr.clone(e.uniforms),vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,side:1,depthWrite:!1});super(new vr(1,1,1),t),this.isSky=!0}}Nd.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new dn},up:{value:new dn(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPosition );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}"};class Fd{constructor(e){this.sky=new Nd,this.sky.name="Sky",this.parameters=Object.assign({visible:!0,distance:4e5,turbidity:10,rayleigh:2,mieCoefficient:.005,mieDirectionalG:.8,inclination:.6,azimuth:0},e),this.updateSky()}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}updateSky(){this.sky.scale.setScalar(45e4),this.sky.frustumCulled=!1,this.sky.material.uniforms.turbidity.value=this.parameters.turbidity,this.sky.material.uniforms.rayleigh.value=this.parameters.rayleigh,this.sky.material.uniforms.mieCoefficient.value=this.parameters.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.parameters.mieDirectionalG;const e=(t=this.parameters.distance,n=this.parameters.azimuth,i=this.parameters.inclination,(new dn).setFromSphericalCoords(t,Math.PI*(1-i),2*Math.PI*(1-n)));var t,n,i;this.sky.material.uniforms.sunPosition.value.copy(e),this.sky.visible=this.parameters.visible}addToScene(e){e.add(this.sky)}changeVisibility(e){this.parameters.visible!==e&&(this.updateParameters({visible:e}),this.updateSky())}}const Bd="None",zd="GridPaper",kd="Concrete",Hd="Marble",Vd="Granite",Gd="VorocracksMarble",Wd="Kraft",jd="Line",Xd="Test";class Yd{get isSet(){return this.parameters.backgroundType!==Bd}constructor(e){this._materialMap=new Map;const t=new Ji;t.setAttribute("position",new Gi([-1,3,0,-1,-1,0,3,-1,0],3)),t.setAttribute("uv",new Gi([0,2,0,0,2,0],2)),this.backgroundMesh=new mr(t),this.backgroundMesh.name="Background",this.parameters=Object.assign({visible:!1,backgroundType:Bd},e),this.updateBackground()}_updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}updateBackground(){this.backgroundMesh.visible=this.parameters.backgroundType!==Bd,this.backgroundMaterial=this._getMaterial(),this.backgroundMesh.material=this.backgroundMaterial}update(e,t,n){this.backgroundMesh.visible&&this.backgroundMaterial&&(this.backgroundMaterial.uniforms.viewMatrixInverse.value.copy(n.matrixWorld),this.backgroundMaterial.uniforms.projectionMatrixInverse.value.copy(n.projectionMatrixInverse),this.backgroundMaterial.uniforms.iResolution.value.set(e,t))}addToScene(e){this.backgroundMesh!==e&&e.add(this.backgroundMesh)}hideBackground(){this.parameters.backgroundType!==Bd&&(this.parameters.backgroundType=Bd,this.updateBackground())}_getMaterial(){let e=this._materialMap.get(this.parameters.backgroundType);if(e)return e;let t=Zd,n={};switch(this.parameters.backgroundType){default:break;case Xd:t=Zd;break;case zd:t=Kd;break;case kd:t=Jd,n={patternChoice:1};break;case Hd:t=Jd,n={patternChoice:3};break;case Vd:t=Jd,n={patternChoice:6};break;case Gd:t=Qd;break;case Wd:t=$d;break;case jd:t=eu}return e=new wr({name:"BackgroundShader",vertexShader:qd,fragmentShader:t,defines:n,uniforms:{viewMatrixInverse:{value:new Hn},projectionMatrixInverse:{value:new Hn},scale:{value:8},iResolution:{value:new Nt(1024,1024)}},side:2,depthWrite:!1}),this._materialMap.set(this.parameters.backgroundType,e),e}}const qd="varying vec2 vertexUv;\nuniform mat4 viewMatrixInverse;\nuniform mat4 projectionMatrixInverse;\nuniform float scale;\n\nvoid main() {\n vec4 p = viewMatrixInverse * projectionMatrixInverse * vec4(position.xy, 0.0, 1.0);\n vertexUv = (p.xz / p.w * 0.5 + 0.5) / scale; \n gl_Position = vec4(position.xy, 1.0, 1.0);\n}",Zd="varying vec2 vertexUv;\nvoid main() {\n vec2 uv = fract(vertexUv);\n gl_FragColor = vec4(uv.x, uv.y, (1.0-uv.x) * (1.0 - uv.y), 1.0);\n}",Kd="varying vec2 vertexUv;\nuniform vec2 iResolution;\nfloat nsin(float a)\n{\n return (sin(a)+1.)/2.;\n}\nfloat rand(float n)\n{\n \treturn fract(cos(n*89.42)*343.42);\n}\nvec2 rand(vec2 n)\n{\n \treturn vec2(rand(n.x*23.62-300.0+n.y*34.35),rand(n.x*45.13+256.0+n.y*38.89)); \n}\n\n// returns (dx, dy, distance)\nvec3 worley(vec2 n,float s)\n{\n vec3 ret = vec3(s * 10.);\n // look in 9 cells (n, plus 8 surrounding)\n for(int x = -1;x<2;x++)\n {\n for(int y = -1;y<2;y++)\n {\n vec2 xy = vec2(x,y);// xy can be thought of as both # of cells distance to n, and \n vec2 cellIndex = floor(n/s) + xy;\n vec2 worleyPoint = rand(cellIndex);// random point in this cell (0-1)\n worleyPoint += xy - fract(n/s);// turn it into distance to n. ;\n float d = length(worleyPoint) * s;\n if(d < ret.z)\n ret = vec3(worleyPoint, d);\n }\n }\n return ret;\n}\n\nvec2 mouse = vec2(1.);// how do i initialize this??\n\nvec4 applyLighting(vec4 inpColor, vec2 uv, vec3 normal, vec3 LightPos, vec4 LightColor, vec4 AmbientColor)\n{\n // if(distance(uv.xy, LightPos.xy) < 0.01) return vec4(1.,0.,0.,1.);\n vec3 LightDir = vec3(LightPos.xy - uv, LightPos.z);\n vec3 N = normalize(normal);\n vec3 L = normalize(LightDir);\n vec3 Diffuse = (LightColor.rgb * LightColor.a) * max(dot(N, L), 0.0);\n vec3 Ambient = AmbientColor.rgb * AmbientColor.a;\n vec3 Intensity = Ambient + Diffuse;\n vec3 FinalColor = inpColor.rgb * Intensity;\n return vec4(FinalColor, inpColor.a);\n}\n\n// convert distance to alpha value (see https://www.shadertoy.com/view/ltBGzt)\nfloat dtoa(float d)\n{\n const float amount = 800.0;\n return clamp(1.0 / (clamp(d, 1.0/amount, 1.0)*amount), 0.,1.);\n}\n\n// distance to edge of grid line. real distance, and centered over its position.\nfloat grid_d(vec2 uv, vec2 gridSize, float gridLineWidth)\n{\n uv += gridLineWidth / 2.0;\n uv = mod(uv, gridSize);\n vec2 halfRemainingSpace = (gridSize - gridLineWidth) / 2.0;\n uv -= halfRemainingSpace + gridLineWidth;\n uv = abs(uv);\n uv = -(uv - halfRemainingSpace);\n return min(uv.x, uv.y);\n}\n// centered over lineposy\nfloat hline_d(vec2 uv, float lineposy, float lineWidth)\n{\n\treturn distance(uv.y, lineposy) - (lineWidth / 2.0);\n}\n// centered over lineposx\nfloat vline_d(vec2 uv, float lineposx, float lineWidth)\n{\n\treturn distance(uv.x, lineposx) - (lineWidth / 2.0);\n}\nfloat circle_d(vec2 uv, vec2 center, float radius)\n{\n\treturn length(uv - center) - radius;\n}\n\n// not exactly perfectly perfect, but darn close\nfloat pointRectDist(vec2 p, vec2 rectTL, vec2 rectBR)\n{\n float dx = max(max(rectTL.x - p.x, 0.), p.x - rectBR.x);\n float dy = max(max(rectTL.y - p.y, 0.), p.y - rectBR.y);\n return max(dx, dy);\n}\n\n\nvec2 getuv(vec2 fragCoord, vec2 newTL, vec2 newSize, out float distanceToVisibleArea, out float vignetteAmt)\n{\n vec2 ret = vec2(fragCoord.x / iResolution.x, (iResolution.y - fragCoord.y) / iResolution.y);// ret is now 0-1 in both dimensions\n \n // warp\n //ret = tvWarp(ret / 2.) * 2.;// scale it by 2.\n distanceToVisibleArea = pointRectDist(ret, vec2(0.0), vec2(1.));\n\n // vignette\n vec2 vignetteCenter = vec2(0.5, 0.5);\n\tvignetteAmt = 1.0 - distance(ret, vignetteCenter);\n vignetteAmt = 0.03 + pow(vignetteAmt, .25);// strength\n vignetteAmt = clamp(vignetteAmt, 0.,1.);\n \n \n ret *= newSize;// scale up to new dimensions\n float aspect = iResolution.x / iResolution.y;\n ret.x *= aspect;// orig aspect ratio\n float newWidth = newSize.x * aspect;\n return ret + vec2(newTL.x - (newWidth - newSize.x) / 2.0, newTL.y);\n}\n\nvec4 drawHole(vec4 inpColor, vec2 uv, vec2 pos)\n{\n vec4 circleWhiteColor = vec4(vec3(0.95), 1.);\n\tfloat d = circle_d(uv, pos, 0.055);\n return vec4(mix(inpColor.rgb, circleWhiteColor.rgb, circleWhiteColor.a * dtoa(d)), 1.);\n}\n\nvoid main()\n{\n vec4 fragColor;\n vec2 fragCoord = vertexUv.xy * iResolution.yy;\n float distanceToVisibleArea;\n float vignetteAmt;\n\tvec2 uv = getuv(fragCoord, vec2(-1.,1.), vec2(2., -2.), distanceToVisibleArea, vignetteAmt);\n float throwaway;\n //mouse = getuv(iMouse.xy, vec2(-1.,1.), vec2(2., -2.), throwaway, throwaway);\n\n fragColor = vec4(0.94, 0.96, 0.78, 1.0);// background\n float d;\n \n // grid\n vec4 gridColor = vec4(0.2,0.4,.9, 0.35);\n\td = grid_d(uv, vec2(0.10), 0.001);\n\tfragColor = vec4(mix(fragColor.rgb, gridColor.rgb, gridColor.a * dtoa(d)), 1.);\n \n // red h line\n //vec4 hlineColor = vec4(0.8,0.,.2, 0.55);\n\t//d = hline_d(uv, 0.60, 0.003);\n\t//fragColor = vec4(mix(fragColor.rgb, hlineColor.rgb, hlineColor.a * dtoa(d)), 1.);\n \n // red v line\n //vec4 vlineColor = vec4(0.8,0.,.2, 0.55);\n\t//d = vline_d(uv, -1.40, 0.003);\n\t//fragColor = vec4(mix(fragColor.rgb, vlineColor.rgb, vlineColor.a * dtoa(d)), 1.);\n\n \n // fractal worley crumpled paper effect\n float wsize = 0.8;\n const int iterationCount = 6;\n vec2 normal = vec2(0.);\n float influenceFactor = 1.0;\n for(int i = 0; i < iterationCount; ++ i)\n {\n vec3 w = worley(uv, wsize);\n\t\tnormal.xy += influenceFactor * w.xy;\n wsize *= 0.5;\n influenceFactor *= 0.9;\n }\n \n // lighting\n //vec3 lightPos = vec3(mouse, 8.);\n //vec4 lightColor = vec4(vec3(0.99),0.6);\n //vec4 ambientColor = vec4(vec3(0.99),0.5);\n\t//fragColor = applyLighting(fragColor, uv, vec3(normal, 4.0), lightPos, lightColor, ambientColor);\n\n // white circles\n //fragColor = drawHole(fragColor, uv, vec2(-1.6, 0.2));\n\t//fragColor = drawHole(fragColor, uv, vec2(-1.6, -.7));\n \n // post effects\n\t//fragColor.rgb *= vignetteAmt;\n gl_FragColor = fragColor;\n}",Jd="varying vec2 vertexUv;\nuniform vec2 iResolution;\nuniform float iTime;\n\n// Solid Colors\nvec3 red = vec3(1.0,0.0,0.0);\nvec3 green = vec3(0.0,1.0,0.0);\nvec3 blue = vec3(0.0,0.0,1.0);\nvec3 black = vec3(0.0,0.0,0.0);\nvec3 white = vec3(1.0,1.0,1.0);\n// Concrete\nvec3 concreteLite = vec3(0.909, 0.905, 0.917);\nvec3 concreteDark = vec3(0.760, 0.729, 0.647);\n// Lava\nvec3 lavaLite = vec3(0.686, 0.203, 0.160);\nvec3 lavaDark = vec3(0.580, 0.176, 0.117);\n// Marble\nvec3 marbleLite = vec3(0.988, 0.988, 0.988);\nvec3 marbleStainBlue1 = vec3(0.690, 0.760, 0.811);\nvec3 marbleStainBlue2 = vec3(0.647, 0.745, 0.803);\nvec3 marbleStainBlue3 = vec3(0.654, 0.756, 0.772);\n// Lava Lamp\nvec3 lavaLampBG = vec3(0.462, 0.266, 0.6);\nvec3 lavaLampLava = vec3(0.929, 0.203, 0.572);\n// Clouds\nvec3 sky = vec3(0.541, 0.729, 0.827);\nvec3 cloud = vec3(0.941, 0.945, 0.941);\n// Granite\nvec3 graniteBG = vec3(0.956, 0.952, 0.976);\nvec3 graniteGray = vec3(0.478, 0.474, 0.494);\nvec3 graniteBrown = vec3(0.4, 0.356, 0.341);\nvec3 graniteBlack = vec3(0.105, 0.121, 0.160);\n\n// Tartan\nvec3 tar1Blue = vec3(0.074, 0.349, 0.505);\nvec3 tar1Green = vec3(0.286, 0.541, 0.341);\nvec3 tar1White = vec3(1.0,1.0,1.0);\nvec3 tar1Black = vec3(0.0,0.0,0.0);\nvec3 tar1BG = vec3(0.062, 0.274, 0.109);\n\n// Tartan 2\nvec3 tar2BG = vec3(0.152, 0.160, 0.156);\nvec3 tar2Blue = vec3(0.176, 0.501, 0.674);\nvec3 tar2Orange = vec3(0.603, 0.407, 0.309);\n\n// Art Installation\nvec3 violet = vec3(0.662, 0.407, 0.870);\nvec3 yellow = vec3(0.968, 0.752, 0.556);\n\n\nfloat random (in vec2 uv) {\n return fract(sin(dot(uv.xy,\n vec2(12.9898,78.233)))*\n 43758.5453123);\n}\n\n// Based on Morgan McGuire @morgan3d\n// https://www.shadertoy.com/view/4dS3Wd\nfloat noise (in vec2 uv) {\n vec2 i = floor(uv);\n vec2 f = fract(uv);\n\n // Four corners in 2D of a tile\n float a = random(i);\n float b = random(i + vec2(1.0, 0.0));\n float c = random(i + vec2(0.0, 1.0));\n float d = random(i + vec2(1.0, 1.0));\n\n vec2 u = f * f * (3.0 - 2.0 * f);\n\n return mix(a, b, u.x) +\n (c - a)* u.y * (1.0 - u.x) +\n (d - b) * u.x * u.y;\n}\n\n#define OCTAVES 6\nfloat fbm (in vec2 uv) {\n // Initial values\n float value = 0.0;\n float amplitud = .5;\n float frequency = 0.;\n //\n // Loop of octaves\n for (int i = 0; i < OCTAVES; i++) {\n value += amplitud * noise(uv);\n uv *= 2.;\n amplitud *= .5;\n }\n return value;\n}\n\n// Simplex noise\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); }\n\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n vec2 i = floor(v + dot(v, C.yy) );\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod289(i); // Avoid truncation effects in permutation\n vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))\n + i.x + vec3(0.0, i1.x, 1.0 ));\n\n vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\n m = m*m ;\n m = m*m ;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nfloat lavaLamp(vec2 uv,vec2 shapePos, float times){\n shapePos = vec2(shapePos.x*1.5,shapePos.y*0.3);\n uv -= shapePos;\n \n float angle = atan(uv.y,uv.x);\n float radius = cos(times*angle*0.5);\n return radius;\n}\n\nvec4 rectangle(vec2 uv, vec2 pos, float width, float height, vec3 color) {\n\tfloat t = 0.0;\n\tif ((uv.x > pos.x - width / 2.0) && (uv.x < pos.x + width / 2.0)\n\t\t&& (uv.y > pos.y - height / 2.0) && (uv.y < pos.y + height / 2.0)) {\n\t\tt = 1.0;\n\t}\n\treturn vec4(color, t);\n}\n\nvoid main()\n{\n vec4 fragColor;\n vec2 fragCoord = vertexUv.xy * iResolution.yy;\n\tvec2 uv = fragCoord.xy / iResolution.xy;\n\tfloat ratio = iResolution.x/iResolution.y;\n uv.x *= ratio;\n \n if (patternChoice == 1) // Concrete\n {\n vec3 value = concreteLite;\n \n value = mix(value, concreteDark,random(uv)*0.6);\n value = mix(value, black, random(uv)*0.35);\n \n vec3 stains = vec3(fbm((uv*5.)*2.))*.12;\n \n value = mix(value, concreteLite,(smoothstep(0.03,.12,stains) - smoothstep(.2,.3,stains))*0.3);\n \n\t fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 2) // Lava\n {\n\t\tvec3 value = black;\n \n vec3 stains = vec3(fbm((uv*1.7)*25.))*.75;\n \n float fade = sin(iTime * 5.)+2.5;\n \n value = mix(value, lavaLite, (smoothstep(0.05,0.1,stains) - smoothstep(.17, .22,stains) * fade));\n \n fragColor = vec4(value,1.0);\n }\n \n else if (patternChoice == 3) // Marble\n {\n vec3 value = marbleLite;\n \n vec3 stains = vec3(fbm((uv*1.2)*18.))*.113;\n vec3 stains2 = vec3(fbm((uv*5.)*1.5))*.12;\n \n vec3 stains3 = vec3(fbm((uv)*5.))*.12;\n vec3 stains4 = vec3(fbm((uv*2.)*2.5))*.12;\n \n value = mix(value, marbleStainBlue1,(smoothstep(0.065,0.1,stains) - smoothstep(0.1, 0.8,stains)));\n //value = mix(value, marbleStainBlue2,(smoothstep(0.065,0.1,stains2) - smoothstep(0.1, 0.8,stains2)));\n //value = mix(value, marbleStainBlue3,(smoothstep(0.09,0.1,stains2) - smoothstep(0.2, 0.5,stains2)));\n //value = mix(value, marbleStainBlue2,(smoothstep(0.07,0.1,stains3) - smoothstep(0.1, 0.8,stains3)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 4) // Lava Lamp\n {\n //float value = lavaLamp(uv,vec2(0.,0.5), 3.);\n //vec2 value = vec2(snoise(uv*3.-iTime));\n \t//vec3 color = red*vec3(value, 1.0);\n \n vec3 value = lavaLampBG;\n float lava = lavaLamp(uv*0.5,vec2(snoise(uv*4.-iTime)), 1.);\n \n vec3 color = lavaLampLava*lava;\n value += color;\n \n \n fragColor = vec4(value, 1.0);\n }\n \t\n else if (patternChoice == 5) // Clouds\n {\n uv *= 0.5;\n vec3 value = sky;\n \n vec3 clouds = vec3(fbm((uv*sin(iTime*0.25))*20.))*.12;\n \n value = mix(value, cloud,(smoothstep(0.05,0.1,clouds) - smoothstep(0.1, 0.2,clouds)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 6) // Granite\n {\n \tvec3 value = graniteBG;\n \n uv *= 2.;\n uv += 2.3;\n vec3 layer1 = vec3(fbm((uv*0.6)*18.))*.113;\n uv *= 0.2;\n uv += 0.5;\n vec3 layer2 = vec3(fbm((uv*0.8)*30.))*.117;\n uv *= 2.2;\n uv += 2.5;\n vec3 layer3 = vec3(fbm((uv*0.4)*15.))*.12;\n \n value = mix(value, graniteBlack,(smoothstep(0.04,0.1,layer1) - smoothstep(0.1, 0.8,layer1)));\n value = mix(value, graniteBrown,(smoothstep(0.04,0.1,layer2) - smoothstep(0.1, 0.8,layer2)));\n value = mix(value, graniteGray,(smoothstep(0.072,0.1,layer3) - smoothstep(0.1, 0.8,layer3)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 7) // Scottish Tartan 1\n {\n vec3 value = tar1BG; \n \n uv *= 2.;\n \tuv = fract(uv);\n \n float blackTile = 0.;\n float greenTile = 0.;\n float blueTile = 0.;\n float whiteTile = 0.;\n \n // Blue blocks\n // Horizontal\n \tblueTile += step(0.15, uv.x) - step(0.35, uv.x);\n \tblueTile += step(0.65, uv.x) - step(0.85, uv.x);\n // Vertical\n blueTile += step(0.15, uv.y) - step(0.35, uv.y);\n blueTile += step(0.68, uv.y) - step(0.85, uv.y);\n \n // White lines\n // Vertical\n whiteTile += step(0.0001, uv.x) - step(0.02, uv.x);\n whiteTile += step(0.49, uv.x) - step(0.51, uv.x);\n // Horizontal\n whiteTile += step(0.220, uv.y) - step(0.245, uv.y);\n \twhiteTile += step(0.755, uv.y) - step(0.775, uv.y);\n \n // Black lines\n // Vertical\n blackTile += step(0.10, uv.x) - step(0.11, uv.x);\n blackTile += step(0.12, uv.x) - step(0.13, uv.x);\n blackTile += step(0.14, uv.x) - step(0.15, uv.x);\n blackTile += step(0.18, uv.x) - step(0.19, uv.x);\n blackTile += step(0.2, uv.x) - step(0.21, uv.x);\n blackTile += step(0.29, uv.x) - step(0.3, uv.x);\n blackTile += step(0.31, uv.x) - step(0.32, uv.x);\n blackTile += step(0.35, uv.x) - step(0.36, uv.x);\n blackTile += step(0.37, uv.x) - step(0.38, uv.x);\n blackTile += step(0.39, uv.x) - step(0.4, uv.x);\n blackTile += step(0.59, uv.x) - step(0.6, uv.x);\n blackTile += step(0.61, uv.x) - step(0.62, uv.x);\n blackTile += step(0.63, uv.x) - step(0.64, uv.x);\n blackTile += step(0.68, uv.x) - step(0.69, uv.x);\n blackTile += step(0.7, uv.x) - step(0.71, uv.x);\n blackTile += step(0.77, uv.x) - step(0.78, uv.x);\n blackTile += step(0.8, uv.x) - step(0.81, uv.x);\n blackTile += step(0.85, uv.x) - step(0.86, uv.x);\n blackTile += step(0.87, uv.x) - step(0.88, uv.x);\n blackTile += step(0.89, uv.x) - step(0.9, uv.x);\n // Horizontal\n blackTile += step(0.07, uv.y) - step(0.08, uv.y);\n blackTile += step(0.05, uv.y) - step(0.06, uv.y);\n blackTile += step(0.39, uv.y) - step(0.4, uv.y);\n blackTile += step(0.41, uv.y) - step(0.42, uv.y);\n blackTile += step(0.59, uv.y) - step(0.6, uv.y);\n blackTile += step(0.61, uv.y) - step(0.62, uv.y);\n blackTile += step(0.90, uv.y) - step(0.91, uv.y);\n blackTile += step(0.92, uv.y) - step(0.93, uv.y);\n \n // Apply\n value = mix(value, tar1Blue, vec3(blueTile * noise(uv* 1000.)));\n value = mix(value, tar1White, vec3(whiteTile * noise(uv * 200.)));\n value = mix(value, tar1Black, vec3(blackTile * noise(uv * 200.)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 8) // Scottish Tartan 2\n {\n vec3 value = tar2BG; \n \n uv *= 2.;\n \tuv = fract(uv);\n \n float blackTile = 0.;\n float greenTile = 0.;\n float blueTile = 0.;\n float orangeTile = 0.;\n \n // Blue blocks\n // Horizontal\n \tblueTile += step(0.15, uv.x) - step(0.35, uv.x);\n \tblueTile += step(0.65, uv.x) - step(0.85, uv.x);\n // Vertical\n blueTile += step(0.15, uv.y) - step(0.35, uv.y);\n blueTile += step(0.68, uv.y) - step(0.85, uv.y);\n \n // Orange lines\n // Vertical\n orangeTile += step(0.0001, uv.x) - step(0.02, uv.x);\n orangeTile += step(0.49, uv.x) - step(0.51, uv.x);\n orangeTile += step(0.04, uv.x) - step(0.05, uv.x);\n orangeTile += step(0.97, uv.x) - step(0.98, uv.x);\n orangeTile += step(0.46, uv.x) - step(0.47, uv.x);\n orangeTile += step(0.53, uv.x) - step(0.54, uv.x);\n // Horizontal\n orangeTile += step(0.220, uv.y) - step(0.245, uv.y);\n \torangeTile += step(0.755, uv.y) - step(0.775, uv.y);\n orangeTile += step(0.200, uv.y) - step(0.210, uv.y);\n orangeTile += step(0.255, uv.y) - step(0.265, uv.y);\n orangeTile += step(0.730, uv.y) - step(0.740, uv.y);\n orangeTile += step(0.79, uv.y) - step(0.8, uv.y);\n \n // Apply\n value = mix(value, tar2Blue, vec3(blueTile * noise(uv* 1200.)));\n value = mix(value, tar2Orange, vec3(orangeTile * noise(uv * 200.)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 9) // Art Installation\n {\n vec2 uv2 = fragCoord.xy/iResolution.xy;\n uv2 -= 0.5;\n uv2.x *= 1.6;\n uv2.y *= 1.9;\n \n float dist = length(uv2);\n \n vec2 fragCo = fragCoord.xy;\n vec2 center = iResolution.xy * 0.5;\n float width = iResolution.x * 0.4;\n float height = iResolution.x * 0.2;\n \n vec3 value = mix(violet, yellow, dist);\n \n vec4 finalVal = vec4(value, 1.0);\n \n vec4 rect = rectangle(fragCo, center, width, height, violet);\n \n fragColor = mix(finalVal,rect,rect.a);\n fragColor = finalVal;\n }\n gl_FragColor = fragColor;\n}",Qd="varying vec2 vertexUv;\nuniform vec2 iResolution;\nuniform float iTime;\n// variant of Vorocracks: https://shadertoy.com/view/lsVyRy\n// integrated with cracks here: https://www.shadertoy.com/view/Xd3fRN\n\n#define MM 0\n\n#define VARIANT 1 // 1: amplifies Voronoi cell jittering\n#if VARIANT\n float ofs = .5; // jitter Voronoi centers in -ofs ... 1.+ofs\n#else\n float ofs = 0.;\n#endif\n \n//int FAULT = 1; // 0: crest 1: fault\n\nfloat RATIO = 1., // stone length/width ratio\n /* STONE_slope = .3, // 0. .3 .3 -.3\n STONE_height = 1., // 1. 1. .6 .7\n profile = 1., // z = height + slope * dist ^ prof\n */ \n CRACK_depth = 3.,\n CRACK_zebra_scale = 1., // fractal shape of the fault zebra\n CRACK_zebra_amp = .67,\n CRACK_profile = 1., // fault vertical shape 1. .2 \n CRACK_slope = 50., // 10. 1.4\n CRACK_width = .0;\n \n\n// std int hash, inspired from https://www.shadertoy.com/view/XlXcW4\nvec3 hash3( uvec3 x ) \n{\n# define scramble x = ( (x>>8U) ^ x.yzx ) * 1103515245U // GLIB-C const\n scramble; scramble; scramble; \n return vec3(x) / float(0xffffffffU) + 1e-30; // <- eps to fix a windows/angle bug\n}\n\n// === Voronoi =====================================================\n// --- Base Voronoi. inspired by https://www.shadertoy.com/view/MslGD8\n\n#define hash22(p) fract( 18.5453 * sin( p * mat2(127.1,311.7,269.5,183.3)) )\n#define disp(p) ( -ofs + (1.+2.*ofs) * hash22(p) )\n\nvec3 voronoi( vec2 u ) // returns len + id\n{\n vec2 iu = floor(u), v;\n\tfloat m = 1e9,d;\n#if VARIANT\n for( int k=0; k < 25; k++ ) {\n vec2 p = iu + vec2(k%5-2,k/5-2),\n#else\n for( int k=0; k < 9; k++ ) {\n vec2 p = iu + vec2(k%3-1,k/3-1),\n#endif\n o = disp(p),\n \t r = p - u + o;\n\t\td = dot(r,r);\n if( d < m ) m = d, v = r;\n }\n\n return vec3( sqrt(m), v+u );\n}\n\n// --- Voronoi distance to borders. inspired by https://www.shadertoy.com/view/ldl3W8\nvec3 voronoiB( vec2 u ) // returns len + id\n{\n vec2 iu = floor(u), C, P;\n\tfloat m = 1e9,d;\n#if VARIANT\n for( int k=0; k < 25; k++ ) {\n vec2 p = iu + vec2(k%5-2,k/5-2),\n#else\n for( int k=0; k < 9; k++ ) {\n vec2 p = iu + vec2(k%3-1,k/3-1),\n#endif\n o = disp(p),\n \t r = p - u + o;\n\t\td = dot(r,r);\n if( d < m ) m = d, C = p-iu, P = r;\n }\n\n m = 1e9;\n \n for( int k=0; k < 25; k++ ) {\n vec2 p = iu+C + vec2(k%5-2,k/5-2),\n\t\t o = disp(p),\n r = p-u + o;\n\n if( dot(P-r,P-r)>1e-5 )\n m = min( m, .5*dot( (P+r), normalize(r-P) ) );\n }\n\n return vec3( m, P+u );\n}\n\n// === pseudo Perlin noise =============================================\n#define rot(a) mat2(cos(a),-sin(a),sin(a),cos(a))\nint MOD = 1; // type of Perlin noise\n \n// --- 2D\n#define hash21(p) fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453123)\nfloat noise2(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p); f = f*f*(3.-2.*f); // smoothstep\n\n float v= mix( mix(hash21(i+vec2(0,0)),hash21(i+vec2(1,0)),f.x),\n mix(hash21(i+vec2(0,1)),hash21(i+vec2(1,1)),f.x), f.y);\n\treturn MOD==0 ? v\n\t : MOD==1 ? 2.*v-1.\n : MOD==2 ? abs(2.*v-1.)\n : 1.-abs(2.*v-1.);\n}\n\nfloat fbm2(vec2 p) {\n float v = 0., a = .5;\n mat2 R = rot(.37);\n\n for (int i = 0; i < 9; i++, p*=2.,a/=2.) \n p *= R,\n v += a * noise2(p);\n\n return v;\n}\n#define noise22(p) vec2(noise2(p),noise2(p+17.7))\nvec2 fbm22(vec2 p) {\n vec2 v = vec2(0);\n float a = .5;\n mat2 R = rot(.37);\n\n for (int i = 0; i < 6; i++, p*=2.,a/=2.) \n p *= R,\n v += a * noise22(p);\n\n return v;\n}\nvec2 mfbm22(vec2 p) { // multifractal fbm \n vec2 v = vec2(1);\n float a = .5;\n mat2 R = rot(.37);\n\n for (int i = 0; i < 6; i++, p*=2.,a/=2.) \n p *= R,\n //v *= 1.+noise22(p);\n v += v * a * noise22(p);\n\n return v-1.;\n}\n\n/*\n// --- 3D \n#define hash31(p) fract(sin(dot(p,vec3(127.1,311.7, 74.7)))*43758.5453123)\nfloat noise3(vec3 p) {\n vec3 i = floor(p);\n vec3 f = fract(p); f = f*f*(3.-2.*f); // smoothstep\n\n float v= mix( mix( mix(hash31(i+vec3(0,0,0)),hash31(i+vec3(1,0,0)),f.x),\n mix(hash31(i+vec3(0,1,0)),hash31(i+vec3(1,1,0)),f.x), f.y), \n mix( mix(hash31(i+vec3(0,0,1)),hash31(i+vec3(1,0,1)),f.x),\n mix(hash31(i+vec3(0,1,1)),hash31(i+vec3(1,1,1)),f.x), f.y), f.z);\n\treturn MOD==0 ? v\n\t : MOD==1 ? 2.*v-1.\n : MOD==2 ? abs(2.*v-1.)\n : 1.-abs(2.*v-1.);\n}\n\nfloat fbm3(vec3 p) {\n float v = 0., a = .5;\n mat2 R = rot(.37);\n\n for (int i = 0; i < 9; i++, p*=2.,a/=2.) \n p.xy *= R, p.yz *= R,\n v += a * noise3(p);\n\n return v;\n}\n*/\n \n// ======================================================\n\nvoid main()\n{\n vec4 O;\n vec2 U = vertexUv.xy * iResolution.yy;\n U *= 4./iResolution.y;\n U.x += iTime; // for demo\n // O = vec4( 1.-voronoiB(U).x,voronoi(U).x, 0,0 ); // for tests\n vec2 I = floor(U/2.); \n bool vert = mod(I.x+I.y,2.)==0.; //if (vert) U = U.yx;\n vec3 H0;\n O-=O;\n\n for(float i=0.; i{this.parse(e,t,i)}),n,i)}parse(e,t,n=(()=>{})){this.decodeDracoFile(e,t,null,null,it,n).catch(n)}decodeDracoFile(e,t,n,i,r=rt,a=(()=>{})){const s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,s).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(tu.has(e)){const t=tu.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(r,a).then((n=>(i=n,new Promise(((n,a)=>{i._callbacks[r]={resolve:n,reject:a},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return s.catch((()=>!0)).then((()=>{i&&r&&this._releaseTask(i,r)})),tu.set(e,{key:n,promise:s}),s}_createGeometry(e){const t=new Ji;e.index&&t.setIndex(new ki(e.index.array,1));for(let n=0;n{n.load(e,t,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=iu.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.lengtht._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e{const t=e.draco,s=new t.Decoder;try{const e=function(e,t,i,r){const a=r.attributeIDs,s=r.attributeTypes;let o,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)o=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,o);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,o)}if(!l.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in a){const l=self[s[i]];let c,d;if(r.useUniqueIDs)d=a[i],c=t.GetAttributeByUniqueId(o,d);else{if(d=t.GetAttributeId(o,e[a[i]]),-1===d)continue;c=t.GetAttribute(o,d)}const u=n(e,t,o,i,l,c);"color"===i&&(u.vertexColorSpace=r.vertexColorSpace),h.attributes.push(u)}return c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),r=4*i,a=e._malloc(r);t.GetTrianglesUInt32Array(n,r,a);const s=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:s,itemSize:1}}(e,t,o)),e.destroy(o),h}(t,s,new Int8Array(i),a),o=e.attributes.map((e=>e.array.buffer));e.index&&o.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},o)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(s)}}))}}}function ru(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported.")));const l=new Zu(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise((function(i,r){n.parse(e,t,i,r)}))}}function su(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const ou={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class lu{constructor(e){this.parser=e,this.name=ou.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class wu{constructor(e){this.parser=e,this.name=ou.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class bu{constructor(e){this.parser=e,this.name=ou.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Mu{constructor(e){this.name=ou.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){const n=e.byteOffset||0,i=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then((function(e){return e.buffer})):r.ready.then((function(){const t=new ArrayBuffer(a*s);return r.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t}))}))}return null}}class Tu{constructor(e){this.name=ou.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==Uu.TRIANGLES&&e.mode!==Uu.TRIANGLE_STRIP&&e.mode!==Uu.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,a=[],s={};for(const e in r)a.push(this.parser.getDependency("accessor",r[e]).then((t=>(s[e]=t,s[e]))));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then((e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new Hn,n=new dn,a=new hn,o=new dn(1,1,1),l=new $o(e.geometry,e.material,i);for(let e=0;e-1,a=r?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&a<98?this.textureLoader=new Sc(this.options.manager):this.textureLoader=new zc(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new _c(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){const a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return Vu(r,a,i),Gu(a,i),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){for(const e of a.scenes)e.updateMatrixWorld();e(a)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,h[e*a+1]),a>=3&&p.setZ(t,h[e*a+2]),a>=4&&p.setW(t,h[e*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],s=r.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);const n=(r.samplers||{})[a.sampler]||{};return t.magFilter=Nu[n.magFilter]||q,t.minFilter=Nu[n.minFilter]||K,t.wrapS=Fu[n.wrapS]||V,t.wrapT=Fu[n.wrapT]||V,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[o]=l,l}loadImageSource(e,t){const n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const r=n.images[e],a=self.URL||self.webkitURL;let s=r.uri||"",o=!1;if(void 0!==r.bufferView)s=this.getDependency("bufferView",r.bufferView).then((function(e){o=!0;const t=new Blob([e],{type:r.mimeType});return s=a.createObjectURL(t),s}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(s).then((function(e){return new Promise((function(n,r){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){const t=new rn(e);t.needsUpdate=!0,n(t)}),t.load(Bc.resolveURL(e,i.path),a,void 0,r)}))})).then((function(e){var t;return!0===o&&a.revokeObjectURL(s),Gu(e,r),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e}));return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then((function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),r.extensions[ou.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[ou.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=r.associations.get(a);a=r.extensions[ou.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==i&&(a.colorSpace=i),e[t]=a,a}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new fl,Ii.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new el,Ii.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||a){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Gl}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const s={},o=[];if((r.extensions||{})[ou.KHR_MATERIALS_UNLIT]){const e=i[ou.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),o.push(e.extendParams(s,r,t))}else{const n=r.pbrMetallicRoughness||{};if(s.color=new Ci(1,1,1),s.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],rt),s.opacity=e[3]}void 0!==n.baseColorTexture&&o.push(t.assignTexture(s,"map",n.baseColorTexture,it)),s.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,s.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(t.assignTexture(s,"metalnessMap",n.metallicRoughnessTexture)),o.push(t.assignTexture(s,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),o.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))}!0===r.doubleSided&&(s.side=2);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===l&&(s.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&a!==Ui&&(o.push(t.assignTexture(s,"normalMap",r.normalTexture)),s.normalScale=new Nt(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&a!==Ui&&(o.push(t.assignTexture(s,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(s.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&a!==Ui){const e=r.emissiveFactor;s.emissive=(new Ci).setRGB(e[0],e[1],e[2],rt)}return void 0!==r.emissiveTexture&&a!==Ui&&o.push(t.assignTexture(s,"emissiveMap",r.emissiveTexture,it)),Promise.all(o).then((function(){const n=new a(s);return r.name&&(n.name=r.name),Gu(n,r),t.associations.set(n,{materials:e}),r.extensions&&Vu(i,n,r),n}))}createUniqueName(e){const t=Xc.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[ou.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return Ku(n,e,t)}))}const a=[];for(let n=0,s=e.length;n0&&Wu(d,r),d.name=t.createUniqueName(r.name||"mesh_"+e),Gu(d,r),h.extensions&&Vu(i,d,h),t.assignFinalMaterial(d),l.push(d)}for(let n=0,i=l.length;n1?new vo:1===t.length?t[0]:new fi,s!==t[0])for(let e=0,n=t.length;e{const t=new Map;for(const[e,n]of i.associations)(e instanceof Ii||e instanceof rn)&&t.set(e,n);return e.traverse((e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)})),t})(r),r}))}_createAnimationTracks(e,t,n,i,r){const a=[],s=e.name?e.name:e.uuid,o=[];let l;switch(ku[r.path]===ku.weights?e.traverse((function(e){e.morphTargetInfluences&&o.push(e.name?e.name:e.uuid)})):o.push(s),ku[r.path]){case ku.weights:l=ac;break;case ku.rotation:l=oc;break;case ku.position:case ku.scale:l=cc;break;default:l=1===n.itemSize?ac:cc}const c=void 0!==i.interpolation?Hu[i.interpolation]:et,h=this._getArrayFromAccessor(n);for(let e=0,n=o.length;eMath.PI&&(_-=m),w<-Math.PI?w+=m:w>Math.PI&&(w-=m),s.theta=_<=w?Math.max(_,Math.min(w,s.theta)):s.theta>(_+w)/2?Math.max(_,s.theta):Math.min(w,s.theta)),s.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,s.phi)),s.makeSafe(),!0===n.enableDamping?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let b=!1;if(n.zoomToCursor&&S||n.object.isOrthographicCamera)s.radius=U(s.radius);else{const e=s.radius;s.radius=U(s.radius*l),b=e!=s.radius}if(t.setFromSpherical(s),t.applyQuaternion(d),v.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(o.theta*=1-n.dampingFactor,o.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(o.set(0,0,0),c.set(0,0,0)),n.zoomToCursor&&S){let i=null;if(n.object.isPerspectiveCamera){const e=t.length();i=U(e*l);const r=e-i;n.object.position.addScaledVector(x,r),n.object.updateMatrixWorld(),b=!!r}else if(n.object.isOrthographicCamera){const e=new dn(y.x,y.y,0);e.unproject(n.object);const r=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),b=r!==n.object.zoom;const a=new dn(y.x,y.y,0);a.unproject(n.object),n.object.position.sub(a).add(e),n.object.updateMatrixWorld(),i=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;null!==i&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(i).add(n.object.position):(ep.origin.copy(n.object.position),ep.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ep.direction))a||8*(1-p.dot(n.object.quaternion))>a||f.distanceToSquared(n.target)>a)&&(n.dispatchEvent(Ju),u.copy(n.object.position),p.copy(n.object.quaternion),f.copy(n.target),!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",J),n.domElement.removeEventListener("pointerdown",G),n.domElement.removeEventListener("pointercancel",j),n.domElement.removeEventListener("wheel",X),n.domElement.removeEventListener("pointermove",W),n.domElement.removeEventListener("pointerup",j),n.domElement.getRootNode().removeEventListener("keydown",Y,{capture:!0}),null!==n._domElementKeyEvents&&(n._domElementKeyEvents.removeEventListener("keydown",Z),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=i.NONE;const a=1e-6,s=new Jc,o=new Jc;let l=1;const c=new dn,h=new Nt,d=new Nt,u=new Nt,p=new Nt,f=new Nt,m=new Nt,g=new Nt,v=new Nt,_=new Nt,x=new dn,y=new Nt;let S=!1;const w=[],b={};let M=!1;function T(e){const t=Math.abs(.01*e);return Math.pow(.95,n.zoomSpeed*t)}function E(e){o.theta-=e}function A(e){o.phi-=e}const P=function(){const e=new dn;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),c.add(e)}}(),R=function(){const e=new dn;return function(t,i){!0===n.screenSpacePanning?e.setFromMatrixColumn(i,1):(e.setFromMatrixColumn(i,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),c.add(e)}}(),C=function(){const e=new dn;return function(t,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const a=n.object.position;e.copy(a).sub(n.target);let s=e.length();s*=Math.tan(n.object.fov/2*Math.PI/180),P(2*t*s/r.clientHeight,n.object.matrix),R(2*i*s/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(P(t*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),R(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function L(e){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function D(e){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(e,t){if(!n.zoomToCursor)return;S=!0;const i=n.domElement.getBoundingClientRect(),r=e-i.left,a=t-i.top,s=i.width,o=i.height;y.x=r/s*2-1,y.y=-a/o*2+1,x.set(y.x,y.y,1).unproject(n.object).sub(n.object.position).normalize()}function U(e){return Math.max(n.minDistance,Math.min(n.maxDistance,e))}function O(e){h.set(e.clientX,e.clientY)}function N(e){p.set(e.clientX,e.clientY)}function F(e){if(1===w.length)h.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);h.set(n,i)}}function B(e){if(1===w.length)p.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);p.set(n,i)}}function z(e){const t=$(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);g.set(0,r)}function k(e){if(1==w.length)d.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);d.set(n,i)}u.subVectors(d,h).multiplyScalar(n.rotateSpeed);const t=n.domElement;E(2*Math.PI*u.x/t.clientHeight),A(2*Math.PI*u.y/t.clientHeight),h.copy(d)}function H(e){if(1===w.length)f.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);f.set(n,i)}m.subVectors(f,p).multiplyScalar(n.panSpeed),C(m.x,m.y),p.copy(f)}function V(e){const t=$(e),i=e.pageX-t.x,r=e.pageY-t.y,a=Math.sqrt(i*i+r*r);v.set(0,a),_.set(0,Math.pow(v.y/g.y,n.zoomSpeed)),L(_.y),g.copy(v),I(.5*(e.pageX+t.x),.5*(e.pageY+t.y))}function G(e){!1!==n.enabled&&(0===w.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",W),n.domElement.addEventListener("pointerup",j)),function(e){for(let t=0;t0?L(T(_.y)):_.y<0&&D(T(_.y)),g.copy(v),n.update()}(e);break;case i.PAN:if(!1===n.enablePan)return;!function(e){f.set(e.clientX,e.clientY),m.subVectors(f,p).multiplyScalar(n.panSpeed),C(m.x,m.y),p.copy(f),n.update()}(e)}}(e))}function j(e){switch(function(e){delete b[e.pointerId];for(let t=0;t0&&L(T(e.deltaY)),n.update()}(function(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100}return e.ctrlKey&&!M&&(n.deltaY*=10),n}(e)),n.dispatchEvent($u))}function Y(e){"Control"===e.key&&(M=!0,n.domElement.getRootNode().addEventListener("keyup",q,{passive:!0,capture:!0}))}function q(e){"Control"===e.key&&(M=!1,n.domElement.getRootNode().removeEventListener("keyup",q,{passive:!0,capture:!0}))}function Z(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?A(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?A(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?E(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?E(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function K(e){switch(Q(e),w.length){case 1:switch(n.touches.ONE){case 0:if(!1===n.enableRotate)return;F(e),r=i.TOUCH_ROTATE;break;case 1:if(!1===n.enablePan)return;B(e),r=i.TOUCH_PAN;break;default:r=i.NONE}break;case 2:switch(n.touches.TWO){case 2:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&z(e),n.enablePan&&B(e)}(e),r=i.TOUCH_DOLLY_PAN;break;case 3:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&z(e),n.enableRotate&&F(e)}(e),r=i.TOUCH_DOLLY_ROTATE;break;default:r=i.NONE}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent(Qu)}function J(e){!1!==n.enabled&&e.preventDefault()}function Q(e){let t=b[e.pointerId];void 0===t&&(t=new Nt,b[e.pointerId]=t),t.set(e.pageX,e.pageY)}function $(e){const t=e.pointerId===w[0]?w[1]:w[0];return b[t]}n.domElement.addEventListener("contextmenu",J),n.domElement.addEventListener("pointerdown",G),n.domElement.addEventListener("pointercancel",j),n.domElement.addEventListener("wheel",X,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",Y,{passive:!0,capture:!0}),this.update()}}const rp=new qc,ap=new dn,sp=new dn,op=new hn,lp={X:new dn(1,0,0),Y:new dn(0,1,0),Z:new dn(0,0,1)},cp={type:"change"},hp={type:"mouseDown",mode:null},dp={type:"mouseUp",mode:null},up={type:"objectChange"};class pp extends fi{constructor(e,t){super(),void 0===t&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const n=new Up;this._gizmo=n,this.add(n);const i=new Op;this._plane=i,this.add(i);const r=this;function a(e,t){let a=t;Object.defineProperty(r,e,{get:function(){return void 0!==a?a:t},set:function(t){a!==t&&(a=t,i[e]=t,n[e]=t,r.dispatchEvent({type:e+"-changed",value:t}),r.dispatchEvent(cp))}}),r[e]=t,i[e]=t,n[e]=t}a("camera",e),a("object",void 0),a("enabled",!0),a("axis",null),a("mode","translate"),a("translationSnap",null),a("rotationSnap",null),a("scaleSnap",null),a("space","world"),a("size",1),a("dragging",!1),a("showX",!0),a("showY",!0),a("showZ",!0);const s=new dn,o=new dn,l=new hn,c=new hn,h=new dn,d=new hn,u=new dn,p=new dn,f=new dn,m=new dn;a("worldPosition",s),a("worldPositionStart",o),a("worldQuaternion",l),a("worldQuaternionStart",c),a("cameraPosition",h),a("cameraQuaternion",d),a("pointStart",u),a("pointEnd",p),a("rotationAxis",f),a("rotationAngle",0),a("eye",m),this._offset=new dn,this._startNorm=new dn,this._endNorm=new dn,this._cameraScale=new dn,this._parentPosition=new dn,this._parentQuaternion=new hn,this._parentQuaternionInv=new hn,this._parentScale=new dn,this._worldScaleStart=new dn,this._worldQuaternionInv=new hn,this._worldScale=new dn,this._positionStart=new dn,this._quaternionStart=new hn,this._scaleStart=new dn,this._getPointer=fp.bind(this),this._onPointerDown=gp.bind(this),this._onPointerHover=mp.bind(this),this._onPointerMove=vp.bind(this),this._onPointerUp=_p.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(e){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(e)}pointerHover(e){if(void 0===this.object||!0===this.dragging)return;null!==e&&rp.setFromCamera(e,this.camera);const t=xp(this._gizmo.picker[this.mode],rp);this.axis=t?t.object.name:null}pointerDown(e){if(void 0!==this.object&&!0!==this.dragging&&(null==e||0===e.button)&&null!==this.axis){null!==e&&rp.setFromCamera(e,this.camera);const t=xp(this._plane,rp,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,hp.mode=this.mode,this.dispatchEvent(hp)}}pointerMove(e){const t=this.axis,n=this.mode,i=this.object;let r=this.space;if("scale"===n?r="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(r="world"),void 0===i||null===t||!1===this.dragging||null!==e&&-1!==e.button)return;null!==e&&rp.setFromCamera(e,this.camera);const a=xp(this._plane,rp,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),"translate"===n)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===r&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),"local"===r&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===r&&(i.position.applyQuaternion(op.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),"world"===r&&(i.parent&&i.position.add(ap.setFromMatrixPosition(i.parent.matrixWorld)),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(ap.setFromMatrixPosition(i.parent.matrixWorld))));else if("scale"===n){if(-1!==t.search("XYZ")){let e=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(e*=-1),sp.set(e,e,e)}else ap.copy(this.pointStart),sp.copy(this.pointEnd),ap.applyQuaternion(this._worldQuaternionInv),sp.applyQuaternion(this._worldQuaternionInv),sp.divide(ap),-1===t.search("X")&&(sp.x=1),-1===t.search("Y")&&(sp.y=1),-1===t.search("Z")&&(sp.z=1);i.scale.copy(this._scaleStart).multiply(sp),this.scaleSnap&&(-1!==t.search("X")&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===n){this._offset.copy(this.pointEnd).sub(this.pointStart);const e=20/this.worldPosition.distanceTo(ap.setFromMatrixPosition(this.camera.matrixWorld));let n=!1;"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(ap.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(lp[t]),ap.copy(lp[t]),"local"===r&&ap.applyQuaternion(this.worldQuaternion),ap.cross(this.eye),0===ap.length()?n=!0:this.rotationAngle=this._offset.dot(ap.normalize())*e),("E"===t||n)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===r&&"E"!==t&&"XYZE"!==t?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(op.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(op.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(cp),this.dispatchEvent(up)}}pointerUp(e){null!==e&&0!==e.button||(this.dragging&&null!==this.axis&&(dp.mode=this.mode,this.dispatchEvent(dp)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(cp),this.dispatchEvent(up),this.pointStart.copy(this.pointEnd))}getRaycaster(){return rp}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function fp(e){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:e.button};{const t=this.domElement.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button}}}function mp(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}function gp(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}function vp(e){this.enabled&&this.pointerMove(this._getPointer(e))}function _p(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}function xp(e,t,n){const i=t.intersectObject(e,!0);for(let e=0;ee&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"Y"===i.name&&Math.abs(Sp.copy(Rp).applyQuaternion(t).dot(this.eye))>e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"Z"===i.name&&Math.abs(Sp.copy(Cp).applyQuaternion(t).dot(this.eye))>e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"XY"===i.name&&Math.abs(Sp.copy(Cp).applyQuaternion(t).dot(this.eye)).9&&(i.visible=!1)),"Y"===this.axis&&(op.setFromEuler(yp.set(0,0,Math.PI/2)),i.quaternion.copy(t).multiply(op),Math.abs(Sp.copy(Rp).applyQuaternion(t).dot(this.eye))>.9&&(i.visible=!1)),"Z"===this.axis&&(op.setFromEuler(yp.set(0,Math.PI/2,0)),i.quaternion.copy(t).multiply(op),Math.abs(Sp.copy(Cp).applyQuaternion(t).dot(this.eye))>.9&&(i.visible=!1)),"XYZE"===this.axis&&(op.setFromEuler(yp.set(0,Math.PI/2,0)),Sp.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(bp.lookAt(wp,Sp,Rp)),i.quaternion.multiply(op),i.visible=this.dragging),"E"===this.axis&&(i.visible=!1)):"START"===i.name?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):"END"===i.name?(i.position.copy(this.worldPosition),i.visible=this.dragging):"DELTA"===i.name?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),ap.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),ap.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(ap),i.visible=this.dragging):(i.quaternion.copy(t),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=-1!==this.axis.search(i.name)))}super.updateMatrixWorld(e)}}class Op extends mr{constructor(){super(new Hr(1e5,1e5,2,2),new Ui({visible:!1,wireframe:!0,side:2,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(t="local"),Lp.copy(Pp).applyQuaternion("local"===t?this.worldQuaternion:Tp),Dp.copy(Rp).applyQuaternion("local"===t?this.worldQuaternion:Tp),Ip.copy(Cp).applyQuaternion("local"===t?this.worldQuaternion:Tp),Sp.copy(Dp),this.mode){case"translate":case"scale":switch(this.axis){case"X":Sp.copy(this.eye).cross(Lp),Ep.copy(Lp).cross(Sp);break;case"Y":Sp.copy(this.eye).cross(Dp),Ep.copy(Dp).cross(Sp);break;case"Z":Sp.copy(this.eye).cross(Ip),Ep.copy(Ip).cross(Sp);break;case"XY":Ep.copy(Ip);break;case"YZ":Ep.copy(Lp);break;case"XZ":Sp.copy(Ip),Ep.copy(Dp);break;case"XYZ":case"E":Ep.set(0,0,0)}break;default:Ep.set(0,0,0)}0===Ep.length()?this.quaternion.copy(this.cameraQuaternion):(Ap.lookAt(ap.set(0,0,0),Ep,Sp),this.quaternion.setFromRotationMatrix(Ap)),super.updateMatrixWorld(e)}}class Np{constructor(e,t,n){this.renderer=e,this.canvas=n||this.renderer.domElement,this.camera=t,this.orbitControls=new ip(t,this.canvas)}addTransformControl(e,t){const n=new pp(this.camera,this.canvas);return n.addEventListener("dragging-changed",(e=>{this.orbitControls.enabled=!e.value})),n.attach(e),t.add(n),n}update(){this.orbitControls.update()}}class Fp extends mr{constructor(e,t){super(new Hr(1,1,10,10),new Wl({color:Fp.alphaMap?0:16777215,transparent:!0,depthWrite:!1,polygonOffset:!0,name:"ShadowGroundPlaneMaterial"})),this.name="ShadowGroundPlane",this.userData.isFloor=!0,this.renderOrder=1,this.receiveShadow=!1,this.layers.disableAll(),t&&this.updateMaterial(t),this.setShadowMap(e)}setVisibility(e){this.visible=e,this.setVisibilityLayers(e)}setVisibilityLayers(e){e?this.layers.enableAll():this.layers.disableAll()}setDepthWrite(e){const t=this.material;t.depthWrite=e,t.transparent=!e,t.needsUpdate=!0,this.setVisibility(e)}setReceiveShadow(e){this.receiveShadow=e,this.setVisibility(e)}setShadowMap(e){const t=this.material;Fp.alphaMap?(t.alphaMap=e,t.map=null,t.color.set(0)):(t.alphaMap=null,t.map=e,t.color.set(16777215)),t.needsUpdate=!0}updateMaterial(e){const t=this.material;e.opacity&&t.opacity!==e.opacity&&(t.opacity=e.opacity),e.polygonOffset&&t.polygonOffsetFactor!==e.polygonOffset&&(t.polygonOffset=!0,t.polygonOffsetFactor=e.polygonOffset,t.polygonOffsetUnits=e.polygonOffset),t.needsUpdate=!0}}Fp.alphaMap=!0;class Bp extends vh{get renderPassManager(){return this._renderPassManager}get renderCacheManager(){return this._renderPassManager.renderCacheManager}get scene(){return this._renderPassManager.scene}get camera(){return this._renderPassManager.camera}get gBufferTextures(){return this._renderPassManager.gBufferRenderPass}get passRenderer(){return this._renderPassManager.passRenderer}constructor(e){super(),this._renderPassManager=e}render(e,t,n,i,r){this.renderPass(e)}}const zp="inputRgbNormal",kp="floatBufferNormal",Hp="separateBuffer",Vp="normalVectorAlpha",Gp=(e,t)=>{const n=Wp(e,t);let i="vec4[SAMPLES](";for(let t=0;t{const n=[];for(let i=0;i\n\t\t#include \n\n\t\t#ifndef FRAGMENT_OUTPUT\n\t\t#define FRAGMENT_OUTPUT vec4(vec3(ao), 1.)\n\t\t#endif\n\n\t\tconst vec4 sampleKernel[SAMPLES] = SAMPLE_VECTORS;\n\n\t\tvec3 getViewPosition(const in vec2 screenPosition, const in float depth) {\n\t\t\tvec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0);\n\t\t\tvec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition;\n\t\t\treturn viewSpacePosition.xyz / viewSpacePosition.w;\n\t\t}\n\n\t\tfloat getDepth(const vec2 uv) { \n\t\t\t#if DEPTH_BUFFER_ANTIALIAS == 1\n\t\t\t\tvec2 size = vec2(textureSize(tDepth, 0));\n\t\t\t\tivec2 p = ivec2(uv * size);\n\t\t\t\tfloat d0 = texelFetch(tDepth, p, 0).DEPTH_SWIZZLING;\n\t\t\t\tvec2 depth = vec2(d0, 1.0);\n\t\t\t\tfloat d1 = texelFetch(tDepth, p + ivec2(1, 0), 0).DEPTH_SWIZZLING;\n\t\t\t\tdepth += vec2(d1, 1.0) * step(abs(d1 - d0), 0.1);\n\t\t\t\tfloat d2 = texelFetch(tDepth, p - ivec2(1, 0), 0).DEPTH_SWIZZLING;\n\t\t\t\tdepth += vec2(d2, 1.0) * step(abs(d2 - d0), 0.1);\n\t\t\t\tfloat d3 = texelFetch(tDepth, p + ivec2(0, 1), 0).DEPTH_SWIZZLING;\n\t\t\t\tdepth += vec2(d3, 1.0) * step(abs(d3 - d0), 0.1);\n\t\t\t\tfloat d4 = texelFetch(tDepth, p - ivec2(0, 1), 0).DEPTH_SWIZZLING;\n\t\t\t\tdepth += vec2(d4, 1.0) * step(abs(d4 - d0), 0.1);\n\t\t\t\treturn depth.x / depth.y;\n \t#else\n \treturn textureLod(tDepth, uv.xy, 0.0).DEPTH_SWIZZLING;\n \t#endif\n\t\t}\n\n\t\tfloat fetchDepth(const ivec2 uv) { \n\t\t\treturn texelFetch(tDepth, uv.xy, 0).DEPTH_SWIZZLING;\n\t\t}\n\n\t\tfloat getViewZ(const in float depth) {\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\t\t\t\treturn perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n\t\t\t#else\n\t\t\t\treturn orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n\t\t\t#endif\n\t\t}\n\n\t\tvec3 computeNormalFromDepth(const vec2 uv) {\n vec2 size = vec2(textureSize(tDepth, 0));\n ivec2 p = ivec2(uv * size);\n float c0 = fetchDepth(p);\n float l2 = fetchDepth(p - ivec2(2, 0));\n float l1 = fetchDepth(p - ivec2(1, 0));\n float r1 = fetchDepth(p + ivec2(1, 0));\n float r2 = fetchDepth(p + ivec2(2, 0));\n float b2 = fetchDepth(p - ivec2(0, 2));\n float b1 = fetchDepth(p - ivec2(0, 1));\n float t1 = fetchDepth(p + ivec2(0, 1));\n float t2 = fetchDepth(p + ivec2(0, 2));\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n vec3 ce = getViewPosition(uv, c0).xyz;\n vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n return normalize(cross(dpdx, dpdy));\n\t\t}\n\n\t\tvec3 getViewNormal(const vec2 uv) {\n\t\t\t#if NORMAL_VECTOR_TYPE == 2\n\t\t\t\treturn normalize(textureLod(tNormal, uv, 0.).rgb);\n\t\t\t#elif NORMAL_VECTOR_TYPE == 1\n\t\t\t\treturn unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb);\n\t\t\t#else\n\t\t\t\treturn computeNormalFromDepth(uv);\n\t\t\t#endif\n\t\t}\n\n\t\tvec3 getAntiAliasedViewNormal(const in vec2 screenPosition) {\n\t\t\t#if NORMAL_VECTOR_TYPE == 2\n\t\t\t\t#if NORMAL_VECTOR_ANTIALIAS == 1\n\t\t\t\t\tvec2 uv = screenPosition;\n\t\t\t\t\tvec2 size = vec2(textureSize(tNormal, 0));\n\t\t\t\t\tivec2 p = ivec2(screenPosition * size);\n\t\t\t\t\tfloat c0 = texelFetch(tNormal, p, 0).a;\n\t\t\t\t\tfloat l2 = texelFetch(tNormal, p - ivec2(2, 0), 0).a;\n\t\t\t\t\tfloat l1 = texelFetch(tNormal, p - ivec2(1, 0), 0).a;\n\t\t\t\t\tfloat r1 = texelFetch(tNormal, p + ivec2(1, 0), 0).a;\n\t\t\t\t\tfloat r2 = texelFetch(tNormal, p + ivec2(2, 0), 0).a;\n\t\t\t\t\tfloat b2 = texelFetch(tNormal, p - ivec2(0, 2), 0).a;\n\t\t\t\t\tfloat b1 = texelFetch(tNormal, p - ivec2(0, 1), 0).a;\n\t\t\t\t\tfloat t1 = texelFetch(tNormal, p + ivec2(0, 1), 0).a;\n\t\t\t\t\tfloat t2 = texelFetch(tNormal, p + ivec2(0, 2), 0).a;\n\t\t\t\t\tfloat dl = abs((2.0 * l1 - l2) - c0);\n\t\t\t\t\tfloat dr = abs((2.0 * r1 - r2) - c0);\n\t\t\t\t\tfloat db = abs((2.0 * b1 - b2) - c0);\n\t\t\t\t\tfloat dt = abs((2.0 * t1 - t2) - c0);\n\t\t\t\t\tvec3 ce = getViewPosition(uv, c0).xyz;\n\t\t\t\t\tvec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n\t\t\t\t\t\t\t\t\t\t : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n\t\t\t\t\tvec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n\t\t\t\t\t\t\t\t\t\t : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n\t\t\t\t\treturn normalize(cross(dpdx, dpdy));\n\t\t\t\t#elif NORMAL_VECTOR_ANTIALIAS == 2\n\t\t\t\t\tvec2 size = vec2(textureSize(tNormal, 0));\n\t\t\t\t\tivec2 p = ivec2(screenPosition * size);\n\t\t\t\t\tvec3 normalVector = texelFetch(tNormal, p, 0).xyz;\n\t\t\t\t\tnormalVector += texelFetch(tNormal, p + ivec2(1, 0), 0).xyz;\n\t\t\t\t\tnormalVector += texelFetch(tNormal, p - ivec2(1, 0), 0).xyz;\n\t\t\t\t\tnormalVector += texelFetch(tNormal, p + ivec2(0, 1), 0).xyz;\n\t\t\t\t\tnormalVector += texelFetch(tNormal, p - ivec2(0, 1), 0).xyz;\n\t\t\t\t\treturn normalize(normalVector);\n\t\t\t\t#else\n\t\t\t\t\treturn texture2D(tNormal, screenPosition).xyz;\n\t\t\t\t#endif\n\t\t\t#elif NORMAL_VECTOR_TYPE == 1\n\t\t\t\treturn unpackRGBToNormal(textureLod(tNormal, screenPosition, 0.).rgb);\n\t\t\t#else\n\t\t\t\treturn computeNormalFromDepth(screenPosition);\n\t\t\t#endif\n\t\t }\n\n\t\tvec3 getSceneUvAndDepth(vec3 sampleViewPos) {\n\t\t\tvec4 sampleClipPos = cameraProjectionMatrix * vec4(sampleViewPos, 1.);\n\t\t\tvec2 sampleUv = sampleClipPos.xy / sampleClipPos.w * 0.5 + 0.5;\n\t\t\tfloat sampleSceneDepth = getDepth(sampleUv);\n\t\t\treturn vec3(sampleUv, sampleSceneDepth);\n\t\t}\n\n\t\tfloat sinusToPlane(vec3 pointOnPlane, vec3 planeNormal, vec3 point) {\n\t\t\tvec3 delta = point - pointOnPlane;\n\t\t\tfloat sinV = dot(planeNormal, normalize(delta));\n\t\t\treturn sinV;\n\t\t}\n\n\t\tfloat getFallOff(float delta, float falloffDistance) {\n\t\t\tfloat fallOff = smoothstep(0., 1., 1. - distanceFallOff * abs(delta) / falloffDistance);\n\t\t\treturn fallOff;\n\t\t}\n\t\t\n\t\tvoid main() {\n\t\t\tfloat depth = getDepth(vUv.xy);\n\t\t\tif (depth >= 1.0) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvec3 viewPos = getViewPosition(vUv, depth);\n\t\t\tvec3 viewNormal = getAntiAliasedViewNormal(vUv);\n\n\t\t\tfloat radiusToUse = radius;\n\t\t\tfloat distanceFalloffToUse = thickness;\n\t\t\t#if SCREEN_SPACE_RADIUS == 1\n\t\t\t float radiusScale = getViewPosition(vec2(0.5 + float(SCREEN_SPACE_RADIUS_SCALE) / resolution.x, 0.0), depth).x;\n\t\t\t\tradiusToUse *= radiusScale;\n\t\t\t\tdistanceFalloffToUse *= radiusScale;\n\t\t\t#endif\n\n\t\t\t#if SCENE_CLIP_BOX == 1\n\t\t\t\tvec3 worldPos = (cameraWorldMatrix * vec4(viewPos, 1.0)).xyz;\n \t\t\tfloat boxDistance = length(max(vec3(0.0), max(sceneBoxMin - worldPos, worldPos - sceneBoxMax)));\n\t\t\t\tif (boxDistance > radiusToUse) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t#endif\n\t\t\t\n\t\t\tvec2 noiseResolution = vec2(textureSize(tNoise, 0));\n\t\t\tvec2 noiseUv = vUv * resolution / noiseResolution;\n\t\t\tvec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0);\n\t\t\tvec3 randomVec = noiseTexel.xyz * 2.0 - 1.0;\n\n\t\t\t#if NV_ALIGNED_SAMPLES == 1\n \t\t\t\tvec3 tangent = normalize(randomVec - viewNormal * dot(randomVec, viewNormal));\n \t\t\tvec3 bitangent = cross(viewNormal, tangent);\n \t\t\tmat3 kernelMatrix = mat3(tangent, bitangent, viewNormal);\n\t\t\t#else\n\t\t\t\tvec3 tangent = normalize(vec3(randomVec.xy, 0.));\n\t\t\t\tvec3 bitangent = vec3(-tangent.y, tangent.x, 0.);\n\t\t\t\tmat3 kernelMatrix = mat3(tangent, bitangent, vec3(0., 0., 1.));\n\t\t\t#endif\n\n\t\t#if AO_ALGORITHM == 4\n\t\t\tconst int DIRECTIONS = SAMPLES < 30 ? 3 : 5;\n\t\t\tconst int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS;\n\t\t#elif AO_ALGORITHM == 3\n\t\t\tconst int DIRECTIONS = SAMPLES < 16 ? 3 : 5;\n\t\t\tconst int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS;\n\t\t#else\n\t\t\tconst int DIRECTIONS = SAMPLES;\n\t\t\tconst int STEPS = 1;\n\t\t#endif\n\n\t\t\tfloat ao = 0.0, totalWeight = 0.0;\n\t\t\tfor (int i = 0; i < DIRECTIONS; ++i) {\n\n\t\t\t#if AO_ALGORITHM == 4\n\t\t\t\tfloat angle = float(i) / float(DIRECTIONS) * PI;\n\t\t\t\tvec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w); \n\t\t\t#elif AO_ALGORITHM == 3\n\t\t\t\tfloat angle = float(i) / float(DIRECTIONS) * 2. * PI;\n\t\t\t\tvec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w); \n\t\t\t#else\n\t\t\t\tvec4 sampleDir = sampleKernel[i];\n\t\t\t#endif\n\t\t\t\tsampleDir.xyz = normalize(kernelMatrix * sampleDir.xyz);\n\n\t\t\t\tvec3 viewDir = normalize(-viewPos.xyz);\n\t\t\t\tvec3 sliceBitangent = normalize(cross(sampleDir.xyz, viewDir));\n\t\t\t\tvec3 sliceTangent = cross(sliceBitangent, viewDir);\n\t\t\t\tvec3 normalInSlice = normalize(viewNormal - sliceBitangent * dot(viewNormal, sliceBitangent));\n\t\t\t\t\n\t\t\t#if (AO_ALGORITHM == 3 || AO_ALGORITHM == 4)\n\t\t\t\tvec3 tangentToNormalInSlice = cross(normalInSlice, sliceBitangent);\n\t\t\t\t#if AO_ALGORITHM == 4\n\t\t\t\t\tvec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice), dot(viewDir, -tangentToNormalInSlice));\n\t\t\t\t#else\n\t\t\t\t\tvec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice));\n\t\t\t\t#endif\n\t\t\t\tfor (int j = 0; j < STEPS; ++j) {\n\t\t\t\t\tvec3 sampleViewOffset = sampleDir.xyz * radiusToUse * sampleDir.w * pow(float(j + 1) / float(STEPS), distanceExponent);\n\t\t\t\t\tvec3 sampleViewPos = viewPos + sampleViewOffset;\n\t\t\t#else\n\t\t\t\t\tvec3 sampleViewPos = viewPos + sampleDir.xyz * radiusToUse * pow(sampleDir.w, distanceExponent);\n\t\t\t#endif\t\n\n\t\t\t\t\tvec3 sampleSceneUvDepth = getSceneUvAndDepth(sampleViewPos);\n\t\t\t\t\tvec3 sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);\n\t\t\t\t\tfloat sceneSampleDist = abs(sampleSceneViewPos.z);\n\t\t\t\t\tfloat sampleDist = abs(sampleViewPos.z);\n\t\t\t\t\t\n\t\t\t\t#if (AO_ALGORITHM == 3 || AO_ALGORITHM == 4)\n\t\t\t\t\t// HBAO || GTAO\n\t\t\t\t\tvec3 viewDelta = sampleSceneViewPos - viewPos;\n\t\t\t\t\tif (abs(viewDelta.z) < thickness) {\n\t\t\t\t\t\tvec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n\t\t\t\t\t\tfloat sampleCosHorizon = dot(viewDir, normalize(viewDelta));\n\t\t\t\t\t\tcosHorizons.x += max(0., (sampleCosHorizon - cosHorizons.x) * mix(1., 2. / float(j + 2), distanceFallOff) * clipRangeCheck.x * clipRangeCheck.y);\n\t\t\t\t\t}\t\t\n\t\t\t\t\t#if AO_ALGORITHM == 4\n\t\t\t\t\t\tsampleSceneUvDepth = getSceneUvAndDepth(viewPos - sampleViewOffset);\n\t\t\t\t\t\tsampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);\n\t\t\t\t\t\tviewDelta = sampleSceneViewPos - viewPos;\n\t\t\t\t\t\tif (abs(viewDelta.z) < thickness) {\n\t\t\t\t\t\t\tvec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n\t\t\t\t\t\t\tfloat sampleCosHorizon = dot(viewDir, normalize(viewDelta));\n\t\t\t\t\t\t\tcosHorizons.y += max(0., (sampleCosHorizon - cosHorizons.y) * mix(1., 2. / float(j + 2), distanceFallOff) * clipRangeCheck.x * clipRangeCheck.y);\t\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\t\t\t\t#elif AO_ALGORITHM == 2\n\t\t\t\t\t// N8AO\n\t\t\t\t\tfloat weight = dot(viewNormal, sampleDir.xyz);\n\t\t\t\t\tfloat occlusion = weight * step(sceneSampleDist + bias, sampleDist);\n\t\t\t\t#elif AO_ALGORITHM == 1\n\t\t\t\t\t// SAO\n\t\t\t\t\tvec3 viewDelta = sampleSceneViewPos - viewPos;\n\t\t\t\t\tfloat minResolution = 0.; // ?\n\t\t\t\t\tfloat scaledViewDist = length( viewDelta ) / scale;\n\t\t\t\t\tfloat weight = 1.;\n\t\t\t\t\tfloat occlusion = max(0., (dot(viewNormal, viewDelta) - minResolution) / scaledViewDist - bias) / (1. + scaledViewDist * scaledViewDist );\n\t\t\t\t#else\n\t\t\t\t\t// SSAO\n\t\t\t\t\tfloat weight = 1.;\n\t\t\t\t\tfloat occlusion = step(sceneSampleDist + bias, sampleDist);\n\t\t\t\t#endif\n\n\t\t#if AO_ALGORITHM == 4\t\n\t\t\t\t}\n\t\t\t\t// GTAO\n\t\t\t\tvec2 sinHorizons = sqrt(1. - cosHorizons * cosHorizons);\n\t\t\t\tfloat nx = dot(normalInSlice, sliceTangent);\n\t\t\t\tfloat ny = dot(normalInSlice, viewDir);\n\t\t\t\tfloat nxb = 1. / 2. * (acos(cosHorizons.y) - acos(cosHorizons.x) + sinHorizons.x * cosHorizons.x - sinHorizons.y * cosHorizons.y);\n\t\t\t\tfloat nyb = 1. / 2. * (2. - cosHorizons.x * cosHorizons.x - cosHorizons.y * cosHorizons.y);\n\t\t\t\tfloat occlusion = nx * nxb + ny * nyb;\n\t\t\t\tao += occlusion;\n\t\t\t}\n\t\t\tao = clamp(ao / float(DIRECTIONS), 0., 1.);\t\n\t\t#elif AO_ALGORITHM == 3\n\t\t\t\t}\n\t\t\t\ttotalWeight += 1.;\n\t\t\t\tao += max(0., cosHorizons.x - max(0., cosHorizons.y));\n\t\t\t}\n\t\t\tao /= totalWeight + 1. - step(0., totalWeight);\n\t\t\tao = clamp(1. - ao, 0., 1.);\n\t\t#else\n\n\t\t\t\tfloat fallOff = getFallOff(sceneSampleDist - sampleDist, distanceFalloffToUse);\n\t\t\t\tocclusion *= fallOff;\n\t\t\t\tvec2 diff = (vUv - sampleSceneUvDepth.xy) * resolution;\n\t\t\t\tocclusion *= step(1., dot(diff, diff));\n\t\t\t\tvec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n\t\t\t\tocclusion *= clipRangeCheck.x * clipRangeCheck.y;\n\t\t\t\tweight *= clipRangeCheck.x * clipRangeCheck.y;\n\t\t\t\ttotalWeight += weight;\n\t\t\t\tao += occlusion;\n\t\t\t}\n\t\t\tao /= totalWeight + 1. - step(0., totalWeight);\n\t\t\tao = clamp(1. - ao, 0., 1.);\n\t\t#endif\t\n\n\t\t#if SCENE_CLIP_BOX == 1\n\t\t\tao = mix(ao, 1., smoothstep(0., radiusToUse, boxDistance));\n\t\t#endif\n\t\t#if AO_ALGORITHM != 1\n\t\t\tao = pow(ao, scale);\n\t\t#endif\n\t\t\tgl_FragColor = FRAGMENT_OUTPUT;\n\t\t}"},Xp={resolutionScale:1,algorithm:0,samples:32,radius:.25,distanceExponent:2,thickness:.5,distanceFallOff:.5,scale:1,bias:.01,screenSpaceRadius:!1};class Yp{get texture(){var e;return this._renderTarget?null===(e=this._renderTarget)||void 0===e?void 0:e.texture:null}constructor(e,t,n,i,r){this.needsUpdate=!0,this.parameters=Object.assign({},Xp),this._width=0,this._height=0,this._samples=0,this._gBufferAntiAliasing=!1,this._normalVectorSourceType=kp,this._depthValueSourceType=Vp,this._modulateRedChannel=!1,this.depthTexture=null,this.normalTexture=null,this._noiseTexture=null,this._renderTarget=null,this._passRenderer=new Ph,this._sceneClipBox=new fn(new dn(-1,-1,-1),new dn(1,1,1)),this._sceneScale=1,this._width=e,this._height=t,this._samples=n,this._gBufferAntiAliasing=i,this._normalVectorSourceType=(null==r?void 0:r.normalVectorSourceType)||kp,this._depthValueSourceType=(null==r?void 0:r.depthValueSourceType)||Vp,this._modulateRedChannel=(null==r?void 0:r.modulateRedChannel)||!1,(null==r?void 0:r.aoParameters)&&(this.parameters=r.aoParameters),r&&this.updateTextures(r)}_getNoiseTexture(e=64){if(!this._noiseTexture){const t=new Sh,n=new Uint8Array(e*e*4);for(let i=0;i{const t=new Sh,n=Math.floor(e)%2==0?Math.floor(e)+1:Math.floor(e),i=(e=>{const t=Math.floor(e)%2==0?Math.floor(e)+1:Math.floor(e),n=t*t,i=Array(n).fill(0);let r=Math.floor(t/2),a=t-1;for(let e=1;e<=n;)-1===r&&a===t?(a=t-2,r=0):(a===t&&(a=0),r<0&&(r=t-1)),0===i[r*t+a]?(i[r*t+a]=e++,a++,r--):(a-=2,r++);return i})(n),r=i.length,a=new Uint8Array(4*r);for(let n=0;n{const r=Jp(e,t,n,i);let a="vec3[SAMPLES](";for(let t=0;t{const r=[];for(let a=0;a\n#include \n\n#if LUMINANCE_WEIGHTED == 1 \n\n#ifndef LUMINANCE_TYPE\n#define LUMINANCE_TYPE float\n#endif\n#ifndef SAMPLE_LUMINANCE\n#define SAMPLE_LUMINANCE dot(vec3(0.2125, 0.7154, 0.0721), a)\n#endif\n#define WEIGHT_TYPE LUMINANCE_TYPE\n\n#else\n#define WEIGHT_TYPE float\n#endif\n\n#ifndef FRAGMENT_OUTPUT\n#define FRAGMENT_OUTPUT vec4(vec3(denoised), 1.)\n#endif\n\nLUMINANCE_TYPE getLuminance(const in vec3 a) {\n return SAMPLE_LUMINANCE;\n}\n\nconst vec3 poissonDisk[SAMPLES] = SAMPLE_VECTORS;\n\nvec3 getViewPosition(const in vec2 screenPosition, const in float depth) {\n vec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0);\n vec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition;\n return viewSpacePosition.xyz / viewSpacePosition.w;\n}\n\nfloat getDepth(const vec2 uv) {\n#if DEPTH_VALUE_SOURCE == 1 \n return textureLod(tDepth, uv.xy, 0.0).a;\n#else\n return textureLod(tDepth, uv.xy, 0.0).r;\n#endif\n}\n\nfloat fetchDepth(const ivec2 uv) {\n#if DEPTH_VALUE_SOURCE == 1 \n return texelFetch(tDepth, uv.xy, 0).a;\n#else\n return texelFetch(tDepth, uv.xy, 0).r;\n#endif\n}\n\nvec3 computeNormalFromDepth(const vec2 uv) {\n vec2 size = vec2(textureSize(tDepth, 0));\n ivec2 p = ivec2(uv * size);\n float c0 = fetchDepth(p);\n float l2 = fetchDepth(p - ivec2(2, 0));\n float l1 = fetchDepth(p - ivec2(1, 0));\n float r1 = fetchDepth(p + ivec2(1, 0));\n float r2 = fetchDepth(p + ivec2(2, 0));\n float b2 = fetchDepth(p - ivec2(0, 2));\n float b1 = fetchDepth(p - ivec2(0, 1));\n float t1 = fetchDepth(p + ivec2(0, 1));\n float t2 = fetchDepth(p + ivec2(0, 2));\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n vec3 ce = getViewPosition(uv, c0).xyz;\n vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n return normalize(cross(dpdx, dpdy));\n}\n\nvec3 getViewNormal(const vec2 uv) {\n#if NORMAL_VECTOR_TYPE == 2\n return normalize(textureLod(tNormal, uv, 0.).rgb);\n#elif NORMAL_VECTOR_TYPE == 1\n return unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb);\n#else\n return computeNormalFromDepth(uv);\n#endif\n}\n\nvoid denoiseSample(in vec3 center, in vec3 viewNormal, in vec3 viewPos, in vec2 sampleUv, inout vec3 denoised, inout WEIGHT_TYPE totalWeight) {\n vec4 sampleTexel = textureLod(tDiffuse, sampleUv, 0.0);\n float sampleDepth = getDepth(sampleUv);\n vec3 sampleNormal = getViewNormal(sampleUv);\n vec3 neighborColor = sampleTexel.rgb;\n vec3 viewPosSample = getViewPosition(sampleUv, sampleDepth);\n \n float normalDiff = dot(viewNormal, sampleNormal);\n float normalSimilarity = pow(max(normalDiff, 0.), normalPhi);\n float depthDiff = abs(dot(normalize(viewPos - viewPosSample), viewNormal));\n float depthSimilarity = max(1. - depthDiff / depthPhi, 0.);\n #if LUMINANCE_WEIGHTED == 1 \n LUMINANCE_TYPE lumaDiff = abs(getLuminance(neighborColor) - getLuminance(center));\n LUMINANCE_TYPE lumaSimilarity = max(1. - lumaDiff / lumaPhi, 0.);\n LUMINANCE_TYPE w = lumaSimilarity * depthSimilarity * normalSimilarity;\n #else\n WEIGHT_TYPE w = depthSimilarity * normalSimilarity;\n #endif\n\n denoised += w * neighborColor;\n totalWeight += w;\n}\n\nvoid main() {\n float depth = fetchDepth(ivec2(vec2(textureSize(tDepth, 0)) * vUv.xy));\t\n vec3 viewNormal = getViewNormal(vUv);\t\n if (depth == 1. || dot(viewNormal, viewNormal) == 0.) {\n discard;\n return;\n }\n vec4 texel = textureLod(tDiffuse, vUv, 0.0);\n vec3 center = texel.rgb;\n vec3 viewPos = getViewPosition(vUv, depth);\n\n #if SCENE_CLIP_BOX == 1\n vec3 worldPos = (cameraWorldMatrix * vec4(viewPos, 1.0)).xyz;\n float boxDistance = length(max(vec3(0.0), max(sceneBoxMin - worldPos, worldPos - sceneBoxMax)));\n if (boxDistance > radius * 2.) {\n discard;\n return;\n }\n\t\t#endif\n\n vec2 noiseResolution = vec2(textureSize(tNoise, 0));\n vec2 noiseUv = vUv * resolution / noiseResolution;\n vec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0);\n vec2 noiseVec = vec2(sin(noiseTexel[iteration % 4] * 2. * PI), cos(noiseTexel[iteration % 4] * 2. * PI));\n #if SAMPLE_DISTRIBUTION == 1\n vec3 randomVec = normalize(vec3(noiseVec.xy, 0.));\n vec3 tangent = normalize(randomVec - viewNormal * dot(randomVec, viewNormal));\n vec3 bitangent = cross(viewNormal, tangent);\n mat3 kernelMatrix = mat3(tangent, bitangent, viewNormal);\n #else\n mat2 rotationMatrix = mat2(noiseVec.x, -noiseVec.y, noiseVec.x, noiseVec.y);\n #endif\n\n WEIGHT_TYPE totalWeight = WEIGHT_TYPE(1.);\n vec3 denoised = texel.rgb;\n for (int i = 0; i < SAMPLES; i++) {\n vec3 sampleDir = poissonDisk[i];\n #if SAMPLE_DISTRIBUTION == 1\n vec3 offsetViewPos = viewPos + normalize(kernelMatrix * vec3(sampleDir.xy, 0.)) * sampleDir.z * radius * radius;\n vec4 samplePointNDC = cameraProjectionMatrix * vec4(offsetViewPos, 1.0); \n vec2 sampleUv = (samplePointNDC.xy / samplePointNDC.w * 0.5 + 0.5);\n #else\n vec2 offset = rotationMatrix * sampleDir.xy * (1. + sampleDir.z * (radius - 1.));\n offset *= mix(vec2(1.0), sqrt(1.0 - viewNormal.xy * viewNormal.xy), float(iteration) / float(noOfIterations-1));\n offset *= max(1.0, 1.0 / length(offset));\n vec2 sampleUv = vUv + offset / resolution;\n #endif\n denoiseSample(center, viewNormal, viewPos, sampleUv, denoised, totalWeight);\n }\n\n denoised /= totalWeight + 1.0 - step(0.0, totalWeight);\n gl_FragColor = FRAGMENT_OUTPUT;\n}"},$p={iterations:2,samples:16,rings:2.89,radiusExponent:1.3,radius:4,lumaPhi:10,depthPhi:2.5,normalPhi:.5,nvOrientatedSamples:!1};class ef{get texture(){return this.parameters.iterations>0&&this._renderTargets.length>0?this._renderTargets[this._outputRenderTargetIndex].texture:this._inputTexture}set inputTexture(e){this._inputTexture=e}constructor(e,t,n,i){this.needsUpdate=!0,this.parameters=Object.assign({},$p),this._width=0,this._height=0,this._samples=0,this._normalVectorSourceType=kp,this._depthValueSourceType=Vp,this._inputTexture=null,this.depthTexture=null,this.normalTexture=null,this._noiseTexture=null,this._renderTargets=[],this._outputRenderTargetIndex=0,this._passRenderer=new Ph,this._rgInputTexture=!1,this._luminanceWeighted=!0,this._width=e,this._height=t,this._samples=n,this._normalVectorSourceType=(null==i?void 0:i.normalVectorSourceType)||kp,this._depthValueSourceType=(null==i?void 0:i.depthValueSourceType)||Vp,this._inputTexture=(null==i?void 0:i.inputTexture)||null,this.depthTexture=(null==i?void 0:i.depthTexture)||null,this.normalTexture=(null==i?void 0:i.normalTexture)||null,this._rgInputTexture=(null==i?void 0:i.rgInputTexture)||!1,this._luminanceWeighted=!0===(null==i?void 0:i.luminanceWeighted),this._luminanceType=(null==i?void 0:i.luminanceType)||"vec3",this._sampleLuminance=(null==i?void 0:i.sampleLuminance)||"a",this._fragmentOutput=(null==i?void 0:i.fragmentOutput)||"vec4(denoised.xyz, 1.)",(null==i?void 0:i.poissonDenoisePassParameters)&&(this.parameters=i.poissonDenoisePassParameters),i&&this.updateTextures(i)}_getNoiseTexture(e=64){if(!this._noiseTexture){const t=new Sh,n=new Uint8Array(e*e*4);for(let i=0;ie.dispose()))}setSize(e,t){this._width=e,this._height=t,this._renderTargets.forEach((n=>n.setSize(e,t))),this.needsUpdate=!0}updateBounds(e){this._sceneClipBox=(new fn).copy(e),this.needsUpdate=!0}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t],this.needsUpdate=!0)}updateTextures(e){e.inputTexture&&(this._inputTexture=e.inputTexture,this.needsUpdate=!0),e.depthTexture&&(this.depthTexture=e.depthTexture,this.needsUpdate=!0),e.normalTexture&&(this.normalTexture=e.normalTexture,this.needsUpdate=!0)}render(e,t){const n=this._getMaterial(t,this.needsUpdate);this.needsUpdate=!1;const i=this._getRenderTargets();n.uniforms.iteration.value=this.parameters.iterations;for(let t=0;t.001,r=e===nf&&t>.001&&t<.999;return{fadeInPoissonShadow:i,fadeInHardShadow:r,onlyHardShadow:e===nf&&!r,progressiveDenoise:!i&&!r&&n>1&&n<=this.parameters.progressiveDenoiseIterations+1}}renderPass(e){if(!this._setRenderState())return;const t=this._getRenderConditions(this.shadowAndAoPassSettings.shadowFadeInBlurType,this.shadowAndAoPassSettings.shadowFadeInMix,this.shadowAndAoPassSettings.noOStaticFrames);let n=!1;!t.onlyHardShadow&&this.shadowAndAoPassSettings.shadowBlurType===af&&this._evaluateIfUpdateIsNeeded(this.camera)&&(this._renderShadowAndAo(e,this.scene,this.camera,this.shadowAndAoPassSettings.shadowMapTexture),n=!0);let i=t.onlyHardShadow?this.shadowAndAoPassSettings.shadowMapTexture:this.denoiseRenderTargetTexture;t.fadeInPoissonShadow&&(i=this._renderDynamicShadow(e,this.aoAndSoftShadowRenderTarget.texture,this.shadowAndAoPassSettings.shadowMapTexture,this.shadowAndAoPassSettings.shadowFadeInMix),n=!0),n?i=this._renderDenoise(e,this.camera,t.fadeInPoissonShadow,!1):t.progressiveDenoise&&(i=this._renderDenoise(e,this.camera,!1,!0)),t.fadeInHardShadow&&(i=this._renderDynamicShadow(e,this.denoiseRenderTargetTexture,this.shadowAndAoPassSettings.shadowMapTexture,this.shadowAndAoPassSettings.shadowFadeInMix)),this._finalTexture=i,this._onlyHardShadow=t.onlyHardShadow,this.renderToRenderTarget&&this.renderToTarget(e)}_setRenderState(){return!(!this.parameters.enabled||!(null!==this.parameters.ao.algorithm||this.parameters.shadowIntensity>=.01)||(this.needsUpdate&&(this._aoPass&&(this._aoPass.needsUpdate=!0),this._poissonDenoisePass&&(this._poissonDenoisePass.needsUpdate=!0)),0))}_evaluateIfUpdateIsNeeded(e){e.updateProjectionMatrix();const t=this.parameters.alwaysUpdate||this.needsUpdate||null!=e&&this._cameraUpdate.changed(e);return this.needsUpdate=!1,t}_renderShadowAndAo(e,t,n,i){var r;const a=null!==this.parameters.ao.algorithm&&this.parameters.aoIntensity>.01;a||null===(r=this._aoPass)||void 0===r||r.clear(e,this.aoAndSoftShadowRenderTarget),this._renderSoftShadow(e,n,i),a&&this._renderAo(e,t,n)}_renderAo(e,t,n){const i=this.gBufferTextures.depthBufferTexture,r=this.gBufferTextures.gBufferTexture,a=this._aoAndSoftShadowRenderTarget,s=e.autoClear;e.autoClear=!1;const o=this.aoRenderPass;o.depthTexture=i,o.normalTexture=r,o.render(e,n,t,a),e.autoClear=s}_renderSoftShadow(e,t,n){const i=this.softShadowPass;i.parameters.radius=this.parameters.shadow.shadowRadius,i.inputTexture=n,this.softShadowPass.renderToTarget(e,t,this.aoAndSoftShadowRenderTarget)}_renderDynamicShadow(e,t,n,i=1){const r=i<.999;return r&&(this._copyMaterial.update({texture:t,blending:0,colorTransform:rh,colorBase:ch,multiplyChannels:0}),this.passRenderer.renderScreenSpace(e,this._copyMaterial,this.fadeRenderTarget)),i>.001&&(this._blendMaterial.update({texture:n,blending:r?5:0,colorTransform:(new Hn).set(0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,r?i:1),multiplyChannels:0}),this.passRenderer.renderScreenSpace(e,this._blendMaterial,this.fadeRenderTarget)),this.fadeRenderTarget.texture}_renderDenoise(e,t,n,i){const r=this.denoisePass;return r.inputTexture=n?this.fadeRenderTarget.texture:i?r.texture:this.aoAndSoftShadowRenderTarget.texture,r.render(e,t),r.texture}renderToTarget(e){const t=this._onlyHardShadow?this.parameters.shadowIntensity:this.parameters.aoIntensity,n=this._onlyHardShadow?0:this.parameters.shadowIntensity;this.passRenderer.renderScreenSpace(e,this._blendAoAndShadowMaterial.update({texture:this._finalTexture,blending:5,aoIntensity:t,shadowIntensity:n}),e.getRenderTarget())}}of.shadowTransform=(new Hn).set(0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1);class lf{get isOutlinePassActivated(){return this.outlinePassActivated}get outlinePass(){return this._renderPassManager.outlinePass}constructor(e,t,n){this._effectComposer=null,this.outlinePassActivated=!1,this._renderPassManager=e,this._effectComposer=t,this.parameters=Object.assign({enabled:!0,edgeStrength:2,edgeGlow:1,edgeThickness:2,pulsePeriod:0,usePatternTexture:!1,visibleEdgeColor:16777215,hiddenEdgeColor:16777215},n)}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}applyParameters(){this.outlinePass&&(this.outlinePass.edgeStrength=this.parameters.edgeStrength,this.outlinePass.edgeGlow=this.parameters.edgeGlow,this.outlinePass.edgeThickness=this.parameters.edgeThickness,this.outlinePass.pulsePeriod=this.parameters.pulsePeriod,this.outlinePass.usePatternTexture=this.parameters.usePatternTexture,this.outlinePass.visibleEdgeColor.set(this.parameters.visibleEdgeColor),this.outlinePass.hiddenEdgeColor.set(this.parameters.hiddenEdgeColor))}activateOutline(e,t){var n;if(!this.parameters.enabled)return void this.deactivateOutline();const i=(null===(n=this.outlinePass)||void 0===n?void 0:n.renderCamera)&&t.isPerspectiveCamera!==this.outlinePass.renderCamera.isPerspectiveCamera;this.outlinePass&&(this.outlinePass.renderScene=e,this.outlinePass.renderCamera=t),!i&&this.outlinePassActivated||(!i&&this.outlinePass||this._renderPassManager.createOutlinePass(),this.applyParameters(),this._effectComposer&&this._effectComposer.addPass(this.outlinePass),this.outlinePassActivated=!0)}deactivateOutline(){this.outlinePassActivated&&(this.outlinePass&&this._effectComposer&&this._effectComposer.removePass(this.outlinePass),this.outlinePassActivated=!1)}updateOutline(e,t,n){n.length>0?(this.activateOutline(e,t),this.outlinePass&&(this.outlinePass.selectedObjects=n)):this.deactivateOutline()}}const cf=(e,t)=>{for(const n in t)try{t[n].constructor===Object?e[n]=cf(e[n],t[n]):e[n]=t[n]}catch(i){e[n]=t[n]}return e},hf="default",df={shadowType:"PCFSoftShadowMap",shAndAoPassParameters:{aoIntensity:.3,shadow:{shadowRadius:.1},ao:{algorithm:0,samples:32,radius:.02,distanceExponent:2,thickness:.1,distanceFallOff:1,bias:.01},poissonDenoise:{iterations:2,samples:16,rings:2.89,radius:4,radiusExponent:1.3,depthPhi:2.5,normalPhi:.5}},groundReflectionParameters:{brightness:.5}},uf=e=>Math.max(0,Math.min(1,e));class pf{constructor(e){this.needsUpdate=!0,this._cache=null,this._cache=e}dispose(){var e;null===(e=this._cache)||void 0===e||e.dispose()}clear(){var e;null===(e=this._cache)||void 0===e||e.clear(),this.needsUpdate=!0}update(e){this.needsUpdate&&this._cache&&(e.traverse((e=>{var t,n,i;e.isLine||e.isPoints?null===(t=this._cache)||void 0===t||t.addLineOrPoint(e):e.isMesh?null===(n=this._cache)||void 0===n||n.addMesh(e):null===(i=this._cache)||void 0===i||i.addObject(e)})),this.needsUpdate=!1)}onBeforeRender(){var e;null===(e=this._cache)||void 0===e||e.onBeforeRender()}onAfterRender(){var e;null===(e=this._cache)||void 0===e||e.onAfterRender()}}class ff{constructor(){this._cacheMap=new Map}dispose(){this._cacheMap.forEach((e=>{e.dispose()}))}registerCache(e,t){this._cacheMap.set(e,new pf(t))}clearCache(){this._cacheMap.forEach((e=>{e.clear()}))}clearObjectCache(e){const t=this._cacheMap.get(e);t&&t.clear()}onBeforeRender(e,t){const n=this._cacheMap.get(e);n&&(n.update(t),n.onBeforeRender())}onAfterRender(e){const t=this._cacheMap.get(e);t&&t.onAfterRender()}render(e,t,n){const i=this._cacheMap.get(e);i&&(i.update(t),i.onBeforeRender()),n(),i&&i.onAfterRender()}}class mf{constructor(e){this._visibilityCache=new Map,this._isObjectInvisible=e}dispose(){this._visibilityCache.clear()}clear(){this._visibilityCache.clear()}addLineOrPoint(e){this._visibilityCache.set(e,e.visible)}addMesh(e){this._isObjectInvisible&&this._isObjectInvisible(e)&&this._visibilityCache.set(e,e.visible)}addObject(e){this._isObjectInvisible&&this._isObjectInvisible(e)&&this._visibilityCache.set(e,e.visible)}onBeforeRender(){this._visibilityCache.forEach(((e,t)=>{t.visible=!1}))}onAfterRender(){this._visibilityCache.forEach(((e,t)=>{t.visible=e}))}}class gf{constructor(e){this._depthWriteCache=new Set,this._doNotWriteDepth=e}dispose(){this._depthWriteCache.clear()}clear(){this._depthWriteCache.clear()}addLineOrPoint(e){}addObject(e){}addMesh(e){this._doNotWriteDepth&&this._doNotWriteDepth(e)&&e.material instanceof Gl&&e.material.depthWrite&&this._depthWriteCache.add(e.material)}onBeforeRender(){this._depthWriteCache.forEach((e=>{e.depthWrite=!1}))}onAfterRender(){this._depthWriteCache.forEach((e=>{e.depthWrite=!0}))}}class vf{constructor(){this._objectCache=new Map}clear(){this._objectCache.clear()}onBeforeRender(){this._objectCache.forEach(((e,t)=>{t instanceof mr&&(t.material!==e.originalObjectData.material&&t.material!==e.updateObjectData.material&&(e.originalObjectData.material=t.material),t.receiveShadow!==e.originalObjectData.receiveShadow&&(e.originalObjectData.receiveShadow=t.receiveShadow),t.castShadow!==e.originalObjectData.castShadow&&(e.originalObjectData.castShadow=t.castShadow),t.visible!==e.originalObjectData.visible&&(e.originalObjectData.visible=t.visible)),this._updateObject(t,e.updateObjectData)}))}onAfterRender(){this._objectCache.forEach(((e,t)=>{this._updateObject(t,e.originalObjectData)}))}addToCache(e,t){this._objectCache.set(e,{originalObjectData:{visible:e.visible,castShadow:e.castShadow,receiveShadow:e instanceof mr?e.receiveShadow:void 0,material:e instanceof mr?e.material:void 0},updateObjectData:t})}_updateObject(e,t){void 0!==t.visible&&(e.visible=t.visible),void 0!==t.castShadow&&(e.castShadow=t.castShadow),e instanceof mr&&void 0!==t.receiveShadow&&(e.receiveShadow=t.receiveShadow),e instanceof mr&&void 0!==t.material&&(e.material=t.material)}}class _f extends Bp{get shadowGroundPlane(){var e;let t=this._sharedShadowGroundPlane;return t||(null!==(e=this._shadowGroundPlane)&&void 0!==e||(this._shadowGroundPlane=new Fp(this.renderTarget.texture,this.parameters)),t=this._shadowGroundPlane),t.parent!==this._groundGroup&&this._groundGroup.add(t),t}constructor(e,t,n,i){var r,a;super(e),this.limitPlaneSize=!0,this.needsUpdate=!0,this.noNeedOfUpdateCount=0,this._blurScale=1,this._shadowScale=1,this._groundGroup=n,this.shadowMapSize=null!==(r=i.shadowMapSize)&&void 0!==r?r:2048,this.parameters=this._getDefaultParameters(i),this._groundShadowFar=this.parameters.cameraFar,this._renderer=t,null===(a=this.renderCacheManager)||void 0===a||a.registerCache(this,new mf((e=>e.isMesh&&!(e=>{var t;if(!e.isMesh)return!1;if(!e.castShadow&&!(null===(t=e.userData)||void 0===t?void 0:t.meshId))return!1;const n=e.material;return!n.transparent||n.opacity>.5})(e)||void 0!==e.name&&["Ground","Floor"].includes(e.name)))),this.renderTarget=new on(this.shadowMapSize,this.shadowMapSize),this.renderTarget.texture.generateMipmaps=!1,this._renderTargetBlur=new on(this.shadowMapSize,this.shadowMapSize),this._renderTargetBlur.texture.generateMipmaps=!1,this._sharedShadowGroundPlane=null==i?void 0:i.sharedShadowGroundPlane,this.shadowGroundPlane.setShadowMap(this.renderTarget.texture),this.shadowGroundPlane.updateMaterial(this.parameters),this._groundContactCamera=new xf,this._groundGroup.add(this._groundContactCamera),this._depthMaterial=new lo,this._depthMaterial.userData.fadeoutBias={value:this.parameters.fadeoutBias},this._depthMaterial.userData.fadeoutFalloff={value:this.parameters.fadeoutFalloff},this._depthMaterial.onBeforeCompile=e=>{e.uniforms.fadeoutBias=this._depthMaterial.userData.fadeoutBias,e.uniforms.fadeoutFalloff=this._depthMaterial.userData.fadeoutFalloff,e.fragmentShader=`\n uniform float fadeoutBias;\n uniform float fadeoutFalloff;\n ${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );",Fp.alphaMap?"gl_FragColor = vec4(clamp(pow(1.0 + fadeoutBias - fragCoordZ, 1.0/(1.0-fadeoutFalloff)), 0.0, 1.0));":"gl_FragColor = vec4(vec3(0.0), clamp(pow(1.0 + fadeoutBias - fragCoordZ, 1.0/(1.0-fadeoutFalloff)), 0.0, 1.0));")}\n `},this._depthMaterial.side=2,this._depthMaterial.depthTest=!0,this._depthMaterial.depthWrite=!0,this._blurPass=new Rh(mh,Object.assign(Object.assign({},i),{passRenderer:this.renderPassManager.passRenderer})),this.updatePlaneAndShadowCamera()}_getDefaultParameters(e){return Object.assign({enabled:!0,cameraHelper:!1,alwaysUpdate:!1,fadeIn:!1,blurMin:.001,blurMax:.1,fadeoutFalloff:.9,fadeoutBias:.03,opacity:.5,maximumPlaneSize:40,planeSize:10,cameraFar:3,hardLayers:null,softLayers:null,polygonOffset:2,excludeGroundObjects:!0},e)}dispose(){this.renderTarget.dispose(),this._renderTargetBlur.dispose(),this._blurPass.dispose(),this._depthMaterial.dispose()}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t]);void 0!==e.cameraFar&&(this._groundShadowFar=this.parameters.cameraFar)}applyParameters(){this.shadowGroundPlane.updateMaterial(this.parameters),this._groundContactCamera.updateCameraHelper(this.parameters.cameraHelper),this._groundContactCamera.far!==this.parameters.cameraFar&&this.updatePlaneAndShadowCamera();const e=this.parameters.fadeoutFalloff;this._depthMaterial.userData.fadeoutFalloff.value!==e&&(this._depthMaterial.userData.fadeoutFalloff.value=this.parameters.fadeoutFalloff);const t=this.parameters.fadeoutBias/this._groundContactCamera.far;this._depthMaterial.userData.fadeoutBias.value!==t&&(this._depthMaterial.userData.fadeoutBias.value=t),this.needsUpdate=!0}setScale(e,t){this._blurScale=e,this._shadowScale=null!=t?t:e,this.needsUpdate=!0}updateBounds(e,t){var n;this._groundShadowFar=this.parameters.cameraFar,this._groundShadowFarthis.parameters.maximumPlaneSize?(this.parameters.planeSize=this.parameters.maximumPlaneSize,this._groundGroup.position.set(0,null!=t?t:0,0)):this._groundGroup.position.set(e.center.x,null!=t?t:0,e.center.z),this._groundGroup.updateMatrixWorld(),this.updatePlaneAndShadowCamera()}updatePlaneAndShadowCamera(){const e=this.parameters.planeSize;this.shadowGroundPlane.scale.x=e,this.shadowGroundPlane.scale.y=e,this._groundContactCamera.updateCameraFormPlaneSize(e,this._groundShadowFar),this.needsUpdate=!0}setGroundVisibilityLayers(e){this.shadowGroundPlane.setVisibilityLayers(e)}renderPass(e){if(this._groundContactCamera.updateCameraHelper(this.parameters.cameraHelper,this.scene),!this.parameters.enabled)return void(this.needsUpdate&&(this.needsUpdate=!1,this.passRenderer.clear(e,this.renderTarget,0,1)));if(this.shadowGroundPlane.visible=this.parameters.enabled,this.parameters.alwaysUpdate||this.needsUpdate)this.noNeedOfUpdateCount=0;else if(this.noNeedOfUpdateCount++,this.noNeedOfUpdateCount>=10)return;this.needsUpdate=!1,this.shadowGroundPlane.material.opacity=this.parameters.alwaysUpdate||!this.parameters.fadeIn?this.parameters.opacity:this.parameters.opacity*(this.noNeedOfUpdateCount+2)/12;const t=this._renderer.getClearAlpha();this._renderer.setClearAlpha(0),this._groundGroup.visible=!1,this.shadowGroundPlane.visible=!1,this._groundContactCamera.setCameraHelperVisibility(!1),0===this.noNeedOfUpdateCount?(this._renderGroundContact(this.scene),this._renderBlur()):1===this.noNeedOfUpdateCount&&this._renderBlur(),this._renderReduceBandingBlur(),this._renderer.setRenderTarget(null),this._renderer.setClearAlpha(t),this._groundGroup.visible=!0,this.shadowGroundPlane.visible=this.parameters.enabled,this._groundContactCamera.setCameraHelperVisibility(this.parameters.cameraHelper)}_renderGroundContact(e){const t=e.background;e.background=null,e.overrideMaterial=this._depthMaterial,this._renderer.setRenderTarget(this.renderTarget),this._renderer.clear();const n=this._renderer.autoClear;this._renderer.autoClear=!1,this.parameters.hardLayers&&(this._groundContactCamera.layers.mask=this.parameters.hardLayers.mask,this._groundContactCamera.updateCameraFarPlane(10),this._depthMaterial.userData.fadeoutBias.value=.99,this._renderer.render(e,this._groundContactCamera),this._groundContactCamera.updateCameraFarPlane(this._groundShadowFar),this._depthMaterial.userData.fadeoutBias.value=this.parameters.fadeoutBias/this._groundShadowFar),this._groundContactCamera.layers.enableAll(),this.parameters.softLayers&&(this._groundContactCamera.layers.mask=this.parameters.softLayers.mask),this.renderCacheManager?this.renderCacheManager.render(this,e,(()=>{this._renderer.render(e,this._groundContactCamera)})):this._renderer.render(e,this._groundContactCamera),this._renderer.autoClear=n,e.overrideMaterial=null,e.background=t}_renderBlur(){this._renderBlurPass(this._blurScale*this.parameters.blurMin/this.parameters.planeSize,this._blurScale*this.parameters.blurMax/this.parameters.planeSize)}_renderReduceBandingBlur(){const e=.01*this._blurScale/this.parameters.planeSize;this._renderBlurPass(e,e)}_renderBlurPass(e,t){this._blurPass.render(this._renderer,[this.renderTarget,this._renderTargetBlur,this.renderTarget],[e,e],[t,t])}}_f.addTestMesh=!1;class xf extends ea{constructor(){super(-1,1,-1,1,-1,1),this.rotation.x=Math.PI}updateCameraFormPlaneSize(e,t){var n;this.left=-e/2,this.right=e/2,this.top=-e/2,this.bottom=e/2,this.near=0,this.far=t,this.updateProjectionMatrix(),null===(n=this.cameraHelper)||void 0===n||n.update()}updateCameraFarPlane(e){var t;this.far=e,this.updateProjectionMatrix(),null===(t=this.cameraHelper)||void 0===t||t.update()}updateCameraHelper(e,t){var n,i,r;e?(this.cameraHelper=null!==(n=this.cameraHelper)&&void 0!==n?n:new eh(this),this.cameraHelper.visible=!0,null==t||t.add(this.cameraHelper)):(null===(i=this.cameraHelper)||void 0===i?void 0:i.parent)&&(null===(r=this.cameraHelper)||void 0===r||r.removeFromParent())}setCameraHelperVisibility(e){this.cameraHelper&&(this.cameraHelper.visible=e)}}class yf extends wr{constructor(e){var t;super({defines:Object.assign(Object.assign(Object.assign({},yf._normalAndDepthShader.defines),{FLOAT_BUFFER:(null==e?void 0:e.floatBufferType)?1:0,LINEAR_DEPTH:(null==e?void 0:e.linearDepth)?1:0})),uniforms:Sr.clone(yf._normalAndDepthShader.uniforms),vertexShader:yf._normalAndDepthShader.vertexShader,fragmentShader:yf._normalAndDepthShader.fragmentShader,blending:null!==(t=null==e?void 0:e.blending)&&void 0!==t?t:0}),this.update(e)}update(e){if(void 0!==(null==e?void 0:e.camera)){const t=(null==e?void 0:e.camera)||(null==e?void 0:e.camera);this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far}return this}}yf._normalAndDepthShader={uniforms:{cameraNear:{value:.1},cameraFar:{value:1}},defines:{FLOAT_BUFFER:0,LINEAR_DEPTH:0},vertexShader:"varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n#endif\n\n void main() {\n vNormal = normalMatrix * normal;\n vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);\n #if LINEAR_DEPTH == 1\n vZ = viewPosition.z; \n #endif\n gl_Position = projectionMatrix * viewPosition;\n }",fragmentShader:"varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n uniform float cameraNear;\n uniform float cameraFar;\n#endif\n\n void main() {\n #if FLOAT_BUFFER == 1\n vec3 normal = normalize(vNormal);\n #else\n vec3 normal = normalize(vNormal) * 0.5 + 0.5;\n #endif\n #if LINEAR_DEPTH == 1\n float depth = (-vZ - cameraNear) / (cameraFar - cameraNear);\n #else\n float depth = gl_FragCoord.z;\n #endif\n gl_FragColor = vec4(normal, depth);\n }"};class Sf extends Bp{set groundDepthWrite(e){this._gBufferMaterialCache&&(this._gBufferMaterialCache.groundDepthWrite=e)}get isFloatGBufferWithRgbNormalAlphaDepth(){return this.floatRgbNormalAlphaDepth}get gBufferTexture(){return this.depthNormalRenderTarget.texture}get depthBufferTexture(){return this.copyToSeparateDepthBuffer&&this.floatRgbNormalAlphaDepth?this.separateDeptRenderTarget.texture:this.depthNormalRenderTarget.depthTexture}get textureWithDepthValue(){return this.floatRgbNormalAlphaDepth?this.depthNormalRenderTarget.texture:this.depthNormalRenderTarget.depthTexture}updateGBufferRenderMaterial(e){var t;return this._gBufferRenderMaterial=null!==(t=this._gBufferRenderMaterial)&&void 0!==t?t:this.floatRgbNormalAlphaDepth?new yf({blending:0,floatBufferType:!0,linearDepth:!1}):new Xl({blending:0}),this._gBufferRenderMaterial instanceof yf&&this._gBufferRenderMaterial.update({camera:e}),this._gBufferRenderMaterial}get depthNormalRenderTarget(){if(!this._depthNormalRenderTarget)if(this.floatRgbNormalAlphaDepth)this._depthNormalRenderTarget=new on(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale,{minFilter:this._targetMinificationTextureFilter,magFilter:this._targetMagnificationTextureFilter,type:ie,samples:this._samples});else{const e=new ba(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale);e.format=me,e.type=oe,this._depthNormalRenderTarget=new on(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale,{minFilter:this._targetMinificationTextureFilter,magFilter:this._targetMagnificationTextureFilter,depthTexture:e})}return this._depthNormalRenderTarget}get separateDeptRenderTarget(){return this._separateDeptRenderTarget||(this._separateDeptRenderTarget=new on(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale,{minFilter:this._targetMinificationTextureFilter,magFilter:this._targetMagnificationTextureFilter,type:ie,samples:0})),this._separateDeptRenderTarget}constructor(e,t){var n,i,r,a,s,o,l,c,h;super(e),this.floatRgbNormalAlphaDepth=!1,this.linearDepth=!1,this.copyToSeparateDepthBuffer=!1,this.needsUpdate=!0,this.drawGround=!0,this.floatRgbNormalAlphaDepth=null!==(i=null===(n=null==t?void 0:t.capabilities)||void 0===n?void 0:n.isWebGL2)&&void 0!==i&&i,this.renderCacheManager&&(this._gBufferMaterialCache=new wf,this.renderCacheManager.registerCache(this,this._gBufferMaterialCache)),this.parameters={depthNormalScale:null!==(r=null==t?void 0:t.depthNormalScale)&&void 0!==r?r:1},this._targetMinificationTextureFilter=null!==(a=null==t?void 0:t.textureMinificationFilter)&&void 0!==a?a:j,this._targetMagnificationTextureFilter=null!==(s=null==t?void 0:t.textureMagnificationFilter)&&void 0!==s?s:j,this._width=null!==(o=null==t?void 0:t.width)&&void 0!==o?o:1024,this._height=null!==(l=null==t?void 0:t.height)&&void 0!==l?l:1024,this._samples=null!==(c=null==t?void 0:t.samples)&&void 0!==c?c:0,this._shared=null!==(h=null==t?void 0:t.shared)&&void 0!==h&&h}dispose(){var e,t;super.dispose(),null===(e=this._gBufferRenderMaterial)||void 0===e||e.dispose(),null===(t=this._depthNormalRenderTarget)||void 0===t||t.dispose()}setSize(e,t){var n;this._width=e,this._height=t,null===(n=this._depthNormalRenderTarget)||void 0===n||n.setSize(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale)}renderPass(e){this._shared&&!this.needsUpdate||(this.needsUpdate=!1,this.renderPassManager.setGroundVisibility(this.drawGround),this.renderCacheManager?this.renderCacheManager.render(this,this.scene,(()=>{this._renderGBuffer(e,this.scene,this.camera)})):this._renderGBuffer(e,this.scene,this.camera),this.renderPassManager.setGroundVisibility(!1),this.floatRgbNormalAlphaDepth&&this.copyToSeparateDepthBuffer&&this._copyDepthToSeparateDepthTexture(e,this.depthNormalRenderTarget))}_renderGBuffer(e,t,n){this.passRenderer.renderWithOverrideMaterial(e,t,n,this.updateGBufferRenderMaterial(n),this.depthNormalRenderTarget,7829503,1)}getCopyMaterial(e){var t;return null!==(t=this._copyMaterial)&&void 0!==t||(this._copyMaterial=new fh),this._copyMaterial.update(e)}_copyDepthToSeparateDepthTexture(e,t){this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:t.texture,blending:0,colorTransform:sh,colorBase:hh,multiplyChannels:0,uvTransform:dh}),this.separateDeptRenderTarget)}}class wf extends vf{set groundDepthWrite(e){this._groundDepthWrite=e}constructor(){super(),this._groundDepthWrite=!0}dispose(){}addLineOrPoint(e){this.addToCache(e,{visible:!1})}addMesh(e){e.userData.isFloor?this.addToCache(e,{visible:this._groundDepthWrite}):e.visible&&(e.material instanceof Ii&&(e.material.transparent&&e.material.opacity<.7||e.material.alphaTest>0)||e.material instanceof Wl&&e.material.transmission>0)&&this.addToCache(e,{visible:!1})}addObject(e){}}class bf extends Bp{get reflectionRenderTarget(){var e;return this._reflectionRenderTarget=null!==(e=this._reflectionRenderTarget)&&void 0!==e?e:this._newRenderTarget(!0),this._reflectionRenderTarget}get intensityRenderTarget(){var e;return this._intensityRenderTarget=null!==(e=this._intensityRenderTarget)&&void 0!==e?e:this._newRenderTarget(!1),this._intensityRenderTarget}get blurRenderTarget(){var e;return this._blurRenderTarget=null!==(e=this._blurRenderTarget)&&void 0!==e?e:this._newRenderTarget(!1),this._blurRenderTarget}constructor(e,t,n,i,r){super(e),this.reflectionFadeInScale=1,this._width=t,this._height=n,this._samples=null!=i?i:1,this.parameters=Object.assign({enabled:!1,intensity:.25,fadeOutDistance:1,fadeOutExponent:4,brightness:1,blurHorizontal:3,blurVertical:6,blurAscent:0,groundLevel:0,groundReflectionScale:1,renderTargetDownScale:4},r),this._copyMaterial=new fh({},ph,!0,!0),this._updateCopyMaterial(null),this._reflectionIntensityMaterial=new Mf({width:this._width/this.parameters.renderTargetDownScale,height:this._height/this.parameters.renderTargetDownScale}),this._blurPass=new Rh(mh,Object.assign(Object.assign({},r),{passRenderer:this.renderPassManager.passRenderer}))}_newRenderTarget(e){const t=this._width/this.parameters.renderTargetDownScale,n=this._height/this.parameters.renderTargetDownScale,i={};if(e){const e=new ba(t,n);i.depthTexture=e,i.samples=this._samples}else i.samples=1;return new on(t,n,Object.assign({format:de},i))}dispose(){var e,t,n;super.dispose(),null===(e=this._reflectionRenderTarget)||void 0===e||e.dispose(),null===(t=this._intensityRenderTarget)||void 0===t||t.dispose(),null===(n=this._blurRenderTarget)||void 0===n||n.dispose(),this._copyMaterial.dispose()}setSize(e,t){var n,i,r,a;this._width=e,this._height=t,null===(n=this._reflectionRenderTarget)||void 0===n||n.setSize(this._width/this.parameters.renderTargetDownScale,this._height/this.parameters.renderTargetDownScale),null===(i=this._intensityRenderTarget)||void 0===i||i.setSize(this._width/this.parameters.renderTargetDownScale,this._height/this.parameters.renderTargetDownScale),null===(r=this._blurRenderTarget)||void 0===r||r.setSize(this._width/this.parameters.renderTargetDownScale,this._height/this.parameters.renderTargetDownScale),null===(a=this._reflectionIntensityMaterial)||void 0===a||a.update({width:this._width/this.parameters.renderTargetDownScale,height:this._height/this.parameters.renderTargetDownScale})}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}updateBounds(e,t){this.parameters.groundLevel=e,this.parameters.groundReflectionScale=t}_updateCopyMaterial(e,t=1){var n;const i=this.parameters.intensity*t,r=this.parameters.brightness;this._copyMaterial.update({texture:null!==(n=null==e?void 0:e.texture)&&void 0!==n?n:void 0,colorTransform:(new Hn).set(r,0,0,0,0,r,0,0,0,0,r,0,0,0,0,i),multiplyChannels:0,uvTransform:uh}),this._copyMaterial.depthTest=!0,this._copyMaterial.depthWrite=!1}renderPass(e){if(!(this.parameters.enabled&&this.camera instanceof Ar))return;const t=this._createGroundReflectionCamera(this.camera);this.renderCacheManager.render("inivisibleGround",this.scene,(()=>{this._renderGroundReflection(e,this.scene,t,this.reflectionRenderTarget)})),this._renderGroundReflectionIntensity(e,t,this.intensityRenderTarget),(this.parameters.blurHorizontal>0||this.parameters.blurVertical>0)&&this.blurReflection(e,this.camera,[this.intensityRenderTarget,this.blurRenderTarget,this.intensityRenderTarget]),this._updateCopyMaterial(this.intensityRenderTarget,this.reflectionFadeInScale),this.passRenderer.renderScreenSpace(e,this._copyMaterial,e.getRenderTarget())}_renderGroundReflection(e,t,n,i){const r=e.getRenderTarget();i&&(e.setRenderTarget(i),this.passRenderer.clear(e,i,0,0)),e.render(t,n),i&&e.setRenderTarget(r)}_renderGroundReflectionIntensity(e,t,n){const i=e.getRenderTarget();e.setRenderTarget(n),this.passRenderer.renderScreenSpace(e,this._reflectionIntensityMaterial.update({texture:this.reflectionRenderTarget.texture,depthTexture:this.reflectionRenderTarget.depthTexture,camera:t,groundLevel:this.parameters.groundLevel,fadeOutDistance:this.parameters.fadeOutDistance*this.parameters.groundReflectionScale,fadeOutExponent:this.parameters.fadeOutExponent}),e.getRenderTarget()),e.setRenderTarget(i)}blurReflection(e,t,n){const i=new dn(t.matrixWorld.elements[4],t.matrixWorld.elements[5],t.matrixWorld.elements[6]),r=this.parameters.blurHorizontal/this._width,a=this.parameters.blurVertical/this._height*Math.abs(i.dot(new dn(0,0,1)));this._blurPass.render(e,n,[4*r,4*a],[4*r*(1+this.parameters.blurAscent),4*a*(1+this.parameters.blurAscent)])}_createGroundReflectionCamera(e){const t=e.clone(),n=t;return n._offset&&(n._offset={left:n._offset.left,top:1-n._offset.bottom,right:n._offset.right,bottom:1-n._offset.top}),t.position.set(e.position.x,-e.position.y+2*this.parameters.groundLevel,e.position.z),t.rotation.set(-e.rotation.x,e.rotation.y,-e.rotation.z),t.updateMatrixWorld(),t.updateProjectionMatrix(),t}}class Mf extends wr{constructor(e){super({defines:Object.assign({},Mf.shader.defines),uniforms:Sr.clone(Mf.shader.uniforms),vertexShader:Mf.shader.vertexShader,fragmentShader:Mf.shader.fragmentShader,blending:0}),this.update(e)}update(e){var t,n;if(void 0!==(null==e?void 0:e.texture)&&(this.uniforms.tDiffuse.value=null==e?void 0:e.texture),void 0!==(null==e?void 0:e.depthTexture)&&(this.uniforms.tDepth.value=null==e?void 0:e.depthTexture),(null==e?void 0:e.width)||(null==e?void 0:e.height)){const i=null!==(t=null==e?void 0:e.width)&&void 0!==t?t:this.uniforms.resolution.value.x,r=null!==(n=null==e?void 0:e.height)&&void 0!==n?n:this.uniforms.resolution.value.y;this.uniforms.resolution.value.set(i,r)}if(void 0!==(null==e?void 0:e.camera)){const t=(null==e?void 0:e.camera)||(null==e?void 0:e.camera);this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far,this.uniforms.cameraProjectionMatrix.value.copy(t.projectionMatrix),this.uniforms.cameraInverseProjectionMatrix.value.copy(t.projectionMatrixInverse),this.uniforms.inverseViewMatrix.value.copy(t.matrixWorld)}return void 0!==(null==e?void 0:e.groundLevel)&&(this.uniforms.groundLevel.value=null==e?void 0:e.groundLevel),void 0!==(null==e?void 0:e.fadeOutDistance)&&(this.uniforms.fadeOutDistance.value=null==e?void 0:e.fadeOutDistance),void 0!==(null==e?void 0:e.fadeOutExponent)&&(this.uniforms.fadeOutExponent.value=null==e?void 0:e.fadeOutExponent),this}}Mf.shader={uniforms:{tDiffuse:{value:null},tDepth:{value:null},resolution:{value:new Nt},cameraNear:{value:.1},cameraFar:{value:1},cameraProjectionMatrix:{value:new Hn},cameraInverseProjectionMatrix:{value:new Hn},inverseViewMatrix:{value:new Hn},groundLevel:{value:0},fadeOutDistance:{value:1},fadeOutExponent:{value:1}},defines:{PERSPECTIVE_CAMERA:1,LINEAR_TO_SRGB:0,PREMULTIPLIED_ALPHA:1},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform vec2 resolution;\n uniform float cameraNear;\n uniform float cameraFar;\n uniform mat4 cameraProjectionMatrix;\n uniform mat4 cameraInverseProjectionMatrix;\n uniform mat4 inverseViewMatrix;\n uniform float groundLevel;\n uniform float fadeOutDistance;\n uniform float fadeOutExponent;\n varying vec2 vUv;\n\n #include \n\n float getDepth(const in vec2 screenPosition) {\n return texture2D(tDepth, screenPosition).x;\n }\n\n float getLinearDepth(const in vec2 screenPosition) {\n #if PERSPECTIVE_CAMERA == 1\n float fragCoordZ = texture2D(tDepth, screenPosition).x;\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return texture2D(tDepth, screenPosition).x;\n #endif\n }\n\n float getViewZ(const in float depth) {\n #if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n #else\n return 0.0;//orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n #endif\n }\n\n vec3 getViewPosition(const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n vec4 clipPosition = vec4((vec3(screenPosition, depth) - 0.5) * 2.0, 1.0);\n clipPosition *= clipW;\n return (cameraInverseProjectionMatrix * clipPosition).xyz;\n }\n\n void main() {\n float verticalBias = 1.5 / resolution.y;\n vec2 uv = vUv.xy + vec2(0.0, verticalBias);\n float depth = getDepth(uv);\n float viewZ = getViewZ(depth);\n vec4 worldPosition = inverseViewMatrix * vec4(getViewPosition(uv, depth, viewZ), 1.0);\n float distance = worldPosition.y - groundLevel;\n vec2 diffuseTextureSize = vec2(textureSize(tDiffuse, 0 ));\n vec4 fragColor = texelFetch(tDiffuse, ivec2(uv * diffuseTextureSize), 0).rgba;\n #if LINEAR_TO_SRGB == 1\n fragColor.rgb = mix(fragColor.rgb * 12.92, 1.055 * pow(fragColor.rgb, vec3(0.41666)) - 0.055, step(0.0031308, fragColor.rgb));\n #endif\n float fadeOutAlpha = pow(clamp(1.0 - distance / fadeOutDistance, 0.0, 1.0), fadeOutExponent);\n fragColor.a *= fadeOutAlpha * step(depth, 0.9999);\n #if PREMULTIPLIED_ALPHA == 1\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n #else\n gl_FragColor = fragColor;\n #endif\n }"};class Tf extends ll{constructor(e,t){const n=new Ji;n.setAttribute("position",new Gi([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),n.computeBoundingSphere(),super(n,new el({fog:!1})),this.light=e,this.color=t,this.type="RectAreaLightHelper";const i=new Ji;i.setAttribute("position",new Gi([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),i.computeBoundingSphere(),this.add(new mr(i,new Ui({side:1,fog:!1})))}updateMatrixWorld(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);const e=this.material.color,t=Math.max(e.r,e.g,e.b);t>1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}class Ef extends Yl{constructor(e){super(e),this.customProgramCacheKey=this._customProgramCacheKey,this.onBeforeCompile=this._onBeforeCompile}static setShadowParameters(e,t,n,i,r,a,s){this._enableGroundBoundary=e,Ef._distributionProperties.set(t,n,i,r),Ef._shadowFadeOut.set(a,s)}static setBoundingBox(e){Ef._sceneBoxMin.copy(e.min),Ef._sceneBoxMax.copy(e.max)}_customProgramCacheKey(){return Ef._enableGroundBoundary?"GROUND_BOUNDARY":"NO_GROUND_BOUNDARY"}_onBeforeCompile(e,t){e.vertexShader=Af,e.fragmentShader=Pf,e.defines=Object.assign(Object.assign(Object.assign({},e.defines),{DYNAMIC_SHADOW_RADIUS:"",GROUND_BOUNDARY:Ef._enableGroundBoundary?1:0}));const n=e.uniforms;n&&(n.distributionProperties={value:Ef._distributionProperties},n.shadowFadeOut={value:Ef._shadowFadeOut},n.sceneBoxMin={value:Ef._sceneBoxMin},n.sceneBoxMax={value:Ef._sceneBoxMax})}}Ef._enableGroundBoundary=!1,Ef._shadowFadeOut=new Nt(.1,20),Ef._sceneBoxMin=new dn(-1,-1,-1),Ef._sceneBoxMax=new dn(1,1,1),Ef._distributionProperties=new an(1,1,1,1);const Af="\n#define LAMBERT\n\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n #include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vWorldPosition = worldPosition.xyz;\n#else\n vWorldPosition = (modelMatrix * vec4(transformed, 1.)).xyz;\n#endif\n}\n",Pf="\n#define LAMBERT\n\nuniform vec3 diffuse;\nuniform float opacity;\n\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPosition;\n\n#ifdef DYNAMIC_SHADOW_RADIUS\n uniform vec2 shadowFadeOut;\n #define fadeOutDistance shadowFadeOut.x\n #define fadeOutBlur shadowFadeOut.y\n uniform vec3 sceneBoxMin;\n uniform vec3 sceneBoxMax;\n#endif\nuniform vec4 distributionProperties;\n#define directionalDependency distributionProperties.x\n#define directionalExponent distributionProperties.y\n#define groundBoundary distributionProperties.z\n#define groundMapScale distributionProperties.w\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvec2 getShadowDynamicScale() {\n vec2 dynamicScale = vec2(0.0, 1.0);\n#ifdef DYNAMIC_SHADOW_RADIUS\n if (fadeOutDistance > 0.0) {\n vec3 boxDistanceVec = max(vec3(0.0), max(sceneBoxMin - vWorldPosition, vWorldPosition - sceneBoxMax));\n float boxDistance = length(boxDistanceVec);\n float shadowBase = clamp(boxDistance / fadeOutDistance, 0.0, 1.0);\n dynamicScale = vec2(shadowBase, 1.0 - shadowBase);\n }\n#endif\n return dynamicScale;\n}\n\nfloat getShadowDynamicRadius(sampler2D shadowMap, float shadowBias, float shadowRadius, vec4 shadowCoord, vec2 shadowScale) {\n float dynamicRadius = shadowRadius;\n#ifdef DYNAMIC_SHADOW_RADIUS\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 && fadeOutDistance > 0.0) {\n dynamicRadius = shadowRadius + fadeOutBlur * max(0.0, shadowScale.x);\n }\n#endif\n return dynamicRadius;\n}\n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\n\tvec3 geometryPosition = - vViewPosition;\n vec3 geometryNormal = normal;\n vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n vec3 accumulatedShadowLight = vec3(0.0);\n vec3 directionDependentShadowLight = vec3(1.0);\n float groundDistance = clamp((vWorldPosition.y - sceneBoxMin.y) * 100.0, 0.0, 1.0);\n vec2 dynamicScale = getShadowDynamicScale();\n\n #if ( NUM_DIR_LIGHTS > 0 )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n IncidentLight directLight;\n vec3 incidentLightSum = vec3(0.0);\n vec3 incidentShadowLight = vec3(0.0);\n float groundShadowFactor = 1.;\n float shadowFactor;\n float dynamicRadius;\n float dotNL;\n\n #pragma unroll_loop_start\n for ( int i = 0 ; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n\n #if defined( USE_SHADOWMAP ) && ( GROUND_BOUNDARY == 1 && UNROLLED_LOOP_INDEX == 0 )\n\n directionalLightShadow = directionalLightShadows[ i ];\n dynamicRadius = fadeOutDistance * groundMapScale;\n groundShadowFactor = groundDistance < 0.5 ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, dynamicRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n #elif defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n directionalLightShadow = directionalLightShadows[ i ];\n dynamicRadius = getShadowDynamicRadius(directionalShadowMap[i], directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[i], dynamicScale);\n shadowFactor = ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, dynamicRadius, vDirectionalShadowCoord[ i ] ) : 1.0; \n accumulatedShadowLight += directLight.color * shadowFactor * saturate(min(dotNL * 10.0 + 0.9, 1.0));\n dotNL = dot(dot(geometryNormal, geometryPosition) >= 0.0 ? -geometryNormal : geometryNormal, directLight.direction);\n incidentLightSum += directLight.color;\n incidentShadowLight += directLight.color * mix(1.0, shadowFactor, pow(clamp(dotNL, 0.0, 1.0), directionalExponent));\n \n #endif\n }\n #pragma unroll_loop_end\n\n directionDependentShadowLight = incidentShadowLight / ( incidentLightSum + 1. - step(0., incidentLightSum) );\n #else\n accumulatedShadowLight = vec3(1.0);\n #endif \n\n\t// modulation\n\n\tvec3 outgoingLight = mix(accumulatedShadowLight, directionDependentShadowLight, max(directionalDependency, 1.0 - groundDistance));\n #if GROUND_BOUNDARY == 1\n float groundWeight = 1. - groundShadowFactor + groundDistance - (1. - groundShadowFactor) * groundDistance;\n outgoingLight = mix(vec3(1.), outgoingLight, mix(dynamicScale.y, groundWeight, groundBoundary));\n #else\n outgoingLight = mix(vec3(1.), outgoingLight, dynamicScale.y);\n #endif\n\n\t#include \n\t#include \n}\n",Rf="DirectionalLightShadow",Cf={alwaysUpdate:!1,enableShadowMap:!0,enableGroundBoundary:!0,layers:null,shadowLightSourceType:Rf,maximumNumberOfLightSources:-1,directionalDependency:1,directionalExponent:1,groundBoundary:1,fadeOutDistance:.1,fadeOutBlur:5};class Lf extends Bp{get shadowTexture(){return this._shadowRenderTarget.texture}set shadowOnGround(e){this._shadowMapPassOverrideMaterialCache.shadowOnGround=e}constructor(e,t,n){var i,r,a;super(e),this.needsUpdate=!1,this.drawGround=!0,this.shadowTypeNeedsUpdate=!0,this.shadowConfiguration=new Nf,this._shadowLightSources=[],this._shadowScale=1,this._groundMapScale=1,this._cameraUpdate=new Ah,this._viewportSize=new Nt(t.x,t.y),this._samples=null!==(i=null==n?void 0:n.samples)&&void 0!==i?i:0,this._shadowMapSize=null!==(r=null==n?void 0:n.shadowMapSize)&&void 0!==r?r:1024,this.parameters=this._getScreenSpaceShadowMapParameters(n),this.castShadow=this.parameters.enableShadowMap,this._shadowMapPassOverrideMaterialCache=new Of,null===(a=this.renderCacheManager)||void 0===a||a.registerCache(this,this._shadowMapPassOverrideMaterialCache);const s=this._samples;this._shadowRenderTarget=new on(this._viewportSize.x,this._viewportSize.y,{samples:s,format:ge,magFilter:j,minFilter:j})}_getScreenSpaceShadowMapParameters(e){return Object.assign(Object.assign({},Cf),e)}dispose(){super.dispose(),this._shadowLightSources.forEach((e=>e.dispose())),this._shadowRenderTarget.dispose(),this._shadowMapPassOverrideMaterialCache.dispose()}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}updateBounds(e,t){var n;const i=this._shadowScale;if(this._shadowScale=t,Math.abs(i-this._shadowScale)>1e-5&&(this.shadowTypeNeedsUpdate=!0),this._shadowLightSources.forEach((t=>t.updateBounds(e))),this._shadowLightSources.length>0){const e=null===(n=this._shadowLightSources[0].getShadowLight().shadow)||void 0===n?void 0:n.camera;e instanceof ea&&(this._groundMapScale=2*this._shadowMapSize/(Math.abs(e.right-e.left)+Math.abs(e.top-e.bottom)))}else this._groundMapScale=1;this._shadowMapPassOverrideMaterialCache.setBoundingBox(e.bounds)}forceShadowUpdate(){this._shadowLightSources.forEach((e=>e.forceShadowUpdate())),this.needsUpdate=!0}getShadowLightSources(){return this._shadowLightSources.map((e=>e.getShadowLight()))}findShadowLightSource(e){var t;return null===(t=this._shadowLightSources.find((t=>t.getOriginalLight()===e)))||void 0===t?void 0:t.getShadowLight()}addRectAreaLight(e,t){const n=new Bf(e,{shadowMapSize:this._shadowMapSize,shadowLightSourceType:this.parameters.shadowLightSourceType});this._shadowLightSources.push(n),n.addTo(t),n.updatePositionAndTarget(),this.needsUpdate=!0}updateRectAreaLights(e,t){const n=this._shadowLightSources;this._shadowLightSources=this._createShadowLightSourceArray(!1);for(const i of n){if(i instanceof Bf){const t=i.getRectAreaLight();e.includes(t)&&(i.updatePositionAndTarget(),this._shadowLightSources.push(i))}i.removeFrom(t),i.dispose()}e.forEach((e=>{this._shadowLightSources.find((t=>t instanceof Bf&&t.getRectAreaLight()===e))||this.addRectAreaLight(e,t)})),this.needsUpdate=!0,this.shadowTypeNeedsUpdate=!0}createShadowFromLightSources(e,t){for(const t of this._shadowLightSources)t.removeFrom(e),t.dispose();this._shadowLightSources=this._createShadowLightSourceArray(!0);const n=1/(t.length>0?Math.max(...t.map((e=>e.maxIntensity))):1);this._addShadowFromLightSources(t,n),this._shadowLightSources.forEach((t=>{t.addTo(e),t.updatePositionAndTarget()})),this.needsUpdate=!0,this.shadowTypeNeedsUpdate=!0}_addShadowFromLightSources(e,t){e.forEach((e=>{const n=e.maxIntensity*t;if(n>=.1&&e.position.z>=0){const t=new dn(e.position.x,e.position.z,e.position.y).multiplyScalar(7),i=new zf(t,n,{shadowMapSize:this._shadowMapSize,shadowLightSourceType:this.parameters.shadowLightSourceType});this._shadowLightSources.push(i)}}))}_createShadowLightSourceArray(e){const t=[];if(e){const e=new kf(new dn(0,7,0),{shadowMapSize:this._shadowMapSize});t.push(e)}return this.parameters.enableGroundBoundary=e,t}setSize(e,t){this._viewportSize=new Nt(e,t),this._shadowRenderTarget.setSize(this._viewportSize.x,this._viewportSize.y)}updatePositionAndTarget(){this._shadowLightSources.forEach((e=>e.updatePositionAndTarget()))}renderPass(e){if(!(this.needsUpdate||this.parameters.alwaysUpdate||this._cameraUpdate.changed(this.camera)))return;this.needsUpdate=!1,this.shadowTypeNeedsUpdate&&(this.shadowTypeNeedsUpdate=!1,this.needsUpdate=!0,this._updateShadowType(e));const t=this.scene.background,n=this.scene.environment,i=this.camera.layers.mask;this.scene.environment=null,this.scene.background=null,this.parameters.layers&&(this.camera.layers.mask=this.parameters.layers.mask),this.renderPassManager.setGroundVisibility(this.drawGround),this._renderSimpleShadowMapFromShadowLightSources(e,this.scene,this.camera),this.renderPassManager.setGroundVisibility(!1),this.camera.layers.mask=i,this.scene.environment=n,this.scene.background=t}_renderSimpleShadowMapFromShadowLightSources(e,t,n){var i;this._shadowMapPassOverrideMaterialCache.setShadowParameters(this.parameters.enableGroundBoundary,this.parameters.directionalDependency,this.parameters.directionalExponent,this.parameters.groundBoundary,this._groundMapScale,this.parameters.fadeOutDistance*this._shadowScale,this.parameters.fadeOutBlur);const r=this._getSortedShadowLightSources();0===r.length?this.passRenderer.clear(e,this._shadowRenderTarget,16777215,1):(this._setShadowLightSourcesIntensity(r),null===(i=this.renderCacheManager)||void 0===i||i.render(this,t,(()=>{this.passRenderer.render(e,t,n,this._shadowRenderTarget,16777215,1)})),this._shadowLightSources.forEach((e=>e.finishRenderShadow())))}_getSortedShadowLightSources(){const e=[];return this._shadowLightSources.forEach((t=>e.push(...t.prepareRenderShadow()))),e.sort(((e,t)=>e.light.castShadow&&!t.light.castShadow||e.groundShadow&&!t.groundShadow?-1:!e.light.castShadow&&t.light.castShadow||!e.groundShadow&&t.groundShadow?1:t.intensity-e.intensity)),e}_setShadowLightSourcesIntensity(e){let t=0;const n=this.parameters.maximumNumberOfLightSources;let i=0;e.forEach((e=>{(n<0||i{var r;!this.parameters.enableGroundBoundary&&e.groundShadow||!(n<0||ie._updateShadowType(this.shadowConfiguration.currentConfiguration,this._shadowScale)))}switchType(e){return!!this.shadowConfiguration.switchType(e)&&(this.needsUpdate=!0,this.shadowTypeNeedsUpdate=!0,!0)}}const Df="unlit",If="emissive",Uf="shadow";class Of extends vf{set shadowOnGround(e){this._shadowOnGround=e}constructor(){super(),this._boundingBoxSet=!1,this._shadowOnGround=!0,this._shadowObjectMaterial=this._createShadowMaterial("default"),this._unlitMaterial=this._createShadowMaterial(Df),this._emissiveMaterial=this._createShadowMaterial(If),this._receiveShadowMaterial=this._createShadowMaterial(Uf)}dispose(){this._shadowObjectMaterial.dispose(),this._unlitMaterial.dispose(),this._emissiveMaterial.dispose(),this._receiveShadowMaterial.dispose()}setShadowParameters(e,t,n,i,r,a,s){Ef.setShadowParameters(e,t,n,i,r,a,s)}setBoundingBox(e){this._boundingBoxSet=!0,Ef.setBoundingBox(e)}_createShadowMaterial(e){let t;return t=e===If||e===Df?new Ui({color:16777215,side:2}):e===Uf?new Vl({side:2}):Of.useModifiedMaterial?this._createCustomerShadowMaterial():new jl({color:16777215,shininess:0,polygonOffsetFactor:0,polygonOffsetUnits:0,side:2}),t}_createCustomerShadowMaterial(){return new Ef({side:2})}addLineOrPoint(e){this.addToCache(e,{visible:!1})}addMesh(e){e.visible&&this._setMeshMaterialAndVisibility(e)}addObject(e){e.isLight&&!e.userData.shadowLightSource&&this.addToCache(e,{visible:!1})}_setMeshMaterialAndVisibility(e){e.userData.isFloor?this._setMeshShadowFloorMaterial(e):!e.material||!e.receiveShadow||Array.isArray(e.material)||!0===e.material.transparent&&e.material.opacity<.9?e.material&&e.material.transparent&&e.material.opacity<.9?this.addToCache(e,{visible:!1}):e.receiveShadow?this.addToCache(e,{castShadow:!1,material:this._receiveShadowMaterial}):this.addToCache(e,{visible:!1}):this._setShadowMaterialForOpaqueObject(e)}_setShadowMaterialForOpaqueObject(e){const t=e.material;t instanceof el||t instanceof Ui?this.addToCache(e,{material:this._unlitMaterial}):t instanceof Gl?this._setMeshShadowStandardMaterial(e,t):this.addToCache(e,{material:e.receiveShadow?this._shadowObjectMaterial:this._unlitMaterial})}_setMeshShadowStandardMaterial(e,t){const n=t.emissiveIntensity>0&&(t.emissive.r>0||t.emissive.g>0||t.emissive.b>0);this.addToCache(e,{castShadow:!n&&e.castShadow,material:n?this._emissiveMaterial:e.receiveShadow?this._shadowObjectMaterial:this._unlitMaterial})}_setMeshShadowFloorMaterial(e){this._boundingBoxSet&&this._shadowOnGround?this.addToCache(e,{visible:!0,castShadow:!1,receiveShadow:!0,material:this._shadowObjectMaterial}):this.addToCache(e,{visible:!1})}}Of.useModifiedMaterial=!0;class Nf{constructor(){var e;this.types=new Map([["off",Nf._noShadow],["BasicShadowMap",Nf._basicShadow],["PCFShadowMap",Nf._pcfShadow],["PCFSoftShadowMap",Nf._pcfSoftShadow],["VSMShadowMap",Nf._vcmShadow]]),this.shadowType="PCFShadowMap",this.currentConfiguration=null!==(e=this.types.get(this.shadowType))&&void 0!==e?e:Nf._defaultType}switchType(e){var t;return!!this.types.has(e)&&(this.currentConfiguration=null!==(t=this.types.get(e))&&void 0!==t?t:Nf._defaultType,!0)}}Nf._noShadow={castShadow:!1,type:i,bias:0,normalBias:0,radius:0},Nf._basicShadow={castShadow:!0,type:0,bias:-5e-5,normalBias:.005,radius:0},Nf._pcfShadow={castShadow:!0,type:i,bias:-5e-5,normalBias:.01,radius:4},Nf._pcfSoftShadow={castShadow:!0,type:r,bias:-5e-5,normalBias:.01,radius:1},Nf._vcmShadow={castShadow:!0,type:a,bias:1e-4,normalBias:0,radius:15},Nf._defaultType=Nf._pcfShadow;class Ff{constructor(e,t){var n,i;this._isVisibleBackup=!0,this._castShadowBackup=!0,this._shadowMapSize=null!==(n=null==t?void 0:t.shadowMapSize)&&void 0!==n?n:1024,this._blurSamples=null!==(i=null==t?void 0:t.blurSamples)&&void 0!==i?i:8,this._shadowLightSource=e,this._shadowLightSource.visible=!1,this._shadowLightSource.castShadow=!0,this._shadowLightSource.shadow&&(this._shadowLightSource.shadow.mapSize=new Nt(this._shadowMapSize,this._shadowMapSize),this._shadowLightSource.shadow.blurSamples=this._blurSamples,this._shadowLightSource.shadow.autoUpdate=!1),this._shadowLightSource.userData.shadowLightSource=this}getPosition(){return this._shadowLightSource.position}getShadowLight(){return this._shadowLightSource}getOriginalLight(){return null}dispose(){this._shadowLightSource.dispose()}addTo(e){e.add(this._shadowLightSource)}removeFrom(e){e.remove(this._shadowLightSource)}updatePositionAndTarget(){this._updateShadowPositionAndTarget(this.getPosition(),new dn(0,0,0))}updateBounds(e){if(this._shadowLightSource instanceof Pc){const t=this._shadowLightSource.shadow.camera,n=e.bounds.clone().applyMatrix4(t.matrixWorldInverse),i=Math.max(.001,Math.min(-n.min.z,-n.max.z)),r=Math.max(-n.min.z,-n.max.z),a=Math.max(Math.abs(n.min.x),Math.abs(n.max.x)),s=Math.max(Math.abs(n.min.y),Math.abs(n.max.y)),o=Math.atan2(1.05*Math.hypot(s,a),i);t.aspect=1,t.near=i,t.far=r,this._shadowLightSource.angle=o}else if(this._shadowLightSource.shadow){const t=this._shadowLightSource.shadow.camera;e.updateCameraViewVolumeFromBounds(t);const n=t;n.far+=n.far-n.near,n.updateProjectionMatrix()}this._shadowLightSource.shadow&&(this._shadowLightSource.shadow.needsUpdate=!0)}forceShadowUpdate(){this._shadowLightSource.shadow&&(this._shadowLightSource.shadow.needsUpdate=!0)}_updateShadowPositionAndTarget(e,t){var n,i,r;if(this._shadowLightSource instanceof Pc){const n=t.clone().sub(e),i=n.length();n.normalize();const r=t.clone().sub(n.clone().multiplyScalar(4*i));this._shadowLightSource.shadow.camera.position.copy(r),this._shadowLightSource.shadow.camera.position.copy(r),this._shadowLightSource.shadow.camera.lookAt(t),this._shadowLightSource.position.copy(r),this._shadowLightSource.lookAt(t)}else this._shadowLightSource.position.copy(e),this._shadowLightSource.lookAt(t),null===(n=this._shadowLightSource.shadow)||void 0===n||n.camera.position.copy(e),null===(i=this._shadowLightSource.shadow)||void 0===i||i.camera.lookAt(t);null===(r=this._shadowLightSource.shadow)||void 0===r||r.camera.updateMatrixWorld(),this._shadowLightSource.updateMatrixWorld()}_updateShadowType(e,t){const n=this._shadowLightSource.shadow;n&&(n.bias=e.bias,n.normalBias=e.normalBias*t,n.radius=e.radius,n.needsUpdate=!0)}prepareRenderShadow(){return[]}finishRenderShadow(){}}class Bf extends Ff{constructor(e,t){let n;switch(null==t?void 0:t.shadowLightSourceType){default:case Rf:n=new Oc(16777215,1);break;case"SpotLightShadow":n=new Pc(16777215,1,0,Math.PI/4,0)}n.position.copy(e.position),n.lookAt(0,0,0),super(n,t),this._rectAreaLight=e,this._rectAreaLight.userData.shadowLightSource=this,(null==t?void 0:t.addHelper)&&(this._rectLightHelper=new Tf(this._rectAreaLight),this._rectLightHelper.material.depthWrite=!1,this._rectAreaLight.add(this._rectLightHelper))}getPosition(){return this._rectAreaLight.position}getRectAreaLight(){return this._rectAreaLight}getOriginalLight(){return this._rectAreaLight}prepareRenderShadow(){return this._isVisibleBackup=this._rectAreaLight.visible,this._castShadowBackup=this._shadowLightSource.castShadow,this._shadowLightSource.visible=this._rectAreaLight.visible,this._rectAreaLight.visible=!1,this._shadowLightSource.visible?[{light:this._shadowLightSource,intensity:this._rectAreaLight.intensity,groundShadow:!1}]:[]}finishRenderShadow(){this._shadowLightSource.visible=!1,this._shadowLightSource.castShadow=this._castShadowBackup,this._rectAreaLight.visible=this._isVisibleBackup}}class zf extends Ff{constructor(e,t,n){const i=new Oc(16777215,t);i.position.copy(e),i.lookAt(0,0,0),i.updateMatrix(),i.castShadow=!0,super(i,n),this._position=e.clone(),this._intensity=t}getPosition(){return this._position}prepareRenderShadow(){return this._castShadowBackup=this._shadowLightSource.castShadow,this._shadowLightSource.visible=!0,[{light:this._shadowLightSource,intensity:this._intensity,groundShadow:!1}]}finishRenderShadow(){this._shadowLightSource.castShadow=this._castShadowBackup,this._shadowLightSource.visible=!1}}class kf extends Ff{constructor(e,t){const n=new Oc(16777215,1);n.position.copy(e),n.lookAt(0,0,0),n.updateMatrix(),n.castShadow=!0,super(n,t),this._position=e.clone()}getPosition(){return this._position}prepareRenderShadow(){return this._castShadowBackup=this._shadowLightSource.castShadow,this._shadowLightSource.visible=!0,[{light:this._shadowLightSource,intensity:1,groundShadow:!0}]}finishRenderShadow(){this._shadowLightSource.castShadow=this._castShadowBackup,this._shadowLightSource.visible=!1}}const Hf={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"},Vf={name:"FXAAShader",uniforms:{tDiffuse:{value:null},resolution:{value:new Nt(1/1024,1/512)}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\t\tprecision highp float;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tuniform vec2 resolution;\n\n\t\tvarying vec2 vUv;\n\n\t\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t\t//----------------------------------------------------------------------------------\n\t\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t\t// SDK Version: v3.00\n\t\t// Email: gameworks@nvidia.com\n\t\t// Site: http://developer.nvidia.com/\n\t\t//\n\t\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t\t//\n\t\t// Redistribution and use in source and binary forms, with or without\n\t\t// modification, are permitted provided that the following conditions\n\t\t// are met:\n\t\t// * Redistributions of source code must retain the above copyright\n\t\t// notice, this list of conditions and the following disclaimer.\n\t\t// * Redistributions in binary form must reproduce the above copyright\n\t\t// notice, this list of conditions and the following disclaimer in the\n\t\t// documentation and/or other materials provided with the distribution.\n\t\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t\t// contributors may be used to endorse or promote products derived\n\t\t// from this software without specific prior written permission.\n\t\t//\n\t\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t\t//\n\t\t//----------------------------------------------------------------------------------\n\n\t\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t\t#endif\n\n\t\t/*--------------------------------------------------------------------------*/\n\t\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t\t/*--------------------------------------------------------------------------*/\n\n\t\t#define NUM_SAMPLES 5\n\n\t\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\t\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t\t}\n\n\t\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t\t============================================================================*/\n\n\t\t/*--------------------------------------------------------------------------*/\n\t\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t// locate the edge\n\t\t\t\tvec2 dirToEdge;\n\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t// . 2 . . 1 .\n\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t// . 1 .\n\t\t\t\t// 0 0 1\n\t\t\t\t// . 0 H\n\n\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t// V 1 .\n\t\t\t\t// 0 0 1\n\t\t\t\t// . 0 .\n\n\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t// 1 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t// do a simple blur\n\t\t\t\t\treturn mix(\n\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t.4\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\titerationsUsed = i;\n\n\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\tif(!doneN) {\n\t\t\t\t\tnDist += increment;\n\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t}\n\n\t\t\t\tif(!doneP) {\n\t\t\t\t\tpDist += increment;\n\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t}\n\n\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\trgbaM,\n\t\t\t\trgbaN,\n\t\t\t\tdist * .5\n\t\t\t);\n\t\t}\n\n\t\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\tvUv,\n\t\t\t\ttDiffuse,\n\t\t\t\tresolution,\n\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t\t}\n\t"};class Gf extends Bp{constructor(e,t,n,i,r,a){var s;super(e),this.patternTexture=null,this.clearBackground=!1,this.renderScene=n,this.renderCamera=i,this.selectedObjects=void 0!==r?r:[],this.visibleEdgeColor=new Ci(1,1,1),this.hiddenEdgeColor=new Ci(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=(null==a?void 0:a.downSampleRatio)||2,this.pulsePeriod=0,this.edgeDetectionFxaa=(null==a?void 0:a.edgeDetectionFxaa)||!1,this._visibilityCache=new Map,this.resolution=void 0!==t?new Nt(t.x,t.y):new Nt(256,256);const o=Math.round(this.resolution.x/this.downSampleRatio),l=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetMaskBuffer=new on(this.resolution.x,this.resolution.y),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.prepareMaskMaterial=this._getPrepareMaskMaterial(null===(s=this.gBufferTextures)||void 0===s?void 0:s.isFloatGBufferWithRgbNormalAlphaDepth),this.prepareMaskMaterial.side=2,this.prepareMaskMaterial.fragmentShader=function(e,t){const n=t.isPerspectiveCamera?"perspective":"orthographic";return e.replace(/DEPTH_TO_VIEW_Z/g,n+"DepthToViewZ")}(this.prepareMaskMaterial.fragmentShader,this.renderCamera),this.edgeDetectionFxaa&&(this.fxaaRenderMaterial=new wr(Vf),this.fxaaRenderMaterial.uniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,this.fxaaRenderMaterial.uniforms.resolution.value.set(1/this.resolution.x,1/this.resolution.y),this.renderTargetFxaaBuffer=new on(this.resolution.x,this.resolution.y),this.renderTargetFxaaBuffer.texture.name="OutlinePass.fxaa",this.renderTargetFxaaBuffer.texture.generateMipmaps=!1),this.renderTargetMaskDownSampleBuffer=new on(o,l),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new on(o,l),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new on(Math.round(o/2),Math.round(l/2)),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this._getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new on(o,l),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new on(Math.round(o/2),Math.round(l/2)),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,this.separableBlurMaterial1=this._getSeperableBlurMaterial(4),this.separableBlurMaterial1.uniforms.texSize.value.set(o,l),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this._getSeperableBlurMaterial(4),this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(o/2),Math.round(l/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=4,this.overlayMaterial=this._getOverlayMaterial();const c=Hf;this.copyUniforms=Sr.clone(c.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new wr({uniforms:this.copyUniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,blending:0,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new Ci,this.oldClearAlpha=1,this.fsQuad=new yh(void 0),this.tempPulseColor1=new Ci,this.tempPulseColor2=new Ci,this.textureMatrix=new Hn}dispose(){var e,t;super.dispose(),this.renderTargetMaskBuffer.dispose(),null===(e=this.renderTargetFxaaBuffer)||void 0===e||e.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose(),this.prepareMaskMaterial.dispose(),null===(t=this.fxaaRenderMaterial)||void 0===t||t.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.dispose()}setSize(e,t){var n,i;this.renderTargetMaskBuffer.setSize(e,t);let r=Math.round(e/this.downSampleRatio),a=Math.round(t/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(r,a),this.renderTargetBlurBuffer1.setSize(r,a),this.renderTargetEdgeBuffer1.setSize(r,a),this.separableBlurMaterial1.uniforms.texSize.value.set(r,a),r=Math.round(r/2),a=Math.round(a/2),this.renderTargetBlurBuffer2.setSize(r,a),this.renderTargetEdgeBuffer2.setSize(r,a),this.separableBlurMaterial2.uniforms.texSize.value.set(r,a),null===(n=this.fxaaRenderMaterial)||void 0===n||n.uniforms.resolution.value.set(1/this.resolution.x,1/this.resolution.y),null===(i=this.renderTargetFxaaBuffer)||void 0===i||i.setSize(e,t)}_canBeHighlighted(e){return e.isMesh||Gf.highlightLines&&e.isLine}_changeVisibilityOfSelectedObjects(e){const t=this._visibilityCache;this.selectedObjects.forEach((n=>n.traverse((n=>{this._canBeHighlighted(n)&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}))))}_changeVisibilityOfNonSelectedObjects(e){const t=this._visibilityCache,n=[];this.selectedObjects.forEach((e=>e.traverse((e=>{this._canBeHighlighted(e)&&n.push(e)})))),this.renderScene.traverse((i=>{if(this._canBeHighlighted(i)||i.isSprite){if(!1===n.some((e=>e.id===i.id))){const n=i.visible;!1!==e&&!0!==t.get(i)||(i.visible=e),t.set(i,n)}}else i.isPoints&&(!0===e?i.visible=t.get(i):(t.set(i,i.visible),i.visible=e))}))}_updateTextureMatrix(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}render(e,t,n,i,r){if(this.selectedObjects.length>0){e.getClearColor(this.oldClearColor),this.oldClearAlpha=e.getClearAlpha();const t=e.autoClear;this.clearBackground&&(e.setClearColor(0,255),e.clear(!0,!1,!1)),e.autoClear=!1,r&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this._changeVisibilityOfSelectedObjects(!1);const i=this.renderScene.background;this.renderScene.background=null,this._changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this._updateTextureMatrix(),this._changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.gBufferTextures.textureWithDepthValue,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this._changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=i;let a=this.renderTargetMaskBuffer;if(this.edgeDetectionFxaa&&this.fxaaRenderMaterial&&this.renderTargetFxaaBuffer&&(this.fxaaRenderMaterial.uniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,this.fsQuad.material=this.fxaaRenderMaterial,e.setRenderTarget(this.renderTargetFxaaBuffer),e.clear(),this.fsQuad.render(e),a=this.renderTargetFxaaBuffer),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=a.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),this.pulsePeriod>0){const e=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2;this.tempPulseColor1.multiplyScalar(e),this.tempPulseColor2.multiplyScalar(e)}this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Gf.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Gf.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=Gf.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=Gf.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=a.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,r&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=t}this.renderToScreen&&n&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=n.texture,e.setRenderTarget(null),this.fsQuad.render(e))}renderPass(e){this.render(e,null,null,0,!1)}_getPrepareMaskMaterial(e){return new wr({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new Nt(.5,.5)},textureMatrix:{value:null}},defines:{FLOAT_ALPHA_DEPTH:e?1:0},vertexShader:"#include \n\t\t\t\t#include \n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t\tvPosition = mvPosition;\n\n\t\t\t\t\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\n\t\t\t\t\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tworldPosition = modelMatrix * worldPosition;\n\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include \n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n #if FLOAT_ALPHA_DEPTH == 1\n\t\t\t\t\t float depth = texture2DProj( depthTexture, projTexCoord ).w;\n #else\n float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n #endif\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}_getEdgeDetectionMaterial(){return new wr({uniforms:{maskTexture:{value:null},texSize:{value:new Nt(.5,.5)},visibleEdgeColor:{value:new dn(1,1,1)},hiddenEdgeColor:{value:new dn(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}_getSeperableBlurMaterial(e){return new wr({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new Nt(.5,.5)},direction:{value:new Nt(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include \n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}_getOverlayMaterial(){return new wr({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n }",blending:2,depthTest:!1,depthWrite:!1,transparent:!0})}}Gf.BlurDirectionX=new Nt(1,0),Gf.BlurDirectionY=new Nt(0,1),Gf.highlightLines=!0;const Wf={tDiffuse:{value:null}},jf="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",Xf="\n uniform highp sampler2D tDiffuse;\n varying vec2 vUv;\n \n void main() {\n vec4 textureColor = texture2D(tDiffuse, vUv);\n float aoPassDepth = dot(textureColor.wz, vec2(1.0/1024.0));\n gl_FragColor = vec4(vec3(aoPassDepth * aoPassDepth), 1.0);\n }";class Yf extends wr{constructor(e){super({uniforms:Sr.clone(Wf),vertexShader:jf,fragmentShader:Xf,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:y,blendDst:u,blendEquation:c,blendSrcAlpha:_,blendDstAlpha:u,blendEquationAlpha:c}),this._intensity=new Nt(1,1),this.update(e)}update(e){return void 0!==(null==e?void 0:e.texture)&&(this.uniforms.tDiffuse.value=e.texture),void 0!==(null==e?void 0:e.blending)&&(this.blending=e.blending),this}}class qf extends Bp{constructor(e){super(e),this.debugOutput="",this._environmentMapDecodeMaterial=new Gh(!0,!1),this._environmentMapDecodeMaterial.blending=0,this._environmentMapDecodeMaterial.depthTest=!1}dispose(){var e,t,n;null===(e=this._depthRenderMaterial)||void 0===e||e.dispose(),null===(t=this._copyMaterial)||void 0===t||t.dispose(),null===(n=this._srgbToLinearCopyMaterial)||void 0===n||n.dispose()}getCopyMaterial(e){var t;return this._copyMaterial=null!==(t=this._copyMaterial)&&void 0!==t?t:new fh,this._copyMaterial.update(e)}getBlendAoAndShadowMaterial(e){var t;return this._blendAoAndShadowMaterial=null!==(t=this._blendAoAndShadowMaterial)&&void 0!==t?t:new Zp({blending:0}),this._blendAoAndShadowMaterial.update(e)}getBlendAoPassDepthMaterial(e){var t;return this._blendAoPassDepthMaterial=null!==(t=this._blendAoPassDepthMaterial)&&void 0!==t?t:new Yf({blending:0}),this._blendAoPassDepthMaterial.update(e)}getSrgbToLinearCopyMaterial(e){var t;return this._srgbToLinearCopyMaterial=null!==(t=this._copyMaterial)&&void 0!==t?t:new fh({},ph,!0,!0),this._srgbToLinearCopyMaterial.update(e)}_getDepthRenderMaterial(e){var t;return this._depthRenderMaterial=null!==(t=this._depthRenderMaterial)&&void 0!==t?t:new gh({depthTexture:this.gBufferTextures.textureWithDepthValue,depthFilter:this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth?new an(0,0,0,1):new an(1,0,0,0)}),this._depthRenderMaterial.update({camera:e})}renderPass(e){var t,n,i,r,a,s;switch(this.debugOutput){default:break;case"lineardepth":this.passRenderer.renderScreenSpace(e,this._getDepthRenderMaterial(this.camera),null);break;case"g-normal":this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth?this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:null===(t=this.gBufferTextures)||void 0===t?void 0:t.gBufferTexture,blending:0,colorTransform:(new Hn).set(.5,0,0,0,0,.5,0,0,0,0,.5,0,0,0,0,0),colorBase:new an(.5,.5,.5,1),multiplyChannels:0,uvTransform:dh}),null):this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:null===(n=this.gBufferTextures)||void 0===n?void 0:n.gBufferTexture,blending:0,colorTransform:ah,colorBase:hh,multiplyChannels:0,uvTransform:dh}),null);break;case"g-depth":this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth?this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:null===(i=this.gBufferTextures)||void 0===i?void 0:i.gBufferTexture,blending:0,colorTransform:sh,colorBase:hh,multiplyChannels:0,uvTransform:dh}),null):this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:null===(r=this.gBufferTextures)||void 0===r?void 0:r.depthBufferTexture,blending:0,colorTransform:oh,colorBase:hh,multiplyChannels:0,uvTransform:dh}),null);break;case"ssao":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,blending:0,colorTransform:lh,colorBase:ch,multiplyChannels:0,uvTransform:dh}),null);break;case"ssaodenoise":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,blending:0,colorTransform:lh,colorBase:ch,multiplyChannels:0,uvTransform:dh}),null);break;case"shadowmap":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.screenSpaceShadowMapPass.shadowTexture,blending:0,colorTransform:lh,colorBase:ch,multiplyChannels:0,uvTransform:dh}),null);break;case"shadowsoft":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,blending:0,colorTransform:of.shadowTransform,colorBase:ch,multiplyChannels:0,uvTransform:dh}),null);break;case"shadowdenoise":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,blending:0,colorTransform:of.shadowTransform,colorBase:ch,multiplyChannels:0,uvTransform:dh}),null);break;case"shadowfadein":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.fadeRenderTarget.texture,blending:0,colorTransform:of.shadowTransform,colorBase:ch,multiplyChannels:0,uvTransform:dh}),null);break;case"shadowandao":this.passRenderer.renderScreenSpace(e,this.getBlendAoAndShadowMaterial({texture:this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,blending:0,aoIntensity:this.renderPassManager.shadowAndAoPass.parameters.aoIntensity,shadowIntensity:this.renderPassManager.shadowAndAoPass.parameters.shadowIntensity}),null);break;case"shadowandaodepth":this.passRenderer.renderScreenSpace(e,this.getBlendAoPassDepthMaterial({texture:this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,blending:0}),null);break;case"materialao":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.aoPassMapTexture,blending:0,colorTransform:rh,colorBase:ch,multiplyChannels:0,uvTransform:dh}),null);break;case"groundreflection":this.passRenderer.renderScreenSpace(e,this.getSrgbToLinearCopyMaterial({texture:this.renderPassManager.groundReflectionPass.reflectionRenderTarget.texture,blending:0,colorTransform:rh,colorBase:ch,multiplyChannels:0,uvTransform:uh}),null);break;case"groundreflectionfinal":this.passRenderer.renderScreenSpace(e,this.getSrgbToLinearCopyMaterial({texture:this.renderPassManager.groundReflectionPass.intensityRenderTarget.texture,blending:0,colorTransform:rh,colorBase:ch,multiplyChannels:0,uvTransform:uh}),null);break;case"bakedgroundshadow":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.bakedGroundContactShadowPass.renderTarget.texture,blending:0,colorTransform:rh,colorBase:ch,multiplyChannels:0,uvTransform:dh}),null);break;case"environmentmap":this._environmentMapDecodeMaterial.setSourceTexture(this.scene.environment),this.passRenderer.renderScreenSpace(e,this._environmentMapDecodeMaterial,null);break;case"lightsourcedetection":if(null===(a=this.scene.userData)||void 0===a?void 0:a.environmentDefinition){const t=this.renderPassManager.aspect,n=new ea(-1,1,1/t,-1/t,-1,1),i=null===(s=this.scene.userData)||void 0===s?void 0:s.environmentDefinition.createDebugScene(e,this.scene,this.renderPassManager.screenSpaceShadowMapPass.parameters.maximumNumberOfLightSources);i.background=new Ci(16777215),e.render(i,n)}}}}class Zf extends Bp{constructor(e){super(e),this.drawGround=!0,this.drawWithDebugMaterial=!1,this.grayDebugMaterial=new Gl({color:12632256,side:2,envMapIntensity:.4})}dispose(){super.dispose(),this.grayDebugMaterial.dispose()}renderPass(e){this.renderCacheManager.onBeforeRender("floorDepthWrite",this.scene),this.renderPassManager.setGroundVisibility(this.drawGround),this.drawWithDebugMaterial?this.renderCacheManager.render("debug",this.scene,(()=>{this.passRenderer.renderWithOverrideMaterial(e,this.scene,this.camera,this.grayDebugMaterial,null,0,1)})):e.render(this.scene,this.camera),this.renderPassManager.setGroundVisibility(!1),this.renderCacheManager.onAfterRender("floorDepthWrite")}}class Kf{constructor(){this.weightedAoPassAntiAliasing=!1,this.applyAoAndShadowToAlpha=!1,this._aoPassMapUniform={value:null},this._aoPassMapScaleUniform={value:1},this._aoPassMapIntensityUniform={value:1},this._shPassMapIntensityUniform={value:1},this._reflectionPassMapUniform={value:null},this._reflectionPassMapScaleUniform={value:1},this._reflectionPassMapIntensityUniform={value:0},this.applyReflectionPassMap=!1}set aoPassMap(e){this._aoPassMapUniform.value=e}set aoPassMapScale(e){this._aoPassMapScaleUniform.value=e}set aoPassMapIntensity(e){this._aoPassMapIntensityUniform.value=e}set shPassMapIntensity(e){this._shPassMapIntensityUniform.value=e}set reflectionPassMap(e){this._reflectionPassMapUniform.value=e}set reflectionPassMapScale(e){this._reflectionPassMapScaleUniform.value=e}set reflectionPassMapIntensity(e){this._reflectionPassMapIntensityUniform.value=e}static addPlugin(e){if(void 0!==e.userData.postProcessingMaterialPlugin)return e.userData.postProcessingMaterialPlugin instanceof Kf?e.userData.postProcessingMaterialPlugin:null;const t=new Kf;return e.userData.postProcessingMaterialPlugin=t,e.onBeforeCompile=(e,n)=>t._onBeforeCompile(e,n),e.customProgramCacheKey=()=>t._customProgramCacheKey(),t}_isEnabled(){return void 0!==this._aoPassMapUniform.value&&null!==this._aoPassMapUniform.value}_customProgramCacheKey(){let e="";return this._isEnabled()&&(e+="aoPassMap"+(this.applyAoAndShadowToAlpha?"Alpha":"")),this.applyReflectionPassMap&&(e+="reflectionPassMap"),e}_onBeforeCompile(e,t){if(this._isEnabled()||this.applyReflectionPassMap){let t=this.applyAoAndShadowToAlpha?"#define USE_APPLY_AO_AND_SHADOW_TO_ALPHA\n":"";t+=this.applyReflectionPassMap?"#define USE_REFLECTION_PASS_MAP\n":"",t+=this.weightedAoPassAntiAliasing?"#define WEIGHTED_AO_PASS_ANTIALIASING\n":"",t+=Jf,e.fragmentShader=e.fragmentShader.replace("#include ",t),e.fragmentShader=e.fragmentShader.replace("#include ",Qf),this._initUniforms(e)}}_initUniforms(e){e&&(e.uniforms.tAoPassMap=this._aoPassMapUniform,e.uniforms.aoPassMapScale=this._aoPassMapScaleUniform,e.uniforms.aoPassMapIntensity=this._aoPassMapIntensityUniform,e.uniforms.shPassMapIntensity=this._shPassMapIntensityUniform,e.uniforms.tReflectionPassMap=this._reflectionPassMapUniform,e.uniforms.reflectionPassMapScale=this._reflectionPassMapScaleUniform,e.uniforms.reflectionPassMapIntensity=this._reflectionPassMapIntensityUniform)}}const Jf="\n#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif\n\n\tuniform highp sampler2D tAoPassMap;\n uniform float aoPassMapScale;\n uniform float aoPassMapIntensity;\n uniform float shPassMapIntensity;\n uniform sampler2D tReflectionPassMap;\n uniform float reflectionPassMapScale;\n uniform float reflectionPassMapIntensity;\n",Qf="\n#ifndef AOPASSMAP_SWIZZLE\n\t#define AOPASSMAP_SWIZZLE rg\n#endif\n\nfloat ambientOcclusion = 1.0;\nfloat shadowValue = 1.0;\n\t\n#ifdef USE_AOMAP\n\n\t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tambientOcclusion = texture2D( aoMap, vAoMapUv ).r;\n ambientOcclusion = ( ambientOcclusion - 1.0 ) * aoMapIntensity + 1.0;\n\n#endif\n\n vec4 aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ), 0 );\n vec2 aoAndShadow = aoAndShadowMap.rg;\n float depthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n const ivec2 aoOffsetArray[8] = ivec2[8](\n ivec2(1, 0), ivec2(-1, 0), ivec2(0, 1), ivec2(0, -1), ivec2(1, 1), ivec2(-1, 1), ivec2(1, -1), ivec2(-1, -1));\n #ifdef WEIGHTED_AO_PASS_ANTIALIASING \n aoAndShadow *= 100.0;\n float deltaAoPassWeight = 100.0; \n for (int aoOffsetI = 0; aoOffsetI < 8; aoOffsetI++) {\n aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ) + aoOffsetArray[aoOffsetI], 0 );\n float testDepthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n float aoPassSampleWeight = (depthDelta * 100.0 + 0.01) / (testDepthDelta * 100.0 + 0.01);\n deltaAoPassWeight += aoPassSampleWeight;\n aoAndShadow += aoAndShadowMap.rg * aoPassSampleWeight;\n }\n aoAndShadow /= deltaAoPassWeight;\n #else\n for (int aoOffsetI = 0; aoOffsetI < 8; aoOffsetI++) {\n aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ) + aoOffsetArray[aoOffsetI], 0 );\n float testDepthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n if (testDepthDelta < depthDelta) {\n aoAndShadow = aoAndShadowMap.rg;\n depthDelta = testDepthDelta;\n }\n }\n #endif \n \n float aoPassMapValue = aoPassMapIntensity < 0.0 ? 1.0 : max(0.0, (aoAndShadow.r - 1.0) * aoPassMapIntensity + 1.0);\n shadowValue = shPassMapIntensity < 0.0 ? 1.0 : max(0.0, (aoAndShadow.g - 1.0) * shPassMapIntensity + 1.0);\n\n #ifdef USE_REFLECTION_PASS_MAP\n\n ivec2 reflectionPassMapSize = textureSize( tReflectionPassMap, 0 );\n vec2 reflectionPassMapUv = vec2( gl_FragCoord.x * reflectionPassMapScale, float(reflectionPassMapSize.y) - gl_FragCoord.y * reflectionPassMapScale );\n vec4 reflectionPassMapColor = texture2D( tReflectionPassMap, reflectionPassMapUv / vec2(reflectionPassMapSize) );\n if (reflectionPassMapColor.a > 0.0) reflectionPassMapColor.rgb /= reflectionPassMapColor.a;\n vec3 diffuseReflectionPassMapColor = reflectionPassMapColor.rgb * material.diffuseColor;\n reflectedLight.indirectDiffuse += diffuseReflectionPassMapColor * reflectionPassMapColor.a * reflectionPassMapIntensity;\n //reflectedLight.indirectDiffuse = mix(reflectedLight.indirectDiffuse, diffuseReflectionPassMapColor, reflectionPassMapColor.a * reflectionPassMapIntensity);\n\n #endif\n\n #if defined ( USE_APPLY_AO_AND_SHADOW_TO_ALPHA )\n diffuseColor.a = 1.0 - (1.0 - diffuseColor.a) * aoPassMapValue * shadowValue;\n #else\n ambientOcclusion = min( ambientOcclusion, aoPassMapValue );\n #endif\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion * shadowValue;\n \n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion * shadowValue;\n\t#endif\n\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion * shadowValue;\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n \n float specularOcclusion = computeSpecularOcclusion( dotNV, ambientOcclusion * shadowValue, material.roughness );\n\t\treflectedLight.indirectSpecular *= specularOcclusion;\n\n #ifdef USE_REFLECTION_PASS_MAP\n reflectedLight.indirectSpecular += material.specularColor * reflectionPassMapColor.rgb * reflectionPassMapColor.a * reflectionPassMapIntensity * specularOcclusion;\n #endif \n \n\t#endif\n";class $f{get passRenderer(){return this._passRenderer}get scene(){return this._scene}get camera(){return this._camera}get aspect(){return this._sceneRenderer.width/this._sceneRenderer.height}get cameraChanged(){return this._cameraChanged}get noOStaticFrames(){return this._noOStaticFrames}get renderCacheManager(){return this._sceneRenderer.renderCacheManager}get parameters(){return this._sceneRenderer.parameters}get sceneRenderPass(){return this._sceneRenderPass}get bakedGroundContactShadowPass(){return this._bakedGroundContactShadowPass}get gBufferRenderPass(){return this._gBufferRenderPass}get groundReflectionPass(){return this._groundReflectionPass}get screenSpaceShadowMapPass(){return this._screenSpaceShadowMapPass}get shadowAndAoPass(){return this._shadowAndAoPass}get outlinePass(){return this._outlinePass}get outlineRenderer(){return this._sceneRenderer.outlineRenderer}get debugPass(){var e;return null!==(e=this._debugPass)&&void 0!==e||(this._debugPass=new qf(this)),this._debugPass}get debugOutput(){return this._sceneRenderer.debugOutput}constructor(e){this.materialsNeedUpdate=!0,this._passRenderer=new Ph,this._outlinePass=null,this._debugPass=null,this._cameraUpdate=new Ah,this._cameraChanged=!0,this._noUpdateNeededCount=0,this._noOStaticFrames=0,this._maxSamples=1,this._passUpdateStates={updateGroundReflection:!1,updateGBuffer:!1,updateScreenSpaceShadow:!1,updateShadowAndAoPass:!1,updateOutlinePass:!1,updateDebugPass:!1},this.aoPassMapTexture=null,this._sceneRenderer=e,this._maxSamples=Eh(this._sceneRenderer.renderer),this._sceneRenderPass=new Zf(this),this._bakedGroundContactShadowPass=new _f(this,this._sceneRenderer.renderer,this._sceneRenderer.groundGroup,{sharedShadowGroundPlane:this._sceneRenderer.shadowAndAoGroundPlane}),this._gBufferRenderPass=new Sf(this,{shared:!0,capabilities:this._sceneRenderer.renderer.capabilities,width:this._sceneRenderer.width,height:this._sceneRenderer.height,samples:1}),this._groundReflectionPass=new bf(this,this._sceneRenderer.width,this._sceneRenderer.height,this._maxSamples,{}),this._screenSpaceShadowMapPass=new Lf(this,new Nt(this._sceneRenderer.width,this._sceneRenderer.height),{samples:1,alwaysUpdate:!1}),this._shadowAndAoPass=new of(this,this._sceneRenderer.width,this._sceneRenderer.height,1)}dispose(){var e;this._sceneRenderPass.dispose(),this._bakedGroundContactShadowPass.dispose(),this._gBufferRenderPass.dispose(),this._groundReflectionPass.dispose(),this._screenSpaceShadowMapPass.dispose(),this._shadowAndAoPass.dispose(),null===(e=this._outlinePass)||void 0===e||e.dispose()}setSize(e,t){var n;this._gBufferRenderPass.setSize(e,t),this._groundReflectionPass.setSize(e,t),this._screenSpaceShadowMapPass.setSize(e,t),this._shadowAndAoPass.setSize(e,t),null===(n=this._outlinePass)||void 0===n||n.setSize(e,t)}createOutlinePass(){return this._outlinePass||(this._outlinePass=new Gf(this,new Nt(this._sceneRenderer.width,this._sceneRenderer.height),this.scene,this.camera,[],{downSampleRatio:2,edgeDetectionFxaa:!0})),this._outlinePass}setGroundVisibility(e){this._sceneRenderer.shadowAndAoGroundPlane.setVisibility(e)}updatePasses(e,t,n){this._scene=t,this._camera=n,this._cameraChanged=this._cameraUpdate.changed(n);const i=this._evaluateIfShadowAndAoUpdateIsNeeded();this._updateSceneRenderPass(),this._updateBakedGroundContactShadowPass(),this._updateGBufferPass(i),this._updateGroundReflectionPass(i),this._updateScreenSpaceShadowPass(i),this._updateShadowAndAoPass(i),this._updateOutlinePass(),this._updateDebugPass()}_evaluateIfShadowAndAoUpdateIsNeeded(){const e=this._shadowAndAoPass.parameters.alwaysUpdate||this._screenSpaceShadowMapPass.needsUpdate||this._screenSpaceShadowMapPass.shadowTypeNeedsUpdate;let t=(this._shadowAndAoPass.parameters.enabled||this._groundReflectionPass.parameters.enabled)&&this._cameraChanged,n=1;return t&&(this._noUpdateNeededCount=0,this._noOStaticFrames=0),e||(this._noUpdateNeededCount++,t=this._noUpdateNeededCount>=this.parameters.effectSuspendFrames,n=Math.max(0,Math.min(1,(this._noUpdateNeededCount-this.parameters.effectSuspendFrames)/this.parameters.effectFadeInFrames))),e||1!==n||this._noOStaticFrames++,t=e||t,{needsUpdate:t,shadowOnCameraChange:!t||n<.99?this.parameters.shadowOnCameraChange:tf,intensityScale:n}}_dynamicChanges(e){return e.needsUpdate||e.shadowOnCameraChange!==tf}_updateSceneRenderPass(){this._sceneRenderPass.drawWithDebugMaterial=!1}_updateBakedGroundContactShadowPass(){const e=this._bakedGroundContactShadowPass.limitPlaneSize;this._bakedGroundContactShadowPass.limitPlaneSize=this._bakedGroundContactShadowPass.parameters.enabled,(e!==this._bakedGroundContactShadowPass.limitPlaneSize||this._bakedGroundContactShadowPass.needsUpdate)&&this._bakedGroundContactShadowPass.updateBounds(this._sceneRenderer.boundingVolume,this._sceneRenderer.groundLevel),this._sceneRenderPass.drawGround=this._bakedGroundContactShadowPass.parameters.enabled||this._shadowAndAoPass.parameters.applyToMaterial}_updateGBufferPass(e){this._passUpdateStates.updateGBuffer=!1,this._gBufferRenderPass.needsUpdate=e.needsUpdate||e.shadowOnCameraChange===rf,this.gBufferRenderPass.drawGround=this._sceneRenderer.boundingVolumeSet&&this._shadowAndAoPass.parameters.aoOnGround}_updateGroundReflectionPass(e){this._passUpdateStates.updateGroundReflection=!1,this._groundReflectionPass.parameters.enabled&&this._dynamicChanges(e)&&(!this.parameters.suspendGroundReflection||e.needsUpdate)&&(this._groundReflectionPass.reflectionFadeInScale=this.parameters.suspendGroundReflection?e.intensityScale:1,this._passUpdateStates.updateGroundReflection=!0)}_updateScreenSpaceShadowPass(e){this._dynamicChanges(e)?(this._screenSpaceShadowMapPass.parameters.alwaysUpdate=this._shadowAndAoPass.parameters.alwaysUpdate,this._screenSpaceShadowMapPass.drawGround=this._shadowAndAoPass.parameters.shadowOnGround,this._passUpdateStates.updateScreenSpaceShadow=this._shadowAndAoPass.parameters.shadowIntensity>0,this._passUpdateStates.updateScreenSpaceShadow=!0,this._passUpdateStates.updateGBuffer=!0):this._passUpdateStates.updateScreenSpaceShadow=!1}_updateShadowAndAoPass(e){this._dynamicChanges(e)?(this._shadowAndAoPass.shadowAndAoPassSettings={shadowMapTexture:this._screenSpaceShadowMapPass.shadowTexture,shadowBlurType:e.needsUpdate?af:e.shadowOnCameraChange,shadowFadeInBlurType:e.shadowOnCameraChange,shadowFadeInMix:1-e.intensityScale,noOStaticFrames:this.noOStaticFrames},this._passUpdateStates.updateShadowAndAoPass=!0,this._passUpdateStates.updateGBuffer=!0):this._passUpdateStates.updateShadowAndAoPass=!1}_updateOutlinePass(){this.outlineRenderer.outlinePassActivated&&this.outlineRenderer.outlinePass?(this.outlineRenderer.outlinePass.renderToScreen=!1,this.outlineRenderer.outlinePass.clearBackground=!1,this._passUpdateStates.updateOutlinePass=!0,this._passUpdateStates.updateGBuffer=!0):this._passUpdateStates.updateOutlinePass=!1}_updateDebugPass(){if(this.debugOutput&&""!==this.debugOutput&&"off"!==this.debugOutput){if("outline"===this.debugOutput&&this.outlineRenderer.outlinePass)return this.outlineRenderer.outlinePass.clearBackground=!0,void(this._passUpdateStates.updateDebugPass=!1);if("color"===this.debugOutput||"grayscale"===this.debugOutput)return this._passUpdateStates.updateGroundReflection=!1,this._passUpdateStates.updateGBuffer=!1,this._passUpdateStates.updateScreenSpaceShadow=!1,this._passUpdateStates.updateShadowAndAoPass=!1,this._passUpdateStates.updateOutlinePass=!1,this._passUpdateStates.updateDebugPass=!1,void(this._sceneRenderPass.drawWithDebugMaterial="grayscale"===this.debugOutput);this.debugPass.debugOutput=this.debugOutput,this._passUpdateStates.updateDebugPass=!0}else this._passUpdateStates.updateDebugPass=!1}_updateMaterials(e,t){if(!this.materialsNeedUpdate||!this._shadowAndAoPass.parameters.applyToMaterial)return;this.aoPassMapTexture=this._shadowAndAoPass.denoiseRenderTargetTexture;const n=e.getPixelRatio();this.materialsNeedUpdate=!1,t.traverse((e=>{if(e.isMesh){const t=e.material;t instanceof Gl&&this._updateMaterial(e,t,n)}}))}_updateMaterial(e,t,n){const i=Kf.addPlugin(t);i&&(this._updatePlugInAo(i,e,t,n),this._updatePlugInReflection(i,e),t.needsUpdate=!1)}_updatePlugInAo(e,t,n,i){const r=this._shadowAndAoPass.parameters.enabled&&this._shadowAndAoPass.parameters.applyToMaterial&&null!==this.aoPassMapTexture&&("ShadowGroundPlaneMaterial"===n.name||t.receiveShadow&&(!n.transparent||n.alphaTest>=.9)),a=r&&this._shadowAndAoPass.parameters.aoIntensity>.01,s=r&&this._screenSpaceShadowMapPass.enabled&&this._shadowAndAoPass.parameters.shadowIntensity>.01;e.applyAoAndShadowToAlpha="ShadowGroundPlaneMaterial"===n.name,e.aoPassMapIntensity=a?2*this._shadowAndAoPass.parameters.aoIntensity:-1,e.shPassMapIntensity=s?2*this._shadowAndAoPass.parameters.shadowIntensity:-1,e.aoPassMapScale=1/i,e.aoPassMap=this.aoPassMapTexture}_updatePlugInReflection(e,t){const n=this._groundReflectionPass.intensityRenderTarget.texture,i=t.userData.isPlanFloor&&this._groundReflectionPass.parameters.enabled&&(null!==n||void 0!==n),r=this._groundReflectionPass.parameters.intensity;e.applyReflectionPassMap=i,e.reflectionPassMapIntensity=i?Math.pow(r,.25):0,e.reflectionPassMapScale=1/(this._groundReflectionPass.parameters.renderTargetDownScale*devicePixelRatio),e.reflectionPassMap=i?n:null}renderPasses(e,t){var n,i;e.setRenderTarget(null),this._bakedGroundContactShadowPass.renderPass(e),this._passUpdateStates.updateGBuffer&&this._gBufferRenderPass.renderPass(e),this._passUpdateStates.updateScreenSpaceShadow&&this._screenSpaceShadowMapPass.renderPass(e),this._passUpdateStates.updateShadowAndAoPass&&this._shadowAndAoPass.renderPass(e),this._updateMaterials(e,t),this._sceneRenderPass.renderPass(e),this._passUpdateStates.updateGroundReflection&&this._groundReflectionPass.renderPass(e),this._passUpdateStates.updateShadowAndAoPass&&!this._shadowAndAoPass.parameters.applyToMaterial&&this._shadowAndAoPass.renderToTarget(e),this._passUpdateStates.updateOutlinePass&&(null===(n=this._outlinePass)||void 0===n||n.renderPass(e)),this._passUpdateStates.updateDebugPass&&(null===(i=this._debugPass)||void 0===i||i.renderPass(e))}}const em="highest",tm="high",nm="medium";class im{get sceneRenderPass(){return this._renderPassManager.sceneRenderPass}get bakedGroundContactShadowPass(){return this._renderPassManager.bakedGroundContactShadowPass}get gBufferRenderPass(){return this._renderPassManager.gBufferRenderPass}get groundReflectionPass(){return this._renderPassManager.groundReflectionPass}get screenSpaceShadowMapPass(){return this._renderPassManager.screenSpaceShadowMapPass}get shadowAndAoPass(){return this._renderPassManager.shadowAndAoPass}get debugPass(){return this._renderPassManager.debugPass}get shadowAndAoGroundPlane(){return this._shadowAndAoGroundPlane}constructor(e,t,n){this.debugOutput="off",this.outputColorSpace="",this.toneMapping="",this.environmentLights=!1,this.enableObjectSelection=!0,this.groundLevel=0,this.uiInteractionMode=!1,this.width=0,this.height=0,this.boundingVolume=new Th,this.boundingVolumeSet=!1,this.renderCacheManager=new ff,this.selectedObjects=[],this.groundGroup=new vo,this._shadingType=hf,this._qualityLevel=em,this._qualityMap=new Map,this._customShadingParameters=null,this.width=t,this.height=n,this.renderer=e,this.renderCacheManager.registerCache("inivisibleGround",new mf((e=>e===this.groundGroup))),this.renderCacheManager.registerCache("debug",new mf),this.renderCacheManager.registerCache("floorDepthWrite",new gf((e=>{var t;return null===(t=e.userData)||void 0===t?void 0:t.isFloor}))),this._shadowAndAoGroundPlane=new Fp(null),this.groundGroup.rotateX(-Math.PI/2),this._renderPassManager=new $f(this),this.outlineRenderer=new lf(this._renderPassManager,null,{}),this.parameters={gBufferRenderTargetParameters:this.gBufferRenderPass.parameters,bakedGroundContactShadowParameters:this.bakedGroundContactShadowPass.parameters,screenSpaceShadowMapParameters:this.screenSpaceShadowMapPass.parameters,shAndAoPassParameters:this.shadowAndAoPass.parameters,groundReflectionParameters:this.groundReflectionPass.parameters,outlineParameters:this.outlineRenderer.parameters,effectSuspendFrames:0,effectFadeInFrames:0,suspendGroundReflection:!1,shadowOnCameraChange:tf},this._addEventListeners(this.renderer)}_addEventListeners(e){e.domElement.addEventListener("webglcontextlost",(()=>{console.log("webglcontextlost")})),e.domElement.addEventListener("webglcontextrestored",(()=>{console.log("webglcontextrestored"),this._forceEnvironmentMapUpdate(this.renderer)}))}dispose(){var e;null===(e=this._copyMaterial)||void 0===e||e.dispose(),this._renderPassManager.dispose(),this.renderer.dispose()}setSize(e,t){this.width=e,this.height=t,this._renderPassManager.setSize(e,t),this.renderer.setSize(e,t)}getQualityLevel(){return this._qualityLevel}setShadingType(e){this._shadingType!==e&&(this._shadingType=e,this.applyCurrentParameters())}setQualityLevel(e){this._qualityLevel!==e&&(this._qualityMap.has(this._qualityLevel)&&(this._qualityLevel=e),this.applyCurrentParameters())}setQualityMap(e){this._qualityMap=e,this.applyCurrentParameters()}setCustomShadingParameters(e){this._customShadingParameters=e,this.applyCurrentParameters(),this.requestUpdateOfPasses()}setQualityMapAndShadingParameters(e,t){this._qualityMap=e,this._customShadingParameters=t,this.applyCurrentParameters(),this.requestUpdateOfPasses()}applyCurrentParameters(){const e=[];this._qualityMap.has(this._qualityLevel)&&e.push(this._qualityMap.get(this._qualityLevel));const t=(n=this._shadingType)&&n!==hf&&"bright"===n?df:null;var n;t&&e.push(t);const i=this.uiInteractionMode?{groundReflectionParameters:{enabled:!1}}:null;if(i&&e.push(i),this._customShadingParameters&&e.push((e=>{const t={shAndAoPassParameters:{ao:{},shadow:{}},groundReflectionParameters:{},bakedGroundContactShadowParameters:{}};return((e,t)=>{void 0!==t.aoIntensity&&(e.shAndAoPassParameters.aoIntensity=uf(t.aoIntensity)),void 0!==t.aoExtent&&(e.shAndAoPassParameters.ao.radius=.3*uf(t.aoExtent),e.shAndAoPassParameters.ao.thickness=.1+.2*uf(t.aoExtent))})(t,e),((e,t)=>{t.shBakedOnGround?(e.bakedGroundContactShadowParameters.enabled=!0,e.shAndAoPassParameters.shadowIntensity=0,void 0!==t.shadowIntensity&&(e.bakedGroundContactShadowParameters.opacity=uf(t.shadowIntensity)),void 0!==t.shadowIntensity&&(e.bakedGroundContactShadowParameters.blurMax=.1*uf(t.shadowIntensity),e.bakedGroundContactShadowParameters.blurMin=.01*e.bakedGroundContactShadowParameters.blurMax)):(void 0!==t.shBakedOnGround&&(e.bakedGroundContactShadowParameters.enabled=!1),void 0!==t.shadowIntensity&&(e.shAndAoPassParameters.shadowIntensity=uf(t.shadowIntensity)),void 0!==t.shadowSoftening&&(e.shAndAoPassParameters.shadow.shadowRadius=.001+.2*uf(t.shadowSoftening)))})(t,e),((e,t)=>{void 0!==t.grReflectIntensity&&(e.groundReflectionParameters.enabled=t.grReflectIntensity>0,e.groundReflectionParameters.intensity=uf(t.grReflectIntensity)),void 0!==t.grReflectFadeOut&&(e.groundReflectionParameters.fadeOutDistance=4*(1-uf(t.grReflectFadeOut)))})(t,e),t})(this._customShadingParameters)),e.length>0){const t=((...e)=>{if(0===e.length)return null;if(1===e.length)return e[0];let t=e[0];for(let n=1;n0&&(this.environmentLights=!1),this.screenSpaceShadowMapPass.updateRectAreaLights(e,t),this.shadowAndAoPass.needsUpdate=!0}createShadowFromLightSources(e,t){this.environmentLights=!0,this.screenSpaceShadowMapPass.createShadowFromLightSources(e,t),this.shadowAndAoPass.needsUpdate=!0}selectObjects(e){this.selectedObjects=e}updateBounds(e,t){this.clearCache();const n=e.clone();n.min.y>this.groundLevel&&(n.min.y=this.groundLevel),this.boundingVolumeSet=!0,this.gBufferRenderPass.groundDepthWrite=this.shadowAndAoPass.parameters.aoOnGround,this.boundingVolume.updateFromBox(n);const i=this.boundingVolume.size,r=(i.x+i.y+i.z)/3,a=Math.min(i.x,i.y,i.z),s=Math.max(i.x,i.y,i.z),o=a<.5?a/.5:i.z>5?i.z/5:1;this.bakedGroundContactShadowPass.setScale(t?r:o,r),this.groundReflectionPass.updateBounds(this.groundLevel,Math.min(1,s)),this.screenSpaceShadowMapPass.updateBounds(this.boundingVolume,r),this.shadowAndAoPass.updateBounds(this.boundingVolume,t?r:Math.min(1,2*s))}updateNearAndFarPlaneOfPerspectiveCamera(e,t){const n=this.boundingVolume.getNearAndFarForPerspectiveCamera(e.position,3);e.near=Math.max(1e-5,.9*n[0]),e.far=Math.max(null!=t?t:e.near,n[1]),e.updateProjectionMatrix()}_forceEnvironmentMapUpdate(e){const t=e.userData;if(null==t?void 0:t.environmentTexture){const e=t.environmentTexture;t.environmentTexture=void 0,e.dispose()}}_updateEnvironment(e,t){var n,i;if(!(null===(n=t.userData)||void 0===n?void 0:n.environmentDefinition))return;e.userData||(e.userData={});const r=e.userData;if(r&&((null===(i=t.userData)||void 0===i?void 0:i.environmentDefinition.needsUpdate)||!r.environmentTexture||r.environmentDefinition!==t.userData.environmentDefinition)){const n=t.userData.environmentDefinition;if(r.environmentDefinition=n,r.environmentTexture=n.createNewEnvironment(e),t.userData.shadowFromEnvironment){const e=n.maxNoOfLightSources;void 0!==e&&(this.screenSpaceShadowMapPass.parameters.maximumNumberOfLightSources=e),this.createShadowFromLightSources(t,n.lightSources)}}t.environment=null==r?void 0:r.environmentTexture,t.userData.showEnvironmentBackground?t.background=t.environment:t.background===t.environment&&(t.background=null)}render(e,t){e.add(this.groundGroup),this._updateEnvironment(this.renderer,e),this.outlineRenderer.updateOutline(e,t,this.enableObjectSelection?this.selectedObjects:[]),this._renderPassManager.updatePasses(this.renderer,e,t),this._renderPassManager.renderPasses(this.renderer,e),e.remove(this.groundGroup)}}class rm extends fi{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Nt(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const am=new dn,sm=new Hn,om=new Hn,lm=new dn,cm=new dn;class hm extends vo{constructor(e,t,n){super(),this.arrowNeedsUpdate=!0,this.labelTextClientWidth=0,this.startPosition=e.clone(),this.endPosition=t.clone(),this.parameters=Object.assign({shaftPixelWidth:10,shaftPixelOffset:3,arrowPixelWidth:30,arrowPixelHeight:50,color:0,labelClass:"label",deviceRatio:1,autoLabelTextUpdate:!0,autoLabelRotationUpdate:!0},n),this.startShaftMaterial=new dm,this.startShaft=new mr(new Hr(2,1).translate(0,.5,0),this.startShaftMaterial),this.startShaft.onBeforeRender=(e,t,n,i,r,a)=>{this.updateShaftMaterial(!0,e,n,r)},this.add(this.startShaft),this.endShaftMaterial=new dm,this.endShaft=new mr(new Hr(2,1).translate(0,.5,0),this.endShaftMaterial),this.endShaft.onBeforeRender=(e,t,n,i,r,a)=>{this.updateShaftMaterial(!1,e,n,r)},this.add(this.endShaft),this.startArrowMaterial=new um,this.startArrow=new mr(new Hr(2,1).translate(0,.5,0),this.startArrowMaterial),this.startArrow.onBeforeRender=(e,t,n,i,r,a)=>{this.updateArrowMaterial(!0,e,n,r)},this.add(this.startArrow),this.endArrowMaterial=new um,this.endArrow=new mr(new Hr(2,1).translate(0,.5,0),this.endArrowMaterial),this.endArrow.onBeforeRender=(e,t,n,i,r,a)=>{this.updateArrowMaterial(!1,e,n,r)},this.add(this.endArrow),this.arrowLabel=this.createArrowLabel("0.000",this.parameters),this.add(this.arrowLabel),this.updateArrow()}createArrowLabel(e,t){var n,i,r,a,s,o;const l=document.createElement("div"),c=document.createElement("div");l.appendChild(c),c.className=null!==(n=t.labelClass)&&void 0!==n?n:"",c.textContent=e,c.style.backgroundColor="transparent",c.style.color=new Ci(null!==(i=t.color)&&void 0!==i?i:0).getStyle();const h=new rm(l);return h.position.set(0,0,0),h.center.set(null!==(a=null===(r=t.origin)||void 0===r?void 0:r.x)&&void 0!==a?a:.5,null!==(o=null===(s=t.origin)||void 0===s?void 0:s.y)&&void 0!==o?o:.5),h.layers.set(0),h}setPosition(e,t,n=0,i=0){const r=t.clone().sub(e).normalize();this.startPosition.copy(e.clone().add(r.clone().multiplyScalar(n))),this.endPosition.copy(t.clone().add(r.clone().multiplyScalar(-i))),this.arrowNeedsUpdate=!0}setAngle(e){const t=`${e.toFixed(0)}deg`;this.arrowLabel.element.children[0].style.rotate=t}setLabel(e){const t=this.arrowLabel.element.children[0];t.textContent=e,this.labelTextClientWidth=t.clientWidth*this.parameters.deviceRatio}updateArrow(){const e=this.startPosition.clone().applyMatrix4(this.matrixWorld),t=this.endPosition.clone().applyMatrix4(this.matrixWorld),n=t.clone().sub(e),i=n.length();n.multiplyScalar(1/i);const r=new dn(0,1,0).cross(n),a=Math.acos(new dn(0,1,0).dot(n));this.setModelMatrix(this.startShaft,e,i,r,a),this.setModelMatrix(this.endShaft,t,i,r,a),this.setModelMatrix(this.startArrow,e,1,r,a),this.setModelMatrix(this.endArrow,t,1,r,a+Math.PI)}updateArrowLabel(e,t){var n,i;const r=this.startPosition.distanceTo(this.endPosition).toFixed(3),a=this.startPosition.clone().applyMatrix4(this.matrixWorld).applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix),s=this.endPosition.clone().applyMatrix4(this.matrixWorld).applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix),o=s.clone().add(a).multiplyScalar(.5).applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld);this.arrowLabel.position.copy(o);const l=e.getRenderTarget(),c=null!==(n=null==l?void 0:l.width)&&void 0!==n?n:e.domElement.clientWidth,h=null!==(i=null==l?void 0:l.height)&&void 0!==i?i:e.domElement.clientHeight,d=s.clone().sub(a),u=180*Math.atan2(-d.y,d.x*c/h)/Math.PI;this.parameters.autoLabelRotationUpdate&&this.setAngle(u),this.parameters.autoLabelTextUpdate&&this.setLabel(r)}setModelMatrix(e,t,n,i,r){e.scale.set(1,1,1),e.rotation.set(0,0,0),e.position.set(0,0,0),e.applyMatrix4((new Hn).makeScale(1,.5*n,1)),e.applyMatrix4((new Hn).makeRotationAxis(i,r)),e.applyMatrix4((new Hn).makeTranslation(t.x,t.y,t.z))}updateShaftMaterial(e,t,n,i){var r,a;if(this.updateMatrixWorld(),i instanceof dm){const s=t.getRenderTarget(),o=new Nt;t.getSize(o);const l=null!==(r=null==s?void 0:s.width)&&void 0!==r?r:o.x,c=null!==(a=null==s?void 0:s.height)&&void 0!==a?a:o.y,h=this.startPosition.clone().applyMatrix4(this.matrixWorld),d=this.endPosition.clone().applyMatrix4(this.matrixWorld);i.update({width:l,height:c,camera:n,start:e?h:d,end:e?d:h,shaftPixelWidth:this.parameters.shaftPixelWidth,shaftPixelOffset:this.parameters.shaftPixelOffset,arrowPixelSize:new Nt(this.parameters.arrowPixelWidth,this.parameters.arrowPixelHeight),labelPixelWidth:this.labelTextClientWidth,color:this.parameters.color})}this.arrowNeedsUpdate&&(this.arrowNeedsUpdate=!1,this.updateArrowLabel(t,n),this.updateArrow())}updateArrowMaterial(e,t,n,i){var r,a;if(this.updateMatrixWorld(),i instanceof um){const s=t.getRenderTarget(),o=null!==(r=null==s?void 0:s.width)&&void 0!==r?r:t.domElement.clientWidth,l=null!==(a=null==s?void 0:s.height)&&void 0!==a?a:t.domElement.clientHeight,c=this.startPosition.clone().applyMatrix4(this.matrixWorld),h=this.endPosition.clone().applyMatrix4(this.matrixWorld);i.update({width:o,height:l,camera:n,start:e?c:h,end:e?h:c,arrowPixelSize:new Nt(this.parameters.arrowPixelWidth,this.parameters.arrowPixelHeight),color:this.parameters.color})}this.arrowNeedsUpdate&&(this.arrowNeedsUpdate=!1,this.updateArrowLabel(t,n),this.updateArrow())}}class dm extends wr{constructor(e){super({defines:Object.assign({},dm.shader.defines),uniforms:Sr.clone(dm.shader.uniforms),vertexShader:dm.shader.vertexShader,fragmentShader:dm.shader.fragmentShader,side:2,blending:0}),this.update(e)}update(e){var t,n;if((null==e?void 0:e.width)||(null==e?void 0:e.height)){const i=null!==(t=null==e?void 0:e.width)&&void 0!==t?t:this.uniforms.resolution.value.x,r=null!==(n=null==e?void 0:e.height)&&void 0!==n?n:this.uniforms.resolution.value.y;this.uniforms.resolution.value.set(i,r)}return void 0!==(null==e?void 0:e.start)&&this.uniforms.start.value.copy(e.start),void 0!==(null==e?void 0:e.end)&&this.uniforms.end.value.copy(e.end),void 0!==(null==e?void 0:e.shaftPixelWidth)&&(this.uniforms.shaftPixelWidth.value=e.shaftPixelWidth),void 0!==(null==e?void 0:e.shaftPixelOffset)&&(this.uniforms.shaftPixelOffset.value=e.shaftPixelOffset),void 0!==(null==e?void 0:e.arrowPixelSize)&&this.uniforms.arrowPixelSize.value.copy(e.arrowPixelSize),void 0!==(null==e?void 0:e.labelPixelWidth)&&(this.uniforms.labelPixelWidth.value=e.labelPixelWidth),void 0!==(null==e?void 0:e.color)&&(this.uniforms.color.value=new Ci(e.color)),this}}dm.shader={uniforms:{resolution:{value:new Nt},start:{value:new dn},end:{value:new dn},shaftPixelWidth:{value:10},shaftPixelOffset:{value:10},arrowPixelSize:{value:new Nt},labelPixelWidth:{value:0},color:{value:new Ci}},defines:{RADIUS_RATIO:.5},vertexShader:"varying vec2 centerPixel;\nvarying vec2 posPixel;\nvarying vec2 arrowDir;\n\nuniform vec2 resolution;\nuniform vec3 start;\nuniform vec3 end;\nuniform float shaftPixelWidth;\nuniform float shaftPixelOffset;\nuniform vec2 arrowPixelSize;\nuniform float labelPixelWidth;\n\nvec2 pixelToNdcScale(vec4 hVec) {\n return vec2(2.0 * hVec.w) / resolution.xy;\n}\n\nvoid main() {\n vec4 viewPos = modelViewMatrix * vec4(0.0, 0.0, position.z, 1.0);\n gl_Position = projectionMatrix * viewPos;\n vec4 clipStart = projectionMatrix * viewMatrix * vec4(start, 1.0);\n vec4 clipEnd = projectionMatrix * viewMatrix * vec4(end, 1.0);\n vec2 clipDir = normalize((clipEnd.xy / clipEnd.w - clipStart.xy / clipStart.w) * resolution.xy);\n vec4 shaftEnd = vec4(clipEnd.xy / clipEnd.w * clipStart.w, clipStart.zw);\n shaftEnd.xy -= clipDir * (labelPixelWidth * 0.5 + shaftPixelOffset) * pixelToNdcScale(gl_Position);\n gl_Position.xy = mix(clipStart.xy / clipStart.w, shaftEnd.xy / shaftEnd.w, position.y * 0.5) * gl_Position.w;\n gl_Position.xy += vec2(-clipDir.y, clipDir.x) * position.x * shaftPixelWidth * 0.5 * pixelToNdcScale(gl_Position);\n\n vec4 clipCenter = clipStart;\n float d = arrowPixelSize.y * (1.0 + RADIUS_RATIO) - length(arrowPixelSize * vec2(0.5, RADIUS_RATIO));\n clipCenter.xy += clipDir * (d + shaftPixelOffset + shaftPixelWidth * 0.5) * pixelToNdcScale(gl_Position);\n centerPixel = (clipCenter.xy / gl_Position.w * 0.5 + 0.5) * resolution;\n posPixel = (gl_Position.xy / gl_Position.w * 0.5 + 0.5) * resolution;\n arrowDir = clipDir;\n}",fragmentShader:"varying vec2 centerPixel;\nvarying vec2 posPixel;\nvarying vec2 arrowDir;\n\nuniform float shaftPixelWidth;\nuniform vec3 color;\n\nvoid main() {\n if (dot(arrowDir, posPixel - centerPixel) < 0.0 && length(posPixel - centerPixel) > shaftPixelWidth * 0.5)\n discard;\n gl_FragColor = vec4(color, 1.0);\n}"};class um extends wr{constructor(e){super({defines:Object.assign({},um.shader.defines),uniforms:Sr.clone(um.shader.uniforms),vertexShader:um.shader.vertexShader,fragmentShader:um.shader.fragmentShader,side:2,blending:0}),this.update(e)}update(e){var t,n;if((null==e?void 0:e.width)||(null==e?void 0:e.height)){const i=null!==(t=null==e?void 0:e.width)&&void 0!==t?t:this.uniforms.resolution.value.x,r=null!==(n=null==e?void 0:e.height)&&void 0!==n?n:this.uniforms.resolution.value.y;this.uniforms.resolution.value.set(i,r)}return void 0!==(null==e?void 0:e.start)&&this.uniforms.start.value.copy(e.start),void 0!==(null==e?void 0:e.end)&&this.uniforms.end.value.copy(e.end),void 0!==(null==e?void 0:e.arrowPixelSize)&&this.uniforms.arrowPixelSize.value.copy(e.arrowPixelSize),void 0!==(null==e?void 0:e.color)&&(this.uniforms.color.value=new Ci(e.color)),this}}um.shader={uniforms:{resolution:{value:new Nt},start:{value:new dn},end:{value:new dn},arrowPixelSize:{value:new Nt},color:{value:new Ci}},defines:{RADIUS_RATIO:.5},vertexShader:"varying vec2 arrowUv;\nvarying vec2 centerPixel;\nvarying vec2 posPixel;\n\nuniform vec2 resolution;\nuniform vec3 start;\nuniform vec3 end;\nuniform vec2 arrowPixelSize;\n\nvec2 pixelToNdcScale(vec4 hVec) {\n return vec2(2.0 * hVec.w) / resolution.xy;\n}\n\nvoid main() {\n vec4 viewPos = modelViewMatrix * vec4(0.0, 0.0, position.z, 1.0);\n gl_Position = projectionMatrix * viewPos;\n vec4 clipStart = projectionMatrix * viewMatrix * vec4(start, 1.0);\n vec4 clipEnd = projectionMatrix * viewMatrix * vec4(end, 1.0);\n vec2 clipDir = normalize((clipEnd.xy / clipEnd.w - clipStart.xy / clipStart.w) * resolution.xy);\n gl_Position.xy += clipDir * position.y * arrowPixelSize.y * pixelToNdcScale(gl_Position);\n gl_Position.xy += vec2(-clipDir.y, clipDir.x) * position.x * arrowPixelSize.x * 0.5 * pixelToNdcScale(gl_Position);\n\n arrowUv = position.xy;\n\n vec4 clipCenter = clipStart;\n clipCenter.xy += clipDir * arrowPixelSize.y * (1.0 + RADIUS_RATIO) * pixelToNdcScale(gl_Position);\n centerPixel = (clipCenter.xy / gl_Position.w * 0.5 + 0.5) * resolution;\n posPixel = (gl_Position.xy / gl_Position.w * 0.5 + 0.5) * resolution;\n}",fragmentShader:"varying vec2 arrowUv;\nvarying vec2 centerPixel;\nvarying vec2 posPixel;\n\nuniform vec2 resolution;\nuniform vec2 arrowPixelSize;\nuniform vec3 color;\n\nvoid main() {\n if (abs(arrowUv.x) > abs(arrowUv.y))\n discard;\n if (length(posPixel - centerPixel) < length(arrowPixelSize * vec2(0.5, RADIUS_RATIO)))\n discard;\n gl_FragColor = vec4(color, 1.0);\n}"};const pm="all_around",fm="front";class mm extends Qh{constructor(e={}){super(),this._parameters={},this._parameters=e}generateScene(e,t){const n=new gm(Object.assign(Object.assign({},this._parameters),{lightIntensity:e*(this._parameters.lightIntensity||1),topLightIntensity:e*(this._parameters.topLightIntensity||1),sidLightIntensity:e*(this._parameters.sidLightIntensity||1)}));return n.rotation.y=t,n}}class gm extends Eo{constructor(e={}){var t;super(),this._type=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:pm,this._topLightIntensity=(null==e?void 0:e.topLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideLightIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideReflectorIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1;const n=this._type===fm?.3:0;this._ambientLightIntensity=(null==e?void 0:e.ambientLightIntensity)||n,this._colorVariation=(null==e?void 0:e.colorVariation)||.5,this._lightGeometry=new vr,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new Ol(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(e){switch(this._type){default:case pm:this._createAllAroundSceneLight(e);break;case fm:this._createFrontSceneLight(e)}}dispose(){const e=new Set;this.traverse((t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))}));for(const t of e)t.dispose()}_createAllAroundSceneLight(e){const t=this._ambientLightIntensity;this.background=new Ci(t,t,t),this._createTopLight(e,6,1);for(let t=0;t<6;t++){const n=t*Math.PI*2/6,i=Math.sin(n),r=Math.cos(n);t%2==0?this._createReflector(e,new Nt(i,r),3,1,.8,.2):this._createSideLight(e,new Nt(i,r),(t-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(e){const t=this._ambientLightIntensity;this.background=new Ci(t,t,t),this._createTopLight(e,6,.7);for(let t=0;t<6;t++){const n=t*Math.PI*2/6,i=Math.sin(n),r=Math.cos(n);if(0===t){this._createReflector(e,new Nt(i,r),1.1,.6,.8,-.4);for(let n=0;n<2;n++){const i=(t-.3+.6*n)*Math.PI*2/6,r=Math.sin(i),a=Math.cos(i);this._createSideLight(e,new Nt(r,a),(t-1)/2,50,1.2,.7,.8)}}else this._createReflector(e,new Nt(i,r),1.1,.7,1.4,0)}}_createAreaLightMaterial(e,t,n){const i=new Ui;return i.color.set(e,null!=t?t:e,null!=n?n:e),i}_createTopLight(e,t,n){const i=new mr(this._lightGeometry,this._createAreaLightMaterial(t*this._topLightIntensity));i.position.set(0,20,0),i.scale.set(5*n,.1,5*n),e.add(i)}_createSideLight(e,t,n,i,r,a,s){for(let o=0;o<3;o++){const l=i*this._sideLightIntensity,c=new mr(this._lightGeometry,this._createAreaLightMaterial((o+n)%3==0?l:l*(1-this._colorVariation),(o+n)%3==1?l:l*(1-this._colorVariation),(o+n)%3==2?l:l*(1-this._colorVariation))),h=(1===o?-t.y:2===o?t.y:0)/Math.sqrt(2),d=0===o?0:1,u=(1===o?t.x:2===o?-t.x:0)/Math.sqrt(2);c.position.set(t.x*s*15+1.1*h*r,15*a+1.1*d*r,t.y*s*15+1.1*u*r),c.rotation.set(0,Math.atan2(t.x,t.y),0),c.scale.setScalar(r),e.add(c)}}_createReflector(e,t,n,i,r,a){const s=new mr(this._reflectorLightGeometry,this._createAreaLightMaterial(n*this._sideReflectorIntensity));s.position.set(15*t.x,10*a,15*t.y),s.scale.set(10*i,10*r,10*i),e.add(s)}}const vm={effectSuspendFrames:0,effectFadeInFrames:0,suspendGroundReflection:!1,shadowOnCameraChange:af},_m={effectSuspendFrames:5,effectFadeInFrames:5,suspendGroundReflection:!1,shadowOnCameraChange:rf},xm={effectSuspendFrames:5,effectFadeInFrames:5,suspendGroundReflection:!0,shadowOnCameraChange:nf},ym={enabled:!0,aoOnGround:!0,shadowOnGround:!0,aoIntensity:1,shadowIntensity:1,ao:{algorithm:4,samples:16,radius:.5,distanceExponent:2,thickness:1,distanceFallOff:1,scale:1,bias:.01,screenSpaceRadius:!1}},Sm={enableGroundBoundary:!1,directionalDependency:1,directionalExponent:1,groundBoundary:1,fadeOutDistance:.2,fadeOutBlur:5},wm=new Map([[em,Object.assign(Object.assign({},vm),{shAndAoPassParameters:ym,screenSpaceShadowMapParameters:Sm,groundReflectionParameters:{enabled:!0},bakedGroundContactShadowParameters:{enabled:!1}})],[tm,Object.assign(Object.assign({},_m),{shAndAoPassParameters:ym,screenSpaceShadowMapParameters:Sm,groundReflectionParameters:{enabled:!0},bakedGroundContactShadowParameters:{enabled:!1}})],[nm,Object.assign(Object.assign({},xm),{shAndAoPassParameters:ym,screenSpaceShadowMapParameters:Sm,groundReflectionParameters:{enabled:!1},bakedGroundContactShadowParameters:{enabled:!1}})],["low",{shAndAoPassParameters:{enabled:!1,aoOnGround:!1,shadowOnGround:!1},groundReflectionParameters:{enabled:!1},bakedGroundContactShadowParameters:{enabled:!0}}]]);class bm extends mr{constructor(e,t,n,i=128){if(t<=0||n<=0||i<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const r=new zl(n,2*i,i);r.scale(1,1,-1);const a=r.getAttribute("position"),s=new dn;for(let e=0;e{const t=e.materialId;return{materialId:e.materialId,name:t}})),a=Object.assign({},...r.map((e=>({[e.name]:e.materialId}))));this.materialFolder.add(this,"materialId",a).onChange((e=>this.updateMaterialPropertiesUI(e))),this.updateMaterialPropertiesUI(this.materialId)}updateMaterialPropertiesUI(e){var t,n,i,r,a,s,o,l,c,h;if(this.materialId=e,!this.materialFolder)return;this.materialProperties&&(this.materialFolder.removeFolder(this.materialProperties),this.materialProperties=void 0);const d=this.materials.find((t=>t.materialId===e));if(!d)return;const u=d.material;if(!u)return;const p={color:null!==(n=null===(t=u.color)||void 0===t?void 0:t.getHex())&&void 0!==n?n:16777215,specularColor:null!==(r=null===(i=u.color)||void 0===i?void 0:i.getHex())&&void 0!==r?r:16777215,emissive:null!==(s=null===(a=u.emissive)||void 0===a?void 0:a.getHex())&&void 0!==s?s:16777215,sheenColor:null!==(l=null===(o=u.emissive)||void 0===o?void 0:o.getHex())&&void 0!==l?l:16777215,attenuationColor:null!==(h=null===(c=u.emissive)||void 0===c?void 0:c.getHex())&&void 0!==h?h:16777215};let f="properties";d.material.userData&&(d.material.userData.diffuseMap&&(f+=d.material.userData.diffuseMapHasAlpha?" RGBA":" RGB"),d.material.userData.normalMap&&(f+=" XYZ"),d.material.userData.ormMap&&(f+=" ORM")),this.materialProperties=this.materialFolder.addFolder(f),this.materialProperties.addColor(p,"color").onChange(Em.handleColorChange(u.color,!0)),this.materialProperties.add(u,"opacity",0,1).onChange((e=>{const t=e<1;t!==u.transparent&&(u.transparent=t,u.needsUpdate=!0)}));try{this.materialProperties.add(u,"metalness",0,1),this.materialProperties.add(u,"roughness",0,1),this.materialProperties.add(u,"transmission",0,1),this.materialProperties.add(u,"ior",1,2.333),this.materialProperties.add(u,"specularIntensity",0,1),this.materialProperties.addColor(p,"specularColor").onChange(Em.handleColorChange(u.specularColor,!0)),this.materialProperties.add(u,"reflectivity",0,1),this.materialProperties.add(u,"clearcoat",0,1),this.materialProperties.add(u,"clearcoatRoughness",0,1),this.materialProperties.add(u,"sheen",0,1),this.materialProperties.add(u,"sheenRoughness",0,1),this.materialProperties.addColor(p,"sheenColor").onChange(Em.handleColorChange(u.sheenColor,!0)),this.materialProperties.add(u,"emissiveIntensity",0,1),this.materialProperties.addColor(p,"emissive").onChange(Em.handleColorChange(u.emissive,!0)),this.materialProperties.add(u,"attenuationDistance",0,50),this.materialProperties.addColor(p,"attenuationColor").onChange(Em.handleColorChange(u.attenuationColor,!0)),this.materialProperties.add(u,"thickness",0,50)}catch(e){console.log(e)}}static handleColorChange(e,t=!1){return n=>{"string"==typeof n&&(n=n.replace("#","0x")),e.setHex(n),!0===t&&e.convertSRGBToLinear()}}}var Am=function(){var e=0,t=document.createElement("div");function n(e){return t.appendChild(e.dom),e}function i(n){for(var i=0;i=a+1e3&&(o.update(1e3*s/(e-a),100),a=e,s=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){r=this.end()},domElement:t,setMode:i}};Am.Panel=function(e,t,n){var i=1/0,r=0,a=Math.round,s=a(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,h=2*s,d=3*s,u=15*s,p=74*s,f=30*s,m=document.createElement("canvas");m.width=o,m.height=l,m.style.cssText="width:80px;height:48px";var g=m.getContext("2d");return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=n,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,c,h),g.fillRect(d,u,p,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d,u,p,f),{dom:m,update:function(l,v){i=Math.min(i,l),r=Math.max(r,l),g.fillStyle=n,g.globalAlpha=1,g.fillRect(0,0,o,u),g.fillStyle=t,g.fillText(a(l)+" "+e+" ("+a(i)+"-"+a(r)+")",c,h),g.drawImage(m,d+s,u,p-s,f,d,u,p-s,f),g.fillRect(d+p-s,u,s,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d+p-s,u,s,a((1-l/v)*f))}}};const Pm=Am;function Rm(e,t){var n=e.__state.conversionName.toString(),i=Math.round(e.r),r=Math.round(e.g),a=Math.round(e.b),s=e.a,o=Math.round(e.h),l=e.s.toFixed(1),c=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=e.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+a+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+a+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+a+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+a+","+s+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+a+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+a+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+o+",s:"+l+",v:"+c+"}":"HSVA_OBJ"===n?"{h:"+o+",s:"+l+",v:"+c+",a:"+s+"}":"unknown format"}var Cm=Array.prototype.forEach,Lm=Array.prototype.slice,Dm={BREAK:{},extend:function(e){return this.each(Lm.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}),this),e},defaults:function(e){return this.each(Lm.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}),this),e},compose:function(){var e=Lm.call(arguments);return function(){for(var t=Lm.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(Cm&&e.forEach&&e.forEach===Cm)e.forEach(t,n);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?Dm.toArray(arguments):arguments[0];return Dm.each(Im,(function(t){if(t.litmus(e))return Dm.each(t.conversions,(function(t,n){if(Um=t.read(e),!1===Om&&!1!==Um)return Om=Um,Um.conversionName=n,Um.conversion=t,Dm.BREAK})),Dm.BREAK})),Om},Fm=void 0,Bm={hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),a=n*(1-t),s=n*(1-r*t),o=n*(1-(1-r)*t),l=[[n,o,a],[s,n,a],[a,n,o],[a,s,n],[o,a,n],[n,a,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i=Math.min(e,t,n),r=Math.max(e,t,n),a=r-i,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=e===r?(t-n)/a:t===r?2+(n-e)/a:4+(e-t)/a,(s/=6)<0&&(s+=1),{h:360*s,s:a/r,v:r/255})},rgb_to_hex:function(e,t,n){var i=this.hex_with_component(0,2,e);return i=this.hex_with_component(i,1,t),this.hex_with_component(i,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(Fm=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var ig=function(e){function t(e,n,i){km(this,t);var r=Wm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),a=i||{};return r.__min=a.min,r.__max=a.max,r.__step=a.step,Dm.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=ng(r.__impliedStep),r}return Gm(t,e),Hm(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),Vm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=ng(e),this}}]),t}(qm),rg=function(e){function t(e,n,i){km(this,t);var r=Wm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));r.__truncationSuspended=!1;var a=r,s=void 0;function o(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function l(e){var t=s-e.clientY;a.setValue(a.getValue()+t*a.__impliedStep),s=e.clientY}function c(){Qm.unbind(window,"mousemove",l),Qm.unbind(window,"mouseup",c),o()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),Qm.bind(r.__input,"change",(function(){var e=parseFloat(a.__input.value);Dm.isNaN(e)||a.setValue(e)})),Qm.bind(r.__input,"blur",(function(){o()})),Qm.bind(r.__input,"mousedown",(function(e){Qm.bind(window,"mousemove",l),Qm.bind(window,"mouseup",c),s=e.clientY})),Qm.bind(r.__input,"keydown",(function(e){13===e.keyCode&&(a.__truncationSuspended=!0,this.blur(),a.__truncationSuspended=!1,o())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return Gm(t,e),Hm(t,[{key:"updateDisplay",value:function(){var e,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(e*i)/i),Vm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(ig);function ag(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)}var sg=function(e){function t(e,n,i,r,a){km(this,t);var s=Wm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:i,max:r,step:a})),o=s;function l(e){e.preventDefault();var t=o.__background.getBoundingClientRect();return o.setValue(ag(e.clientX,t.left,t.right,o.__min,o.__max)),!1}function c(){Qm.unbind(window,"mousemove",l),Qm.unbind(window,"mouseup",c),o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function h(e){var t=e.touches[0].clientX,n=o.__background.getBoundingClientRect();o.setValue(ag(t,n.left,n.right,o.__min,o.__max))}function d(){Qm.unbind(window,"touchmove",h),Qm.unbind(window,"touchend",d),o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),Qm.bind(s.__background,"mousedown",(function(e){document.activeElement.blur(),Qm.bind(window,"mousemove",l),Qm.bind(window,"mouseup",c),l(e)})),Qm.bind(s.__background,"touchstart",(function(e){1===e.touches.length&&(Qm.bind(window,"touchmove",h),Qm.bind(window,"touchend",d),h(e))})),Qm.addClass(s.__background,"slider"),Qm.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return Gm(t,e),Hm(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",Vm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(ig),og=function(e){function t(e,n,i){km(this,t);var r=Wm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),a=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,Qm.bind(r.__button,"click",(function(e){return e.preventDefault(),a.fire(),!1})),Qm.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return Gm(t,e),Hm(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(qm),lg=function(e){function t(e,n){km(this,t);var i=Wm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.__color=new jm(i.getValue()),i.__temp=new jm(0);var r=i;i.domElement=document.createElement("div"),Qm.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",Qm.bind(i.__input,"keydown",(function(e){13===e.keyCode&&d.call(this)})),Qm.bind(i.__input,"blur",d),Qm.bind(i.__selector,"mousedown",(function(){Qm.addClass(this,"drag").bind(window,"mouseup",(function(){Qm.removeClass(r.__selector,"drag")}))})),Qm.bind(i.__selector,"touchstart",(function(){Qm.addClass(this,"drag").bind(window,"touchend",(function(){Qm.removeClass(r.__selector,"drag")}))}));var a,s=document.createElement("div");function o(e){p(e),Qm.bind(window,"mousemove",p),Qm.bind(window,"touchmove",p),Qm.bind(window,"mouseup",c),Qm.bind(window,"touchend",c)}function l(e){f(e),Qm.bind(window,"mousemove",f),Qm.bind(window,"touchmove",f),Qm.bind(window,"mouseup",h),Qm.bind(window,"touchend",h)}function c(){Qm.unbind(window,"mousemove",p),Qm.unbind(window,"touchmove",p),Qm.unbind(window,"mouseup",c),Qm.unbind(window,"touchend",c),u()}function h(){Qm.unbind(window,"mousemove",f),Qm.unbind(window,"touchmove",f),Qm.unbind(window,"mouseup",h),Qm.unbind(window,"touchend",h),u()}function d(){var e=Nm(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function u(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,i=n.clientX,a=n.clientY,s=(i-t.left)/(t.right-t.left),o=1-(a-t.top)/(t.bottom-t.top);return o>1?o=1:o<0&&(o=0),s>1?s=1:s<0&&(s=0),r.__color.v=o,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return Dm.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Dm.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Dm.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Dm.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Dm.extend(s.style,{width:"100%",height:"100%",background:"none"}),hg(s,"top","rgba(0,0,0,0)","#000"),Dm.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(a=i.__hue_field).style.background="",a.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",a.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Dm.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),Qm.bind(i.__saturation_field,"mousedown",o),Qm.bind(i.__saturation_field,"touchstart",o),Qm.bind(i.__field_knob,"mousedown",o),Qm.bind(i.__field_knob,"touchstart",o),Qm.bind(i.__hue_field,"mousedown",l),Qm.bind(i.__hue_field,"touchstart",l),i.__saturation_field.appendChild(s),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return Gm(t,e),Hm(t,[{key:"updateDisplay",value:function(){var e=Nm(this.getValue());if(!1!==e){var t=!1;Dm.each(jm.COMPONENTS,(function(n){if(!Dm.isUndefined(e[n])&&!Dm.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&Dm.extend(this.__color.__state,e)}Dm.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;Dm.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,hg(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Dm.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),t}(qm),cg=["-moz-","-o-","-webkit-","-ms-",""];function hg(e,t,n,i){e.style.background="",Dm.each(cg,(function(r){e.style.cssText+="background: "+r+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "}))}var dg=function(e,t){var n=e[t];return Dm.isArray(arguments[2])||Dm.isObject(arguments[2])?new eg(e,t,arguments[2]):Dm.isNumber(n)?Dm.isNumber(arguments[2])&&Dm.isNumber(arguments[3])?Dm.isNumber(arguments[4])?new sg(e,t,arguments[2],arguments[3],arguments[4]):new sg(e,t,arguments[2],arguments[3]):Dm.isNumber(arguments[4])?new rg(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new rg(e,t,{min:arguments[2],max:arguments[3]}):Dm.isString(n)?new tg(e,t):Dm.isFunction(n)?new og(e,t,""):Dm.isBoolean(n)?new $m(e,t):null},ug=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},pg=function(){function e(){km(this,e),this.backgroundElement=document.createElement("div"),Dm.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),Qm.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Dm.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;Qm.bind(this.backgroundElement,"click",(function(){t.hide()}))}return Hm(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),Dm.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",Qm.unbind(e.domElement,"webkitTransitionEnd",t),Qm.unbind(e.domElement,"transitionend",t),Qm.unbind(e.domElement,"oTransitionEnd",t)};Qm.bind(this.domElement,"webkitTransitionEnd",t),Qm.bind(this.domElement,"transitionend",t),Qm.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-Qm.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-Qm.getHeight(this.domElement)/2+"px"}}]),e}();!function(e,t){var n=t||document,i=document.createElement("style");i.type="text/css",i.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(e){}}(function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var fg="Default",mg=function(){try{return!!window.localStorage}catch(e){return!1}}(),gg=void 0,vg=!0,_g=void 0,xg=!1,yg=[],Sg=function e(t){var n=this,i=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),Qm.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=Dm.defaults(i,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),i=Dm.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),Dm.isUndefined(i.load)?i.load={preset:fg}:i.preset&&(i.load.preset=i.preset),Dm.isUndefined(i.parent)&&i.hideable&&yg.push(this),i.resizable=Dm.isUndefined(i.parent)&&i.resizable,i.autoPlace&&Dm.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,a=mg&&"true"===localStorage.getItem(Ag(0,"isLocal")),s=void 0,o=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(e){n.parent?n.getRoot().preset=e:i.load.preset=e,function(e){for(var t=0;t1){var i=n.__li.nextElementSibling;return n.remove(),Eg(e,n.object,n.property,{before:i,factoryArgs:[Dm.toArray(arguments)]})}if(Dm.isArray(t)||Dm.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),Eg(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof sg){var i=new rg(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});Dm.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],r=i[e];n[e]=i[e]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(i,e),t.apply(n,e)}})),Qm.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof rg){var r=function(t){if(Dm.isNumber(n.__min)&&Dm.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var a=Eg(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return a.name(i),r&&a.listen(),a}return t};n.min=Dm.compose(r,n.min),n.max=Dm.compose(r,n.max)}else n instanceof $m?(Qm.bind(t,"click",(function(){Qm.fakeEvent(n.__checkbox,"click")})),Qm.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof og?(Qm.bind(t,"click",(function(){Qm.fakeEvent(n.__button,"click")})),Qm.bind(t,"mouseover",(function(){Qm.addClass(n.__button,"hover")})),Qm.bind(t,"mouseout",(function(){Qm.removeClass(n.__button,"hover")}))):n instanceof lg&&(Qm.addClass(t,"color"),n.updateDisplay=Dm.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=Dm.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&Mg(e.getRoot(),!0),t}),n.setValue)}(e,l,r),e.__controllers.push(r),r}function Ag(e,t){return document.location.href+"."+t}function Pg(e,t,n){var i=document.createElement("option");i.innerHTML=t,i.value=t,e.__preset_select.appendChild(i),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function Rg(e,t){t.style.display=e.useLocalStorage?"block":"none"}function Cg(e){var t=void 0;function n(n){return n.preventDefault(),e.width+=t-n.clientX,e.onResize(),t=n.clientX,!1}function i(){Qm.removeClass(e.__closeButton,Sg.CLASS_DRAG),Qm.unbind(window,"mousemove",n),Qm.unbind(window,"mouseup",i)}function r(r){return r.preventDefault(),t=r.clientX,Qm.addClass(e.__closeButton,Sg.CLASS_DRAG),Qm.bind(window,"mousemove",n),Qm.bind(window,"mouseup",i),!1}e.__resize_handle=document.createElement("div"),Dm.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),Qm.bind(e.__resize_handle,"mousedown",r),Qm.bind(e.__closeButton,"mousedown",r),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function Lg(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function Dg(e,t){var n={};return Dm.each(e.__rememberedObjects,(function(i,r){var a={},s=e.__rememberedObjectIndecesToControllers[r];Dm.each(s,(function(e,n){a[n]=t?e.initialValue:e.getValue()})),n[r]=a})),n}function Ig(e){0!==e.length&&ug.call(window,(function(){Ig(e)})),Dm.each(e,(function(e){e.updateDisplay()}))}Sg.toggleHide=function(){xg=!xg,Dm.each(yg,(function(e){e.domElement.style.display=xg?"none":""}))},Sg.CLASS_AUTO_PLACE="a",Sg.CLASS_AUTO_PLACE_CONTAINER="ac",Sg.CLASS_MAIN="main",Sg.CLASS_CONTROLLER_ROW="cr",Sg.CLASS_TOO_TALL="taller-than-window",Sg.CLASS_CLOSED="closed",Sg.CLASS_CLOSE_BUTTON="close-button",Sg.CLASS_CLOSE_TOP="close-top",Sg.CLASS_CLOSE_BOTTOM="close-bottom",Sg.CLASS_DRAG="drag",Sg.DEFAULT_WIDTH=245,Sg.TEXT_CLOSED="Close Controls",Sg.TEXT_OPEN="Open Controls",Sg._keydownHandler=function(e){"text"===document.activeElement.type||72!==e.which&&72!==e.keyCode||Sg.toggleHide()},Qm.bind(window,"keydown",Sg._keydownHandler,!1),Dm.extend(Sg.prototype,{add:function(e,t){return Eg(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return Eg(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;Dm.defer((function(){t.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&_g.removeChild(this.domElement);var e=this;Dm.each(this.__folders,(function(t){e.removeFolder(t)})),Qm.unbind(window,"keydown",Sg._keydownHandler,!1),bg(this)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new Sg(t);this.__folders[e]=n;var i=wg(this,n.domElement);return Qm.addClass(i,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],bg(e);var t=this;Dm.each(e.__folders,(function(t){e.removeFolder(t)})),Dm.defer((function(){t.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=Qm.getOffset(e.__ul).top,n=0;Dm.each(e.__ul.childNodes,(function(t){e.autoPlace&&t===e.__save_row||(n+=Qm.getHeight(t))})),window.innerHeight-t-20GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n'),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;Dm.each(Array.prototype.slice.call(arguments),(function(t){0===e.__rememberedObjects.length&&function(e){var t=e.__save_row=document.createElement("li");Qm.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),Qm.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",Qm.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",Qm.addClass(i,"button"),Qm.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",Qm.addClass(r,"button"),Qm.addClass(r,"save-as");var a=document.createElement("span");a.innerHTML="Revert",Qm.addClass(a,"button"),Qm.addClass(a,"revert");var s=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?Dm.each(e.load.remembered,(function(t,n){Pg(e,n,n===e.preset)})):Pg(e,fg,!1),Qm.bind(s,"change",(function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=Dg(this)),e.folders={},Dm.each(this.__folders,(function(t,n){e.folders[n]=t.getSaveObject()})),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=Dg(this),Mg(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[fg]=Dg(this,!0)),this.load.remembered[e]=Dg(this),this.preset=e,Pg(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){Dm.each(this.__controllers,(function(t){this.getRoot().load.remembered?Tg(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),Dm.each(this.__folders,(function(e){e.revert(e)})),e||Mg(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&Ig(this.__listening)},updateDisplay:function(){Dm.each(this.__controllers,(function(e){e.updateDisplay()})),Dm.each(this.__folders,(function(e){e.updateDisplay()}))}});var Ug=Sg;const Og=(()=>{const e=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(e)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(e)?"mobile":"desktop"})();console.log(Og);const Ng="mobile"===Og,Fg={},Bg=(e,t="#000000")=>{console.log(`Status information: ${e}`);const n=document.getElementById("status-line");n&&(n.innerText=e,n.style.setProperty("color",t))},zg=e=>{const t=Yg.collectMaterials();rv.updateMaterialUI(qg,t),Bg(`${e}`),Xg.sceneName=e.replace(/:/g,"_")},kg=(e,t)=>{return n=void 0,i=void 0,a=function*(){let n=Fg[t];n||(yield Yg.loadResource(e+".glb",t,(e=>{}),((e,n)=>{n?(Fg[t]={scene:n,glb:!0},zg(e)):Bg(`load ${e}`,"#ff0000")})),n=Fg[t]),Bg(`render ${t}`,"#ff0000"),Yg.update(void 0,n.scene,n.glb),zg(t)},new((r=void 0)||(r=Promise))((function(e,t){function s(e){try{l(a.next(e))}catch(e){t(e)}}function o(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,o)}l((a=a.apply(n,i||[])).next())}));var n,i,r,a},Hg=()=>{let e=Dh;switch(Xg.groundMaterial.toLocaleLowerCase()){default:e=Dh;break;case"parquet":e=Ih;break;case"pavement":e=Uh}Yg.setGroundMaterial(e)},Vg=document.getElementById("container"),Gg=new class{constructor(e={}){const{canvas:t=Ht(),context:i=null,depth:r=!0,stencil:a=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=e;let u;if(this.isWebGLRenderer=!0,null!==i){if("undefined"!=typeof WebGLRenderingContext&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");u=i.getContextAttributes().alpha}else u=s;const p=new Uint32Array(4),f=new Int32Array(4);let m=null,g=null;const v=[],_=[];this.domElement=t,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._outputColorSpace=it,this.toneMapping=C,this.toneMappingExposure=1;const x=this;let y=!1,S=0,w=0,b=null,M=-1,T=null;const E=new an,A=new an;let P=null;const R=new Ci(0);let L=0,D=t.width,I=t.height,U=1,O=null,N=null;const F=new an(0,0,D,I),B=new an(0,0,D,I);let z=!1;const k=new Br;let H=!1,V=!1;const G=new Hn,W=new dn,j=new an,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Y=!1;function q(){return null===b?U:1}let Z,Q,$,te,ie,le,ce,he,de,ue,pe,fe,me,ge,_e,Se,we,be,Me,Te,Ee,Ae,Pe,Re,Ce=i;function Le(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:r,stencil:a,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${n}`),t.addEventListener("webglcontextlost",Ue,!1),t.addEventListener("webglcontextrestored",Oe,!1),t.addEventListener("webglcontextcreationerror",Ne,!1),null===Ce){const t="webgl2";if(Ce=Le(t,e),null===Ce)throw Le(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function De(){Z=new va(Ce),Z.init(),Ae=new mo(Ce,Z),Q=new Jr(Ce,Z,e,Ae),$=new uo(Ce),te=new ya(Ce),ie=new Js,le=new fo(Ce,Z,$,ie,Q,Ae,te),ce=new $r(x),he=new ga(x),de=new kr(Ce),Pe=new Zr(Ce,de),ue=new _a(Ce,de,te,Pe),pe=new wa(Ce,ue,de,te),Me=new Sa(Ce,Q,le),Se=new Qr(ie),fe=new Ks(x,ce,he,Z,Q,Pe,Se),me=new Mo(x,ie),ge=new to,_e=new oo(Z),be=new qr(x,ce,he,$,pe,u,l),we=new ho(x,pe,Q),Re=new To(Ce,te,Q,$),Te=new Kr(Ce,Z,te),Ee=new xa(Ce,Z,te),te.programs=fe.programs,x.capabilities=Q,x.extensions=Z,x.properties=ie,x.renderLists=ge,x.shadowMap=we,x.state=$,x.info=te}De();const Ie=new So(x,Ce);function Ue(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function Oe(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const e=te.autoReset,t=we.enabled,n=we.autoUpdate,i=we.needsUpdate,r=we.type;De(),te.autoReset=e,we.enabled=t,we.autoUpdate=n,we.needsUpdate=i,we.type=r}function Ne(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Fe(e){const t=e.target;t.removeEventListener("dispose",Fe),function(e){(function(e){const t=ie.get(e).programs;void 0!==t&&(t.forEach((function(e){fe.releaseProgram(e)})),e.isShaderMaterial&&fe.releaseShaderCache(e))})(e),ie.remove(e)}(t)}function Be(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,qe(e,t,n),e.side=0,e.needsUpdate=!0,qe(e,t,n),e.side=2):qe(e,t,n)}this.xr=Ie,this.getContext=function(){return Ce},this.getContextAttributes=function(){return Ce.getContextAttributes()},this.forceContextLoss=function(){const e=Z.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=Z.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return U},this.setPixelRatio=function(e){void 0!==e&&(U=e,this.setSize(D,I,!1))},this.getSize=function(e){return e.set(D,I)},this.setSize=function(e,n,i=!0){Ie.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(D=e,I=n,t.width=Math.floor(e*U),t.height=Math.floor(n*U),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(D*U,I*U).floor()},this.setDrawingBufferSize=function(e,n,i){D=e,I=n,U=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(F)},this.setViewport=function(e,t,n,i){e.isVector4?F.set(e.x,e.y,e.z,e.w):F.set(e,t,n,i),$.viewport(E.copy(F).multiplyScalar(U).round())},this.getScissor=function(e){return e.copy(B)},this.setScissor=function(e,t,n,i){e.isVector4?B.set(e.x,e.y,e.z,e.w):B.set(e,t,n,i),$.scissor(A.copy(B).multiplyScalar(U).round())},this.getScissorTest=function(){return z},this.setScissorTest=function(e){$.setScissorTest(z=e)},this.setOpaqueSort=function(e){O=e},this.setTransparentSort=function(e){N=e},this.getClearColor=function(e){return e.copy(be.getClearColor())},this.setClearColor=function(){be.setClearColor.apply(be,arguments)},this.getClearAlpha=function(){return be.getClearAlpha()},this.setClearAlpha=function(){be.setClearAlpha.apply(be,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==b){const t=b.texture.format;e=t===ye||t===xe||t===ve}if(e){const e=b.texture.type,t=e===J||e===ne||e===ee||e===oe||e===ae||e===se,n=be.getClearColor(),i=be.getClearAlpha(),r=n.r,a=n.g,s=n.b;t?(p[0]=r,p[1]=a,p[2]=s,p[3]=i,Ce.clearBufferuiv(Ce.COLOR,0,p)):(f[0]=r,f[1]=a,f[2]=s,f[3]=i,Ce.clearBufferiv(Ce.COLOR,0,f))}else i|=Ce.COLOR_BUFFER_BIT}t&&(i|=Ce.DEPTH_BUFFER_BIT),n&&(i|=Ce.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Ce.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ue,!1),t.removeEventListener("webglcontextrestored",Oe,!1),t.removeEventListener("webglcontextcreationerror",Ne,!1),ge.dispose(),_e.dispose(),ie.dispose(),ce.dispose(),he.dispose(),pe.dispose(),Pe.dispose(),Re.dispose(),fe.dispose(),Ie.dispose(),Ie.removeEventListener("sessionstart",ke),Ie.removeEventListener("sessionend",He),Ve.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=X);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=function(e,t,n,i,r){!0!==t.isScene&&(t=X),le.resetTextureUnits();const a=t.fog,s=i.isMeshStandardMaterial?t.environment:null,o=null===b?x.outputColorSpace:!0===b.isXRRenderTarget?b.texture.colorSpace:rt,l=(i.isMeshStandardMaterial?he:ce).get(i.envMap||s),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),d=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let f=C;i.toneMapped&&(null!==b&&!0!==b.isXRRenderTarget||(f=x.toneMapping));const m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==m?m.length:0,_=ie.get(i),y=g.state.lights;if(!0===H&&(!0===V||e!==T)){const t=e===T&&i.id===M;Se.setState(i,e,t)}let S=!1;i.version===_.__version?_.needsLights&&_.lightsStateVersion!==y.state.version||_.outputColorSpace!==o||r.isBatchedMesh&&!1===_.batching?S=!0:r.isBatchedMesh||!0!==_.batching?r.isBatchedMesh&&!0===_.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===_.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===_.instancing?S=!0:r.isInstancedMesh||!0!==_.instancing?r.isSkinnedMesh&&!1===_.skinning?S=!0:r.isSkinnedMesh||!0!==_.skinning?r.isInstancedMesh&&!0===_.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===_.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===_.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===_.instancingMorph&&null!==r.morphTexture||_.envMap!==l||!0===i.fog&&_.fog!==a?S=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===Se.numPlanes&&_.numIntersection===Se.numIntersection?(_.vertexAlphas!==c||_.vertexTangents!==h||_.morphTargets!==d||_.morphNormals!==u||_.morphColors!==p||_.toneMapping!==f||_.morphTargetsCount!==v)&&(S=!0):S=!0:S=!0:S=!0:S=!0:(S=!0,_.__version=i.version);let w=_.currentProgram;!0===S&&(w=qe(i,t,r));let E=!1,A=!1,P=!1;const R=w.getUniforms(),L=_.uniforms;if($.useProgram(w.program)&&(E=!0,A=!0,P=!0),i.id!==M&&(M=i.id,A=!0),E||T!==e){R.setValue(Ce,"projectionMatrix",e.projectionMatrix),R.setValue(Ce,"viewMatrix",e.matrixWorldInverse);const t=R.map.cameraPosition;void 0!==t&&t.setValue(Ce,W.setFromMatrixPosition(e.matrixWorld)),Q.logarithmicDepthBuffer&&R.setValue(Ce,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&R.setValue(Ce,"isOrthographic",!0===e.isOrthographicCamera),T!==e&&(T=e,A=!0,P=!0)}if(r.isSkinnedMesh){R.setOptional(Ce,r,"bindMatrix"),R.setOptional(Ce,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),R.setValue(Ce,"boneTexture",e.boneTexture,le))}r.isBatchedMesh&&(R.setOptional(Ce,r,"batchingTexture"),R.setValue(Ce,"batchingTexture",r._matricesTexture,le),R.setOptional(Ce,r,"batchingIdTexture"),R.setValue(Ce,"batchingIdTexture",r._indirectTexture,le),R.setOptional(Ce,r,"batchingColorTexture"),null!==r._colorsTexture&&R.setValue(Ce,"batchingColorTexture",r._colorsTexture,le));const D=n.morphAttributes;var O,N;if(void 0===D.position&&void 0===D.normal&&void 0===D.color||Me.update(r,n,w),(A||_.receiveShadow!==r.receiveShadow)&&(_.receiveShadow=r.receiveShadow,R.setValue(Ce,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(L.envMap.value=l,L.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(L.envMapIntensity.value=t.environmentIntensity),A&&(R.setValue(Ce,"toneMappingExposure",x.toneMappingExposure),_.needsLights&&(N=P,(O=L).ambientLightColor.needsUpdate=N,O.lightProbe.needsUpdate=N,O.directionalLights.needsUpdate=N,O.directionalLightShadows.needsUpdate=N,O.pointLights.needsUpdate=N,O.pointLightShadows.needsUpdate=N,O.spotLights.needsUpdate=N,O.spotLightShadows.needsUpdate=N,O.rectAreaLights.needsUpdate=N,O.hemisphereLights.needsUpdate=N),a&&!0===i.fog&&me.refreshFogUniforms(L,a),me.refreshMaterialUniforms(L,i,U,I,g.state.transmissionRenderTarget[e.id]),Ps.upload(Ce,Ze(_),L,le)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Ps.upload(Ce,Ze(_),L,le),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&R.setValue(Ce,"center",r.center),R.setValue(Ce,"modelViewMatrix",r.modelViewMatrix),R.setValue(Ce,"normalMatrix",r.normalMatrix),R.setValue(Ce,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t{function n(){i.forEach((function(e){ie.get(e).currentProgram.isReady()&&i.delete(e)})),0!==i.size?setTimeout(n,10):t(e)}null!==Z.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let ze=null;function ke(){Ve.stop()}function He(){Ve.start()}const Ve=new zr;function Ge(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||k.intersectsSprite(e)){i&&j.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=pe.update(e),r=e.material;r.visible&&m.push(e,t,r,n,j.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||k.intersectsObject(e))){const t=pe.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),j.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),j.copy(t.boundingSphere.center)),j.applyMatrix4(e.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const i=t.groups;for(let a=0,s=i.length;a0&&Xe(r,t,n),a.length>0&&Xe(a,t,n),s.length>0&&Xe(s,t,n),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function je(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===g.state.transmissionRenderTarget[i.id]&&(g.state.transmissionRenderTarget[i.id]=new on(1,1,{generateMipmaps:!0,type:Z.has("EXT_color_buffer_half_float")||Z.has("EXT_color_buffer_float")?re:J,minFilter:K,samples:4,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:qt.workingColorSpace}));const r=g.state.transmissionRenderTarget[i.id],s=i.viewport||E;r.setSize(s.z,s.w);const o=x.getRenderTarget();x.setRenderTarget(r),x.getClearColor(R),L=x.getClearAlpha(),L<1&&x.setClearColor(16777215,.5),Y?be.render(n):x.clear();const l=x.toneMapping;x.toneMapping=C;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),g.setupLightsView(i),!0===H&&Se.setGlobalState(x.clippingPlanes,i),Xe(e,n,i),le.updateMultisampleRenderTarget(r),le.updateRenderTargetMipmap(r),!1===Z.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r0)for(let t=0,a=n.length;t0&&je(i,r,e,t),Y&&be.render(e),We(m,e,t);null!==b&&(le.updateMultisampleRenderTarget(b),le.updateRenderTargetMipmap(b)),!0===e.isScene&&e.onAfterRender(x,e,t),Pe.resetDefaultState(),M=-1,T=null,_.pop(),_.length>0?(g=_[_.length-1],!0===H&&Se.setGlobalState(x.clippingPlanes,g.state.camera)):g=null,v.pop(),m=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(e,t,n){ie.get(e.texture).__webglTexture=t,ie.get(e.depthTexture).__webglTexture=n;const i=ie.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===Z.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){const n=ie.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){b=e,S=t,w=n;let i=!0,r=null,a=!1,s=!1;if(e){const o=ie.get(e);void 0!==o.__useDefaultFramebuffer?($.bindFramebuffer(Ce.FRAMEBUFFER,null),i=!1):void 0===o.__webglFramebuffer?le.setupRenderTarget(e):o.__hasExternalTextures&&le.rebindTextures(e,ie.get(e.texture).__webglTexture,ie.get(e.depthTexture).__webglTexture);const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(s=!0);const c=ie.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],a=!0):r=e.samples>0&&!1===le.useMultisampledRTT(e)?ie.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,E.copy(e.viewport),A.copy(e.scissor),P=e.scissorTest}else E.copy(F).multiplyScalar(U).floor(),A.copy(B).multiplyScalar(U).floor(),P=z;if($.bindFramebuffer(Ce.FRAMEBUFFER,r)&&i&&$.drawBuffers(e,r),$.viewport(E),$.scissor(A),$.setScissorTest(P),a){const i=ie.get(e.texture);Ce.framebufferTexture2D(Ce.FRAMEBUFFER,Ce.COLOR_ATTACHMENT0,Ce.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(s){const i=ie.get(e.texture),r=t||0;Ce.framebufferTextureLayer(Ce.FRAMEBUFFER,Ce.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}M=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,s){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ie.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){$.bindFramebuffer(Ce.FRAMEBUFFER,o);try{const s=e.texture,o=s.format,l=s.type;if(!Q.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!Q.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Ce.readPixels(t,n,i,r,Ae.convert(o),Ae.convert(l),a)}finally{const e=null!==b?ie.get(b).__webglFramebuffer:null;$.bindFramebuffer(Ce.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,s){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ie.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){$.bindFramebuffer(Ce.FRAMEBUFFER,o);try{const s=e.texture,o=s.format,l=s.type;if(!Q.textureFormatReadable(o))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Q.textureTypeReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){const e=Ce.createBuffer();Ce.bindBuffer(Ce.PIXEL_PACK_BUFFER,e),Ce.bufferData(Ce.PIXEL_PACK_BUFFER,a.byteLength,Ce.STREAM_READ),Ce.readPixels(t,n,i,r,Ae.convert(o),Ae.convert(l),0),Ce.flush();const s=Ce.fenceSync(Ce.SYNC_GPU_COMMANDS_COMPLETE,0);await function(e,t,n){return new Promise((function(n,i){setTimeout((function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}}),4)}))}(Ce,s);try{Ce.bindBuffer(Ce.PIXEL_PACK_BUFFER,e),Ce.getBufferSubData(Ce.PIXEL_PACK_BUFFER,0,a)}finally{Ce.deleteBuffer(e),Ce.deleteSync(s)}return a}}finally{const e=null!==b?ie.get(b).__webglFramebuffer:null;$.bindFramebuffer(Ce.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),s=null!==t?t.x:0,o=null!==t?t.y:0;le.setTexture2D(e,0),Ce.copyTexSubImage2D(Ce.TEXTURE_2D,n,0,0,s,o,r,a),$.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,i=null,r=0){let a,s,o,l,c,h;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],r=arguments[3]||0,n=null),null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.min.x,l=n.min.y):(a=e.image.width,s=e.image.height,o=0,l=0),null!==i?(c=i.x,h=i.y):(c=0,h=0);const d=Ae.convert(t.format),u=Ae.convert(t.type);le.setTexture2D(t,0),Ce.pixelStorei(Ce.UNPACK_FLIP_Y_WEBGL,t.flipY),Ce.pixelStorei(Ce.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Ce.pixelStorei(Ce.UNPACK_ALIGNMENT,t.unpackAlignment);const p=Ce.getParameter(Ce.UNPACK_ROW_LENGTH),f=Ce.getParameter(Ce.UNPACK_IMAGE_HEIGHT),m=Ce.getParameter(Ce.UNPACK_SKIP_PIXELS),g=Ce.getParameter(Ce.UNPACK_SKIP_ROWS),v=Ce.getParameter(Ce.UNPACK_SKIP_IMAGES),_=e.isCompressedTexture?e.mipmaps[r]:e.image;Ce.pixelStorei(Ce.UNPACK_ROW_LENGTH,_.width),Ce.pixelStorei(Ce.UNPACK_IMAGE_HEIGHT,_.height),Ce.pixelStorei(Ce.UNPACK_SKIP_PIXELS,o),Ce.pixelStorei(Ce.UNPACK_SKIP_ROWS,l),e.isDataTexture?Ce.texSubImage2D(Ce.TEXTURE_2D,r,c,h,a,s,d,u,_.data):e.isCompressedTexture?Ce.compressedTexSubImage2D(Ce.TEXTURE_2D,r,c,h,_.width,_.height,d,_.data):Ce.texSubImage2D(Ce.TEXTURE_2D,r,c,h,a,s,d,u,_),Ce.pixelStorei(Ce.UNPACK_ROW_LENGTH,p),Ce.pixelStorei(Ce.UNPACK_IMAGE_HEIGHT,f),Ce.pixelStorei(Ce.UNPACK_SKIP_PIXELS,m),Ce.pixelStorei(Ce.UNPACK_SKIP_ROWS,g),Ce.pixelStorei(Ce.UNPACK_SKIP_IMAGES,v),0===r&&t.generateMipmaps&&Ce.generateMipmap(Ce.TEXTURE_2D),$.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){let a,s,o,l,c,h,d,u,p;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0);const f=e.isCompressedTexture?e.mipmaps[r]:e.image;null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.max.z-n.min.z,l=n.min.x,c=n.min.y,h=n.min.z):(a=f.width,s=f.height,o=f.depth,l=0,c=0,h=0),null!==i?(d=i.x,u=i.y,p=i.z):(d=0,u=0,p=0);const m=Ae.convert(t.format),g=Ae.convert(t.type);let v;if(t.isData3DTexture)le.setTexture3D(t,0),v=Ce.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");le.setTexture2DArray(t,0),v=Ce.TEXTURE_2D_ARRAY}Ce.pixelStorei(Ce.UNPACK_FLIP_Y_WEBGL,t.flipY),Ce.pixelStorei(Ce.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Ce.pixelStorei(Ce.UNPACK_ALIGNMENT,t.unpackAlignment);const _=Ce.getParameter(Ce.UNPACK_ROW_LENGTH),x=Ce.getParameter(Ce.UNPACK_IMAGE_HEIGHT),y=Ce.getParameter(Ce.UNPACK_SKIP_PIXELS),S=Ce.getParameter(Ce.UNPACK_SKIP_ROWS),w=Ce.getParameter(Ce.UNPACK_SKIP_IMAGES);Ce.pixelStorei(Ce.UNPACK_ROW_LENGTH,f.width),Ce.pixelStorei(Ce.UNPACK_IMAGE_HEIGHT,f.height),Ce.pixelStorei(Ce.UNPACK_SKIP_PIXELS,l),Ce.pixelStorei(Ce.UNPACK_SKIP_ROWS,c),Ce.pixelStorei(Ce.UNPACK_SKIP_IMAGES,h),e.isDataTexture||e.isData3DTexture?Ce.texSubImage3D(v,r,d,u,p,a,s,o,m,g,f.data):t.isCompressedArrayTexture?Ce.compressedTexSubImage3D(v,r,d,u,p,a,s,o,m,f.data):Ce.texSubImage3D(v,r,d,u,p,a,s,o,m,g,f),Ce.pixelStorei(Ce.UNPACK_ROW_LENGTH,_),Ce.pixelStorei(Ce.UNPACK_IMAGE_HEIGHT,x),Ce.pixelStorei(Ce.UNPACK_SKIP_PIXELS,y),Ce.pixelStorei(Ce.UNPACK_SKIP_ROWS,S),Ce.pixelStorei(Ce.UNPACK_SKIP_IMAGES,w),0===r&&t.generateMipmaps&&Ce.generateMipmap(v),$.unbindTexture()},this.initRenderTarget=function(e){void 0===ie.get(e).__webglFramebuffer&&le.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?le.setTextureCube(e,0):e.isData3DTexture?le.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?le.setTexture2DArray(e,0):le.setTexture2D(e,0),$.unbindTexture()},this.resetState=function(){S=0,w=0,b=null,$.reset(),Pe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return wt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===at?"display-p3":"srgb",t.unpackColorSpace=qt.workingColorSpace===st?"display-p3":"srgb"}}({antialias:!Ng,alpha:!0,preserveDrawingBuffer:!0});Gg.setPixelRatio(window.devicePixelRatio),Gg.setSize(window.innerWidth,window.innerHeight),Vg.appendChild(Gg.domElement);const Wg=new class{constructor(e={}){const t=this;let n,i,r,a;const s={objects:new WeakMap},o=void 0!==e.element?e.element:document.createElement("div");function l(e){e.isCSS2DObject&&(e.element.style.display="none");for(let t=0,n=e.children.length;t=-1&&am.z<=1&&!0===e.layers.test(i.layers),c=e.element;c.style.display=!0===l?"":"none",!0===l&&(e.onBeforeRender(t,n,i),c.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(am.x*r+r)+"px,"+(-am.y*a+a)+"px)",c.parentNode!==o&&o.appendChild(c),e.onAfterRender(t,n,i));const u={distanceToCameraSquared:(h=i,d=e,lm.setFromMatrixPosition(h.matrixWorld),cm.setFromMatrixPosition(d.matrixWorld),lm.distanceToSquared(cm))};s.objects.set(e,u)}for(let t=0,r=e.children.length;t{const i=new Uint8Array(1048576);for(let e=0;e{this.skyEnvironment.changeVisibility(!1),this.backgroundEnvironment.hideBackground(),this.showEnvironment=!0},r=e.toLowerCase();if(r.endsWith(".exr"))this.environmentLoader.loadExr(e,t,!0),n();else if(r.endsWith(".hdr"))this.environmentLoader.loadHdr(e,t,!0),n();else if(r.endsWith(".envmap"))this.environmentLoader.loadEnvmap(e,t,!0),n();else if(r.endsWith(".glb")||r.endsWith(".gltf")){i(e,null);const n=yield this.loadGLTF(t);i(e,n)}}catch(e){console.log(e)}}))}createControls(){var e;null!==(e=this.controls)&&void 0!==e||(this.controls=new Np(this.renderer,this.camera))}changeLightControls(e){var t;e&&!this.transformControls&&(this.transformControls=null===(t=this.controls)||void 0===t?void 0:t.addTransformControl(this.lightSources.getLightSources()[0],this.scene)),this.transformControls&&(this.transformControls.visible=e)}setEnvironment(){this.environmentLoader.loadDefaultEnvironment(!0,(()=>new mm({type:pm})),"room environment"),this.environmentLoader.loadDefaultEnvironment(!1,(()=>new mm({type:fm})),"front light environment"),this.environmentLoader.loadEnvmap("test64.envmap",Mm,!1)}updateSceneDependencies(){this.sceneRenderer.bakedGroundContactShadowPass.needsUpdate=!0,this.updateBounds()}updateBounds(){this.sceneRenderer.updateBounds(this.sceneBounds,this.scaleShadowAndAo)}setGroundMaterial(e){this.groundMaterialType!==e&&(this.groundMaterialType=e,this.updateGround(void 0,Nh(this.groundMaterialType)),this.sceneRenderer.clearCache())}updateGround(e,t){this.groundMesh||(this.groundMesh=new mr,this.groundMesh.name="groundMesh",this.groundMesh.userData.isFloor=!0,this.groundMesh.receiveShadow=!0,this.sceneRenderer.groundGroup.add(this.groundMesh)),e&&(this.groundMesh.geometry=e),t&&(t.depthWrite=!1,t.polygonOffset=!0,t.polygonOffsetFactor=4,t.polygonOffsetUnits=4,t.needsUpdate=!0,this.groundMesh.material=t,this.groundMesh.userData.isFloor=!0)}update(e,t,n){t&&this.setNewTurntableGroup(t,null!=n&&n),e&&this.properties.rotate!==(null==e?void 0:e.rotate)&&(this.properties.rotate=null==e?void 0:e.rotate,0===this.properties.rotate&&(this.turnTableGroup.rotation.y=0)),e&&this.properties.dimensions!==(null==e?void 0:e.dimensions)&&(this.properties.dimensions=null==e?void 0:e.dimensions,this.updateDimensions()),e&&this.properties.randomOrientation!==(null==e?void 0:e.randomOrientation)&&(this.properties.randomOrientation=null==e?void 0:e.randomOrientation)}updateDimensions(){if(this.properties.dimensions){if(0===this.dimensioningArrows.length)for(let e=0;e<3;++e){const e=new hm(new dn,new dn,{color:0,arrowPixelWidth:10,arrowPixelHeight:15,shaftPixelWidth:3,shaftPixelOffset:1,labelClass:"label",deviceRatio:window.devicePixelRatio});this.dimensioningArrows.push(e),this.dimensioningArrowScene.add(e)}const e=this.sceneRenderer.boundingVolume.bounds,t=this.sceneRenderer.boundingVolume.size,n=.2*Math.min(t.x,t.y,t.z);this.dimensioningArrows[0].setPosition(new dn(e.min.x,e.min.y,e.max.z+n),new dn(e.max.x,e.min.y,e.max.z+n)),this.dimensioningArrows[1].setPosition(new dn(e.min.x-n,e.min.y,e.max.z+n),new dn(e.min.x-n,e.max.y,e.max.z+n)),this.dimensioningArrows[2].setPosition(new dn(e.min.x-n,e.min.y,e.max.z),new dn(e.min.x-n,e.min.y,e.min.z))}else this.dimensioningArrows.forEach((e=>e.setLabel("")))}collectMaterials(){const e=[];return this.scene.traverse((t=>{if(t instanceof mr&&t.name.length>0){const n=t.material;n&&e.push({materialId:t.name,material:n})}else if(t instanceof mr&&t.material.name.length>0){const n=t.material;if(n){const i=t.material.name;-1===e.findIndex((e=>e.materialId===i))&&e.push({materialId:i,material:n})}}})),e}updateMaterialProperties(e,t){this.properties.materialNoise!==e.materialNoise&&(this.properties.materialNoise=e.materialNoise,t.forEach((e=>{const t=e.material;t.userData&&"ormMap"in t.userData||(t.roughnessMap=this.properties.materialNoise?this.noiseTexture:null,t.metalnessMap=this.properties.materialNoise?this.noiseTexture:null,t.needsUpdate=!0)})))}resize(e,t){var n;this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.sceneRenderer.setSize(e,t),null===(n=this.css2Renderer)||void 0===n||n.setSize(e,t)}animate(e){this.properties.rotate>0&&(this.turnTableGroup.rotation.y+=2*Math.PI*e*.001*this.properties.rotate)}prepareRender(e){var t,n;const i=this.environmentLoader.setEnvironment(this.scene,{showEnvironment:this.showEnvironment,environmentRotation:this.environmentRotation,environmentIntensity:this.environmentIntensity});if(i){null===(t=this.groundProjectionSkybox)||void 0===t||t.removeFromParent(),this.groundProjectionSkybox=null;const e=null===(n=this.environmentLoader.currentEnvironment)||void 0===n?void 0:n.equirectangularTexture;this.scene.userData.shadowFromEnvironment=!0,e&&(this.lightSources.currentLightSourceDefinition=nh.noLightSources,this.lightSources.updateLightSources(),this.createGroundProjectionSkybox&&(this.groundProjectionSkybox=new bm(e,1.5,10),this.groundProjectionSkybox.scale.setScalar(this.groundProjectionSkyboxDistance),this.groundProjectionSkybox.name="skybox",this.scene.add(this.groundProjectionSkybox)))}const r=this.createGroundProjectionSkybox&&this.groundProjectionSkybox?2*this.groundProjectionSkyboxDistance:void 0;if(this.sceneRenderer.updateNearAndFarPlaneOfPerspectiveCamera(this.camera,r),i&&this.updateSceneDependencies(),this.sceneRenderer.outlineRenderer.parameters.enabled){this.raycaster.setFromCamera(e,this.camera);const t=this.raycaster.intersectObject(this.turnTableGroup,!0),n=t.length>0?t[0].object:void 0;this.sceneRenderer.selectObjects(n?[n]:[])}}render(e=!0){var t,n;e&&(null===(t=this.controls)||void 0===t||t.update()),this.backgroundEnvironment.update(this.sceneRenderer.width,this.sceneRenderer.height,this.camera),this.sceneRenderer.render(this.scene,this.camera),this.properties.dimensions&&(this.dimensioningArrows.forEach((e=>{e.arrowNeedsUpdate=!0})),this.renderer.autoClear=!1,this.renderer.render(this.dimensioningArrowScene,this.camera),null===(n=this.css2Renderer)||void 0===n||n.render(this.dimensioningArrowScene,this.camera),this.renderer.autoClear=!0)}loadGLTF(e){return Tm(this,void 0,void 0,(function*(){const t=new au;t.setDRACOLoader(this.dracoLoader);const n=yield t.loadAsync(e);return this.updateGLTFScene(n,(e=>{if(e.isMesh){const t=e.material;t instanceof Gl&&!1===t.transparent&&(e.castShadow=!0,e.receiveShadow=!0)}})),this.setNewTurntableGroup(n.scene,!0),n.scene}))}updateGLTFScene(e,t){e.scene.traverse((e=>{e instanceof mr&&(t(e),e.material instanceof Gl&&(e.material.envMapIntensity=1,e.material.needsUpdate=!0))}))}setNewTurntableGroup(e,t){this.turnTableGroup.clear(),this.scaleShadowAndAo=t,this.setInitialObjectPosition(e),this.setInitialCameraPositionAndRotation(),this.sceneRenderer.environmentLights||this.lightSources.setLightSourcesDistances(this.sceneRenderer.boundingVolume,t),this.sceneRenderer.forceShadowUpdates(!0),this.updateSceneDependencies()}setInitialObjectPosition(e){e.updateMatrixWorld(),this.sceneBounds.setFromObject(e);const t=this.sceneBounds.getSize(new dn),n=this.sceneBounds.getCenter(new dn);e.applyMatrix4((new Hn).makeTranslation(-n.x,-this.sceneBounds.min.y,-n.z)),this.sceneBounds.translate(new dn(-n.x,-this.sceneBounds.min.y-t.y/2,-n.z));const i=-t.y/2;this.turnTableGroup.position.y=i,this.turnTableGroup.add(e),this.turnTableGroup.updateMatrixWorld(),this.sceneRenderer.groundLevel=i}setInitialCameraPositionAndRotation(){const e=new dn(-1.5,.8,2.5).normalize();if(this.properties.randomOrientation){const t=4*Math.random()-2,n=.8*Math.random()+.4;e.set(t,n,2.5).normalize()}this.camera.position.copy(e),this.camera.lookAt(new dn(0,0,0)),this.camera.updateMatrixWorld();const t=(new fn).setFromObject(this.turnTableGroup).applyMatrix4(this.camera.matrixWorldInverse),n=this.camera.fov*Math.PI/180/2,i=this.camera.aspect,r=Math.max(-t.min.x/i,t.max.x/i,-t.min.y,t.max.y)/Math.tan(n)+t.max.z+1;this.camera.position.copy(e.multiplyScalar(r)),this.camera.lookAt(new dn(0,0,0)),this.camera.updateMatrixWorld()}constructLoadingGeometry(e){let t=[];if(1===e){const e=[];for(let t=0;t<=230;t+=15){const n=t*Math.PI/180;e.push({x:-Math.cos(n),y:Math.sin(n)+1})}e.push({x:0,y:0});for(let t=60;t>=-180;t-=15){const n=t*Math.PI/180;e.push({x:-Math.cos(n),y:Math.sin(n)-1})}const n=.6,i=2.5*n,r=new Pl(e.map((e=>new dn(e.x,e.y+2+i,0)))),a=new Hl(r,64,n,16,!1),s=new zl(n,32,16);s.translate(-1,3+i,0);const o=new zl(n,32,16);o.translate(1,1+i,0);const l=new zl(n,32,16),c=new Wl({color:14352384,side:2});t=[{geometry:a,material:c,materialId:"",environment:!1},{geometry:s,material:c,materialId:"",environment:!1},{geometry:o,material:c,materialId:"",environment:!1},{geometry:l,material:c,materialId:"",environment:!1}]}else{const e=(()=>{const e=new Gl({side:2});return Mh((t=>e.map=t),Ch,new Ci(.859,0,0)),e})();t=[{geometry:new vr,material:e,materialId:"",environment:!1}]}return(e=>{const t=new vo;return e.forEach((e=>{const n=new mr(e.geometry,e.material);e.transform&&n.applyMatrix4(e.transform),n.castShadow=!e.environment,n.receiveShadow=!0,t.add(n)})),t})(t)}}(Gg,Wg);Yg.dracoLoader.setDecoderPath("./draco/"),Yg.dracoLoader.setDecoderConfig({type:"js"}),Yg.sceneRenderer.setQualityLevel(em),Yg.createControls(),Yg.setEnvironment(),Yg.updateSceneDependencies(),Hg();const qg=new Ug,Zg=Object.assign({},...t.map((e=>({[e.name]:e.url})))),Kg=qg.add(Xg,"glb",Zg).onChange((e=>{if(""!==e){const n=t.findIndex((t=>t.url===e)),i=n>=0?t[n].name:e;kg(i,e)}}));qg.add(Xg,"randomOrientation").onChange((()=>Yg.update(Xg))),qg.add(Xg,"dimensions").onChange((()=>Yg.update(Xg))),qg.add(Xg,"groundMaterial",{shadow:"onlyshadow",parquet:"parquet",pavement:"pavement"}).onChange((()=>Hg()));const Jg=qg.addFolder("environment"),Qg=Jg.add(Yg,"showEnvironment").onChange((e=>{e&&(ev.hideSky(),nv.hideBackground())}));Jg.add(Yg,"environmentRotation",0,2*Math.PI,.01).onChange((e=>{var t;(null===(t=Yg.scene.userData)||void 0===t?void 0:t.environmentDefinition)&&(Yg.scene.userData.environmentDefinition.rotation=e)})),Jg.add(Yg,"environmentIntensity",0,5,.01).onChange((e=>{var t;(null===(t=Yg.scene.userData)||void 0===t?void 0:t.environmentDefinition)&&(Yg.scene.userData.environmentDefinition.intensity=e)}));const $g=Jg.addFolder("sky"),ev=new class{constructor(e){this.skyEnvironment=e}hideSky(){var e,t;null===(e=this.showSkyController)||void 0===e||e.setValue(!1),null===(t=this.showSkyController)||void 0===t||t.updateDisplay()}addGUI(e,t){this.showSkyController=e.add(this.skyEnvironment.parameters,"visible").onChange((()=>{this.skyEnvironment.updateSky(),t&&t(this.skyEnvironment)}))}}(Yg.skyEnvironment);ev.addGUI($g,(e=>{e.parameters.visible&&(Qg.setValue(!1),Qg.updateDisplay(),nv.hideBackground())}));const tv=Jg.addFolder("background"),nv=new class{constructor(e){this._backgroundEnvironment=e}hideBackground(){var e,t;null===(e=this._backgroundTypeController)||void 0===e||e.setValue("None"),null===(t=this._backgroundTypeController)||void 0===t||t.updateDisplay()}addGUI(e,t){const n={backgroundType:""},i=new Map([["None",Bd],["Grid Paper",zd],["Concrete",kd],["Marble",Hd],["Granite",Vd],["Vorocracks Marble",Gd],["Kraft",Wd],["Line (slow)",jd],["Test",Xd]]),r=[];i.forEach(((e,t)=>{r.push(t),this._backgroundEnvironment.parameters.backgroundType===e&&(n.backgroundType=t)})),e.add(n,"backgroundType",r).onChange((e=>{var n;i.has(e)&&(this._backgroundEnvironment.parameters.backgroundType=null!==(n=i.get(e))&&void 0!==n?n:Bd,this._backgroundEnvironment.updateBackground(),t&&t(this._backgroundEnvironment))}))}}(Yg.backgroundEnvironment);nv.addGUI(tv,(e=>{e.parameters.isSet&&(Qg.setValue(!1),Qg.updateDisplay(),ev.hideSky())})),Yg.environmentLoader.addGUI(Jg);const iv=new class{constructor(e){this._qualityLevel="",this._ambientOcclusionType="",this._sceneRenderer=e}addGUI(e,t){this._addRepresentationalGUI(e,t),this._addDebugGUI(e,t);const n=e.addFolder("Shadow type");this._addShadowTypeGUI(n,t);const i=e.addFolder("Shadow and Ambient Occlusion");this._addShadowAndAoGUI(i,t);const r=e.addFolder("Ground Reflection");this._addGroundReflectionGUI(r,t);const a=e.addFolder("Baked Ground Contact Shadow");this._addBakedGroundContactShadowGUI(a,t);const s=e.addFolder("Outline");this._addOutlineGUI(s,t)}_addRepresentationalGUI(e,t){const n=new Map([["LinearSRGBColorSpace",rt],["SRGBColorSpace",it]]),i=[];n.forEach(((e,t)=>{i.push(t),this._sceneRenderer.renderer.outputColorSpace===e&&(this._sceneRenderer.outputColorSpace=t)})),e.add(this._sceneRenderer,"outputColorSpace",i).onChange((e=>{var i;n.has(e)&&(this._sceneRenderer.renderer.outputColorSpace=null!==(i=n.get(e))&&void 0!==i?i:it,t())}));const r=new Map([["NoToneMapping",C],["LinearToneMapping",L],["ReinhardToneMapping",D],["CineonToneMapping",I],["ACESFilmicToneMapping",U]]),a=[];r.forEach(((e,t)=>{a.push(t),this._sceneRenderer.renderer.toneMapping===e&&(this._sceneRenderer.toneMapping=t)})),e.add(this._sceneRenderer,"toneMapping",a).onChange((e=>{var n;r.has(e)&&(this._sceneRenderer.renderer.toneMapping=null!==(n=r.get(e))&&void 0!==n?n:C,t())}))}_addDebugGUI(e,t){const n=new Map([["HIGHEST",em],["HIGH",tm],["MEDIUM",nm],["LOW","low"]]),i=[];n.forEach(((e,t)=>i.push(t))),e.add(this,"_qualityLevel",i).onChange((e=>{var t;n.has(e)&&this._sceneRenderer.setQualityLevel(null!==(t=n.get(e))&&void 0!==t?t:em)})),e.add(this._sceneRenderer,"debugOutput",{"off ":"off","grayscale (no textures)":"grayscale","color buffer":"color","linear depth":"lineardepth","g-buffer normal vector":"g-normal","g-buffer depth":"g-depth","AO pure":"ssao","AO denoised":"ssaodenoise","shadow map":"shadowmap","shadow soft":"shadowsoft","shadow denoised":"shadowdenoise","shadow fade in":"shadowfadein","shadow and AO":"shadowandao","shadow and AO depth":"shadowandaodepth","material AO pass":"materialao","ground reflection base":"groundreflection","ground reflection final":"groundreflectionfinal","baked ground shadow":"bakedgroundshadow","selection outline":"outline","environment map":"environmentmap","light source detection":"lightsourcedetection"}).onChange((()=>t()))}_addShadowTypeGUI(e,t){const n=this._sceneRenderer.screenSpaceShadowMapPass.shadowConfiguration,i=[];n.types.forEach(((e,t)=>{i.push(t)}));const r=()=>{this._sceneRenderer.screenSpaceShadowMapPass.needsUpdate=!0,this._sceneRenderer.screenSpaceShadowMapPass.shadowTypeNeedsUpdate=!0,this._sceneRenderer.shadowAndAoPass.needsUpdate=!0,t()};e.add(n,"shadowType",i).onChange((e=>{this._sceneRenderer.screenSpaceShadowMapPass.switchType(e)&&(a.object=n.currentConfiguration,s.object=n.currentConfiguration,o.object=n.currentConfiguration,a.updateDisplay(),s.updateDisplay(),o.updateDisplay(),r())}));const a=e.add(n.currentConfiguration,"bias",-.001,.001,1e-5).onChange((()=>r())),s=e.add(n.currentConfiguration,"normalBias",-.05,.05).onChange((()=>r())),o=e.add(n.currentConfiguration,"radius",0,100).onChange((()=>r()))}_addShadowAndAoGUI(e,t){const n=()=>{this._sceneRenderer.requestUpdateOfPasses(),t()},i=this._sceneRenderer.shadowAndAoPass.parameters,r=i.shadow,a=this._sceneRenderer.screenSpaceShadowMapPass.parameters,s=i.ao,o=i.poissonDenoise;e.add(i,"enabled").onChange((()=>n())),e.add(i,"applyToMaterial").onChange((()=>{n(),this._sceneRenderer.clearCache()}));const l=new Map([["none",null],["SSAO",0],["SAO",1],["N8AO",2],["HBAO",3],["GTAO",4]]),c=Array.from(l.keys());l.forEach(((e,t)=>{e===s.algorithm&&(this._ambientOcclusionType=t)})),e.add(i,"aoIntensity",0,1).onChange((()=>{n()})),e.add(i,"aoOnGround").onChange((()=>{n(),this._sceneRenderer.clearCache()})),e.add(i,"shadowOnGround").onChange((()=>{n(),this._sceneRenderer.clearCache()})),e.add(i,"shadowIntensity",0,1).onChange((()=>n())),e.add(i,"alwaysUpdate").onChange((()=>n())),e.add(i,"progressiveDenoiseIterations",0,3,1).onChange((()=>n()));const h=e.addFolder("Environment Shadow");h.add(a,"maximumNumberOfLightSources",-1,10,1).onChange((()=>n())),h.add(a,"enableGroundBoundary").onChange((()=>n())),h.add(a,"directionalDependency",0,1,.01).onChange((()=>n())),h.add(a,"directionalExponent",0,2,.01).onChange((()=>n())),h.add(a,"groundBoundary",0,1,.01).onChange((()=>n())),h.add(a,"fadeOutDistance",0,5,.01).onChange((()=>n())),h.add(a,"fadeOutBlur",0,20,1).onChange((()=>n())),h.add(r,"shadowRadius",.001,.5).onChange((()=>n()));const d=e.addFolder("AO");d.add(this,"_ambientOcclusionType",c).onChange((e=>{if(l.has(e)){const t=l.get(e);s.algorithm=void 0!==t?t:0,n()}})),d.add(s,"samples",1,64,1).onChange((()=>n())),d.add(s,"radius",.01,2,.01).onChange((()=>n())),d.add(s,"distanceExponent",.1,4,.1).onChange((()=>n())),d.add(s,"thickness",.01,2,.01).onChange((()=>n())),d.add(s,"distanceFallOff",0,1).onChange((()=>n())),d.add(s,"scale",.01,2,.01).onChange((()=>n())),d.add(s,"bias",1e-4,.01,1e-4).onChange((()=>n())),d.add(s,"screenSpaceRadius").onChange((()=>n()));const u=e.addFolder("Possion Denoise");u.add(o,"iterations",0,4,1).onChange((()=>n())),u.add(o,"samples",0,32,1).onChange((()=>n())),u.add(o,"rings",0,16,.125).onChange((()=>n())),u.add(o,"radiusExponent",.1,4,.01).onChange((()=>n())),u.add(o,"radius",0,50,1).onChange((()=>n())),u.add(o,"depthPhi",0,20,.001).onChange((()=>n())),u.add(o,"normalPhi",0,20,.001).onChange((()=>n()))}_addGroundReflectionGUI(e,t){const n=this._sceneRenderer.parameters.groundReflectionParameters;e.add(n,"enabled"),e.add(n,"intensity",0,1).onChange((()=>t())),e.add(n,"fadeOutDistance",0,4).onChange((()=>t())),e.add(n,"fadeOutExponent",.1,10).onChange((()=>t())),e.add(n,"brightness",0,2).onChange((()=>t())),e.add(n,"blurHorizontal",0,10).onChange((()=>t())),e.add(n,"blurVertical",0,10).onChange((()=>t()))}_addBakedGroundContactShadowGUI(e,t){const n=()=>{this._sceneRenderer.bakedGroundContactShadowPass.applyParameters(),t()},i=this._sceneRenderer.parameters.bakedGroundContactShadowParameters;e.add(i,"enabled").onChange((()=>n())),e.add(i,"cameraHelper").onChange((()=>n())),e.add(i,"alwaysUpdate"),e.add(i,"fadeIn"),e.add(i,"blurMin",0,.2,.001).onChange((()=>n())),e.add(i,"blurMax",0,.5,.01).onChange((()=>n())),e.add(i,"fadeoutFalloff",0,1,.01).onChange((()=>n())),e.add(i,"fadeoutBias",0,.5).onChange((()=>n())),e.add(i,"opacity",0,1,.01).onChange((()=>n())),e.add(i,"maximumPlaneSize",0,50,1).onChange((()=>n())),e.add(i,"cameraFar",.1,10,.1).onChange((()=>n()))}_addOutlineGUI(e,t){const n=()=>{this._sceneRenderer.outlineRenderer.applyParameters(),t()},i=this._sceneRenderer.outlineRenderer.parameters;e.add(i,"enabled"),e.add(i,"edgeStrength",.5,20).onChange((()=>n())),e.add(i,"edgeGlow",0,20).onChange((()=>n())),e.add(i,"edgeThickness",.5,20).onChange((()=>n())),e.add(i,"pulsePeriod",0,5).onChange((()=>n())),e.addColor(i,"visibleEdgeColor").onChange((()=>n())),e.addColor(i,"hiddenEdgeColor").onChange((()=>n()))}}(Yg.sceneRenderer);iv.addGUI(qg,(()=>{}));const rv=new Em,av=qg.addFolder("Light"),sv=new class{constructor(e){this.lightColors=[],this.lightSourceFolders=[],this.lights="none",this.lightSources=e}addGUI(e,t,n){e.add(this.lightSources,"lightControls").onChange(t),e.add(this,"lights",["none","default","fife"]).onChange((e=>{switch(e){default:case"none":this.lightSources.currentLightSourceDefinition=nh.noLightSources;break;case"default":this.lightSources.currentLightSourceDefinition=nh.defaultLightSources;break;case"fife":this.lightSources.currentLightSourceDefinition=nh.fifeLightSources}this.lightSources.updateLightSources(),this.updateGUI(),n()})),this.lightGUI=e,this.updateGUI()}updateGUI(){if(!this.lightGUI)return;const e=this.lightGUI;this.lightSourceFolders.forEach((t=>e.removeFolder(t))),this.lightSourceFolders=[],this.lightColors=[],this.lightSources.getLightSources().forEach((t=>{if(t instanceof Nc){this.lightColors.push({color:t.color.getHex()});const n=e.addFolder("Ambient Light");this.lightSourceFolders.push(n),n.add(t,"visible"),n.add(t,"intensity").min(0).max(5).step(.1),n.addColor(this.lightColors[this.lightColors.length-1],"color").onChange((e=>t.color=new Ci(e)))}})),this.lightSources.getLightSources().forEach((t=>{var n;if(t instanceof Oc){this.lightColors.push({color:t.color.getHex()});const n=e.addFolder("Directional Light "+(this.lightColors.length-1));this.lightSourceFolders.push(n),n.add(t,"visible"),n.add(t,"intensity").min(0).max(10).step(.1),n.add(t,"castShadow"),n.addColor(this.lightColors[this.lightColors.length-1],"color").onChange((e=>t.color=new Ci(e)))}else if(t instanceof Fc){this.lightColors.push({color:t.color.getHex()});const i=e.addFolder("Rect area Light "+(this.lightColors.length-1));this.lightSourceFolders.push(i);const r=null===(n=this.lightSources.sceneRenderer)||void 0===n?void 0:n.screenSpaceShadowMapPass.findShadowLightSource(t);i.add(t,"visible"),i.add(t,"intensity").min(0).max(200).step(1),r&&i.add(r,"castShadow"),i.addColor(this.lightColors[this.lightColors.length-1],"color").onChange((e=>t.color=new Ci(e)))}}))}}(Yg.getLightSources());sv.addGUI(av,(()=>e=>Yg.changeLightControls(e)),(()=>Yg.updateSceneDependencies())),window.addEventListener("resize",(()=>{const e=window.innerWidth,t=window.innerHeight;Yg.resize(e,t)}),!1);const ov=new Nt;Gg.domElement.addEventListener("pointermove",(e=>{!1!==e.isPrimary&&(ov.x=e.clientX/window.innerWidth*2-1,ov.y=-e.clientY/window.innerHeight*2+1)})),((e,t,n)=>{const i=document.getElementById("holder");i&&(i.ondragover=function(){return this.className="hover",!1},i.ondragend=function(){return this.className="",!1},i.ondrop=function(e){this.className="",e.preventDefault();const t=e.dataTransfer.files[0],n=new FileReader;n.onload=e=>((e,t)=>{((e,t)=>{const n=Fg[e];n?(Bg(`render ${e}`,"#ff0000"),Yg.update(void 0,n.scene,n.glb),zg(e)):Yg.loadResource(e,t,(e=>{}),((t,n)=>{n?(Fg[e]={scene:n,glb:!0},zg(t),(e=>{Zg.push(e);let t="";Zg.forEach((e=>{t+=``})),Kg.domElement.children[0].innerHTML=t,Kg.setValue(e),Kg.updateDisplay()})(e)):Bg(`load ${t}`,"#ff0000")}))})(e.name,t.target.result)})(t,e),n.readAsDataURL(t)})})();const lv=document.createElement("a"),cv=e=>{const t=Gg.domElement.toDataURL();lv.href=t,lv.download=e,lv.click()},hv=(e,t)=>{const n=Yg.sceneRenderer.debugOutput;Yg.sceneRenderer.debugOutput=e,Yg.prepareRender(new Nt),Yg.render(!1),cv(t),Yg.sceneRenderer.debugOutput=n},dv=document.getElementById("save-button");dv&&(dv.onclick=()=>(()=>{try{cv(Xg.sceneName+".png")}catch(e){console.log(e)}})());const uv=document.getElementById("save-g-buffer-button");let pv,fv;uv&&(uv.onclick=()=>(()=>{try{hv("color",Xg.sceneName+"_color.png"),hv("g-normal",Xg.sceneName+"_normal.png"),hv("g-depth",Xg.sceneName+"_depth.png")}catch(e){console.log(e)}})());const mv=e=>{void 0===pv&&(pv=e),void 0===fv&&(fv=e);const t=e-fv;fv=e,Yg.animate(t),gv(),requestAnimationFrame(mv)},gv=()=>{Yg.prepareRender(ov),Yg.render(),jg.update()};(e=>{const n=t.findIndex((e=>"BrainStem"===e.name));if(n>=0){const e=t[n];kg(e.name,e.url)}})(),requestAnimationFrame(mv)})(); \ No newline at end of file +(()=>{"use strict";var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),(()=>{var t;e.g.importScripts&&(t=e.g.location+"");var n=e.g.document;if(!t&&n&&(n.currentScript&&"SCRIPT"===n.currentScript.tagName.toUpperCase()&&(t=n.currentScript.src),!t)){var i=n.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=i[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=t})();const t=[{name:"BrainStem",url:"./BrainStem.glb"},{name:"DamagedHelmet",url:"./DamagedHelmet.glb"}],n="167",i=1,r=2,a=3,s=0,o=1,l=2,c=100,h=101,d=102,u=200,p=201,f=202,m=203,g=204,v=205,_=206,x=207,y=208,S=209,w=210,b=211,M=212,T=213,E=214,A=0,P=1,R=2,C=0,L=1,D=2,I=3,U=4,O=5,N=6,F=7,B="attached",z=301,k=302,H=306,V=1e3,G=1001,W=1002,j=1003,X=1004,Y=1005,q=1006,Z=1007,K=1008,J=1009,Q=1010,$=1011,ee=1012,te=1013,ne=1014,ie=1015,re=1016,ae=1017,se=1018,oe=1020,le=35902,ce=1021,he=1022,de=1023,ue=1024,pe=1025,fe=1026,me=1027,ge=1028,ve=1029,_e=1030,xe=1031,ye=1033,Se=33776,we=33777,be=33778,Me=33779,Te=35840,Ee=35841,Ae=35842,Pe=35843,Re=36196,Ce=37492,Le=37496,De=37808,Ie=37809,Ue=37810,Oe=37811,Ne=37812,Fe=37813,Be=37814,ze=37815,ke=37816,He=37817,Ve=37818,Ge=37819,We=37820,je=37821,Xe=36492,Ye=36494,qe=36495,Ze=36283,Ke=36284,Je=36285,Qe=36286,$e=2300,et=2301,tt=2302,nt="",it="srgb",rt="srgb-linear",at="display-p3",st="display-p3-linear",ot="linear",lt="srgb",ct="rec709",ht="p3",dt=7680,ut=512,pt=513,ft=514,mt=515,gt=516,vt=517,_t=518,xt=519,yt=35044,St="300 es",wt=2e3,bt=2001;class Mt{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>8&255]+Tt[e>>16&255]+Tt[e>>24&255]+"-"+Tt[255&t]+Tt[t>>8&255]+"-"+Tt[t>>16&15|64]+Tt[t>>24&255]+"-"+Tt[63&n|128]+Tt[n>>8&255]+"-"+Tt[n>>16&255]+Tt[n>>24&255]+Tt[255&i]+Tt[i>>8&255]+Tt[i>>16&255]+Tt[i>>24&255]).toLowerCase()}function Rt(e,t,n){return Math.max(t,Math.min(n,e))}function Ct(e,t){return(e%t+t)%t}function Lt(e,t,n){return(1-n)*e+n*t}function Dt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function It(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const Ut=Et,Ot=function(e){return e*At};class Nt{constructor(e=0,t=0){Nt.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 new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){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}sub(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){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Rt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ft{constructor(e,t,n,i,r,a,s,o,l){Ft.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=s,c[3]=t,c[4]=r,c[5]=o,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],c=n[4],h=n[7],d=n[2],u=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],x=i[7],y=i[2],S=i[5],w=i[8];return r[0]=a*f+s*v+o*y,r[3]=a*m+s*_+o*S,r[6]=a*g+s*x+o*w,r[1]=l*f+c*v+h*y,r[4]=l*m+c*_+h*S,r[7]=l*g+c*x+h*w,r[2]=d*f+u*v+p*y,r[5]=d*m+u*_+p*S,r[8]=d*g+u*x+p*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8];return t*a*c-t*s*l-n*r*c+n*s*o+i*r*l-i*a*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=c*a-s*l,d=s*o-c*r,u=l*r-a*o,p=t*h+n*d+i*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=h*f,e[1]=(i*l-c*n)*f,e[2]=(s*n-i*a)*f,e[3]=d*f,e[4]=(c*t-i*o)*f,e[5]=(i*r-s*t)*f,e[6]=u*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*r)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(Bt.makeScale(e,t)),this}rotate(e){return this.premultiply(Bt.makeRotation(-e)),this}translate(e,t){return this.premultiply(Bt.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const Bt=new Ft;function zt(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function kt(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Ht(){const e=kt("canvas");return e.style.display="block",e}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;const Vt={};function Gt(e){e in Vt||(Vt[e]=!0,console.warn(e))}const Wt=(new Ft).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),jt=(new Ft).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Xt={[rt]:{transfer:ot,primaries:ct,luminanceCoefficients:[.2126,.7152,.0722],toReference:e=>e,fromReference:e=>e},[it]:{transfer:lt,primaries:ct,luminanceCoefficients:[.2126,.7152,.0722],toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[st]:{transfer:ot,primaries:ht,luminanceCoefficients:[.2289,.6917,.0793],toReference:e=>e.applyMatrix3(jt),fromReference:e=>e.applyMatrix3(Wt)},[at]:{transfer:lt,primaries:ht,luminanceCoefficients:[.2289,.6917,.0793],toReference:e=>e.convertSRGBToLinear().applyMatrix3(jt),fromReference:e=>e.applyMatrix3(Wt).convertLinearToSRGB()}},Yt=new Set([rt,st]),qt={enabled:!0,_workingColorSpace:rt,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!Yt.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;const i=Xt[t].toReference;return(0,Xt[n].fromReference)(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return Xt[e].primaries},getTransfer:function(e){return e===nt?ot:Xt[e].transfer},getLuminanceCoefficients:function(e,t=this._workingColorSpace){return e.fromArray(Xt[t].luminanceCoefficients)}};function Zt(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Kt(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let Jt;class Qt{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Jt&&(Jt=kt("canvas")),Jt.width=e.width,Jt.height=e.height;const n=Jt.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Jt}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){const t=kt("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}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 V:e.x=e.x-Math.floor(e.x);break;case G:e.x=e.x<0?0:1;break;case W: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 V:e.y=e.y-Math.floor(e.y);break;case G:e.y=e.y<0?0:1;break;case W: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)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}rn.DEFAULT_IMAGE=null,rn.DEFAULT_MAPPING=300,rn.DEFAULT_ANISOTROPY=1;class an{constructor(e=0,t=0,n=0,i=1){an.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){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}sub(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){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const a=.01,s=.1,o=e.elements,l=o[0],c=o[4],h=o[8],d=o[1],u=o[5],p=o[9],f=o[2],m=o[6],g=o[10];if(Math.abs(c-d)o&&e>v?ev?o=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,t*n);e=Math.sin(e*a)/r,s=Math.sin(s*a)/r}const r=s*n;if(o=o*e+d*r,l=l*e+u*r,c=c*e+p*r,h=h*e+f*r,e===1-s){const e=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=e,l*=e,c*=e,h*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[a],d=r[a+1],u=r[a+2],p=r[a+3];return e[t]=s*p+c*h+o*u-l*d,e[t+1]=o*p+c*d+l*h-s*u,e[t+2]=l*p+c*u+s*d-o*h,e[t+3]=c*p-s*h-o*d-l*u,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),c=s(i/2),h=s(r/2),d=o(n/2),u=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],c=t[6],h=t[10],d=n+s+h;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(c-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>h){const e=2*Math.sqrt(1+n-s-h);this._w=(c-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>h){const e=2*Math.sqrt(1+s-n-h);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+c)/e}else{const e=2*Math.sqrt(1+h-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Rt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,c=t._w;return this._x=n*c+a*s+i*l-r*o,this._y=i*c+a*o+r*s-n*l,this._z=r*c+a*l+n*o-i*s,this._w=a*c-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let s=a*e._w+n*e._x+i*e._y+r*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=n,this._y=i,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(o),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}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._onChangeCallback(),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}}class dn{constructor(e=0,t=0,n=0){dn.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){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(pn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(pn.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*n),c=2*(s*t-r*i),h=2*(r*n-a*t);return this.x=t+o*l+a*h-s*c,this.y=n+o*c+s*l-r*h,this.z=i+o*h+r*c-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return un.copy(this).projectOnVector(e),this.sub(un)}reflect(e){return this.sub(un.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Rt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const un=new dn,pn=new hn;class fn{constructor(e=new dn(1/0,1/0,1/0),t=new dn(-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,n=e.length;t=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,gn),gn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mn),Tn.subVectors(this.max,Mn),_n.subVectors(e.a,Mn),xn.subVectors(e.b,Mn),yn.subVectors(e.c,Mn),Sn.subVectors(xn,_n),wn.subVectors(yn,xn),bn.subVectors(_n,yn);let t=[0,-Sn.z,Sn.y,0,-wn.z,wn.y,0,-bn.z,bn.y,Sn.z,0,-Sn.x,wn.z,0,-wn.x,bn.z,0,-bn.x,-Sn.y,Sn.x,0,-wn.y,wn.x,0,-bn.y,bn.x,0];return!!Pn(t,_n,xn,yn,Tn)&&(t=[1,0,0,0,1,0,0,0,1],!!Pn(t,_n,xn,yn,Tn)&&(En.crossVectors(Sn,wn),t=[En.x,En.y,En.z],Pn(t,_n,xn,yn,Tn)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,gn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(gn).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()||(mn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mn)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const mn=[new dn,new dn,new dn,new dn,new dn,new dn,new dn,new dn],gn=new dn,vn=new fn,_n=new dn,xn=new dn,yn=new dn,Sn=new dn,wn=new dn,bn=new dn,Mn=new dn,Tn=new dn,En=new dn,An=new dn;function Pn(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){An.fromArray(e,a);const s=r.x*Math.abs(An.x)+r.y*Math.abs(An.y)+r.z*Math.abs(An.z),o=t.dot(An),l=n.dot(An),c=i.dot(An);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const Rn=new fn,Cn=new dn,Ln=new dn;class Dn{constructor(e=new dn,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Rn.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Cn.subVectors(e,this.center);const t=Cn.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Cn,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Ln.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Cn.copy(e.center).add(Ln)),this.expandByPoint(Cn.copy(e.center).sub(Ln))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const In=new dn,Un=new dn,On=new dn,Nn=new dn,Fn=new dn,Bn=new dn,zn=new dn;class kn{constructor(e=new dn,t=new dn(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,In)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=In.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(In.copy(this.origin).addScaledVector(this.direction,t),In.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Un.copy(e).add(t).multiplyScalar(.5),On.copy(t).sub(e).normalize(),Nn.copy(this.origin).sub(Un);const r=.5*e.distanceTo(t),a=-this.direction.dot(On),s=Nn.dot(this.direction),o=-Nn.dot(On),l=Nn.lengthSq(),c=Math.abs(1-a*a);let h,d,u,p;if(c>0)if(h=a*o-s,d=a*s-o,p=r*c,h>=0)if(d>=-p)if(d<=p){const e=1/c;h*=e,d*=e,u=h*(h+a*d+2*s)+d*(a*h+d+2*o)+l}else d=r,h=Math.max(0,-(a*d+s)),u=-h*h+d*(d+2*o)+l;else d=-r,h=Math.max(0,-(a*d+s)),u=-h*h+d*(d+2*o)+l;else d<=-p?(h=Math.max(0,-(-a*r+s)),d=h>0?-r:Math.min(Math.max(-r,-o),r),u=-h*h+d*(d+2*o)+l):d<=p?(h=0,d=Math.min(Math.max(-r,-o),r),u=d*(d+2*o)+l):(h=Math.max(0,-(a*r+s)),d=h>0?r:Math.min(Math.max(-r,-o),r),u=-h*h+d*(d+2*o)+l);else d=a>0?-r:r,h=Math.max(0,-(a*d+s)),u=-h*h+d*(d+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Un).addScaledVector(On,d),u}intersectSphere(e,t){In.subVectors(e.center,this.origin);const n=In.dot(this.direction),i=In.dot(In)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+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){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,s,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),c>=0?(r=(e.min.y-d.y)*c,a=(e.max.y-d.y)*c):(r=(e.max.y-d.y)*c,a=(e.min.y-d.y)*c),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a=0?(s=(e.min.z-d.z)*h,o=(e.max.z-d.z)*h):(s=(e.max.z-d.z)*h,o=(e.min.z-d.z)*h),n>o||s>i?null:((s>n||n!=n)&&(n=s),(o=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,In)}intersectTriangle(e,t,n,i,r){Fn.subVectors(t,e),Bn.subVectors(n,e),zn.crossVectors(Fn,Bn);let a,s=this.direction.dot(zn);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}Nn.subVectors(this.origin,e);const o=a*this.direction.dot(Bn.crossVectors(Nn,Bn));if(o<0)return null;const l=a*this.direction.dot(Fn.cross(Nn));if(l<0)return null;if(o+l>s)return null;const c=-a*Nn.dot(zn);return c<0?null:this.at(c/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Hn{constructor(e,t,n,i,r,a,s,o,l,c,h,d,u,p,f,m){Hn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l,c,h,d,u,p,f,m)}set(e,t,n,i,r,a,s,o,l,c,h,d,u,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=d,g[3]=u,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 Hn).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Vn.setFromMatrixColumn(e,0).length(),r=1/Vn.setFromMatrixColumn(e,1).length(),a=1/Vn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=a*c,n=a*h,i=s*c,r=s*h;t[0]=o*c,t[4]=-o*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}else if("YXZ"===e.order){const e=o*c,n=o*h,i=l*c,r=l*h;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){const e=o*c,n=o*h,i=l*c,r=l*h;t[0]=e-r*s,t[4]=-a*h,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*c,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){const e=a*c,n=a*h,i=s*c,r=s*h;t[0]=o*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=a*c,t[9]=-s*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=a*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=s*c,t[10]=r*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(Wn,e,jn)}lookAt(e,t,n){const i=this.elements;return qn.subVectors(e,t),0===qn.lengthSq()&&(qn.z=1),qn.normalize(),Xn.crossVectors(n,qn),0===Xn.lengthSq()&&(1===Math.abs(n.z)?qn.x+=1e-4:qn.z+=1e-4,qn.normalize(),Xn.crossVectors(n,qn)),Xn.normalize(),Yn.crossVectors(qn,Xn),i[0]=Xn.x,i[4]=Yn.x,i[8]=qn.x,i[1]=Xn.y,i[5]=Yn.y,i[9]=qn.y,i[2]=Xn.z,i[6]=Yn.z,i[10]=qn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],c=n[1],h=n[5],d=n[9],u=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],_=n[7],x=n[11],y=n[15],S=i[0],w=i[4],b=i[8],M=i[12],T=i[1],E=i[5],A=i[9],P=i[13],R=i[2],C=i[6],L=i[10],D=i[14],I=i[3],U=i[7],O=i[11],N=i[15];return r[0]=a*S+s*T+o*R+l*I,r[4]=a*w+s*E+o*C+l*U,r[8]=a*b+s*A+o*L+l*O,r[12]=a*M+s*P+o*D+l*N,r[1]=c*S+h*T+d*R+u*I,r[5]=c*w+h*E+d*C+u*U,r[9]=c*b+h*A+d*L+u*O,r[13]=c*M+h*P+d*D+u*N,r[2]=p*S+f*T+m*R+g*I,r[6]=p*w+f*E+m*C+g*U,r[10]=p*b+f*A+m*L+g*O,r[14]=p*M+f*P+m*D+g*N,r[3]=v*S+_*T+x*R+y*I,r[7]=v*w+_*E+x*C+y*U,r[11]=v*b+_*A+x*L+y*O,r[15]=v*M+_*P+x*D+y*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],c=e[2],h=e[6],d=e[10],u=e[14];return e[3]*(+r*o*h-i*l*h-r*s*d+n*l*d+i*s*u-n*o*u)+e[7]*(+t*o*u-t*l*d+r*a*d-i*a*u+i*l*c-r*o*c)+e[11]*(+t*l*h-t*s*u-r*a*h+n*a*u+r*s*c-n*l*c)+e[15]*(-i*s*c-t*o*h+t*s*d+i*a*h-n*a*d+n*o*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=e[9],d=e[10],u=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=h*m*l-f*d*l+f*o*u-s*m*u-h*o*g+s*d*g,_=p*d*l-c*m*l-p*o*u+a*m*u+c*o*g-a*d*g,x=c*f*l-p*h*l+p*s*u-a*f*u-c*s*g+a*h*g,y=p*h*o-c*f*o-p*s*d+a*f*d+c*s*m-a*h*m,S=t*v+n*_+i*x+r*y;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/S;return e[0]=v*w,e[1]=(f*d*r-h*m*r-f*i*u+n*m*u+h*i*g-n*d*g)*w,e[2]=(s*m*r-f*o*r+f*i*l-n*m*l-s*i*g+n*o*g)*w,e[3]=(h*o*r-s*d*r-h*i*l+n*d*l+s*i*u-n*o*u)*w,e[4]=_*w,e[5]=(c*m*r-p*d*r+p*i*u-t*m*u-c*i*g+t*d*g)*w,e[6]=(p*o*r-a*m*r-p*i*l+t*m*l+a*i*g-t*o*g)*w,e[7]=(a*d*r-c*o*r+c*i*l-t*d*l-a*i*u+t*o*u)*w,e[8]=x*w,e[9]=(p*h*r-c*f*r-p*n*u+t*f*u+c*n*g-t*h*g)*w,e[10]=(a*f*r-p*s*r+p*n*l-t*f*l-a*n*g+t*s*g)*w,e[11]=(c*s*r-a*h*r-c*n*l+t*h*l+a*n*u-t*s*u)*w,e[12]=y*w,e[13]=(c*f*i-p*h*i+p*n*d-t*f*d-c*n*m+t*h*m)*w,e[14]=(p*s*i-a*f*i-p*n*o+t*f*o+a*n*m-t*s*m)*w,e[15]=(a*h*i-c*s*i+c*n*o-t*h*o-a*n*d+t*s*d)*w,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,c=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,c*s+n,c*o-i*a,0,l*o-i*s,c*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,c=a+a,h=s+s,d=r*l,u=r*c,p=r*h,f=a*c,m=a*h,g=s*h,v=o*l,_=o*c,x=o*h,y=n.x,S=n.y,w=n.z;return i[0]=(1-(f+g))*y,i[1]=(u+x)*y,i[2]=(p-_)*y,i[3]=0,i[4]=(u-x)*S,i[5]=(1-(d+g))*S,i[6]=(m+v)*S,i[7]=0,i[8]=(p+_)*w,i[9]=(m-v)*w,i[10]=(1-(d+f))*w,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Vn.set(i[0],i[1],i[2]).length();const a=Vn.set(i[4],i[5],i[6]).length(),s=Vn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Gn.copy(this);const o=1/r,l=1/a,c=1/s;return Gn.elements[0]*=o,Gn.elements[1]*=o,Gn.elements[2]*=o,Gn.elements[4]*=l,Gn.elements[5]*=l,Gn.elements[6]*=l,Gn.elements[8]*=c,Gn.elements[9]*=c,Gn.elements[10]*=c,t.setFromRotationMatrix(Gn),n.x=r,n.y=a,n.z=s,this}makePerspective(e,t,n,i,r,a,s=2e3){const o=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let u,p;if(s===wt)u=-(a+r)/(a-r),p=-2*a*r/(a-r);else{if(s!==bt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);u=-a/(a-r),p=-a*r/(a-r)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=d,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,a,s=2e3){const o=this.elements,l=1/(t-e),c=1/(n-i),h=1/(a-r),d=(t+e)*l,u=(n+i)*c;let p,f;if(s===wt)p=(a+r)*h,f=-2*h;else{if(s!==bt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);p=r*h,f=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-d,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Vn=new dn,Gn=new Hn,Wn=new dn(0,0,0),jn=new dn(1,1,1),Xn=new dn,Yn=new dn,qn=new dn,Zn=new Hn,Kn=new hn;class Jn{constructor(e=0,t=0,n=0,i=Jn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],c=i[9],h=i[2],d=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(Rt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Rt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Rt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Rt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Rt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,u));break;case"XZY":this._z=Math.asin(-Rt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Zn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Zn,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Kn.setFromEuler(this),this.setFromQuaternion(Kn,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}}Jn.DEFAULT_ORDER="XYZ";class Qn{constructor(){this.mask=1}set(e){this.mask=1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function a(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){mi.subVectors(i,t),gi.subVectors(n,t),vi.subVectors(e,t);const a=mi.dot(mi),s=mi.dot(gi),o=mi.dot(vi),l=gi.dot(gi),c=gi.dot(vi),h=a*l-s*s;if(0===h)return r.set(0,0,0),null;const d=1/h,u=(l*o-s*c)*d,p=(a*c-s*o)*d;return r.set(1-u-p,p,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,_i)&&_i.x>=0&&_i.y>=0&&_i.x+_i.y<=1}static getInterpolation(e,t,n,i,r,a,s,o){return null===this.getBarycoord(e,t,n,i,_i)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,_i.x),o.addScaledVector(a,_i.y),o.addScaledVector(s,_i.z),o)}static isFrontFacing(e,t,n,i){return mi.subVectors(n,t),gi.subVectors(e,t),mi.cross(gi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return mi.subVectors(this.c,this.b),gi.subVectors(this.a,this.b),.5*mi.cross(gi).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ti.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ti.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Ti.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Ti.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ti.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,s;xi.subVectors(i,n),yi.subVectors(r,n),wi.subVectors(e,n);const o=xi.dot(wi),l=yi.dot(wi);if(o<=0&&l<=0)return t.copy(n);bi.subVectors(e,i);const c=xi.dot(bi),h=yi.dot(bi);if(c>=0&&h<=c)return t.copy(i);const d=o*h-c*l;if(d<=0&&o>=0&&c<=0)return a=o/(o-c),t.copy(n).addScaledVector(xi,a);Mi.subVectors(e,r);const u=xi.dot(Mi),p=yi.dot(Mi);if(p>=0&&u<=p)return t.copy(r);const f=u*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),t.copy(n).addScaledVector(yi,s);const m=c*p-u*h;if(m<=0&&h-c>=0&&u-p>=0)return Si.subVectors(r,i),s=(h-c)/(h-c+(u-p)),t.copy(i).addScaledVector(Si,s);const g=1/(m+f+d);return a=f*g,s=d*g,t.copy(n).addScaledVector(xi,a).addScaledVector(yi,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Ei={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},Ai={h:0,s:0,l:0},Pi={h:0,s:0,l:0};function Ri(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class Ci{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=it){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,qt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=qt.workingColorSpace){return this.r=e,this.g=t,this.b=n,qt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=qt.workingColorSpace){if(e=Ct(e,1),t=Rt(t,0,1),n=Rt(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Ri(r,i,e+1/3),this.g=Ri(r,i,e),this.b=Ri(r,i,e-1/3)}return qt.toWorkingColorSpace(this,i),this}setStyle(e,t=it){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)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=it){const n=Ei[e.toLowerCase()];return void 0!==n?this.setHex(n,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=Zt(e.r),this.g=Zt(e.g),this.b=Zt(e.b),this}copyLinearToSRGB(e){return this.r=Kt(e.r),this.g=Kt(e.g),this.b=Kt(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=it){return qt.fromWorkingColorSpace(Li.copy(this),e),65536*Math.round(Rt(255*Li.r,0,255))+256*Math.round(Rt(255*Li.g,0,255))+Math.round(Rt(255*Li.b,0,255))}getHexString(e=it){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=qt.workingColorSpace){qt.fromWorkingColorSpace(Li.copy(this),t);const n=Li.r,i=Li.g,r=Li.b,a=Math.max(n,i,r),s=Math.min(n,i,r);let o,l;const c=(s+a)/2;if(s===a)o=0,l=0;else{const e=a-s;switch(l=c<=.5?e/(a+s):e/(2-a-s),a){case n:o=(i-r)/e+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==c&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==dt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==dt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==dt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,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++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Ui extends Ii{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ci(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.envMapRotation=new Jn,this.combine=A,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.envMapRotation.copy(e.envMapRotation),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}}const Oi=Ni();function Ni(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=1199570944,s[32]=2147483648;for(let e=33;e<63;++e)s[e]=2147483648+(e-32<<23);s[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}const Fi={toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Rt(e,-65504,65504),Oi.floatView[0]=e;const t=Oi.uint32View[0],n=t>>23&511;return Oi.baseTable[n]+((8388607&t)>>Oi.shiftTable[n])},fromHalfFloat:function(e){const t=e>>10;return Oi.uint32View[0]=Oi.mantissaTable[Oi.offsetTable[t]+(1023&e)]+Oi.exponentTable[t],Oi.floatView[0]}},Bi=new dn,zi=new Nt;class ki{constructor(e,t,n=!1){if(Array.isArray(e))throw new 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=n,this.usage=yt,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ie,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return Gt("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const 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;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2)return}Qi.copy(r).invert(),$i.copy(e.ray).applyMatrix4(Qi),null!==n.boundingBox&&!1===$i.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,$i)}}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=d.length;rn.far?null:{distance:c,point:fr.clone(),object:e}}(e,t,n,i,nr,ir,rr,pr);if(h){r&&(or.fromBufferAttribute(r,o),lr.fromBufferAttribute(r,l),cr.fromBufferAttribute(r,c),h.uv=Ti.getInterpolation(pr,nr,ir,rr,or,lr,cr,new Nt)),a&&(or.fromBufferAttribute(a,o),lr.fromBufferAttribute(a,l),cr.fromBufferAttribute(a,c),h.uv1=Ti.getInterpolation(pr,nr,ir,rr,or,lr,cr,new Nt)),s&&(hr.fromBufferAttribute(s,o),dr.fromBufferAttribute(s,l),ur.fromBufferAttribute(s,c),h.normal=Ti.getInterpolation(pr,nr,ir,rr,hr,dr,ur,new dn),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a:o,b:l,c,normal:new dn,materialIndex:0};Ti.getNormal(nr,ir,rr,e.normal),h.face=e}return h}class vr extends Ji{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],c=[],h=[];let d=0,u=0;function p(e,t,n,i,r,a,p,f,m,g,v){const _=a/m,x=p/g,y=a/2,S=p/2,w=f/2,b=m+1,M=g+1;let T=0,E=0;const A=new dn;for(let a=0;a0?1:-1,c.push(A.x,A.y,A.z),h.push(o/m),h.push(1-a/g),T+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class br extends fi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Hn,this.projectionMatrix=new Hn,this.projectionMatrixInverse=new Hn,this.coordinateSystem=wt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}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)}}const Mr=new dn,Tr=new Nt,Er=new Nt;class Ar extends br{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}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){const t=.5*this.getFilmHeight()/e;this.fov=2*At*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Et*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*At*Math.atan(Math.tan(.5*Et*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Mr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Mr.x,Mr.y).multiplyScalar(-e/Mr.z),Mr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Mr.x,Mr.y).multiplyScalar(-e/Mr.z)}getViewSize(e,t){return this.getViewBounds(e,Tr,Er),t.subVectors(Er,Tr)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Et*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}const s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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}}const Pr=-90;class Rr extends fi{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ar(Pr,1,e,t);i.layers=this.layers,this.add(i);const r=new Ar(Pr,1,e,t);r.layers=this.layers,this.add(r);const a=new Ar(Pr,1,e,t);a.layers=this.layers,this.add(a);const s=new Ar(Pr,1,e,t);s.layers=this.layers,this.add(s);const o=new Ar(Pr,1,e,t);o.layers=this.layers,this.add(o);const l=new Ar(Pr,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,s,o]=t;for(const e of t)this.remove(e);if(e===wt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(e!==bt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,s,o,l,c]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,s),e.setRenderTarget(n,3,i),e.render(t,o),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,d,u),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class Cr extends rn{constructor(e,t,n,i,r,a,s,o,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:z,n,i,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Lr extends on{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Cr(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:q}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new vr(5,5,5),s=new wr({name:"CubemapFromEquirect",uniforms:_r(n),vertexShader:i,fragmentShader:r,side:1,blending:0});s.uniforms.tEquirect.value=t;const o=new mr(a,s),l=t.minFilter;return t.minFilter===K&&(t.minFilter=q),new Rr(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}const Dr=new dn,Ir=new dn,Ur=new Ft;class Or{constructor(e=new dn(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Dr.subVectors(n,t).cross(Ir.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Dr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Ur.getNormalMatrix(e),i=this.coplanarPoint(Dr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Nr=new Dn,Fr=new dn;class Br{constructor(e=new Or,t=new Or,n=new Or,i=new Or,r=new Or,a=new Or){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3){const n=this.planes,i=e.elements,r=i[0],a=i[1],s=i[2],o=i[3],l=i[4],c=i[5],h=i[6],d=i[7],u=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],_=i[14],x=i[15];if(n[0].setComponents(o-r,d-l,m-u,x-g).normalize(),n[1].setComponents(o+r,d+l,m+u,x+g).normalize(),n[2].setComponents(o+a,d+c,m+p,x+v).normalize(),n[3].setComponents(o-a,d-c,m-p,x-v).normalize(),n[4].setComponents(o-s,d-h,m-f,x-_).normalize(),t===wt)n[5].setComponents(o+s,d+h,m+f,x+_).normalize();else{if(t!==bt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(s,h,f,_).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),Nr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),Nr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Nr)}intersectsSprite(e){return Nr.center.set(0,0,0),Nr.radius=.7071067811865476,Nr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Nr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Fr.y=i.normal.y>0?e.max.y:e.min.y,Fr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Fr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function zr(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function kr(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.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\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform 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\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_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\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = 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\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn 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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn 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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = 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\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( 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\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - 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\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Gr={common:{diffuse:{value:new Ci(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ft},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ft}},envmap:{envMap:{value:null},envMapRotation:{value:new Ft},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ft}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ft}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ft},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ft},normalScale:{value:new Nt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ft},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ft}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ft}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ft}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ci(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 Ci(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0},uvTransform:{value:new Ft}},sprite:{diffuse:{value:new Ci(16777215)},opacity:{value:1},center:{value:new Nt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ft},alphaMap:{value:null},alphaMapTransform:{value:new Ft},alphaTest:{value:0}}},Wr={basic:{uniforms:xr([Gr.common,Gr.specularmap,Gr.envmap,Gr.aomap,Gr.lightmap,Gr.fog]),vertexShader:Vr.meshbasic_vert,fragmentShader:Vr.meshbasic_frag},lambert:{uniforms:xr([Gr.common,Gr.specularmap,Gr.envmap,Gr.aomap,Gr.lightmap,Gr.emissivemap,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.fog,Gr.lights,{emissive:{value:new Ci(0)}}]),vertexShader:Vr.meshlambert_vert,fragmentShader:Vr.meshlambert_frag},phong:{uniforms:xr([Gr.common,Gr.specularmap,Gr.envmap,Gr.aomap,Gr.lightmap,Gr.emissivemap,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.fog,Gr.lights,{emissive:{value:new Ci(0)},specular:{value:new Ci(1118481)},shininess:{value:30}}]),vertexShader:Vr.meshphong_vert,fragmentShader:Vr.meshphong_frag},standard:{uniforms:xr([Gr.common,Gr.envmap,Gr.aomap,Gr.lightmap,Gr.emissivemap,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.roughnessmap,Gr.metalnessmap,Gr.fog,Gr.lights,{emissive:{value:new Ci(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Vr.meshphysical_vert,fragmentShader:Vr.meshphysical_frag},toon:{uniforms:xr([Gr.common,Gr.aomap,Gr.lightmap,Gr.emissivemap,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.gradientmap,Gr.fog,Gr.lights,{emissive:{value:new Ci(0)}}]),vertexShader:Vr.meshtoon_vert,fragmentShader:Vr.meshtoon_frag},matcap:{uniforms:xr([Gr.common,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,Gr.fog,{matcap:{value:null}}]),vertexShader:Vr.meshmatcap_vert,fragmentShader:Vr.meshmatcap_frag},points:{uniforms:xr([Gr.points,Gr.fog]),vertexShader:Vr.points_vert,fragmentShader:Vr.points_frag},dashed:{uniforms:xr([Gr.common,Gr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Vr.linedashed_vert,fragmentShader:Vr.linedashed_frag},depth:{uniforms:xr([Gr.common,Gr.displacementmap]),vertexShader:Vr.depth_vert,fragmentShader:Vr.depth_frag},normal:{uniforms:xr([Gr.common,Gr.bumpmap,Gr.normalmap,Gr.displacementmap,{opacity:{value:1}}]),vertexShader:Vr.meshnormal_vert,fragmentShader:Vr.meshnormal_frag},sprite:{uniforms:xr([Gr.sprite,Gr.fog]),vertexShader:Vr.sprite_vert,fragmentShader:Vr.sprite_frag},background:{uniforms:{uvTransform:{value:new Ft},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Vr.background_vert,fragmentShader:Vr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ft}},vertexShader:Vr.backgroundCube_vert,fragmentShader:Vr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Vr.cube_vert,fragmentShader:Vr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Vr.equirect_vert,fragmentShader:Vr.equirect_frag},distanceRGBA:{uniforms:xr([Gr.common,Gr.displacementmap,{referencePosition:{value:new dn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Vr.distanceRGBA_vert,fragmentShader:Vr.distanceRGBA_frag},shadow:{uniforms:xr([Gr.lights,Gr.fog,{color:{value:new Ci(0)},opacity:{value:1}}]),vertexShader:Vr.shadow_vert,fragmentShader:Vr.shadow_frag}};Wr.physical={uniforms:xr([Wr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ft},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ft},clearcoatNormalScale:{value:new Nt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ft},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ft},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ft},sheen:{value:0},sheenColor:{value:new Ci(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ft},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ft},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ft},transmissionSamplerSize:{value:new Nt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ft},attenuationDistance:{value:0},attenuationColor:{value:new Ci(0)},specularColor:{value:new Ci(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ft},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ft},anisotropyVector:{value:new Nt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ft}}]),vertexShader:Vr.meshphysical_vert,fragmentShader:Vr.meshphysical_frag};const jr={r:0,b:0,g:0},Xr=new Jn,Yr=new Hn;function qr(e,t,n,i,r,a,s){const o=new Ci(0);let l,c,h=!0===a?0:1,d=null,u=0,p=null;function f(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function m(t,n){t.getRGB(jr,yr(e)),i.buffers.color.setClear(jr.r,jr.g,jr.b,n,s)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),h=t,m(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,m(o,h)},render:function(t){let n=!1;const r=f(t);null===r?m(o,h):r&&r.isColor&&(m(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,s),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=f(n);i&&(i.isCubeTexture||i.mapping===H)?(void 0===c&&(c=new mr(new vr(1,1,1),new wr({name:"BackgroundCubeMaterial",uniforms:_r(Wr.backgroundCube.uniforms),vertexShader:Wr.backgroundCube.vertexShader,fragmentShader:Wr.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Xr.copy(n.backgroundRotation),Xr.x*=-1,Xr.y*=-1,Xr.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Xr.y*=-1,Xr.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Yr.makeRotationFromEuler(Xr)),c.material.toneMapped=qt.getTransfer(i.colorSpace)!==lt,d===i&&u===i.version&&p===e.toneMapping||(c.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new mr(new Hr(2,2),new wr({name:"BackgroundMaterial",uniforms:_r(Wr.background.uniforms),vertexShader:Wr.background.vertexShader,fragmentShader:Wr.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=qt.getTransfer(i.colorSpace)!==lt,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),d===i&&u===i.version&&p===e.toneMapping||(l.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}}}function Zr(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e=0){const n=r[t];let i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return a.attributesNum!==o||a.index!==i}(n,m,l,g),v&&function(e,t,n,i){const r={},s=t.attributes;let o=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}a.attributes=r,a.attributesNum=o,a.index=i}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(v||s)&&(s=!1,function(n,i,r,a){h();const s=a.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const i in o){const r=o[i];if(r.location>=0){let o=s[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const i=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,m=h===e.INT||h===e.UNSIGNED_INT||o.gpuType===te;if(o.isInterleavedBufferAttribute){const t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp";const o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===de||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===re&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==J&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==ie&&!r)},precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function Qr(e){const t=this;let n=null,i=0,r=!1,a=!1;const s=new Or,o=new Ft,l={value:null,needsUpdate:!1};function c(e,n,i,r){const a=null!==e?e.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const t=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0),t.numPlanes=i,t.numIntersection=0);else{const e=a?0:i,t=4*e;let r=f.clippingState||null;l.value=r,r=c(d,o,t,h);for(let e=0;e!==t;++e)r[e]=n[e];f.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function $r(e){let t=new WeakMap;function n(e,t){return 303===t?e.mapping=z:304===t&&(e.mapping=k),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(303===a||304===a){if(t.has(r))return n(t.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const s=new Lr(a.height);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}class ea extends br{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const ta=[.125,.215,.35,.446,.526,.582],na=new ea,ia=new Ci;let ra=null,aa=0,sa=0,oa=!1;const la=(1+Math.sqrt(5))/2,ca=1/la,ha=[new dn(-la,ca,0),new dn(la,ca,0),new dn(-ca,0,la),new dn(ca,0,la),new dn(0,la,-ca),new dn(0,la,ca),new dn(-1,1,-1),new dn(1,1,-1),new dn(-1,1,1),new dn(1,1,1)];class da{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,n=.1,i=100){ra=this._renderer.getRenderTarget(),aa=this._renderer.getActiveCubeFace(),sa=this._renderer.getActiveMipmapLevel(),oa=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=ma(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=fa(),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;ee-4?o=ta[s-e+4-1]:0===s&&(o=0),i.push(o);const l=1/(a-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*u),_=new Float32Array(m*p*u),x=new Float32Array(g*p*u);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];v.set(i,f*p*e),_.set(d,m*p*e);const r=[e,e,e,e,e,e];x.set(r,g*p*e)}const y=new Ji;y.setAttribute("position",new ki(v,f)),y.setAttribute("uv",new ki(_,m)),y.setAttribute("faceIndex",new ki(x,g)),t.push(y),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new dn(0,1,0);return new wr({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new mr(this._lodPlanes[0],e);this._renderer.compile(t,na)}_sceneToCubeUV(e,t,n,i){const r=new Ar(90,1,t,n),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(ia),o.toneMapping=C,o.autoClear=!1;const h=new Ui({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new mr(new vr,h);let u=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,u=!0):(h.color.copy(ia),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,a[t],0),r.lookAt(s[t],0,0)):1===n?(r.up.set(0,0,a[t]),r.lookAt(0,s[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,s[t]));const l=this._cubeSize;pa(i,n*l,t>2?l:0,l,l),o.setRenderTarget(i),u&&o.render(d,r),o.render(e,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=c,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===z||e.mapping===k;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=ma()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=fa());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new mr(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const s=this._cubeSize;pa(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,na)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:ev-4?i-v+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(t),o.render(c,na)}}function ua(e,t,n){const i=new on(e,t,n);return i.texture.mapping=H,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function pa(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function fa(){return new wr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function ma(){return new wr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function ga(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,s=303===a||304===a,o=a===z||a===k;if(s||o){let a=t.get(r);const l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new da(e)),a=s?n.fromEquirectangular(r,a):n.fromCubemap(r,a),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;if(void 0!==a)return a.texture;{const l=r.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new da(e)),a=s?n.fromEquirectangular(r):n.fromCubemap(r),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function va(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&Gt("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function _a(e,t,n,i){const r={},a=new WeakMap;function s(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const e in o.attributes)t.remove(o.attributes[e]);for(const e in o.morphAttributes){const n=o.morphAttributes[e];for(let e=0,i=n.length;et.maxTextureSize&&(y=Math.ceil(x/t.maxTextureSize),x=t.maxTextureSize);const S=new Float32Array(x*y*4*h),w=new ln(S,x,y,h);w.type=ie,w.needsUpdate=!0;const b=4*_;for(let T=0;T0)return e;const r=t*n;let a=Ra[r];if(void 0===a&&(a=new Float32Array(r),Ra[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function Oa(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function Is(e,t){const n=function(e){const t=qt.getPrimaries(qt.workingColorSpace),n=qt.getPrimaries(e);let i;switch(t===n?i="":t===ht&&n===ct?i="LinearDisplayP3ToLinearSRGB":t===ct&&n===ht&&(i="LinearSRGBToLinearDisplayP3"),e){case rt:case st:return[i,"LinearTransferOETF"];case it:case at:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[i,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function Us(e,t){let n;switch(t){case L:n="Linear";break;case D:n="Reinhard";break;case I:n="OptimizedCineon";break;case U:n="ACESFilmic";break;case N:n="AgX";break;case F:n="Neutral";break;case O:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Os=new dn;function Ns(e){return""!==e}function Fs(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).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 Bs(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const zs=/^[ \t]*#include +<([\w\d./]+)>/gm;function ks(e){return e.replace(zs,Vs)}const Hs=new Map;function Vs(e,t){let n=Vr[t];if(void 0===n){const e=Hs.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=Vr[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return ks(n)}const Gs=/#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 Ws(e){return e.replace(Gs,js)}function js(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(x+="\n"),y=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v].filter(Ns).join("\n"),y.length>0&&(y+="\n")):(x=[Xs(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Ns).join("\n"),y=[Xs(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+p:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==C?"#define TONE_MAPPING":"",n.toneMapping!==C?Vr.tonemapping_pars_fragment:"",n.toneMapping!==C?Us("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Vr.colorspace_pars_fragment,Is("linearToOutputTexel",n.outputColorSpace),(qt.getLuminanceCoefficients(Os),["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${Os.x.toFixed(4)}, ${Os.y.toFixed(4)}, ${Os.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ns).join("\n")),c=ks(c),c=Fs(c,n),c=Bs(c,n),h=ks(h),h=Fs(h,n),h=Bs(h,n),c=Ws(c),h=Ws(h),!0!==n.isRawShaderMaterial&&(S="#version 300 es\n",x=[g,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,y=["#define varying in",n.glslVersion===St?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===St?"":"#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"+y);const w=S+x+c,b=S+y+h,M=Rs(o,o.VERTEX_SHADER,w),T=Rs(o,o.FRAGMENT_SHADER,b);function E(t){if(e.debug.checkShaderErrors){const n=o.getProgramInfoLog(_).trim(),i=o.getShaderInfoLog(M).trim(),r=o.getShaderInfoLog(T).trim();let a=!0,s=!0;if(!1===o.getProgramParameter(_,o.LINK_STATUS))if(a=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(o,_,M,T);else{const e=Ds(o,M,"vertex"),i=Ds(o,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(_,o.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==r||(s=!1);s&&(t.diagnostics={runnable:a,programLog:n,vertexShader:{log:i,prefix:x},fragmentShader:{log:r,prefix:y}})}o.deleteShader(M),o.deleteShader(T),L=new Ps(o,_),D=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,q=a.clearcoat>0,Z=a.dispersion>0,K=a.iridescence>0,J=a.sheen>0,Q=a.transmission>0,$=Y&&!!a.anisotropyMap,ee=q&&!!a.clearcoatMap,te=q&&!!a.clearcoatNormalMap,ne=q&&!!a.clearcoatRoughnessMap,ie=K&&!!a.iridescenceMap,re=K&&!!a.iridescenceThicknessMap,ae=J&&!!a.sheenColorMap,se=J&&!!a.sheenRoughnessMap,oe=!!a.specularMap,le=!!a.specularColorMap,ce=!!a.specularIntensityMap,he=Q&&!!a.transmissionMap,de=Q&&!!a.thicknessMap,ue=!!a.gradientMap,pe=!!a.alphaMap,fe=a.alphaTest>0,me=!!a.alphaHash,ge=!!a.extensions;let ve=C;a.toneMapped&&(null!==D&&!0!==D.isXRRenderTarget||(ve=e.toneMapping));const _e={shaderID:b,shaderType:a.type,shaderName:a.name,vertexShader:E,fragmentShader:A,defines:a.defines,customVertexShaderID:P,customFragmentShaderID:R,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:U,batchingColor:U&&null!==v._colorsTexture,instancing:I,instancingColor:I&&null!==v.instanceColor,instancingMorph:I&&null!==v.morphTexture,supportsVertexTextures:u,outputColorSpace:null===D?e.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:rt,alphaToCoverage:!!a.alphaToCoverage,map:O,matcap:N,envMap:F,envMapMode:F&&S.mapping,envMapCubeUVHeight:w,aoMap:B,lightMap:z,bumpMap:k,normalMap:V,displacementMap:u&&G,emissiveMap:W,normalMapObjectSpace:V&&1===a.normalMapType,normalMapTangentSpace:V&&0===a.normalMapType,metalnessMap:j,roughnessMap:X,anisotropy:Y,anisotropyMap:$,clearcoat:q,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,dispersion:Z,iridescence:K,iridescenceMap:ie,iridescenceThicknessMap:re,sheen:J,sheenColorMap:ae,sheenRoughnessMap:se,specularMap:oe,specularColorMap:le,specularIntensityMap:ce,transmission:Q,transmissionMap:he,thicknessMap:de,gradientMap:ue,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:pe,alphaTest:fe,alphaHash:me,combine:a.combine,mapUv:O&&m(a.map.channel),aoMapUv:B&&m(a.aoMap.channel),lightMapUv:z&&m(a.lightMap.channel),bumpMapUv:k&&m(a.bumpMap.channel),normalMapUv:V&&m(a.normalMap.channel),displacementMapUv:G&&m(a.displacementMap.channel),emissiveMapUv:W&&m(a.emissiveMap.channel),metalnessMapUv:j&&m(a.metalnessMap.channel),roughnessMapUv:X&&m(a.roughnessMap.channel),anisotropyMapUv:$&&m(a.anisotropyMap.channel),clearcoatMapUv:ee&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:te&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ie&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:re&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:ae&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:se&&m(a.sheenRoughnessMap.channel),specularMapUv:oe&&m(a.specularMap.channel),specularColorMapUv:le&&m(a.specularColorMap.channel),specularIntensityMapUv:ce&&m(a.specularIntensityMap.channel),transmissionMapUv:he&&m(a.transmissionMap.channel),thicknessMapUv:de&&m(a.thicknessMap.channel),alphaMapUv:pe&&m(a.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(V||Y),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!x.attributes.uv&&(O||pe),fog:!!_,useFog:!0===a.fog,fogExp2:!!_&&_.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:T,morphTextureStride:L,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,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:ve,decodeVideoTexture:O&&!0===a.map.isVideoTexture&&qt.getTransfer(a.map.colorSpace)===lt,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ge&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ge&&!0===a.extensions.multiDraw||U)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return _e.vertexUv1s=c.has(1),_e.vertexUv2s=c.has(2),_e.vertexUv3s=c.has(3),c.clear(),_e},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){o.disableAll(),t.supportsVertexTextures&&o.enable(0),t.instancing&&o.enable(1),t.instancingColor&&o.enable(2),t.instancingMorph&&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.vertexUv1s&&o.enable(13),t.vertexUv2s&&o.enable(14),t.vertexUv3s&&o.enable(15),t.vertexTangents&&o.enable(16),t.anisotropy&&o.enable(17),t.alphaHash&&o.enable(18),t.batching&&o.enable(19),t.dispersion&&o.enable(20),t.batchingColor&&o.enable(21),e.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.doubleSided&&o.enable(10),t.flipSided&&o.enable(11),t.useDepthPacking&&o.enable(12),t.dithering&&o.enable(13),t.transmission&&o.enable(14),t.sheen&&o.enable(15),t.opaque&&o.enable(16),t.pointsUvs&&o.enable(17),t.decodeVideoTexture&&o.enable(18),t.alphaToCoverage&&o.enable(19),e.push(o.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=f[e.type];let n;if(t){const e=Wr[t];n=Sr.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e0?i.push(h):!0===s.transparent?r.push(h):n.push(h)},unshift:function(e,t,s,o,l,c){const h=a(e,t,s,o,l,c);s.transmission>0?i.unshift(h):!0===s.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||$s),i.length>1&&i.sort(t||eo),r.length>1&&r.sort(t||eo)}}}function no(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new to,e.set(t,[r])):n>=i.length?(r=new to,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function io(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new dn,color:new Ci};break;case"SpotLight":n={position:new dn,direction:new dn,color:new Ci,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new dn,color:new Ci,distance:0,decay:0};break;case"HemisphereLight":n={direction:new dn,skyColor:new Ci,groundColor:new Ci};break;case"RectAreaLight":n={color:new Ci,position:new dn,halfWidth:new dn,halfHeight:new dn}}return e[t.id]=n,n}}}let ro=0;function ao(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function so(e){const t=new io,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Nt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Nt,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let e=0;e<9;e++)i.probe.push(new dn);const r=new dn,a=new Hn,s=new Hn;return{setup:function(r){let a=0,s=0,o=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,d=0,u=0,p=0,f=0,m=0,g=0,v=0,_=0;r.sort(ao);for(let e=0,x=r.length;e0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=Gr.LTC_FLOAT_1,i.rectAreaLTC2=Gr.LTC_FLOAT_2):(i.rectAreaLTC1=Gr.LTC_HALF_1,i.rectAreaLTC2=Gr.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=s,i.ambient[2]=o;const x=i.hash;x.directionalLength===l&&x.pointLength===c&&x.spotLength===h&&x.rectAreaLength===d&&x.hemiLength===u&&x.numDirectionalShadows===p&&x.numPointShadows===f&&x.numSpotShadows===m&&x.numSpotMaps===g&&x.numLightProbes===_||(i.directional.length=l,i.spot.length=h,i.rectArea.length=d,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=f,i.spotLightMatrix.length=m+g-v,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=v,i.numLightProbes=_,x.directionalLength=l,x.pointLength=c,x.spotLength=h,x.rectAreaLength=d,x.hemiLength=u,x.numDirectionalShadows=p,x.numPointShadows=f,x.numSpotShadows=m,x.numSpotMaps=g,x.numLightProbes=_,i.version=ro++)},setupView:function(e,t){let n=0,o=0,l=0,c=0,h=0;const d=t.matrixWorldInverse;for(let t=0,u=e.length;t=r.length?(a=new oo(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}class co extends Ii{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}}class ho extends Ii{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 uo(e,t,n){let r=new Br;const c=new Nt,h=new Nt,d=new an,u=new co({depthPacking:3201}),p=new ho,f={},m=n.maxTextureSize,g={[s]:1,[o]:0,[l]:2},v=new wr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Nt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),_=v.clone();_.defines.HORIZONTAL_PASS=1;const x=new Ji;x.setAttribute("position",new ki(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new mr(x,v),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i;let w=this.type;function b(n,i){const r=t.update(y);v.defines.VSM_SAMPLES!==n.blurSamples&&(v.defines.VSM_SAMPLES=n.blurSamples,_.defines.VSM_SAMPLES=n.blurSamples,v.needsUpdate=!0,_.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new on(c.x,c.y)),v.uniforms.shadow_pass.value=n.map.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,v,y,null),_.uniforms.shadow_pass.value=n.mapPass.texture,_.uniforms.resolution.value=n.mapSize,_.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,_,y,null)}function M(t,n,i,r){let s=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)s=o;else if(s=!0===i.isPointLight?p:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=s.uuid,t=n.uuid;let i=f[e];void 0===i&&(i={},f[e]=i);let r=i[t];void 0===r&&(r=s.clone(),i[t]=r,n.addEventListener("dispose",E)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=r===a?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:g[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(e.properties.get(s).light=i),s}function T(n,i,s,o,l){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&l===a)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=t.update(n),a=n.material;if(Array.isArray(a)){const t=r.groups;for(let c=0,h=t.length;cm||c.y>m)&&(c.x>m&&(h.x=Math.floor(m/g.x),c.x=h.x*g.x,l.mapSize.x=h.x),c.y>m&&(h.y=Math.floor(m/g.y),c.y=h.y*g.y,l.mapSize.y=h.y)),null===l.map||!0===p||!0===f){const e=this.type!==a?{minFilter:j,magFilter:j}:{};null!==l.map&&l.map.dispose(),l.map=new on(c.x,c.y,e),l.map.texture.name=o.name+".shadowMap",l.camera.updateProjectionMatrix()}e.setRenderTarget(l.map),e.clear();const v=l.getViewportCount();for(let e=0;e=1):-1!==q.indexOf("OpenGL ES")&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),X=Y>=2);let Z=null,K={};const J=e.getParameter(e.SCISSOR_BOX),Q=e.getParameter(e.VIEWPORT),$=(new an).fromArray(J),ee=(new an).fromArray(Q);function te(t,n,i,r){const a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;sn||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===d&&(d=f(n,a));const s=t?f(n,a):d;return s.width=n,s.height=a,s.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),s}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function g(e){return e.generateMipmaps&&e.minFilter!==j&&e.minFilter!==q}function v(t){e.generateMipmap(t)}function _(n,i,r,a,s=!1){if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;if(i===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),i===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),i===e.RGBA){const t=s?ot:qt.getTransfer(a);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===lt?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return o!==e.R16F&&o!==e.R32F&&o!==e.RG16F&&o!==e.RG32F&&o!==e.RGBA16F&&o!==e.RGBA32F||t.get("EXT_color_buffer_float"),o}function x(t,n){let i;return t?null===n||n===ne||n===oe?i=e.DEPTH24_STENCIL8:n===ie?i=e.DEPTH32F_STENCIL8:n===ee&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===ne||n===oe?i=e.DEPTH_COMPONENT24:n===ie?i=e.DEPTH_COMPONENT32F:n===ee&&(i=e.DEPTH_COMPONENT16),i}function y(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==j&&e.minFilter!==q?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 S(e){const t=e.target;t.removeEventListener("dispose",S),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=u.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&b(e),0===Object.keys(r).length&&u.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function w(t){const n=t.target;n.removeEventListener("dispose",w),function(t){const n=i.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i0&&a.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}const E={[V]:e.REPEAT,[G]:e.CLAMP_TO_EDGE,[W]:e.MIRRORED_REPEAT},A={[j]:e.NEAREST,[X]:e.NEAREST_MIPMAP_NEAREST,[Y]:e.NEAREST_MIPMAP_LINEAR,[q]:e.LINEAR,[Z]:e.LINEAR_MIPMAP_NEAREST,[K]:e.LINEAR_MIPMAP_LINEAR},P={[ut]:e.NEVER,[xt]:e.ALWAYS,[pt]:e.LESS,[mt]:e.LEQUAL,[ft]:e.EQUAL,[_t]:e.GEQUAL,[gt]:e.GREATER,[vt]:e.NOTEQUAL};function R(n,a){if(a.type!==ie||!1!==t.has("OES_texture_float_linear")||a.magFilter!==q&&a.magFilter!==Z&&a.magFilter!==Y&&a.magFilter!==K&&a.minFilter!==q&&a.minFilter!==Z&&a.minFilter!==Y&&a.minFilter!==K||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,E[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,E[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,E[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,A[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,A[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,P[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(a.magFilter===j)return;if(a.minFilter!==Y&&a.minFilter!==K)return;if(a.type===ie&&!1===t.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function C(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",S));const r=n.source;let a=u.get(r);void 0===a&&(a={},u.set(r,a));const o=function(e){const t=[];return 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.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&b(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return i}function L(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);const c=C(t,s),h=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);const d=i.get(h);if(h.version!==d.__version||!0===c){n.activeTexture(e.TEXTURE0+o);const t=qt.getPrimaries(qt.workingColorSpace),i=s.colorSpace===nt?null:qt.getPrimaries(s.colorSpace),u=s.colorSpace===nt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=m(s.image,!1,r.maxTextureSize);p=z(s,p);const f=a.convert(s.format,s.colorSpace),S=a.convert(s.type);let w,b=_(s.internalFormat,f,S,s.colorSpace,s.isVideoTexture);R(l,s);const M=s.mipmaps,T=!0!==s.isVideoTexture,E=void 0===d.__version||!0===c,A=h.dataReady,P=y(s,p);if(s.isDepthTexture)b=x(s.format===me,s.type),E&&(T?n.texStorage2D(e.TEXTURE_2D,1,b,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,b,p.width,p.height,0,f,S,null));else if(s.isDataTexture)if(M.length>0){T&&E&&n.texStorage2D(e.TEXTURE_2D,P,b,M[0].width,M[0].height);for(let t=0,i=M.length;t0){const i=fo(w.width,w.height,s.format,s.type);for(const r of s.layerUpdates){const a=w.data.subarray(r*i/w.data.BYTES_PER_ELEMENT,(r+1)*i/w.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,r,w.width,w.height,1,f,a,0,0)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,w.width,w.height,p.depth,f,w.data,0,0)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,b,w.width,w.height,p.depth,0,w.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?A&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,w.width,w.height,p.depth,f,S,w.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,b,w.width,w.height,p.depth,0,f,S,w.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,P,b,M[0].width,M[0].height);for(let t=0,i=M.length;t0){const t=fo(p.width,p.height,s.format,s.type);for(const i of s.layerUpdates){const r=p.data.subarray(i*t/p.data.BYTES_PER_ELEMENT,(i+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,f,S,r)}s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,f,S,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,b,p.width,p.height,p.depth,0,f,S,p.data);else if(s.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,P,b,p.width,p.height,p.depth),A&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,f,S,p.data)):n.texImage3D(e.TEXTURE_3D,0,b,p.width,p.height,p.depth,0,f,S,p.data);else if(s.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,P,b,p.width,p.height);else{let t=p.width,i=p.height;for(let r=0;r>=1,i>>=1}}else if(M.length>0){if(T&&E){const t=k(M[0]);n.texStorage2D(e.TEXTURE_2D,P,b,t.width,t.height)}for(let t=0,i=M.length;t>h),i=Math.max(1,r.height>>h);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?n.texImage3D(c,h,p,t,i,r.depth,0,d,u,null):n.texImage2D(c,h,p,t,i,0,d,u,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),B(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,c,i.get(s).__webglTexture,0,F(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,c,i.get(s).__webglTexture,h),n.bindFramebuffer(e.FRAMEBUFFER,null)}function I(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=x(n.stencilBuffer,a),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=F(n);B(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,s,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function z(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==rt&&n!==nt&&(qt.getTransfer(n)===lt?i===de&&r===J||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function k(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){const e=M;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),M+=1,e},this.resetTextureUnits=function(){M=0},this.setTexture2D=T,this.setTexture2DArray=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?L(a,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?L(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;const l=C(t,s),c=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+o);const t=qt.getPrimaries(qt.workingColorSpace),i=s.colorSpace===nt?null:qt.getPrimaries(s.colorSpace),d=s.colorSpace===nt||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const u=s.isCompressedTexture||s.image[0].isCompressedTexture,p=s.image[0]&&s.image[0].isDataTexture,f=[];for(let e=0;e<6;e++)f[e]=u||p?p?s.image[e].image:s.image[e]:m(s.image[e],!0,r.maxCubemapSize),f[e]=z(s,f[e]);const x=f[0],S=a.convert(s.format,s.colorSpace),w=a.convert(s.type),b=_(s.internalFormat,S,w,s.colorSpace),M=!0!==s.isVideoTexture,T=void 0===h.__version||!0===l,E=c.dataReady;let A,P=y(s,x);if(R(e.TEXTURE_CUBE_MAP,s),u){M&&T&&n.texStorage2D(e.TEXTURE_CUBE_MAP,P,b,x.width,x.height);for(let t=0;t<6;t++){A=f[t].mipmaps;for(let i=0;i0&&P++;const t=k(f[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,P,b,t.width,t.height)}for(let t=0;t<6;t++)if(p){M?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,f[t].width,f[t].height,S,w,f[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,b,f[t].width,f[t].height,0,S,w,f[t].data);for(let i=0;i1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),h){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n0){o.__webglFramebuffer=[];for(let t=0;t0&&!1===B(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let n=0;n0)if(!1===B(t)){const r=t.textures,a=t.width,s=t.height;let o=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),d=r.length>1;if(d)for(let t=0;to+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==s&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(xo)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new _o;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class So{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new rn;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new wr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new mr(new Hr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class wo extends Mt{constructor(e,t){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,c=null,h=null,d=null,u=null,p=null;const f=new So,m=t.getContextAttributes();let g=null,v=null;const _=[],x=[],y=new Nt;let S=null;const w=new Ar;w.layers.enable(1),w.viewport=new an;const b=new Ar;b.layers.enable(2),b.viewport=new an;const M=[w,b],T=new vo;T.layers.enable(1),T.layers.enable(2);let E=null,A=null;function P(e){const t=x.indexOf(e.inputSource);if(-1===t)return;const n=_[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function R(){i.removeEventListener("select",P),i.removeEventListener("selectstart",P),i.removeEventListener("selectend",P),i.removeEventListener("squeeze",P),i.removeEventListener("squeezestart",P),i.removeEventListener("squeezeend",P),i.removeEventListener("end",R),i.removeEventListener("inputsourceschange",C);for(let e=0;e<_.length;e++){const t=x[e];null!==t&&(x[e]=null,_[e].disconnect(t))}E=null,A=null,f.reset(),e.setRenderTarget(g),u=null,d=null,h=null,i=null,v=null,O.stop(),n.isPresenting=!1,e.setPixelRatio(S),e.setSize(y.width,y.height,!1),n.dispatchEvent({type:"sessionend"})}function C(e){for(let t=0;t=0&&(x[i]=null,_[i].disconnect(n))}for(let t=0;t=x.length){x.push(n),i=e;break}if(null===x[e]){x[e]=n,i=e;break}}if(-1===i)break}const r=_[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=_[e];return void 0===t&&(t=new yo,_[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=_[e];return void 0===t&&(t=new yo,_[e]=t),t.getGripSpace()},this.getHand=function(e){let t=_[e];return void 0===t&&(t=new yo,_[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(g=e.getRenderTarget(),i.addEventListener("select",P),i.addEventListener("selectstart",P),i.addEventListener("selectend",P),i.addEventListener("squeeze",P),i.addEventListener("squeezestart",P),i.addEventListener("squeezeend",P),i.addEventListener("end",R),i.addEventListener("inputsourceschange",C),!0!==m.xrCompatible&&await t.makeXRCompatible(),S=e.getPixelRatio(),e.getSize(y),void 0===i.renderState.layers){const n={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:u}),e.setPixelRatio(1),e.setSize(u.framebufferWidth,u.framebufferHeight,!1),v=new on(u.framebufferWidth,u.framebufferHeight,{format:de,type:J,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let n=null,a=null,s=null;m.depth&&(s=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=m.stencil?me:fe,a=m.stencil?oe:ne);const o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(o),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),v=new on(d.textureWidth,d.textureHeight,{format:de,type:J,depthTexture:new ba(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:!1===d.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),O.setContext(i),O.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};const L=new dn,D=new dn;function I(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===i)return;null!==f.texture&&(e.near=f.depthNear,e.far=f.depthFar),T.near=b.near=w.near=e.near,T.far=b.far=w.far=e.far,E===T.near&&A===T.far||(i.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,A=T.far,w.near=E,w.far=A,b.near=E,b.far=A,w.updateProjectionMatrix(),b.updateProjectionMatrix(),e.updateProjectionMatrix());const t=e.parent,n=T.cameras;I(T,t);for(let e=0;e0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,bo.copy(s),bo.x*=-1,bo.y*=-1,bo.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(bo.y*=-1,bo.z*=-1),e.envMapRotation.value.setFromMatrix4(Mo.makeRotationFromEuler(bo)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,yr(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,s,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,o)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,s):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Eo(e,t,n,i){let r={},a={},s=[];const o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return i[a]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==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 h(t){const n=t.target;n.removeEventListener("dispose",h);const i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,d){let u=r[n.id];void 0===u&&(function(e){const t=e.uniforms;let n=0;for(let e=0,i=t.length;e0&&(n+=16-i),e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Po{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=yt,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Pt()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return Gt("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei)return;ol.applyMatrix4(e.matrixWorld);const o=t.ray.origin.distanceTo(ol);return ot.far?void 0:{distance:o,point:ll.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,object:e}}const dl=new dn,ul=new dn;class pl extends cl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,object:s})}}class wl{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let a;a=t||e*n[r-1];let s,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),s=n[i]-a,s<0)o=i+1;else{if(!(s>0)){l=i;break}l=i-1}if(i=l,n[i]===a)return i/(r-1);const c=n[i];return(i+(a-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const a=this.getPoint(i),s=this.getPoint(r),o=t||(a.isVector2?new Nt:new dn);return o.copy(s).sub(a).normalize(),o}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new dn,i=[],r=[],a=[],s=new dn,o=new Hn;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new dn)}r[0]=new dn,a[0]=new dn;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),a[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(i[t-1],i[t]),s.length()>Number.EPSILON){s.normalize();const e=Math.acos(Rt(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(Rt(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class bl extends wl{constructor(e=0,t=0,n=1,i=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new Nt){const n=t,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?s=i[(l-1)%r]:(Tl.subVectors(i[0],i[1]).add(i[0]),s=Tl);const h=i[l%r],d=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return n.set(Cl(s,o.x,l.x,c.x,h.x),Cl(s,o.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t0&&v(!0),t>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new Gi(h,3)),this.setAttribute("normal",new Gi(d,3)),this.setAttribute("uv",new Gi(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Nl(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Fl extends Ji{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],a=[];function s(e,t,n,i){const r=i+1,a=[];for(let i=0;i<=r;i++){a[i]=[];const s=e.clone().lerp(n,i/r),o=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)a[i][e]=0===e&&i===r?s:s.clone().lerp(o,e/l)}for(let e=0;e.9&&s<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new Gi(r,3)),this.setAttribute("normal",new Gi(r.slice(),3)),this.setAttribute("uv",new Gi(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fl(e.vertices,e.indices,e.radius,e.details)}}class Bl extends Fl{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 Bl(e.radius,e.detail)}}class zl extends Ji{constructor(e=.5,t=1,n=32,i=1,r=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},n=Math.max(3,n);const s=[],o=[],l=[],c=[];let h=e;const d=(t-e)/(i=Math.max(1,i)),u=new dn,p=new Nt;for(let e=0;e<=i;e++){for(let e=0;e<=n;e++){const i=r+e/n*a;u.x=h*Math.cos(i),u.y=h*Math.sin(i),o.push(u.x,u.y,u.z),l.push(0,0,1),p.x=(u.x/t+1)/2,p.y=(u.y/t+1)/2,c.push(p.x,p.y)}h+=d}for(let e=0;e0)&&u.push(t,r,l),(e!==n-1||o0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Xl extends Ii{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ci(16777215),this.specular=new Ci(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ci(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Nt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jn,this.combine=A,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Yl extends Ii{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Nt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class ql extends Ii{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ci(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ci(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Nt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Jn,this.combine=A,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function Zl(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function Kl(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n}function Jl(e,t,n){const i=e.length,r=new e.constructor(i);for(let a=0,s=0;s!==i;++a){const i=n[a]*t;for(let n=0;n!==t;++n)r[s++]=e[i+n]}return r}function Ql(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do{s=a[i],void 0!==s&&(t.push(a.time),n.push.apply(n,s)),a=e[r++]}while(void 0!==a);else if(void 0!==s.toArray)do{s=a[i],void 0!==s&&(t.push(a.time),s.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{s=a[i],void 0!==s&&(t.push(a.time),n.push(s)),a=e[r++]}while(void 0!==a)}class $l{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e=r)break e;{const s=t[1];e=r)break t}a=n,n=0}}for(;n>>1;et;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&(s=i,ArrayBuffer.isView(s)&&!(s instanceof DataView)))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}var s;return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===tt,r=e.length-1;let a=1;for(let s=1;s0){e[a]=e[r];for(let e=r*n,i=a*n,s=0;s!==n;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}ic.prototype.TimeBufferType=Float32Array,ic.prototype.ValueBufferType=Float32Array,ic.prototype.DefaultInterpolation=et;class rc extends ic{constructor(e,t,n){super(e,t,n)}}rc.prototype.ValueTypeName="bool",rc.prototype.ValueBufferType=Array,rc.prototype.DefaultInterpolation=$e,rc.prototype.InterpolantFactoryMethodLinear=void 0,rc.prototype.InterpolantFactoryMethodSmooth=void 0;class ac extends ic{}ac.prototype.ValueTypeName="color";class sc extends ic{}sc.prototype.ValueTypeName="number";class oc extends $l{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(i-t);let l=e*s;for(let e=l+s;l!==e;l+=4)hn.slerpFlat(r,0,a,l-s,a,l,o);return r}}class lc extends ic{InterpolantFactoryMethodLinear(e){return new oc(this.times,this.values,this.getValueSize(),e)}}lc.prototype.ValueTypeName="quaternion",lc.prototype.InterpolantFactoryMethodSmooth=void 0;class cc extends ic{constructor(e,t,n){super(e,t,n)}}cc.prototype.ValueTypeName="string",cc.prototype.ValueBufferType=Array,cc.prototype.DefaultInterpolation=$e,cc.prototype.InterpolantFactoryMethodLinear=void 0,cc.prototype.InterpolantFactoryMethodSmooth=void 0;class hc extends ic{}hc.prototype.ValueTypeName="vector";class dc{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Pt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(uc(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(ic.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let e=0;e1){const e=a[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const a=[];for(const e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const a=[],s=[];Ql(n,a,s,i),0!==a.length&&r.push(new e(t,a,s))}},i=[],r=e.name||"default",a=e.fps||30,s=e.blendMode;let o=e.length||-1;const l=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==vc[e])return void vc[e].push({onLoad:t,onProgress:n,onError:i});vc[e]=[],vc[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,o=this.responseType;fetch(a).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=vc[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,s=0!==a;let o=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:a});for(let e=0,t=n.length;e{e.error(t)}))}()}});return new Response(l)}throw new _c(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)})).then((e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,s)));case"json":return e.json();default:if(void 0===s)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{pc.add(e,t);const n=vc[e];delete vc[e];for(let e=0,i=n.length;e{const n=vc[e];if(void 0===n)throw this.manager.itemError(e),t;delete vc[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class yc extends gc{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=pc.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;const s=kt("img");function o(){c(),pc.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(e),s.src=e,s}}class Sc extends gc{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Vo,s=new xc(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(r.withCredentials),s.load(e,(function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:G,a.wrapT=void 0!==n.wrapT?n.wrapT:G,a.magFilter=void 0!==n.magFilter?n.magFilter:q,a.minFilter=void 0!==n.minFilter?n.minFilter:q,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(a.colorSpace=n.colorSpace),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=K),1===n.mipmapCount&&(a.minFilter=q),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)}),n,i),a}}class wc extends gc{constructor(e){super(e)}load(e,t,n,i){const r=new rn,a=new yc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}class bc extends fi{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ci(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(t.object.target=this.target.uuid),t}}const Mc=new Hn,Tc=new dn,Ec=new dn;class Ac{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Nt(512,512),this.map=null,this.mapPass=null,this.matrix=new Hn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Br,this._frameExtents=new Nt(1,1),this._viewportCount=1,this._viewports=[new an(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Tc.setFromMatrixPosition(e.matrixWorld),t.position.copy(Tc),Ec.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ec),t.updateMatrixWorld(),Mc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Mc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Mc)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Pc extends Ac{constructor(){super(new Ar(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*At*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Rc extends bc{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(fi.DEFAULT_UP),this.updateMatrix(),this.target=new fi,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new Pc}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Cc=new Hn,Lc=new dn,Dc=new dn;class Ic extends Ac{constructor(){super(new Ar(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Nt(4,2),this._viewportCount=6,this._viewports=[new an(2,1,1,1),new an(0,1,1,1),new an(3,1,1,1),new an(1,1,1,1),new an(3,0,1,1),new an(1,0,1,1)],this._cubeDirections=[new dn(1,0,0),new dn(-1,0,0),new dn(0,0,1),new dn(0,0,-1),new dn(0,1,0),new dn(0,-1,0)],this._cubeUps=[new dn(0,1,0),new dn(0,1,0),new dn(0,1,0),new dn(0,1,0),new dn(0,0,1),new dn(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Lc.setFromMatrixPosition(e.matrixWorld),n.position.copy(Lc),Dc.copy(n.position),Dc.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Dc),n.updateMatrixWorld(),i.makeTranslation(-Lc.x,-Lc.y,-Lc.z),Cc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Cc)}}class Uc extends bc{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Ic}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Oc extends Ac{constructor(){super(new ea(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Nc extends bc{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(fi.DEFAULT_UP),this.updateMatrix(),this.target=new fi,this.shadow=new Oc}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Fc extends bc{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Bc extends bc{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class zc{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n{t&&t(n),r.manager.itemEnd(e)})).catch((e=>{i&&i(e)})):(setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a);const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader;const o=fetch(e,s).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return pc.add(e,n),t&&t(n),r.manager.itemEnd(e),n})).catch((function(t){i&&i(t),pc.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)}));pc.add(e,o),r.manager.itemStart(e)}}const Hc="\\[\\]\\.:\\/",Vc=new RegExp("["+Hc+"]","g"),Gc="[^"+Hc+"]",Wc="[^"+Hc.replace("\\.","")+"]",jc=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Gc)+/(WCOD+)?/.source.replace("WCOD",Wc)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Gc)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Gc)+"$"),Xc=["material","materials","bones","map"];class Yc{constructor(e,t,n){this.path=t,this.parsedPath=n||Yc.parseTrackName(t),this.node=Yc.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Yc.Composite(e,t,n):new Yc(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Vc,"")}static parseTrackName(e){const t=jc.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==Xc.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i{var t;switch(e.type){default:break;case"ambient":const n=new Fc(new Ci(e.color),0);this._lightSources.push(n);break;case"rectArea":const r=new dn(e.position.x,e.position.y,e.position.z);if(this.lightSourceScale&&r.length()this._scene.add(e)))}removeFromScene(){this._lightSources.forEach((e=>this._scene.remove(e)))}reload(){this.removeFromScene(),this.addToScene()}}ih.noLightSources=[],ih.defaultLightSources=[{type:"ambient",color:"#ffffff"},{type:"rectArea",position:{x:0,y:5,z:3},color:"#ffffff",intensity:60,castShadow:!0},{type:"rectArea",position:{x:-5,y:3,z:2},color:"#ffffff",intensity:60,castShadow:!1}],ih.fifeLightSources=[{type:"ambient",color:"#ffffff"},{type:"rectArea",position:{x:0,y:5,z:0},color:"#ffffff",intensity:40,castShadow:!0},{type:"rectArea",position:{x:5,y:5,z:5},color:"#ffffff",intensity:60,castShadow:!0},{type:"rectArea",position:{x:-5,y:5,z:5},color:"#ffffff",intensity:60,castShadow:!0},{type:"rectArea",position:{x:5,y:5,z:-5},color:"#ffffff",intensity:60,castShadow:!0},{type:"rectArea",position:{x:-5,y:5,z:-5},color:"#ffffff",intensity:60,castShadow:!0}];const rh={uniforms:{tDiffuse:{value:null},colorTransform:{value:new Hn},colorBase:{value:new an(0,0,0,0)},multiplyChannels:{value:0},uvTransform:{value:new Ft}},vertexShader:"\n varying vec2 vUv;\n uniform mat3 uvTransform;\n \n void main() {\n vUv = (uvTransform * vec3(uv, 1.0)).xy;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform mat4 colorTransform;\n uniform vec4 colorBase;\n uniform float multiplyChannels;\n varying vec2 vUv;\n \n void main() {\n vec4 color = texture2D(tDiffuse, vUv);\n #if PREMULTIPLIED_ALPHA == 1\n if (color.a > 0.0) color.rgb /= color.a;\n #endif\n color = colorTransform * color + colorBase;\n color.rgb = mix(color.rgb, vec3(color.r * color.g * color.b), multiplyChannels);\n #if LINEAR_TO_SRGB == 1\n color.rgb = mix(color.rgb * 12.92, 1.055 * pow(color.rgb, vec3(0.41666)) - 0.055, step(0.0031308, color.rgb));\n #endif\n gl_FragColor = color;\n }"},ah=new Hn,sh=(new Hn).set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0),oh=(new Hn).set(0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0),lh=(new Hn).set(1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1),ch=((new Hn).set(0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1),(new Hn).set(0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1),(new Hn).set(1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1)),hh=new an(0,0,0,0),dh=new an(0,0,0,1),uh=new Ft,ph=(new Ft).set(1,0,0,0,-1,1,0,0,1),fh="additive";class mh extends wr{constructor(e,t=fh,n=!1,i=!1){const r=t===fh?{blendSrc:y,blendDst:u,blendEquation:c,blendSrcAlpha:_,blendDstAlpha:u,blendEquationAlpha:c}:{};super(Object.assign({uniforms:Sr.clone(rh.uniforms),vertexShader:rh.vertexShader,fragmentShader:rh.fragmentShader,defines:{LINEAR_TO_SRGB:n?1:0,PREMULTIPLIED_ALPHA:i?1:0},transparent:!0,depthTest:!1,depthWrite:!1},r)),this.update(e)}update(e){return void 0!==(null==e?void 0:e.texture)&&(this.uniforms.tDiffuse.value=null==e?void 0:e.texture),void 0!==(null==e?void 0:e.colorTransform)&&(this.uniforms.colorTransform.value=null==e?void 0:e.colorTransform),void 0!==(null==e?void 0:e.colorBase)&&(this.uniforms.colorBase.value=null==e?void 0:e.colorBase),void 0!==(null==e?void 0:e.multiplyChannels)&&(this.uniforms.multiplyChannels.value=null==e?void 0:e.multiplyChannels),void 0!==(null==e?void 0:e.uvTransform)&&(this.uniforms.uvTransform.value=null==e?void 0:e.uvTransform),void 0!==(null==e?void 0:e.blending)&&(this.blending=null==e?void 0:e.blending),void 0!==(null==e?void 0:e.blendSrc)&&(this.blendSrc=null==e?void 0:e.blendSrc),void 0!==(null==e?void 0:e.blendDst)&&(this.blendDst=null==e?void 0:e.blendDst),void 0!==(null==e?void 0:e.blendEquation)&&(this.blendEquation=null==e?void 0:e.blendEquation),void 0!==(null==e?void 0:e.blendSrcAlpha)&&(this.blendSrcAlpha=null==e?void 0:e.blendSrcAlpha),void 0!==(null==e?void 0:e.blendDstAlpha)&&(this.blendDstAlpha=null==e?void 0:e.blendDstAlpha),void 0!==(null==e?void 0:e.blendEquationAlpha)&&(this.blendEquationAlpha=null==e?void 0:e.blendEquationAlpha),this}}const gh={uniforms:{tDiffuse:{value:null},rangeMin:{value:new Nt(1/512,1/512)},rangeMax:{value:new Nt(1/512,1/512)}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform vec2 rangeMin;\n uniform vec2 rangeMax;\n varying vec2 vUv;\n \n void main() {\n vec4 baseColor = texture2D(tDiffuse, vUv);\n vec2 blur = mix(rangeMax, rangeMin, baseColor.a);\n vec4 sum = vec4( 0.0 );\n sum += texture2D(tDiffuse, vUv - 1.0 * blur) * 0.051;\n sum += texture2D(tDiffuse, vUv - 0.75 * blur) * 0.0918;\n sum += texture2D(tDiffuse, vUv - 0.5 * blur) * 0.12245;\n sum += texture2D(tDiffuse, vUv - 0.25 * blur) * 0.1531;\n sum += baseColor * 0.1633;\n sum += texture2D(tDiffuse, vUv + 0.25 * blur) * 0.1531;\n sum += texture2D(tDiffuse, vUv + 0.5 * blur) * 0.12245;\n sum += texture2D(tDiffuse, vUv + 0.75 * blur) * 0.0918;\n sum += texture2D(tDiffuse, vUv + 1.0 * blur) * 0.051;\n gl_FragColor = sum;\n }"};new Nt(.1,.9),new Nt(.1,.9);class vh extends wr{constructor(e){super({defines:Object.assign({},vh._linearDepthShader.defines),uniforms:Sr.clone(vh._linearDepthShader.uniforms),vertexShader:vh._linearDepthShader.vertexShader,fragmentShader:vh._linearDepthShader.fragmentShader,blending:0}),this.update(e)}update(e){if(void 0!==(null==e?void 0:e.depthTexture)&&(this.uniforms.tDepth.value=null==e?void 0:e.depthTexture),void 0!==(null==e?void 0:e.camera)){const t=(null==e?void 0:e.camera)||(null==e?void 0:e.camera);this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far}return void 0!==(null==e?void 0:e.depthFilter)&&(this.uniforms.depthFilter.value=null==e?void 0:e.depthFilter),this}}vh._linearDepthShader={uniforms:{tDepth:{value:null},depthFilter:{value:new an(1,0,0,0)},cameraNear:{value:.1},cameraFar:{value:1}},defines:{PERSPECTIVE_CAMERA:1,ALPHA_DEPTH:0},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"uniform sampler2D tDepth;\n uniform vec4 depthFilter;\n uniform float cameraNear;\n uniform float cameraFar;\n varying vec2 vUv;\n \n #include \n \n float getLinearDepth(const in vec2 screenPosition) {\n float fragCoordZ = dot(texture2D(tDepth, screenPosition), depthFilter);\n #if PERSPECTIVE_CAMERA == 1\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return fragCoordZ;\n #endif\n }\n \n void main() {\n float depth = getLinearDepth(vUv);\n gl_FragColor = vec4(vec3(1.0 - depth), 1.0);\n }"};class _h{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const xh=new ea(-1,1,1,-1,0,1),yh=new class extends Ji{constructor(){super(),this.setAttribute("position",new Gi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Gi([0,2,0,0,2,0],2))}};class Sh{constructor(e){this._mesh=new mr(yh,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,xh)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class wh{constructor(e=Math){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.grad4=[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]],this.p=[];for(let t=0;t<256;t++)this.p[t]=Math.floor(256*e.random());this.perm=[];for(let e=0;e<512;e++)this.perm[e]=this.p[255&e];this.simplex=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]}dot(e,t,n){return e[0]*t+e[1]*n}dot3(e,t,n,i){return e[0]*t+e[1]*n+e[2]*i}dot4(e,t,n,i,r){return e[0]*t+e[1]*n+e[2]*i+e[3]*r}noise(e,t){let n,i,r;const a=(e+t)*(.5*(Math.sqrt(3)-1)),s=Math.floor(e+a),o=Math.floor(t+a),l=(3-Math.sqrt(3))/6,c=(s+o)*l,h=e-(s-c),d=t-(o-c);let u,p;h>d?(u=1,p=0):(u=0,p=1);const f=h-u+l,m=d-p+l,g=h-1+2*l,v=d-1+2*l,_=255&s,x=255&o,y=this.perm[_+this.perm[x]]%12,S=this.perm[_+u+this.perm[x+p]]%12,w=this.perm[_+1+this.perm[x+1]]%12;let b=.5-h*h-d*d;b<0?n=0:(b*=b,n=b*b*this.dot(this.grad3[y],h,d));let M=.5-f*f-m*m;M<0?i=0:(M*=M,i=M*M*this.dot(this.grad3[S],f,m));let T=.5-g*g-v*v;return T<0?r=0:(T*=T,r=T*T*this.dot(this.grad3[w],g,v)),70*(n+i+r)}noise3d(e,t,n){let i,r,a,s;const o=(e+t+n)*(1/3),l=Math.floor(e+o),c=Math.floor(t+o),h=Math.floor(n+o),d=1/6,u=(l+c+h)*d,p=e-(l-u),f=t-(c-u),m=n-(h-u);let g,v,_,x,y,S;p>=f?f>=m?(g=1,v=0,_=0,x=1,y=1,S=0):p>=m?(g=1,v=0,_=0,x=1,y=0,S=1):(g=0,v=0,_=1,x=1,y=0,S=1):fS?32:0)+(y>w?16:0)+(S>w?8:0)+(y>b?4:0)+(S>b?2:0)+(w>b?1:0),T=a[M][0]>=3?1:0,E=a[M][1]>=3?1:0,A=a[M][2]>=3?1:0,P=a[M][3]>=3?1:0,R=a[M][0]>=2?1:0,C=a[M][1]>=2?1:0,L=a[M][2]>=2?1:0,D=a[M][3]>=2?1:0,I=a[M][0]>=1?1:0,U=a[M][1]>=1?1:0,O=a[M][2]>=1?1:0,N=a[M][3]>=1?1:0,F=y-T+l,B=S-E+l,z=w-A+l,k=b-P+l,H=y-R+2*l,V=S-C+2*l,G=w-L+2*l,W=b-D+2*l,j=y-I+3*l,X=S-U+3*l,Y=w-O+3*l,q=b-N+3*l,Z=y-1+4*l,K=S-1+4*l,J=w-1+4*l,Q=b-1+4*l,$=255&m,ee=255&g,te=255&v,ne=255&_,ie=s[$+s[ee+s[te+s[ne]]]]%32,re=s[$+T+s[ee+E+s[te+A+s[ne+P]]]]%32,ae=s[$+R+s[ee+C+s[te+L+s[ne+D]]]]%32,se=s[$+I+s[ee+U+s[te+O+s[ne+N]]]]%32,oe=s[$+1+s[ee+1+s[te+1+s[ne+1]]]]%32;let le=.6-y*y-S*S-w*w-b*b;le<0?c=0:(le*=le,c=le*le*this.dot4(r[ie],y,S,w,b));let ce=.6-F*F-B*B-z*z-k*k;ce<0?h=0:(ce*=ce,h=ce*ce*this.dot4(r[re],F,B,z,k));let he=.6-H*H-V*V-G*G-W*W;he<0?d=0:(he*=he,d=he*he*this.dot4(r[ae],H,V,G,W));let de=.6-j*j-X*X-Y*Y-q*q;de<0?u=0:(de*=de,u=de*de*this.dot4(r[se],j,X,Y,q));let ue=.6-Z*Z-K*K-J*J-Q*Q;return ue<0?p=0:(ue*=ue,p=ue*ue*this.dot4(r[oe],Z,K,J,Q)),27*(c+h+d+u+p)}}const bh=new wc,Mh=e=>{const t=new Uint8Array([Math.floor(255*e.r),Math.floor(255*e.g),Math.floor(255*e.b),255]),n=new Vo(t,1,1);return n.needsUpdate=!0,n},Th=(e,t,n)=>{n&&e(Mh(n)),t&&bh.load(t,e)};class Eh{constructor(){this.bounds=new fn(new dn(-1,-1,-1),new dn(1,1,1)),this.size=new dn(2,2,2),this.center=new dn(0,0,0),this.maxSceneDistanceFromCenter=Math.sqrt(3),this.maxSceneDistanceFrom0=Math.sqrt(3)}copyFrom(e){this.bounds.copy(e.bounds),this.size.copy(e.size),this.center.copy(e.center),this.maxSceneDistanceFromCenter=e.maxSceneDistanceFromCenter,this.maxSceneDistanceFrom0=e.maxSceneDistanceFrom0}updateFromObject(e){e.updateMatrixWorld(),this.bounds.setFromObject(e),this.updateFromBox(this.bounds)}updateFromBox(e){this.bounds!==e&&this.bounds.copy(e),this.bounds.getSize(this.size),this.bounds.getCenter(this.center),this.maxSceneDistanceFromCenter=this.size.length()/2,this.maxSceneDistanceFrom0=new dn(Math.max(Math.abs(this.bounds.min.x),Math.abs(this.bounds.max.x)),Math.max(Math.abs(this.bounds.min.y),Math.abs(this.bounds.max.y)),Math.max(Math.abs(this.bounds.min.z),Math.abs(this.bounds.max.z))).length()}updateCameraViewVolumeFromBounds(e){e.updateMatrixWorld();const t=this.bounds.clone().applyMatrix4(e.matrixWorldInverse);e instanceof ea?((e,t)=>{e.left=t.min.x,e.right=t.max.x,e.bottom=t.min.y,e.top=t.max.y,e.near=Math.min(-t.min.z,-t.max.z),e.far=Math.max(-t.min.z,-t.max.z),e.updateProjectionMatrix()})(e,t):e instanceof Ar&&((e,t)=>{const n=Math.min(-t.min.z,-t.max.z),i=Math.max(-t.min.z,-t.max.z);if(n<.001)return;const r=Math.max(Math.abs(t.min.x),Math.abs(t.max.x)),a=Math.max(Math.abs(t.min.y),Math.abs(t.max.y));e.aspect=r/a,e.fov=Ot(2*Math.atan2(a,n)),e.near=n,e.far=i,e.updateProjectionMatrix()})(e,t)}getNearAndFarForPerspectiveCamera(e,t=1){const n=e.clone().sub(this.center).length();return[Math.max(.01,n-this.maxSceneDistanceFromCenter-.01),n+this.maxSceneDistanceFromCenter*t+.01]}}const Ah=e=>e.capabilities.maxSamples;class Ph{changed(e){var t,n;const i=!(null===(t=this._lastCameraProjection)||void 0===t?void 0:t.equals(e.projectionMatrix))||!(null===(n=this._lastCameraWorld)||void 0===n?void 0:n.equals(e.matrixWorld));return this._lastCameraProjection=e.projectionMatrix.clone(),this._lastCameraWorld=e.matrixWorld.clone(),i}}class Rh{constructor(){this._originalClearColor=new Ci,this._originalClearAlpha=0,this._originalAutoClear=!1,this._originalRenderTarget=null,this._screenSpaceQuad=new Sh(void 0),this._emptyScene=new Ao,this._defaultCamera=new Ar}renderWithOverrideMaterial(e,t,n,i,r,a,s){this._backup(e),this._prepareRenderer(e,r,a,s);const o=t.overrideMaterial;t.overrideMaterial=i,e.render(t,n),t.overrideMaterial=o,this._restore(e)}clear(e,t,n,i){this._backup(e),this._prepareRenderer(e,t,n,i),e.render(this._emptyScene,this._defaultCamera),this._restore(e)}render(e,t,n,i,r,a){this._backup(e),this._prepareRenderer(e,i,r,a),e.render(t,n),this._restore(e)}renderScreenSpace(e,t,n,i,r){this._backup(e),this._prepareRenderer(e,n,i,r),this._screenSpaceQuad.material=t,this._screenSpaceQuad.render(e),this._restore(e)}_prepareRenderer(e,t,n,i){e.setRenderTarget(t),e.autoClear=!1,null!=n&&(e.setClearColor(n),e.setClearAlpha(i||0),e.clear())}_backup(e){e.getClearColor(this._originalClearColor),this._originalClearAlpha=e.getClearAlpha(),this._originalAutoClear=e.autoClear,this._originalRenderTarget=e.getRenderTarget()}_restore(e){e.setClearColor(this._originalClearColor),e.setClearAlpha(this._originalClearAlpha),e.setRenderTarget(this._originalRenderTarget),e.autoClear=this._originalAutoClear}}class Ch{constructor(e,t){var n;this._passRenderer=null!==(n=null==t?void 0:t.passRenderer)&&void 0!==n?n:new Rh,this._blurMaterial=new wr(null!=e?e:gh),this._blurMaterial.depthTest=!1}dispose(){this._blurMaterial.dispose()}render(e,t,n,i){this._blurMaterial.uniforms.tDiffuse.value=t[0].texture,this._blurMaterial.uniforms.rangeMin.value.x=n[0],this._blurMaterial.uniforms.rangeMin.value.y=0,this._blurMaterial.uniforms.rangeMax.value.x=i[0],this._blurMaterial.uniforms.rangeMax.value.y=0,this._passRenderer.renderScreenSpace(e,this._blurMaterial,t[1]),this._blurMaterial.uniforms.tDiffuse.value=t[1].texture,this._blurMaterial.uniforms.rangeMin.value.x=0,this._blurMaterial.uniforms.rangeMin.value.y=n[1],this._blurMaterial.uniforms.rangeMax.value.x=0,this._blurMaterial.uniforms.rangeMax.value.y=i[1],this._passRenderer.renderScreenSpace(e,this._blurMaterial,t[2])}}const Lh=e.p+"9ba94fd0181997dfa7e8.png",Dh="OnlyShadow",Ih="Transparent",Uh="Parquet",Oh="Pavement",Nh={},Fh=e=>{let t=Nh[e];if(!t){switch(e){default:t=new Wl;break;case Dh:t=new Gl,t.opacity=.5;break;case Ih:t=new Wl,t.transparent=!0,t.opacity=0;break;case"White":t=new Wl;break;case Uh:{const e=new jl;Th((t=>{Bh(t),e.map=t}),"TexturesCom_Wood_ParquetChevron7_1K_albedo.jpg",new Ci(1,.6,.2)),Th((t=>{Bh(t),e.normalMap=t}),"TexturesCom_Wood_ParquetChevron7_1K_normal.jpg"),Th((t=>{Bh(t),e.roughnessMap=t}),"TexturesCom_Wood_ParquetChevron7_1K_roughness.jpg"),e.aoMapIntensity=0,e.roughness=1,e.metalness=0,e.envMapIntensity=.5,t=e;break}case Oh:{const e=new jl;Th((t=>{Bh(t),e.map=t}),"TexturesCom_Pavement_HerringboneNew_1K_albedo.jpg",new Ci(.6,.3,0)),Th((t=>{Bh(t),e.normalMap=t}),"TexturesCom_Pavement_HerringboneNew_1K_normal.jpg"),Th((t=>{Bh(t),e.roughnessMap=t}),"TexturesCom_Pavement_HerringboneNew_1K_roughness.jpg"),Th((t=>{Bh(t),e.aoMap=t}),"TexturesCom_Pavement_HerringboneNew_1K_ao.jpg"),e.aoMapIntensity=1,e.roughness=1,e.metalness=0,e.envMapIntensity=.5,t=e;break}}Nh[e]=t}return t},Bh=e=>{e.anisotropy=16,e.wrapS=V,e.wrapT=V,e.repeat.set(1e5,1e5)},zh=e=>{const t=Math.atan2(e.y,e.x)/(2*Math.PI)+.5,n=Math.asin(e.z)/Math.PI+.5;return new Nt(t,n)};class kh{get colorRenderTarget(){var e;return this._colorRenderTarget=null!==(e=this._colorRenderTarget)&&void 0!==e?e:new on,this._colorRenderTarget}environmentMapDecodeTarget(e){var t;const n=e.capabilities.isWebGL2?ie:J;return this._environmentMapDecodeTarget=null!==(t=this._environmentMapDecodeTarget)&&void 0!==t?t:new on(1,1,{type:n}),this._environmentMapDecodeTarget}environmentMapDecodeMaterial(e){var t,n;return e?(this._equirectangularDecodeMaterial=null!==(t=this._equirectangularDecodeMaterial)&&void 0!==t?t:new Wh(!0,!1),this._equirectangularDecodeMaterial):(this._pmremDecodeMaterial=null!==(n=this._pmremDecodeMaterial)&&void 0!==n?n:new Wh(!1,!1),this._pmremDecodeMaterial)}get camera(){var e;return this._camera=null!==(e=this._camera)&&void 0!==e?e:new ea(-1,1,1,-1,-1,1),this._camera}scaleTexture(e,t,n,i){var r;this.colorRenderTarget.setSize(n,i),this._planeMesh=null!==(r=this._planeMesh)&&void 0!==r?r:new mr(new Hr(2,2),new Ui({map:t}));const a=e.getRenderTarget();e.setRenderTarget(this.colorRenderTarget),e.render(this._planeMesh,this.camera),e.setRenderTarget(a);const s=this.environmentMapDecodeTarget(e).texture,o=new Uint8Array(n*i*4);return e.readRenderTargetPixels(this.colorRenderTarget,0,0,n,i,o),{texture:s,pixels:o,sRgbaPixels:!1}}newGrayscaleTexture(e,t,n,i){var r;const a=this.environmentMapDecodeMaterial("PMREM.cubeUv"===t.name),s=this.environmentMapDecodeTarget(e);s.setSize(n,i),a.setSourceTexture(t),this._planeMesh=null!==(r=this._planeMesh)&&void 0!==r?r:new mr(new Hr(2,2),a);const o=e.getRenderTarget();e.setRenderTarget(s),e.render(this._planeMesh,this.camera),e.setRenderTarget(o);const l=s.texture,c=s.texture.type===ie,h=c?new Float32Array(n*i*4):new Uint8Array(n*i*4);return e.readRenderTargetPixels(s,0,0,n,i,h),{texture:l,pixels:h,sRgbaPixels:c}}}const Hh={tDiffuse:{value:null}},Vh="\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",Gh="\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n \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\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 ); // pos x\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n }\n return 0.5 * ( uv + 1.0 );\n }\n\n void main() {\n #if PMREM_DECODE == 1\n float altitude = (vUv.y - 0.5) * 3.141593;\n float azimuth = vUv.x * 2.0 * 3.141593;\n vec3 direction = vec3(\n cos(altitude) * cos(azimuth) * -1.0, \n sin(altitude), \n cos(altitude) * sin(azimuth) * -1.0\n );\n float face = getFace(direction);\n vec2 uv = getUV(direction, face) / vec2(3.0, 4.0);\n if (face > 2.5) {\n uv.y += 0.25;\n face -= 3.0;\n }\n uv.x += face / 3.0;\n vec4 color = texture2D(tDiffuse, uv);\n #else\n vec4 color = texture2D(tDiffuse, vUv);\n #endif \n #if GRAYSCALE_CONVERT == 1\n float grayscale = dot(color.rgb, vec3(0.2126, 0.7152, 0.0722));\n //float grayscale = dot(color.rgb, vec3(1.0/3.0));\n gl_FragColor = vec4(vec3(grayscale), 1.0);\n #else\n gl_FragColor = vec4(color.rgb, 1.0);\n #endif\n }";class Wh extends wr{constructor(e,t){super({uniforms:Sr.clone(Hh),vertexShader:Vh,fragmentShader:Gh,defines:{PMREM_DECODE:e?1:0,GRAYSCALE_CONVERT:t?1:0}})}setSourceTexture(e){this.uniforms.tDiffuse.value=e}}class jh{constructor(e){var t,n,i,r;this.samplePoints=[],this.sampleUVs=[],this.grayscaleTexture={texture:new rn,pixels:new Uint8Array(0),sRgbaPixels:!1},this.detectorTexture=new rn,this.detectorArray=new Float32Array(0),this.lightSamples=[],this.lightGraph=new Yh(0),this.lightSources=[],this._grayScale=new dn(.2126,.7152,.0722),this._createEquirectangularSamplePoints=e=>{const t=[];for(let n=0;nzh(e)))}detectLightSources(e,t,n){var i;this.textureData=n,this._textureConverter=null!==(i=this._textureConverter)&&void 0!==i?i:new kh,this.grayscaleTexture=this._textureConverter.newGrayscaleTexture(e,t,this._width,this._height),this.detectorArray=this._redFromRgbaToNormalizedFloatArray(this.grayscaleTexture.pixels,this.grayscaleTexture.sRgbaPixels),this.detectorTexture=this._grayscaleTextureFromFloatArray(this.detectorArray,this._width,this._height),this.lightSamples=this._filterLightSamples(this._sampleThreshold),this.lightGraph=this._findClusterSegments(this.lightSamples,this._sampleThreshold),this.lightGraph.findConnectedComponents(),this.lightSources=this.createLightSourcesFromLightGraph(this.lightSamples,this.lightGraph),this.lightSources.sort(((e,t)=>t.maxIntensity-e.maxIntensity))}_redFromRgbaToNormalizedFloatArray(e,t,n){const i=new Float32Array(e.length/4);let r=1,a=0;for(let t=0;te&&t.push(new Xh(this.samplePoints[n],i))}return t}_detectorTextureLuminanceValueFromUV(e){const t=Math.floor(e.x*this._width),n=Math.floor(e.y*this._height)*this._width+t;return this.detectorArray[n]}_originalLuminanceValueFromUV(e){if(!(this.textureData&&this.textureData.data&&this.textureData._width&&this.textureData._height))return 256*this._detectorTextureLuminanceValueFromUV(e);const t=Math.floor(e.x*this.textureData._width),n=Math.floor(e.y*this.textureData._height);let i=0;for(let e=Math.max(0,t-2);e1){l=!1;break}}else c=0}l&&(r.adjacent[a].push(s),r.adjacent[s].push(a),r.edges.push([a,s]))}return r}createLightSourcesFromLightGraph(e,t){const n=t.components.filter((e=>e.length>1)).map((t=>new qh(t.map((t=>e[t])))));return n.forEach((e=>e.calculateLightSourceProperties((e=>this._originalLuminanceValueFromUV(e))))),n}}class Xh{constructor(e,t){this.position=e,this.uv=t}}class Yh{constructor(e){this.edges=[],this.adjacent=[],this.components=[],this.noOfNodes=e;for(let t=0;tt.length-e.length))}_dfs(e,t,n){t[e]=!0,n.push(e);for(const i of this.adjacent[e])t[i]||this._dfs(i,t,n)}}class qh{constructor(e){this.position=new dn,this.uv=new Nt,this.averageIntensity=0,this.maxIntensity=0,this.size=0,this.lightSamples=e}calculateLightSourceProperties(e){this.position=new dn,this.averageIntensity=0,this.maxIntensity=0;for(const t of this.lightSamples){this.position.add(t.position);const n=e(t.uv);this.averageIntensity+=n,this.maxIntensity=Math.max(this.maxIntensity,n)}this.averageIntensity/=this.lightSamples.length,this.position.normalize(),this.uv=zh(this.position);let t=0;for(const e of this.lightSamples)t+=e.position.distanceTo(this.position);t/=this.lightSamples.length,this.size=t/Math.PI}}class Zh{constructor(e){this._lightSourceDetector=e}static createPlane(e,t){const n=new Hr(2,1),i=null!=t?t:new Ui({color:12632256,side:2}),r=new mr(n,i);return r.position.z=-.1,e.add(r),r}createDebugScene(e,t){this._scene=e,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,t)}_createLightGraphInMap(e,t,n,i){const r=[],a=[];for(let e=0;ee.uv)),o=a.map((e=>e.uv)),l=e.filter((e=>!s.includes(e)&&!o.includes(e)));this._createSamplePointsInMap(l,.005,16711680),this._createSamplePointsInMap(s,.01,255),this._createSamplePointsInMap(o,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const c=this._lightSourceDetector.lightSources.map((e=>e.uv));this._createSamplePointsInMap(c,.015,16776960);let h=this._lightSourceDetector.lightSources;void 0!==i&&i>=0&&i{var t;const n=new mr(i,r);n.position.copy(this._uvToMapPosition(e)),n.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(n)}))}_createCirclesInMap(e,t){const n=new Ui({color:t,transparent:!0,opacity:.5});e.forEach((e=>{var t;const i=new Ol(e.size,8,4),r=new mr(i,n);r.position.copy(this._uvToMapPosition(e.uv)),r.name="samplePoint",null===(t=this._scene)||void 0===t||t.add(r)}))}_createClusterLinesInMap(e,t,n){var i;const r=new tl({color:n}),a=[];t.forEach((t=>{for(let n=1;n.5){const e=(i.y+r.y)/2,t=i.x{(new xc).setResponseType("arraybuffer").load(this._path+e,(e=>{this.parseData_(e),t(this._cubeTexture)}))}))}parseHeader_(e){const t=new DataView(e,0,30);this._size=t.getUint16(0),this._maxLod=t.getUint8(2),this._colorSpace=t.getUint16(3)?rt:it,this._type=t.getUint16(5),this._format=t.getUint16(7),this._lightDirection.x=t.getFloat32(9),this._lightDirection.y=t.getFloat32(13),this._lightDirection.z=t.getFloat32(17)}parseBufferData_(e,t){let n=this._size;const i=Math.log2(this._size)+1;this._cubeTextures=[];for(let r=0;r{t.isMesh&&(e.add(t.geometry),e.add(t.material))}));for(const t of e)t.dispose()}}function id(e){const t=new Ui;return t.color.setScalar(e),t}var rd=Uint8Array,ad=Uint16Array,sd=Int32Array,od=new rd([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ld=new rd([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),cd=new rd([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hd=function(e,t){for(var n=new ad(31),i=0;i<31;++i)n[i]=t+=1<>1|(21845&vd)<<1;_d=(61680&(_d=(52428&_d)>>2|(13107&_d)<<2))>>4|(3855&_d)<<4,gd[vd]=((65280&_d)>>8|(255&_d)<<8)>>1}var xd=function(e,t,n){for(var i=e.length,r=0,a=new ad(t);r>l]=c}else for(s=new ad(i),r=0;r>15-e[r]);return s},yd=new rd(288);for(vd=0;vd<144;++vd)yd[vd]=8;for(vd=144;vd<256;++vd)yd[vd]=9;for(vd=256;vd<280;++vd)yd[vd]=7;for(vd=280;vd<288;++vd)yd[vd]=8;var Sd=new rd(32);for(vd=0;vd<32;++vd)Sd[vd]=5;var wd=xd(yd,9,1),bd=xd(Sd,5,1),Md=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},Td=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},Ed=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Ad=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Pd=function(e,t,n){var i=new Error(t||Ad[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,Pd),!n)throw i;return i},Rd=function(e,t,n,i){var r=e.length,a=i?i.length:0;if(!r||t.f&&!t.l)return n||new rd(0);var s=!n,o=s||2!=t.i,l=t.i;s&&(n=new rd(3*r));var c,h=function(e){var t=n.length;if(e>t){var i=new rd(Math.max(2*t,e));i.set(n),n=i}},d=t.f||0,u=t.p||0,p=t.b||0,f=t.l,m=t.d,g=t.m,v=t.n,_=8*r;do{if(!f){d=Td(e,u,1);var x=Td(e,u+1,3);if(u+=3,!x){var y=e[(c=u,(L=4+((c+7)/8|0))-4)]|e[L-3]<<8,S=L+y;if(S>r){l&&Pd(0);break}o&&h(p+y),n.set(e.subarray(L,S),p),t.b=p+=y,t.p=u=8*S,t.f=d;continue}if(1==x)f=wd,m=bd,g=9,v=5;else if(2==x){var w=Td(e,u,31)+257,b=Td(e,u+10,15)+4,M=w+Td(e,u+5,31)+1;u+=14;for(var T=new rd(M),E=new rd(19),A=0;A>4)<16)T[A++]=L;else{var I=0,U=0;for(16==L?(U=3+Td(e,u,3),u+=2,I=T[A-1]):17==L?(U=3+Td(e,u,7),u+=3):18==L&&(U=11+Td(e,u,127),u+=7);U--;)T[A++]=I}}var O=T.subarray(0,w),N=T.subarray(w);g=Md(O),v=Md(N),f=xd(O,g,1),m=xd(N,v,1)}else Pd(1);if(u>_){l&&Pd(0);break}}o&&h(p+131072);for(var F=(1<>4;if((u+=15&I)>_){l&&Pd(0);break}if(I||Pd(2),k<256)n[p++]=k;else{if(256==k){z=u,f=null;break}var H=k-254;if(k>264){var V=od[A=k-257];H=Td(e,u,(1<>4;if(G||Pd(3),u+=15&G,N=md[W],W>3&&(V=ld[W],N+=Ed(e,u)&(1<_){l&&Pd(0);break}o&&h(p+131072);var j=p+H;if(pe.length)&&(n=e.length),new rd(e.subarray(t,n))}(n,0,p):n.subarray(0,p)},Cd=new rd(0);function Ld(e,t){return Rd(e.subarray((n=e,i=t&&t.dictionary,(8!=(15&n[0])||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Pd(6,"invalid zlib data"),(n[1]>>5&1)==+!i&&Pd(6,"invalid zlib data: "+(32&n[1]?"need":"unexpected")+" dictionary"),2+(n[1]>>3&4)),-4),{i:2},t&&t.out,t&&t.dictionary);var n,i}var Dd="undefined"!=typeof TextDecoder&&new TextDecoder;try{Dd.decode(Cd,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;class Id extends Sc{constructor(e){super(e),this.type=re}parse(e){const t=65536,n=14,i=65537,r=Math.pow(2.7182818,2.2),a={l:0,c:0,lc:0};function s(e,t,n,i,r){for(;n>n&(1<>6}const h={c:0,lc:0};function d(e,t,n,i){e=e<<8|F(n,i),t+=8,h.c=e,h.lc=t}const u={c:0,lc:0};function p(e,t,n,i,r,a,s,o,l){if(e==t){i<8&&(d(n,i,r,a),n=h.c,i=h.lc);let e=n>>(i-=8);if(e=new Uint8Array([e])[0],o.value+e>l)return!1;const t=s[o.value-1];for(;e-- >0;)s[o.value++]=t}else{if(!(o.value32767?t-65536:t}const g={a:0,b:0};function v(e,t){const n=m(e),i=m(t),r=n+(1&i)+(i>>1),a=r,s=r-i;g.a=a,g.b=s}function _(e,t){const n=f(e),i=f(t),r=n-(i>>1)&65535,a=i+r-32768&65535;g.a=a,g.b=r}function x(e,t,n,i,r,a,s){const o=s<16384,l=n>r?r:n;let c,h,d=1;for(;d<=l;)d<<=1;for(d>>=1,c=d,d>>=1;d>=1;){h=0;const s=h+a*(r-c),l=a*d,u=a*c,p=i*d,f=i*c;let m,x,y,S;for(;h<=s;h+=u){let r=h;const a=h+i*(n-c);for(;r<=a;r+=f){const n=r+p,i=r+l,a=i+p;o?(v(e[r+t],e[i+t]),m=g.a,y=g.b,v(e[n+t],e[a+t]),x=g.a,S=g.b,v(m,x),e[r+t]=g.a,e[n+t]=g.b,v(y,S),e[i+t]=g.a,e[a+t]=g.b):(_(e[r+t],e[i+t]),m=g.a,y=g.b,_(e[n+t],e[a+t]),x=g.a,S=g.b,_(m,x),e[r+t]=g.a,e[n+t]=g.b,_(y,S),e[i+t]=g.a,e[a+t]=g.b)}if(n&d){const n=r+l;o?v(e[r+t],e[n+t]):_(e[r+t],e[n+t]),m=g.a,e[n+t]=g.b,e[r+t]=m}}if(r&d){let r=h;const a=h+i*(n-c);for(;r<=a;r+=f){const n=r+p;o?v(e[r+t],e[n+t]):_(e[r+t],e[n+t]),m=g.a,e[n+t]=g.b,e[r+t]=m}}c=d,d>>=1}return h}function y(e,t,r,f,m,g){const v=r.value,_=N(t,r),x=N(t,r);r.value+=4;const y=N(t,r);if(r.value+=4,_<0||_>=i||x<0||x>=i)throw new Error("Something wrong with HUF_ENCSIZE");const S=new Array(i),w=new Array(16384);if(function(e){for(let t=0;t<16384;t++)e[t]={},e[t].len=0,e[t].lit=0,e[t].p=null}(w),function(e,t,n,r,l,c){const h=t;let d=0,u=0;for(;r<=l;r++){if(h.value-t.value>n)return!1;s(6,d,u,e,h);const i=a.l;if(d=a.c,u=a.lc,c[r]=i,63==i){if(h.value-t.value>n)throw new Error("Something wrong with hufUnpackEncTable");s(8,d,u,e,h);let i=a.l+6;if(d=a.c,u=a.lc,r+i>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;i--;)c[r++]=0;r--}else if(i>=59){let e=i-59+2;if(r+e>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;e--;)c[r++]=0;r--}}!function(e){for(let e=0;e<=58;++e)o[e]=0;for(let t=0;t0;--e){const n=t+o[e]>>1;o[e]=t,t=n}for(let t=0;t0&&(e[t]=n|o[n]++<<6)}}(c)}(e,r,f-(r.value-v),_,x,S),y>8*(f-(r.value-v)))throw new Error("Something wrong with hufUncompress");!function(e,t,i,r){for(;t<=i;t++){const i=c(e[t]),a=l(e[t]);if(i>>a)throw new Error("Invalid table entry");if(a>n){const e=r[i>>a-n];if(e.len)throw new Error("Invalid table entry");if(e.lit++,e.p){const t=e.p;e.p=new Array(e.lit);for(let n=0;n0;s--){const s=r[(i<=n;){const a=t[g>>v-n&16383];if(a.len)v-=a.len,p(a.lit,s,g,v,i,r,f,m,_),g=u.c,v=u.lc;else{if(!a.p)throw new Error("hufDecode issues");let t;for(t=0;t=n&&c(e[a.p[t]])==(g>>v-n&(1<>=y,v-=y;v>0;){const e=t[g<a||(t[r++]=e[n++],r>a));)t[r++]=e[i++]}function b(e){let t=e.byteLength;const n=new Array;let i=0;const r=new DataView(e);for(;t>0;){const e=r.getInt8(i++);if(e<0){const a=-e;t-=a+1;for(let e=0;e>8==255?r+=255&i:(n[r]=i,r++),e.value++}function T(e){const t=.5*Math.cos(.7853975),n=.5*Math.cos(3.14159/16),i=.5*Math.cos(3.14159/8),r=.5*Math.cos(3*3.14159/16),a=.5*Math.cos(.981746875),s=.5*Math.cos(3*3.14159/8),o=.5*Math.cos(1.374445625),l=new Array(4),c=new Array(4),h=new Array(4),d=new Array(4);for(let u=0;u<8;++u){const p=8*u;l[0]=i*e[p+2],l[1]=s*e[p+2],l[2]=i*e[p+6],l[3]=s*e[p+6],c[0]=n*e[p+1]+r*e[p+3]+a*e[p+5]+o*e[p+7],c[1]=r*e[p+1]-o*e[p+3]-n*e[p+5]-a*e[p+7],c[2]=a*e[p+1]-n*e[p+3]+o*e[p+5]+r*e[p+7],c[3]=o*e[p+1]-a*e[p+3]+r*e[p+5]-n*e[p+7],h[0]=t*(e[p+0]+e[p+4]),h[3]=t*(e[p+0]-e[p+4]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],d[0]=h[0]+h[1],d[1]=h[3]+h[2],d[2]=h[3]-h[2],d[3]=h[0]-h[1],e[p+0]=d[0]+c[0],e[p+1]=d[1]+c[1],e[p+2]=d[2]+c[2],e[p+3]=d[3]+c[3],e[p+4]=d[3]-c[3],e[p+5]=d[2]-c[2],e[p+6]=d[1]-c[1],e[p+7]=d[0]-c[0]}for(let u=0;u<8;++u)l[0]=i*e[16+u],l[1]=s*e[16+u],l[2]=i*e[48+u],l[3]=s*e[48+u],c[0]=n*e[8+u]+r*e[24+u]+a*e[40+u]+o*e[56+u],c[1]=r*e[8+u]-o*e[24+u]-n*e[40+u]-a*e[56+u],c[2]=a*e[8+u]-n*e[24+u]+o*e[40+u]+r*e[56+u],c[3]=o*e[8+u]-a*e[24+u]+r*e[40+u]-n*e[56+u],h[0]=t*(e[u]+e[32+u]),h[3]=t*(e[u]-e[32+u]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],d[0]=h[0]+h[1],d[1]=h[3]+h[2],d[2]=h[3]-h[2],d[3]=h[0]-h[1],e[0+u]=d[0]+c[0],e[8+u]=d[1]+c[1],e[16+u]=d[2]+c[2],e[24+u]=d[3]+c[3],e[32+u]=d[3]-c[3],e[40+u]=d[2]-c[2],e[48+u]=d[1]-c[1],e[56+u]=d[0]-c[0]}function E(e){for(let t=0;t<64;++t){const n=e[0][t],i=e[1][t],r=e[2][t];e[0][t]=n+1.5747*r,e[1][t]=n-.1873*i-.4682*r,e[2][t]=n+1.8556*i}}function A(e,t,n){for(let a=0;a<64;++a)t[n+a]=Fi.toHalfFloat((i=e[a])<=1?Math.sign(i)*Math.pow(Math.abs(i),2.2):Math.sign(i)*Math.pow(r,Math.abs(i)-1));var i}function P(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function R(e){const t=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),n=new Uint8Array(b(t)),i=new Uint8Array(n.length);return S(n),w(n,i),new DataView(i.buffer)}function C(e){const t=Ld(e.array.slice(e.offset.value,e.offset.value+e.size)),n=new Uint8Array(t.length);return S(t),w(t,n),new DataView(n.buffer)}function L(e){const n=e.viewer,i={value:e.offset.value},r=new Uint16Array(e.columns*e.lines*(e.inputChannels.length*e.type)),a=new Uint8Array(8192);let s=0;const o=new Array(e.inputChannels.length);for(let t=0,n=e.inputChannels.length;t=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(l<=c)for(let e=0;e>3]&1<<(7&r))&&(n[i++]=r);const r=i-1;for(;i0;){const e=U(t.buffer,n),i=B(t,n),r=i>>2&3,o=new Int8Array([(i>>4)-1])[0],l=B(t,n);a.push({name:e,index:o,type:l,compression:r}),s-=e.length+3}const o=Q.channels,l=new Array(e.inputChannels.length);for(let t=0;t=0&&(c.idx[i.index]=t),e.offset=t)}}let h,d,u;if(r.acCompressedSize>0)switch(r.acCompression){case 0:h=new Uint16Array(r.totalAcUncompressedCount),y(e.array,t,n,r.acCompressedSize,h,r.totalAcUncompressedCount);break;case 1:const i=Ld(e.array.slice(n.value,n.value+r.totalAcUncompressedCount));h=new Uint16Array(i.buffer),n.value+=r.totalAcUncompressedCount}if(r.dcCompressedSize>0){const t={array:e.array,offset:n,size:r.dcCompressedSize};d=new Uint16Array(C(t).buffer),n.value+=r.dcCompressedSize}r.rleRawSize>0&&(u=b(Ld(e.array.slice(n.value,n.value+r.rleCompressedSize)).buffer),n.value+=r.rleCompressedSize);let p=0;const f=new Array(l.length);for(let e=0;e>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:Math.pow(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}function G(e,t){const n=e.getUint16(t.value,!0);return t.value+=2,n}function W(e,t){return V(G(e,t))}function j(e,t,n,i,r){return"string"===i||"stringvector"===i||"iccProfile"===i?function(e,t,n){const i=(new TextDecoder).decode(new Uint8Array(e).slice(t.value,t.value+n));return t.value=t.value+n,i}(t,n,r):"chlist"===i?function(e,t,n,i){const r=n.value,a=[];for(;n.value>4]}}(e,n):"lineOrder"===i?function(e,t){return["INCREASING_Y","DECREASING_Y","RANDOM_Y"][B(e,t)]}(e,n):"float"===i?k(e,n):"v2f"===i?function(e,t){return[k(e,t),k(e,t)]}(e,n):"v3f"===i?function(e,t){return[k(e,t),k(e,t),k(e,t)]}(e,n):"int"===i?O(e,n):"rational"===i?function(e,t){return[O(e,t),N(e,t)]}(e,n):"timecode"===i?function(e,t){return[N(e,t),N(e,t)]}(e,n):"preview"===i?(n.value+=r,"skipped"):void(n.value+=r)}function X(e,t,n,i){const r=new Array(e);for(let a=0;ae.width?e.width-a:e.blockWidth,e.lines=s+e.blockHeight>e.height?e.height-s:e.blockHeight;const o=e.columns*e.totalBytes,l=e.sizee.height?e.height-r:e.blockHeight;const a=e.columns*e.totalBytes,s=e.size=e.height)continue;const l=t*a,c=(e.height-1-o)*e.outLineWidth;for(let t=0;te:a.scanOrder=e=>a.height-1-e,4==a.outputChannels?(a.format=de,a.colorSpace=rt):(a.format=ge,a.colorSpace=nt),e.spec.singleTile){a.blockHeight=e.tiles.ySize,a.blockWidth=e.tiles.xSize;const n=function(e,t,n){let i=0;switch(e.levelMode){case"ONE_LEVEL":i=1;break;case"MIPMAP_LEVELS":i=function(e,t){const n=Math.log2(e);return"ROUND_DOWN"==t?Math.floor(n):Math.ceil(n)}(Math.max(t,n),e.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return i}(e.tiles,a.width,a.height),r=X(n,a.width,e.tiles.xSize,e.tiles.roundingMode),s=X(n,a.height,e.tiles.ySize,e.tiles.roundingMode);a.tileCount=r[0]*s[0];for(let e=0;e(r=o.indexOf("\n"))&&a=e.byteLength||!(l=n(e)))&&t(1,"no header found"),(c=l.match(/^#\?(\S+)/))||t(3,"bad initial token"),o.valid|=1,o.programtype=c[1],o.string+=l+"\n";l=n(e),!1!==l;)if(o.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(i))&&(o.gamma=parseFloat(c[1])),(c=l.match(r))&&(o.exposure=parseFloat(c[1])),(c=l.match(a))&&(o.valid|=2,o.format=c[1]),(c=l.match(s))&&(o.valid|=4,o.height=parseInt(c[1],10),o.width=parseInt(c[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=l+"\n";return 2&o.valid||t(3,"missing format specifier"),4&o.valid||t(3,"missing image size specifier"),o}(a),o=s.width,l=s.height,c=function(e,n,i){const r=n;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");const a=new Uint8Array(4*n*i);a.length||t(4,"unable to allocate buffer space");let s=0,o=0;const l=4*r,c=new Uint8Array(4),h=new Uint8Array(l);let d=i;for(;d>0&&oe.byteLength&&t(1),c[0]=e[o++],c[1]=e[o++],c[2]=e[o++],c[3]=e[o++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||t(3,"bad rgbe scanline format");let n,i=0;for(;i128;if(r&&(n-=128),(0===n||i+n>l)&&t(3,"bad scanline data"),r){const t=e[o++];for(let e=0;e0?this.environmentName:r),s=this.currentEnvironment!==a;return this.showBackground=null!==(i=null==t?void 0:t.showEnvironment)&&void 0!==i&&i,this.currentEnvironment=a,this.currentEnvironment&&(null==t?void 0:t.environmentRotation)&&(this.currentEnvironment.rotation=t.environmentRotation),this.currentEnvironment&&(null==t?void 0:t.environmentIntensity)&&(this.currentEnvironment.intensity=t.environmentIntensity),e.userData.showEnvironmentBackground=this.showBackground,e.userData.environmentDefinition=this.currentEnvironment,s}loadDefaultEnvironment(e,t,n){var i;const r=null!=n?n:"room environment",a=null!==(i=t&&t())&&void 0!==i?i:new Od;this.environemtMap.set(r,new ed(a)),e&&(this.environmentName=r),this.updateUI()}loadEnvmap(e,t,n){this.loadAndSetCubeTexture((t=>{this.environemtMap.set(e,new ed(t)),n&&(this.environmentName=e),this.updateUI()}),t)}loadExr(e,t,n){this.loadExrAndSetTexture(((t,i)=>{this.environemtMap.set(e,new ed(t,{textureData:i})),n&&(this.environmentName=e),this.updateUI()}),t)}loadHdr(e,t,n){this.loadHdrAndSetTexture(((t,i)=>{this.environemtMap.set(e,new ed(t,{textureData:i})),n&&(this.environmentName=e),this.updateUI()}),t)}loadAndSetCubeTexture(e,t){t&&(this.envMapReader||(this.envMapReader=new td),this.envMapReader.load(t).then((t=>{t&&e(t)})))}loadExrAndSetTexture(e,t){t&&(this.exrLoader||(this.exrLoader=new Id),this.exrLoader.load(t,((t,n)=>{e(t,n)})))}loadHdrAndSetTexture(e,t){t&&(this.rgbeLoader||(this.rgbeLoader=new Ud),this.rgbeLoader.load(t,((t,n)=>{e(t,n)})))}addGUI(e){this.uiFolder=e,this.updateUI()}updateUI(){if(this.uiFolder){const e=Array.from(this.environemtMap.keys());if(this.environmentController){let t="";e.forEach((e=>{t+=``})),this.environmentController.domElement.children[0].innerHTML=t,this.environmentController.setValue(this.environmentName),this.environmentController.updateDisplay()}else this.environmentController=this.uiFolder.add(this,"environmentName",e)}}}class Fd extends mr{constructor(){const e=Fd.SkyShader,t=new wr({name:e.name,uniforms:Sr.clone(e.uniforms),vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,side:1,depthWrite:!1});super(new vr(1,1,1),t),this.isSky=!0}}Fd.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new dn},up:{value:new dn(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPosition );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t}"};class Bd{constructor(e){this.sky=new Fd,this.sky.name="Sky",this.parameters=Object.assign({visible:!0,distance:4e5,turbidity:10,rayleigh:2,mieCoefficient:.005,mieDirectionalG:.8,inclination:.6,azimuth:0},e),this.updateSky()}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}updateSky(){this.sky.scale.setScalar(45e4),this.sky.frustumCulled=!1,this.sky.material.uniforms.turbidity.value=this.parameters.turbidity,this.sky.material.uniforms.rayleigh.value=this.parameters.rayleigh,this.sky.material.uniforms.mieCoefficient.value=this.parameters.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.parameters.mieDirectionalG;const e=(t=this.parameters.distance,n=this.parameters.azimuth,i=this.parameters.inclination,(new dn).setFromSphericalCoords(t,Math.PI*(1-i),2*Math.PI*(1-n)));var t,n,i;this.sky.material.uniforms.sunPosition.value.copy(e),this.sky.visible=this.parameters.visible}addToScene(e){e.add(this.sky)}changeVisibility(e){this.parameters.visible!==e&&(this.updateParameters({visible:e}),this.updateSky())}}const zd="None",kd="GridPaper",Hd="Concrete",Vd="Marble",Gd="Granite",Wd="VorocracksMarble",jd="Kraft",Xd="Line",Yd="Test";class qd{get isSet(){return this.parameters.backgroundType!==zd}constructor(e){this._materialMap=new Map;const t=new Ji;t.setAttribute("position",new Gi([-1,3,0,-1,-1,0,3,-1,0],3)),t.setAttribute("uv",new Gi([0,2,0,0,2,0],2)),this.backgroundMesh=new mr(t),this.backgroundMesh.name="Background",this.parameters=Object.assign({visible:!1,backgroundType:zd},e),this.updateBackground()}_updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}updateBackground(){this.backgroundMesh.visible=this.parameters.backgroundType!==zd,this.backgroundMaterial=this._getMaterial(),this.backgroundMesh.material=this.backgroundMaterial}update(e,t,n){this.backgroundMesh.visible&&this.backgroundMaterial&&(this.backgroundMaterial.uniforms.viewMatrixInverse.value.copy(n.matrixWorld),this.backgroundMaterial.uniforms.projectionMatrixInverse.value.copy(n.projectionMatrixInverse),this.backgroundMaterial.uniforms.iResolution.value.set(e,t))}addToScene(e){this.backgroundMesh!==e&&e.add(this.backgroundMesh)}hideBackground(){this.parameters.backgroundType!==zd&&(this.parameters.backgroundType=zd,this.updateBackground())}_getMaterial(){let e=this._materialMap.get(this.parameters.backgroundType);if(e)return e;let t=Kd,n={};switch(this.parameters.backgroundType){default:break;case Yd:t=Kd;break;case kd:t=Jd;break;case Hd:t=Qd,n={patternChoice:1};break;case Vd:t=Qd,n={patternChoice:3};break;case Gd:t=Qd,n={patternChoice:6};break;case Wd:t=$d;break;case jd:t=eu;break;case Xd:t=tu}return e=new wr({name:"BackgroundShader",vertexShader:Zd,fragmentShader:t,defines:n,uniforms:{viewMatrixInverse:{value:new Hn},projectionMatrixInverse:{value:new Hn},scale:{value:8},iResolution:{value:new Nt(1024,1024)}},side:2,depthWrite:!1}),this._materialMap.set(this.parameters.backgroundType,e),e}}const Zd="varying vec2 vertexUv;\nuniform mat4 viewMatrixInverse;\nuniform mat4 projectionMatrixInverse;\nuniform float scale;\n\nvoid main() {\n vec4 p = viewMatrixInverse * projectionMatrixInverse * vec4(position.xy, 0.0, 1.0);\n vertexUv = (p.xz / p.w * 0.5 + 0.5) / scale; \n gl_Position = vec4(position.xy, 1.0, 1.0);\n}",Kd="varying vec2 vertexUv;\nvoid main() {\n vec2 uv = fract(vertexUv);\n gl_FragColor = vec4(uv.x, uv.y, (1.0-uv.x) * (1.0 - uv.y), 1.0);\n}",Jd="varying vec2 vertexUv;\nuniform vec2 iResolution;\nfloat nsin(float a)\n{\n return (sin(a)+1.)/2.;\n}\nfloat rand(float n)\n{\n \treturn fract(cos(n*89.42)*343.42);\n}\nvec2 rand(vec2 n)\n{\n \treturn vec2(rand(n.x*23.62-300.0+n.y*34.35),rand(n.x*45.13+256.0+n.y*38.89)); \n}\n\n// returns (dx, dy, distance)\nvec3 worley(vec2 n,float s)\n{\n vec3 ret = vec3(s * 10.);\n // look in 9 cells (n, plus 8 surrounding)\n for(int x = -1;x<2;x++)\n {\n for(int y = -1;y<2;y++)\n {\n vec2 xy = vec2(x,y);// xy can be thought of as both # of cells distance to n, and \n vec2 cellIndex = floor(n/s) + xy;\n vec2 worleyPoint = rand(cellIndex);// random point in this cell (0-1)\n worleyPoint += xy - fract(n/s);// turn it into distance to n. ;\n float d = length(worleyPoint) * s;\n if(d < ret.z)\n ret = vec3(worleyPoint, d);\n }\n }\n return ret;\n}\n\nvec2 mouse = vec2(1.);// how do i initialize this??\n\nvec4 applyLighting(vec4 inpColor, vec2 uv, vec3 normal, vec3 LightPos, vec4 LightColor, vec4 AmbientColor)\n{\n // if(distance(uv.xy, LightPos.xy) < 0.01) return vec4(1.,0.,0.,1.);\n vec3 LightDir = vec3(LightPos.xy - uv, LightPos.z);\n vec3 N = normalize(normal);\n vec3 L = normalize(LightDir);\n vec3 Diffuse = (LightColor.rgb * LightColor.a) * max(dot(N, L), 0.0);\n vec3 Ambient = AmbientColor.rgb * AmbientColor.a;\n vec3 Intensity = Ambient + Diffuse;\n vec3 FinalColor = inpColor.rgb * Intensity;\n return vec4(FinalColor, inpColor.a);\n}\n\n// convert distance to alpha value (see https://www.shadertoy.com/view/ltBGzt)\nfloat dtoa(float d)\n{\n const float amount = 800.0;\n return clamp(1.0 / (clamp(d, 1.0/amount, 1.0)*amount), 0.,1.);\n}\n\n// distance to edge of grid line. real distance, and centered over its position.\nfloat grid_d(vec2 uv, vec2 gridSize, float gridLineWidth)\n{\n uv += gridLineWidth / 2.0;\n uv = mod(uv, gridSize);\n vec2 halfRemainingSpace = (gridSize - gridLineWidth) / 2.0;\n uv -= halfRemainingSpace + gridLineWidth;\n uv = abs(uv);\n uv = -(uv - halfRemainingSpace);\n return min(uv.x, uv.y);\n}\n// centered over lineposy\nfloat hline_d(vec2 uv, float lineposy, float lineWidth)\n{\n\treturn distance(uv.y, lineposy) - (lineWidth / 2.0);\n}\n// centered over lineposx\nfloat vline_d(vec2 uv, float lineposx, float lineWidth)\n{\n\treturn distance(uv.x, lineposx) - (lineWidth / 2.0);\n}\nfloat circle_d(vec2 uv, vec2 center, float radius)\n{\n\treturn length(uv - center) - radius;\n}\n\n// not exactly perfectly perfect, but darn close\nfloat pointRectDist(vec2 p, vec2 rectTL, vec2 rectBR)\n{\n float dx = max(max(rectTL.x - p.x, 0.), p.x - rectBR.x);\n float dy = max(max(rectTL.y - p.y, 0.), p.y - rectBR.y);\n return max(dx, dy);\n}\n\n\nvec2 getuv(vec2 fragCoord, vec2 newTL, vec2 newSize, out float distanceToVisibleArea, out float vignetteAmt)\n{\n vec2 ret = vec2(fragCoord.x / iResolution.x, (iResolution.y - fragCoord.y) / iResolution.y);// ret is now 0-1 in both dimensions\n \n // warp\n //ret = tvWarp(ret / 2.) * 2.;// scale it by 2.\n distanceToVisibleArea = pointRectDist(ret, vec2(0.0), vec2(1.));\n\n // vignette\n vec2 vignetteCenter = vec2(0.5, 0.5);\n\tvignetteAmt = 1.0 - distance(ret, vignetteCenter);\n vignetteAmt = 0.03 + pow(vignetteAmt, .25);// strength\n vignetteAmt = clamp(vignetteAmt, 0.,1.);\n \n \n ret *= newSize;// scale up to new dimensions\n float aspect = iResolution.x / iResolution.y;\n ret.x *= aspect;// orig aspect ratio\n float newWidth = newSize.x * aspect;\n return ret + vec2(newTL.x - (newWidth - newSize.x) / 2.0, newTL.y);\n}\n\nvec4 drawHole(vec4 inpColor, vec2 uv, vec2 pos)\n{\n vec4 circleWhiteColor = vec4(vec3(0.95), 1.);\n\tfloat d = circle_d(uv, pos, 0.055);\n return vec4(mix(inpColor.rgb, circleWhiteColor.rgb, circleWhiteColor.a * dtoa(d)), 1.);\n}\n\nvoid main()\n{\n vec4 fragColor;\n vec2 fragCoord = vertexUv.xy * iResolution.yy;\n float distanceToVisibleArea;\n float vignetteAmt;\n\tvec2 uv = getuv(fragCoord, vec2(-1.,1.), vec2(2., -2.), distanceToVisibleArea, vignetteAmt);\n float throwaway;\n //mouse = getuv(iMouse.xy, vec2(-1.,1.), vec2(2., -2.), throwaway, throwaway);\n\n fragColor = vec4(0.94, 0.96, 0.78, 1.0);// background\n float d;\n \n // grid\n vec4 gridColor = vec4(0.2,0.4,.9, 0.35);\n\td = grid_d(uv, vec2(0.10), 0.001);\n\tfragColor = vec4(mix(fragColor.rgb, gridColor.rgb, gridColor.a * dtoa(d)), 1.);\n \n // red h line\n //vec4 hlineColor = vec4(0.8,0.,.2, 0.55);\n\t//d = hline_d(uv, 0.60, 0.003);\n\t//fragColor = vec4(mix(fragColor.rgb, hlineColor.rgb, hlineColor.a * dtoa(d)), 1.);\n \n // red v line\n //vec4 vlineColor = vec4(0.8,0.,.2, 0.55);\n\t//d = vline_d(uv, -1.40, 0.003);\n\t//fragColor = vec4(mix(fragColor.rgb, vlineColor.rgb, vlineColor.a * dtoa(d)), 1.);\n\n \n // fractal worley crumpled paper effect\n float wsize = 0.8;\n const int iterationCount = 6;\n vec2 normal = vec2(0.);\n float influenceFactor = 1.0;\n for(int i = 0; i < iterationCount; ++ i)\n {\n vec3 w = worley(uv, wsize);\n\t\tnormal.xy += influenceFactor * w.xy;\n wsize *= 0.5;\n influenceFactor *= 0.9;\n }\n \n // lighting\n //vec3 lightPos = vec3(mouse, 8.);\n //vec4 lightColor = vec4(vec3(0.99),0.6);\n //vec4 ambientColor = vec4(vec3(0.99),0.5);\n\t//fragColor = applyLighting(fragColor, uv, vec3(normal, 4.0), lightPos, lightColor, ambientColor);\n\n // white circles\n //fragColor = drawHole(fragColor, uv, vec2(-1.6, 0.2));\n\t//fragColor = drawHole(fragColor, uv, vec2(-1.6, -.7));\n \n // post effects\n\t//fragColor.rgb *= vignetteAmt;\n gl_FragColor = fragColor;\n}",Qd="varying vec2 vertexUv;\nuniform vec2 iResolution;\nuniform float iTime;\n\n// Solid Colors\nvec3 red = vec3(1.0,0.0,0.0);\nvec3 green = vec3(0.0,1.0,0.0);\nvec3 blue = vec3(0.0,0.0,1.0);\nvec3 black = vec3(0.0,0.0,0.0);\nvec3 white = vec3(1.0,1.0,1.0);\n// Concrete\nvec3 concreteLite = vec3(0.909, 0.905, 0.917);\nvec3 concreteDark = vec3(0.760, 0.729, 0.647);\n// Lava\nvec3 lavaLite = vec3(0.686, 0.203, 0.160);\nvec3 lavaDark = vec3(0.580, 0.176, 0.117);\n// Marble\nvec3 marbleLite = vec3(0.988, 0.988, 0.988);\nvec3 marbleStainBlue1 = vec3(0.690, 0.760, 0.811);\nvec3 marbleStainBlue2 = vec3(0.647, 0.745, 0.803);\nvec3 marbleStainBlue3 = vec3(0.654, 0.756, 0.772);\n// Lava Lamp\nvec3 lavaLampBG = vec3(0.462, 0.266, 0.6);\nvec3 lavaLampLava = vec3(0.929, 0.203, 0.572);\n// Clouds\nvec3 sky = vec3(0.541, 0.729, 0.827);\nvec3 cloud = vec3(0.941, 0.945, 0.941);\n// Granite\nvec3 graniteBG = vec3(0.956, 0.952, 0.976);\nvec3 graniteGray = vec3(0.478, 0.474, 0.494);\nvec3 graniteBrown = vec3(0.4, 0.356, 0.341);\nvec3 graniteBlack = vec3(0.105, 0.121, 0.160);\n\n// Tartan\nvec3 tar1Blue = vec3(0.074, 0.349, 0.505);\nvec3 tar1Green = vec3(0.286, 0.541, 0.341);\nvec3 tar1White = vec3(1.0,1.0,1.0);\nvec3 tar1Black = vec3(0.0,0.0,0.0);\nvec3 tar1BG = vec3(0.062, 0.274, 0.109);\n\n// Tartan 2\nvec3 tar2BG = vec3(0.152, 0.160, 0.156);\nvec3 tar2Blue = vec3(0.176, 0.501, 0.674);\nvec3 tar2Orange = vec3(0.603, 0.407, 0.309);\n\n// Art Installation\nvec3 violet = vec3(0.662, 0.407, 0.870);\nvec3 yellow = vec3(0.968, 0.752, 0.556);\n\n\nfloat random (in vec2 uv) {\n return fract(sin(dot(uv.xy,\n vec2(12.9898,78.233)))*\n 43758.5453123);\n}\n\n// Based on Morgan McGuire @morgan3d\n// https://www.shadertoy.com/view/4dS3Wd\nfloat noise (in vec2 uv) {\n vec2 i = floor(uv);\n vec2 f = fract(uv);\n\n // Four corners in 2D of a tile\n float a = random(i);\n float b = random(i + vec2(1.0, 0.0));\n float c = random(i + vec2(0.0, 1.0));\n float d = random(i + vec2(1.0, 1.0));\n\n vec2 u = f * f * (3.0 - 2.0 * f);\n\n return mix(a, b, u.x) +\n (c - a)* u.y * (1.0 - u.x) +\n (d - b) * u.x * u.y;\n}\n\n#define OCTAVES 6\nfloat fbm (in vec2 uv) {\n // Initial values\n float value = 0.0;\n float amplitud = .5;\n float frequency = 0.;\n //\n // Loop of octaves\n for (int i = 0; i < OCTAVES; i++) {\n value += amplitud * noise(uv);\n uv *= 2.;\n amplitud *= .5;\n }\n return value;\n}\n\n// Simplex noise\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); }\n\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n vec2 i = floor(v + dot(v, C.yy) );\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod289(i); // Avoid truncation effects in permutation\n vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))\n + i.x + vec3(0.0, i1.x, 1.0 ));\n\n vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\n m = m*m ;\n m = m*m ;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nfloat lavaLamp(vec2 uv,vec2 shapePos, float times){\n shapePos = vec2(shapePos.x*1.5,shapePos.y*0.3);\n uv -= shapePos;\n \n float angle = atan(uv.y,uv.x);\n float radius = cos(times*angle*0.5);\n return radius;\n}\n\nvec4 rectangle(vec2 uv, vec2 pos, float width, float height, vec3 color) {\n\tfloat t = 0.0;\n\tif ((uv.x > pos.x - width / 2.0) && (uv.x < pos.x + width / 2.0)\n\t\t&& (uv.y > pos.y - height / 2.0) && (uv.y < pos.y + height / 2.0)) {\n\t\tt = 1.0;\n\t}\n\treturn vec4(color, t);\n}\n\nvoid main()\n{\n vec4 fragColor;\n vec2 fragCoord = vertexUv.xy * iResolution.yy;\n\tvec2 uv = fragCoord.xy / iResolution.xy;\n\tfloat ratio = iResolution.x/iResolution.y;\n uv.x *= ratio;\n \n if (patternChoice == 1) // Concrete\n {\n vec3 value = concreteLite;\n \n value = mix(value, concreteDark,random(uv)*0.6);\n value = mix(value, black, random(uv)*0.35);\n \n vec3 stains = vec3(fbm((uv*5.)*2.))*.12;\n \n value = mix(value, concreteLite,(smoothstep(0.03,.12,stains) - smoothstep(.2,.3,stains))*0.3);\n \n\t fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 2) // Lava\n {\n\t\tvec3 value = black;\n \n vec3 stains = vec3(fbm((uv*1.7)*25.))*.75;\n \n float fade = sin(iTime * 5.)+2.5;\n \n value = mix(value, lavaLite, (smoothstep(0.05,0.1,stains) - smoothstep(.17, .22,stains) * fade));\n \n fragColor = vec4(value,1.0);\n }\n \n else if (patternChoice == 3) // Marble\n {\n vec3 value = marbleLite;\n \n vec3 stains = vec3(fbm((uv*1.2)*18.))*.113;\n vec3 stains2 = vec3(fbm((uv*5.)*1.5))*.12;\n \n vec3 stains3 = vec3(fbm((uv)*5.))*.12;\n vec3 stains4 = vec3(fbm((uv*2.)*2.5))*.12;\n \n value = mix(value, marbleStainBlue1,(smoothstep(0.065,0.1,stains) - smoothstep(0.1, 0.8,stains)));\n //value = mix(value, marbleStainBlue2,(smoothstep(0.065,0.1,stains2) - smoothstep(0.1, 0.8,stains2)));\n //value = mix(value, marbleStainBlue3,(smoothstep(0.09,0.1,stains2) - smoothstep(0.2, 0.5,stains2)));\n //value = mix(value, marbleStainBlue2,(smoothstep(0.07,0.1,stains3) - smoothstep(0.1, 0.8,stains3)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 4) // Lava Lamp\n {\n //float value = lavaLamp(uv,vec2(0.,0.5), 3.);\n //vec2 value = vec2(snoise(uv*3.-iTime));\n \t//vec3 color = red*vec3(value, 1.0);\n \n vec3 value = lavaLampBG;\n float lava = lavaLamp(uv*0.5,vec2(snoise(uv*4.-iTime)), 1.);\n \n vec3 color = lavaLampLava*lava;\n value += color;\n \n \n fragColor = vec4(value, 1.0);\n }\n \t\n else if (patternChoice == 5) // Clouds\n {\n uv *= 0.5;\n vec3 value = sky;\n \n vec3 clouds = vec3(fbm((uv*sin(iTime*0.25))*20.))*.12;\n \n value = mix(value, cloud,(smoothstep(0.05,0.1,clouds) - smoothstep(0.1, 0.2,clouds)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 6) // Granite\n {\n \tvec3 value = graniteBG;\n \n uv *= 2.;\n uv += 2.3;\n vec3 layer1 = vec3(fbm((uv*0.6)*18.))*.113;\n uv *= 0.2;\n uv += 0.5;\n vec3 layer2 = vec3(fbm((uv*0.8)*30.))*.117;\n uv *= 2.2;\n uv += 2.5;\n vec3 layer3 = vec3(fbm((uv*0.4)*15.))*.12;\n \n value = mix(value, graniteBlack,(smoothstep(0.04,0.1,layer1) - smoothstep(0.1, 0.8,layer1)));\n value = mix(value, graniteBrown,(smoothstep(0.04,0.1,layer2) - smoothstep(0.1, 0.8,layer2)));\n value = mix(value, graniteGray,(smoothstep(0.072,0.1,layer3) - smoothstep(0.1, 0.8,layer3)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 7) // Scottish Tartan 1\n {\n vec3 value = tar1BG; \n \n uv *= 2.;\n \tuv = fract(uv);\n \n float blackTile = 0.;\n float greenTile = 0.;\n float blueTile = 0.;\n float whiteTile = 0.;\n \n // Blue blocks\n // Horizontal\n \tblueTile += step(0.15, uv.x) - step(0.35, uv.x);\n \tblueTile += step(0.65, uv.x) - step(0.85, uv.x);\n // Vertical\n blueTile += step(0.15, uv.y) - step(0.35, uv.y);\n blueTile += step(0.68, uv.y) - step(0.85, uv.y);\n \n // White lines\n // Vertical\n whiteTile += step(0.0001, uv.x) - step(0.02, uv.x);\n whiteTile += step(0.49, uv.x) - step(0.51, uv.x);\n // Horizontal\n whiteTile += step(0.220, uv.y) - step(0.245, uv.y);\n \twhiteTile += step(0.755, uv.y) - step(0.775, uv.y);\n \n // Black lines\n // Vertical\n blackTile += step(0.10, uv.x) - step(0.11, uv.x);\n blackTile += step(0.12, uv.x) - step(0.13, uv.x);\n blackTile += step(0.14, uv.x) - step(0.15, uv.x);\n blackTile += step(0.18, uv.x) - step(0.19, uv.x);\n blackTile += step(0.2, uv.x) - step(0.21, uv.x);\n blackTile += step(0.29, uv.x) - step(0.3, uv.x);\n blackTile += step(0.31, uv.x) - step(0.32, uv.x);\n blackTile += step(0.35, uv.x) - step(0.36, uv.x);\n blackTile += step(0.37, uv.x) - step(0.38, uv.x);\n blackTile += step(0.39, uv.x) - step(0.4, uv.x);\n blackTile += step(0.59, uv.x) - step(0.6, uv.x);\n blackTile += step(0.61, uv.x) - step(0.62, uv.x);\n blackTile += step(0.63, uv.x) - step(0.64, uv.x);\n blackTile += step(0.68, uv.x) - step(0.69, uv.x);\n blackTile += step(0.7, uv.x) - step(0.71, uv.x);\n blackTile += step(0.77, uv.x) - step(0.78, uv.x);\n blackTile += step(0.8, uv.x) - step(0.81, uv.x);\n blackTile += step(0.85, uv.x) - step(0.86, uv.x);\n blackTile += step(0.87, uv.x) - step(0.88, uv.x);\n blackTile += step(0.89, uv.x) - step(0.9, uv.x);\n // Horizontal\n blackTile += step(0.07, uv.y) - step(0.08, uv.y);\n blackTile += step(0.05, uv.y) - step(0.06, uv.y);\n blackTile += step(0.39, uv.y) - step(0.4, uv.y);\n blackTile += step(0.41, uv.y) - step(0.42, uv.y);\n blackTile += step(0.59, uv.y) - step(0.6, uv.y);\n blackTile += step(0.61, uv.y) - step(0.62, uv.y);\n blackTile += step(0.90, uv.y) - step(0.91, uv.y);\n blackTile += step(0.92, uv.y) - step(0.93, uv.y);\n \n // Apply\n value = mix(value, tar1Blue, vec3(blueTile * noise(uv* 1000.)));\n value = mix(value, tar1White, vec3(whiteTile * noise(uv * 200.)));\n value = mix(value, tar1Black, vec3(blackTile * noise(uv * 200.)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 8) // Scottish Tartan 2\n {\n vec3 value = tar2BG; \n \n uv *= 2.;\n \tuv = fract(uv);\n \n float blackTile = 0.;\n float greenTile = 0.;\n float blueTile = 0.;\n float orangeTile = 0.;\n \n // Blue blocks\n // Horizontal\n \tblueTile += step(0.15, uv.x) - step(0.35, uv.x);\n \tblueTile += step(0.65, uv.x) - step(0.85, uv.x);\n // Vertical\n blueTile += step(0.15, uv.y) - step(0.35, uv.y);\n blueTile += step(0.68, uv.y) - step(0.85, uv.y);\n \n // Orange lines\n // Vertical\n orangeTile += step(0.0001, uv.x) - step(0.02, uv.x);\n orangeTile += step(0.49, uv.x) - step(0.51, uv.x);\n orangeTile += step(0.04, uv.x) - step(0.05, uv.x);\n orangeTile += step(0.97, uv.x) - step(0.98, uv.x);\n orangeTile += step(0.46, uv.x) - step(0.47, uv.x);\n orangeTile += step(0.53, uv.x) - step(0.54, uv.x);\n // Horizontal\n orangeTile += step(0.220, uv.y) - step(0.245, uv.y);\n \torangeTile += step(0.755, uv.y) - step(0.775, uv.y);\n orangeTile += step(0.200, uv.y) - step(0.210, uv.y);\n orangeTile += step(0.255, uv.y) - step(0.265, uv.y);\n orangeTile += step(0.730, uv.y) - step(0.740, uv.y);\n orangeTile += step(0.79, uv.y) - step(0.8, uv.y);\n \n // Apply\n value = mix(value, tar2Blue, vec3(blueTile * noise(uv* 1200.)));\n value = mix(value, tar2Orange, vec3(orangeTile * noise(uv * 200.)));\n \n fragColor = vec4(value, 1.0);\n }\n \n else if (patternChoice == 9) // Art Installation\n {\n vec2 uv2 = fragCoord.xy/iResolution.xy;\n uv2 -= 0.5;\n uv2.x *= 1.6;\n uv2.y *= 1.9;\n \n float dist = length(uv2);\n \n vec2 fragCo = fragCoord.xy;\n vec2 center = iResolution.xy * 0.5;\n float width = iResolution.x * 0.4;\n float height = iResolution.x * 0.2;\n \n vec3 value = mix(violet, yellow, dist);\n \n vec4 finalVal = vec4(value, 1.0);\n \n vec4 rect = rectangle(fragCo, center, width, height, violet);\n \n fragColor = mix(finalVal,rect,rect.a);\n fragColor = finalVal;\n }\n gl_FragColor = fragColor;\n}",$d="varying vec2 vertexUv;\nuniform vec2 iResolution;\nuniform float iTime;\n// variant of Vorocracks: https://shadertoy.com/view/lsVyRy\n// integrated with cracks here: https://www.shadertoy.com/view/Xd3fRN\n\n#define MM 0\n\n#define VARIANT 1 // 1: amplifies Voronoi cell jittering\n#if VARIANT\n float ofs = .5; // jitter Voronoi centers in -ofs ... 1.+ofs\n#else\n float ofs = 0.;\n#endif\n \n//int FAULT = 1; // 0: crest 1: fault\n\nfloat RATIO = 1., // stone length/width ratio\n /* STONE_slope = .3, // 0. .3 .3 -.3\n STONE_height = 1., // 1. 1. .6 .7\n profile = 1., // z = height + slope * dist ^ prof\n */ \n CRACK_depth = 3.,\n CRACK_zebra_scale = 1., // fractal shape of the fault zebra\n CRACK_zebra_amp = .67,\n CRACK_profile = 1., // fault vertical shape 1. .2 \n CRACK_slope = 50., // 10. 1.4\n CRACK_width = .0;\n \n\n// std int hash, inspired from https://www.shadertoy.com/view/XlXcW4\nvec3 hash3( uvec3 x ) \n{\n# define scramble x = ( (x>>8U) ^ x.yzx ) * 1103515245U // GLIB-C const\n scramble; scramble; scramble; \n return vec3(x) / float(0xffffffffU) + 1e-30; // <- eps to fix a windows/angle bug\n}\n\n// === Voronoi =====================================================\n// --- Base Voronoi. inspired by https://www.shadertoy.com/view/MslGD8\n\n#define hash22(p) fract( 18.5453 * sin( p * mat2(127.1,311.7,269.5,183.3)) )\n#define disp(p) ( -ofs + (1.+2.*ofs) * hash22(p) )\n\nvec3 voronoi( vec2 u ) // returns len + id\n{\n vec2 iu = floor(u), v;\n\tfloat m = 1e9,d;\n#if VARIANT\n for( int k=0; k < 25; k++ ) {\n vec2 p = iu + vec2(k%5-2,k/5-2),\n#else\n for( int k=0; k < 9; k++ ) {\n vec2 p = iu + vec2(k%3-1,k/3-1),\n#endif\n o = disp(p),\n \t r = p - u + o;\n\t\td = dot(r,r);\n if( d < m ) m = d, v = r;\n }\n\n return vec3( sqrt(m), v+u );\n}\n\n// --- Voronoi distance to borders. inspired by https://www.shadertoy.com/view/ldl3W8\nvec3 voronoiB( vec2 u ) // returns len + id\n{\n vec2 iu = floor(u), C, P;\n\tfloat m = 1e9,d;\n#if VARIANT\n for( int k=0; k < 25; k++ ) {\n vec2 p = iu + vec2(k%5-2,k/5-2),\n#else\n for( int k=0; k < 9; k++ ) {\n vec2 p = iu + vec2(k%3-1,k/3-1),\n#endif\n o = disp(p),\n \t r = p - u + o;\n\t\td = dot(r,r);\n if( d < m ) m = d, C = p-iu, P = r;\n }\n\n m = 1e9;\n \n for( int k=0; k < 25; k++ ) {\n vec2 p = iu+C + vec2(k%5-2,k/5-2),\n\t\t o = disp(p),\n r = p-u + o;\n\n if( dot(P-r,P-r)>1e-5 )\n m = min( m, .5*dot( (P+r), normalize(r-P) ) );\n }\n\n return vec3( m, P+u );\n}\n\n// === pseudo Perlin noise =============================================\n#define rot(a) mat2(cos(a),-sin(a),sin(a),cos(a))\nint MOD = 1; // type of Perlin noise\n \n// --- 2D\n#define hash21(p) fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453123)\nfloat noise2(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p); f = f*f*(3.-2.*f); // smoothstep\n\n float v= mix( mix(hash21(i+vec2(0,0)),hash21(i+vec2(1,0)),f.x),\n mix(hash21(i+vec2(0,1)),hash21(i+vec2(1,1)),f.x), f.y);\n\treturn MOD==0 ? v\n\t : MOD==1 ? 2.*v-1.\n : MOD==2 ? abs(2.*v-1.)\n : 1.-abs(2.*v-1.);\n}\n\nfloat fbm2(vec2 p) {\n float v = 0., a = .5;\n mat2 R = rot(.37);\n\n for (int i = 0; i < 9; i++, p*=2.,a/=2.) \n p *= R,\n v += a * noise2(p);\n\n return v;\n}\n#define noise22(p) vec2(noise2(p),noise2(p+17.7))\nvec2 fbm22(vec2 p) {\n vec2 v = vec2(0);\n float a = .5;\n mat2 R = rot(.37);\n\n for (int i = 0; i < 6; i++, p*=2.,a/=2.) \n p *= R,\n v += a * noise22(p);\n\n return v;\n}\nvec2 mfbm22(vec2 p) { // multifractal fbm \n vec2 v = vec2(1);\n float a = .5;\n mat2 R = rot(.37);\n\n for (int i = 0; i < 6; i++, p*=2.,a/=2.) \n p *= R,\n //v *= 1.+noise22(p);\n v += v * a * noise22(p);\n\n return v-1.;\n}\n\n/*\n// --- 3D \n#define hash31(p) fract(sin(dot(p,vec3(127.1,311.7, 74.7)))*43758.5453123)\nfloat noise3(vec3 p) {\n vec3 i = floor(p);\n vec3 f = fract(p); f = f*f*(3.-2.*f); // smoothstep\n\n float v= mix( mix( mix(hash31(i+vec3(0,0,0)),hash31(i+vec3(1,0,0)),f.x),\n mix(hash31(i+vec3(0,1,0)),hash31(i+vec3(1,1,0)),f.x), f.y), \n mix( mix(hash31(i+vec3(0,0,1)),hash31(i+vec3(1,0,1)),f.x),\n mix(hash31(i+vec3(0,1,1)),hash31(i+vec3(1,1,1)),f.x), f.y), f.z);\n\treturn MOD==0 ? v\n\t : MOD==1 ? 2.*v-1.\n : MOD==2 ? abs(2.*v-1.)\n : 1.-abs(2.*v-1.);\n}\n\nfloat fbm3(vec3 p) {\n float v = 0., a = .5;\n mat2 R = rot(.37);\n\n for (int i = 0; i < 9; i++, p*=2.,a/=2.) \n p.xy *= R, p.yz *= R,\n v += a * noise3(p);\n\n return v;\n}\n*/\n \n// ======================================================\n\nvoid main()\n{\n vec4 O;\n vec2 U = vertexUv.xy * iResolution.yy;\n U *= 4./iResolution.y;\n U.x += iTime; // for demo\n // O = vec4( 1.-voronoiB(U).x,voronoi(U).x, 0,0 ); // for tests\n vec2 I = floor(U/2.); \n bool vert = mod(I.x+I.y,2.)==0.; //if (vert) U = U.yx;\n vec3 H0;\n O-=O;\n\n for(float i=0.; i{this.parse(e,t,i)}),n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,it,n).catch(n)}decodeDracoFile(e,t,n,i,r=rt,a=()=>{}){const s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,s).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(nu.has(e)){const t=nu.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(r,a).then((n=>(i=n,new Promise(((n,a)=>{i._callbacks[r]={resolve:n,reject:a},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return s.catch((()=>!0)).then((()=>{i&&r&&this._releaseTask(i,r)})),nu.set(e,{key:n,promise:s}),s}_createGeometry(e){const t=new Ji;e.index&&t.setIndex(new ki(e.index.array,1));for(let n=0;n{n.load(e,t,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=ru.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.lengtht._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e{const t=e.draco,s=new t.Decoder;try{const e=function(e,t,i,r){const a=r.attributeIDs,s=r.attributeTypes;let o,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)o=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,o);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,o)}if(!l.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in a){const l=self[s[i]];let c,d;if(r.useUniqueIDs)d=a[i],c=t.GetAttributeByUniqueId(o,d);else{if(d=t.GetAttributeId(o,e[a[i]]),-1===d)continue;c=t.GetAttribute(o,d)}const u=n(e,t,o,i,l,c);"color"===i&&(u.vertexColorSpace=r.vertexColorSpace),h.attributes.push(u)}return c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),r=4*i,a=e._malloc(r);t.GetTrianglesUInt32Array(n,r,a);const s=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:s,itemSize:1}}(e,t,o)),e.destroy(o),h}(t,s,new Int8Array(i),a),o=e.attributes.map((e=>e.array.buffer));e.index&&o.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},o)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(s)}}))}}}function au(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported.")));const l=new Ku(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise((function(i,r){n.parse(e,t,i,r)}))}}function ou(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const lu={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class cu{constructor(e){this.parser=e,this.name=lu.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class bu{constructor(e){this.parser=e,this.name=lu.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Mu{constructor(e){this.parser=e,this.name=lu.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class Tu{constructor(e){this.name=lu.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){const n=e.byteOffset||0,i=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then((function(e){return e.buffer})):r.ready.then((function(){const t=new ArrayBuffer(a*s);return r.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t}))}))}return null}}class Eu{constructor(e){this.name=lu.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==Ou.TRIANGLES&&e.mode!==Ou.TRIANGLE_STRIP&&e.mode!==Ou.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,a=[],s={};for(const e in r)a.push(this.parser.getDependency("accessor",r[e]).then((t=>(s[e]=t,s[e]))));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then((e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new Hn,n=new dn,a=new hn,o=new dn(1,1,1),l=new el(e.geometry,e.material,i);for(let e=0;e-1,a=r?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&a<98?this.textureLoader=new wc(this.options.manager):this.textureLoader=new kc(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new xc(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){const a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return Gu(r,a,i),Wu(a,i),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){for(const e of a.scenes)e.updateMatrixWorld();e(a)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,h[e*a+1]),a>=3&&p.setZ(t,h[e*a+2]),a>=4&&p.setW(t,h[e*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],s=r.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);const n=(r.samplers||{})[a.sampler]||{};return t.magFilter=Fu[n.magFilter]||q,t.minFilter=Fu[n.minFilter]||K,t.wrapS=Bu[n.wrapS]||V,t.wrapT=Bu[n.wrapT]||V,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[o]=l,l}loadImageSource(e,t){const n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const r=n.images[e],a=self.URL||self.webkitURL;let s=r.uri||"",o=!1;if(void 0!==r.bufferView)s=this.getDependency("bufferView",r.bufferView).then((function(e){o=!0;const t=new Blob([e],{type:r.mimeType});return s=a.createObjectURL(t),s}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(s).then((function(e){return new Promise((function(n,r){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){const t=new rn(e);t.needsUpdate=!0,n(t)}),t.load(zc.resolveURL(e,i.path),a,void 0,r)}))})).then((function(e){var t;return!0===o&&a.revokeObjectURL(s),Wu(e,r),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e}));return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then((function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),r.extensions[lu.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[lu.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=r.associations.get(a);a=r.extensions[lu.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==i&&(a.colorSpace=i),e[t]=a,a}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new ml,Ii.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new tl,Ii.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||a){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Wl}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const s={},o=[];if((r.extensions||{})[lu.KHR_MATERIALS_UNLIT]){const e=i[lu.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),o.push(e.extendParams(s,r,t))}else{const n=r.pbrMetallicRoughness||{};if(s.color=new Ci(1,1,1),s.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],rt),s.opacity=e[3]}void 0!==n.baseColorTexture&&o.push(t.assignTexture(s,"map",n.baseColorTexture,it)),s.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,s.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(t.assignTexture(s,"metalnessMap",n.metallicRoughnessTexture)),o.push(t.assignTexture(s,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),o.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))}!0===r.doubleSided&&(s.side=2);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===l&&(s.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&a!==Ui&&(o.push(t.assignTexture(s,"normalMap",r.normalTexture)),s.normalScale=new Nt(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&a!==Ui&&(o.push(t.assignTexture(s,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(s.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&a!==Ui){const e=r.emissiveFactor;s.emissive=(new Ci).setRGB(e[0],e[1],e[2],rt)}return void 0!==r.emissiveTexture&&a!==Ui&&o.push(t.assignTexture(s,"emissiveMap",r.emissiveTexture,it)),Promise.all(o).then((function(){const n=new a(s);return r.name&&(n.name=r.name),Wu(n,r),t.associations.set(n,{materials:e}),r.extensions&&Gu(i,n,r),n}))}createUniqueName(e){const t=Yc.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[lu.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return Ju(n,e,t)}))}const a=[];for(let n=0,s=e.length;n0&&ju(d,r),d.name=t.createUniqueName(r.name||"mesh_"+e),Wu(d,r),h.extensions&&Gu(i,d,h),t.assignFinalMaterial(d),l.push(d)}for(let n=0,i=l.length;n1?new _o:1===t.length?t[0]:new fi,s!==t[0])for(let e=0,n=t.length;e{const t=new Map;for(const[e,n]of i.associations)(e instanceof Ii||e instanceof rn)&&t.set(e,n);return e.traverse((e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)})),t})(r),r}))}_createAnimationTracks(e,t,n,i,r){const a=[],s=e.name?e.name:e.uuid,o=[];let l;switch(Hu[r.path]===Hu.weights?e.traverse((function(e){e.morphTargetInfluences&&o.push(e.name?e.name:e.uuid)})):o.push(s),Hu[r.path]){case Hu.weights:l=sc;break;case Hu.rotation:l=lc;break;case Hu.position:case Hu.scale:l=hc;break;default:l=1===n.itemSize?sc:hc}const c=void 0!==i.interpolation?Vu[i.interpolation]:et,h=this._getArrayFromAccessor(n);for(let e=0,n=o.length;eMath.PI&&(_-=m),w<-Math.PI?w+=m:w>Math.PI&&(w-=m),s.theta=_<=w?Math.max(_,Math.min(w,s.theta)):s.theta>(_+w)/2?Math.max(_,s.theta):Math.min(w,s.theta)),s.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,s.phi)),s.makeSafe(),!0===n.enableDamping?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let b=!1;if(n.zoomToCursor&&S||n.object.isOrthographicCamera)s.radius=U(s.radius);else{const e=s.radius;s.radius=U(s.radius*l),b=e!=s.radius}if(t.setFromSpherical(s),t.applyQuaternion(d),v.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(o.theta*=1-n.dampingFactor,o.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(o.set(0,0,0),c.set(0,0,0)),n.zoomToCursor&&S){let i=null;if(n.object.isPerspectiveCamera){const e=t.length();i=U(e*l);const r=e-i;n.object.position.addScaledVector(x,r),n.object.updateMatrixWorld(),b=!!r}else if(n.object.isOrthographicCamera){const e=new dn(y.x,y.y,0);e.unproject(n.object);const r=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),b=r!==n.object.zoom;const a=new dn(y.x,y.y,0);a.unproject(n.object),n.object.position.sub(a).add(e),n.object.updateMatrixWorld(),i=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;null!==i&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(i).add(n.object.position):(tp.origin.copy(n.object.position),tp.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(tp.direction))a||8*(1-p.dot(n.object.quaternion))>a||f.distanceToSquared(n.target)>a)&&(n.dispatchEvent(Qu),u.copy(n.object.position),p.copy(n.object.quaternion),f.copy(n.target),!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",J),n.domElement.removeEventListener("pointerdown",G),n.domElement.removeEventListener("pointercancel",j),n.domElement.removeEventListener("wheel",X),n.domElement.removeEventListener("pointermove",W),n.domElement.removeEventListener("pointerup",j),n.domElement.getRootNode().removeEventListener("keydown",Y,{capture:!0}),null!==n._domElementKeyEvents&&(n._domElementKeyEvents.removeEventListener("keydown",Z),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=i.NONE;const a=1e-6,s=new Qc,o=new Qc;let l=1;const c=new dn,h=new Nt,d=new Nt,u=new Nt,p=new Nt,f=new Nt,m=new Nt,g=new Nt,v=new Nt,_=new Nt,x=new dn,y=new Nt;let S=!1;const w=[],b={};let M=!1;function T(e){const t=Math.abs(.01*e);return Math.pow(.95,n.zoomSpeed*t)}function E(e){o.theta-=e}function A(e){o.phi-=e}const P=function(){const e=new dn;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),c.add(e)}}(),R=function(){const e=new dn;return function(t,i){!0===n.screenSpacePanning?e.setFromMatrixColumn(i,1):(e.setFromMatrixColumn(i,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),c.add(e)}}(),C=function(){const e=new dn;return function(t,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const a=n.object.position;e.copy(a).sub(n.target);let s=e.length();s*=Math.tan(n.object.fov/2*Math.PI/180),P(2*t*s/r.clientHeight,n.object.matrix),R(2*i*s/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(P(t*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),R(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function L(e){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function D(e){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(e,t){if(!n.zoomToCursor)return;S=!0;const i=n.domElement.getBoundingClientRect(),r=e-i.left,a=t-i.top,s=i.width,o=i.height;y.x=r/s*2-1,y.y=-a/o*2+1,x.set(y.x,y.y,1).unproject(n.object).sub(n.object.position).normalize()}function U(e){return Math.max(n.minDistance,Math.min(n.maxDistance,e))}function O(e){h.set(e.clientX,e.clientY)}function N(e){p.set(e.clientX,e.clientY)}function F(e){if(1===w.length)h.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);h.set(n,i)}}function B(e){if(1===w.length)p.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);p.set(n,i)}}function z(e){const t=$(e),n=e.pageX-t.x,i=e.pageY-t.y,r=Math.sqrt(n*n+i*i);g.set(0,r)}function k(e){if(1==w.length)d.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);d.set(n,i)}u.subVectors(d,h).multiplyScalar(n.rotateSpeed);const t=n.domElement;E(2*Math.PI*u.x/t.clientHeight),A(2*Math.PI*u.y/t.clientHeight),h.copy(d)}function H(e){if(1===w.length)f.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);f.set(n,i)}m.subVectors(f,p).multiplyScalar(n.panSpeed),C(m.x,m.y),p.copy(f)}function V(e){const t=$(e),i=e.pageX-t.x,r=e.pageY-t.y,a=Math.sqrt(i*i+r*r);v.set(0,a),_.set(0,Math.pow(v.y/g.y,n.zoomSpeed)),L(_.y),g.copy(v),I(.5*(e.pageX+t.x),.5*(e.pageY+t.y))}function G(e){!1!==n.enabled&&(0===w.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",W),n.domElement.addEventListener("pointerup",j)),function(e){for(let t=0;t0?L(T(_.y)):_.y<0&&D(T(_.y)),g.copy(v),n.update()}(e);break;case i.PAN:if(!1===n.enablePan)return;!function(e){f.set(e.clientX,e.clientY),m.subVectors(f,p).multiplyScalar(n.panSpeed),C(m.x,m.y),p.copy(f),n.update()}(e)}}(e))}function j(e){switch(function(e){delete b[e.pointerId];for(let t=0;t0&&L(T(e.deltaY)),n.update()}(function(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100}return e.ctrlKey&&!M&&(n.deltaY*=10),n}(e)),n.dispatchEvent(ep))}function Y(e){"Control"===e.key&&(M=!0,n.domElement.getRootNode().addEventListener("keyup",q,{passive:!0,capture:!0}))}function q(e){"Control"===e.key&&(M=!1,n.domElement.getRootNode().removeEventListener("keyup",q,{passive:!0,capture:!0}))}function Z(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?A(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?A(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?E(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?E(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):C(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function K(e){switch(Q(e),w.length){case 1:switch(n.touches.ONE){case 0:if(!1===n.enableRotate)return;F(e),r=i.TOUCH_ROTATE;break;case 1:if(!1===n.enablePan)return;B(e),r=i.TOUCH_PAN;break;default:r=i.NONE}break;case 2:switch(n.touches.TWO){case 2:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&z(e),n.enablePan&&B(e)}(e),r=i.TOUCH_DOLLY_PAN;break;case 3:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&z(e),n.enableRotate&&F(e)}(e),r=i.TOUCH_DOLLY_ROTATE;break;default:r=i.NONE}break;default:r=i.NONE}r!==i.NONE&&n.dispatchEvent($u)}function J(e){!1!==n.enabled&&e.preventDefault()}function Q(e){let t=b[e.pointerId];void 0===t&&(t=new Nt,b[e.pointerId]=t),t.set(e.pageX,e.pageY)}function $(e){const t=e.pointerId===w[0]?w[1]:w[0];return b[t]}n.domElement.addEventListener("contextmenu",J),n.domElement.addEventListener("pointerdown",G),n.domElement.addEventListener("pointercancel",j),n.domElement.addEventListener("wheel",X,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",Y,{passive:!0,capture:!0}),this.update()}}const ap=new Zc,sp=new dn,op=new dn,lp=new hn,cp={X:new dn(1,0,0),Y:new dn(0,1,0),Z:new dn(0,0,1)},hp={type:"change"},dp={type:"mouseDown",mode:null},up={type:"mouseUp",mode:null},pp={type:"objectChange"};class fp extends fi{constructor(e,t){super(),void 0===t&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const n=new Op;this._gizmo=n,this.add(n);const i=new Np;this._plane=i,this.add(i);const r=this;function a(e,t){let a=t;Object.defineProperty(r,e,{get:function(){return void 0!==a?a:t},set:function(t){a!==t&&(a=t,i[e]=t,n[e]=t,r.dispatchEvent({type:e+"-changed",value:t}),r.dispatchEvent(hp))}}),r[e]=t,i[e]=t,n[e]=t}a("camera",e),a("object",void 0),a("enabled",!0),a("axis",null),a("mode","translate"),a("translationSnap",null),a("rotationSnap",null),a("scaleSnap",null),a("space","world"),a("size",1),a("dragging",!1),a("showX",!0),a("showY",!0),a("showZ",!0);const s=new dn,o=new dn,l=new hn,c=new hn,h=new dn,d=new hn,u=new dn,p=new dn,f=new dn,m=new dn;a("worldPosition",s),a("worldPositionStart",o),a("worldQuaternion",l),a("worldQuaternionStart",c),a("cameraPosition",h),a("cameraQuaternion",d),a("pointStart",u),a("pointEnd",p),a("rotationAxis",f),a("rotationAngle",0),a("eye",m),this._offset=new dn,this._startNorm=new dn,this._endNorm=new dn,this._cameraScale=new dn,this._parentPosition=new dn,this._parentQuaternion=new hn,this._parentQuaternionInv=new hn,this._parentScale=new dn,this._worldScaleStart=new dn,this._worldQuaternionInv=new hn,this._worldScale=new dn,this._positionStart=new dn,this._quaternionStart=new hn,this._scaleStart=new dn,this._getPointer=mp.bind(this),this._onPointerDown=vp.bind(this),this._onPointerHover=gp.bind(this),this._onPointerMove=_p.bind(this),this._onPointerUp=xp.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(e){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(e)}pointerHover(e){if(void 0===this.object||!0===this.dragging)return;null!==e&&ap.setFromCamera(e,this.camera);const t=yp(this._gizmo.picker[this.mode],ap);this.axis=t?t.object.name:null}pointerDown(e){if(void 0!==this.object&&!0!==this.dragging&&(null==e||0===e.button)&&null!==this.axis){null!==e&&ap.setFromCamera(e,this.camera);const t=yp(this._plane,ap,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,dp.mode=this.mode,this.dispatchEvent(dp)}}pointerMove(e){const t=this.axis,n=this.mode,i=this.object;let r=this.space;if("scale"===n?r="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(r="world"),void 0===i||null===t||!1===this.dragging||null!==e&&-1!==e.button)return;null!==e&&ap.setFromCamera(e,this.camera);const a=yp(this._plane,ap,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),"translate"===n)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===r&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),"local"===r&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===r&&(i.position.applyQuaternion(lp.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),"world"===r&&(i.parent&&i.position.add(sp.setFromMatrixPosition(i.parent.matrixWorld)),-1!==t.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(sp.setFromMatrixPosition(i.parent.matrixWorld))));else if("scale"===n){if(-1!==t.search("XYZ")){let e=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(e*=-1),op.set(e,e,e)}else sp.copy(this.pointStart),op.copy(this.pointEnd),sp.applyQuaternion(this._worldQuaternionInv),op.applyQuaternion(this._worldQuaternionInv),op.divide(sp),-1===t.search("X")&&(op.x=1),-1===t.search("Y")&&(op.y=1),-1===t.search("Z")&&(op.z=1);i.scale.copy(this._scaleStart).multiply(op),this.scaleSnap&&(-1!==t.search("X")&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===n){this._offset.copy(this.pointEnd).sub(this.pointStart);const e=20/this.worldPosition.distanceTo(sp.setFromMatrixPosition(this.camera.matrixWorld));let n=!1;"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(sp.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(cp[t]),sp.copy(cp[t]),"local"===r&&sp.applyQuaternion(this.worldQuaternion),sp.cross(this.eye),0===sp.length()?n=!0:this.rotationAngle=this._offset.dot(sp.normalize())*e),("E"===t||n)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===r&&"E"!==t&&"XYZE"!==t?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(lp.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(lp.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(hp),this.dispatchEvent(pp)}}pointerUp(e){null!==e&&0!==e.button||(this.dragging&&null!==this.axis&&(up.mode=this.mode,this.dispatchEvent(up)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(hp),this.dispatchEvent(pp),this.pointStart.copy(this.pointEnd))}getRaycaster(){return ap}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function mp(e){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:e.button};{const t=this.domElement.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button}}}function gp(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}function vp(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}function _p(e){this.enabled&&this.pointerMove(this._getPointer(e))}function xp(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}function yp(e,t,n){const i=t.intersectObject(e,!0);for(let e=0;ee&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"Y"===i.name&&Math.abs(wp.copy(Cp).applyQuaternion(t).dot(this.eye))>e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"Z"===i.name&&Math.abs(wp.copy(Lp).applyQuaternion(t).dot(this.eye))>e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"XY"===i.name&&Math.abs(wp.copy(Lp).applyQuaternion(t).dot(this.eye)).9&&(i.visible=!1)),"Y"===this.axis&&(lp.setFromEuler(Sp.set(0,0,Math.PI/2)),i.quaternion.copy(t).multiply(lp),Math.abs(wp.copy(Cp).applyQuaternion(t).dot(this.eye))>.9&&(i.visible=!1)),"Z"===this.axis&&(lp.setFromEuler(Sp.set(0,Math.PI/2,0)),i.quaternion.copy(t).multiply(lp),Math.abs(wp.copy(Lp).applyQuaternion(t).dot(this.eye))>.9&&(i.visible=!1)),"XYZE"===this.axis&&(lp.setFromEuler(Sp.set(0,Math.PI/2,0)),wp.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(Mp.lookAt(bp,wp,Cp)),i.quaternion.multiply(lp),i.visible=this.dragging),"E"===this.axis&&(i.visible=!1)):"START"===i.name?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):"END"===i.name?(i.position.copy(this.worldPosition),i.visible=this.dragging):"DELTA"===i.name?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),sp.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),sp.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(sp),i.visible=this.dragging):(i.quaternion.copy(t),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=-1!==this.axis.search(i.name)))}super.updateMatrixWorld(e)}}class Np extends mr{constructor(){super(new Hr(1e5,1e5,2,2),new Ui({visible:!1,wireframe:!0,side:2,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(t="local"),Dp.copy(Rp).applyQuaternion("local"===t?this.worldQuaternion:Ep),Ip.copy(Cp).applyQuaternion("local"===t?this.worldQuaternion:Ep),Up.copy(Lp).applyQuaternion("local"===t?this.worldQuaternion:Ep),wp.copy(Ip),this.mode){case"translate":case"scale":switch(this.axis){case"X":wp.copy(this.eye).cross(Dp),Ap.copy(Dp).cross(wp);break;case"Y":wp.copy(this.eye).cross(Ip),Ap.copy(Ip).cross(wp);break;case"Z":wp.copy(this.eye).cross(Up),Ap.copy(Up).cross(wp);break;case"XY":Ap.copy(Up);break;case"YZ":Ap.copy(Dp);break;case"XZ":wp.copy(Up),Ap.copy(Ip);break;case"XYZ":case"E":Ap.set(0,0,0)}break;default:Ap.set(0,0,0)}0===Ap.length()?this.quaternion.copy(this.cameraQuaternion):(Pp.lookAt(sp.set(0,0,0),Ap,wp),this.quaternion.setFromRotationMatrix(Pp)),super.updateMatrixWorld(e)}}class Fp{constructor(e,t,n){this.renderer=e,this.canvas=n||this.renderer.domElement,this.camera=t,this.orbitControls=new rp(t,this.canvas)}addTransformControl(e,t){const n=new fp(this.camera,this.canvas);return n.addEventListener("dragging-changed",(e=>{this.orbitControls.enabled=!e.value})),n.attach(e),t.add(n),n}update(){this.orbitControls.update()}}class Bp extends mr{constructor(e,t){super(new Hr(1,1,10,10),new jl({color:Bp.alphaMap?0:16777215,transparent:!0,depthWrite:!1,polygonOffset:!0,name:"ShadowGroundPlaneMaterial"})),this.name="ShadowGroundPlane",this.userData.isFloor=!0,this.renderOrder=1,this.receiveShadow=!1,this.layers.disableAll(),t&&this.updateMaterial(t),this.setShadowMap(e)}setVisibility(e){this.visible=e,this.setVisibilityLayers(e)}setVisibilityLayers(e){e?this.layers.enableAll():this.layers.disableAll()}setDepthWrite(e){const t=this.material;t.depthWrite=e,t.transparent=!e,t.needsUpdate=!0,this.setVisibility(e)}setReceiveShadow(e){this.receiveShadow=e,this.setVisibility(e)}setShadowMap(e){const t=this.material;Bp.alphaMap?(t.alphaMap=e,t.map=null,t.color.set(0)):(t.alphaMap=null,t.map=e,t.color.set(16777215)),t.needsUpdate=!0}updateMaterial(e){const t=this.material;e.opacity&&t.opacity!==e.opacity&&(t.opacity=e.opacity),e.polygonOffset&&t.polygonOffsetFactor!==e.polygonOffset&&(t.polygonOffset=!0,t.polygonOffsetFactor=e.polygonOffset,t.polygonOffsetUnits=e.polygonOffset),t.needsUpdate=!0}}Bp.alphaMap=!0;class zp extends _h{get renderPassManager(){return this._renderPassManager}get renderCacheManager(){return this._renderPassManager.renderCacheManager}get scene(){return this._renderPassManager.scene}get camera(){return this._renderPassManager.camera}get gBufferTextures(){return this._renderPassManager.gBufferRenderPass}get passRenderer(){return this._renderPassManager.passRenderer}constructor(e){super(),this._renderPassManager=e}render(e,t,n,i,r){this.renderPass(e)}}const kp="inputRgbNormal",Hp="floatBufferNormal",Vp="separateBuffer",Gp="normalVectorAlpha",Wp=(e,t)=>{const n=jp(e,t);let i="vec4[SAMPLES](";for(let t=0;t{const n=[];for(let i=0;i\n\t\t#include \n\n\t\t#ifndef FRAGMENT_OUTPUT\n\t\t#define FRAGMENT_OUTPUT vec4(vec3(ao), 1.)\n\t\t#endif\n\n\t\tconst vec4 sampleKernel[SAMPLES] = SAMPLE_VECTORS;\n\n\t\tvec3 getViewPosition(const in vec2 screenPosition, const in float depth) {\n\t\t\tvec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0);\n\t\t\tvec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition;\n\t\t\treturn viewSpacePosition.xyz / viewSpacePosition.w;\n\t\t}\n\n\t\tfloat getDepth(const vec2 uv) { \n\t\t\t#if DEPTH_BUFFER_ANTIALIAS == 1\n\t\t\t\tvec2 size = vec2(textureSize(tDepth, 0));\n\t\t\t\tivec2 p = ivec2(uv * size);\n\t\t\t\tfloat d0 = texelFetch(tDepth, p, 0).DEPTH_SWIZZLING;\n\t\t\t\tvec2 depth = vec2(d0, 1.0);\n\t\t\t\tfloat d1 = texelFetch(tDepth, p + ivec2(1, 0), 0).DEPTH_SWIZZLING;\n\t\t\t\tdepth += vec2(d1, 1.0) * step(abs(d1 - d0), 0.1);\n\t\t\t\tfloat d2 = texelFetch(tDepth, p - ivec2(1, 0), 0).DEPTH_SWIZZLING;\n\t\t\t\tdepth += vec2(d2, 1.0) * step(abs(d2 - d0), 0.1);\n\t\t\t\tfloat d3 = texelFetch(tDepth, p + ivec2(0, 1), 0).DEPTH_SWIZZLING;\n\t\t\t\tdepth += vec2(d3, 1.0) * step(abs(d3 - d0), 0.1);\n\t\t\t\tfloat d4 = texelFetch(tDepth, p - ivec2(0, 1), 0).DEPTH_SWIZZLING;\n\t\t\t\tdepth += vec2(d4, 1.0) * step(abs(d4 - d0), 0.1);\n\t\t\t\treturn depth.x / depth.y;\n \t#else\n \treturn textureLod(tDepth, uv.xy, 0.0).DEPTH_SWIZZLING;\n \t#endif\n\t\t}\n\n\t\tfloat fetchDepth(const ivec2 uv) { \n\t\t\treturn texelFetch(tDepth, uv.xy, 0).DEPTH_SWIZZLING;\n\t\t}\n\n\t\tfloat getViewZ(const in float depth) {\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\t\t\t\treturn perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n\t\t\t#else\n\t\t\t\treturn orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n\t\t\t#endif\n\t\t}\n\n\t\tvec3 computeNormalFromDepth(const vec2 uv) {\n vec2 size = vec2(textureSize(tDepth, 0));\n ivec2 p = ivec2(uv * size);\n float c0 = fetchDepth(p);\n float l2 = fetchDepth(p - ivec2(2, 0));\n float l1 = fetchDepth(p - ivec2(1, 0));\n float r1 = fetchDepth(p + ivec2(1, 0));\n float r2 = fetchDepth(p + ivec2(2, 0));\n float b2 = fetchDepth(p - ivec2(0, 2));\n float b1 = fetchDepth(p - ivec2(0, 1));\n float t1 = fetchDepth(p + ivec2(0, 1));\n float t2 = fetchDepth(p + ivec2(0, 2));\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n vec3 ce = getViewPosition(uv, c0).xyz;\n vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n return normalize(cross(dpdx, dpdy));\n\t\t}\n\n\t\tvec3 getViewNormal(const vec2 uv) {\n\t\t\t#if NORMAL_VECTOR_TYPE == 2\n\t\t\t\treturn normalize(textureLod(tNormal, uv, 0.).rgb);\n\t\t\t#elif NORMAL_VECTOR_TYPE == 1\n\t\t\t\treturn unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb);\n\t\t\t#else\n\t\t\t\treturn computeNormalFromDepth(uv);\n\t\t\t#endif\n\t\t}\n\n\t\tvec3 getAntiAliasedViewNormal(const in vec2 screenPosition) {\n\t\t\t#if NORMAL_VECTOR_TYPE == 2\n\t\t\t\t#if NORMAL_VECTOR_ANTIALIAS == 1\n\t\t\t\t\tvec2 uv = screenPosition;\n\t\t\t\t\tvec2 size = vec2(textureSize(tNormal, 0));\n\t\t\t\t\tivec2 p = ivec2(screenPosition * size);\n\t\t\t\t\tfloat c0 = texelFetch(tNormal, p, 0).a;\n\t\t\t\t\tfloat l2 = texelFetch(tNormal, p - ivec2(2, 0), 0).a;\n\t\t\t\t\tfloat l1 = texelFetch(tNormal, p - ivec2(1, 0), 0).a;\n\t\t\t\t\tfloat r1 = texelFetch(tNormal, p + ivec2(1, 0), 0).a;\n\t\t\t\t\tfloat r2 = texelFetch(tNormal, p + ivec2(2, 0), 0).a;\n\t\t\t\t\tfloat b2 = texelFetch(tNormal, p - ivec2(0, 2), 0).a;\n\t\t\t\t\tfloat b1 = texelFetch(tNormal, p - ivec2(0, 1), 0).a;\n\t\t\t\t\tfloat t1 = texelFetch(tNormal, p + ivec2(0, 1), 0).a;\n\t\t\t\t\tfloat t2 = texelFetch(tNormal, p + ivec2(0, 2), 0).a;\n\t\t\t\t\tfloat dl = abs((2.0 * l1 - l2) - c0);\n\t\t\t\t\tfloat dr = abs((2.0 * r1 - r2) - c0);\n\t\t\t\t\tfloat db = abs((2.0 * b1 - b2) - c0);\n\t\t\t\t\tfloat dt = abs((2.0 * t1 - t2) - c0);\n\t\t\t\t\tvec3 ce = getViewPosition(uv, c0).xyz;\n\t\t\t\t\tvec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n\t\t\t\t\t\t\t\t\t\t : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n\t\t\t\t\tvec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n\t\t\t\t\t\t\t\t\t\t : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n\t\t\t\t\treturn normalize(cross(dpdx, dpdy));\n\t\t\t\t#elif NORMAL_VECTOR_ANTIALIAS == 2\n\t\t\t\t\tvec2 size = vec2(textureSize(tNormal, 0));\n\t\t\t\t\tivec2 p = ivec2(screenPosition * size);\n\t\t\t\t\tvec3 normalVector = texelFetch(tNormal, p, 0).xyz;\n\t\t\t\t\tnormalVector += texelFetch(tNormal, p + ivec2(1, 0), 0).xyz;\n\t\t\t\t\tnormalVector += texelFetch(tNormal, p - ivec2(1, 0), 0).xyz;\n\t\t\t\t\tnormalVector += texelFetch(tNormal, p + ivec2(0, 1), 0).xyz;\n\t\t\t\t\tnormalVector += texelFetch(tNormal, p - ivec2(0, 1), 0).xyz;\n\t\t\t\t\treturn normalize(normalVector);\n\t\t\t\t#else\n\t\t\t\t\treturn texture2D(tNormal, screenPosition).xyz;\n\t\t\t\t#endif\n\t\t\t#elif NORMAL_VECTOR_TYPE == 1\n\t\t\t\treturn unpackRGBToNormal(textureLod(tNormal, screenPosition, 0.).rgb);\n\t\t\t#else\n\t\t\t\treturn computeNormalFromDepth(screenPosition);\n\t\t\t#endif\n\t\t }\n\n\t\tvec3 getSceneUvAndDepth(vec3 sampleViewPos) {\n\t\t\tvec4 sampleClipPos = cameraProjectionMatrix * vec4(sampleViewPos, 1.);\n\t\t\tvec2 sampleUv = sampleClipPos.xy / sampleClipPos.w * 0.5 + 0.5;\n\t\t\tfloat sampleSceneDepth = getDepth(sampleUv);\n\t\t\treturn vec3(sampleUv, sampleSceneDepth);\n\t\t}\n\n\t\tfloat sinusToPlane(vec3 pointOnPlane, vec3 planeNormal, vec3 point) {\n\t\t\tvec3 delta = point - pointOnPlane;\n\t\t\tfloat sinV = dot(planeNormal, normalize(delta));\n\t\t\treturn sinV;\n\t\t}\n\n\t\tfloat getFallOff(float delta, float falloffDistance) {\n\t\t\tfloat fallOff = smoothstep(0., 1., 1. - distanceFallOff * abs(delta) / falloffDistance);\n\t\t\treturn fallOff;\n\t\t}\n\t\t\n\t\tvoid main() {\n\t\t\tfloat depth = getDepth(vUv.xy);\n\t\t\tif (depth >= 1.0) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvec3 viewPos = getViewPosition(vUv, depth);\n\t\t\tvec3 viewNormal = getAntiAliasedViewNormal(vUv);\n\n\t\t\tfloat radiusToUse = radius;\n\t\t\tfloat distanceFalloffToUse = thickness;\n\t\t\t#if SCREEN_SPACE_RADIUS == 1\n\t\t\t float radiusScale = getViewPosition(vec2(0.5 + float(SCREEN_SPACE_RADIUS_SCALE) / resolution.x, 0.0), depth).x;\n\t\t\t\tradiusToUse *= radiusScale;\n\t\t\t\tdistanceFalloffToUse *= radiusScale;\n\t\t\t#endif\n\n\t\t\t#if SCENE_CLIP_BOX == 1\n\t\t\t\tvec3 worldPos = (cameraWorldMatrix * vec4(viewPos, 1.0)).xyz;\n \t\t\tfloat boxDistance = length(max(vec3(0.0), max(sceneBoxMin - worldPos, worldPos - sceneBoxMax)));\n\t\t\t\tif (boxDistance > radiusToUse) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t#endif\n\t\t\t\n\t\t\tvec2 noiseResolution = vec2(textureSize(tNoise, 0));\n\t\t\tvec2 noiseUv = vUv * resolution / noiseResolution;\n\t\t\tvec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0);\n\t\t\tvec3 randomVec = noiseTexel.xyz * 2.0 - 1.0;\n\n\t\t\t#if NV_ALIGNED_SAMPLES == 1\n \t\t\t\tvec3 tangent = normalize(randomVec - viewNormal * dot(randomVec, viewNormal));\n \t\t\tvec3 bitangent = cross(viewNormal, tangent);\n \t\t\tmat3 kernelMatrix = mat3(tangent, bitangent, viewNormal);\n\t\t\t#else\n\t\t\t\tvec3 tangent = normalize(vec3(randomVec.xy, 0.));\n\t\t\t\tvec3 bitangent = vec3(-tangent.y, tangent.x, 0.);\n\t\t\t\tmat3 kernelMatrix = mat3(tangent, bitangent, vec3(0., 0., 1.));\n\t\t\t#endif\n\n\t\t#if AO_ALGORITHM == 4\n\t\t\tconst int DIRECTIONS = SAMPLES < 30 ? 3 : 5;\n\t\t\tconst int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS;\n\t\t#elif AO_ALGORITHM == 3\n\t\t\tconst int DIRECTIONS = SAMPLES < 16 ? 3 : 5;\n\t\t\tconst int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS;\n\t\t#else\n\t\t\tconst int DIRECTIONS = SAMPLES;\n\t\t\tconst int STEPS = 1;\n\t\t#endif\n\n\t\t\tfloat ao = 0.0, totalWeight = 0.0;\n\t\t\tfor (int i = 0; i < DIRECTIONS; ++i) {\n\n\t\t\t#if AO_ALGORITHM == 4\n\t\t\t\tfloat angle = float(i) / float(DIRECTIONS) * PI;\n\t\t\t\tvec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w); \n\t\t\t#elif AO_ALGORITHM == 3\n\t\t\t\tfloat angle = float(i) / float(DIRECTIONS) * 2. * PI;\n\t\t\t\tvec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w); \n\t\t\t#else\n\t\t\t\tvec4 sampleDir = sampleKernel[i];\n\t\t\t#endif\n\t\t\t\tsampleDir.xyz = normalize(kernelMatrix * sampleDir.xyz);\n\n\t\t\t\tvec3 viewDir = normalize(-viewPos.xyz);\n\t\t\t\tvec3 sliceBitangent = normalize(cross(sampleDir.xyz, viewDir));\n\t\t\t\tvec3 sliceTangent = cross(sliceBitangent, viewDir);\n\t\t\t\tvec3 normalInSlice = normalize(viewNormal - sliceBitangent * dot(viewNormal, sliceBitangent));\n\t\t\t\t\n\t\t\t#if (AO_ALGORITHM == 3 || AO_ALGORITHM == 4)\n\t\t\t\tvec3 tangentToNormalInSlice = cross(normalInSlice, sliceBitangent);\n\t\t\t\t#if AO_ALGORITHM == 4\n\t\t\t\t\tvec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice), dot(viewDir, -tangentToNormalInSlice));\n\t\t\t\t#else\n\t\t\t\t\tvec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice));\n\t\t\t\t#endif\n\t\t\t\tfor (int j = 0; j < STEPS; ++j) {\n\t\t\t\t\tvec3 sampleViewOffset = sampleDir.xyz * radiusToUse * sampleDir.w * pow(float(j + 1) / float(STEPS), distanceExponent);\n\t\t\t\t\tvec3 sampleViewPos = viewPos + sampleViewOffset;\n\t\t\t#else\n\t\t\t\t\tvec3 sampleViewPos = viewPos + sampleDir.xyz * radiusToUse * pow(sampleDir.w, distanceExponent);\n\t\t\t#endif\t\n\n\t\t\t\t\tvec3 sampleSceneUvDepth = getSceneUvAndDepth(sampleViewPos);\n\t\t\t\t\tvec3 sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);\n\t\t\t\t\tfloat sceneSampleDist = abs(sampleSceneViewPos.z);\n\t\t\t\t\tfloat sampleDist = abs(sampleViewPos.z);\n\t\t\t\t\t\n\t\t\t\t#if (AO_ALGORITHM == 3 || AO_ALGORITHM == 4)\n\t\t\t\t\t// HBAO || GTAO\n\t\t\t\t\tvec3 viewDelta = sampleSceneViewPos - viewPos;\n\t\t\t\t\tif (abs(viewDelta.z) < thickness) {\n\t\t\t\t\t\tvec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n\t\t\t\t\t\tfloat sampleCosHorizon = dot(viewDir, normalize(viewDelta));\n\t\t\t\t\t\tcosHorizons.x += max(0., (sampleCosHorizon - cosHorizons.x) * mix(1., 2. / float(j + 2), distanceFallOff) * clipRangeCheck.x * clipRangeCheck.y);\n\t\t\t\t\t}\t\t\n\t\t\t\t\t#if AO_ALGORITHM == 4\n\t\t\t\t\t\tsampleSceneUvDepth = getSceneUvAndDepth(viewPos - sampleViewOffset);\n\t\t\t\t\t\tsampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z);\n\t\t\t\t\t\tviewDelta = sampleSceneViewPos - viewPos;\n\t\t\t\t\t\tif (abs(viewDelta.z) < thickness) {\n\t\t\t\t\t\t\tvec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n\t\t\t\t\t\t\tfloat sampleCosHorizon = dot(viewDir, normalize(viewDelta));\n\t\t\t\t\t\t\tcosHorizons.y += max(0., (sampleCosHorizon - cosHorizons.y) * mix(1., 2. / float(j + 2), distanceFallOff) * clipRangeCheck.x * clipRangeCheck.y);\t\n\t\t\t\t\t\t}\n\t\t\t\t\t#endif\n\t\t\t\t#elif AO_ALGORITHM == 2\n\t\t\t\t\t// N8AO\n\t\t\t\t\tfloat weight = dot(viewNormal, sampleDir.xyz);\n\t\t\t\t\tfloat occlusion = weight * step(sceneSampleDist + bias, sampleDist);\n\t\t\t\t#elif AO_ALGORITHM == 1\n\t\t\t\t\t// SAO\n\t\t\t\t\tvec3 viewDelta = sampleSceneViewPos - viewPos;\n\t\t\t\t\tfloat minResolution = 0.; // ?\n\t\t\t\t\tfloat scaledViewDist = length( viewDelta ) / scale;\n\t\t\t\t\tfloat weight = 1.;\n\t\t\t\t\tfloat occlusion = max(0., (dot(viewNormal, viewDelta) - minResolution) / scaledViewDist - bias) / (1. + scaledViewDist * scaledViewDist );\n\t\t\t\t#else\n\t\t\t\t\t// SSAO\n\t\t\t\t\tfloat weight = 1.;\n\t\t\t\t\tfloat occlusion = step(sceneSampleDist + bias, sampleDist);\n\t\t\t\t#endif\n\n\t\t#if AO_ALGORITHM == 4\t\n\t\t\t\t}\n\t\t\t\t// GTAO\n\t\t\t\tvec2 sinHorizons = sqrt(1. - cosHorizons * cosHorizons);\n\t\t\t\tfloat nx = dot(normalInSlice, sliceTangent);\n\t\t\t\tfloat ny = dot(normalInSlice, viewDir);\n\t\t\t\tfloat nxb = 1. / 2. * (acos(cosHorizons.y) - acos(cosHorizons.x) + sinHorizons.x * cosHorizons.x - sinHorizons.y * cosHorizons.y);\n\t\t\t\tfloat nyb = 1. / 2. * (2. - cosHorizons.x * cosHorizons.x - cosHorizons.y * cosHorizons.y);\n\t\t\t\tfloat occlusion = nx * nxb + ny * nyb;\n\t\t\t\tao += occlusion;\n\t\t\t}\n\t\t\tao = clamp(ao / float(DIRECTIONS), 0., 1.);\t\n\t\t#elif AO_ALGORITHM == 3\n\t\t\t\t}\n\t\t\t\ttotalWeight += 1.;\n\t\t\t\tao += max(0., cosHorizons.x - max(0., cosHorizons.y));\n\t\t\t}\n\t\t\tao /= totalWeight + 1. - step(0., totalWeight);\n\t\t\tao = clamp(1. - ao, 0., 1.);\n\t\t#else\n\n\t\t\t\tfloat fallOff = getFallOff(sceneSampleDist - sampleDist, distanceFalloffToUse);\n\t\t\t\tocclusion *= fallOff;\n\t\t\t\tvec2 diff = (vUv - sampleSceneUvDepth.xy) * resolution;\n\t\t\t\tocclusion *= step(1., dot(diff, diff));\n\t\t\t\tvec2 clipRangeCheck = step(0., sampleSceneUvDepth.xy) * step(sampleSceneUvDepth.xy, vec2(1.));\n\t\t\t\tocclusion *= clipRangeCheck.x * clipRangeCheck.y;\n\t\t\t\tweight *= clipRangeCheck.x * clipRangeCheck.y;\n\t\t\t\ttotalWeight += weight;\n\t\t\t\tao += occlusion;\n\t\t\t}\n\t\t\tao /= totalWeight + 1. - step(0., totalWeight);\n\t\t\tao = clamp(1. - ao, 0., 1.);\n\t\t#endif\t\n\n\t\t#if SCENE_CLIP_BOX == 1\n\t\t\tao = mix(ao, 1., smoothstep(0., radiusToUse, boxDistance));\n\t\t#endif\n\t\t#if AO_ALGORITHM != 1\n\t\t\tao = pow(ao, scale);\n\t\t#endif\n\t\t\tgl_FragColor = FRAGMENT_OUTPUT;\n\t\t}"},Yp={resolutionScale:1,algorithm:0,samples:32,radius:.25,distanceExponent:2,thickness:.5,distanceFallOff:.5,scale:1,bias:.01,screenSpaceRadius:!1};class qp{get texture(){var e;return this._renderTarget?null===(e=this._renderTarget)||void 0===e?void 0:e.texture:null}constructor(e,t,n,i,r){this.needsUpdate=!0,this.parameters=Object.assign({},Yp),this._width=0,this._height=0,this._samples=0,this._gBufferAntiAliasing=!1,this._normalVectorSourceType=Hp,this._depthValueSourceType=Gp,this._modulateRedChannel=!1,this.depthTexture=null,this.normalTexture=null,this._noiseTexture=null,this._renderTarget=null,this._passRenderer=new Rh,this._sceneClipBox=new fn(new dn(-1,-1,-1),new dn(1,1,1)),this._sceneScale=1,this._width=e,this._height=t,this._samples=n,this._gBufferAntiAliasing=i,this._normalVectorSourceType=(null==r?void 0:r.normalVectorSourceType)||Hp,this._depthValueSourceType=(null==r?void 0:r.depthValueSourceType)||Gp,this._modulateRedChannel=(null==r?void 0:r.modulateRedChannel)||!1,(null==r?void 0:r.aoParameters)&&(this.parameters=r.aoParameters),r&&this.updateTextures(r)}_getNoiseTexture(e=64){if(!this._noiseTexture){const t=new wh,n=new Uint8Array(e*e*4);for(let i=0;i{const t=new wh,n=Math.floor(e)%2==0?Math.floor(e)+1:Math.floor(e),i=(e=>{const t=Math.floor(e)%2==0?Math.floor(e)+1:Math.floor(e),n=t*t,i=Array(n).fill(0);let r=Math.floor(t/2),a=t-1;for(let e=1;e<=n;)-1===r&&a===t?(a=t-2,r=0):(a===t&&(a=0),r<0&&(r=t-1)),0===i[r*t+a]?(i[r*t+a]=e++,a++,r--):(a-=2,r++);return i})(n),r=i.length,a=new Uint8Array(4*r);for(let n=0;n{const r=Qp(e,t,n,i);let a="vec3[SAMPLES](";for(let t=0;t{const r=[];for(let a=0;a\n#include \n\n#if LUMINANCE_WEIGHTED == 1 \n\n#ifndef LUMINANCE_TYPE\n#define LUMINANCE_TYPE float\n#endif\n#ifndef SAMPLE_LUMINANCE\n#define SAMPLE_LUMINANCE dot(vec3(0.2125, 0.7154, 0.0721), a)\n#endif\n#define WEIGHT_TYPE LUMINANCE_TYPE\n\n#else\n#define WEIGHT_TYPE float\n#endif\n\n#ifndef FRAGMENT_OUTPUT\n#define FRAGMENT_OUTPUT vec4(vec3(denoised), 1.)\n#endif\n\nLUMINANCE_TYPE getLuminance(const in vec3 a) {\n return SAMPLE_LUMINANCE;\n}\n\nconst vec3 poissonDisk[SAMPLES] = SAMPLE_VECTORS;\n\nvec3 getViewPosition(const in vec2 screenPosition, const in float depth) {\n vec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0);\n vec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition;\n return viewSpacePosition.xyz / viewSpacePosition.w;\n}\n\nfloat getDepth(const vec2 uv) {\n#if DEPTH_VALUE_SOURCE == 1 \n return textureLod(tDepth, uv.xy, 0.0).a;\n#else\n return textureLod(tDepth, uv.xy, 0.0).r;\n#endif\n}\n\nfloat fetchDepth(const ivec2 uv) {\n#if DEPTH_VALUE_SOURCE == 1 \n return texelFetch(tDepth, uv.xy, 0).a;\n#else\n return texelFetch(tDepth, uv.xy, 0).r;\n#endif\n}\n\nvec3 computeNormalFromDepth(const vec2 uv) {\n vec2 size = vec2(textureSize(tDepth, 0));\n ivec2 p = ivec2(uv * size);\n float c0 = fetchDepth(p);\n float l2 = fetchDepth(p - ivec2(2, 0));\n float l1 = fetchDepth(p - ivec2(1, 0));\n float r1 = fetchDepth(p + ivec2(1, 0));\n float r2 = fetchDepth(p + ivec2(2, 0));\n float b2 = fetchDepth(p - ivec2(0, 2));\n float b1 = fetchDepth(p - ivec2(0, 1));\n float t1 = fetchDepth(p + ivec2(0, 1));\n float t2 = fetchDepth(p + ivec2(0, 2));\n float dl = abs((2.0 * l1 - l2) - c0);\n float dr = abs((2.0 * r1 - r2) - c0);\n float db = abs((2.0 * b1 - b2) - c0);\n float dt = abs((2.0 * t1 - t2) - c0);\n vec3 ce = getViewPosition(uv, c0).xyz;\n vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz\n : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz;\n vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz\n : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz;\n return normalize(cross(dpdx, dpdy));\n}\n\nvec3 getViewNormal(const vec2 uv) {\n#if NORMAL_VECTOR_TYPE == 2\n return normalize(textureLod(tNormal, uv, 0.).rgb);\n#elif NORMAL_VECTOR_TYPE == 1\n return unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb);\n#else\n return computeNormalFromDepth(uv);\n#endif\n}\n\nvoid denoiseSample(in vec3 center, in vec3 viewNormal, in vec3 viewPos, in vec2 sampleUv, inout vec3 denoised, inout WEIGHT_TYPE totalWeight) {\n vec4 sampleTexel = textureLod(tDiffuse, sampleUv, 0.0);\n float sampleDepth = getDepth(sampleUv);\n vec3 sampleNormal = getViewNormal(sampleUv);\n vec3 neighborColor = sampleTexel.rgb;\n vec3 viewPosSample = getViewPosition(sampleUv, sampleDepth);\n \n float normalDiff = dot(viewNormal, sampleNormal);\n float normalSimilarity = pow(max(normalDiff, 0.), normalPhi);\n float depthDiff = abs(dot(normalize(viewPos - viewPosSample), viewNormal));\n float depthSimilarity = max(1. - depthDiff / depthPhi, 0.);\n #if LUMINANCE_WEIGHTED == 1 \n LUMINANCE_TYPE lumaDiff = abs(getLuminance(neighborColor) - getLuminance(center));\n LUMINANCE_TYPE lumaSimilarity = max(1. - lumaDiff / lumaPhi, 0.);\n LUMINANCE_TYPE w = lumaSimilarity * depthSimilarity * normalSimilarity;\n #else\n WEIGHT_TYPE w = depthSimilarity * normalSimilarity;\n #endif\n\n denoised += w * neighborColor;\n totalWeight += w;\n}\n\nvoid main() {\n float depth = fetchDepth(ivec2(vec2(textureSize(tDepth, 0)) * vUv.xy));\t\n vec3 viewNormal = getViewNormal(vUv);\t\n if (depth == 1. || dot(viewNormal, viewNormal) == 0.) {\n discard;\n return;\n }\n vec4 texel = textureLod(tDiffuse, vUv, 0.0);\n vec3 center = texel.rgb;\n vec3 viewPos = getViewPosition(vUv, depth);\n\n #if SCENE_CLIP_BOX == 1\n vec3 worldPos = (cameraWorldMatrix * vec4(viewPos, 1.0)).xyz;\n float boxDistance = length(max(vec3(0.0), max(sceneBoxMin - worldPos, worldPos - sceneBoxMax)));\n if (boxDistance > radius * 2.) {\n discard;\n return;\n }\n\t\t#endif\n\n vec2 noiseResolution = vec2(textureSize(tNoise, 0));\n vec2 noiseUv = vUv * resolution / noiseResolution;\n vec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0);\n vec2 noiseVec = vec2(sin(noiseTexel[iteration % 4] * 2. * PI), cos(noiseTexel[iteration % 4] * 2. * PI));\n #if SAMPLE_DISTRIBUTION == 1\n vec3 randomVec = normalize(vec3(noiseVec.xy, 0.));\n vec3 tangent = normalize(randomVec - viewNormal * dot(randomVec, viewNormal));\n vec3 bitangent = cross(viewNormal, tangent);\n mat3 kernelMatrix = mat3(tangent, bitangent, viewNormal);\n #else\n mat2 rotationMatrix = mat2(noiseVec.x, -noiseVec.y, noiseVec.x, noiseVec.y);\n #endif\n\n WEIGHT_TYPE totalWeight = WEIGHT_TYPE(1.);\n vec3 denoised = texel.rgb;\n for (int i = 0; i < SAMPLES; i++) {\n vec3 sampleDir = poissonDisk[i];\n #if SAMPLE_DISTRIBUTION == 1\n vec3 offsetViewPos = viewPos + normalize(kernelMatrix * vec3(sampleDir.xy, 0.)) * sampleDir.z * radius * radius;\n vec4 samplePointNDC = cameraProjectionMatrix * vec4(offsetViewPos, 1.0); \n vec2 sampleUv = (samplePointNDC.xy / samplePointNDC.w * 0.5 + 0.5);\n #else\n vec2 offset = rotationMatrix * sampleDir.xy * (1. + sampleDir.z * (radius - 1.));\n offset *= mix(vec2(1.0), sqrt(1.0 - viewNormal.xy * viewNormal.xy), float(iteration) / float(noOfIterations-1));\n offset *= max(1.0, 1.0 / length(offset));\n vec2 sampleUv = vUv + offset / resolution;\n #endif\n denoiseSample(center, viewNormal, viewPos, sampleUv, denoised, totalWeight);\n }\n\n denoised /= totalWeight + 1.0 - step(0.0, totalWeight);\n gl_FragColor = FRAGMENT_OUTPUT;\n}"},ef={iterations:2,samples:16,rings:2.89,radiusExponent:1.3,radius:4,lumaPhi:10,depthPhi:2.5,normalPhi:.5,nvOrientatedSamples:!1};class tf{get texture(){return this.parameters.iterations>0&&this._renderTargets.length>0?this._renderTargets[this._outputRenderTargetIndex].texture:this._inputTexture}set inputTexture(e){this._inputTexture=e}constructor(e,t,n,i){this.needsUpdate=!0,this.parameters=Object.assign({},ef),this._width=0,this._height=0,this._samples=0,this._normalVectorSourceType=Hp,this._depthValueSourceType=Gp,this._inputTexture=null,this.depthTexture=null,this.normalTexture=null,this._noiseTexture=null,this._renderTargets=[],this._outputRenderTargetIndex=0,this._passRenderer=new Rh,this._rgInputTexture=!1,this._luminanceWeighted=!0,this._width=e,this._height=t,this._samples=n,this._normalVectorSourceType=(null==i?void 0:i.normalVectorSourceType)||Hp,this._depthValueSourceType=(null==i?void 0:i.depthValueSourceType)||Gp,this._inputTexture=(null==i?void 0:i.inputTexture)||null,this.depthTexture=(null==i?void 0:i.depthTexture)||null,this.normalTexture=(null==i?void 0:i.normalTexture)||null,this._rgInputTexture=(null==i?void 0:i.rgInputTexture)||!1,this._luminanceWeighted=!0===(null==i?void 0:i.luminanceWeighted),this._luminanceType=(null==i?void 0:i.luminanceType)||"vec3",this._sampleLuminance=(null==i?void 0:i.sampleLuminance)||"a",this._fragmentOutput=(null==i?void 0:i.fragmentOutput)||"vec4(denoised.xyz, 1.)",(null==i?void 0:i.poissonDenoisePassParameters)&&(this.parameters=i.poissonDenoisePassParameters),i&&this.updateTextures(i)}_getNoiseTexture(e=64){if(!this._noiseTexture){const t=new wh,n=new Uint8Array(e*e*4);for(let i=0;ie.dispose()))}setSize(e,t){this._width=e,this._height=t,this._renderTargets.forEach((n=>n.setSize(e,t))),this.needsUpdate=!0}updateBounds(e){this._sceneClipBox=(new fn).copy(e),this.needsUpdate=!0}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t],this.needsUpdate=!0)}updateTextures(e){e.inputTexture&&(this._inputTexture=e.inputTexture,this.needsUpdate=!0),e.depthTexture&&(this.depthTexture=e.depthTexture,this.needsUpdate=!0),e.normalTexture&&(this.normalTexture=e.normalTexture,this.needsUpdate=!0)}render(e,t){const n=this._getMaterial(t,this.needsUpdate);this.needsUpdate=!1;const i=this._getRenderTargets();n.uniforms.iteration.value=this.parameters.iterations;for(let t=0;t.001,r=e===rf&&t>.001&&t<.999;return{fadeInPoissonShadow:i,fadeInHardShadow:r,onlyHardShadow:e===rf&&!r,progressiveDenoise:!i&&!r&&n>1&&n<=this.parameters.progressiveDenoiseIterations+1}}renderPass(e){if(!this._setRenderState())return;const t=this._getRenderConditions(this.shadowAndAoPassSettings.shadowFadeInBlurType,this.shadowAndAoPassSettings.shadowFadeInMix,this.shadowAndAoPassSettings.noOStaticFrames);let n=!1;!t.onlyHardShadow&&this.shadowAndAoPassSettings.shadowBlurType===sf&&this._evaluateIfUpdateIsNeeded(this.camera)&&(this._renderShadowAndAo(e,this.scene,this.camera,this.shadowAndAoPassSettings.shadowMapTexture),n=!0);let i=t.onlyHardShadow?this.shadowAndAoPassSettings.shadowMapTexture:this.denoiseRenderTargetTexture;t.fadeInPoissonShadow&&(i=this._renderDynamicShadow(e,this.aoAndSoftShadowRenderTarget.texture,this.shadowAndAoPassSettings.shadowMapTexture,this.shadowAndAoPassSettings.shadowFadeInMix),n=!0),n?i=this._renderDenoise(e,this.camera,t.fadeInPoissonShadow,!1):t.progressiveDenoise&&(i=this._renderDenoise(e,this.camera,!1,!0)),t.fadeInHardShadow&&(i=this._renderDynamicShadow(e,this.denoiseRenderTargetTexture,this.shadowAndAoPassSettings.shadowMapTexture,this.shadowAndAoPassSettings.shadowFadeInMix)),this._finalTexture=i,this._onlyHardShadow=t.onlyHardShadow,this.renderToRenderTarget&&this.renderToTarget(e)}_setRenderState(){return!(!this.parameters.enabled||!(null!==this.parameters.ao.algorithm||this.parameters.shadowIntensity>=.01)||(this.needsUpdate&&(this._aoPass&&(this._aoPass.needsUpdate=!0),this._poissonDenoisePass&&(this._poissonDenoisePass.needsUpdate=!0)),0))}_evaluateIfUpdateIsNeeded(e){e.updateProjectionMatrix();const t=this.parameters.alwaysUpdate||this.needsUpdate||null!=e&&this._cameraUpdate.changed(e);return this.needsUpdate=!1,t}_renderShadowAndAo(e,t,n,i){var r;const a=null!==this.parameters.ao.algorithm&&this.parameters.aoIntensity>.01;a||null===(r=this._aoPass)||void 0===r||r.clear(e,this.aoAndSoftShadowRenderTarget),this._renderSoftShadow(e,n,i),a&&this._renderAo(e,t,n)}_renderAo(e,t,n){const i=this.gBufferTextures.depthBufferTexture,r=this.gBufferTextures.gBufferTexture,a=this._aoAndSoftShadowRenderTarget,s=e.autoClear;e.autoClear=!1;const o=this.aoRenderPass;o.depthTexture=i,o.normalTexture=r,o.render(e,n,t,a),e.autoClear=s}_renderSoftShadow(e,t,n){const i=this.softShadowPass;i.parameters.radius=this.parameters.shadow.shadowRadius,i.inputTexture=n,this.softShadowPass.renderToTarget(e,t,this.aoAndSoftShadowRenderTarget)}_renderDynamicShadow(e,t,n,i=1){const r=i<.999;return r&&(this._copyMaterial.update({texture:t,blending:0,colorTransform:ah,colorBase:hh,multiplyChannels:0}),this.passRenderer.renderScreenSpace(e,this._copyMaterial,this.fadeRenderTarget)),i>.001&&(this._blendMaterial.update({texture:n,blending:r?5:0,colorTransform:(new Hn).set(0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,r?i:1),multiplyChannels:0}),this.passRenderer.renderScreenSpace(e,this._blendMaterial,this.fadeRenderTarget)),this.fadeRenderTarget.texture}_renderDenoise(e,t,n,i){const r=this.denoisePass;return r.inputTexture=n?this.fadeRenderTarget.texture:i?r.texture:this.aoAndSoftShadowRenderTarget.texture,r.render(e,t),r.texture}renderToTarget(e){const t=this._onlyHardShadow?this.parameters.shadowIntensity:this.parameters.aoIntensity,n=this._onlyHardShadow?0:this.parameters.shadowIntensity;this.passRenderer.renderScreenSpace(e,this._blendAoAndShadowMaterial.update({texture:this._finalTexture,blending:5,aoIntensity:t,shadowIntensity:n}),e.getRenderTarget())}}lf.shadowTransform=(new Hn).set(0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1);class cf{get isOutlinePassActivated(){return this.outlinePassActivated}get outlinePass(){return this._renderPassManager.outlinePass}constructor(e,t,n){this._effectComposer=null,this.outlinePassActivated=!1,this._renderPassManager=e,this._effectComposer=t,this.parameters=Object.assign({enabled:!0,edgeStrength:2,edgeGlow:1,edgeThickness:2,pulsePeriod:0,usePatternTexture:!1,visibleEdgeColor:16777215,hiddenEdgeColor:16777215},n)}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}applyParameters(){this.outlinePass&&(this.outlinePass.edgeStrength=this.parameters.edgeStrength,this.outlinePass.edgeGlow=this.parameters.edgeGlow,this.outlinePass.edgeThickness=this.parameters.edgeThickness,this.outlinePass.pulsePeriod=this.parameters.pulsePeriod,this.outlinePass.usePatternTexture=this.parameters.usePatternTexture,this.outlinePass.visibleEdgeColor.set(this.parameters.visibleEdgeColor),this.outlinePass.hiddenEdgeColor.set(this.parameters.hiddenEdgeColor))}activateOutline(e,t){var n;if(!this.parameters.enabled)return void this.deactivateOutline();const i=(null===(n=this.outlinePass)||void 0===n?void 0:n.renderCamera)&&t.isPerspectiveCamera!==this.outlinePass.renderCamera.isPerspectiveCamera;this.outlinePass&&(this.outlinePass.renderScene=e,this.outlinePass.renderCamera=t),!i&&this.outlinePassActivated||(!i&&this.outlinePass||this._renderPassManager.createOutlinePass(),this.applyParameters(),this._effectComposer&&this._effectComposer.addPass(this.outlinePass),this.outlinePassActivated=!0)}deactivateOutline(){this.outlinePassActivated&&(this.outlinePass&&this._effectComposer&&this._effectComposer.removePass(this.outlinePass),this.outlinePassActivated=!1)}updateOutline(e,t,n){n.length>0?(this.activateOutline(e,t),this.outlinePass&&(this.outlinePass.selectedObjects=n)):this.deactivateOutline()}}const hf=(e,t)=>{for(const n in t)try{t[n].constructor===Object?e[n]=hf(e[n],t[n]):e[n]=t[n]}catch(i){e[n]=t[n]}return e},df="default",uf={shadowType:"PCFSoftShadowMap",shAndAoPassParameters:{aoIntensity:.3,shadow:{shadowRadius:.1},ao:{algorithm:0,samples:32,radius:.02,distanceExponent:2,thickness:.1,distanceFallOff:1,bias:.01},poissonDenoise:{iterations:2,samples:16,rings:2.89,radius:4,radiusExponent:1.3,depthPhi:2.5,normalPhi:.5}},groundReflectionParameters:{brightness:.5}},pf=e=>Math.max(0,Math.min(1,e));class ff{constructor(e){this.needsUpdate=!0,this._cache=null,this._cache=e}dispose(){var e;null===(e=this._cache)||void 0===e||e.dispose()}clear(){var e;null===(e=this._cache)||void 0===e||e.clear(),this.needsUpdate=!0}update(e){this.needsUpdate&&this._cache&&(e.traverse((e=>{var t,n,i;e.isLine||e.isPoints?null===(t=this._cache)||void 0===t||t.addLineOrPoint(e):e.isMesh?null===(n=this._cache)||void 0===n||n.addMesh(e):null===(i=this._cache)||void 0===i||i.addObject(e)})),this.needsUpdate=!1)}onBeforeRender(){var e;null===(e=this._cache)||void 0===e||e.onBeforeRender()}onAfterRender(){var e;null===(e=this._cache)||void 0===e||e.onAfterRender()}}class mf{constructor(){this._cacheMap=new Map}dispose(){this._cacheMap.forEach((e=>{e.dispose()}))}registerCache(e,t){this._cacheMap.set(e,new ff(t))}clearCache(){this._cacheMap.forEach((e=>{e.clear()}))}clearObjectCache(e){const t=this._cacheMap.get(e);t&&t.clear()}onBeforeRender(e,t){const n=this._cacheMap.get(e);n&&(n.update(t),n.onBeforeRender())}onAfterRender(e){const t=this._cacheMap.get(e);t&&t.onAfterRender()}render(e,t,n){const i=this._cacheMap.get(e);i&&(i.update(t),i.onBeforeRender()),n(),i&&i.onAfterRender()}}class gf{constructor(e){this._visibilityCache=new Map,this._isObjectInvisible=e}dispose(){this._visibilityCache.clear()}clear(){this._visibilityCache.clear()}addLineOrPoint(e){this._visibilityCache.set(e,e.visible)}addMesh(e){this._isObjectInvisible&&this._isObjectInvisible(e)&&this._visibilityCache.set(e,e.visible)}addObject(e){this._isObjectInvisible&&this._isObjectInvisible(e)&&this._visibilityCache.set(e,e.visible)}onBeforeRender(){this._visibilityCache.forEach(((e,t)=>{t.visible=!1}))}onAfterRender(){this._visibilityCache.forEach(((e,t)=>{t.visible=e}))}}class vf{constructor(e){this._depthWriteCache=new Set,this._doNotWriteDepth=e}dispose(){this._depthWriteCache.clear()}clear(){this._depthWriteCache.clear()}addLineOrPoint(e){}addObject(e){}addMesh(e){this._doNotWriteDepth&&this._doNotWriteDepth(e)&&e.material instanceof Wl&&e.material.depthWrite&&this._depthWriteCache.add(e.material)}onBeforeRender(){this._depthWriteCache.forEach((e=>{e.depthWrite=!1}))}onAfterRender(){this._depthWriteCache.forEach((e=>{e.depthWrite=!0}))}}class _f{constructor(){this._objectCache=new Map}clear(){this._objectCache.clear()}onBeforeRender(){this._objectCache.forEach(((e,t)=>{t instanceof mr&&(t.material!==e.originalObjectData.material&&t.material!==e.updateObjectData.material&&(e.originalObjectData.material=t.material),t.receiveShadow!==e.originalObjectData.receiveShadow&&(e.originalObjectData.receiveShadow=t.receiveShadow),t.castShadow!==e.originalObjectData.castShadow&&(e.originalObjectData.castShadow=t.castShadow),t.visible!==e.originalObjectData.visible&&(e.originalObjectData.visible=t.visible)),this._updateObject(t,e.updateObjectData)}))}onAfterRender(){this._objectCache.forEach(((e,t)=>{this._updateObject(t,e.originalObjectData)}))}addToCache(e,t){this._objectCache.set(e,{originalObjectData:{visible:e.visible,castShadow:e.castShadow,receiveShadow:e instanceof mr?e.receiveShadow:void 0,material:e instanceof mr?e.material:void 0},updateObjectData:t})}_updateObject(e,t){void 0!==t.visible&&(e.visible=t.visible),void 0!==t.castShadow&&(e.castShadow=t.castShadow),e instanceof mr&&void 0!==t.receiveShadow&&(e.receiveShadow=t.receiveShadow),e instanceof mr&&void 0!==t.material&&(e.material=t.material)}}class xf extends zp{get shadowGroundPlane(){var e;let t=this._sharedShadowGroundPlane;return t||(null!==(e=this._shadowGroundPlane)&&void 0!==e||(this._shadowGroundPlane=new Bp(this.renderTarget.texture,this.parameters)),t=this._shadowGroundPlane),t.parent!==this._groundGroup&&this._groundGroup.add(t),t}constructor(e,t,n,i){var r,a;super(e),this.limitPlaneSize=!0,this.needsUpdate=!0,this.noNeedOfUpdateCount=0,this._blurScale=1,this._shadowScale=1,this._groundGroup=n,this.shadowMapSize=null!==(r=i.shadowMapSize)&&void 0!==r?r:2048,this.parameters=this._getDefaultParameters(i),this._groundShadowFar=this.parameters.cameraFar,this._renderer=t,null===(a=this.renderCacheManager)||void 0===a||a.registerCache(this,new gf((e=>e.isMesh&&!(e=>{var t;if(!e.isMesh)return!1;if(!e.castShadow&&!(null===(t=e.userData)||void 0===t?void 0:t.meshId))return!1;const n=e.material;return!n.transparent||n.opacity>.5})(e)||void 0!==e.name&&["Ground","Floor"].includes(e.name)))),this.renderTarget=new on(this.shadowMapSize,this.shadowMapSize),this.renderTarget.texture.generateMipmaps=!1,this._renderTargetBlur=new on(this.shadowMapSize,this.shadowMapSize),this._renderTargetBlur.texture.generateMipmaps=!1,this._sharedShadowGroundPlane=null==i?void 0:i.sharedShadowGroundPlane,this.shadowGroundPlane.setShadowMap(this.renderTarget.texture),this.shadowGroundPlane.updateMaterial(this.parameters),this._groundContactCamera=new yf,this._groundGroup.add(this._groundContactCamera),this._depthMaterial=new co,this._depthMaterial.userData.fadeoutBias={value:this.parameters.fadeoutBias},this._depthMaterial.userData.fadeoutFalloff={value:this.parameters.fadeoutFalloff},this._depthMaterial.onBeforeCompile=e=>{e.uniforms.fadeoutBias=this._depthMaterial.userData.fadeoutBias,e.uniforms.fadeoutFalloff=this._depthMaterial.userData.fadeoutFalloff,e.fragmentShader=`\n uniform float fadeoutBias;\n uniform float fadeoutFalloff;\n ${e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );",Bp.alphaMap?"gl_FragColor = vec4(clamp(pow(1.0 + fadeoutBias - fragCoordZ, 1.0/(1.0-fadeoutFalloff)), 0.0, 1.0));":"gl_FragColor = vec4(vec3(0.0), clamp(pow(1.0 + fadeoutBias - fragCoordZ, 1.0/(1.0-fadeoutFalloff)), 0.0, 1.0));")}\n `},this._depthMaterial.side=2,this._depthMaterial.depthTest=!0,this._depthMaterial.depthWrite=!0,this._blurPass=new Ch(gh,Object.assign(Object.assign({},i),{passRenderer:this.renderPassManager.passRenderer})),this.updatePlaneAndShadowCamera()}_getDefaultParameters(e){return Object.assign({enabled:!0,cameraHelper:!1,alwaysUpdate:!1,fadeIn:!1,blurMin:.001,blurMax:.1,fadeoutFalloff:.9,fadeoutBias:.03,opacity:.5,maximumPlaneSize:40,planeSize:10,cameraFar:3,hardLayers:null,softLayers:null,polygonOffset:2,excludeGroundObjects:!0},e)}dispose(){this.renderTarget.dispose(),this._renderTargetBlur.dispose(),this._blurPass.dispose(),this._depthMaterial.dispose()}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t]);void 0!==e.cameraFar&&(this._groundShadowFar=this.parameters.cameraFar)}applyParameters(){this.shadowGroundPlane.updateMaterial(this.parameters),this._groundContactCamera.updateCameraHelper(this.parameters.cameraHelper),this._groundContactCamera.far!==this.parameters.cameraFar&&this.updatePlaneAndShadowCamera();const e=this.parameters.fadeoutFalloff;this._depthMaterial.userData.fadeoutFalloff.value!==e&&(this._depthMaterial.userData.fadeoutFalloff.value=this.parameters.fadeoutFalloff);const t=this.parameters.fadeoutBias/this._groundContactCamera.far;this._depthMaterial.userData.fadeoutBias.value!==t&&(this._depthMaterial.userData.fadeoutBias.value=t),this.needsUpdate=!0}setScale(e,t){this._blurScale=e,this._shadowScale=null!=t?t:e,this.needsUpdate=!0}updateBounds(e,t){var n;this._groundShadowFar=this.parameters.cameraFar,this._groundShadowFarthis.parameters.maximumPlaneSize?(this.parameters.planeSize=this.parameters.maximumPlaneSize,this._groundGroup.position.set(0,null!=t?t:0,0)):this._groundGroup.position.set(e.center.x,null!=t?t:0,e.center.z),this._groundGroup.updateMatrixWorld(),this.updatePlaneAndShadowCamera()}updatePlaneAndShadowCamera(){const e=this.parameters.planeSize;this.shadowGroundPlane.scale.x=e,this.shadowGroundPlane.scale.y=e,this._groundContactCamera.updateCameraFormPlaneSize(e,this._groundShadowFar),this.needsUpdate=!0}setGroundVisibilityLayers(e){this.shadowGroundPlane.setVisibilityLayers(e)}renderPass(e){if(this._groundContactCamera.updateCameraHelper(this.parameters.cameraHelper,this.scene),!this.parameters.enabled)return void(this.needsUpdate&&(this.needsUpdate=!1,this.passRenderer.clear(e,this.renderTarget,0,1)));if(this.shadowGroundPlane.visible=this.parameters.enabled,this.parameters.alwaysUpdate||this.needsUpdate)this.noNeedOfUpdateCount=0;else if(this.noNeedOfUpdateCount++,this.noNeedOfUpdateCount>=10)return;this.needsUpdate=!1,this.shadowGroundPlane.material.opacity=this.parameters.alwaysUpdate||!this.parameters.fadeIn?this.parameters.opacity:this.parameters.opacity*(this.noNeedOfUpdateCount+2)/12;const t=this._renderer.getClearAlpha();this._renderer.setClearAlpha(0),this._groundGroup.visible=!1,this.shadowGroundPlane.visible=!1,this._groundContactCamera.setCameraHelperVisibility(!1),0===this.noNeedOfUpdateCount?(this._renderGroundContact(this.scene),this._renderBlur()):1===this.noNeedOfUpdateCount&&this._renderBlur(),this._renderReduceBandingBlur(),this._renderer.setRenderTarget(null),this._renderer.setClearAlpha(t),this._groundGroup.visible=!0,this.shadowGroundPlane.visible=this.parameters.enabled,this._groundContactCamera.setCameraHelperVisibility(this.parameters.cameraHelper)}_renderGroundContact(e){const t=e.background;e.background=null,e.overrideMaterial=this._depthMaterial,this._renderer.setRenderTarget(this.renderTarget),this._renderer.clear();const n=this._renderer.autoClear;this._renderer.autoClear=!1,this.parameters.hardLayers&&(this._groundContactCamera.layers.mask=this.parameters.hardLayers.mask,this._groundContactCamera.updateCameraFarPlane(10),this._depthMaterial.userData.fadeoutBias.value=.99,this._renderer.render(e,this._groundContactCamera),this._groundContactCamera.updateCameraFarPlane(this._groundShadowFar),this._depthMaterial.userData.fadeoutBias.value=this.parameters.fadeoutBias/this._groundShadowFar),this._groundContactCamera.layers.enableAll(),this.parameters.softLayers&&(this._groundContactCamera.layers.mask=this.parameters.softLayers.mask),this.renderCacheManager?this.renderCacheManager.render(this,e,(()=>{this._renderer.render(e,this._groundContactCamera)})):this._renderer.render(e,this._groundContactCamera),this._renderer.autoClear=n,e.overrideMaterial=null,e.background=t}_renderBlur(){this._renderBlurPass(this._blurScale*this.parameters.blurMin/this.parameters.planeSize,this._blurScale*this.parameters.blurMax/this.parameters.planeSize)}_renderReduceBandingBlur(){const e=.01*this._blurScale/this.parameters.planeSize;this._renderBlurPass(e,e)}_renderBlurPass(e,t){this._blurPass.render(this._renderer,[this.renderTarget,this._renderTargetBlur,this.renderTarget],[e,e],[t,t])}}xf.addTestMesh=!1;class yf extends ea{constructor(){super(-1,1,-1,1,-1,1),this.rotation.x=Math.PI}updateCameraFormPlaneSize(e,t){var n;this.left=-e/2,this.right=e/2,this.top=-e/2,this.bottom=e/2,this.near=0,this.far=t,this.updateProjectionMatrix(),null===(n=this.cameraHelper)||void 0===n||n.update()}updateCameraFarPlane(e){var t;this.far=e,this.updateProjectionMatrix(),null===(t=this.cameraHelper)||void 0===t||t.update()}updateCameraHelper(e,t){var n,i,r;e?(this.cameraHelper=null!==(n=this.cameraHelper)&&void 0!==n?n:new th(this),this.cameraHelper.visible=!0,null==t||t.add(this.cameraHelper)):(null===(i=this.cameraHelper)||void 0===i?void 0:i.parent)&&(null===(r=this.cameraHelper)||void 0===r||r.removeFromParent())}setCameraHelperVisibility(e){this.cameraHelper&&(this.cameraHelper.visible=e)}}class Sf extends wr{constructor(e){var t;super({defines:Object.assign(Object.assign(Object.assign({},Sf._normalAndDepthShader.defines),{FLOAT_BUFFER:(null==e?void 0:e.floatBufferType)?1:0,LINEAR_DEPTH:(null==e?void 0:e.linearDepth)?1:0})),uniforms:Sr.clone(Sf._normalAndDepthShader.uniforms),vertexShader:Sf._normalAndDepthShader.vertexShader,fragmentShader:Sf._normalAndDepthShader.fragmentShader,blending:null!==(t=null==e?void 0:e.blending)&&void 0!==t?t:0}),this.update(e)}update(e){if(void 0!==(null==e?void 0:e.camera)){const t=(null==e?void 0:e.camera)||(null==e?void 0:e.camera);this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far}return this}}Sf._normalAndDepthShader={uniforms:{cameraNear:{value:.1},cameraFar:{value:1}},defines:{FLOAT_BUFFER:0,LINEAR_DEPTH:0},vertexShader:"varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n#endif\n\n void main() {\n vNormal = normalMatrix * normal;\n vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);\n #if LINEAR_DEPTH == 1\n vZ = viewPosition.z; \n #endif\n gl_Position = projectionMatrix * viewPosition;\n }",fragmentShader:"varying vec3 vNormal;\n#if LINEAR_DEPTH == 1\n varying float vZ; \n uniform float cameraNear;\n uniform float cameraFar;\n#endif\n\n void main() {\n #if FLOAT_BUFFER == 1\n vec3 normal = normalize(vNormal);\n #else\n vec3 normal = normalize(vNormal) * 0.5 + 0.5;\n #endif\n #if LINEAR_DEPTH == 1\n float depth = (-vZ - cameraNear) / (cameraFar - cameraNear);\n #else\n float depth = gl_FragCoord.z;\n #endif\n gl_FragColor = vec4(normal, depth);\n }"};class wf extends zp{set groundDepthWrite(e){this._gBufferMaterialCache&&(this._gBufferMaterialCache.groundDepthWrite=e)}get isFloatGBufferWithRgbNormalAlphaDepth(){return this.floatRgbNormalAlphaDepth}get gBufferTexture(){return this.depthNormalRenderTarget.texture}get depthBufferTexture(){return this.copyToSeparateDepthBuffer&&this.floatRgbNormalAlphaDepth?this.separateDeptRenderTarget.texture:this.depthNormalRenderTarget.depthTexture}get textureWithDepthValue(){return this.floatRgbNormalAlphaDepth?this.depthNormalRenderTarget.texture:this.depthNormalRenderTarget.depthTexture}updateGBufferRenderMaterial(e){var t;return this._gBufferRenderMaterial=null!==(t=this._gBufferRenderMaterial)&&void 0!==t?t:this.floatRgbNormalAlphaDepth?new Sf({blending:0,floatBufferType:!0,linearDepth:!1}):new Yl({blending:0}),this._gBufferRenderMaterial instanceof Sf&&this._gBufferRenderMaterial.update({camera:e}),this._gBufferRenderMaterial}get depthNormalRenderTarget(){if(!this._depthNormalRenderTarget)if(this.floatRgbNormalAlphaDepth)this._depthNormalRenderTarget=new on(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale,{minFilter:this._targetMinificationTextureFilter,magFilter:this._targetMagnificationTextureFilter,type:ie,samples:this._samples});else{const e=new ba(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale);e.format=me,e.type=oe,this._depthNormalRenderTarget=new on(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale,{minFilter:this._targetMinificationTextureFilter,magFilter:this._targetMagnificationTextureFilter,depthTexture:e})}return this._depthNormalRenderTarget}get separateDeptRenderTarget(){return this._separateDeptRenderTarget||(this._separateDeptRenderTarget=new on(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale,{minFilter:this._targetMinificationTextureFilter,magFilter:this._targetMagnificationTextureFilter,type:ie,samples:0})),this._separateDeptRenderTarget}constructor(e,t){var n,i,r,a,s,o,l,c,h;super(e),this.floatRgbNormalAlphaDepth=!1,this.linearDepth=!1,this.copyToSeparateDepthBuffer=!1,this.needsUpdate=!0,this.drawGround=!0,this.floatRgbNormalAlphaDepth=null!==(i=null===(n=null==t?void 0:t.capabilities)||void 0===n?void 0:n.isWebGL2)&&void 0!==i&&i,this.renderCacheManager&&(this._gBufferMaterialCache=new bf,this.renderCacheManager.registerCache(this,this._gBufferMaterialCache)),this.parameters={depthNormalScale:null!==(r=null==t?void 0:t.depthNormalScale)&&void 0!==r?r:1},this._targetMinificationTextureFilter=null!==(a=null==t?void 0:t.textureMinificationFilter)&&void 0!==a?a:j,this._targetMagnificationTextureFilter=null!==(s=null==t?void 0:t.textureMagnificationFilter)&&void 0!==s?s:j,this._width=null!==(o=null==t?void 0:t.width)&&void 0!==o?o:1024,this._height=null!==(l=null==t?void 0:t.height)&&void 0!==l?l:1024,this._samples=null!==(c=null==t?void 0:t.samples)&&void 0!==c?c:0,this._shared=null!==(h=null==t?void 0:t.shared)&&void 0!==h&&h}dispose(){var e,t;super.dispose(),null===(e=this._gBufferRenderMaterial)||void 0===e||e.dispose(),null===(t=this._depthNormalRenderTarget)||void 0===t||t.dispose()}setSize(e,t){var n;this._width=e,this._height=t,null===(n=this._depthNormalRenderTarget)||void 0===n||n.setSize(this._width*this.parameters.depthNormalScale,this._height*this.parameters.depthNormalScale)}renderPass(e){this._shared&&!this.needsUpdate||(this.needsUpdate=!1,this.renderPassManager.setGroundVisibility(this.drawGround),this.renderCacheManager?this.renderCacheManager.render(this,this.scene,(()=>{this._renderGBuffer(e,this.scene,this.camera)})):this._renderGBuffer(e,this.scene,this.camera),this.renderPassManager.setGroundVisibility(!1),this.floatRgbNormalAlphaDepth&&this.copyToSeparateDepthBuffer&&this._copyDepthToSeparateDepthTexture(e,this.depthNormalRenderTarget))}_renderGBuffer(e,t,n){this.passRenderer.renderWithOverrideMaterial(e,t,n,this.updateGBufferRenderMaterial(n),this.depthNormalRenderTarget,7829503,1)}getCopyMaterial(e){var t;return null!==(t=this._copyMaterial)&&void 0!==t||(this._copyMaterial=new mh),this._copyMaterial.update(e)}_copyDepthToSeparateDepthTexture(e,t){this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:t.texture,blending:0,colorTransform:oh,colorBase:dh,multiplyChannels:0,uvTransform:uh}),this.separateDeptRenderTarget)}}class bf extends _f{set groundDepthWrite(e){this._groundDepthWrite=e}constructor(){super(),this._groundDepthWrite=!0}dispose(){}addLineOrPoint(e){this.addToCache(e,{visible:!1})}addMesh(e){e.userData.isFloor?this.addToCache(e,{visible:this._groundDepthWrite}):e.visible&&(e.material instanceof Ii&&(e.material.transparent&&e.material.opacity<.7||e.material.alphaTest>0)||e.material instanceof jl&&e.material.transmission>0)&&this.addToCache(e,{visible:!1})}addObject(e){}}class Mf extends zp{get reflectionRenderTarget(){var e;return this._reflectionRenderTarget=null!==(e=this._reflectionRenderTarget)&&void 0!==e?e:this._newRenderTarget(!0),this._reflectionRenderTarget}get intensityRenderTarget(){var e;return this._intensityRenderTarget=null!==(e=this._intensityRenderTarget)&&void 0!==e?e:this._newRenderTarget(!1),this._intensityRenderTarget}get blurRenderTarget(){var e;return this._blurRenderTarget=null!==(e=this._blurRenderTarget)&&void 0!==e?e:this._newRenderTarget(!1),this._blurRenderTarget}constructor(e,t,n,i,r){super(e),this.reflectionFadeInScale=1,this._width=t,this._height=n,this._samples=null!=i?i:1,this.parameters=Object.assign({enabled:!1,intensity:.25,fadeOutDistance:1,fadeOutExponent:4,brightness:1,blurHorizontal:3,blurVertical:6,blurAscent:0,groundLevel:0,groundReflectionScale:1,renderTargetDownScale:4},r),this._copyMaterial=new mh({},fh,!0,!0),this._updateCopyMaterial(null),this._reflectionIntensityMaterial=new Tf({width:this._width/this.parameters.renderTargetDownScale,height:this._height/this.parameters.renderTargetDownScale}),this._blurPass=new Ch(gh,Object.assign(Object.assign({},r),{passRenderer:this.renderPassManager.passRenderer}))}_newRenderTarget(e){const t=this._width/this.parameters.renderTargetDownScale,n=this._height/this.parameters.renderTargetDownScale,i={};if(e){const e=new ba(t,n);i.depthTexture=e,i.samples=this._samples}else i.samples=1;return new on(t,n,Object.assign({format:de},i))}dispose(){var e,t,n;super.dispose(),null===(e=this._reflectionRenderTarget)||void 0===e||e.dispose(),null===(t=this._intensityRenderTarget)||void 0===t||t.dispose(),null===(n=this._blurRenderTarget)||void 0===n||n.dispose(),this._copyMaterial.dispose()}setSize(e,t){var n,i,r,a;this._width=e,this._height=t,null===(n=this._reflectionRenderTarget)||void 0===n||n.setSize(this._width/this.parameters.renderTargetDownScale,this._height/this.parameters.renderTargetDownScale),null===(i=this._intensityRenderTarget)||void 0===i||i.setSize(this._width/this.parameters.renderTargetDownScale,this._height/this.parameters.renderTargetDownScale),null===(r=this._blurRenderTarget)||void 0===r||r.setSize(this._width/this.parameters.renderTargetDownScale,this._height/this.parameters.renderTargetDownScale),null===(a=this._reflectionIntensityMaterial)||void 0===a||a.update({width:this._width/this.parameters.renderTargetDownScale,height:this._height/this.parameters.renderTargetDownScale})}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}updateBounds(e,t){this.parameters.groundLevel=e,this.parameters.groundReflectionScale=t}_updateCopyMaterial(e,t=1){var n;const i=this.parameters.intensity*t,r=this.parameters.brightness;this._copyMaterial.update({texture:null!==(n=null==e?void 0:e.texture)&&void 0!==n?n:void 0,colorTransform:(new Hn).set(r,0,0,0,0,r,0,0,0,0,r,0,0,0,0,i),multiplyChannels:0,uvTransform:ph}),this._copyMaterial.depthTest=!0,this._copyMaterial.depthWrite=!1}renderPass(e){if(!(this.parameters.enabled&&this.camera instanceof Ar))return;const t=this._createGroundReflectionCamera(this.camera);this.renderCacheManager.render("inivisibleGround",this.scene,(()=>{this._renderGroundReflection(e,this.scene,t,this.reflectionRenderTarget)})),this._renderGroundReflectionIntensity(e,t,this.intensityRenderTarget),(this.parameters.blurHorizontal>0||this.parameters.blurVertical>0)&&this.blurReflection(e,this.camera,[this.intensityRenderTarget,this.blurRenderTarget,this.intensityRenderTarget]),this._updateCopyMaterial(this.intensityRenderTarget,this.reflectionFadeInScale),this.passRenderer.renderScreenSpace(e,this._copyMaterial,e.getRenderTarget())}_renderGroundReflection(e,t,n,i){const r=e.getRenderTarget();i&&(e.setRenderTarget(i),this.passRenderer.clear(e,i,0,0)),e.render(t,n),i&&e.setRenderTarget(r)}_renderGroundReflectionIntensity(e,t,n){const i=e.getRenderTarget();e.setRenderTarget(n),this.passRenderer.renderScreenSpace(e,this._reflectionIntensityMaterial.update({texture:this.reflectionRenderTarget.texture,depthTexture:this.reflectionRenderTarget.depthTexture,camera:t,groundLevel:this.parameters.groundLevel,fadeOutDistance:this.parameters.fadeOutDistance*this.parameters.groundReflectionScale,fadeOutExponent:this.parameters.fadeOutExponent}),e.getRenderTarget()),e.setRenderTarget(i)}blurReflection(e,t,n){const i=new dn(t.matrixWorld.elements[4],t.matrixWorld.elements[5],t.matrixWorld.elements[6]),r=this.parameters.blurHorizontal/this._width,a=this.parameters.blurVertical/this._height*Math.abs(i.dot(new dn(0,0,1)));this._blurPass.render(e,n,[4*r,4*a],[4*r*(1+this.parameters.blurAscent),4*a*(1+this.parameters.blurAscent)])}_createGroundReflectionCamera(e){const t=e.clone(),n=t;return n._offset&&(n._offset={left:n._offset.left,top:1-n._offset.bottom,right:n._offset.right,bottom:1-n._offset.top}),t.position.set(e.position.x,-e.position.y+2*this.parameters.groundLevel,e.position.z),t.rotation.set(-e.rotation.x,e.rotation.y,-e.rotation.z),t.updateMatrixWorld(),t.updateProjectionMatrix(),t}}class Tf extends wr{constructor(e){super({defines:Object.assign({},Tf.shader.defines),uniforms:Sr.clone(Tf.shader.uniforms),vertexShader:Tf.shader.vertexShader,fragmentShader:Tf.shader.fragmentShader,blending:0}),this.update(e)}update(e){var t,n;if(void 0!==(null==e?void 0:e.texture)&&(this.uniforms.tDiffuse.value=null==e?void 0:e.texture),void 0!==(null==e?void 0:e.depthTexture)&&(this.uniforms.tDepth.value=null==e?void 0:e.depthTexture),(null==e?void 0:e.width)||(null==e?void 0:e.height)){const i=null!==(t=null==e?void 0:e.width)&&void 0!==t?t:this.uniforms.resolution.value.x,r=null!==(n=null==e?void 0:e.height)&&void 0!==n?n:this.uniforms.resolution.value.y;this.uniforms.resolution.value.set(i,r)}if(void 0!==(null==e?void 0:e.camera)){const t=(null==e?void 0:e.camera)||(null==e?void 0:e.camera);this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far,this.uniforms.cameraProjectionMatrix.value.copy(t.projectionMatrix),this.uniforms.cameraInverseProjectionMatrix.value.copy(t.projectionMatrixInverse),this.uniforms.inverseViewMatrix.value.copy(t.matrixWorld)}return void 0!==(null==e?void 0:e.groundLevel)&&(this.uniforms.groundLevel.value=null==e?void 0:e.groundLevel),void 0!==(null==e?void 0:e.fadeOutDistance)&&(this.uniforms.fadeOutDistance.value=null==e?void 0:e.fadeOutDistance),void 0!==(null==e?void 0:e.fadeOutExponent)&&(this.uniforms.fadeOutExponent.value=null==e?void 0:e.fadeOutExponent),this}}Tf.shader={uniforms:{tDiffuse:{value:null},tDepth:{value:null},resolution:{value:new Nt},cameraNear:{value:.1},cameraFar:{value:1},cameraProjectionMatrix:{value:new Hn},cameraInverseProjectionMatrix:{value:new Hn},inverseViewMatrix:{value:new Hn},groundLevel:{value:0},fadeOutDistance:{value:1},fadeOutExponent:{value:1}},defines:{PERSPECTIVE_CAMERA:1,LINEAR_TO_SRGB:0,PREMULTIPLIED_ALPHA:1},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform vec2 resolution;\n uniform float cameraNear;\n uniform float cameraFar;\n uniform mat4 cameraProjectionMatrix;\n uniform mat4 cameraInverseProjectionMatrix;\n uniform mat4 inverseViewMatrix;\n uniform float groundLevel;\n uniform float fadeOutDistance;\n uniform float fadeOutExponent;\n varying vec2 vUv;\n\n #include \n\n float getDepth(const in vec2 screenPosition) {\n return texture2D(tDepth, screenPosition).x;\n }\n\n float getLinearDepth(const in vec2 screenPosition) {\n #if PERSPECTIVE_CAMERA == 1\n float fragCoordZ = texture2D(tDepth, screenPosition).x;\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);\n #else\n return texture2D(tDepth, screenPosition).x;\n #endif\n }\n\n float getViewZ(const in float depth) {\n #if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);\n #else\n return 0.0;//orthographicDepthToViewZ(depth, cameraNear, cameraFar);\n #endif\n }\n\n vec3 getViewPosition(const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n vec4 clipPosition = vec4((vec3(screenPosition, depth) - 0.5) * 2.0, 1.0);\n clipPosition *= clipW;\n return (cameraInverseProjectionMatrix * clipPosition).xyz;\n }\n\n void main() {\n float verticalBias = 1.5 / resolution.y;\n vec2 uv = vUv.xy + vec2(0.0, verticalBias);\n float depth = getDepth(uv);\n float viewZ = getViewZ(depth);\n vec4 worldPosition = inverseViewMatrix * vec4(getViewPosition(uv, depth, viewZ), 1.0);\n float distance = worldPosition.y - groundLevel;\n vec2 diffuseTextureSize = vec2(textureSize(tDiffuse, 0 ));\n vec4 fragColor = texelFetch(tDiffuse, ivec2(uv * diffuseTextureSize), 0).rgba;\n #if LINEAR_TO_SRGB == 1\n fragColor.rgb = mix(fragColor.rgb * 12.92, 1.055 * pow(fragColor.rgb, vec3(0.41666)) - 0.055, step(0.0031308, fragColor.rgb));\n #endif\n float fadeOutAlpha = pow(clamp(1.0 - distance / fadeOutDistance, 0.0, 1.0), fadeOutExponent);\n fragColor.a *= fadeOutAlpha * step(depth, 0.9999);\n #if PREMULTIPLIED_ALPHA == 1\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n #else\n gl_FragColor = fragColor;\n #endif\n }"};class Ef extends cl{constructor(e,t){const n=new Ji;n.setAttribute("position",new Gi([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),n.computeBoundingSphere(),super(n,new tl({fog:!1})),this.light=e,this.color=t,this.type="RectAreaLightHelper";const i=new Ji;i.setAttribute("position",new Gi([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),i.computeBoundingSphere(),this.add(new mr(i,new Ui({side:1,fog:!1})))}updateMatrixWorld(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);const e=this.material.color,t=Math.max(e.r,e.g,e.b);t>1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}class Af extends ql{constructor(e){super(e),this.customProgramCacheKey=this._customProgramCacheKey,this.onBeforeCompile=this._onBeforeCompile}static setShadowParameters(e,t,n,i,r,a,s){this._enableGroundBoundary=e,Af._distributionProperties.set(t,n,i,r),Af._shadowFadeOut.set(a,s)}static setBoundingBox(e){Af._sceneBoxMin.copy(e.min),Af._sceneBoxMax.copy(e.max)}_customProgramCacheKey(){return Af._enableGroundBoundary?"GROUND_BOUNDARY":"NO_GROUND_BOUNDARY"}_onBeforeCompile(e,t){e.vertexShader=Pf,e.fragmentShader=Rf,e.defines=Object.assign(Object.assign(Object.assign({},e.defines),{DYNAMIC_SHADOW_RADIUS:"",GROUND_BOUNDARY:Af._enableGroundBoundary?1:0}));const n=e.uniforms;n&&(n.distributionProperties={value:Af._distributionProperties},n.shadowFadeOut={value:Af._shadowFadeOut},n.sceneBoxMin={value:Af._sceneBoxMin},n.sceneBoxMax={value:Af._sceneBoxMax})}}Af._enableGroundBoundary=!1,Af._shadowFadeOut=new Nt(.1,20),Af._sceneBoxMin=new dn(-1,-1,-1),Af._sceneBoxMax=new dn(1,1,1),Af._distributionProperties=new an(1,1,1,1);const Pf="\n#define LAMBERT\n\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n #include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vWorldPosition = worldPosition.xyz;\n#else\n vWorldPosition = (modelMatrix * vec4(transformed, 1.)).xyz;\n#endif\n}\n",Rf="\n#define LAMBERT\n\nuniform vec3 diffuse;\nuniform float opacity;\n\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPosition;\n\n#ifdef DYNAMIC_SHADOW_RADIUS\n uniform vec2 shadowFadeOut;\n #define fadeOutDistance shadowFadeOut.x\n #define fadeOutBlur shadowFadeOut.y\n uniform vec3 sceneBoxMin;\n uniform vec3 sceneBoxMax;\n#endif\nuniform vec4 distributionProperties;\n#define directionalDependency distributionProperties.x\n#define directionalExponent distributionProperties.y\n#define groundBoundary distributionProperties.z\n#define groundMapScale distributionProperties.w\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvec2 getShadowDynamicScale() {\n vec2 dynamicScale = vec2(0.0, 1.0);\n#ifdef DYNAMIC_SHADOW_RADIUS\n if (fadeOutDistance > 0.0) {\n vec3 boxDistanceVec = max(vec3(0.0), max(sceneBoxMin - vWorldPosition, vWorldPosition - sceneBoxMax));\n float boxDistance = length(boxDistanceVec);\n float shadowBase = clamp(boxDistance / fadeOutDistance, 0.0, 1.0);\n dynamicScale = vec2(shadowBase, 1.0 - shadowBase);\n }\n#endif\n return dynamicScale;\n}\n\nfloat getShadowDynamicRadius(sampler2D shadowMap, float shadowBias, float shadowRadius, vec4 shadowCoord, vec2 shadowScale) {\n float dynamicRadius = shadowRadius;\n#ifdef DYNAMIC_SHADOW_RADIUS\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 && fadeOutDistance > 0.0) {\n dynamicRadius = shadowRadius + fadeOutBlur * max(0.0, shadowScale.x);\n }\n#endif\n return dynamicRadius;\n}\n\nvoid main() {\n\n\t#include \n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\n\tvec3 geometryPosition = - vViewPosition;\n vec3 geometryNormal = normal;\n vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n vec3 accumulatedShadowLight = vec3(0.0);\n vec3 directionDependentShadowLight = vec3(1.0);\n float groundDistance = clamp((vWorldPosition.y - sceneBoxMin.y) * 100.0, 0.0, 1.0);\n vec2 dynamicScale = getShadowDynamicScale();\n\n #if ( NUM_DIR_LIGHTS > 0 )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n IncidentLight directLight;\n vec3 incidentLightSum = vec3(0.0);\n vec3 incidentShadowLight = vec3(0.0);\n float groundShadowFactor = 1.;\n float shadowFactor;\n float dynamicRadius;\n float dotNL;\n\n #pragma unroll_loop_start\n for ( int i = 0 ; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n\n #if defined( USE_SHADOWMAP ) && ( GROUND_BOUNDARY == 1 && UNROLLED_LOOP_INDEX == 0 )\n\n directionalLightShadow = directionalLightShadows[ i ];\n dynamicRadius = fadeOutDistance * groundMapScale;\n groundShadowFactor = groundDistance < 0.5 ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, dynamicRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n #elif defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n directionalLightShadow = directionalLightShadows[ i ];\n dynamicRadius = getShadowDynamicRadius(directionalShadowMap[i], directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[i], dynamicScale);\n shadowFactor = ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, dynamicRadius, vDirectionalShadowCoord[ i ] ) : 1.0; \n accumulatedShadowLight += directLight.color * shadowFactor * saturate(min(dotNL * 10.0 + 0.9, 1.0));\n dotNL = dot(dot(geometryNormal, geometryPosition) >= 0.0 ? -geometryNormal : geometryNormal, directLight.direction);\n incidentLightSum += directLight.color;\n incidentShadowLight += directLight.color * mix(1.0, shadowFactor, pow(clamp(dotNL, 0.0, 1.0), directionalExponent));\n \n #endif\n }\n #pragma unroll_loop_end\n\n directionDependentShadowLight = incidentShadowLight / ( incidentLightSum + 1. - step(0., incidentLightSum) );\n #else\n accumulatedShadowLight = vec3(1.0);\n #endif \n\n\t// modulation\n\n\tvec3 outgoingLight = mix(accumulatedShadowLight, directionDependentShadowLight, max(directionalDependency, 1.0 - groundDistance));\n #if GROUND_BOUNDARY == 1\n float groundWeight = 1. - groundShadowFactor + groundDistance - (1. - groundShadowFactor) * groundDistance;\n outgoingLight = mix(vec3(1.), outgoingLight, mix(dynamicScale.y, groundWeight, groundBoundary));\n #else\n outgoingLight = mix(vec3(1.), outgoingLight, dynamicScale.y);\n #endif\n\n\t#include \n\t#include \n}\n",Cf="DirectionalLightShadow",Lf={alwaysUpdate:!1,enableShadowMap:!0,enableGroundBoundary:!0,layers:null,shadowLightSourceType:Cf,maximumNumberOfLightSources:-1,directionalDependency:1,directionalExponent:1,groundBoundary:1,fadeOutDistance:.1,fadeOutBlur:5};class Df extends zp{get shadowTexture(){return this._shadowRenderTarget.texture}set shadowOnGround(e){this._shadowMapPassOverrideMaterialCache.shadowOnGround=e}constructor(e,t,n){var i,r,a;super(e),this.needsUpdate=!1,this.drawGround=!0,this.shadowTypeNeedsUpdate=!0,this.shadowConfiguration=new Ff,this._shadowLightSources=[],this._shadowScale=1,this._groundMapScale=1,this._cameraUpdate=new Ph,this._viewportSize=new Nt(t.x,t.y),this._samples=null!==(i=null==n?void 0:n.samples)&&void 0!==i?i:0,this._shadowMapSize=null!==(r=null==n?void 0:n.shadowMapSize)&&void 0!==r?r:1024,this.parameters=this._getScreenSpaceShadowMapParameters(n),this.castShadow=this.parameters.enableShadowMap,this._shadowMapPassOverrideMaterialCache=new Nf,null===(a=this.renderCacheManager)||void 0===a||a.registerCache(this,this._shadowMapPassOverrideMaterialCache);const s=this._samples;this._shadowRenderTarget=new on(this._viewportSize.x,this._viewportSize.y,{samples:s,format:ge,magFilter:j,minFilter:j})}_getScreenSpaceShadowMapParameters(e){return Object.assign(Object.assign({},Lf),e)}dispose(){super.dispose(),this._shadowLightSources.forEach((e=>e.dispose())),this._shadowRenderTarget.dispose(),this._shadowMapPassOverrideMaterialCache.dispose()}updateParameters(e){for(const t in e)this.parameters.hasOwnProperty(t)&&(this.parameters[t]=e[t])}updateBounds(e,t){var n;const i=this._shadowScale;if(this._shadowScale=t,Math.abs(i-this._shadowScale)>1e-5&&(this.shadowTypeNeedsUpdate=!0),this._shadowLightSources.forEach((t=>t.updateBounds(e))),this._shadowLightSources.length>0){const e=null===(n=this._shadowLightSources[0].getShadowLight().shadow)||void 0===n?void 0:n.camera;e instanceof ea&&(this._groundMapScale=2*this._shadowMapSize/(Math.abs(e.right-e.left)+Math.abs(e.top-e.bottom)))}else this._groundMapScale=1;this._shadowMapPassOverrideMaterialCache.setBoundingBox(e.bounds)}forceShadowUpdate(){this._shadowLightSources.forEach((e=>e.forceShadowUpdate())),this.needsUpdate=!0}getShadowLightSources(){return this._shadowLightSources.map((e=>e.getShadowLight()))}findShadowLightSource(e){var t;return null===(t=this._shadowLightSources.find((t=>t.getOriginalLight()===e)))||void 0===t?void 0:t.getShadowLight()}addRectAreaLight(e,t){const n=new zf(e,{shadowMapSize:this._shadowMapSize,shadowLightSourceType:this.parameters.shadowLightSourceType});this._shadowLightSources.push(n),n.addTo(t),n.updatePositionAndTarget(),this.needsUpdate=!0}updateRectAreaLights(e,t){const n=this._shadowLightSources;this._shadowLightSources=this._createShadowLightSourceArray(!1);for(const i of n){if(i instanceof zf){const t=i.getRectAreaLight();e.includes(t)&&(i.updatePositionAndTarget(),this._shadowLightSources.push(i))}i.removeFrom(t),i.dispose()}e.forEach((e=>{this._shadowLightSources.find((t=>t instanceof zf&&t.getRectAreaLight()===e))||this.addRectAreaLight(e,t)})),this.needsUpdate=!0,this.shadowTypeNeedsUpdate=!0}createShadowFromLightSources(e,t){for(const t of this._shadowLightSources)t.removeFrom(e),t.dispose();this._shadowLightSources=this._createShadowLightSourceArray(!0);const n=1/(t.length>0?Math.max(...t.map((e=>e.maxIntensity))):1);this._addShadowFromLightSources(t,n),this._shadowLightSources.forEach((t=>{t.addTo(e),t.updatePositionAndTarget()})),this.needsUpdate=!0,this.shadowTypeNeedsUpdate=!0}_addShadowFromLightSources(e,t){e.forEach((e=>{const n=e.maxIntensity*t;if(n>=.1&&e.position.z>=0){const t=new dn(e.position.x,e.position.z,e.position.y).multiplyScalar(7),i=new kf(t,n,{shadowMapSize:this._shadowMapSize,shadowLightSourceType:this.parameters.shadowLightSourceType});this._shadowLightSources.push(i)}}))}_createShadowLightSourceArray(e){const t=[];if(e){const e=new Hf(new dn(0,7,0),{shadowMapSize:this._shadowMapSize});t.push(e)}return this.parameters.enableGroundBoundary=e,t}setSize(e,t){this._viewportSize=new Nt(e,t),this._shadowRenderTarget.setSize(this._viewportSize.x,this._viewportSize.y)}updatePositionAndTarget(){this._shadowLightSources.forEach((e=>e.updatePositionAndTarget()))}renderPass(e){if(!(this.needsUpdate||this.parameters.alwaysUpdate||this._cameraUpdate.changed(this.camera)))return;this.needsUpdate=!1,this.shadowTypeNeedsUpdate&&(this.shadowTypeNeedsUpdate=!1,this.needsUpdate=!0,this._updateShadowType(e));const t=this.scene.background,n=this.scene.environment,i=this.camera.layers.mask;this.scene.environment=null,this.scene.background=null,this.parameters.layers&&(this.camera.layers.mask=this.parameters.layers.mask),this.renderPassManager.setGroundVisibility(this.drawGround),this._renderSimpleShadowMapFromShadowLightSources(e,this.scene,this.camera),this.renderPassManager.setGroundVisibility(!1),this.camera.layers.mask=i,this.scene.environment=n,this.scene.background=t}_renderSimpleShadowMapFromShadowLightSources(e,t,n){var i;this._shadowMapPassOverrideMaterialCache.setShadowParameters(this.parameters.enableGroundBoundary,this.parameters.directionalDependency,this.parameters.directionalExponent,this.parameters.groundBoundary,this._groundMapScale,this.parameters.fadeOutDistance*this._shadowScale,this.parameters.fadeOutBlur);const r=this._getSortedShadowLightSources();0===r.length?this.passRenderer.clear(e,this._shadowRenderTarget,16777215,1):(this._setShadowLightSourcesIntensity(r),null===(i=this.renderCacheManager)||void 0===i||i.render(this,t,(()=>{this.passRenderer.render(e,t,n,this._shadowRenderTarget,16777215,1)})),this._shadowLightSources.forEach((e=>e.finishRenderShadow())))}_getSortedShadowLightSources(){const e=[];return this._shadowLightSources.forEach((t=>e.push(...t.prepareRenderShadow()))),e.sort(((e,t)=>e.light.castShadow&&!t.light.castShadow||e.groundShadow&&!t.groundShadow?-1:!e.light.castShadow&&t.light.castShadow||!e.groundShadow&&t.groundShadow?1:t.intensity-e.intensity)),e}_setShadowLightSourcesIntensity(e){let t=0;const n=this.parameters.maximumNumberOfLightSources;let i=0;e.forEach((e=>{(n<0||i{var r;!this.parameters.enableGroundBoundary&&e.groundShadow||!(n<0||ie._updateShadowType(this.shadowConfiguration.currentConfiguration,this._shadowScale)))}switchType(e){return!!this.shadowConfiguration.switchType(e)&&(this.needsUpdate=!0,this.shadowTypeNeedsUpdate=!0,!0)}}const If="unlit",Uf="emissive",Of="shadow";class Nf extends _f{set shadowOnGround(e){this._shadowOnGround=e}constructor(){super(),this._boundingBoxSet=!1,this._shadowOnGround=!0,this._shadowObjectMaterial=this._createShadowMaterial("default"),this._unlitMaterial=this._createShadowMaterial(If),this._emissiveMaterial=this._createShadowMaterial(Uf),this._receiveShadowMaterial=this._createShadowMaterial(Of)}dispose(){this._shadowObjectMaterial.dispose(),this._unlitMaterial.dispose(),this._emissiveMaterial.dispose(),this._receiveShadowMaterial.dispose()}setShadowParameters(e,t,n,i,r,a,s){Af.setShadowParameters(e,t,n,i,r,a,s)}setBoundingBox(e){this._boundingBoxSet=!0,Af.setBoundingBox(e)}_createShadowMaterial(e){let t;return t=e===Uf||e===If?new Ui({color:16777215,side:2}):e===Of?new Gl({side:2}):Nf.useModifiedMaterial?this._createCustomerShadowMaterial():new Xl({color:16777215,shininess:0,polygonOffsetFactor:0,polygonOffsetUnits:0,side:2}),t}_createCustomerShadowMaterial(){return new Af({side:2})}addLineOrPoint(e){this.addToCache(e,{visible:!1})}addMesh(e){e.visible&&this._setMeshMaterialAndVisibility(e)}addObject(e){e.isLight&&!e.userData.shadowLightSource&&this.addToCache(e,{visible:!1})}_setMeshMaterialAndVisibility(e){e.userData.isFloor?this._setMeshShadowFloorMaterial(e):!e.material||!e.receiveShadow||Array.isArray(e.material)||!0===e.material.transparent&&e.material.opacity<.9?e.material&&e.material.transparent&&e.material.opacity<.9?this.addToCache(e,{visible:!1}):e.receiveShadow?this.addToCache(e,{castShadow:!1,material:this._receiveShadowMaterial}):this.addToCache(e,{visible:!1}):this._setShadowMaterialForOpaqueObject(e)}_setShadowMaterialForOpaqueObject(e){const t=e.material;t instanceof tl||t instanceof Ui?this.addToCache(e,{material:this._unlitMaterial}):t instanceof Wl?this._setMeshShadowStandardMaterial(e,t):this.addToCache(e,{material:e.receiveShadow?this._shadowObjectMaterial:this._unlitMaterial})}_setMeshShadowStandardMaterial(e,t){const n=t.emissiveIntensity>0&&(t.emissive.r>0||t.emissive.g>0||t.emissive.b>0);this.addToCache(e,{castShadow:!n&&e.castShadow,material:n?this._emissiveMaterial:e.receiveShadow?this._shadowObjectMaterial:this._unlitMaterial})}_setMeshShadowFloorMaterial(e){this._boundingBoxSet&&this._shadowOnGround?this.addToCache(e,{visible:!0,castShadow:!1,receiveShadow:!0,material:this._shadowObjectMaterial}):this.addToCache(e,{visible:!1})}}Nf.useModifiedMaterial=!0;class Ff{constructor(){var e;this.types=new Map([["off",Ff._noShadow],["BasicShadowMap",Ff._basicShadow],["PCFShadowMap",Ff._pcfShadow],["PCFSoftShadowMap",Ff._pcfSoftShadow],["VSMShadowMap",Ff._vcmShadow]]),this.shadowType="PCFShadowMap",this.currentConfiguration=null!==(e=this.types.get(this.shadowType))&&void 0!==e?e:Ff._defaultType}switchType(e){var t;return!!this.types.has(e)&&(this.currentConfiguration=null!==(t=this.types.get(e))&&void 0!==t?t:Ff._defaultType,!0)}}Ff._noShadow={castShadow:!1,type:i,bias:0,normalBias:0,radius:0},Ff._basicShadow={castShadow:!0,type:0,bias:-5e-5,normalBias:.005,radius:0},Ff._pcfShadow={castShadow:!0,type:i,bias:-5e-5,normalBias:.01,radius:4},Ff._pcfSoftShadow={castShadow:!0,type:r,bias:-5e-5,normalBias:.01,radius:1},Ff._vcmShadow={castShadow:!0,type:a,bias:1e-4,normalBias:0,radius:15},Ff._defaultType=Ff._pcfShadow;class Bf{constructor(e,t){var n,i;this._isVisibleBackup=!0,this._castShadowBackup=!0,this._shadowMapSize=null!==(n=null==t?void 0:t.shadowMapSize)&&void 0!==n?n:1024,this._blurSamples=null!==(i=null==t?void 0:t.blurSamples)&&void 0!==i?i:8,this._shadowLightSource=e,this._shadowLightSource.visible=!1,this._shadowLightSource.castShadow=!0,this._shadowLightSource.shadow&&(this._shadowLightSource.shadow.mapSize=new Nt(this._shadowMapSize,this._shadowMapSize),this._shadowLightSource.shadow.blurSamples=this._blurSamples,this._shadowLightSource.shadow.autoUpdate=!1),this._shadowLightSource.userData.shadowLightSource=this}getPosition(){return this._shadowLightSource.position}getShadowLight(){return this._shadowLightSource}getOriginalLight(){return null}dispose(){this._shadowLightSource.dispose()}addTo(e){e.add(this._shadowLightSource)}removeFrom(e){e.remove(this._shadowLightSource)}updatePositionAndTarget(){this._updateShadowPositionAndTarget(this.getPosition(),new dn(0,0,0))}updateBounds(e){if(this._shadowLightSource instanceof Rc){const t=this._shadowLightSource.shadow.camera,n=e.bounds.clone().applyMatrix4(t.matrixWorldInverse),i=Math.max(.001,Math.min(-n.min.z,-n.max.z)),r=Math.max(-n.min.z,-n.max.z),a=Math.max(Math.abs(n.min.x),Math.abs(n.max.x)),s=Math.max(Math.abs(n.min.y),Math.abs(n.max.y)),o=Math.atan2(1.05*Math.hypot(s,a),i);t.aspect=1,t.near=i,t.far=r,this._shadowLightSource.angle=o}else if(this._shadowLightSource.shadow){const t=this._shadowLightSource.shadow.camera;e.updateCameraViewVolumeFromBounds(t);const n=t;n.far+=n.far-n.near,n.updateProjectionMatrix()}this._shadowLightSource.shadow&&(this._shadowLightSource.shadow.needsUpdate=!0)}forceShadowUpdate(){this._shadowLightSource.shadow&&(this._shadowLightSource.shadow.needsUpdate=!0)}_updateShadowPositionAndTarget(e,t){var n,i,r;if(this._shadowLightSource instanceof Rc){const n=t.clone().sub(e),i=n.length();n.normalize();const r=t.clone().sub(n.clone().multiplyScalar(4*i));this._shadowLightSource.shadow.camera.position.copy(r),this._shadowLightSource.shadow.camera.position.copy(r),this._shadowLightSource.shadow.camera.lookAt(t),this._shadowLightSource.position.copy(r),this._shadowLightSource.lookAt(t)}else this._shadowLightSource.position.copy(e),this._shadowLightSource.lookAt(t),null===(n=this._shadowLightSource.shadow)||void 0===n||n.camera.position.copy(e),null===(i=this._shadowLightSource.shadow)||void 0===i||i.camera.lookAt(t);null===(r=this._shadowLightSource.shadow)||void 0===r||r.camera.updateMatrixWorld(),this._shadowLightSource.updateMatrixWorld()}_updateShadowType(e,t){const n=this._shadowLightSource.shadow;n&&(n.bias=e.bias,n.normalBias=e.normalBias*t,n.radius=e.radius,n.needsUpdate=!0)}prepareRenderShadow(){return[]}finishRenderShadow(){}}class zf extends Bf{constructor(e,t){let n;switch(null==t?void 0:t.shadowLightSourceType){default:case Cf:n=new Nc(16777215,1);break;case"SpotLightShadow":n=new Rc(16777215,1,0,Math.PI/4,0)}n.position.copy(e.position),n.lookAt(0,0,0),super(n,t),this._rectAreaLight=e,this._rectAreaLight.userData.shadowLightSource=this,(null==t?void 0:t.addHelper)&&(this._rectLightHelper=new Ef(this._rectAreaLight),this._rectLightHelper.material.depthWrite=!1,this._rectAreaLight.add(this._rectLightHelper))}getPosition(){return this._rectAreaLight.position}getRectAreaLight(){return this._rectAreaLight}getOriginalLight(){return this._rectAreaLight}prepareRenderShadow(){return this._isVisibleBackup=this._rectAreaLight.visible,this._castShadowBackup=this._shadowLightSource.castShadow,this._shadowLightSource.visible=this._rectAreaLight.visible,this._rectAreaLight.visible=!1,this._shadowLightSource.visible?[{light:this._shadowLightSource,intensity:this._rectAreaLight.intensity,groundShadow:!1}]:[]}finishRenderShadow(){this._shadowLightSource.visible=!1,this._shadowLightSource.castShadow=this._castShadowBackup,this._rectAreaLight.visible=this._isVisibleBackup}}class kf extends Bf{constructor(e,t,n){const i=new Nc(16777215,t);i.position.copy(e),i.lookAt(0,0,0),i.updateMatrix(),i.castShadow=!0,super(i,n),this._position=e.clone(),this._intensity=t}getPosition(){return this._position}prepareRenderShadow(){return this._castShadowBackup=this._shadowLightSource.castShadow,this._shadowLightSource.visible=!0,[{light:this._shadowLightSource,intensity:this._intensity,groundShadow:!1}]}finishRenderShadow(){this._shadowLightSource.castShadow=this._castShadowBackup,this._shadowLightSource.visible=!1}}class Hf extends Bf{constructor(e,t){const n=new Nc(16777215,1);n.position.copy(e),n.lookAt(0,0,0),n.updateMatrix(),n.castShadow=!0,super(n,t),this._position=e.clone()}getPosition(){return this._position}prepareRenderShadow(){return this._castShadowBackup=this._shadowLightSource.castShadow,this._shadowLightSource.visible=!0,[{light:this._shadowLightSource,intensity:1,groundShadow:!0}]}finishRenderShadow(){this._shadowLightSource.castShadow=this._castShadowBackup,this._shadowLightSource.visible=!1}}const Vf={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"},Gf={name:"FXAAShader",uniforms:{tDiffuse:{value:null},resolution:{value:new Nt(1/1024,1/512)}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\t\tprecision highp float;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tuniform vec2 resolution;\n\n\t\tvarying vec2 vUv;\n\n\t\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t\t//----------------------------------------------------------------------------------\n\t\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t\t// SDK Version: v3.00\n\t\t// Email: gameworks@nvidia.com\n\t\t// Site: http://developer.nvidia.com/\n\t\t//\n\t\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t\t//\n\t\t// Redistribution and use in source and binary forms, with or without\n\t\t// modification, are permitted provided that the following conditions\n\t\t// are met:\n\t\t// * Redistributions of source code must retain the above copyright\n\t\t// notice, this list of conditions and the following disclaimer.\n\t\t// * Redistributions in binary form must reproduce the above copyright\n\t\t// notice, this list of conditions and the following disclaimer in the\n\t\t// documentation and/or other materials provided with the distribution.\n\t\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t\t// contributors may be used to endorse or promote products derived\n\t\t// from this software without specific prior written permission.\n\t\t//\n\t\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t\t//\n\t\t//----------------------------------------------------------------------------------\n\n\t\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t\t#endif\n\n\t\t/*--------------------------------------------------------------------------*/\n\t\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t\t/*--------------------------------------------------------------------------*/\n\n\t\t#define NUM_SAMPLES 5\n\n\t\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\t\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t\t}\n\n\t\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t\t============================================================================*/\n\n\t\t/*--------------------------------------------------------------------------*/\n\t\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t// locate the edge\n\t\t\t\tvec2 dirToEdge;\n\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t// . 2 . . 1 .\n\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t// . 1 .\n\t\t\t\t// 0 0 1\n\t\t\t\t// . 0 H\n\n\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t// V 1 .\n\t\t\t\t// 0 0 1\n\t\t\t\t// . 0 .\n\n\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t// 1 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t// do a simple blur\n\t\t\t\t\treturn mix(\n\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t.4\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\n\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\tif(!doneN) {\n\t\t\t\t\tnDist += increment;\n\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t}\n\n\t\t\t\tif(!doneP) {\n\t\t\t\t\tpDist += increment;\n\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t}\n\n\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\trgbaM,\n\t\t\t\trgbaN,\n\t\t\t\tdist * .5\n\t\t\t);\n\t\t}\n\n\t\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\tvUv,\n\t\t\t\ttDiffuse,\n\t\t\t\tresolution,\n\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t\t}\n\t"};class Wf extends zp{constructor(e,t,n,i,r,a){var s;super(e),this.patternTexture=null,this.clearBackground=!1,this.renderScene=n,this.renderCamera=i,this.selectedObjects=void 0!==r?r:[],this.visibleEdgeColor=new Ci(1,1,1),this.hiddenEdgeColor=new Ci(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=(null==a?void 0:a.downSampleRatio)||2,this.pulsePeriod=0,this.edgeDetectionFxaa=(null==a?void 0:a.edgeDetectionFxaa)||!1,this._visibilityCache=new Map,this.resolution=void 0!==t?new Nt(t.x,t.y):new Nt(256,256);const o=Math.round(this.resolution.x/this.downSampleRatio),l=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetMaskBuffer=new on(this.resolution.x,this.resolution.y),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.prepareMaskMaterial=this._getPrepareMaskMaterial(null===(s=this.gBufferTextures)||void 0===s?void 0:s.isFloatGBufferWithRgbNormalAlphaDepth),this.prepareMaskMaterial.side=2,this.prepareMaskMaterial.fragmentShader=function(e,t){const n=t.isPerspectiveCamera?"perspective":"orthographic";return e.replace(/DEPTH_TO_VIEW_Z/g,n+"DepthToViewZ")}(this.prepareMaskMaterial.fragmentShader,this.renderCamera),this.edgeDetectionFxaa&&(this.fxaaRenderMaterial=new wr(Gf),this.fxaaRenderMaterial.uniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,this.fxaaRenderMaterial.uniforms.resolution.value.set(1/this.resolution.x,1/this.resolution.y),this.renderTargetFxaaBuffer=new on(this.resolution.x,this.resolution.y),this.renderTargetFxaaBuffer.texture.name="OutlinePass.fxaa",this.renderTargetFxaaBuffer.texture.generateMipmaps=!1),this.renderTargetMaskDownSampleBuffer=new on(o,l),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new on(o,l),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new on(Math.round(o/2),Math.round(l/2)),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this._getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new on(o,l),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new on(Math.round(o/2),Math.round(l/2)),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,this.separableBlurMaterial1=this._getSeperableBlurMaterial(4),this.separableBlurMaterial1.uniforms.texSize.value.set(o,l),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this._getSeperableBlurMaterial(4),this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(o/2),Math.round(l/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=4,this.overlayMaterial=this._getOverlayMaterial();const c=Vf;this.copyUniforms=Sr.clone(c.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new wr({uniforms:this.copyUniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,blending:0,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new Ci,this.oldClearAlpha=1,this.fsQuad=new Sh(void 0),this.tempPulseColor1=new Ci,this.tempPulseColor2=new Ci,this.textureMatrix=new Hn}dispose(){var e,t;super.dispose(),this.renderTargetMaskBuffer.dispose(),null===(e=this.renderTargetFxaaBuffer)||void 0===e||e.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose(),this.prepareMaskMaterial.dispose(),null===(t=this.fxaaRenderMaterial)||void 0===t||t.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.dispose()}setSize(e,t){var n,i;this.renderTargetMaskBuffer.setSize(e,t);let r=Math.round(e/this.downSampleRatio),a=Math.round(t/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(r,a),this.renderTargetBlurBuffer1.setSize(r,a),this.renderTargetEdgeBuffer1.setSize(r,a),this.separableBlurMaterial1.uniforms.texSize.value.set(r,a),r=Math.round(r/2),a=Math.round(a/2),this.renderTargetBlurBuffer2.setSize(r,a),this.renderTargetEdgeBuffer2.setSize(r,a),this.separableBlurMaterial2.uniforms.texSize.value.set(r,a),null===(n=this.fxaaRenderMaterial)||void 0===n||n.uniforms.resolution.value.set(1/this.resolution.x,1/this.resolution.y),null===(i=this.renderTargetFxaaBuffer)||void 0===i||i.setSize(e,t)}_canBeHighlighted(e){return e.isMesh||Wf.highlightLines&&e.isLine}_changeVisibilityOfSelectedObjects(e){const t=this._visibilityCache;this.selectedObjects.forEach((n=>n.traverse((n=>{this._canBeHighlighted(n)&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}))))}_changeVisibilityOfNonSelectedObjects(e){const t=this._visibilityCache,n=[];this.selectedObjects.forEach((e=>e.traverse((e=>{this._canBeHighlighted(e)&&n.push(e)})))),this.renderScene.traverse((i=>{if(this._canBeHighlighted(i)||i.isSprite){if(!1===n.some((e=>e.id===i.id))){const n=i.visible;!1!==e&&!0!==t.get(i)||(i.visible=e),t.set(i,n)}}else i.isPoints&&(!0===e?i.visible=t.get(i):(t.set(i,i.visible),i.visible=e))}))}_updateTextureMatrix(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}render(e,t,n,i,r){if(this.selectedObjects.length>0){e.getClearColor(this.oldClearColor),this.oldClearAlpha=e.getClearAlpha();const t=e.autoClear;this.clearBackground&&(e.setClearColor(0,255),e.clear(!0,!1,!1)),e.autoClear=!1,r&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this._changeVisibilityOfSelectedObjects(!1);const i=this.renderScene.background;this.renderScene.background=null,this._changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this._updateTextureMatrix(),this._changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.gBufferTextures.textureWithDepthValue,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this._changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=i;let a=this.renderTargetMaskBuffer;if(this.edgeDetectionFxaa&&this.fxaaRenderMaterial&&this.renderTargetFxaaBuffer&&(this.fxaaRenderMaterial.uniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,this.fsQuad.material=this.fxaaRenderMaterial,e.setRenderTarget(this.renderTargetFxaaBuffer),e.clear(),this.fsQuad.render(e),a=this.renderTargetFxaaBuffer),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=a.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),this.pulsePeriod>0){const e=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2;this.tempPulseColor1.multiplyScalar(e),this.tempPulseColor2.multiplyScalar(e)}this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Wf.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Wf.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=Wf.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=Wf.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=a.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,r&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=t}this.renderToScreen&&n&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=n.texture,e.setRenderTarget(null),this.fsQuad.render(e))}renderPass(e){this.render(e,null,null,0,!1)}_getPrepareMaskMaterial(e){return new wr({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new Nt(.5,.5)},textureMatrix:{value:null}},defines:{FLOAT_ALPHA_DEPTH:e?1:0},vertexShader:"#include \n\t\t\t\t#include \n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t\tvPosition = mvPosition;\n\n\t\t\t\t\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\n\t\t\t\t\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tworldPosition = modelMatrix * worldPosition;\n\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include \n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n #if FLOAT_ALPHA_DEPTH == 1\n\t\t\t\t\t float depth = texture2DProj( depthTexture, projTexCoord ).w;\n #else\n float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n #endif\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}_getEdgeDetectionMaterial(){return new wr({uniforms:{maskTexture:{value:null},texSize:{value:new Nt(.5,.5)},visibleEdgeColor:{value:new dn(1,1,1)},hiddenEdgeColor:{value:new dn(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}_getSeperableBlurMaterial(e){return new wr({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new Nt(.5,.5)},direction:{value:new Nt(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include \n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}_getOverlayMaterial(){return new wr({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n }",blending:2,depthTest:!1,depthWrite:!1,transparent:!0})}}Wf.BlurDirectionX=new Nt(1,0),Wf.BlurDirectionY=new Nt(0,1),Wf.highlightLines=!0;const jf={tDiffuse:{value:null}},Xf="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = (projectionMatrix * modelViewMatrix * vec4(position, 1.0)).xyww;\n }",Yf="\n uniform highp sampler2D tDiffuse;\n varying vec2 vUv;\n \n void main() {\n vec4 textureColor = texture2D(tDiffuse, vUv);\n float aoPassDepth = dot(textureColor.wz, vec2(1.0/1024.0));\n gl_FragColor = vec4(vec3(aoPassDepth * aoPassDepth), 1.0);\n }";class qf extends wr{constructor(e){super({uniforms:Sr.clone(jf),vertexShader:Xf,fragmentShader:Yf,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:y,blendDst:u,blendEquation:c,blendSrcAlpha:_,blendDstAlpha:u,blendEquationAlpha:c}),this._intensity=new Nt(1,1),this.update(e)}update(e){return void 0!==(null==e?void 0:e.texture)&&(this.uniforms.tDiffuse.value=e.texture),void 0!==(null==e?void 0:e.blending)&&(this.blending=e.blending),this}}class Zf extends zp{constructor(e){super(e),this.debugOutput="",this._environmentMapDecodeMaterial=new Wh(!0,!1),this._environmentMapDecodeMaterial.blending=0,this._environmentMapDecodeMaterial.depthTest=!1}dispose(){var e,t,n;null===(e=this._depthRenderMaterial)||void 0===e||e.dispose(),null===(t=this._copyMaterial)||void 0===t||t.dispose(),null===(n=this._srgbToLinearCopyMaterial)||void 0===n||n.dispose()}getCopyMaterial(e){var t;return this._copyMaterial=null!==(t=this._copyMaterial)&&void 0!==t?t:new mh,this._copyMaterial.update(e)}getBlendAoAndShadowMaterial(e){var t;return this._blendAoAndShadowMaterial=null!==(t=this._blendAoAndShadowMaterial)&&void 0!==t?t:new Kp({blending:0}),this._blendAoAndShadowMaterial.update(e)}getBlendAoPassDepthMaterial(e){var t;return this._blendAoPassDepthMaterial=null!==(t=this._blendAoPassDepthMaterial)&&void 0!==t?t:new qf({blending:0}),this._blendAoPassDepthMaterial.update(e)}getSrgbToLinearCopyMaterial(e){var t;return this._srgbToLinearCopyMaterial=null!==(t=this._copyMaterial)&&void 0!==t?t:new mh({},fh,!0,!0),this._srgbToLinearCopyMaterial.update(e)}_getDepthRenderMaterial(e){var t;return this._depthRenderMaterial=null!==(t=this._depthRenderMaterial)&&void 0!==t?t:new vh({depthTexture:this.gBufferTextures.textureWithDepthValue,depthFilter:this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth?new an(0,0,0,1):new an(1,0,0,0)}),this._depthRenderMaterial.update({camera:e})}renderPass(e){var t,n,i,r,a,s;switch(this.debugOutput){default:break;case"lineardepth":this.passRenderer.renderScreenSpace(e,this._getDepthRenderMaterial(this.camera),null);break;case"g-normal":this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth?this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:null===(t=this.gBufferTextures)||void 0===t?void 0:t.gBufferTexture,blending:0,colorTransform:(new Hn).set(.5,0,0,0,0,.5,0,0,0,0,.5,0,0,0,0,0),colorBase:new an(.5,.5,.5,1),multiplyChannels:0,uvTransform:uh}),null):this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:null===(n=this.gBufferTextures)||void 0===n?void 0:n.gBufferTexture,blending:0,colorTransform:sh,colorBase:dh,multiplyChannels:0,uvTransform:uh}),null);break;case"g-depth":this.gBufferTextures.isFloatGBufferWithRgbNormalAlphaDepth?this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:null===(i=this.gBufferTextures)||void 0===i?void 0:i.gBufferTexture,blending:0,colorTransform:oh,colorBase:dh,multiplyChannels:0,uvTransform:uh}),null):this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:null===(r=this.gBufferTextures)||void 0===r?void 0:r.depthBufferTexture,blending:0,colorTransform:lh,colorBase:dh,multiplyChannels:0,uvTransform:uh}),null);break;case"ssao":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,blending:0,colorTransform:ch,colorBase:hh,multiplyChannels:0,uvTransform:uh}),null);break;case"ssaodenoise":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,blending:0,colorTransform:ch,colorBase:hh,multiplyChannels:0,uvTransform:uh}),null);break;case"shadowmap":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.screenSpaceShadowMapPass.shadowTexture,blending:0,colorTransform:ch,colorBase:hh,multiplyChannels:0,uvTransform:uh}),null);break;case"shadowsoft":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.aoAndSoftShadowRenderTarget.texture,blending:0,colorTransform:lf.shadowTransform,colorBase:hh,multiplyChannels:0,uvTransform:uh}),null);break;case"shadowdenoise":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,blending:0,colorTransform:lf.shadowTransform,colorBase:hh,multiplyChannels:0,uvTransform:uh}),null);break;case"shadowfadein":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.shadowAndAoPass.fadeRenderTarget.texture,blending:0,colorTransform:lf.shadowTransform,colorBase:hh,multiplyChannels:0,uvTransform:uh}),null);break;case"shadowandao":this.passRenderer.renderScreenSpace(e,this.getBlendAoAndShadowMaterial({texture:this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,blending:0,aoIntensity:this.renderPassManager.shadowAndAoPass.parameters.aoIntensity,shadowIntensity:this.renderPassManager.shadowAndAoPass.parameters.shadowIntensity}),null);break;case"shadowandaodepth":this.passRenderer.renderScreenSpace(e,this.getBlendAoPassDepthMaterial({texture:this.renderPassManager.shadowAndAoPass.denoiseRenderTargetTexture,blending:0}),null);break;case"materialao":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.aoPassMapTexture,blending:0,colorTransform:ah,colorBase:hh,multiplyChannels:0,uvTransform:uh}),null);break;case"groundreflection":this.passRenderer.renderScreenSpace(e,this.getSrgbToLinearCopyMaterial({texture:this.renderPassManager.groundReflectionPass.reflectionRenderTarget.texture,blending:0,colorTransform:ah,colorBase:hh,multiplyChannels:0,uvTransform:ph}),null);break;case"groundreflectionfinal":this.passRenderer.renderScreenSpace(e,this.getSrgbToLinearCopyMaterial({texture:this.renderPassManager.groundReflectionPass.intensityRenderTarget.texture,blending:0,colorTransform:ah,colorBase:hh,multiplyChannels:0,uvTransform:ph}),null);break;case"bakedgroundshadow":this.passRenderer.renderScreenSpace(e,this.getCopyMaterial({texture:this.renderPassManager.bakedGroundContactShadowPass.renderTarget.texture,blending:0,colorTransform:ah,colorBase:hh,multiplyChannels:0,uvTransform:uh}),null);break;case"environmentmap":this._environmentMapDecodeMaterial.setSourceTexture(this.scene.environment),this.passRenderer.renderScreenSpace(e,this._environmentMapDecodeMaterial,null);break;case"lightsourcedetection":if(null===(a=this.scene.userData)||void 0===a?void 0:a.environmentDefinition){const t=this.renderPassManager.aspect,n=new ea(-1,1,1/t,-1/t,-1,1),i=null===(s=this.scene.userData)||void 0===s?void 0:s.environmentDefinition.createDebugScene(e,this.scene,this.renderPassManager.screenSpaceShadowMapPass.parameters.maximumNumberOfLightSources);i.background=new Ci(16777215),e.render(i,n)}}}}class Kf extends zp{constructor(e){super(e),this.drawGround=!0,this.drawWithDebugMaterial=!1,this.grayDebugMaterial=new Wl({color:12632256,side:2,envMapIntensity:.4})}dispose(){super.dispose(),this.grayDebugMaterial.dispose()}renderPass(e){this.renderCacheManager.onBeforeRender("floorDepthWrite",this.scene),this.renderPassManager.setGroundVisibility(this.drawGround),this.drawWithDebugMaterial?this.renderCacheManager.render("debug",this.scene,(()=>{this.passRenderer.renderWithOverrideMaterial(e,this.scene,this.camera,this.grayDebugMaterial,null,0,1)})):e.render(this.scene,this.camera),this.renderPassManager.setGroundVisibility(!1),this.renderCacheManager.onAfterRender("floorDepthWrite")}}class Jf{constructor(){this.weightedAoPassAntiAliasing=!1,this.applyAoAndShadowToAlpha=!1,this._aoPassMapUniform={value:null},this._aoPassMapScaleUniform={value:1},this._aoPassMapIntensityUniform={value:1},this._shPassMapIntensityUniform={value:1},this._reflectionPassMapUniform={value:null},this._reflectionPassMapScaleUniform={value:1},this._reflectionPassMapIntensityUniform={value:0},this.applyReflectionPassMap=!1}set aoPassMap(e){this._aoPassMapUniform.value=e}set aoPassMapScale(e){this._aoPassMapScaleUniform.value=e}set aoPassMapIntensity(e){this._aoPassMapIntensityUniform.value=e}set shPassMapIntensity(e){this._shPassMapIntensityUniform.value=e}set reflectionPassMap(e){this._reflectionPassMapUniform.value=e}set reflectionPassMapScale(e){this._reflectionPassMapScaleUniform.value=e}set reflectionPassMapIntensity(e){this._reflectionPassMapIntensityUniform.value=e}static addPlugin(e){if(void 0!==e.userData.postProcessingMaterialPlugin)return e.userData.postProcessingMaterialPlugin instanceof Jf?e.userData.postProcessingMaterialPlugin:null;const t=new Jf;return e.userData.postProcessingMaterialPlugin=t,e.onBeforeCompile=(e,n)=>t._onBeforeCompile(e,n),e.customProgramCacheKey=()=>t._customProgramCacheKey(),t}_isEnabled(){return void 0!==this._aoPassMapUniform.value&&null!==this._aoPassMapUniform.value}_customProgramCacheKey(){let e="";return this._isEnabled()&&(e+="aoPassMap"+(this.applyAoAndShadowToAlpha?"Alpha":"")),this.applyReflectionPassMap&&(e+="reflectionPassMap"),e}_onBeforeCompile(e,t){if(this._isEnabled()||this.applyReflectionPassMap){let t=this.applyAoAndShadowToAlpha?"#define USE_APPLY_AO_AND_SHADOW_TO_ALPHA\n":"";t+=this.applyReflectionPassMap?"#define USE_REFLECTION_PASS_MAP\n":"",t+=this.weightedAoPassAntiAliasing?"#define WEIGHTED_AO_PASS_ANTIALIASING\n":"",t+=Qf,e.fragmentShader=e.fragmentShader.replace("#include ",t),e.fragmentShader=e.fragmentShader.replace("#include ",$f),this._initUniforms(e)}}_initUniforms(e){e&&(e.uniforms.tAoPassMap=this._aoPassMapUniform,e.uniforms.aoPassMapScale=this._aoPassMapScaleUniform,e.uniforms.aoPassMapIntensity=this._aoPassMapIntensityUniform,e.uniforms.shPassMapIntensity=this._shPassMapIntensityUniform,e.uniforms.tReflectionPassMap=this._reflectionPassMapUniform,e.uniforms.reflectionPassMapScale=this._reflectionPassMapScaleUniform,e.uniforms.reflectionPassMapIntensity=this._reflectionPassMapIntensityUniform)}}const Qf="\n#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif\n\n\tuniform highp sampler2D tAoPassMap;\n uniform float aoPassMapScale;\n uniform float aoPassMapIntensity;\n uniform float shPassMapIntensity;\n uniform sampler2D tReflectionPassMap;\n uniform float reflectionPassMapScale;\n uniform float reflectionPassMapIntensity;\n",$f="\n#ifndef AOPASSMAP_SWIZZLE\n\t#define AOPASSMAP_SWIZZLE rg\n#endif\n\nfloat ambientOcclusion = 1.0;\nfloat shadowValue = 1.0;\n\t\n#ifdef USE_AOMAP\n\n\t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tambientOcclusion = texture2D( aoMap, vAoMapUv ).r;\n ambientOcclusion = ( ambientOcclusion - 1.0 ) * aoMapIntensity + 1.0;\n\n#endif\n\n vec4 aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ), 0 );\n vec2 aoAndShadow = aoAndShadowMap.rg;\n float depthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n const ivec2 aoOffsetArray[8] = ivec2[8](\n ivec2(1, 0), ivec2(-1, 0), ivec2(0, 1), ivec2(0, -1), ivec2(1, 1), ivec2(-1, 1), ivec2(1, -1), ivec2(-1, -1));\n #ifdef WEIGHTED_AO_PASS_ANTIALIASING \n aoAndShadow *= 100.0;\n float deltaAoPassWeight = 100.0; \n for (int aoOffsetI = 0; aoOffsetI < 8; aoOffsetI++) {\n aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ) + aoOffsetArray[aoOffsetI], 0 );\n float testDepthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n float aoPassSampleWeight = (depthDelta * 100.0 + 0.01) / (testDepthDelta * 100.0 + 0.01);\n deltaAoPassWeight += aoPassSampleWeight;\n aoAndShadow += aoAndShadowMap.rg * aoPassSampleWeight;\n }\n aoAndShadow /= deltaAoPassWeight;\n #else\n for (int aoOffsetI = 0; aoOffsetI < 8; aoOffsetI++) {\n aoAndShadowMap = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ) + aoOffsetArray[aoOffsetI], 0 );\n float testDepthDelta = abs( dot(aoAndShadowMap.wz, vec2(1.0/1024.0)) - gl_FragCoord.z );\n if (testDepthDelta < depthDelta) {\n aoAndShadow = aoAndShadowMap.rg;\n depthDelta = testDepthDelta;\n }\n }\n #endif \n \n float aoPassMapValue = aoPassMapIntensity < 0.0 ? 1.0 : max(0.0, (aoAndShadow.r - 1.0) * aoPassMapIntensity + 1.0);\n shadowValue = shPassMapIntensity < 0.0 ? 1.0 : max(0.0, (aoAndShadow.g - 1.0) * shPassMapIntensity + 1.0);\n\n #ifdef USE_REFLECTION_PASS_MAP\n\n ivec2 reflectionPassMapSize = textureSize( tReflectionPassMap, 0 );\n vec2 reflectionPassMapUv = vec2( gl_FragCoord.x * reflectionPassMapScale, float(reflectionPassMapSize.y) - gl_FragCoord.y * reflectionPassMapScale );\n vec4 reflectionPassMapColor = texture2D( tReflectionPassMap, reflectionPassMapUv / vec2(reflectionPassMapSize) );\n if (reflectionPassMapColor.a > 0.0) reflectionPassMapColor.rgb /= reflectionPassMapColor.a;\n vec3 diffuseReflectionPassMapColor = reflectionPassMapColor.rgb * material.diffuseColor;\n reflectedLight.indirectDiffuse += diffuseReflectionPassMapColor * reflectionPassMapColor.a * reflectionPassMapIntensity;\n //reflectedLight.indirectDiffuse = mix(reflectedLight.indirectDiffuse, diffuseReflectionPassMapColor, reflectionPassMapColor.a * reflectionPassMapIntensity);\n\n #endif\n\n #if defined ( USE_APPLY_AO_AND_SHADOW_TO_ALPHA )\n diffuseColor.a = 1.0 - (1.0 - diffuseColor.a) * aoPassMapValue * shadowValue;\n #else\n ambientOcclusion = min( ambientOcclusion, aoPassMapValue );\n #endif\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion * shadowValue;\n \n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion * shadowValue;\n\t#endif\n\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion * shadowValue;\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n \n float specularOcclusion = computeSpecularOcclusion( dotNV, ambientOcclusion * shadowValue, material.roughness );\n\t\treflectedLight.indirectSpecular *= specularOcclusion;\n\n #ifdef USE_REFLECTION_PASS_MAP\n reflectedLight.indirectSpecular += material.specularColor * reflectionPassMapColor.rgb * reflectionPassMapColor.a * reflectionPassMapIntensity * specularOcclusion;\n #endif \n \n\t#endif\n";class em{get passRenderer(){return this._passRenderer}get scene(){return this._scene}get camera(){return this._camera}get aspect(){return this._sceneRenderer.width/this._sceneRenderer.height}get cameraChanged(){return this._cameraChanged}get noOStaticFrames(){return this._noOStaticFrames}get renderCacheManager(){return this._sceneRenderer.renderCacheManager}get parameters(){return this._sceneRenderer.parameters}get sceneRenderPass(){return this._sceneRenderPass}get bakedGroundContactShadowPass(){return this._bakedGroundContactShadowPass}get gBufferRenderPass(){return this._gBufferRenderPass}get groundReflectionPass(){return this._groundReflectionPass}get screenSpaceShadowMapPass(){return this._screenSpaceShadowMapPass}get shadowAndAoPass(){return this._shadowAndAoPass}get outlinePass(){return this._outlinePass}get outlineRenderer(){return this._sceneRenderer.outlineRenderer}get debugPass(){var e;return null!==(e=this._debugPass)&&void 0!==e||(this._debugPass=new Zf(this)),this._debugPass}get debugOutput(){return this._sceneRenderer.debugOutput}constructor(e){this.materialsNeedUpdate=!0,this._passRenderer=new Rh,this._outlinePass=null,this._debugPass=null,this._cameraUpdate=new Ph,this._cameraChanged=!0,this._noUpdateNeededCount=0,this._noOStaticFrames=0,this._maxSamples=1,this._passUpdateStates={updateGroundReflection:!1,updateGBuffer:!1,updateScreenSpaceShadow:!1,updateShadowAndAoPass:!1,updateOutlinePass:!1,updateDebugPass:!1},this.aoPassMapTexture=null,this._sceneRenderer=e,this._maxSamples=Ah(this._sceneRenderer.renderer),this._sceneRenderPass=new Kf(this),this._bakedGroundContactShadowPass=new xf(this,this._sceneRenderer.renderer,this._sceneRenderer.groundGroup,{sharedShadowGroundPlane:this._sceneRenderer.shadowAndAoGroundPlane}),this._gBufferRenderPass=new wf(this,{shared:!0,capabilities:this._sceneRenderer.renderer.capabilities,width:this._sceneRenderer.width,height:this._sceneRenderer.height,samples:1}),this._groundReflectionPass=new Mf(this,this._sceneRenderer.width,this._sceneRenderer.height,this._maxSamples,{}),this._screenSpaceShadowMapPass=new Df(this,new Nt(this._sceneRenderer.width,this._sceneRenderer.height),{samples:1,alwaysUpdate:!1}),this._shadowAndAoPass=new lf(this,this._sceneRenderer.width,this._sceneRenderer.height,1)}dispose(){var e;this._sceneRenderPass.dispose(),this._bakedGroundContactShadowPass.dispose(),this._gBufferRenderPass.dispose(),this._groundReflectionPass.dispose(),this._screenSpaceShadowMapPass.dispose(),this._shadowAndAoPass.dispose(),null===(e=this._outlinePass)||void 0===e||e.dispose()}setSize(e,t){var n;this._gBufferRenderPass.setSize(e,t),this._groundReflectionPass.setSize(e,t),this._screenSpaceShadowMapPass.setSize(e,t),this._shadowAndAoPass.setSize(e,t),null===(n=this._outlinePass)||void 0===n||n.setSize(e,t)}createOutlinePass(){return this._outlinePass||(this._outlinePass=new Wf(this,new Nt(this._sceneRenderer.width,this._sceneRenderer.height),this.scene,this.camera,[],{downSampleRatio:2,edgeDetectionFxaa:!0})),this._outlinePass}setGroundVisibility(e){this._sceneRenderer.shadowAndAoGroundPlane.setVisibility(e)}updatePasses(e,t,n){this._scene=t,this._camera=n,this._cameraChanged=this._cameraUpdate.changed(n);const i=this._evaluateIfShadowAndAoUpdateIsNeeded();this._updateSceneRenderPass(),this._updateBakedGroundContactShadowPass(),this._updateGBufferPass(i),this._updateGroundReflectionPass(i),this._updateScreenSpaceShadowPass(i),this._updateShadowAndAoPass(i),this._updateOutlinePass(),this._updateDebugPass()}_evaluateIfShadowAndAoUpdateIsNeeded(){const e=this._shadowAndAoPass.parameters.alwaysUpdate||this._screenSpaceShadowMapPass.needsUpdate||this._screenSpaceShadowMapPass.shadowTypeNeedsUpdate;let t=(this._shadowAndAoPass.parameters.enabled||this._groundReflectionPass.parameters.enabled)&&this._cameraChanged,n=1;return t&&(this._noUpdateNeededCount=0,this._noOStaticFrames=0),e||(this._noUpdateNeededCount++,t=this._noUpdateNeededCount>=this.parameters.effectSuspendFrames,n=Math.max(0,Math.min(1,(this._noUpdateNeededCount-this.parameters.effectSuspendFrames)/this.parameters.effectFadeInFrames))),e||1!==n||this._noOStaticFrames++,t=e||t,{needsUpdate:t,shadowOnCameraChange:!t||n<.99?this.parameters.shadowOnCameraChange:nf,intensityScale:n}}_dynamicChanges(e){return e.needsUpdate||e.shadowOnCameraChange!==nf}_updateSceneRenderPass(){this._sceneRenderPass.drawWithDebugMaterial=!1}_updateBakedGroundContactShadowPass(){const e=this._bakedGroundContactShadowPass.limitPlaneSize;this._bakedGroundContactShadowPass.limitPlaneSize=this._bakedGroundContactShadowPass.parameters.enabled,(e!==this._bakedGroundContactShadowPass.limitPlaneSize||this._bakedGroundContactShadowPass.needsUpdate)&&this._bakedGroundContactShadowPass.updateBounds(this._sceneRenderer.boundingVolume,this._sceneRenderer.groundLevel),this._sceneRenderPass.drawGround=this._bakedGroundContactShadowPass.parameters.enabled||this._shadowAndAoPass.parameters.applyToMaterial}_updateGBufferPass(e){this._passUpdateStates.updateGBuffer=!1,this._gBufferRenderPass.needsUpdate=e.needsUpdate||e.shadowOnCameraChange===af,this.gBufferRenderPass.drawGround=this._sceneRenderer.boundingVolumeSet&&this._shadowAndAoPass.parameters.aoOnGround}_updateGroundReflectionPass(e){this._passUpdateStates.updateGroundReflection=!1,this._groundReflectionPass.parameters.enabled&&this._dynamicChanges(e)&&(!this.parameters.suspendGroundReflection||e.needsUpdate)&&(this._groundReflectionPass.reflectionFadeInScale=this.parameters.suspendGroundReflection?e.intensityScale:1,this._passUpdateStates.updateGroundReflection=!0)}_updateScreenSpaceShadowPass(e){this._dynamicChanges(e)?(this._screenSpaceShadowMapPass.parameters.alwaysUpdate=this._shadowAndAoPass.parameters.alwaysUpdate,this._screenSpaceShadowMapPass.drawGround=this._shadowAndAoPass.parameters.shadowOnGround,this._passUpdateStates.updateScreenSpaceShadow=this._shadowAndAoPass.parameters.shadowIntensity>0,this._passUpdateStates.updateScreenSpaceShadow=!0,this._passUpdateStates.updateGBuffer=!0):this._passUpdateStates.updateScreenSpaceShadow=!1}_updateShadowAndAoPass(e){this._dynamicChanges(e)?(this._shadowAndAoPass.shadowAndAoPassSettings={shadowMapTexture:this._screenSpaceShadowMapPass.shadowTexture,shadowBlurType:e.needsUpdate?sf:e.shadowOnCameraChange,shadowFadeInBlurType:e.shadowOnCameraChange,shadowFadeInMix:1-e.intensityScale,noOStaticFrames:this.noOStaticFrames},this._passUpdateStates.updateShadowAndAoPass=!0,this._passUpdateStates.updateGBuffer=!0):this._passUpdateStates.updateShadowAndAoPass=!1}_updateOutlinePass(){this.outlineRenderer.outlinePassActivated&&this.outlineRenderer.outlinePass?(this.outlineRenderer.outlinePass.renderToScreen=!1,this.outlineRenderer.outlinePass.clearBackground=!1,this._passUpdateStates.updateOutlinePass=!0,this._passUpdateStates.updateGBuffer=!0):this._passUpdateStates.updateOutlinePass=!1}_updateDebugPass(){if(this.debugOutput&&""!==this.debugOutput&&"off"!==this.debugOutput){if("outline"===this.debugOutput&&this.outlineRenderer.outlinePass)return this.outlineRenderer.outlinePass.clearBackground=!0,void(this._passUpdateStates.updateDebugPass=!1);if("color"===this.debugOutput||"grayscale"===this.debugOutput)return this._passUpdateStates.updateGroundReflection=!1,this._passUpdateStates.updateGBuffer=!1,this._passUpdateStates.updateScreenSpaceShadow=!1,this._passUpdateStates.updateShadowAndAoPass=!1,this._passUpdateStates.updateOutlinePass=!1,this._passUpdateStates.updateDebugPass=!1,void(this._sceneRenderPass.drawWithDebugMaterial="grayscale"===this.debugOutput);this.debugPass.debugOutput=this.debugOutput,this._passUpdateStates.updateDebugPass=!0}else this._passUpdateStates.updateDebugPass=!1}_updateMaterials(e,t){if(!this.materialsNeedUpdate||!this._shadowAndAoPass.parameters.applyToMaterial)return;this.aoPassMapTexture=this._shadowAndAoPass.denoiseRenderTargetTexture;const n=e.getPixelRatio();this.materialsNeedUpdate=!1,t.traverse((e=>{if(e.isMesh){const t=e.material;t instanceof Wl&&this._updateMaterial(e,t,n)}}))}_updateMaterial(e,t,n){const i=Jf.addPlugin(t);i&&(this._updatePlugInAo(i,e,t,n),this._updatePlugInReflection(i,e),t.needsUpdate=!1)}_updatePlugInAo(e,t,n,i){const r=this._shadowAndAoPass.parameters.enabled&&this._shadowAndAoPass.parameters.applyToMaterial&&null!==this.aoPassMapTexture&&("ShadowGroundPlaneMaterial"===n.name||t.receiveShadow&&(!n.transparent||n.alphaTest>=.9)),a=r&&this._shadowAndAoPass.parameters.aoIntensity>.01,s=r&&this._screenSpaceShadowMapPass.enabled&&this._shadowAndAoPass.parameters.shadowIntensity>.01;e.applyAoAndShadowToAlpha="ShadowGroundPlaneMaterial"===n.name,e.aoPassMapIntensity=a?2*this._shadowAndAoPass.parameters.aoIntensity:-1,e.shPassMapIntensity=s?2*this._shadowAndAoPass.parameters.shadowIntensity:-1,e.aoPassMapScale=1/i,e.aoPassMap=this.aoPassMapTexture}_updatePlugInReflection(e,t){const n=this._groundReflectionPass.intensityRenderTarget.texture,i=t.userData.isPlanFloor&&this._groundReflectionPass.parameters.enabled&&(null!==n||void 0!==n),r=this._groundReflectionPass.parameters.intensity;e.applyReflectionPassMap=i,e.reflectionPassMapIntensity=i?Math.pow(r,.25):0,e.reflectionPassMapScale=1/(this._groundReflectionPass.parameters.renderTargetDownScale*devicePixelRatio),e.reflectionPassMap=i?n:null}renderPasses(e,t){var n,i;e.setRenderTarget(null),this._bakedGroundContactShadowPass.renderPass(e),this._passUpdateStates.updateGBuffer&&this._gBufferRenderPass.renderPass(e),this._passUpdateStates.updateScreenSpaceShadow&&this._screenSpaceShadowMapPass.renderPass(e),this._passUpdateStates.updateShadowAndAoPass&&this._shadowAndAoPass.renderPass(e),this._updateMaterials(e,t),this._sceneRenderPass.renderPass(e),this._passUpdateStates.updateGroundReflection&&this._groundReflectionPass.renderPass(e),this._passUpdateStates.updateShadowAndAoPass&&!this._shadowAndAoPass.parameters.applyToMaterial&&this._shadowAndAoPass.renderToTarget(e),this._passUpdateStates.updateOutlinePass&&(null===(n=this._outlinePass)||void 0===n||n.renderPass(e)),this._passUpdateStates.updateDebugPass&&(null===(i=this._debugPass)||void 0===i||i.renderPass(e))}}const tm="highest",nm="high",im="medium";class rm{get sceneRenderPass(){return this._renderPassManager.sceneRenderPass}get bakedGroundContactShadowPass(){return this._renderPassManager.bakedGroundContactShadowPass}get gBufferRenderPass(){return this._renderPassManager.gBufferRenderPass}get groundReflectionPass(){return this._renderPassManager.groundReflectionPass}get screenSpaceShadowMapPass(){return this._renderPassManager.screenSpaceShadowMapPass}get shadowAndAoPass(){return this._renderPassManager.shadowAndAoPass}get debugPass(){return this._renderPassManager.debugPass}get shadowAndAoGroundPlane(){return this._shadowAndAoGroundPlane}constructor(e,t,n){this.debugOutput="off",this.outputColorSpace="",this.toneMapping="",this.environmentLights=!1,this.enableObjectSelection=!0,this.groundLevel=0,this.uiInteractionMode=!1,this.width=0,this.height=0,this.boundingVolume=new Eh,this.boundingVolumeSet=!1,this.renderCacheManager=new mf,this.selectedObjects=[],this.groundGroup=new _o,this._shadingType=df,this._qualityLevel=tm,this._qualityMap=new Map,this._customShadingParameters=null,this.width=t,this.height=n,this.renderer=e,this.renderCacheManager.registerCache("inivisibleGround",new gf((e=>e===this.groundGroup))),this.renderCacheManager.registerCache("debug",new gf),this.renderCacheManager.registerCache("floorDepthWrite",new vf((e=>{var t;return null===(t=e.userData)||void 0===t?void 0:t.isFloor}))),this._shadowAndAoGroundPlane=new Bp(null),this.groundGroup.rotateX(-Math.PI/2),this._renderPassManager=new em(this),this.outlineRenderer=new cf(this._renderPassManager,null,{}),this.parameters={gBufferRenderTargetParameters:this.gBufferRenderPass.parameters,bakedGroundContactShadowParameters:this.bakedGroundContactShadowPass.parameters,screenSpaceShadowMapParameters:this.screenSpaceShadowMapPass.parameters,shAndAoPassParameters:this.shadowAndAoPass.parameters,groundReflectionParameters:this.groundReflectionPass.parameters,outlineParameters:this.outlineRenderer.parameters,effectSuspendFrames:0,effectFadeInFrames:0,suspendGroundReflection:!1,shadowOnCameraChange:nf},this._addEventListeners(this.renderer)}_addEventListeners(e){e.domElement.addEventListener("webglcontextlost",(()=>{console.log("webglcontextlost")})),e.domElement.addEventListener("webglcontextrestored",(()=>{console.log("webglcontextrestored"),this._forceEnvironmentMapUpdate(this.renderer)}))}dispose(){var e;null===(e=this._copyMaterial)||void 0===e||e.dispose(),this._renderPassManager.dispose(),this.renderer.dispose()}setSize(e,t){this.width=e,this.height=t,this._renderPassManager.setSize(e,t),this.renderer.setSize(e,t)}getQualityLevel(){return this._qualityLevel}setShadingType(e){this._shadingType!==e&&(this._shadingType=e,this.applyCurrentParameters())}setQualityLevel(e){this._qualityLevel!==e&&(this._qualityMap.has(this._qualityLevel)&&(this._qualityLevel=e),this.applyCurrentParameters())}setQualityMap(e){this._qualityMap=e,this.applyCurrentParameters()}setCustomShadingParameters(e){this._customShadingParameters=e,this.applyCurrentParameters(),this.requestUpdateOfPasses()}setQualityMapAndShadingParameters(e,t){this._qualityMap=e,this._customShadingParameters=t,this.applyCurrentParameters(),this.requestUpdateOfPasses()}applyCurrentParameters(){const e=[];this._qualityMap.has(this._qualityLevel)&&e.push(this._qualityMap.get(this._qualityLevel));const t=(n=this._shadingType)&&n!==df&&"bright"===n?uf:null;var n;t&&e.push(t);const i=this.uiInteractionMode?{groundReflectionParameters:{enabled:!1}}:null;if(i&&e.push(i),this._customShadingParameters&&e.push((e=>{const t={shAndAoPassParameters:{ao:{},shadow:{}},groundReflectionParameters:{},bakedGroundContactShadowParameters:{}};return((e,t)=>{void 0!==t.aoIntensity&&(e.shAndAoPassParameters.aoIntensity=pf(t.aoIntensity)),void 0!==t.aoExtent&&(e.shAndAoPassParameters.ao.radius=.3*pf(t.aoExtent),e.shAndAoPassParameters.ao.thickness=.1+.2*pf(t.aoExtent))})(t,e),((e,t)=>{t.shBakedOnGround?(e.bakedGroundContactShadowParameters.enabled=!0,e.shAndAoPassParameters.shadowIntensity=0,void 0!==t.shadowIntensity&&(e.bakedGroundContactShadowParameters.opacity=pf(t.shadowIntensity)),void 0!==t.shadowIntensity&&(e.bakedGroundContactShadowParameters.blurMax=.1*pf(t.shadowIntensity),e.bakedGroundContactShadowParameters.blurMin=.01*e.bakedGroundContactShadowParameters.blurMax)):(void 0!==t.shBakedOnGround&&(e.bakedGroundContactShadowParameters.enabled=!1),void 0!==t.shadowIntensity&&(e.shAndAoPassParameters.shadowIntensity=pf(t.shadowIntensity)),void 0!==t.shadowSoftening&&(e.shAndAoPassParameters.shadow.shadowRadius=.001+.2*pf(t.shadowSoftening)))})(t,e),((e,t)=>{void 0!==t.grReflectIntensity&&(e.groundReflectionParameters.enabled=t.grReflectIntensity>0,e.groundReflectionParameters.intensity=pf(t.grReflectIntensity)),void 0!==t.grReflectFadeOut&&(e.groundReflectionParameters.fadeOutDistance=4*(1-pf(t.grReflectFadeOut)))})(t,e),t})(this._customShadingParameters)),e.length>0){const t=((...e)=>{if(0===e.length)return null;if(1===e.length)return e[0];let t=e[0];for(let n=1;n0&&(this.environmentLights=!1),this.screenSpaceShadowMapPass.updateRectAreaLights(e,t),this.shadowAndAoPass.needsUpdate=!0}createShadowFromLightSources(e,t){this.environmentLights=!0,this.screenSpaceShadowMapPass.createShadowFromLightSources(e,t),this.shadowAndAoPass.needsUpdate=!0}selectObjects(e){this.selectedObjects=e}updateBounds(e,t){this.clearCache();const n=e.clone();n.min.y>this.groundLevel&&(n.min.y=this.groundLevel),this.boundingVolumeSet=!0,this.gBufferRenderPass.groundDepthWrite=this.shadowAndAoPass.parameters.aoOnGround,this.boundingVolume.updateFromBox(n);const i=this.boundingVolume.size,r=(i.x+i.y+i.z)/3,a=Math.min(i.x,i.y,i.z),s=Math.max(i.x,i.y,i.z),o=a<.5?a/.5:i.z>5?i.z/5:1;this.bakedGroundContactShadowPass.setScale(t?r:o,r),this.groundReflectionPass.updateBounds(this.groundLevel,Math.min(1,s)),this.screenSpaceShadowMapPass.updateBounds(this.boundingVolume,r),this.shadowAndAoPass.updateBounds(this.boundingVolume,t?r:Math.min(1,2*s))}updateNearAndFarPlaneOfPerspectiveCamera(e,t){const n=this.boundingVolume.getNearAndFarForPerspectiveCamera(e.position,3);e.near=Math.max(1e-5,.9*n[0]),e.far=Math.max(null!=t?t:e.near,n[1]),e.updateProjectionMatrix()}_forceEnvironmentMapUpdate(e){const t=e.userData;if(null==t?void 0:t.environmentTexture){const e=t.environmentTexture;t.environmentTexture=void 0,e.dispose()}}_updateEnvironment(e,t){var n,i;if(!(null===(n=t.userData)||void 0===n?void 0:n.environmentDefinition))return;e.userData||(e.userData={});const r=e.userData;if(r&&((null===(i=t.userData)||void 0===i?void 0:i.environmentDefinition.needsUpdate)||!r.environmentTexture||r.environmentDefinition!==t.userData.environmentDefinition)){const n=t.userData.environmentDefinition;if(r.environmentDefinition=n,r.environmentTexture=n.createNewEnvironment(e),t.userData.shadowFromEnvironment){const e=n.maxNoOfLightSources;void 0!==e&&(this.screenSpaceShadowMapPass.parameters.maximumNumberOfLightSources=e),this.createShadowFromLightSources(t,n.lightSources)}}t.environment=null==r?void 0:r.environmentTexture,t.userData.showEnvironmentBackground?t.background=t.environment:t.background===t.environment&&(t.background=null)}render(e,t){e.add(this.groundGroup),this._updateEnvironment(this.renderer,e),this.outlineRenderer.updateOutline(e,t,this.enableObjectSelection?this.selectedObjects:[]),this._renderPassManager.updatePasses(this.renderer,e,t),this._renderPassManager.renderPasses(this.renderer,e),e.remove(this.groundGroup)}}class am extends fi{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Nt(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const sm=new dn,om=new Hn,lm=new Hn,cm=new dn,hm=new dn;class dm extends _o{constructor(e,t,n){super(),this.arrowNeedsUpdate=!0,this.labelTextClientWidth=0,this.startPosition=e.clone(),this.endPosition=t.clone(),this.parameters=Object.assign({shaftPixelWidth:10,shaftPixelOffset:3,arrowPixelWidth:30,arrowPixelHeight:50,color:0,labelClass:"label",deviceRatio:1,autoLabelTextUpdate:!0,autoLabelRotationUpdate:!0},n),this.startShaftMaterial=new um,this.startShaft=new mr(new Hr(2,1).translate(0,.5,0),this.startShaftMaterial),this.startShaft.onBeforeRender=(e,t,n,i,r,a)=>{this.updateShaftMaterial(!0,e,n,r)},this.add(this.startShaft),this.endShaftMaterial=new um,this.endShaft=new mr(new Hr(2,1).translate(0,.5,0),this.endShaftMaterial),this.endShaft.onBeforeRender=(e,t,n,i,r,a)=>{this.updateShaftMaterial(!1,e,n,r)},this.add(this.endShaft),this.startArrowMaterial=new pm,this.startArrow=new mr(new Hr(2,1).translate(0,.5,0),this.startArrowMaterial),this.startArrow.onBeforeRender=(e,t,n,i,r,a)=>{this.updateArrowMaterial(!0,e,n,r)},this.add(this.startArrow),this.endArrowMaterial=new pm,this.endArrow=new mr(new Hr(2,1).translate(0,.5,0),this.endArrowMaterial),this.endArrow.onBeforeRender=(e,t,n,i,r,a)=>{this.updateArrowMaterial(!1,e,n,r)},this.add(this.endArrow),this.arrowLabel=this.createArrowLabel("0.000",this.parameters),this.add(this.arrowLabel),this.updateArrow()}createArrowLabel(e,t){var n,i,r,a,s,o;const l=document.createElement("div"),c=document.createElement("div");l.appendChild(c),c.className=null!==(n=t.labelClass)&&void 0!==n?n:"",c.textContent=e,c.style.backgroundColor="transparent",c.style.color=new Ci(null!==(i=t.color)&&void 0!==i?i:0).getStyle();const h=new am(l);return h.position.set(0,0,0),h.center.set(null!==(a=null===(r=t.origin)||void 0===r?void 0:r.x)&&void 0!==a?a:.5,null!==(o=null===(s=t.origin)||void 0===s?void 0:s.y)&&void 0!==o?o:.5),h.layers.set(0),h}setPosition(e,t,n=0,i=0){const r=t.clone().sub(e).normalize();this.startPosition.copy(e.clone().add(r.clone().multiplyScalar(n))),this.endPosition.copy(t.clone().add(r.clone().multiplyScalar(-i))),this.arrowNeedsUpdate=!0}setAngle(e){const t=`${e.toFixed(0)}deg`;this.arrowLabel.element.children[0].style.rotate=t}setLabel(e){const t=this.arrowLabel.element.children[0];t.textContent=e,this.labelTextClientWidth=t.clientWidth*this.parameters.deviceRatio}updateArrow(){const e=this.startPosition.clone().applyMatrix4(this.matrixWorld),t=this.endPosition.clone().applyMatrix4(this.matrixWorld),n=t.clone().sub(e),i=n.length();n.multiplyScalar(1/i);const r=new dn(0,1,0).cross(n),a=Math.acos(new dn(0,1,0).dot(n));this.setModelMatrix(this.startShaft,e,i,r,a),this.setModelMatrix(this.endShaft,t,i,r,a),this.setModelMatrix(this.startArrow,e,1,r,a),this.setModelMatrix(this.endArrow,t,1,r,a+Math.PI)}updateArrowLabel(e,t){var n,i;const r=this.startPosition.distanceTo(this.endPosition).toFixed(3),a=this.startPosition.clone().applyMatrix4(this.matrixWorld).applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix),s=this.endPosition.clone().applyMatrix4(this.matrixWorld).applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix),o=s.clone().add(a).multiplyScalar(.5).applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld);this.arrowLabel.position.copy(o);const l=e.getRenderTarget(),c=null!==(n=null==l?void 0:l.width)&&void 0!==n?n:e.domElement.clientWidth,h=null!==(i=null==l?void 0:l.height)&&void 0!==i?i:e.domElement.clientHeight,d=s.clone().sub(a),u=180*Math.atan2(-d.y,d.x*c/h)/Math.PI;this.parameters.autoLabelRotationUpdate&&this.setAngle(u),this.parameters.autoLabelTextUpdate&&this.setLabel(r)}setModelMatrix(e,t,n,i,r){e.scale.set(1,1,1),e.rotation.set(0,0,0),e.position.set(0,0,0),e.applyMatrix4((new Hn).makeScale(1,.5*n,1)),e.applyMatrix4((new Hn).makeRotationAxis(i,r)),e.applyMatrix4((new Hn).makeTranslation(t.x,t.y,t.z))}updateShaftMaterial(e,t,n,i){var r,a;if(this.updateMatrixWorld(),i instanceof um){const s=t.getRenderTarget(),o=new Nt;t.getSize(o);const l=null!==(r=null==s?void 0:s.width)&&void 0!==r?r:o.x,c=null!==(a=null==s?void 0:s.height)&&void 0!==a?a:o.y,h=this.startPosition.clone().applyMatrix4(this.matrixWorld),d=this.endPosition.clone().applyMatrix4(this.matrixWorld);i.update({width:l,height:c,camera:n,start:e?h:d,end:e?d:h,shaftPixelWidth:this.parameters.shaftPixelWidth,shaftPixelOffset:this.parameters.shaftPixelOffset,arrowPixelSize:new Nt(this.parameters.arrowPixelWidth,this.parameters.arrowPixelHeight),labelPixelWidth:this.labelTextClientWidth,color:this.parameters.color})}this.arrowNeedsUpdate&&(this.arrowNeedsUpdate=!1,this.updateArrowLabel(t,n),this.updateArrow())}updateArrowMaterial(e,t,n,i){var r,a;if(this.updateMatrixWorld(),i instanceof pm){const s=t.getRenderTarget(),o=null!==(r=null==s?void 0:s.width)&&void 0!==r?r:t.domElement.clientWidth,l=null!==(a=null==s?void 0:s.height)&&void 0!==a?a:t.domElement.clientHeight,c=this.startPosition.clone().applyMatrix4(this.matrixWorld),h=this.endPosition.clone().applyMatrix4(this.matrixWorld);i.update({width:o,height:l,camera:n,start:e?c:h,end:e?h:c,arrowPixelSize:new Nt(this.parameters.arrowPixelWidth,this.parameters.arrowPixelHeight),color:this.parameters.color})}this.arrowNeedsUpdate&&(this.arrowNeedsUpdate=!1,this.updateArrowLabel(t,n),this.updateArrow())}}class um extends wr{constructor(e){super({defines:Object.assign({},um.shader.defines),uniforms:Sr.clone(um.shader.uniforms),vertexShader:um.shader.vertexShader,fragmentShader:um.shader.fragmentShader,side:2,blending:0}),this.update(e)}update(e){var t,n;if((null==e?void 0:e.width)||(null==e?void 0:e.height)){const i=null!==(t=null==e?void 0:e.width)&&void 0!==t?t:this.uniforms.resolution.value.x,r=null!==(n=null==e?void 0:e.height)&&void 0!==n?n:this.uniforms.resolution.value.y;this.uniforms.resolution.value.set(i,r)}return void 0!==(null==e?void 0:e.start)&&this.uniforms.start.value.copy(e.start),void 0!==(null==e?void 0:e.end)&&this.uniforms.end.value.copy(e.end),void 0!==(null==e?void 0:e.shaftPixelWidth)&&(this.uniforms.shaftPixelWidth.value=e.shaftPixelWidth),void 0!==(null==e?void 0:e.shaftPixelOffset)&&(this.uniforms.shaftPixelOffset.value=e.shaftPixelOffset),void 0!==(null==e?void 0:e.arrowPixelSize)&&this.uniforms.arrowPixelSize.value.copy(e.arrowPixelSize),void 0!==(null==e?void 0:e.labelPixelWidth)&&(this.uniforms.labelPixelWidth.value=e.labelPixelWidth),void 0!==(null==e?void 0:e.color)&&(this.uniforms.color.value=new Ci(e.color)),this}}um.shader={uniforms:{resolution:{value:new Nt},start:{value:new dn},end:{value:new dn},shaftPixelWidth:{value:10},shaftPixelOffset:{value:10},arrowPixelSize:{value:new Nt},labelPixelWidth:{value:0},color:{value:new Ci}},defines:{RADIUS_RATIO:.5},vertexShader:"varying vec2 centerPixel;\nvarying vec2 posPixel;\nvarying vec2 arrowDir;\n\nuniform vec2 resolution;\nuniform vec3 start;\nuniform vec3 end;\nuniform float shaftPixelWidth;\nuniform float shaftPixelOffset;\nuniform vec2 arrowPixelSize;\nuniform float labelPixelWidth;\n\nvec2 pixelToNdcScale(vec4 hVec) {\n return vec2(2.0 * hVec.w) / resolution.xy;\n}\n\nvoid main() {\n vec4 viewPos = modelViewMatrix * vec4(0.0, 0.0, position.z, 1.0);\n gl_Position = projectionMatrix * viewPos;\n vec4 clipStart = projectionMatrix * viewMatrix * vec4(start, 1.0);\n vec4 clipEnd = projectionMatrix * viewMatrix * vec4(end, 1.0);\n vec2 clipDir = normalize((clipEnd.xy / clipEnd.w - clipStart.xy / clipStart.w) * resolution.xy);\n vec4 shaftEnd = vec4(clipEnd.xy / clipEnd.w * clipStart.w, clipStart.zw);\n shaftEnd.xy -= clipDir * (labelPixelWidth * 0.5 + shaftPixelOffset) * pixelToNdcScale(gl_Position);\n gl_Position.xy = mix(clipStart.xy / clipStart.w, shaftEnd.xy / shaftEnd.w, position.y * 0.5) * gl_Position.w;\n gl_Position.xy += vec2(-clipDir.y, clipDir.x) * position.x * shaftPixelWidth * 0.5 * pixelToNdcScale(gl_Position);\n\n vec4 clipCenter = clipStart;\n float d = arrowPixelSize.y * (1.0 + RADIUS_RATIO) - length(arrowPixelSize * vec2(0.5, RADIUS_RATIO));\n clipCenter.xy += clipDir * (d + shaftPixelOffset + shaftPixelWidth * 0.5) * pixelToNdcScale(gl_Position);\n centerPixel = (clipCenter.xy / gl_Position.w * 0.5 + 0.5) * resolution;\n posPixel = (gl_Position.xy / gl_Position.w * 0.5 + 0.5) * resolution;\n arrowDir = clipDir;\n}",fragmentShader:"varying vec2 centerPixel;\nvarying vec2 posPixel;\nvarying vec2 arrowDir;\n\nuniform float shaftPixelWidth;\nuniform vec3 color;\n\nvoid main() {\n if (dot(arrowDir, posPixel - centerPixel) < 0.0 && length(posPixel - centerPixel) > shaftPixelWidth * 0.5)\n discard;\n gl_FragColor = vec4(color, 1.0);\n}"};class pm extends wr{constructor(e){super({defines:Object.assign({},pm.shader.defines),uniforms:Sr.clone(pm.shader.uniforms),vertexShader:pm.shader.vertexShader,fragmentShader:pm.shader.fragmentShader,side:2,blending:0}),this.update(e)}update(e){var t,n;if((null==e?void 0:e.width)||(null==e?void 0:e.height)){const i=null!==(t=null==e?void 0:e.width)&&void 0!==t?t:this.uniforms.resolution.value.x,r=null!==(n=null==e?void 0:e.height)&&void 0!==n?n:this.uniforms.resolution.value.y;this.uniforms.resolution.value.set(i,r)}return void 0!==(null==e?void 0:e.start)&&this.uniforms.start.value.copy(e.start),void 0!==(null==e?void 0:e.end)&&this.uniforms.end.value.copy(e.end),void 0!==(null==e?void 0:e.arrowPixelSize)&&this.uniforms.arrowPixelSize.value.copy(e.arrowPixelSize),void 0!==(null==e?void 0:e.color)&&(this.uniforms.color.value=new Ci(e.color)),this}}pm.shader={uniforms:{resolution:{value:new Nt},start:{value:new dn},end:{value:new dn},arrowPixelSize:{value:new Nt},color:{value:new Ci}},defines:{RADIUS_RATIO:.5},vertexShader:"varying vec2 arrowUv;\nvarying vec2 centerPixel;\nvarying vec2 posPixel;\n\nuniform vec2 resolution;\nuniform vec3 start;\nuniform vec3 end;\nuniform vec2 arrowPixelSize;\n\nvec2 pixelToNdcScale(vec4 hVec) {\n return vec2(2.0 * hVec.w) / resolution.xy;\n}\n\nvoid main() {\n vec4 viewPos = modelViewMatrix * vec4(0.0, 0.0, position.z, 1.0);\n gl_Position = projectionMatrix * viewPos;\n vec4 clipStart = projectionMatrix * viewMatrix * vec4(start, 1.0);\n vec4 clipEnd = projectionMatrix * viewMatrix * vec4(end, 1.0);\n vec2 clipDir = normalize((clipEnd.xy / clipEnd.w - clipStart.xy / clipStart.w) * resolution.xy);\n gl_Position.xy += clipDir * position.y * arrowPixelSize.y * pixelToNdcScale(gl_Position);\n gl_Position.xy += vec2(-clipDir.y, clipDir.x) * position.x * arrowPixelSize.x * 0.5 * pixelToNdcScale(gl_Position);\n\n arrowUv = position.xy;\n\n vec4 clipCenter = clipStart;\n clipCenter.xy += clipDir * arrowPixelSize.y * (1.0 + RADIUS_RATIO) * pixelToNdcScale(gl_Position);\n centerPixel = (clipCenter.xy / gl_Position.w * 0.5 + 0.5) * resolution;\n posPixel = (gl_Position.xy / gl_Position.w * 0.5 + 0.5) * resolution;\n}",fragmentShader:"varying vec2 arrowUv;\nvarying vec2 centerPixel;\nvarying vec2 posPixel;\n\nuniform vec2 resolution;\nuniform vec2 arrowPixelSize;\nuniform vec3 color;\n\nvoid main() {\n if (abs(arrowUv.x) > abs(arrowUv.y))\n discard;\n if (length(posPixel - centerPixel) < length(arrowPixelSize * vec2(0.5, RADIUS_RATIO)))\n discard;\n gl_FragColor = vec4(color, 1.0);\n}"};const fm="all_around",mm="front";class gm extends $h{constructor(e={}){super(),this._parameters={},this._parameters=e}generateScene(e,t){const n=new vm(Object.assign(Object.assign({},this._parameters),{lightIntensity:e*(this._parameters.lightIntensity||1),topLightIntensity:e*(this._parameters.topLightIntensity||1),sidLightIntensity:e*(this._parameters.sidLightIntensity||1)}));return n.rotation.y=t,n}}class vm extends Ao{constructor(e={}){var t;super(),this._type=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:fm,this._topLightIntensity=(null==e?void 0:e.topLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideLightIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1,this._sideReflectorIntensity=(null==e?void 0:e.sidLightIntensity)||(null==e?void 0:e.lightIntensity)||1;const n=this._type===mm?.3:0;this._ambientLightIntensity=(null==e?void 0:e.ambientLightIntensity)||n,this._colorVariation=(null==e?void 0:e.colorVariation)||.5,this._lightGeometry=new vr,this._lightGeometry.deleteAttribute("uv"),this._reflectorLightGeometry=new Nl(.7,.4,2,32),this._reflectorLightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(e){switch(this._type){default:case fm:this._createAllAroundSceneLight(e);break;case mm:this._createFrontSceneLight(e)}}dispose(){const e=new Set;this.traverse((t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))}));for(const t of e)t.dispose()}_createAllAroundSceneLight(e){const t=this._ambientLightIntensity;this.background=new Ci(t,t,t),this._createTopLight(e,6,1);for(let t=0;t<6;t++){const n=t*Math.PI*2/6,i=Math.sin(n),r=Math.cos(n);t%2==0?this._createReflector(e,new Nt(i,r),3,1,.8,.2):this._createSideLight(e,new Nt(i,r),(t-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(e){const t=this._ambientLightIntensity;this.background=new Ci(t,t,t),this._createTopLight(e,6,.7);for(let t=0;t<6;t++){const n=t*Math.PI*2/6,i=Math.sin(n),r=Math.cos(n);if(0===t){this._createReflector(e,new Nt(i,r),1.1,.6,.8,-.4);for(let n=0;n<2;n++){const i=(t-.3+.6*n)*Math.PI*2/6,r=Math.sin(i),a=Math.cos(i);this._createSideLight(e,new Nt(r,a),(t-1)/2,50,1.2,.7,.8)}}else this._createReflector(e,new Nt(i,r),1.1,.7,1.4,0)}}_createAreaLightMaterial(e,t,n){const i=new Ui;return i.color.set(e,null!=t?t:e,null!=n?n:e),i}_createTopLight(e,t,n){const i=new mr(this._lightGeometry,this._createAreaLightMaterial(t*this._topLightIntensity));i.position.set(0,20,0),i.scale.set(5*n,.1,5*n),e.add(i)}_createSideLight(e,t,n,i,r,a,s){for(let o=0;o<3;o++){const l=i*this._sideLightIntensity,c=new mr(this._lightGeometry,this._createAreaLightMaterial((o+n)%3==0?l:l*(1-this._colorVariation),(o+n)%3==1?l:l*(1-this._colorVariation),(o+n)%3==2?l:l*(1-this._colorVariation))),h=(1===o?-t.y:2===o?t.y:0)/Math.sqrt(2),d=0===o?0:1,u=(1===o?t.x:2===o?-t.x:0)/Math.sqrt(2);c.position.set(t.x*s*15+1.1*h*r,15*a+1.1*d*r,t.y*s*15+1.1*u*r),c.rotation.set(0,Math.atan2(t.x,t.y),0),c.scale.setScalar(r),e.add(c)}}_createReflector(e,t,n,i,r,a){const s=new mr(this._reflectorLightGeometry,this._createAreaLightMaterial(n*this._sideReflectorIntensity));s.position.set(15*t.x,10*a,15*t.y),s.scale.set(10*i,10*r,10*i),e.add(s)}}const _m={effectSuspendFrames:0,effectFadeInFrames:0,suspendGroundReflection:!1,shadowOnCameraChange:sf},xm={effectSuspendFrames:5,effectFadeInFrames:5,suspendGroundReflection:!1,shadowOnCameraChange:af},ym={effectSuspendFrames:5,effectFadeInFrames:5,suspendGroundReflection:!0,shadowOnCameraChange:rf},Sm={enabled:!0,aoOnGround:!0,shadowOnGround:!0,aoIntensity:1,shadowIntensity:1,ao:{algorithm:4,samples:16,radius:.5,distanceExponent:2,thickness:1,distanceFallOff:1,scale:1,bias:.01,screenSpaceRadius:!1}},wm={enableGroundBoundary:!1,directionalDependency:1,directionalExponent:1,groundBoundary:1,fadeOutDistance:.2,fadeOutBlur:5},bm=new Map([[tm,Object.assign(Object.assign({},_m),{shAndAoPassParameters:Sm,screenSpaceShadowMapParameters:wm,groundReflectionParameters:{enabled:!0},bakedGroundContactShadowParameters:{enabled:!1}})],[nm,Object.assign(Object.assign({},xm),{shAndAoPassParameters:Sm,screenSpaceShadowMapParameters:wm,groundReflectionParameters:{enabled:!0},bakedGroundContactShadowParameters:{enabled:!1}})],[im,Object.assign(Object.assign({},ym),{shAndAoPassParameters:Sm,screenSpaceShadowMapParameters:wm,groundReflectionParameters:{enabled:!1},bakedGroundContactShadowParameters:{enabled:!1}})],["low",{shAndAoPassParameters:{enabled:!1,aoOnGround:!1,shadowOnGround:!1},groundReflectionParameters:{enabled:!1},bakedGroundContactShadowParameters:{enabled:!0}}]]);class Mm extends mr{constructor(e,t,n,i=128){if(t<=0||n<=0||i<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const r=new kl(n,2*i,i);r.scale(1,1,-1);const a=r.getAttribute("position"),s=new dn;for(let e=0;e{const t=e.materialId;return{materialId:e.materialId,name:t}})),a=Object.assign({},...r.map((e=>({[e.name]:e.materialId}))));this.materialFolder.add(this,"materialId",a).onChange((e=>this.updateMaterialPropertiesUI(e))),this.updateMaterialPropertiesUI(this.materialId)}updateMaterialPropertiesUI(e){var t,n,i,r,a,s,o,l,c,h;if(this.materialId=e,!this.materialFolder)return;this.materialProperties&&(this.materialFolder.removeFolder(this.materialProperties),this.materialProperties=void 0);const d=this.materials.find((t=>t.materialId===e));if(!d)return;const u=d.material;if(!u)return;const p={color:null!==(n=null===(t=u.color)||void 0===t?void 0:t.getHex())&&void 0!==n?n:16777215,specularColor:null!==(r=null===(i=u.color)||void 0===i?void 0:i.getHex())&&void 0!==r?r:16777215,emissive:null!==(s=null===(a=u.emissive)||void 0===a?void 0:a.getHex())&&void 0!==s?s:16777215,sheenColor:null!==(l=null===(o=u.emissive)||void 0===o?void 0:o.getHex())&&void 0!==l?l:16777215,attenuationColor:null!==(h=null===(c=u.emissive)||void 0===c?void 0:c.getHex())&&void 0!==h?h:16777215};let f="properties";d.material.userData&&(d.material.userData.diffuseMap&&(f+=d.material.userData.diffuseMapHasAlpha?" RGBA":" RGB"),d.material.userData.normalMap&&(f+=" XYZ"),d.material.userData.ormMap&&(f+=" ORM")),this.materialProperties=this.materialFolder.addFolder(f),this.materialProperties.addColor(p,"color").onChange(Am.handleColorChange(u.color,!0)),this.materialProperties.add(u,"opacity",0,1).onChange((e=>{const t=e<1;t!==u.transparent&&(u.transparent=t,u.needsUpdate=!0)}));try{this.materialProperties.add(u,"metalness",0,1),this.materialProperties.add(u,"roughness",0,1),this.materialProperties.add(u,"transmission",0,1),this.materialProperties.add(u,"ior",1,2.333),this.materialProperties.add(u,"specularIntensity",0,1),this.materialProperties.addColor(p,"specularColor").onChange(Am.handleColorChange(u.specularColor,!0)),this.materialProperties.add(u,"reflectivity",0,1),this.materialProperties.add(u,"clearcoat",0,1),this.materialProperties.add(u,"clearcoatRoughness",0,1),this.materialProperties.add(u,"sheen",0,1),this.materialProperties.add(u,"sheenRoughness",0,1),this.materialProperties.addColor(p,"sheenColor").onChange(Am.handleColorChange(u.sheenColor,!0)),this.materialProperties.add(u,"emissiveIntensity",0,1),this.materialProperties.addColor(p,"emissive").onChange(Am.handleColorChange(u.emissive,!0)),this.materialProperties.add(u,"attenuationDistance",0,50),this.materialProperties.addColor(p,"attenuationColor").onChange(Am.handleColorChange(u.attenuationColor,!0)),this.materialProperties.add(u,"thickness",0,50)}catch(e){console.log(e)}}static handleColorChange(e,t=!1){return n=>{"string"==typeof n&&(n=n.replace("#","0x")),e.setHex(n),!0===t&&e.convertSRGBToLinear()}}}var Pm=function(){var e=0,t=document.createElement("div");function n(e){return t.appendChild(e.dom),e}function i(n){for(var i=0;i=a+1e3&&(o.update(1e3*s/(e-a),100),a=e,s=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){r=this.end()},domElement:t,setMode:i}};Pm.Panel=function(e,t,n){var i=1/0,r=0,a=Math.round,s=a(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,h=2*s,d=3*s,u=15*s,p=74*s,f=30*s,m=document.createElement("canvas");m.width=o,m.height=l,m.style.cssText="width:80px;height:48px";var g=m.getContext("2d");return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=n,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,c,h),g.fillRect(d,u,p,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d,u,p,f),{dom:m,update:function(l,v){i=Math.min(i,l),r=Math.max(r,l),g.fillStyle=n,g.globalAlpha=1,g.fillRect(0,0,o,u),g.fillStyle=t,g.fillText(a(l)+" "+e+" ("+a(i)+"-"+a(r)+")",c,h),g.drawImage(m,d+s,u,p-s,f,d,u,p-s,f),g.fillRect(d+p-s,u,s,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d+p-s,u,s,a((1-l/v)*f))}}};const Rm=Pm;function Cm(e,t){var n=e.__state.conversionName.toString(),i=Math.round(e.r),r=Math.round(e.g),a=Math.round(e.b),s=e.a,o=Math.round(e.h),l=e.s.toFixed(1),c=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=e.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+a+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+a+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+a+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+a+","+s+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+a+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+a+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+o+",s:"+l+",v:"+c+"}":"HSVA_OBJ"===n?"{h:"+o+",s:"+l+",v:"+c+",a:"+s+"}":"unknown format"}var Lm=Array.prototype.forEach,Dm=Array.prototype.slice,Im={BREAK:{},extend:function(e){return this.each(Dm.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}),this),e},defaults:function(e){return this.each(Dm.call(arguments,1),(function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}),this),e},compose:function(){var e=Dm.call(arguments);return function(){for(var t=Dm.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(Lm&&e.forEach&&e.forEach===Lm)e.forEach(t,n);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r1?Im.toArray(arguments):arguments[0];return Im.each(Um,(function(t){if(t.litmus(e))return Im.each(t.conversions,(function(t,n){if(Om=t.read(e),!1===Nm&&!1!==Om)return Nm=Om,Om.conversionName=n,Om.conversion=t,Im.BREAK})),Im.BREAK})),Nm},Bm=void 0,zm={hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),a=n*(1-t),s=n*(1-r*t),o=n*(1-(1-r)*t),l=[[n,o,a],[s,n,a],[a,n,o],[a,s,n],[o,a,n],[n,a,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i=Math.min(e,t,n),r=Math.max(e,t,n),a=r-i,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=e===r?(t-n)/a:t===r?2+(n-e)/a:4+(e-t)/a,(s/=6)<0&&(s+=1),{h:360*s,s:a/r,v:r/255})},rgb_to_hex:function(e,t,n){var i=this.hex_with_component(0,2,e);return i=this.hex_with_component(i,1,t),this.hex_with_component(i,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(Bm=8*t)|e&~(255<-1?t.length-t.indexOf(".")-1:0}var rg=function(e){function t(e,n,i){Hm(this,t);var r=jm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),a=i||{};return r.__min=a.min,r.__max=a.max,r.__step=a.step,Im.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=ig(r.__impliedStep),r}return Wm(t,e),Vm(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&nthis.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),Gm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=ig(e),this}}]),t}(Zm),ag=function(e){function t(e,n,i){Hm(this,t);var r=jm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));r.__truncationSuspended=!1;var a=r,s=void 0;function o(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function l(e){var t=s-e.clientY;a.setValue(a.getValue()+t*a.__impliedStep),s=e.clientY}function c(){$m.unbind(window,"mousemove",l),$m.unbind(window,"mouseup",c),o()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),$m.bind(r.__input,"change",(function(){var e=parseFloat(a.__input.value);Im.isNaN(e)||a.setValue(e)})),$m.bind(r.__input,"blur",(function(){o()})),$m.bind(r.__input,"mousedown",(function(e){$m.bind(window,"mousemove",l),$m.bind(window,"mouseup",c),s=e.clientY})),$m.bind(r.__input,"keydown",(function(e){13===e.keyCode&&(a.__truncationSuspended=!0,this.blur(),a.__truncationSuspended=!1,o())})),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return Wm(t,e),Vm(t,[{key:"updateDisplay",value:function(){var e,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(e*i)/i),Gm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(rg);function sg(e,t,n,i,r){return i+(e-t)/(n-t)*(r-i)}var og=function(e){function t(e,n,i,r,a){Hm(this,t);var s=jm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:i,max:r,step:a})),o=s;function l(e){e.preventDefault();var t=o.__background.getBoundingClientRect();return o.setValue(sg(e.clientX,t.left,t.right,o.__min,o.__max)),!1}function c(){$m.unbind(window,"mousemove",l),$m.unbind(window,"mouseup",c),o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function h(e){var t=e.touches[0].clientX,n=o.__background.getBoundingClientRect();o.setValue(sg(t,n.left,n.right,o.__min,o.__max))}function d(){$m.unbind(window,"touchmove",h),$m.unbind(window,"touchend",d),o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),$m.bind(s.__background,"mousedown",(function(e){document.activeElement.blur(),$m.bind(window,"mousemove",l),$m.bind(window,"mouseup",c),l(e)})),$m.bind(s.__background,"touchstart",(function(e){1===e.touches.length&&($m.bind(window,"touchmove",h),$m.bind(window,"touchend",d),h(e))})),$m.addClass(s.__background,"slider"),$m.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return Wm(t,e),Vm(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",Gm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(rg),lg=function(e){function t(e,n,i){Hm(this,t);var r=jm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),a=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,$m.bind(r.__button,"click",(function(e){return e.preventDefault(),a.fire(),!1})),$m.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return Wm(t,e),Vm(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(Zm),cg=function(e){function t(e,n){Hm(this,t);var i=jm(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));i.__color=new Xm(i.getValue()),i.__temp=new Xm(0);var r=i;i.domElement=document.createElement("div"),$m.makeSelectable(i.domElement,!1),i.__selector=document.createElement("div"),i.__selector.className="selector",i.__saturation_field=document.createElement("div"),i.__saturation_field.className="saturation-field",i.__field_knob=document.createElement("div"),i.__field_knob.className="field-knob",i.__field_knob_border="2px solid ",i.__hue_knob=document.createElement("div"),i.__hue_knob.className="hue-knob",i.__hue_field=document.createElement("div"),i.__hue_field.className="hue-field",i.__input=document.createElement("input"),i.__input.type="text",i.__input_textShadow="0 1px 1px ",$m.bind(i.__input,"keydown",(function(e){13===e.keyCode&&d.call(this)})),$m.bind(i.__input,"blur",d),$m.bind(i.__selector,"mousedown",(function(){$m.addClass(this,"drag").bind(window,"mouseup",(function(){$m.removeClass(r.__selector,"drag")}))})),$m.bind(i.__selector,"touchstart",(function(){$m.addClass(this,"drag").bind(window,"touchend",(function(){$m.removeClass(r.__selector,"drag")}))}));var a,s=document.createElement("div");function o(e){p(e),$m.bind(window,"mousemove",p),$m.bind(window,"touchmove",p),$m.bind(window,"mouseup",c),$m.bind(window,"touchend",c)}function l(e){f(e),$m.bind(window,"mousemove",f),$m.bind(window,"touchmove",f),$m.bind(window,"mouseup",h),$m.bind(window,"touchend",h)}function c(){$m.unbind(window,"mousemove",p),$m.unbind(window,"touchmove",p),$m.unbind(window,"mouseup",c),$m.unbind(window,"touchend",c),u()}function h(){$m.unbind(window,"mousemove",f),$m.unbind(window,"touchmove",f),$m.unbind(window,"mouseup",h),$m.unbind(window,"touchend",h),u()}function d(){var e=Fm(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function u(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function p(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,i=n.clientX,a=n.clientY,s=(i-t.left)/(t.right-t.left),o=1-(a-t.top)/(t.bottom-t.top);return o>1?o=1:o<0&&(o=0),s>1?s=1:s<0&&(s=0),r.__color.v=o,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return Im.extend(i.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Im.extend(i.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:i.__field_knob_border+(i.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Im.extend(i.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Im.extend(i.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Im.extend(s.style,{width:"100%",height:"100%",background:"none"}),dg(s,"top","rgba(0,0,0,0)","#000"),Im.extend(i.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(a=i.__hue_field).style.background="",a.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",a.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",a.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Im.extend(i.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:i.__input_textShadow+"rgba(0,0,0,0.7)"}),$m.bind(i.__saturation_field,"mousedown",o),$m.bind(i.__saturation_field,"touchstart",o),$m.bind(i.__field_knob,"mousedown",o),$m.bind(i.__field_knob,"touchstart",o),$m.bind(i.__hue_field,"mousedown",l),$m.bind(i.__hue_field,"touchstart",l),i.__saturation_field.appendChild(s),i.__selector.appendChild(i.__field_knob),i.__selector.appendChild(i.__saturation_field),i.__selector.appendChild(i.__hue_field),i.__hue_field.appendChild(i.__hue_knob),i.domElement.appendChild(i.__input),i.domElement.appendChild(i.__selector),i.updateDisplay(),i}return Wm(t,e),Vm(t,[{key:"updateDisplay",value:function(){var e=Fm(this.getValue());if(!1!==e){var t=!1;Im.each(Xm.COMPONENTS,(function(n){if(!Im.isUndefined(e[n])&&!Im.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&Im.extend(this.__color.__state,e)}Im.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;Im.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,dg(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Im.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),t}(Zm),hg=["-moz-","-o-","-webkit-","-ms-",""];function dg(e,t,n,i){e.style.background="",Im.each(hg,(function(r){e.style.cssText+="background: "+r+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "}))}var ug=function(e,t){var n=e[t];return Im.isArray(arguments[2])||Im.isObject(arguments[2])?new tg(e,t,arguments[2]):Im.isNumber(n)?Im.isNumber(arguments[2])&&Im.isNumber(arguments[3])?Im.isNumber(arguments[4])?new og(e,t,arguments[2],arguments[3],arguments[4]):new og(e,t,arguments[2],arguments[3]):Im.isNumber(arguments[4])?new ag(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new ag(e,t,{min:arguments[2],max:arguments[3]}):Im.isString(n)?new ng(e,t):Im.isFunction(n)?new lg(e,t,""):Im.isBoolean(n)?new eg(e,t):null},pg=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},fg=function(){function e(){Hm(this,e),this.backgroundElement=document.createElement("div"),Im.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),$m.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Im.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;$m.bind(this.backgroundElement,"click",(function(){t.hide()}))}return Vm(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),Im.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",$m.unbind(e.domElement,"webkitTransitionEnd",t),$m.unbind(e.domElement,"transitionend",t),$m.unbind(e.domElement,"oTransitionEnd",t)};$m.bind(this.domElement,"webkitTransitionEnd",t),$m.bind(this.domElement,"transitionend",t),$m.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-$m.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-$m.getHeight(this.domElement)/2+"px"}}]),e}();!function(e,t){var n=t||document,i=document.createElement("style");i.type="text/css",i.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(e){}}(function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));var mg="Default",gg=function(){try{return!!window.localStorage}catch(e){return!1}}(),vg=void 0,_g=!0,xg=void 0,yg=!1,Sg=[],wg=function e(t){var n=this,i=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),$m.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=Im.defaults(i,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),i=Im.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),Im.isUndefined(i.load)?i.load={preset:mg}:i.preset&&(i.load.preset=i.preset),Im.isUndefined(i.parent)&&i.hideable&&Sg.push(this),i.resizable=Im.isUndefined(i.parent)&&i.resizable,i.autoPlace&&Im.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,a=gg&&"true"===localStorage.getItem(Pg(0,"isLocal")),s=void 0,o=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(e){n.parent?n.getRoot().preset=e:i.load.preset=e,function(e){for(var t=0;t1){var i=n.__li.nextElementSibling;return n.remove(),Ag(e,n.object,n.property,{before:i,factoryArgs:[Im.toArray(arguments)]})}if(Im.isArray(t)||Im.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),Ag(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof og){var i=new ag(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});Im.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],r=i[e];n[e]=i[e]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(i,e),t.apply(n,e)}})),$m.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof ag){var r=function(t){if(Im.isNumber(n.__min)&&Im.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var a=Ag(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return a.name(i),r&&a.listen(),a}return t};n.min=Im.compose(r,n.min),n.max=Im.compose(r,n.max)}else n instanceof eg?($m.bind(t,"click",(function(){$m.fakeEvent(n.__checkbox,"click")})),$m.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof lg?($m.bind(t,"click",(function(){$m.fakeEvent(n.__button,"click")})),$m.bind(t,"mouseover",(function(){$m.addClass(n.__button,"hover")})),$m.bind(t,"mouseout",(function(){$m.removeClass(n.__button,"hover")}))):n instanceof cg&&($m.addClass(t,"color"),n.updateDisplay=Im.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=Im.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&Tg(e.getRoot(),!0),t}),n.setValue)}(e,l,r),e.__controllers.push(r),r}function Pg(e,t){return document.location.href+"."+t}function Rg(e,t,n){var i=document.createElement("option");i.innerHTML=t,i.value=t,e.__preset_select.appendChild(i),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function Cg(e,t){t.style.display=e.useLocalStorage?"block":"none"}function Lg(e){var t=void 0;function n(n){return n.preventDefault(),e.width+=t-n.clientX,e.onResize(),t=n.clientX,!1}function i(){$m.removeClass(e.__closeButton,wg.CLASS_DRAG),$m.unbind(window,"mousemove",n),$m.unbind(window,"mouseup",i)}function r(r){return r.preventDefault(),t=r.clientX,$m.addClass(e.__closeButton,wg.CLASS_DRAG),$m.bind(window,"mousemove",n),$m.bind(window,"mouseup",i),!1}e.__resize_handle=document.createElement("div"),Im.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),$m.bind(e.__resize_handle,"mousedown",r),$m.bind(e.__closeButton,"mousedown",r),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function Dg(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function Ig(e,t){var n={};return Im.each(e.__rememberedObjects,(function(i,r){var a={},s=e.__rememberedObjectIndecesToControllers[r];Im.each(s,(function(e,n){a[n]=t?e.initialValue:e.getValue()})),n[r]=a})),n}function Ug(e){0!==e.length&&pg.call(window,(function(){Ug(e)})),Im.each(e,(function(e){e.updateDisplay()}))}wg.toggleHide=function(){yg=!yg,Im.each(Sg,(function(e){e.domElement.style.display=yg?"none":""}))},wg.CLASS_AUTO_PLACE="a",wg.CLASS_AUTO_PLACE_CONTAINER="ac",wg.CLASS_MAIN="main",wg.CLASS_CONTROLLER_ROW="cr",wg.CLASS_TOO_TALL="taller-than-window",wg.CLASS_CLOSED="closed",wg.CLASS_CLOSE_BUTTON="close-button",wg.CLASS_CLOSE_TOP="close-top",wg.CLASS_CLOSE_BOTTOM="close-bottom",wg.CLASS_DRAG="drag",wg.DEFAULT_WIDTH=245,wg.TEXT_CLOSED="Close Controls",wg.TEXT_OPEN="Open Controls",wg._keydownHandler=function(e){"text"===document.activeElement.type||72!==e.which&&72!==e.keyCode||wg.toggleHide()},$m.bind(window,"keydown",wg._keydownHandler,!1),Im.extend(wg.prototype,{add:function(e,t){return Ag(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return Ag(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;Im.defer((function(){t.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&xg.removeChild(this.domElement);var e=this;Im.each(this.__folders,(function(t){e.removeFolder(t)})),$m.unbind(window,"keydown",wg._keydownHandler,!1),Mg(this)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new wg(t);this.__folders[e]=n;var i=bg(this,n.domElement);return $m.addClass(i,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],Mg(e);var t=this;Im.each(e.__folders,(function(t){e.removeFolder(t)})),Im.defer((function(){t.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=$m.getOffset(e.__ul).top,n=0;Im.each(e.__ul.childNodes,(function(t){e.autoPlace&&t===e.__save_row||(n+=$m.getHeight(t))})),window.innerHeight-t-20GUI\'s constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI\'s constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n\n
\n\n
\n\n'),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;Im.each(Array.prototype.slice.call(arguments),(function(t){0===e.__rememberedObjects.length&&function(e){var t=e.__save_row=document.createElement("li");$m.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),$m.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",$m.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",$m.addClass(i,"button"),$m.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",$m.addClass(r,"button"),$m.addClass(r,"save-as");var a=document.createElement("span");a.innerHTML="Revert",$m.addClass(a,"button"),$m.addClass(a,"revert");var s=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?Im.each(e.load.remembered,(function(t,n){Rg(e,n,n===e.preset)})):Rg(e,mg,!1),$m.bind(s,"change",(function(){for(var t=0;t0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=Ig(this)),e.folders={},Im.each(this.__folders,(function(t,n){e.folders[n]=t.getSaveObject()})),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=Ig(this),Tg(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[mg]=Ig(this,!0)),this.load.remembered[e]=Ig(this),this.preset=e,Rg(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){Im.each(this.__controllers,(function(t){this.getRoot().load.remembered?Eg(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),Im.each(this.__folders,(function(e){e.revert(e)})),e||Tg(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&Ug(this.__listening)},updateDisplay:function(){Im.each(this.__controllers,(function(e){e.updateDisplay()})),Im.each(this.__folders,(function(e){e.updateDisplay()}))}});var Og=wg;const Ng=(()=>{const e=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(e)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(e)?"mobile":"desktop"})();console.log(Ng);const Fg="mobile"===Ng,Bg={},zg=(e,t="#000000")=>{console.log(`Status information: ${e}`);const n=document.getElementById("status-line");n&&(n.innerText=e,n.style.setProperty("color",t))},kg=e=>{const t=qg.collectMaterials();av.updateMaterialUI(Zg,t),zg(`${e}`),Yg.sceneName=e.replace(/:/g,"_")},Hg=(e,t)=>{return n=void 0,i=void 0,a=function*(){let n=Bg[t];n||(yield qg.loadResource(e+".glb",t,(e=>{}),((e,n)=>{n?(Bg[t]={scene:n,glb:!0},kg(e)):zg(`load ${e}`,"#ff0000")})),n=Bg[t]),zg(`render ${t}`,"#ff0000"),qg.update(void 0,n.scene,n.glb),kg(t)},new((r=void 0)||(r=Promise))((function(e,t){function s(e){try{l(a.next(e))}catch(e){t(e)}}function o(e){try{l(a.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,o)}l((a=a.apply(n,i||[])).next())}));var n,i,r,a},Vg=()=>{let e=Ih;switch(Yg.groundMaterial.toLocaleLowerCase()){default:e=Ih;break;case"parquet":e=Uh;break;case"pavement":e=Oh}qg.setGroundMaterial(e)},Gg=document.getElementById("container"),Wg=new class{constructor(e={}){const{canvas:t=Ht(),context:i=null,depth:r=!0,stencil:a=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=e;let u;if(this.isWebGLRenderer=!0,null!==i){if("undefined"!=typeof WebGLRenderingContext&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");u=i.getContextAttributes().alpha}else u=s;const p=new Uint32Array(4),f=new Int32Array(4);let m=null,g=null;const v=[],_=[];this.domElement=t,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._outputColorSpace=it,this.toneMapping=C,this.toneMappingExposure=1;const x=this;let y=!1,S=0,w=0,b=null,M=-1,T=null;const E=new an,A=new an;let P=null;const R=new Ci(0);let L=0,D=t.width,I=t.height,U=1,O=null,N=null;const F=new an(0,0,D,I),B=new an(0,0,D,I);let z=!1;const k=new Br;let H=!1,V=!1;const G=new Hn,W=new dn,j=new an,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Y=!1;function q(){return null===b?U:1}let Z,Q,$,te,ie,le,ce,he,de,ue,pe,fe,me,ge,_e,Se,we,be,Me,Te,Ee,Ae,Pe,Re,Ce=i;function Le(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:r,stencil:a,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${n}`),t.addEventListener("webglcontextlost",Ue,!1),t.addEventListener("webglcontextrestored",Oe,!1),t.addEventListener("webglcontextcreationerror",Ne,!1),null===Ce){const t="webgl2";if(Ce=Le(t,e),null===Ce)throw Le(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function De(){Z=new va(Ce),Z.init(),Ae=new go(Ce,Z),Q=new Jr(Ce,Z,e,Ae),$=new po(Ce),te=new ya(Ce),ie=new Qs,le=new mo(Ce,Z,$,ie,Q,Ae,te),ce=new $r(x),he=new ga(x),de=new kr(Ce),Pe=new Zr(Ce,de),ue=new _a(Ce,de,te,Pe),pe=new wa(Ce,ue,de,te),Me=new Sa(Ce,Q,le),Se=new Qr(ie),fe=new Js(x,ce,he,Z,Q,Pe,Se),me=new To(x,ie),ge=new no,_e=new lo(Z),be=new qr(x,ce,he,$,pe,u,l),we=new uo(x,pe,Q),Re=new Eo(Ce,te,Q,$),Te=new Kr(Ce,Z,te),Ee=new xa(Ce,Z,te),te.programs=fe.programs,x.capabilities=Q,x.extensions=Z,x.properties=ie,x.renderLists=ge,x.shadowMap=we,x.state=$,x.info=te}De();const Ie=new wo(x,Ce);function Ue(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function Oe(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const e=te.autoReset,t=we.enabled,n=we.autoUpdate,i=we.needsUpdate,r=we.type;De(),te.autoReset=e,we.enabled=t,we.autoUpdate=n,we.needsUpdate=i,we.type=r}function Ne(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Fe(e){const t=e.target;t.removeEventListener("dispose",Fe),function(e){(function(e){const t=ie.get(e).programs;void 0!==t&&(t.forEach((function(e){fe.releaseProgram(e)})),e.isShaderMaterial&&fe.releaseShaderCache(e))})(e),ie.remove(e)}(t)}function Be(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,qe(e,t,n),e.side=0,e.needsUpdate=!0,qe(e,t,n),e.side=2):qe(e,t,n)}this.xr=Ie,this.getContext=function(){return Ce},this.getContextAttributes=function(){return Ce.getContextAttributes()},this.forceContextLoss=function(){const e=Z.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=Z.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return U},this.setPixelRatio=function(e){void 0!==e&&(U=e,this.setSize(D,I,!1))},this.getSize=function(e){return e.set(D,I)},this.setSize=function(e,n,i=!0){Ie.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(D=e,I=n,t.width=Math.floor(e*U),t.height=Math.floor(n*U),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(D*U,I*U).floor()},this.setDrawingBufferSize=function(e,n,i){D=e,I=n,U=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(F)},this.setViewport=function(e,t,n,i){e.isVector4?F.set(e.x,e.y,e.z,e.w):F.set(e,t,n,i),$.viewport(E.copy(F).multiplyScalar(U).round())},this.getScissor=function(e){return e.copy(B)},this.setScissor=function(e,t,n,i){e.isVector4?B.set(e.x,e.y,e.z,e.w):B.set(e,t,n,i),$.scissor(A.copy(B).multiplyScalar(U).round())},this.getScissorTest=function(){return z},this.setScissorTest=function(e){$.setScissorTest(z=e)},this.setOpaqueSort=function(e){O=e},this.setTransparentSort=function(e){N=e},this.getClearColor=function(e){return e.copy(be.getClearColor())},this.setClearColor=function(){be.setClearColor.apply(be,arguments)},this.getClearAlpha=function(){return be.getClearAlpha()},this.setClearAlpha=function(){be.setClearAlpha.apply(be,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==b){const t=b.texture.format;e=t===ye||t===xe||t===ve}if(e){const e=b.texture.type,t=e===J||e===ne||e===ee||e===oe||e===ae||e===se,n=be.getClearColor(),i=be.getClearAlpha(),r=n.r,a=n.g,s=n.b;t?(p[0]=r,p[1]=a,p[2]=s,p[3]=i,Ce.clearBufferuiv(Ce.COLOR,0,p)):(f[0]=r,f[1]=a,f[2]=s,f[3]=i,Ce.clearBufferiv(Ce.COLOR,0,f))}else i|=Ce.COLOR_BUFFER_BIT}t&&(i|=Ce.DEPTH_BUFFER_BIT),n&&(i|=Ce.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Ce.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ue,!1),t.removeEventListener("webglcontextrestored",Oe,!1),t.removeEventListener("webglcontextcreationerror",Ne,!1),ge.dispose(),_e.dispose(),ie.dispose(),ce.dispose(),he.dispose(),pe.dispose(),Pe.dispose(),Re.dispose(),fe.dispose(),Ie.dispose(),Ie.removeEventListener("sessionstart",ke),Ie.removeEventListener("sessionend",He),Ve.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=X);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=function(e,t,n,i,r){!0!==t.isScene&&(t=X),le.resetTextureUnits();const a=t.fog,s=i.isMeshStandardMaterial?t.environment:null,o=null===b?x.outputColorSpace:!0===b.isXRRenderTarget?b.texture.colorSpace:rt,l=(i.isMeshStandardMaterial?he:ce).get(i.envMap||s),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),d=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let f=C;i.toneMapped&&(null!==b&&!0!==b.isXRRenderTarget||(f=x.toneMapping));const m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==m?m.length:0,_=ie.get(i),y=g.state.lights;if(!0===H&&(!0===V||e!==T)){const t=e===T&&i.id===M;Se.setState(i,e,t)}let S=!1;i.version===_.__version?_.needsLights&&_.lightsStateVersion!==y.state.version||_.outputColorSpace!==o||r.isBatchedMesh&&!1===_.batching?S=!0:r.isBatchedMesh||!0!==_.batching?r.isBatchedMesh&&!0===_.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===_.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===_.instancing?S=!0:r.isInstancedMesh||!0!==_.instancing?r.isSkinnedMesh&&!1===_.skinning?S=!0:r.isSkinnedMesh||!0!==_.skinning?r.isInstancedMesh&&!0===_.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===_.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===_.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===_.instancingMorph&&null!==r.morphTexture||_.envMap!==l||!0===i.fog&&_.fog!==a?S=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===Se.numPlanes&&_.numIntersection===Se.numIntersection?(_.vertexAlphas!==c||_.vertexTangents!==h||_.morphTargets!==d||_.morphNormals!==u||_.morphColors!==p||_.toneMapping!==f||_.morphTargetsCount!==v)&&(S=!0):S=!0:S=!0:S=!0:S=!0:(S=!0,_.__version=i.version);let w=_.currentProgram;!0===S&&(w=qe(i,t,r));let E=!1,A=!1,P=!1;const R=w.getUniforms(),L=_.uniforms;if($.useProgram(w.program)&&(E=!0,A=!0,P=!0),i.id!==M&&(M=i.id,A=!0),E||T!==e){R.setValue(Ce,"projectionMatrix",e.projectionMatrix),R.setValue(Ce,"viewMatrix",e.matrixWorldInverse);const t=R.map.cameraPosition;void 0!==t&&t.setValue(Ce,W.setFromMatrixPosition(e.matrixWorld)),Q.logarithmicDepthBuffer&&R.setValue(Ce,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&R.setValue(Ce,"isOrthographic",!0===e.isOrthographicCamera),T!==e&&(T=e,A=!0,P=!0)}if(r.isSkinnedMesh){R.setOptional(Ce,r,"bindMatrix"),R.setOptional(Ce,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),R.setValue(Ce,"boneTexture",e.boneTexture,le))}r.isBatchedMesh&&(R.setOptional(Ce,r,"batchingTexture"),R.setValue(Ce,"batchingTexture",r._matricesTexture,le),R.setOptional(Ce,r,"batchingIdTexture"),R.setValue(Ce,"batchingIdTexture",r._indirectTexture,le),R.setOptional(Ce,r,"batchingColorTexture"),null!==r._colorsTexture&&R.setValue(Ce,"batchingColorTexture",r._colorsTexture,le));const D=n.morphAttributes;var O,N;if(void 0===D.position&&void 0===D.normal&&void 0===D.color||Me.update(r,n,w),(A||_.receiveShadow!==r.receiveShadow)&&(_.receiveShadow=r.receiveShadow,R.setValue(Ce,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(L.envMap.value=l,L.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(L.envMapIntensity.value=t.environmentIntensity),A&&(R.setValue(Ce,"toneMappingExposure",x.toneMappingExposure),_.needsLights&&(N=P,(O=L).ambientLightColor.needsUpdate=N,O.lightProbe.needsUpdate=N,O.directionalLights.needsUpdate=N,O.directionalLightShadows.needsUpdate=N,O.pointLights.needsUpdate=N,O.pointLightShadows.needsUpdate=N,O.spotLights.needsUpdate=N,O.spotLightShadows.needsUpdate=N,O.rectAreaLights.needsUpdate=N,O.hemisphereLights.needsUpdate=N),a&&!0===i.fog&&me.refreshFogUniforms(L,a),me.refreshMaterialUniforms(L,i,U,I,g.state.transmissionRenderTarget[e.id]),Ps.upload(Ce,Ze(_),L,le)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Ps.upload(Ce,Ze(_),L,le),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&R.setValue(Ce,"center",r.center),R.setValue(Ce,"modelViewMatrix",r.modelViewMatrix),R.setValue(Ce,"normalMatrix",r.normalMatrix),R.setValue(Ce,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t{function n(){i.forEach((function(e){ie.get(e).currentProgram.isReady()&&i.delete(e)})),0!==i.size?setTimeout(n,10):t(e)}null!==Z.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let ze=null;function ke(){Ve.stop()}function He(){Ve.start()}const Ve=new zr;function Ge(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||k.intersectsSprite(e)){i&&j.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=pe.update(e),r=e.material;r.visible&&m.push(e,t,r,n,j.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||k.intersectsObject(e))){const t=pe.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),j.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),j.copy(t.boundingSphere.center)),j.applyMatrix4(e.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const i=t.groups;for(let a=0,s=i.length;a0&&Xe(r,t,n),a.length>0&&Xe(a,t,n),s.length>0&&Xe(s,t,n),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function je(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===g.state.transmissionRenderTarget[i.id]&&(g.state.transmissionRenderTarget[i.id]=new on(1,1,{generateMipmaps:!0,type:Z.has("EXT_color_buffer_half_float")||Z.has("EXT_color_buffer_float")?re:J,minFilter:K,samples:4,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:qt.workingColorSpace}));const r=g.state.transmissionRenderTarget[i.id],s=i.viewport||E;r.setSize(s.z,s.w);const o=x.getRenderTarget();x.setRenderTarget(r),x.getClearColor(R),L=x.getClearAlpha(),L<1&&x.setClearColor(16777215,.5),x.clear(),Y&&be.render(n);const l=x.toneMapping;x.toneMapping=C;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),g.setupLightsView(i),!0===H&&Se.setGlobalState(x.clippingPlanes,i),Xe(e,n,i),le.updateMultisampleRenderTarget(r),le.updateRenderTargetMipmap(r),!1===Z.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r0)for(let t=0,a=n.length;t0&&je(i,r,e,t),Y&&be.render(e),We(m,e,t);null!==b&&(le.updateMultisampleRenderTarget(b),le.updateRenderTargetMipmap(b)),!0===e.isScene&&e.onAfterRender(x,e,t),Pe.resetDefaultState(),M=-1,T=null,_.pop(),_.length>0?(g=_[_.length-1],!0===H&&Se.setGlobalState(x.clippingPlanes,g.state.camera)):g=null,v.pop(),m=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(e,t,n){ie.get(e.texture).__webglTexture=t,ie.get(e.depthTexture).__webglTexture=n;const i=ie.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===Z.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){const n=ie.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){b=e,S=t,w=n;let i=!0,r=null,a=!1,s=!1;if(e){const o=ie.get(e);void 0!==o.__useDefaultFramebuffer?($.bindFramebuffer(Ce.FRAMEBUFFER,null),i=!1):void 0===o.__webglFramebuffer?le.setupRenderTarget(e):o.__hasExternalTextures&&le.rebindTextures(e,ie.get(e.texture).__webglTexture,ie.get(e.depthTexture).__webglTexture);const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(s=!0);const c=ie.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],a=!0):r=e.samples>0&&!1===le.useMultisampledRTT(e)?ie.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,E.copy(e.viewport),A.copy(e.scissor),P=e.scissorTest}else E.copy(F).multiplyScalar(U).floor(),A.copy(B).multiplyScalar(U).floor(),P=z;if($.bindFramebuffer(Ce.FRAMEBUFFER,r)&&i&&$.drawBuffers(e,r),$.viewport(E),$.scissor(A),$.setScissorTest(P),a){const i=ie.get(e.texture);Ce.framebufferTexture2D(Ce.FRAMEBUFFER,Ce.COLOR_ATTACHMENT0,Ce.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(s){const i=ie.get(e.texture),r=t||0;Ce.framebufferTextureLayer(Ce.FRAMEBUFFER,Ce.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}M=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,s){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ie.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){$.bindFramebuffer(Ce.FRAMEBUFFER,o);try{const s=e.texture,o=s.format,l=s.type;if(!Q.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!Q.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Ce.readPixels(t,n,i,r,Ae.convert(o),Ae.convert(l),a)}finally{const e=null!==b?ie.get(b).__webglFramebuffer:null;$.bindFramebuffer(Ce.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,s){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ie.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){$.bindFramebuffer(Ce.FRAMEBUFFER,o);try{const s=e.texture,o=s.format,l=s.type;if(!Q.textureFormatReadable(o))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Q.textureTypeReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){const e=Ce.createBuffer();Ce.bindBuffer(Ce.PIXEL_PACK_BUFFER,e),Ce.bufferData(Ce.PIXEL_PACK_BUFFER,a.byteLength,Ce.STREAM_READ),Ce.readPixels(t,n,i,r,Ae.convert(o),Ae.convert(l),0),Ce.flush();const s=Ce.fenceSync(Ce.SYNC_GPU_COMMANDS_COMPLETE,0);await function(e,t){return new Promise((function(n,i){setTimeout((function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}}),4)}))}(Ce,s);try{Ce.bindBuffer(Ce.PIXEL_PACK_BUFFER,e),Ce.getBufferSubData(Ce.PIXEL_PACK_BUFFER,0,a)}finally{Ce.deleteBuffer(e),Ce.deleteSync(s)}return a}}finally{const e=null!==b?ie.get(b).__webglFramebuffer:null;$.bindFramebuffer(Ce.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(Gt("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),s=null!==t?t.x:0,o=null!==t?t.y:0;le.setTexture2D(e,0),Ce.copyTexSubImage2D(Ce.TEXTURE_2D,n,0,0,s,o,r,a),$.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,i=null,r=0){let a,s,o,l,c,h;!0!==e.isTexture&&(Gt("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],r=arguments[3]||0,n=null),null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.min.x,l=n.min.y):(a=e.image.width,s=e.image.height,o=0,l=0),null!==i?(c=i.x,h=i.y):(c=0,h=0);const d=Ae.convert(t.format),u=Ae.convert(t.type);le.setTexture2D(t,0),Ce.pixelStorei(Ce.UNPACK_FLIP_Y_WEBGL,t.flipY),Ce.pixelStorei(Ce.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Ce.pixelStorei(Ce.UNPACK_ALIGNMENT,t.unpackAlignment);const p=Ce.getParameter(Ce.UNPACK_ROW_LENGTH),f=Ce.getParameter(Ce.UNPACK_IMAGE_HEIGHT),m=Ce.getParameter(Ce.UNPACK_SKIP_PIXELS),g=Ce.getParameter(Ce.UNPACK_SKIP_ROWS),v=Ce.getParameter(Ce.UNPACK_SKIP_IMAGES),_=e.isCompressedTexture?e.mipmaps[r]:e.image;Ce.pixelStorei(Ce.UNPACK_ROW_LENGTH,_.width),Ce.pixelStorei(Ce.UNPACK_IMAGE_HEIGHT,_.height),Ce.pixelStorei(Ce.UNPACK_SKIP_PIXELS,o),Ce.pixelStorei(Ce.UNPACK_SKIP_ROWS,l),e.isDataTexture?Ce.texSubImage2D(Ce.TEXTURE_2D,r,c,h,a,s,d,u,_.data):e.isCompressedTexture?Ce.compressedTexSubImage2D(Ce.TEXTURE_2D,r,c,h,_.width,_.height,d,_.data):Ce.texSubImage2D(Ce.TEXTURE_2D,r,c,h,a,s,d,u,_),Ce.pixelStorei(Ce.UNPACK_ROW_LENGTH,p),Ce.pixelStorei(Ce.UNPACK_IMAGE_HEIGHT,f),Ce.pixelStorei(Ce.UNPACK_SKIP_PIXELS,m),Ce.pixelStorei(Ce.UNPACK_SKIP_ROWS,g),Ce.pixelStorei(Ce.UNPACK_SKIP_IMAGES,v),0===r&&t.generateMipmaps&&Ce.generateMipmap(Ce.TEXTURE_2D),$.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){let a,s,o,l,c,h,d,u,p;!0!==e.isTexture&&(Gt("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0);const f=e.isCompressedTexture?e.mipmaps[r]:e.image;null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.max.z-n.min.z,l=n.min.x,c=n.min.y,h=n.min.z):(a=f.width,s=f.height,o=f.depth,l=0,c=0,h=0),null!==i?(d=i.x,u=i.y,p=i.z):(d=0,u=0,p=0);const m=Ae.convert(t.format),g=Ae.convert(t.type);let v;if(t.isData3DTexture)le.setTexture3D(t,0),v=Ce.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");le.setTexture2DArray(t,0),v=Ce.TEXTURE_2D_ARRAY}Ce.pixelStorei(Ce.UNPACK_FLIP_Y_WEBGL,t.flipY),Ce.pixelStorei(Ce.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Ce.pixelStorei(Ce.UNPACK_ALIGNMENT,t.unpackAlignment);const _=Ce.getParameter(Ce.UNPACK_ROW_LENGTH),x=Ce.getParameter(Ce.UNPACK_IMAGE_HEIGHT),y=Ce.getParameter(Ce.UNPACK_SKIP_PIXELS),S=Ce.getParameter(Ce.UNPACK_SKIP_ROWS),w=Ce.getParameter(Ce.UNPACK_SKIP_IMAGES);Ce.pixelStorei(Ce.UNPACK_ROW_LENGTH,f.width),Ce.pixelStorei(Ce.UNPACK_IMAGE_HEIGHT,f.height),Ce.pixelStorei(Ce.UNPACK_SKIP_PIXELS,l),Ce.pixelStorei(Ce.UNPACK_SKIP_ROWS,c),Ce.pixelStorei(Ce.UNPACK_SKIP_IMAGES,h),e.isDataTexture||e.isData3DTexture?Ce.texSubImage3D(v,r,d,u,p,a,s,o,m,g,f.data):t.isCompressedArrayTexture?Ce.compressedTexSubImage3D(v,r,d,u,p,a,s,o,m,f.data):Ce.texSubImage3D(v,r,d,u,p,a,s,o,m,g,f),Ce.pixelStorei(Ce.UNPACK_ROW_LENGTH,_),Ce.pixelStorei(Ce.UNPACK_IMAGE_HEIGHT,x),Ce.pixelStorei(Ce.UNPACK_SKIP_PIXELS,y),Ce.pixelStorei(Ce.UNPACK_SKIP_ROWS,S),Ce.pixelStorei(Ce.UNPACK_SKIP_IMAGES,w),0===r&&t.generateMipmaps&&Ce.generateMipmap(v),$.unbindTexture()},this.initRenderTarget=function(e){void 0===ie.get(e).__webglFramebuffer&&le.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?le.setTextureCube(e,0):e.isData3DTexture?le.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?le.setTexture2DArray(e,0):le.setTexture2D(e,0),$.unbindTexture()},this.resetState=function(){S=0,w=0,b=null,$.reset(),Pe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return wt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===at?"display-p3":"srgb",t.unpackColorSpace=qt.workingColorSpace===st?"display-p3":"srgb"}}({antialias:!Fg,alpha:!0,preserveDrawingBuffer:!0});Wg.setPixelRatio(window.devicePixelRatio),Wg.setSize(window.innerWidth,window.innerHeight),Gg.appendChild(Wg.domElement);const jg=new class{constructor(e={}){const t=this;let n,i,r,a;const s={objects:new WeakMap},o=void 0!==e.element?e.element:document.createElement("div");function l(e){e.isCSS2DObject&&(e.element.style.display="none");for(let t=0,n=e.children.length;t=-1&&sm.z<=1&&!0===e.layers.test(i.layers),c=e.element;c.style.display=!0===l?"":"none",!0===l&&(e.onBeforeRender(t,n,i),c.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(sm.x*r+r)+"px,"+(-sm.y*a+a)+"px)",c.parentNode!==o&&o.appendChild(c),e.onAfterRender(t,n,i));const u={distanceToCameraSquared:(h=i,d=e,cm.setFromMatrixPosition(h.matrixWorld),hm.setFromMatrixPosition(d.matrixWorld),cm.distanceToSquared(hm))};s.objects.set(e,u)}for(let t=0,r=e.children.length;t{const t=new Uint8Array(1048576);for(let e=0;e{this.skyEnvironment.changeVisibility(!1),this.backgroundEnvironment.hideBackground(),this.showEnvironment=!0},r=e.toLowerCase();if(r.endsWith(".exr"))this.environmentLoader.loadExr(e,t,!0),n();else if(r.endsWith(".hdr"))this.environmentLoader.loadHdr(e,t,!0),n();else if(r.endsWith(".envmap"))this.environmentLoader.loadEnvmap(e,t,!0),n();else if(r.endsWith(".glb")||r.endsWith(".gltf")){i(e,null);const n=yield this.loadGLTF(t);i(e,n)}}catch(e){console.log(e)}}))}createControls(){var e;null!==(e=this.controls)&&void 0!==e||(this.controls=new Fp(this.renderer,this.camera))}changeLightControls(e){var t;e&&!this.transformControls&&(this.transformControls=null===(t=this.controls)||void 0===t?void 0:t.addTransformControl(this.lightSources.getLightSources()[0],this.scene)),this.transformControls&&(this.transformControls.visible=e)}setEnvironment(){this.environmentLoader.loadDefaultEnvironment(!0,(()=>new gm({type:fm})),"room environment"),this.environmentLoader.loadDefaultEnvironment(!1,(()=>new gm({type:mm})),"front light environment"),this.environmentLoader.loadEnvmap("test64.envmap",Tm,!1)}updateSceneDependencies(){this.sceneRenderer.bakedGroundContactShadowPass.needsUpdate=!0,this.updateBounds()}updateBounds(){this.sceneRenderer.updateBounds(this.sceneBounds,this.scaleShadowAndAo)}setGroundMaterial(e){this.groundMaterialType!==e&&(this.groundMaterialType=e,this.updateGround(void 0,Fh(this.groundMaterialType)),this.sceneRenderer.clearCache())}updateGround(e,t){this.groundMesh||(this.groundMesh=new mr,this.groundMesh.name="groundMesh",this.groundMesh.userData.isFloor=!0,this.groundMesh.receiveShadow=!0,this.sceneRenderer.groundGroup.add(this.groundMesh)),e&&(this.groundMesh.geometry=e),t&&(t.depthWrite=!1,t.polygonOffset=!0,t.polygonOffsetFactor=4,t.polygonOffsetUnits=4,t.needsUpdate=!0,this.groundMesh.material=t,this.groundMesh.userData.isFloor=!0)}update(e,t,n){t&&this.setNewTurntableGroup(t,null!=n&&n),e&&this.properties.rotate!==(null==e?void 0:e.rotate)&&(this.properties.rotate=null==e?void 0:e.rotate,0===this.properties.rotate&&(this.turnTableGroup.rotation.y=0)),e&&this.properties.dimensions!==(null==e?void 0:e.dimensions)&&(this.properties.dimensions=null==e?void 0:e.dimensions,this.updateDimensions()),e&&this.properties.randomOrientation!==(null==e?void 0:e.randomOrientation)&&(this.properties.randomOrientation=null==e?void 0:e.randomOrientation)}updateDimensions(){if(this.properties.dimensions){if(0===this.dimensioningArrows.length)for(let e=0;e<3;++e){const e=new dm(new dn,new dn,{color:0,arrowPixelWidth:10,arrowPixelHeight:15,shaftPixelWidth:3,shaftPixelOffset:1,labelClass:"label",deviceRatio:window.devicePixelRatio});this.dimensioningArrows.push(e),this.dimensioningArrowScene.add(e)}const e=this.sceneRenderer.boundingVolume.bounds,t=this.sceneRenderer.boundingVolume.size,n=.2*Math.min(t.x,t.y,t.z);this.dimensioningArrows[0].setPosition(new dn(e.min.x,e.min.y,e.max.z+n),new dn(e.max.x,e.min.y,e.max.z+n)),this.dimensioningArrows[1].setPosition(new dn(e.min.x-n,e.min.y,e.max.z+n),new dn(e.min.x-n,e.max.y,e.max.z+n)),this.dimensioningArrows[2].setPosition(new dn(e.min.x-n,e.min.y,e.max.z),new dn(e.min.x-n,e.min.y,e.min.z))}else this.dimensioningArrows.forEach((e=>e.setLabel("")))}collectMaterials(){const e=[];return this.scene.traverse((t=>{if(t instanceof mr&&t.name.length>0){const n=t.material;n&&e.push({materialId:t.name,material:n})}else if(t instanceof mr&&t.material.name.length>0){const n=t.material;if(n){const i=t.material.name;-1===e.findIndex((e=>e.materialId===i))&&e.push({materialId:i,material:n})}}})),e}updateMaterialProperties(e,t){this.properties.materialNoise!==e.materialNoise&&(this.properties.materialNoise=e.materialNoise,t.forEach((e=>{const t=e.material;t.userData&&"ormMap"in t.userData||(t.roughnessMap=this.properties.materialNoise?this.noiseTexture:null,t.metalnessMap=this.properties.materialNoise?this.noiseTexture:null,t.needsUpdate=!0)})))}resize(e,t){var n;this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.sceneRenderer.setSize(e,t),null===(n=this.css2Renderer)||void 0===n||n.setSize(e,t)}animate(e){this.properties.rotate>0&&(this.turnTableGroup.rotation.y+=2*Math.PI*e*.001*this.properties.rotate)}prepareRender(e){var t,n;const i=this.environmentLoader.setEnvironment(this.scene,{showEnvironment:this.showEnvironment,environmentRotation:this.environmentRotation,environmentIntensity:this.environmentIntensity});if(i){null===(t=this.groundProjectionSkybox)||void 0===t||t.removeFromParent(),this.groundProjectionSkybox=null;const e=null===(n=this.environmentLoader.currentEnvironment)||void 0===n?void 0:n.equirectangularTexture;this.scene.userData.shadowFromEnvironment=!0,e&&(this.lightSources.currentLightSourceDefinition=ih.noLightSources,this.lightSources.updateLightSources(),this.createGroundProjectionSkybox&&(this.groundProjectionSkybox=new Mm(e,1.5,10),this.groundProjectionSkybox.scale.setScalar(this.groundProjectionSkyboxDistance),this.groundProjectionSkybox.name="skybox",this.scene.add(this.groundProjectionSkybox)))}const r=this.createGroundProjectionSkybox&&this.groundProjectionSkybox?2*this.groundProjectionSkyboxDistance:void 0;if(this.sceneRenderer.updateNearAndFarPlaneOfPerspectiveCamera(this.camera,r),i&&this.updateSceneDependencies(),this.sceneRenderer.outlineRenderer.parameters.enabled){this.raycaster.setFromCamera(e,this.camera);const t=this.raycaster.intersectObject(this.turnTableGroup,!0),n=t.length>0?t[0].object:void 0;this.sceneRenderer.selectObjects(n?[n]:[])}}render(e=!0){var t,n;e&&(null===(t=this.controls)||void 0===t||t.update()),this.backgroundEnvironment.update(this.sceneRenderer.width,this.sceneRenderer.height,this.camera),this.sceneRenderer.render(this.scene,this.camera),this.properties.dimensions&&(this.dimensioningArrows.forEach((e=>{e.arrowNeedsUpdate=!0})),this.renderer.autoClear=!1,this.renderer.render(this.dimensioningArrowScene,this.camera),null===(n=this.css2Renderer)||void 0===n||n.render(this.dimensioningArrowScene,this.camera),this.renderer.autoClear=!0)}loadGLTF(e){return Em(this,void 0,void 0,(function*(){const t=new su;t.setDRACOLoader(this.dracoLoader);const n=yield t.loadAsync(e);return this.updateGLTFScene(n,(e=>{if(e.isMesh){const t=e.material;t instanceof Wl&&!1===t.transparent&&(e.castShadow=!0,e.receiveShadow=!0)}})),this.setNewTurntableGroup(n.scene,!0),n.scene}))}updateGLTFScene(e,t){e.scene.traverse((e=>{e instanceof mr&&(t(e),e.material instanceof Wl&&(e.material.envMapIntensity=1,e.material.needsUpdate=!0))}))}setNewTurntableGroup(e,t){this.turnTableGroup.clear(),this.scaleShadowAndAo=t,this.setInitialObjectPosition(e),this.setInitialCameraPositionAndRotation(),this.sceneRenderer.environmentLights||this.lightSources.setLightSourcesDistances(this.sceneRenderer.boundingVolume,t),this.sceneRenderer.forceShadowUpdates(!0),this.updateSceneDependencies()}setInitialObjectPosition(e){e.updateMatrixWorld(),this.sceneBounds.setFromObject(e);const t=this.sceneBounds.getSize(new dn),n=this.sceneBounds.getCenter(new dn);e.applyMatrix4((new Hn).makeTranslation(-n.x,-this.sceneBounds.min.y,-n.z)),this.sceneBounds.translate(new dn(-n.x,-this.sceneBounds.min.y-t.y/2,-n.z));const i=-t.y/2;this.turnTableGroup.position.y=i,this.turnTableGroup.add(e),this.turnTableGroup.updateMatrixWorld(),this.sceneRenderer.groundLevel=i}setInitialCameraPositionAndRotation(){const e=new dn(-1.5,.8,2.5).normalize();if(this.properties.randomOrientation){const t=4*Math.random()-2,n=.8*Math.random()+.4;e.set(t,n,2.5).normalize()}this.camera.position.copy(e),this.camera.lookAt(new dn(0,0,0)),this.camera.updateMatrixWorld();const t=(new fn).setFromObject(this.turnTableGroup).applyMatrix4(this.camera.matrixWorldInverse),n=this.camera.fov*Math.PI/180/2,i=this.camera.aspect,r=Math.max(-t.min.x/i,t.max.x/i,-t.min.y,t.max.y)/Math.tan(n)+t.max.z+1;this.camera.position.copy(e.multiplyScalar(r)),this.camera.lookAt(new dn(0,0,0)),this.camera.updateMatrixWorld()}constructLoadingGeometry(e){let t=[];if(1===e){const e=[];for(let t=0;t<=230;t+=15){const n=t*Math.PI/180;e.push({x:-Math.cos(n),y:Math.sin(n)+1})}e.push({x:0,y:0});for(let t=60;t>=-180;t-=15){const n=t*Math.PI/180;e.push({x:-Math.cos(n),y:Math.sin(n)-1})}const n=.6,i=2.5*n,r=new Rl(e.map((e=>new dn(e.x,e.y+2+i,0)))),a=new Vl(r,64,n,16,!1),s=new kl(n,32,16);s.translate(-1,3+i,0);const o=new kl(n,32,16);o.translate(1,1+i,0);const l=new kl(n,32,16),c=new jl({color:14352384,side:2});t=[{geometry:a,material:c,materialId:"",environment:!1},{geometry:s,material:c,materialId:"",environment:!1},{geometry:o,material:c,materialId:"",environment:!1},{geometry:l,material:c,materialId:"",environment:!1}]}else{const e=(()=>{const e=new Wl({side:2});return Th((t=>e.map=t),Lh,new Ci(.859,0,0)),e})();t=[{geometry:new vr,material:e,materialId:"",environment:!1}]}return(e=>{const t=new _o;return e.forEach((e=>{const n=new mr(e.geometry,e.material);e.transform&&n.applyMatrix4(e.transform),n.castShadow=!e.environment,n.receiveShadow=!0,t.add(n)})),t})(t)}}(Wg,jg);qg.dracoLoader.setDecoderPath("./draco/"),qg.dracoLoader.setDecoderConfig({type:"js"}),qg.sceneRenderer.setQualityLevel(tm),qg.createControls(),qg.setEnvironment(),qg.updateSceneDependencies(),Vg();const Zg=new Og,Kg=Object.assign({},...t.map((e=>({[e.name]:e.url})))),Jg=Zg.add(Yg,"glb",Kg).onChange((e=>{if(""!==e){const n=t.findIndex((t=>t.url===e)),i=n>=0?t[n].name:e;Hg(i,e)}}));Zg.add(Yg,"randomOrientation").onChange((()=>qg.update(Yg))),Zg.add(Yg,"dimensions").onChange((()=>qg.update(Yg))),Zg.add(Yg,"groundMaterial",{shadow:"onlyshadow",parquet:"parquet",pavement:"pavement"}).onChange((()=>Vg()));const Qg=Zg.addFolder("environment"),$g=Qg.add(qg,"showEnvironment").onChange((e=>{e&&(tv.hideSky(),iv.hideBackground())}));Qg.add(qg,"environmentRotation",0,2*Math.PI,.01).onChange((e=>{var t;(null===(t=qg.scene.userData)||void 0===t?void 0:t.environmentDefinition)&&(qg.scene.userData.environmentDefinition.rotation=e)})),Qg.add(qg,"environmentIntensity",0,5,.01).onChange((e=>{var t;(null===(t=qg.scene.userData)||void 0===t?void 0:t.environmentDefinition)&&(qg.scene.userData.environmentDefinition.intensity=e)}));const ev=Qg.addFolder("sky"),tv=new class{constructor(e){this.skyEnvironment=e}hideSky(){var e,t;null===(e=this.showSkyController)||void 0===e||e.setValue(!1),null===(t=this.showSkyController)||void 0===t||t.updateDisplay()}addGUI(e,t){this.showSkyController=e.add(this.skyEnvironment.parameters,"visible").onChange((()=>{this.skyEnvironment.updateSky(),t&&t(this.skyEnvironment)}))}}(qg.skyEnvironment);tv.addGUI(ev,(e=>{e.parameters.visible&&($g.setValue(!1),$g.updateDisplay(),iv.hideBackground())}));const nv=Qg.addFolder("background"),iv=new class{constructor(e){this._backgroundEnvironment=e}hideBackground(){var e,t;null===(e=this._backgroundTypeController)||void 0===e||e.setValue("None"),null===(t=this._backgroundTypeController)||void 0===t||t.updateDisplay()}addGUI(e,t){const n={backgroundType:""},i=new Map([["None",zd],["Grid Paper",kd],["Concrete",Hd],["Marble",Vd],["Granite",Gd],["Vorocracks Marble",Wd],["Kraft",jd],["Line (slow)",Xd],["Test",Yd]]),r=[];i.forEach(((e,t)=>{r.push(t),this._backgroundEnvironment.parameters.backgroundType===e&&(n.backgroundType=t)})),e.add(n,"backgroundType",r).onChange((e=>{var n;i.has(e)&&(this._backgroundEnvironment.parameters.backgroundType=null!==(n=i.get(e))&&void 0!==n?n:zd,this._backgroundEnvironment.updateBackground(),t&&t(this._backgroundEnvironment))}))}}(qg.backgroundEnvironment);iv.addGUI(nv,(e=>{e.parameters.isSet&&($g.setValue(!1),$g.updateDisplay(),tv.hideSky())})),qg.environmentLoader.addGUI(Qg);const rv=new class{constructor(e){this._qualityLevel="",this._ambientOcclusionType="",this._sceneRenderer=e}addGUI(e,t){this._addRepresentationalGUI(e,t),this._addDebugGUI(e,t);const n=e.addFolder("Shadow type");this._addShadowTypeGUI(n,t);const i=e.addFolder("Shadow and Ambient Occlusion");this._addShadowAndAoGUI(i,t);const r=e.addFolder("Ground Reflection");this._addGroundReflectionGUI(r,t);const a=e.addFolder("Baked Ground Contact Shadow");this._addBakedGroundContactShadowGUI(a,t);const s=e.addFolder("Outline");this._addOutlineGUI(s,t)}_addRepresentationalGUI(e,t){const n=new Map([["LinearSRGBColorSpace",rt],["SRGBColorSpace",it]]),i=[];n.forEach(((e,t)=>{i.push(t),this._sceneRenderer.renderer.outputColorSpace===e&&(this._sceneRenderer.outputColorSpace=t)})),e.add(this._sceneRenderer,"outputColorSpace",i).onChange((e=>{var i;n.has(e)&&(this._sceneRenderer.renderer.outputColorSpace=null!==(i=n.get(e))&&void 0!==i?i:it,t())}));const r=new Map([["NoToneMapping",C],["LinearToneMapping",L],["ReinhardToneMapping",D],["CineonToneMapping",I],["ACESFilmicToneMapping",U]]),a=[];r.forEach(((e,t)=>{a.push(t),this._sceneRenderer.renderer.toneMapping===e&&(this._sceneRenderer.toneMapping=t)})),e.add(this._sceneRenderer,"toneMapping",a).onChange((e=>{var n;r.has(e)&&(this._sceneRenderer.renderer.toneMapping=null!==(n=r.get(e))&&void 0!==n?n:C,t())}))}_addDebugGUI(e,t){const n=new Map([["HIGHEST",tm],["HIGH",nm],["MEDIUM",im],["LOW","low"]]),i=[];n.forEach(((e,t)=>i.push(t))),e.add(this,"_qualityLevel",i).onChange((e=>{var t;n.has(e)&&this._sceneRenderer.setQualityLevel(null!==(t=n.get(e))&&void 0!==t?t:tm)})),e.add(this._sceneRenderer,"debugOutput",{"off ":"off","grayscale (no textures)":"grayscale","color buffer":"color","linear depth":"lineardepth","g-buffer normal vector":"g-normal","g-buffer depth":"g-depth","AO pure":"ssao","AO denoised":"ssaodenoise","shadow map":"shadowmap","shadow soft":"shadowsoft","shadow denoised":"shadowdenoise","shadow fade in":"shadowfadein","shadow and AO":"shadowandao","shadow and AO depth":"shadowandaodepth","material AO pass":"materialao","ground reflection base":"groundreflection","ground reflection final":"groundreflectionfinal","baked ground shadow":"bakedgroundshadow","selection outline":"outline","environment map":"environmentmap","light source detection":"lightsourcedetection"}).onChange((()=>t()))}_addShadowTypeGUI(e,t){const n=this._sceneRenderer.screenSpaceShadowMapPass.shadowConfiguration,i=[];n.types.forEach(((e,t)=>{i.push(t)}));const r=()=>{this._sceneRenderer.screenSpaceShadowMapPass.needsUpdate=!0,this._sceneRenderer.screenSpaceShadowMapPass.shadowTypeNeedsUpdate=!0,this._sceneRenderer.shadowAndAoPass.needsUpdate=!0,t()};e.add(n,"shadowType",i).onChange((e=>{this._sceneRenderer.screenSpaceShadowMapPass.switchType(e)&&(a.object=n.currentConfiguration,s.object=n.currentConfiguration,o.object=n.currentConfiguration,a.updateDisplay(),s.updateDisplay(),o.updateDisplay(),r())}));const a=e.add(n.currentConfiguration,"bias",-.001,.001,1e-5).onChange((()=>r())),s=e.add(n.currentConfiguration,"normalBias",-.05,.05).onChange((()=>r())),o=e.add(n.currentConfiguration,"radius",0,100).onChange((()=>r()))}_addShadowAndAoGUI(e,t){const n=()=>{this._sceneRenderer.requestUpdateOfPasses(),t()},i=this._sceneRenderer.shadowAndAoPass.parameters,r=i.shadow,a=this._sceneRenderer.screenSpaceShadowMapPass.parameters,s=i.ao,o=i.poissonDenoise;e.add(i,"enabled").onChange((()=>n())),e.add(i,"applyToMaterial").onChange((()=>{n(),this._sceneRenderer.clearCache()}));const l=new Map([["none",null],["SSAO",0],["SAO",1],["N8AO",2],["HBAO",3],["GTAO",4]]),c=Array.from(l.keys());l.forEach(((e,t)=>{e===s.algorithm&&(this._ambientOcclusionType=t)})),e.add(i,"aoIntensity",0,1).onChange((()=>{n()})),e.add(i,"aoOnGround").onChange((()=>{n(),this._sceneRenderer.clearCache()})),e.add(i,"shadowOnGround").onChange((()=>{n(),this._sceneRenderer.clearCache()})),e.add(i,"shadowIntensity",0,1).onChange((()=>n())),e.add(i,"alwaysUpdate").onChange((()=>n())),e.add(i,"progressiveDenoiseIterations",0,3,1).onChange((()=>n()));const h=e.addFolder("Environment Shadow");h.add(a,"maximumNumberOfLightSources",-1,10,1).onChange((()=>n())),h.add(a,"enableGroundBoundary").onChange((()=>n())),h.add(a,"directionalDependency",0,1,.01).onChange((()=>n())),h.add(a,"directionalExponent",0,2,.01).onChange((()=>n())),h.add(a,"groundBoundary",0,1,.01).onChange((()=>n())),h.add(a,"fadeOutDistance",0,5,.01).onChange((()=>n())),h.add(a,"fadeOutBlur",0,20,1).onChange((()=>n())),h.add(r,"shadowRadius",.001,.5).onChange((()=>n()));const d=e.addFolder("AO");d.add(this,"_ambientOcclusionType",c).onChange((e=>{if(l.has(e)){const t=l.get(e);s.algorithm=void 0!==t?t:0,n()}})),d.add(s,"samples",1,64,1).onChange((()=>n())),d.add(s,"radius",.01,2,.01).onChange((()=>n())),d.add(s,"distanceExponent",.1,4,.1).onChange((()=>n())),d.add(s,"thickness",.01,2,.01).onChange((()=>n())),d.add(s,"distanceFallOff",0,1).onChange((()=>n())),d.add(s,"scale",.01,2,.01).onChange((()=>n())),d.add(s,"bias",1e-4,.01,1e-4).onChange((()=>n())),d.add(s,"screenSpaceRadius").onChange((()=>n()));const u=e.addFolder("Possion Denoise");u.add(o,"iterations",0,4,1).onChange((()=>n())),u.add(o,"samples",0,32,1).onChange((()=>n())),u.add(o,"rings",0,16,.125).onChange((()=>n())),u.add(o,"radiusExponent",.1,4,.01).onChange((()=>n())),u.add(o,"radius",0,50,1).onChange((()=>n())),u.add(o,"depthPhi",0,20,.001).onChange((()=>n())),u.add(o,"normalPhi",0,20,.001).onChange((()=>n()))}_addGroundReflectionGUI(e,t){const n=this._sceneRenderer.parameters.groundReflectionParameters;e.add(n,"enabled"),e.add(n,"intensity",0,1).onChange((()=>t())),e.add(n,"fadeOutDistance",0,4).onChange((()=>t())),e.add(n,"fadeOutExponent",.1,10).onChange((()=>t())),e.add(n,"brightness",0,2).onChange((()=>t())),e.add(n,"blurHorizontal",0,10).onChange((()=>t())),e.add(n,"blurVertical",0,10).onChange((()=>t()))}_addBakedGroundContactShadowGUI(e,t){const n=()=>{this._sceneRenderer.bakedGroundContactShadowPass.applyParameters(),t()},i=this._sceneRenderer.parameters.bakedGroundContactShadowParameters;e.add(i,"enabled").onChange((()=>n())),e.add(i,"cameraHelper").onChange((()=>n())),e.add(i,"alwaysUpdate"),e.add(i,"fadeIn"),e.add(i,"blurMin",0,.2,.001).onChange((()=>n())),e.add(i,"blurMax",0,.5,.01).onChange((()=>n())),e.add(i,"fadeoutFalloff",0,1,.01).onChange((()=>n())),e.add(i,"fadeoutBias",0,.5).onChange((()=>n())),e.add(i,"opacity",0,1,.01).onChange((()=>n())),e.add(i,"maximumPlaneSize",0,50,1).onChange((()=>n())),e.add(i,"cameraFar",.1,10,.1).onChange((()=>n()))}_addOutlineGUI(e,t){const n=()=>{this._sceneRenderer.outlineRenderer.applyParameters(),t()},i=this._sceneRenderer.outlineRenderer.parameters;e.add(i,"enabled"),e.add(i,"edgeStrength",.5,20).onChange((()=>n())),e.add(i,"edgeGlow",0,20).onChange((()=>n())),e.add(i,"edgeThickness",.5,20).onChange((()=>n())),e.add(i,"pulsePeriod",0,5).onChange((()=>n())),e.addColor(i,"visibleEdgeColor").onChange((()=>n())),e.addColor(i,"hiddenEdgeColor").onChange((()=>n()))}}(qg.sceneRenderer);rv.addGUI(Zg,(()=>{}));const av=new Am,sv=Zg.addFolder("Light"),ov=new class{constructor(e){this.lightColors=[],this.lightSourceFolders=[],this.lights="none",this.lightSources=e}addGUI(e,t,n){e.add(this.lightSources,"lightControls").onChange(t),e.add(this,"lights",["none","default","fife"]).onChange((e=>{switch(e){default:case"none":this.lightSources.currentLightSourceDefinition=ih.noLightSources;break;case"default":this.lightSources.currentLightSourceDefinition=ih.defaultLightSources;break;case"fife":this.lightSources.currentLightSourceDefinition=ih.fifeLightSources}this.lightSources.updateLightSources(),this.updateGUI(),n()})),this.lightGUI=e,this.updateGUI()}updateGUI(){if(!this.lightGUI)return;const e=this.lightGUI;this.lightSourceFolders.forEach((t=>e.removeFolder(t))),this.lightSourceFolders=[],this.lightColors=[],this.lightSources.getLightSources().forEach((t=>{if(t instanceof Fc){this.lightColors.push({color:t.color.getHex()});const n=e.addFolder("Ambient Light");this.lightSourceFolders.push(n),n.add(t,"visible"),n.add(t,"intensity").min(0).max(5).step(.1),n.addColor(this.lightColors[this.lightColors.length-1],"color").onChange((e=>t.color=new Ci(e)))}})),this.lightSources.getLightSources().forEach((t=>{var n;if(t instanceof Nc){this.lightColors.push({color:t.color.getHex()});const n=e.addFolder("Directional Light "+(this.lightColors.length-1));this.lightSourceFolders.push(n),n.add(t,"visible"),n.add(t,"intensity").min(0).max(10).step(.1),n.add(t,"castShadow"),n.addColor(this.lightColors[this.lightColors.length-1],"color").onChange((e=>t.color=new Ci(e)))}else if(t instanceof Bc){this.lightColors.push({color:t.color.getHex()});const i=e.addFolder("Rect area Light "+(this.lightColors.length-1));this.lightSourceFolders.push(i);const r=null===(n=this.lightSources.sceneRenderer)||void 0===n?void 0:n.screenSpaceShadowMapPass.findShadowLightSource(t);i.add(t,"visible"),i.add(t,"intensity").min(0).max(200).step(1),r&&i.add(r,"castShadow"),i.addColor(this.lightColors[this.lightColors.length-1],"color").onChange((e=>t.color=new Ci(e)))}}))}}(qg.getLightSources());ov.addGUI(sv,(()=>e=>qg.changeLightControls(e)),(()=>qg.updateSceneDependencies())),window.addEventListener("resize",(()=>{const e=window.innerWidth,t=window.innerHeight;qg.resize(e,t)}),!1);const lv=new Nt;Wg.domElement.addEventListener("pointermove",(e=>{!1!==e.isPrimary&&(lv.x=e.clientX/window.innerWidth*2-1,lv.y=-e.clientY/window.innerHeight*2+1)})),(()=>{const e=document.getElementById("holder");e&&(e.ondragover=function(){return this.className="hover",!1},e.ondragend=function(){return this.className="",!1},e.ondrop=function(e){this.className="",e.preventDefault();const t=e.dataTransfer.files[0],n=new FileReader;n.onload=e=>((e,t)=>{((e,t)=>{const n=Bg[e];n?(zg(`render ${e}`,"#ff0000"),qg.update(void 0,n.scene,n.glb),kg(e)):qg.loadResource(e,t,(e=>{}),((t,n)=>{n?(Bg[e]={scene:n,glb:!0},kg(t),(e=>{Kg.push(e);let t="";Kg.forEach((e=>{t+=``})),Jg.domElement.children[0].innerHTML=t,Jg.setValue(e),Jg.updateDisplay()})(e)):zg(`load ${t}`,"#ff0000")}))})(e.name,t.target.result)})(t,e),n.readAsDataURL(t)})})();const cv=document.createElement("a"),hv=e=>{const t=Wg.domElement.toDataURL();cv.href=t,cv.download=e,cv.click()},dv=(e,t)=>{const n=qg.sceneRenderer.debugOutput;qg.sceneRenderer.debugOutput=e,qg.prepareRender(new Nt),qg.render(!1),hv(t),qg.sceneRenderer.debugOutput=n},uv=document.getElementById("save-button");uv&&(uv.onclick=()=>(()=>{try{hv(Yg.sceneName+".png")}catch(e){console.log(e)}})());const pv=document.getElementById("save-g-buffer-button");let fv,mv;pv&&(pv.onclick=()=>(()=>{try{dv("color",Yg.sceneName+"_color.png"),dv("g-normal",Yg.sceneName+"_normal.png"),dv("g-depth",Yg.sceneName+"_depth.png")}catch(e){console.log(e)}})());const gv=e=>{void 0===fv&&(fv=e),void 0===mv&&(mv=e);const t=e-mv;mv=e,qg.animate(t),vv(),requestAnimationFrame(gv)},vv=()=>{qg.prepareRender(lv),qg.render(),Xg.update()};(()=>{const e=t.findIndex((e=>"BrainStem"===e.name));if(e>=0){const n=t[e];Hg(n.name,n.url)}})(),requestAnimationFrame(gv)})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5963a88..49deacf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,27 +17,27 @@ "devDependencies": { "@types/dat.gui": "^0.7.13", "@types/express": "^4.17.21", - "@types/node": "^22.4.0", - "@types/three": "^0.167.1", - "@typescript-eslint/eslint-plugin": "8.1.0", - "@typescript-eslint/parser": "8.1.0", - "axios": "^1.7.4", + "@types/node": "^22.5.1", + "@types/three": "^0.167.2", + "@typescript-eslint/eslint-plugin": "8.3.0", + "@typescript-eslint/parser": "8.3.0", + "axios": "^1.7.5", "copy-webpack-plugin": "^12.0.2", "copyfiles": "^2.4.1", "dat.gui": "^0.7.9", - "eslint": "9.9.0", + "eslint": "9.9.1", "eslint-config-prettier": "9.1.0", - "eslint-plugin-jest": "28.8.0", + "eslint-plugin-jest": "28.8.1", "eslint-plugin-node": "11.1.0", "eslint-plugin-prettier": "5.2.1", "install-peers": "^1.0.4", - "npm-check-updates": "^17.0.6", + "npm-check-updates": "^17.1.0", "patch-package": "^8.0.0", "prettier": "3.3.3", "raw-loader": "^4.0.2", "ts-loader": "^9.5.1", "typescript": "^5.5.4", - "webpack": "^5.93.0", + "webpack": "^5.94.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4", "webpack-merge": "^6.0.1" @@ -48,6 +48,7 @@ "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", "dev": true, + "license": "MIT", "engines": { "node": ">=10.0.0" } @@ -57,6 +58,7 @@ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "dev": true, + "license": "MIT", "dependencies": { "eslint-visitor-keys": "^3.3.0" }, @@ -72,15 +74,17 @@ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", "dev": true, + "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/config-array": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.1.tgz", - "integrity": "sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==", + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz", + "integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@eslint/object-schema": "^2.1.4", "debug": "^4.3.1", @@ -95,6 +99,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -105,6 +110,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -117,6 +123,7 @@ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -140,6 +147,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -150,6 +158,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -158,10 +167,11 @@ } }, "node_modules/@eslint/js": { - "version": "9.9.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.9.0.tgz", - "integrity": "sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug==", + "version": "9.9.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.9.1.tgz", + "integrity": "sha512-xIDQRsfg5hNBqHz04H1R3scSVwmI+KUbqjsQKHKQ1DAUSaUjYPReZZmS/5PNiKu1fUvzDd6H7DEDKACSEhu+TQ==", "dev": true, + "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -171,6 +181,7 @@ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } @@ -180,6 +191,7 @@ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=12.22" }, @@ -193,6 +205,7 @@ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=18.18" }, @@ -206,6 +219,7 @@ "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, + "license": "ISC", "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", @@ -223,6 +237,7 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -235,6 +250,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -246,13 +262,15 @@ "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, + "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -270,6 +288,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -285,6 +304,7 @@ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", @@ -302,6 +322,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -316,6 +337,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -325,6 +347,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -334,6 +357,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" @@ -343,13 +367,15 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -360,6 +386,7 @@ "resolved": "https://registry.npmjs.org/@jsonjoy.com/base64/-/base64-1.1.2.tgz", "integrity": "sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=10.0" }, @@ -376,6 +403,7 @@ "resolved": "https://registry.npmjs.org/@jsonjoy.com/json-pack/-/json-pack-1.1.0.tgz", "integrity": "sha512-zlQONA+msXPPwHWZMKFVS78ewFczIll5lXiVPwFPCZUsrOKdxc2AvxU1HoNBmMRhqDZUR9HkC3UOm+6pME6Xsg==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@jsonjoy.com/base64": "^1.1.1", "@jsonjoy.com/util": "^1.1.2", @@ -398,6 +426,7 @@ "resolved": "https://registry.npmjs.org/@jsonjoy.com/util/-/util-1.3.0.tgz", "integrity": "sha512-Cebt4Vk7k1xHy87kHY7KSPLT77A7Ev7IfOblyLZhtYEhrdQ6fX4EoLq3xOQ3O/DRMEh2ok5nyC180E+ABS8Wmw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=10.0" }, @@ -413,13 +442,15 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz", "integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -433,6 +464,7 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, + "license": "MIT", "engines": { "node": ">= 8" } @@ -442,6 +474,7 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -455,6 +488,7 @@ "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", "dev": true, + "license": "MIT", "optional": true, "engines": { "node": ">=14" @@ -465,6 +499,7 @@ "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", "dev": true, + "license": "MIT", "engines": { "node": "^12.20.0 || ^14.18.0 || >=16.0.0" }, @@ -477,6 +512,7 @@ "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -488,13 +524,15 @@ "version": "23.1.3", "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz", "integrity": "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/body-parser": { "version": "1.19.5", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", "dev": true, + "license": "MIT", "dependencies": { "@types/connect": "*", "@types/node": "*" @@ -505,6 +543,7 @@ "resolved": "https://registry.npmjs.org/@types/bonjour/-/bonjour-3.5.13.tgz", "integrity": "sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -514,6 +553,7 @@ "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -523,6 +563,7 @@ "resolved": "https://registry.npmjs.org/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz", "integrity": "sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw==", "dev": true, + "license": "MIT", "dependencies": { "@types/express-serve-static-core": "*", "@types/node": "*" @@ -532,39 +573,22 @@ "version": "0.7.13", "resolved": "https://registry.npmjs.org/@types/dat.gui/-/dat.gui-0.7.13.tgz", "integrity": "sha512-LmG4Pr0mbsB/1WVttf8xaHx45BvSBDGY5D9+0/9AZCbI4vvOguwBHZdKyJMxt5Yst8+icRSHKmr7ClV2u5ZtDA==", - "dev": true - }, - "node_modules/@types/eslint": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.0.tgz", - "integrity": "sha512-gi6WQJ7cHRgZxtkQEoyHMppPjq9Kxo5Tjn2prSKDSmZrCz8TZ3jSRCeTJm+WoM+oB0WG37bRqLzaaU3q7JypGg==", - "dev": true, - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "node_modules/@types/eslint-scope": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", - "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "dev": true, - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" - } + "license": "MIT" }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/express": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -577,6 +601,7 @@ "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz", "integrity": "sha512-y6W03tvrACO72aijJ5uF02FRq5cgDR9lUxddQ8vyF+GvmjJQqbzDcJngEjURc+ZsG31VI3hODNZJ2URj86pzmg==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*", "@types/qs": "*", @@ -588,13 +613,15 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/http-proxy": { "version": "1.17.15", "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.15.tgz", "integrity": "sha512-25g5atgiVNTIv0LBDTg1H74Hvayx0ajtJPLLcYE3whFv75J0pWNtOBzaXJQgDTmrX1bx5U9YC2w/n65BN1HwRQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -603,19 +630,22 @@ "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/mime": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/node": { - "version": "22.4.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.4.0.tgz", - "integrity": "sha512-49AbMDwYUz7EXxKU/r7mXOsxwFr4BYbvB7tWYxVuLdb2ibd30ijjXINSMAHiEEZk5PCRBmW1gUeisn2VMKt3cQ==", + "version": "22.5.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.1.tgz", + "integrity": "sha512-KkHsxej0j9IW1KKOOAA/XBA0z08UFSrRQHErzEfA3Vgq57eXIMYboIlHJuYIfd+lwCQjtKqUu3UnmKbtUc9yRw==", "dev": true, + "license": "MIT", "dependencies": { "undici-types": "~6.19.2" } @@ -625,6 +655,7 @@ "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz", "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -633,25 +664,29 @@ "version": "6.9.15", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz", "integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/range-parser": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/retry": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/send": { "version": "0.17.4", "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", "dev": true, + "license": "MIT", "dependencies": { "@types/mime": "^1", "@types/node": "*" @@ -662,6 +697,7 @@ "resolved": "https://registry.npmjs.org/@types/serve-index/-/serve-index-1.9.4.tgz", "integrity": "sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==", "dev": true, + "license": "MIT", "dependencies": { "@types/express": "*" } @@ -671,6 +707,7 @@ "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", "dev": true, + "license": "MIT", "dependencies": { "@types/http-errors": "*", "@types/node": "*", @@ -682,6 +719,7 @@ "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", "integrity": "sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -690,13 +728,15 @@ "version": "0.17.3", "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.3.tgz", "integrity": "sha512-pXNfAD3KHOdif9EQXZ9deK82HVNaXP5ZIF5RP2QG6OQFNTaY2YIetfrE9t528vEreGQvEPRDDc8muaoYeK0SxQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/three": { - "version": "0.167.1", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.167.1.tgz", - "integrity": "sha512-OCd2Uv/8/4TbmSaIRFawrCOnDMLdpaa+QGJdhlUBmdfbHjLY8k6uFc0tde2/UvcaHQ6NtLl28onj/vJfofV+Tg==", + "version": "0.167.2", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.167.2.tgz", + "integrity": "sha512-onxnIUNYpXcZJ5DTiIsxfnr4F9kAWkkxAUWx5yqzz/u0a4IygCLCjMuOl2DEeCxyJdJ2nOJZvKpu48sBMqfmkQ==", "dev": true, + "license": "MIT", "dependencies": { "@tweenjs/tween.js": "~23.1.2", "@types/stats.js": "*", @@ -706,31 +746,34 @@ } }, "node_modules/@types/webxr": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.19.tgz", - "integrity": "sha512-4hxA+NwohSgImdTSlPXEqDqqFktNgmTXQ05ff1uWam05tNGroCMp4G+4XVl6qWm1p7GQ/9oD41kAYsSssF6Mzw==", - "dev": true + "version": "0.5.20", + "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.20.tgz", + "integrity": "sha512-JGpU6qiIJQKUuVSKx1GtQnHJGxRjtfGIhzO2ilq43VZZS//f1h1Sgexbdk+Lq+7569a6EYhOWrUpIruR/1Enmg==", + "dev": true, + "license": "MIT" }, "node_modules/@types/ws": { "version": "8.5.12", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz", "integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.1.0.tgz", - "integrity": "sha512-LlNBaHFCEBPHyD4pZXb35mzjGkuGKXU5eeCA1SxvHfiRES0E82dOounfVpL4DCqYvJEKab0bZIA0gCRpdLKkCw==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.3.0.tgz", + "integrity": "sha512-FLAIn63G5KH+adZosDYiutqkOkYEx0nvcwNNfJAf+c7Ae/H35qWwTYvPZUKFj5AS+WfHG/WJJfWnDnyNUlp8UA==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.1.0", - "@typescript-eslint/type-utils": "8.1.0", - "@typescript-eslint/utils": "8.1.0", - "@typescript-eslint/visitor-keys": "8.1.0", + "@typescript-eslint/scope-manager": "8.3.0", + "@typescript-eslint/type-utils": "8.3.0", + "@typescript-eslint/utils": "8.3.0", + "@typescript-eslint/visitor-keys": "8.3.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -754,15 +797,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.1.0.tgz", - "integrity": "sha512-U7iTAtGgJk6DPX9wIWPPOlt1gO57097G06gIcl0N0EEnNw8RGD62c+2/DiP/zL7KrkqnnqF7gtFGR7YgzPllTA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.3.0.tgz", + "integrity": "sha512-h53RhVyLu6AtpUzVCYLPhZGL5jzTD9fZL+SYf/+hYOx2bDkyQXztXSc4tbvKYHzfMXExMLiL9CWqJmVz6+78IQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "8.1.0", - "@typescript-eslint/types": "8.1.0", - "@typescript-eslint/typescript-estree": "8.1.0", - "@typescript-eslint/visitor-keys": "8.1.0", + "@typescript-eslint/scope-manager": "8.3.0", + "@typescript-eslint/types": "8.3.0", + "@typescript-eslint/typescript-estree": "8.3.0", + "@typescript-eslint/visitor-keys": "8.3.0", "debug": "^4.3.4" }, "engines": { @@ -782,13 +826,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.1.0.tgz", - "integrity": "sha512-DsuOZQji687sQUjm4N6c9xABJa7fjvfIdjqpSIIVOgaENf2jFXiM9hIBZOL3hb6DHK9Nvd2d7zZnoMLf9e0OtQ==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.3.0.tgz", + "integrity": "sha512-mz2X8WcN2nVu5Hodku+IR8GgCOl4C0G/Z1ruaWN4dgec64kDBabuXyPAr+/RgJtumv8EEkqIzf3X2U5DUKB2eg==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.1.0", - "@typescript-eslint/visitor-keys": "8.1.0" + "@typescript-eslint/types": "8.3.0", + "@typescript-eslint/visitor-keys": "8.3.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -799,13 +844,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.1.0.tgz", - "integrity": "sha512-oLYvTxljVvsMnldfl6jIKxTaU7ok7km0KDrwOt1RHYu6nxlhN3TIx8k5Q52L6wR33nOwDgM7VwW1fT1qMNfFIA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.3.0.tgz", + "integrity": "sha512-wrV6qh//nLbfXZQoj32EXKmwHf4b7L+xXLrP3FZ0GOUU72gSvLjeWUl5J5Ue5IwRxIV1TfF73j/eaBapxx99Lg==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.1.0", - "@typescript-eslint/utils": "8.1.0", + "@typescript-eslint/typescript-estree": "8.3.0", + "@typescript-eslint/utils": "8.3.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -823,10 +869,11 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.1.0.tgz", - "integrity": "sha512-q2/Bxa0gMOu/2/AKALI0tCKbG2zppccnRIRCW6BaaTlRVaPKft4oVYPp7WOPpcnsgbr0qROAVCVKCvIQ0tbWog==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.3.0.tgz", + "integrity": "sha512-y6sSEeK+facMaAyixM36dQ5NVXTnKWunfD1Ft4xraYqxP0lC0POJmIaL/mw72CUMqjY9qfyVfXafMeaUj0noWw==", "dev": true, + "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -836,15 +883,16 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.1.0.tgz", - "integrity": "sha512-NTHhmufocEkMiAord/g++gWKb0Fr34e9AExBRdqgWdVBaKoei2dIyYKD9Q0jBnvfbEA5zaf8plUFMUH6kQ0vGg==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.3.0.tgz", + "integrity": "sha512-Mq7FTHl0R36EmWlCJWojIC1qn/ZWo2YiWYc1XVtasJ7FIgjo0MVv9rZWXEE7IK2CGrtwe1dVOxWwqXUdNgfRCA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "8.1.0", - "@typescript-eslint/visitor-keys": "8.1.0", + "@typescript-eslint/types": "8.3.0", + "@typescript-eslint/visitor-keys": "8.3.0", "debug": "^4.3.4", - "globby": "^11.1.0", + "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", @@ -864,15 +912,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.1.0.tgz", - "integrity": "sha512-ypRueFNKTIFwqPeJBfeIpxZ895PQhNyH4YID6js0UoBImWYoSjBsahUn9KMiJXh94uOjVBgHD9AmkyPsPnFwJA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.3.0.tgz", + "integrity": "sha512-F77WwqxIi/qGkIGOGXNBLV7nykwfjLsdauRB/DOFPdv6LTF3BHHkBpq81/b5iMPSF055oO2BiivDJV4ChvNtXA==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.1.0", - "@typescript-eslint/types": "8.1.0", - "@typescript-eslint/typescript-estree": "8.1.0" + "@typescript-eslint/scope-manager": "8.3.0", + "@typescript-eslint/types": "8.3.0", + "@typescript-eslint/typescript-estree": "8.3.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -886,12 +935,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.1.0.tgz", - "integrity": "sha512-ba0lNI19awqZ5ZNKh6wCModMwoZs457StTebQ0q1NP58zSi2F6MOZRXwfKZy+jB78JNJ/WH8GSh2IQNzXX8Nag==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.3.0.tgz", + "integrity": "sha512-RmZwrTbQ9QveF15m/Cl28n0LXD6ea2CjkhH5rQ55ewz3H24w+AMCJHPVYaZ8/0HoG8Z3cLLFFycRXxeO2tz9FA==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.1.0", + "@typescript-eslint/types": "8.3.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -907,6 +957,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", "integrity": "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/helper-numbers": "1.11.6", "@webassemblyjs/helper-wasm-bytecode": "1.11.6" @@ -916,25 +967,29 @@ "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/helper-api-error": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/helper-buffer": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz", "integrity": "sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.11.6", "@webassemblyjs/helper-api-error": "1.11.6", @@ -945,13 +1000,15 @@ "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/helper-wasm-section": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz", "integrity": "sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", "@webassemblyjs/helper-buffer": "1.12.1", @@ -964,6 +1021,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", "dev": true, + "license": "MIT", "dependencies": { "@xtuc/ieee754": "^1.2.0" } @@ -973,6 +1031,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@xtuc/long": "4.2.2" } @@ -981,13 +1040,15 @@ "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/wasm-edit": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz", "integrity": "sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", "@webassemblyjs/helper-buffer": "1.12.1", @@ -1004,6 +1065,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz", "integrity": "sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.6", @@ -1017,6 +1079,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz", "integrity": "sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", "@webassemblyjs/helper-buffer": "1.12.1", @@ -1029,6 +1092,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz", "integrity": "sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", "@webassemblyjs/helper-api-error": "1.11.6", @@ -1043,6 +1107,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz", "integrity": "sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.12.1", "@xtuc/long": "4.2.2" @@ -1053,6 +1118,7 @@ "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.1.1.tgz", "integrity": "sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==", "dev": true, + "license": "MIT", "engines": { "node": ">=14.15.0" }, @@ -1066,6 +1132,7 @@ "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.2.tgz", "integrity": "sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==", "dev": true, + "license": "MIT", "engines": { "node": ">=14.15.0" }, @@ -1079,6 +1146,7 @@ "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.5.tgz", "integrity": "sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=14.15.0" }, @@ -1096,24 +1164,28 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/@xtuc/long": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/@yarnpkg/lockfile": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", "dependencies": { "mime-types": "~2.1.34", "negotiator": "0.6.3" @@ -1127,6 +1199,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -1139,6 +1212,7 @@ "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", "dev": true, + "license": "MIT", "peerDependencies": { "acorn": "^8" } @@ -1148,6 +1222,7 @@ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, + "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } @@ -1157,6 +1232,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1173,6 +1249,7 @@ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^8.0.0" }, @@ -1190,6 +1267,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -1205,13 +1283,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", "dev": true, + "license": "MIT", "peerDependencies": { "ajv": "^6.9.1" } @@ -1224,6 +1304,7 @@ "engines": [ "node >= 0.8.0" ], + "license": "Apache-2.0", "bin": { "ansi-html": "bin/ansi-html" } @@ -1233,6 +1314,7 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -1242,6 +1324,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -1257,6 +1340,7 @@ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, + "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -1269,42 +1353,38 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "dev": true, + "license": "Python-2.0" }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", "dev": true, + "license": "ISC", "engines": { "node": ">= 4.0.0" } }, "node_modules/axios": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", - "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.5.tgz", + "integrity": "sha512-fZu86yCo+svH3uqJ/yTdQ0QHpQu5oL+/QE+QPSv6BZSkDAoky9vytxp7u5qk83OJFS3kEBcesWni9WTZAv3tSw==", "dev": true, + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -1315,19 +1395,22 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", "dev": true, + "license": "MIT", "engines": { "node": "*" } @@ -1337,6 +1420,7 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -1348,6 +1432,7 @@ "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "license": "MIT", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -1371,6 +1456,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -1378,13 +1464,15 @@ "node_modules/body-parser/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" }, "node_modules/bonjour-service": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.2.1.tgz", "integrity": "sha512-oSzCS2zV14bh2kji6vNe7vrpJYCHGvcZnlffFQ1MEoX/WOeQ/teD8SYWKR942OI3INjq8OMNJlbPK5LLLUxFDw==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3", "multicast-dns": "^7.2.5" @@ -1395,6 +1483,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -1404,6 +1493,7 @@ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, + "license": "MIT", "dependencies": { "fill-range": "^7.1.1" }, @@ -1430,6 +1520,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { "caniuse-lite": "^1.0.30001646", "electron-to-chromium": "^1.5.4", @@ -1447,13 +1538,15 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/bundle-name": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", "dev": true, + "license": "MIT", "dependencies": { "run-applescript": "^7.0.0" }, @@ -1468,6 +1561,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -1476,6 +1570,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "license": "MIT", "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -1495,14 +1590,15 @@ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/caniuse-lite": { - "version": "1.0.30001651", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz", - "integrity": "sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==", + "version": "1.0.30001653", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001653.tgz", + "integrity": "sha512-XGWQVB8wFQ2+9NZwZ10GxTYC5hk0Fa+q8cSkr0tgvMhYhMHP/QC+WTgrePMDBWiWc/pV+1ik82Al20XOK25Gcw==", "dev": true, "funding": [ { @@ -1517,13 +1613,15 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1540,6 +1638,7 @@ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dev": true, + "license": "MIT", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -1564,6 +1663,7 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, + "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, @@ -1576,6 +1676,7 @@ "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0" } @@ -1591,6 +1692,7 @@ "url": "https://github.com/sponsors/sibiraj-s" } ], + "license": "MIT", "engines": { "node": ">=8" } @@ -1600,6 +1702,7 @@ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, + "license": "ISC", "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -1611,6 +1714,7 @@ "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", "dev": true, + "license": "MIT", "dependencies": { "is-plain-object": "^2.0.4", "kind-of": "^6.0.2", @@ -1625,6 +1729,7 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -1636,19 +1741,22 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/colorette": { "version": "2.0.20", "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, + "license": "MIT", "dependencies": { "delayed-stream": "~1.0.0" }, @@ -1660,13 +1768,15 @@ "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/compressible": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", "dev": true, + "license": "MIT", "dependencies": { "mime-db": ">= 1.43.0 < 2" }, @@ -1679,6 +1789,7 @@ "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", "dev": true, + "license": "MIT", "dependencies": { "accepts": "~1.3.5", "bytes": "3.0.0", @@ -1697,6 +1808,7 @@ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -1706,6 +1818,7 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -1714,25 +1827,29 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/compression/node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/connect-history-api-fallback": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz", "integrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8" } @@ -1741,6 +1858,7 @@ "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", "dependencies": { "safe-buffer": "5.2.1" }, @@ -1752,6 +1870,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1760,6 +1879,7 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1767,13 +1887,15 @@ "node_modules/cookie-signature": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "license": "MIT" }, "node_modules/copy-webpack-plugin": { "version": "12.0.2", "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-12.0.2.tgz", "integrity": "sha512-SNwdBeHyII+rWvee/bTnAYyO8vfVdcSTud4EIb6jcZ8inLeWucJE0DnxXQBjlQ5zlteuuvooGQy3LIyGxhvlOA==", "dev": true, + "license": "MIT", "dependencies": { "fast-glob": "^3.3.2", "glob-parent": "^6.0.1", @@ -1793,55 +1915,12 @@ "webpack": "^5.1.0" } }, - "node_modules/copy-webpack-plugin/node_modules/globby": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.2.tgz", - "integrity": "sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==", - "dev": true, - "dependencies": { - "@sindresorhus/merge-streams": "^2.1.0", - "fast-glob": "^3.3.2", - "ignore": "^5.2.4", - "path-type": "^5.0.0", - "slash": "^5.1.0", - "unicorn-magic": "^0.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/copy-webpack-plugin/node_modules/path-type": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", - "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/copy-webpack-plugin/node_modules/slash": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", - "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", - "dev": true, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/copyfiles": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.1.tgz", "integrity": "sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==", "dev": true, + "license": "MIT", "dependencies": { "glob": "^7.0.5", "minimatch": "^3.0.3", @@ -1861,6 +1940,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1871,6 +1951,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -1882,13 +1963,15 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1902,13 +1985,15 @@ "version": "0.7.9", "resolved": "https://registry.npmjs.org/dat.gui/-/dat.gui-0.7.9.tgz", "integrity": "sha512-sCNc1OHobc+Erc1HqiswYgHdVNpSJUlk/Hz8vzOCsER7rl+oF/4+v8GXFUyCgtXpoCX6+bnmg07DedLvBLwYKQ==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/debug": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.1.2" }, @@ -1925,13 +2010,15 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/default-browser": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", "dev": true, + "license": "MIT", "dependencies": { "bundle-name": "^4.1.0", "default-browser-id": "^5.0.0" @@ -1948,6 +2035,7 @@ "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -1960,6 +2048,7 @@ "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz", "integrity": "sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "execa": "^5.0.0" }, @@ -1971,6 +2060,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -1988,6 +2078,7 @@ "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -2000,6 +2091,7 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.4.0" } @@ -2008,6 +2100,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -2016,6 +2109,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", "engines": { "node": ">= 0.8", "npm": "1.2.8000 || >= 1.4.16" @@ -2025,25 +2119,15 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", - "dev": true - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } + "license": "MIT" }, "node_modules/dns-packet": { "version": "5.6.1", "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz", "integrity": "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==", "dev": true, + "license": "MIT", "dependencies": { "@leichtgewicht/ip-codec": "^2.0.1" }, @@ -2055,30 +2139,35 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.11", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.11.tgz", - "integrity": "sha512-R1CccCDYqndR25CaXFd6hp/u9RaaMcftMkphmvuepXr5b1vfLkRml6aWVeBhXJ7rbevHkKEMJtz8XqPf7ffmew==", - "dev": true + "version": "1.5.13", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz", + "integrity": "sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==", + "dev": true, + "license": "ISC" }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/emojis-list": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } @@ -2087,6 +2176,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -2096,6 +2186,7 @@ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", "dev": true, + "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -2109,6 +2200,7 @@ "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.13.0.tgz", "integrity": "sha512-cvcaMr7KqXVh4nyzGTVqTum+gAiL265x5jUWQIDLq//zOGbW+gSW/C+OWLleY/rs9Qole6AZLMXPbtIFQbqu+Q==", "dev": true, + "license": "MIT", "bin": { "envinfo": "dist/cli.js" }, @@ -2120,6 +2212,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "license": "MIT", "dependencies": { "get-intrinsic": "^1.2.4" }, @@ -2131,6 +2224,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -2139,13 +2233,15 @@ "version": "1.5.4", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -2153,13 +2249,15 @@ "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -2168,16 +2266,17 @@ } }, "node_modules/eslint": { - "version": "9.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.9.0.tgz", - "integrity": "sha512-JfiKJrbx0506OEerjK2Y1QlldtBxkAlLxT5OEcRF8uaQ86noDe2k31Vw9rnSWv+MXZHj7OOUV/dA0AhdLFcyvA==", + "version": "9.9.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.9.1.tgz", + "integrity": "sha512-dHvhrbfr4xFQ9/dq+jcVneZMyRYLjggWjk6RVsIiHsP8Rz6yZ8LvZ//iU4TrZF+SXWG+JkNF2OyiZRvzgRDqMg==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.11.0", - "@eslint/config-array": "^0.17.1", + "@eslint/config-array": "^0.18.0", "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.9.0", + "@eslint/js": "9.9.1", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.3.0", "@nodelib/fs.walk": "^1.2.8", @@ -2231,6 +2330,7 @@ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", "dev": true, + "license": "MIT", "bin": { "eslint-config-prettier": "bin/cli.js" }, @@ -2243,6 +2343,7 @@ "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", "dev": true, + "license": "MIT", "dependencies": { "eslint-utils": "^2.0.0", "regexpp": "^3.0.0" @@ -2258,10 +2359,11 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "28.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.8.0.tgz", - "integrity": "sha512-Tubj1hooFxCl52G4qQu0edzV/+EZzPUeN8p2NnW5uu4fbDs+Yo7+qDVDc4/oG3FbCqEBmu/OC3LSsyiU22oghw==", + "version": "28.8.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.8.1.tgz", + "integrity": "sha512-G46XMyYu6PtSNJUkQ0hsPjzXYpzq/O4vpCciMizTKRJG8kNsRreGoMRDG6H9FIB/xVgfFuclVnuX4XRvFUzrZQ==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0" }, @@ -2287,6 +2389,7 @@ "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", "dev": true, + "license": "MIT", "dependencies": { "eslint-plugin-es": "^3.0.0", "eslint-utils": "^2.0.0", @@ -2307,6 +2410,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2317,6 +2421,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2329,6 +2434,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" } @@ -2338,6 +2444,7 @@ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", "dev": true, + "license": "MIT", "dependencies": { "prettier-linter-helpers": "^1.0.0", "synckit": "^0.9.1" @@ -2368,6 +2475,7 @@ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz", "integrity": "sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -2384,6 +2492,7 @@ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", "dev": true, + "license": "MIT", "dependencies": { "eslint-visitor-keys": "^1.1.0" }, @@ -2399,6 +2508,7 @@ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=4" } @@ -2408,6 +2518,7 @@ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -2420,6 +2531,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2430,6 +2542,7 @@ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -2442,6 +2555,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2454,6 +2568,7 @@ "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "acorn": "^8.12.0", "acorn-jsx": "^5.3.2", @@ -2471,6 +2586,7 @@ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -2483,6 +2599,7 @@ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" }, @@ -2495,6 +2612,7 @@ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" }, @@ -2507,6 +2625,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -2516,6 +2635,7 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" } @@ -2524,6 +2644,7 @@ "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -2532,13 +2653,15 @@ "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8.x" } @@ -2548,6 +2671,7 @@ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", "dev": true, + "license": "MIT", "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -2571,6 +2695,7 @@ "resolved": "https://registry.npmjs.org/executioner/-/executioner-2.0.1.tgz", "integrity": "sha512-idZAlKsxEZASjaIqP4PQ1txyS1bOcDwWCHy/8p5oMmLGV0XNCQPD6WWAOwJCUVsWItWzAN2BEash5N78PliaIw==", "dev": true, + "license": "MIT", "dependencies": { "mixly": "^1.0.0" } @@ -2579,6 +2704,7 @@ "version": "4.19.2", "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", @@ -2620,6 +2746,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -2627,25 +2754,29 @@ "node_modules/express/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-diff": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -2662,6 +2793,7 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, + "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, @@ -2673,25 +2805,29 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-uri": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fastest-levenshtein": { "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4.9.1" } @@ -2701,6 +2837,7 @@ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", "dev": true, + "license": "ISC", "dependencies": { "reusify": "^1.0.4" } @@ -2710,6 +2847,7 @@ "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", "dev": true, + "license": "Apache-2.0", "dependencies": { "websocket-driver": ">=0.5.1" }, @@ -2721,13 +2859,15 @@ "version": "0.8.2", "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/file-entry-cache": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, + "license": "MIT", "dependencies": { "flat-cache": "^4.0.0" }, @@ -2740,6 +2880,7 @@ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -2751,6 +2892,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "license": "MIT", "dependencies": { "debug": "2.6.9", "encodeurl": "~1.0.2", @@ -2768,6 +2910,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -2775,13 +2918,15 @@ "node_modules/finalhandler/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, + "license": "MIT", "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -2798,6 +2943,7 @@ "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "micromatch": "^4.0.2" } @@ -2807,6 +2953,7 @@ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true, + "license": "BSD-3-Clause", "bin": { "flat": "cli.js" } @@ -2816,6 +2963,7 @@ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, + "license": "MIT", "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" @@ -2828,7 +2976,8 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/follow-redirects": { "version": "1.15.6", @@ -2841,6 +2990,7 @@ "url": "https://github.com/sponsors/RubenVerborgh" } ], + "license": "MIT", "engines": { "node": ">=4.0" }, @@ -2855,6 +3005,7 @@ "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", "dev": true, + "license": "ISC", "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" @@ -2871,6 +3022,7 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, + "license": "ISC", "engines": { "node": ">=14" }, @@ -2883,6 +3035,7 @@ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dev": true, + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -2896,6 +3049,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -2904,6 +3058,7 @@ "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -2913,6 +3068,7 @@ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, + "license": "MIT", "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", @@ -2927,7 +3083,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/fsevents": { "version": "2.3.3", @@ -2935,6 +3092,7 @@ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -2948,6 +3106,7 @@ "resolved": "https://registry.npmjs.org/fulcon/-/fulcon-1.0.2.tgz", "integrity": "sha512-vYwUBqbdo9XK0NmN7cFmURmy2T1YHpEsTCbxGO3aErxx6a0Z/HkWXcqcPkk7yOuJ74mSAHGWGBSBBd6v3GKebA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.10" } @@ -2956,6 +3115,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -2965,6 +3125,7 @@ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, + "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -2973,6 +3134,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", @@ -2992,6 +3154,7 @@ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -3005,6 +3168,7 @@ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, + "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3025,6 +3189,7 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, + "license": "ISC", "dependencies": { "is-glob": "^4.0.3" }, @@ -3036,13 +3201,15 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/glob/node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3053,6 +3220,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -3065,6 +3233,7 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -3073,20 +3242,21 @@ } }, "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.2.tgz", + "integrity": "sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==", "dev": true, + "license": "MIT", "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" + "@sindresorhus/merge-streams": "^2.1.0", + "fast-glob": "^3.3.2", + "ignore": "^5.2.4", + "path-type": "^5.0.0", + "slash": "^5.1.0", + "unicorn-magic": "^0.1.0" }, "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3096,6 +3266,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "license": "MIT", "dependencies": { "get-intrinsic": "^1.1.3" }, @@ -3107,25 +3278,29 @@ "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/handle-thing": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -3134,6 +3309,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", "dependencies": { "es-define-property": "^1.0.0" }, @@ -3145,6 +3321,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -3156,6 +3333,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -3167,6 +3345,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, @@ -3179,6 +3358,7 @@ "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", "integrity": "sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==", "dev": true, + "license": "MIT", "dependencies": { "inherits": "^2.0.1", "obuf": "^1.0.0", @@ -3190,13 +3370,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/hpack.js/node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, + "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -3211,13 +3393,15 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/hpack.js/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" } @@ -3236,18 +3420,21 @@ "type": "patreon", "url": "https://patreon.com/mdevils" } - ] + ], + "license": "MIT" }, "node_modules/http-deceiver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", @@ -3263,13 +3450,15 @@ "version": "0.5.8", "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz", "integrity": "sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/http-proxy": { "version": "1.18.1", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", "dev": true, + "license": "MIT", "dependencies": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", @@ -3284,6 +3473,7 @@ "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", "dev": true, + "license": "MIT", "dependencies": { "@types/http-proxy": "^1.17.8", "http-proxy": "^1.18.1", @@ -3308,6 +3498,7 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=10.17.0" } @@ -3317,6 +3508,7 @@ "resolved": "https://registry.npmjs.org/hyperdyperid/-/hyperdyperid-1.2.0.tgz", "integrity": "sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A==", "dev": true, + "license": "MIT", "engines": { "node": ">=10.18" } @@ -3325,6 +3517,7 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -3337,6 +3530,7 @@ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } @@ -3346,6 +3540,7 @@ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, + "license": "MIT", "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -3362,6 +3557,7 @@ "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", "dev": true, + "license": "MIT", "dependencies": { "pkg-dir": "^4.2.0", "resolve-cwd": "^3.0.0" @@ -3381,6 +3577,7 @@ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8.19" } @@ -3391,6 +3588,7 @@ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dev": true, + "license": "ISC", "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -3399,7 +3597,8 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" }, "node_modules/install-peers": { "version": "1.0.4", @@ -3407,6 +3606,7 @@ "integrity": "sha512-0POFG2zRn/rt0uO1tUekCDhq6t6l3HDjxR42+Hcbjmj75Gv4yuqEfMe63HC76piO1lsctAp/cQW+Ny+i/SxTlg==", "dev": true, "hasInstallScript": true, + "license": "MIT", "dependencies": { "executioner": "^2.0.1" } @@ -3416,6 +3616,7 @@ "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=10.13.0" } @@ -3424,6 +3625,7 @@ "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", "engines": { "node": ">= 0.10" } @@ -3433,6 +3635,7 @@ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, + "license": "MIT", "dependencies": { "binary-extensions": "^2.0.0" }, @@ -3441,10 +3644,11 @@ } }, "node_modules/is-core-module": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.0.tgz", - "integrity": "sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==", + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", + "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", "dev": true, + "license": "MIT", "dependencies": { "hasown": "^2.0.2" }, @@ -3460,6 +3664,7 @@ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", "dev": true, + "license": "MIT", "bin": { "is-docker": "cli.js" }, @@ -3475,6 +3680,7 @@ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3484,6 +3690,7 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -3493,6 +3700,7 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, + "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, @@ -3505,6 +3713,7 @@ "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", "dev": true, + "license": "MIT", "dependencies": { "is-docker": "^3.0.0" }, @@ -3523,6 +3732,7 @@ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", "dev": true, + "license": "MIT", "bin": { "is-docker": "cli.js" }, @@ -3538,6 +3748,7 @@ "resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.1.0.tgz", "integrity": "sha512-tUdRRAnhT+OtCZR/LxZelH/C7QtjtFrTu5tXCA8pl55eTUElUHT+GPYV8MBMBvea/j+NxQqVt3LbWMRir7Gx9g==", "dev": true, + "license": "MIT", "engines": { "node": ">=16" }, @@ -3550,6 +3761,7 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -3559,6 +3771,7 @@ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -3568,6 +3781,7 @@ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -3580,6 +3794,7 @@ "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, + "license": "MIT", "dependencies": { "isobject": "^3.0.1" }, @@ -3592,6 +3807,7 @@ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -3604,6 +3820,7 @@ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", "dev": true, + "license": "MIT", "dependencies": { "is-docker": "^2.0.0" }, @@ -3615,19 +3832,22 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3637,6 +3857,7 @@ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/cliui": "^8.0.2" }, @@ -3652,6 +3873,7 @@ "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*", "merge-stream": "^2.0.0", @@ -3666,6 +3888,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -3681,6 +3904,7 @@ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -3692,25 +3916,29 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-stable-stringify": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.5", "isarray": "^2.0.5", @@ -3728,13 +3956,15 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, + "license": "MIT", "bin": { "json5": "lib/cli.js" }, @@ -3747,6 +3977,7 @@ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, + "license": "MIT", "dependencies": { "universalify": "^2.0.0" }, @@ -3759,6 +3990,7 @@ "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", "dev": true, + "license": "Public Domain", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3768,6 +4000,7 @@ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, + "license": "MIT", "dependencies": { "json-buffer": "3.0.1" } @@ -3777,6 +4010,7 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3786,6 +4020,7 @@ "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", "dev": true, + "license": "MIT", "dependencies": { "graceful-fs": "^4.1.11" } @@ -3795,6 +4030,7 @@ "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.8.1.tgz", "integrity": "sha512-elBx2l/tp9z99X5H/qev8uyDywVh0VXAwEbjk8kJhnc5grOFkGh7aW6q55me9xnYbss261XtnUrysZ+XvGbhQA==", "dev": true, + "license": "MIT", "dependencies": { "picocolors": "^1.0.0", "shell-quote": "^1.8.1" @@ -3805,6 +4041,7 @@ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, + "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -3818,6 +4055,7 @@ "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.11.5" } @@ -3827,6 +4065,7 @@ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", "dev": true, + "license": "MIT", "dependencies": { "big.js": "^5.2.2", "emojis-list": "^3.0.0", @@ -3841,6 +4080,7 @@ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, + "license": "MIT", "dependencies": { "p-locate": "^5.0.0" }, @@ -3854,24 +4094,28 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lru-cache": { "version": "10.4.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -3881,6 +4125,7 @@ "resolved": "https://registry.npmjs.org/memfs/-/memfs-4.11.1.tgz", "integrity": "sha512-LZcMTBAgqUUKNXZagcZxvXXfgF1bHX7Y7nQ0QyEiNbRJgE29GhgPd8Yna1VQcLlPiHt/5RFJMWYN9Uv/VPNvjQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@jsonjoy.com/json-pack": "^1.0.3", "@jsonjoy.com/util": "^1.3.0", @@ -3898,19 +4143,22 @@ "node_modules/merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", + "license": "MIT" }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 8" } @@ -3919,21 +4167,24 @@ "version": "0.18.1", "resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-0.18.1.tgz", "integrity": "sha512-ZhoIoL7TNV4s5B6+rx5mC//fw8/POGyNxS/DZyCJeiZ12ScLfVwRE/GfsxwiTkMYYD5DmK2/JXnEVXqL4rF+Sw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -3946,6 +4197,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", "bin": { "mime": "cli.js" }, @@ -3957,6 +4209,7 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -3965,6 +4218,7 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", "dependencies": { "mime-db": "1.52.0" }, @@ -3977,6 +4231,7 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -3985,13 +4240,15 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -4007,6 +4264,7 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -4016,6 +4274,7 @@ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, + "license": "ISC", "engines": { "node": ">=16 || 14 >=14.17" } @@ -4025,6 +4284,7 @@ "resolved": "https://registry.npmjs.org/mixly/-/mixly-1.0.0.tgz", "integrity": "sha512-ks+xIMVeIDwuYK4LnOMXTfmiEI8oo3tFNFirpHd60C4r2H0wMwKN5/qHCrFBKFK+BYx2Gp7qs+evUJw7QO9D2w==", "dev": true, + "license": "MIT", "dependencies": { "fulcon": "^1.0.1" }, @@ -4037,6 +4297,7 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true, + "license": "MIT", "bin": { "mkdirp": "bin/cmd.js" }, @@ -4048,13 +4309,15 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/multicast-dns": { "version": "7.2.5", "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz", "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", "dev": true, + "license": "MIT", "dependencies": { "dns-packet": "^5.2.2", "thunky": "^1.0.2" @@ -4067,12 +4330,14 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -4081,13 +4346,15 @@ "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", "dev": true, + "license": "(BSD-3-Clause OR GPL-2.0)", "engines": { "node": ">= 6.13.0" } @@ -4096,13 +4363,15 @@ "version": "2.0.18", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/noms": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/noms/-/noms-0.0.0.tgz", "integrity": "sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow==", "dev": true, + "license": "ISC", "dependencies": { "inherits": "^2.0.1", "readable-stream": "~1.0.31" @@ -4113,15 +4382,17 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/npm-check-updates": { - "version": "17.0.6", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-17.0.6.tgz", - "integrity": "sha512-KCiaJH1cfnh/RyzKiDNjNfXgcKFyQs550Uf1OF/Yzb8xO56w+RLpP/OKRUx23/GyP/mLYwEpOO65qjmVdh6j0A==", + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-17.1.0.tgz", + "integrity": "sha512-RcohCA/tdpxyPllBlYDkqGXFJQgTuEt0f2oPSL9s05pZ3hxYdleaUtvEcSxKl0XAg3ncBhVgLAxhXSjoryUU5Q==", "dev": true, + "license": "Apache-2.0", "bin": { "ncu": "build/cli.js", "npm-check-updates": "build/cli.js" @@ -4136,6 +4407,7 @@ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.0.0" }, @@ -4147,6 +4419,7 @@ "version": "1.13.2", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -4159,6 +4432,7 @@ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -4167,12 +4441,14 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", "dependencies": { "ee-first": "1.1.1" }, @@ -4185,6 +4461,7 @@ "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -4194,6 +4471,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, + "license": "ISC", "dependencies": { "wrappy": "1" } @@ -4203,6 +4481,7 @@ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, + "license": "MIT", "dependencies": { "mimic-fn": "^2.1.0" }, @@ -4218,6 +4497,7 @@ "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", "dev": true, + "license": "MIT", "dependencies": { "is-docker": "^2.0.0", "is-wsl": "^2.1.1" @@ -4234,6 +4514,7 @@ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, + "license": "MIT", "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", @@ -4251,6 +4532,7 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4260,6 +4542,7 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, + "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" }, @@ -4275,6 +4558,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, + "license": "MIT", "dependencies": { "p-limit": "^3.0.2" }, @@ -4290,6 +4574,7 @@ "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-6.2.0.tgz", "integrity": "sha512-JA6nkq6hKyWLLasXQXUrO4z8BUZGUt/LjlJxx8Gb2+2ntodU/SS63YZ8b0LUTbQ8ZB9iwOfhEPhg4ykKnn2KsA==", "dev": true, + "license": "MIT", "dependencies": { "@types/retry": "0.12.2", "is-network-error": "^1.0.0", @@ -4307,6 +4592,7 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -4315,13 +4601,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", - "dev": true + "dev": true, + "license": "BlueOak-1.0.0" }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, + "license": "MIT", "dependencies": { "callsites": "^3.0.0" }, @@ -4333,6 +4621,7 @@ "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -4342,6 +4631,7 @@ "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", "dev": true, + "license": "MIT", "dependencies": { "@yarnpkg/lockfile": "^1.1.0", "chalk": "^4.1.2", @@ -4372,6 +4662,7 @@ "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -4381,6 +4672,7 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -4390,6 +4682,7 @@ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4399,6 +4692,7 @@ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -4407,13 +4701,15 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/path-scurry": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" @@ -4428,28 +4724,35 @@ "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", + "license": "MIT" }, "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", + "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/picocolors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.6" }, @@ -4462,6 +4765,7 @@ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, + "license": "MIT", "dependencies": { "find-up": "^4.0.0" }, @@ -4474,6 +4778,7 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, + "license": "MIT", "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -4487,6 +4792,7 @@ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, + "license": "MIT", "dependencies": { "p-locate": "^4.1.0" }, @@ -4499,6 +4805,7 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, + "license": "MIT", "dependencies": { "p-try": "^2.0.0" }, @@ -4514,6 +4821,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, + "license": "MIT", "dependencies": { "p-limit": "^2.2.0" }, @@ -4526,6 +4834,7 @@ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8.0" } @@ -4535,6 +4844,7 @@ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, + "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" }, @@ -4550,6 +4860,7 @@ "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "dev": true, + "license": "MIT", "dependencies": { "fast-diff": "^1.1.2" }, @@ -4561,12 +4872,14 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" @@ -4579,13 +4892,15 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -4594,6 +4909,7 @@ "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "license": "BSD-3-Clause", "dependencies": { "side-channel": "^1.0.4" }, @@ -4622,13 +4938,15 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "^5.1.0" } @@ -4637,6 +4955,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -4645,6 +4964,7 @@ "version": "2.5.2", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "license": "MIT", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", @@ -4660,6 +4980,7 @@ "resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-4.0.2.tgz", "integrity": "sha512-ZnScIV3ag9A4wPX/ZayxL/jZH+euYb6FcUinPcgiQW0+UBtEv0O6Q3lGd3cqJ+GHH+rksEv3Pj99oxJ3u3VIKA==", "dev": true, + "license": "MIT", "dependencies": { "loader-utils": "^2.0.0", "schema-utils": "^3.0.0" @@ -4680,6 +5001,7 @@ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", "dev": true, + "license": "MIT", "dependencies": { "@types/json-schema": "^7.0.8", "ajv": "^6.12.5", @@ -4698,6 +5020,7 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==", "dev": true, + "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", @@ -4709,13 +5032,15 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, + "license": "MIT", "dependencies": { "picomatch": "^2.2.1" }, @@ -4728,6 +5053,7 @@ "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", "dev": true, + "license": "MIT", "dependencies": { "resolve": "^1.20.0" }, @@ -4740,6 +5066,7 @@ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -4752,6 +5079,7 @@ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4761,6 +5089,7 @@ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4769,13 +5098,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, + "license": "MIT", "dependencies": { "is-core-module": "^2.13.0", "path-parse": "^1.0.7", @@ -4793,6 +5124,7 @@ "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", "dev": true, + "license": "MIT", "dependencies": { "resolve-from": "^5.0.0" }, @@ -4805,6 +5137,7 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -4814,6 +5147,7 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } @@ -4823,6 +5157,7 @@ "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } @@ -4832,6 +5167,7 @@ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true, + "license": "MIT", "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -4843,6 +5179,7 @@ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, + "license": "ISC", "dependencies": { "glob": "^7.1.3" }, @@ -4855,6 +5192,7 @@ "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -4881,6 +5219,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "queue-microtask": "^1.2.2" } @@ -4902,18 +5241,21 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" }, "node_modules/schema-utils": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", "dev": true, + "license": "MIT", "dependencies": { "@types/json-schema": "^7.0.9", "ajv": "^8.9.0", @@ -4933,6 +5275,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -4949,6 +5292,7 @@ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3" }, @@ -4960,19 +5304,22 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/selfsigned": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", "dev": true, + "license": "MIT", "dependencies": { "@types/node-forge": "^1.3.0", "node-forge": "^1" @@ -4986,6 +5333,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -4997,6 +5345,7 @@ "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "license": "MIT", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -5020,6 +5369,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -5027,18 +5377,21 @@ "node_modules/send/node_modules/debug/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/serialize-javascript": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "randombytes": "^2.1.0" } @@ -5048,6 +5401,7 @@ "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==", "dev": true, + "license": "MIT", "dependencies": { "accepts": "~1.3.4", "batch": "0.6.1", @@ -5066,6 +5420,7 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, + "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -5075,6 +5430,7 @@ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -5084,6 +5440,7 @@ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==", "dev": true, + "license": "MIT", "dependencies": { "depd": "~1.1.2", "inherits": "2.0.3", @@ -5098,25 +5455,29 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/serve-index/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/serve-index/node_modules/setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/serve-index/node_modules/statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -5125,6 +5486,7 @@ "version": "1.15.0", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "license": "MIT", "dependencies": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", @@ -5139,6 +5501,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -5154,13 +5517,15 @@ "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" }, "node_modules/shallow-clone": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", "dev": true, + "license": "MIT", "dependencies": { "kind-of": "^6.0.2" }, @@ -5173,6 +5538,7 @@ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, + "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" }, @@ -5185,6 +5551,7 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -5194,6 +5561,7 @@ "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -5202,6 +5570,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -5219,15 +5588,20 @@ "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/sockjs": { @@ -5235,6 +5609,7 @@ "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", "dev": true, + "license": "MIT", "dependencies": { "faye-websocket": "^0.11.3", "uuid": "^8.3.2", @@ -5246,6 +5621,7 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">= 8" } @@ -5255,6 +5631,7 @@ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, + "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -5265,6 +5642,7 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -5274,6 +5652,7 @@ "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.1.0", "handle-thing": "^2.0.0", @@ -5290,6 +5669,7 @@ "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.1.0", "detect-node": "^2.0.4", @@ -5304,6 +5684,7 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, + "license": "MIT", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -5318,6 +5699,7 @@ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "~5.2.0" } @@ -5326,6 +5708,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -5334,13 +5717,15 @@ "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -5356,6 +5741,7 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -5370,6 +5756,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -5383,6 +5770,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -5395,6 +5783,7 @@ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -5404,6 +5793,7 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -5416,6 +5806,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -5428,6 +5819,7 @@ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -5440,6 +5832,7 @@ "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.1.tgz", "integrity": "sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==", "dev": true, + "license": "MIT", "dependencies": { "@pkgr/core": "^0.1.0", "tslib": "^2.6.2" @@ -5456,6 +5849,7 @@ "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -5465,6 +5859,7 @@ "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.6.tgz", "integrity": "sha512-PQ4DAriWzKj+qgehQ7LK5bQqCFNMmlhjR2PFFLuqGCpuCAauxemVBWwWOxo3UIwWQx8+Pr61Df++r76wDmkQBg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", @@ -5483,6 +5878,7 @@ "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "^0.3.20", "jest-worker": "^27.4.5", @@ -5517,6 +5913,7 @@ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", "dev": true, + "license": "MIT", "dependencies": { "@types/json-schema": "^7.0.8", "ajv": "^6.12.5", @@ -5534,13 +5931,15 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/thingies": { "version": "1.21.0", "resolved": "https://registry.npmjs.org/thingies/-/thingies-1.21.0.tgz", "integrity": "sha512-hsqsJsFMsV+aD4s3CWKk85ep/3I9XzYV/IXaSouJMYIoDlgyi11cBhsqYe9/geRfB0YIikBQg6raRaM+nIMP9g==", "dev": true, + "license": "Unlicense", "engines": { "node": ">=10.18" }, @@ -5551,13 +5950,15 @@ "node_modules/three": { "version": "0.167.1", "resolved": "https://registry.npmjs.org/three/-/three-0.167.1.tgz", - "integrity": "sha512-gYTLJA/UQip6J/tJvl91YYqlZF47+D/kxiWrbTon35ZHlXEN0VOo+Qke2walF1/x92v55H6enomymg4Dak52kw==" + "integrity": "sha512-gYTLJA/UQip6J/tJvl91YYqlZF47+D/kxiWrbTon35ZHlXEN0VOo+Qke2walF1/x92v55H6enomymg4Dak52kw==", + "license": "MIT" }, "node_modules/through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", "dev": true, + "license": "MIT", "dependencies": { "readable-stream": "~2.3.6", "xtend": "~4.0.1" @@ -5567,13 +5968,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/through2/node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, + "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -5588,13 +5991,15 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/through2/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" } @@ -5603,13 +6008,15 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, + "license": "MIT", "dependencies": { "os-tmpdir": "~1.0.2" }, @@ -5622,6 +6029,7 @@ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -5633,6 +6041,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", "engines": { "node": ">=0.6" } @@ -5642,6 +6051,7 @@ "resolved": "https://registry.npmjs.org/tree-dump/-/tree-dump-1.0.2.tgz", "integrity": "sha512-dpev9ABuLWdEubk+cIaI9cHwRNNDjkBBLXTwI4UCUFdQ5xXKqNXoK4FEciw/vxf+NQ7Cb7sGUyeUtORvHIdRXQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=10.0" }, @@ -5658,6 +6068,7 @@ "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=16" }, @@ -5670,6 +6081,7 @@ "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0", "enhanced-resolve": "^5.0.0", @@ -5686,16 +6098,18 @@ } }, "node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", - "dev": true + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "dev": true, + "license": "0BSD" }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, + "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1" }, @@ -5707,6 +6121,7 @@ "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" @@ -5720,6 +6135,7 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -5729,16 +6145,18 @@ } }, "node_modules/undici-types": { - "version": "6.19.6", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.6.tgz", - "integrity": "sha512-e/vggGopEfTKSvj4ihnOLTsqhrKRN3LeO6qSN/GxohhuRv8qH9bNQ4B8W7e/vFL+0XTnmHPB4/kegunZGA4Org==", - "dev": true + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" }, "node_modules/unicorn-magic": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -5751,6 +6169,7 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10.0.0" } @@ -5759,6 +6178,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -5768,6 +6188,7 @@ "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -5791,6 +6212,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { "escalade": "^3.1.2", "picocolors": "^1.0.1" @@ -5807,6 +6229,7 @@ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" } @@ -5815,12 +6238,14 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", "engines": { "node": ">= 0.4.0" } @@ -5830,6 +6255,7 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", "dev": true, + "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } @@ -5838,6 +6264,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -5847,6 +6274,7 @@ "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", "dev": true, + "license": "MIT", "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" @@ -5860,17 +6288,18 @@ "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", "dev": true, + "license": "MIT", "dependencies": { "minimalistic-assert": "^1.0.0" } }, "node_modules/webpack": { - "version": "5.93.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.93.0.tgz", - "integrity": "sha512-Y0m5oEY1LRuwly578VqluorkXbvXKh7U3rLoQCEO04M97ScRr44afGVkI0FQFsXzysk5OgFAxjZAb9rsGQVihA==", + "version": "5.94.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", + "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", "dev": true, + "license": "MIT", "dependencies": { - "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.12.1", "@webassemblyjs/wasm-edit": "^1.12.1", @@ -5879,7 +6308,7 @@ "acorn-import-attributes": "^1.9.5", "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.0", + "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", @@ -5916,6 +6345,7 @@ "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz", "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", "dev": true, + "license": "MIT", "dependencies": { "@discoveryjs/json-ext": "^0.5.0", "@webpack-cli/configtest": "^2.1.1", @@ -5961,6 +6391,7 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", "dev": true, + "license": "MIT", "engines": { "node": ">=14" } @@ -5970,6 +6401,7 @@ "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", "dev": true, + "license": "MIT", "dependencies": { "clone-deep": "^4.0.1", "flat": "^5.0.2", @@ -5980,10 +6412,11 @@ } }, "node_modules/webpack-dev-middleware": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-7.3.0.tgz", - "integrity": "sha512-xD2qnNew+F6KwOGZR7kWdbIou/ud7cVqLEXeK1q0nHcNsX/u7ul/fSdlOTX4ntSL5FNFy7ZJJXbf0piF591JYw==", + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-7.4.2.tgz", + "integrity": "sha512-xOO8n6eggxnwYpy1NlzUKpvrjfJTvae5/D6WOK0S2LSo7vjmo5gCM1DbLUmFqrMTJP+W/0YZNctm7jasWvLuBA==", "dev": true, + "license": "MIT", "dependencies": { "colorette": "^2.0.10", "memfs": "^4.6.0", @@ -6013,6 +6446,7 @@ "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.0.4.tgz", "integrity": "sha512-dljXhUgx3HqKP2d8J/fUMvhxGhzjeNVarDLcbO/EWMSgRizDkxHQDZQaLFL5VJY9tRBj2Gz+rvCEYYvhbqPHNA==", "dev": true, + "license": "MIT", "dependencies": { "@types/bonjour": "^3.5.13", "@types/connect-history-api-fallback": "^1.5.4", @@ -6072,6 +6506,7 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, + "license": "ISC", "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", @@ -6092,6 +6527,7 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } @@ -6101,6 +6537,7 @@ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", "dev": true, + "license": "MIT", "dependencies": { "is-inside-container": "^1.0.0" }, @@ -6116,6 +6553,7 @@ "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz", "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==", "dev": true, + "license": "MIT", "dependencies": { "default-browser": "^5.2.1", "define-lazy-prop": "^3.0.0", @@ -6134,6 +6572,7 @@ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", "dev": true, + "license": "ISC", "dependencies": { "glob": "^10.3.7" }, @@ -6149,6 +6588,7 @@ "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-6.0.1.tgz", "integrity": "sha512-hXXvrjtx2PLYx4qruKl+kyRSLc52V+cCvMxRjmKwoA+CBbbF5GfIBtR6kCvl0fYGqTUPKB+1ktVmTHqMOzgCBg==", "dev": true, + "license": "MIT", "dependencies": { "clone-deep": "^4.0.1", "flat": "^5.0.2", @@ -6163,6 +6603,7 @@ "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", "dev": true, + "license": "MIT", "engines": { "node": ">=10.13.0" } @@ -6172,6 +6613,7 @@ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" @@ -6185,6 +6627,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -6194,6 +6637,7 @@ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", "dev": true, + "license": "MIT", "dependencies": { "@types/json-schema": "^7.0.8", "ajv": "^6.12.5", @@ -6212,6 +6656,7 @@ "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", "dev": true, + "license": "Apache-2.0", "dependencies": { "http-parser-js": ">=0.5.1", "safe-buffer": ">=5.1.0", @@ -6226,6 +6671,7 @@ "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=0.8.0" } @@ -6235,6 +6681,7 @@ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, + "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, @@ -6249,13 +6696,15 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -6265,6 +6714,7 @@ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -6283,6 +6733,7 @@ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -6299,13 +6750,15 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/ws": { "version": "8.18.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "dev": true, + "license": "MIT", "engines": { "node": ">=10.0.0" }, @@ -6327,6 +6780,7 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.4" } @@ -6336,6 +6790,7 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, + "license": "ISC", "engines": { "node": ">=10" } @@ -6345,6 +6800,7 @@ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==", "dev": true, + "license": "ISC", "bin": { "yaml": "bin.mjs" }, @@ -6357,6 +6813,7 @@ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, + "license": "MIT", "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", @@ -6375,6 +6832,7 @@ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, + "license": "ISC", "engines": { "node": ">=10" } @@ -6384,6 +6842,7 @@ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, diff --git a/package.json b/package.json index 7fb17a5..be74c9c 100644 --- a/package.json +++ b/package.json @@ -25,27 +25,27 @@ "devDependencies": { "@types/dat.gui": "^0.7.13", "@types/express": "^4.17.21", - "@types/node": "^22.4.0", - "@types/three": "^0.167.1", - "@typescript-eslint/eslint-plugin": "8.1.0", - "@typescript-eslint/parser": "8.1.0", - "axios": "^1.7.4", + "@types/node": "^22.5.1", + "@types/three": "^0.167.2", + "@typescript-eslint/eslint-plugin": "8.3.0", + "@typescript-eslint/parser": "8.3.0", + "axios": "^1.7.5", "copy-webpack-plugin": "^12.0.2", "copyfiles": "^2.4.1", "dat.gui": "^0.7.9", - "eslint": "9.9.0", + "eslint": "9.9.1", "eslint-config-prettier": "9.1.0", - "eslint-plugin-jest": "28.8.0", + "eslint-plugin-jest": "28.8.1", "eslint-plugin-node": "11.1.0", "eslint-plugin-prettier": "5.2.1", "install-peers": "^1.0.4", - "npm-check-updates": "^17.0.6", + "npm-check-updates": "^17.1.0", "patch-package": "^8.0.0", "prettier": "3.3.3", "raw-loader": "^4.0.2", "ts-loader": "^9.5.1", "typescript": "^5.5.4", - "webpack": "^5.93.0", + "webpack": "^5.94.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4", "webpack-merge": "^6.0.1"