ART & GALLERY
ART & GALLERY
var GYRE = GYRE || {}; GYRE.ARTDETAIL = {}; GYRE.ARTDETAIL.INIT = []; GYRE.ARTDETAIL.DESTROY = [];
$(document).ready(function()
{/*! For license information please see bundle.js.LICENSE.txt */
(()=>{"use strict";const t=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],e=Math.PI/180,n=180/Math.PI;function i(){const e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(t[255&e]+t[e>>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&n]+t[n>>8&255]+"-"+t[n>>16&15|64]+t[n>>24&255]+"-"+t[63&i|128]+t[i>>8&255]+"-"+t[i>>16&255]+t[i>>24&255]+t[255&r]+t[r>>8&255]+t[r>>16&255]+t[r>>24&255]).toLowerCase()}function r(t,e,n){return Math.max(e,Math.min(n,t))}function a(t,e,n){return(1-n)*t+n*e}function s(t){return 0==(t&t-1)&&0!==t}function o(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}class l{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,a,s){let o=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const u=r[a+0],d=r[a+1],f=r[a+2],p=r[a+3];if(0===s)return t[e+0]=o,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===s)return t[e+0]=u,t[e+1]=d,t[e+2]=f,void(t[e+3]=p);if(h!==p||o!==u||l!==d||c!==f){let t=1-s;const e=o*u+l*d+c*f+h*p,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,e*n);t=Math.sin(t*a)/r,s=Math.sin(s*a)/r}const r=s*n;if(o=o*t+u*r,l=l*t+d*r,c=c*t+f*r,h=h*t+p*r,t===1-s){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[a],u=r[a+1],d=r[a+2],f=r[a+3];return t[e]=s*f+c*h+o*d-l*u,t[e+1]=o*f+c*u+l*h-s*d,t[e+2]=l*f+c*d+s*u-o*h,t[e+3]=c*f-s*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,a=t._order,s=Math.cos,o=Math.sin,l=s(n/2),c=s(i/2),h=s(r/2),u=o(n/2),d=o(i/2),f=o(r/2);switch(a){case"XYZ":this._x=u*c*h+l*d*f,this._y=l*d*h-u*c*f,this._z=l*c*f+u*d*h,this._w=l*c*h-u*d*f;break;case"YXZ":this._x=u*c*h+l*d*f,this._y=l*d*h-u*c*f,this._z=l*c*f-u*d*h,this._w=l*c*h+u*d*f;break;case"ZXY":this._x=u*c*h-l*d*f,this._y=l*d*h+u*c*f,this._z=l*c*f+u*d*h,this._w=l*c*h-u*d*f;break;case"ZYX":this._x=u*c*h-l*d*f,this._y=l*d*h+u*c*f,this._z=l*c*f-u*d*h,this._w=l*c*h+u*d*f;break;case"YZX":this._x=u*c*h+l*d*f,this._y=l*d*h+u*c*f,this._z=l*c*f-u*d*h,this._w=l*c*h-u*d*f;break;case"XZY":this._x=u*c*h-l*d*f,this._y=l*d*h-u*c*f,this._z=l*c*f+u*d*h,this._w=l*c*h+u*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],a=e[1],s=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+s+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(a-i)*t}else if(n>s&&n>h){const t=2*Math.sqrt(1+n-s-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(r+l)/t}else if(s>h){const t=2*Math.sqrt(1+s-n-h);this._w=(r-l)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-s);this._w=(a-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(r(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,a=t._w,s=e._x,o=e._y,l=e._z,c=e._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(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,a=this._w;let s=a*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),c=Math.atan2(l,s),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=a*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class c{constructor(t=0,e=0,n=0){c.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(u.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(u.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,s=t.z,o=t.w,l=o*e+a*i-s*n,c=o*n+s*e-r*i,h=o*i+r*n-a*e,u=-r*e-a*n-s*i;return this.x=l*o+u*-r+c*-s-h*-a,this.y=c*o+u*-a+h*-r-l*-s,this.z=h*o+u*-s+l*-a-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,a=e.x,s=e.y,o=e.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return h.copy(this).projectOnVector(t),this.sub(h)}reflect(t){return this.sub(h.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(r(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const h=new c,u=new l;class d{constructor(){d.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(t,e,n,i,r,a,s,o,l,c,h,u,d,f,p,m){const g=this.elements;return g[0]=t,g[4]=e,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]=u,g[3]=d,g[7]=f,g[11]=p,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 d).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/f.setFromMatrixColumn(t,0).length(),r=1/f.setFromMatrixColumn(t,1).length(),a=1/f.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.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"===t.order){const t=a*c,n=a*h,i=s*c,r=s*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=a*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*s,e[4]=i*s-n,e[8]=a*l,e[1]=a*h,e[5]=a*c,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=a*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*s,e[4]=-a*h,e[8]=i+n*s,e[1]=n+i*s,e[5]=a*c,e[9]=r-t*s,e[2]=-a*l,e[6]=s,e[10]=a*o}else if("ZYX"===t.order){const t=a*c,n=a*h,i=s*c,r=s*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*o,e[10]=a*o}else if("YZX"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=a*c,e[9]=-s*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=a*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=s*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(m,t,g)}lookAt(t,e,n){const i=this.elements;return x.subVectors(t,e),0===x.lengthSq()&&(x.z=1),x.normalize(),_.crossVectors(n,x),0===_.lengthSq()&&(1===Math.abs(n.z)?x.x+=1e-4:x.z+=1e-4,x.normalize(),_.crossVectors(n,x)),_.normalize(),v.crossVectors(x,_),i[0]=_.x,i[4]=v.x,i[8]=x.x,i[1]=_.y,i[5]=v.y,i[9]=x.y,i[2]=_.z,i[6]=v.z,i[10]=x.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],f=n[2],p=n[6],m=n[10],g=n[14],_=n[3],v=n[7],x=n[11],y=n[15],M=i[0],b=i[4],T=i[8],S=i[12],E=i[1],w=i[5],A=i[9],R=i[13],C=i[2],L=i[6],P=i[10],D=i[14],N=i[3],I=i[7],O=i[11],U=i[15];return r[0]=a*M+s*E+o*C+l*N,r[4]=a*b+s*w+o*L+l*I,r[8]=a*T+s*A+o*P+l*O,r[12]=a*S+s*R+o*D+l*U,r[1]=c*M+h*E+u*C+d*N,r[5]=c*b+h*w+u*L+d*I,r[9]=c*T+h*A+u*P+d*O,r[13]=c*S+h*R+u*D+d*U,r[2]=f*M+p*E+m*C+g*N,r[6]=f*b+p*w+m*L+g*I,r[10]=f*T+p*A+m*P+g*O,r[14]=f*S+p*R+m*D+g*U,r[3]=_*M+v*E+x*C+y*N,r[7]=_*b+v*w+x*L+y*I,r[11]=_*T+v*A+x*P+y*O,r[15]=_*S+v*R+x*D+y*U,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],a=t[1],s=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*s*u+n*l*u+i*s*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*a*u-i*a*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*s*d-r*a*h+n*a*d+r*s*c-n*l*c)+t[15]*(-i*s*c-e*o*h+e*s*u+i*a*h-n*a*u+n*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],f=t[12],p=t[13],m=t[14],g=t[15],_=h*m*l-p*u*l+p*o*d-s*m*d-h*o*g+s*u*g,v=f*u*l-c*m*l-f*o*d+a*m*d+c*o*g-a*u*g,x=c*p*l-f*h*l+f*s*d-a*p*d-c*s*g+a*h*g,y=f*h*o-c*p*o-f*s*u+a*p*u+c*s*m-a*h*m,M=e*_+n*v+i*x+r*y;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/M;return t[0]=_*b,t[1]=(p*u*r-h*m*r-p*i*d+n*m*d+h*i*g-n*u*g)*b,t[2]=(s*m*r-p*o*r+p*i*l-n*m*l-s*i*g+n*o*g)*b,t[3]=(h*o*r-s*u*r-h*i*l+n*u*l+s*i*d-n*o*d)*b,t[4]=v*b,t[5]=(c*m*r-f*u*r+f*i*d-e*m*d-c*i*g+e*u*g)*b,t[6]=(f*o*r-a*m*r-f*i*l+e*m*l+a*i*g-e*o*g)*b,t[7]=(a*u*r-c*o*r+c*i*l-e*u*l-a*i*d+e*o*d)*b,t[8]=x*b,t[9]=(f*h*r-c*p*r-f*n*d+e*p*d+c*n*g-e*h*g)*b,t[10]=(a*p*r-f*s*r+f*n*l-e*p*l-a*n*g+e*s*g)*b,t[11]=(c*s*r-a*h*r-c*n*l+e*h*l+a*n*d-e*s*d)*b,t[12]=y*b,t[13]=(c*p*i-f*h*i+f*n*u-e*p*u-c*n*m+e*h*m)*b,t[14]=(f*s*i-a*p*i-f*n*o+e*p*o+a*n*m-e*s*m)*b,t[15]=(a*h*i-c*s*i+c*n*o-e*h*o-a*n*u+e*s*u)*b,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,a=t.x,s=t.y,o=t.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(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,a){return this.set(1,n,r,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,a=e._y,s=e._z,o=e._w,l=r+r,c=a+a,h=s+s,u=r*l,d=r*c,f=r*h,p=a*c,m=a*h,g=s*h,_=o*l,v=o*c,x=o*h,y=n.x,M=n.y,b=n.z;return i[0]=(1-(p+g))*y,i[1]=(d+x)*y,i[2]=(f-v)*y,i[3]=0,i[4]=(d-x)*M,i[5]=(1-(u+g))*M,i[6]=(m+_)*M,i[7]=0,i[8]=(f+v)*b,i[9]=(m-_)*b,i[10]=(1-(u+p))*b,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=f.set(i[0],i[1],i[2]).length();const a=f.set(i[4],i[5],i[6]).length(),s=f.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],p.copy(this);const o=1/r,l=1/a,c=1/s;return p.elements[0]*=o,p.elements[1]*=o,p.elements[2]*=o,p.elements[4]*=l,p.elements[5]*=l,p.elements[6]*=l,p.elements[8]*=c,p.elements[9]*=c,p.elements[10]*=c,e.setFromRotationMatrix(p),n.x=r,n.y=a,n.z=s,this}makePerspective(t,e,n,i,r,a){const s=this.elements,o=2*r/(e-t),l=2*r/(n-i),c=(e+t)/(e-t),h=(n+i)/(n-i),u=-(a+r)/(a-r),d=-2*a*r/(a-r);return s[0]=o,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,a){const s=this.elements,o=1/(e-t),l=1/(n-i),c=1/(a-r),h=(e+t)*o,u=(n+i)*l,d=(a+r)*c;return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const f=new c,p=new d,m=new c(0,0,0),g=new c(1,1,1),_=new c,v=new c,x=new c;class y{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t);t.target=null}}}const M=new d,b=new l;class T{constructor(t=0,e=0,n=0,i=T.DefaultOrder){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,a=i[0],s=i[4],o=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(e){case"XYZ":this._y=Math.asin(r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,a),this._z=0);break;case"ZXY":this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,a)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return M.makeRotationFromQuaternion(t),this.setFromRotationMatrix(M,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return b.setFromEuler(this),this.setFromQuaternion(b,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}T.DefaultOrder="XYZ",T.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class S{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}isEnabled(t){return 0!=(this.mask&(1<<t|0))}}class E{constructor(){E.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,n,i,r,a,s,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=s,c[3]=e,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(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],f=n[8],p=i[0],m=i[3],g=i[6],_=i[1],v=i[4],x=i[7],y=i[2],M=i[5],b=i[8];return r[0]=a*p+s*_+o*y,r[3]=a*m+s*v+o*M,r[6]=a*g+s*x+o*b,r[1]=l*p+c*_+h*y,r[4]=l*m+c*v+h*M,r[7]=l*g+c*x+h*b,r[2]=u*p+d*_+f*y,r[5]=u*m+d*v+f*M,r[8]=u*g+d*x+f*b,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8];return e*a*c-e*s*l-n*r*c+n*s*o+i*r*l-i*a*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],h=c*a-s*l,u=s*o-c*r,d=l*r-a*o,f=e*h+n*u+i*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const p=1/f;return t[0]=h*p,t[1]=(i*l-c*n)*p,t[2]=(s*n-i*a)*p,t[3]=u*p,t[4]=(c*e-i*o)*p,t[5]=(i*r-s*e)*p,t[6]=d*p,t[7]=(n*o-l*e)*p,t[8]=(a*e-n*r)*p,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+t,-i*l,i*o,-i*(-l*a+o*s)+s+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],a=i[3],s=i[6],o=i[1],l=i[4],c=i[7];return i[0]=e*r+n*o,i[3]=e*a+n*l,i[6]=e*s+n*c,i[1]=-n*r+e*o,i[4]=-n*a+e*l,i[7]=-n*s+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let w=0;const A=new c,R=new l,C=new d,L=new c,P=new c,D=new c,N=new l,I=new c(1,0,0),O=new c(0,1,0),U=new c(0,0,1),F={type:"added"},z={type:"removed"};class B extends y{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:w++}),this.uuid=i(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=B.DefaultUp.clone();const t=new c,e=new T,n=new l,r=new c(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new d},normalMatrix:{value:new E}}),this.matrix=new d,this.matrixWorld=new d,this.matrixAutoUpdate=B.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new S,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return R.setFromAxisAngle(t,e),this.quaternion.multiply(R),this}rotateOnWorldAxis(t,e){return R.setFromAxisAngle(t,e),this.quaternion.premultiply(R),this}rotateX(t){return this.rotateOnAxis(I,t)}rotateY(t){return this.rotateOnAxis(O,t)}rotateZ(t){return this.rotateOnAxis(U,t)}translateOnAxis(t,e){return A.copy(t).applyQuaternion(this.quaternion),this.position.add(A.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(I,t)}translateY(t){return this.translateOnAxis(O,t)}translateZ(t){return this.translateOnAxis(U,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(C.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?L.copy(t):L.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),P.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?C.lookAt(P,L,this.up):C.lookAt(L,P,this.up),this.quaternion.setFromRotationMatrix(C),i&&(C.extractRotation(i.matrixWorld),R.setFromRotationMatrix(C),this.quaternion.premultiply(R.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(F)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(z)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(z)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),C.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),C.multiply(t.parent.matrixWorld)),t.applyMatrix4(C),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(P,t,D),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(P,N,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=a(t.geometries),i=a(t.materials),r=a(t.textures),s=a(t.images),o=a(t.shapes),l=a(t.skeletons),c=a(t.animations),h=a(t.nodes);e.length>0&&(n.geometries=e),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(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}B.DefaultUp=new c(0,1,0),B.DefaultMatrixAutoUpdate=!0;class H extends B{constructor(){super(),this.isGroup=!0,this.type="Group"}}class G{constructor(t=0,e=0,n=0,i=1){G.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const a=.01,s=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],f=o[9],p=o[2],m=o[6],g=o[10];if(Math.abs(c-u)<a&&Math.abs(h-p)<a&&Math.abs(f-m)<a){if(Math.abs(c+u)<s&&Math.abs(h+p)<s&&Math.abs(f+m)<s&&Math.abs(l+d+g-3)<s)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,o=(d+1)/2,_=(g+1)/2,v=(c+u)/4,x=(h+p)/4,y=(f+m)/4;return t>o&&t>_?t<a?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=v/n,r=x/n):o>_?o<a?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=v/i,r=y/i):_<a?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(_),n=x/r,i=y/r),this.set(n,i,r,e),this}let _=Math.sqrt((m-f)*(m-f)+(h-p)*(h-p)+(u-c)*(u-c));return Math.abs(_)<.001&&(_=1),this.x=(m-f)/_,this.y=(h-p)/_,this.z=(u-c)/_,this.w=Math.acos((l+d+g-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class k{constructor(t=0,e=0){k.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const W=100,V=301,X=302,q=306,j=1e3,Y=1001,Z=1002,K=1003,J=1006,Q=1008,$=1009,tt=1014,et=1015,nt=1016,it=1020,rt=1023,at=1026,st=1027,ot=33776,lt=33777,ct=33778,ht=33779,ut=3e3,dt=3001,ft="srgb",pt="srgb-linear",mt=7680,gt="300 es",_t=1035;function vt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function xt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const yt={[ft]:{[pt]:vt},[pt]:{[ft]:xt}},Mt={legacyMode:!0,get workingColorSpace(){return pt},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.legacyMode||e===n||!e||!n)return t;if(yt[e]&&void 0!==yt[e][n]){const i=yt[e][n];return t.r=i(t.r),t.g=i(t.g),t.b=i(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},bt={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},Tt={r:0,g:0,b:0},St={h:0,s:0,l:0},Et={h:0,s:0,l:0};function wt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function At(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class Rt{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e="srgb"){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Mt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i="srgb-linear"){return this.r=t,this.g=e,this.b=n,Mt.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i="srgb-linear"){if(t=function(t,e){return(t%e+e)%e}(t,1),e=r(e,0,1),n=r(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=wt(r,i,t+1/3),this.g=wt(r,i,t),this.b=wt(r,i,t-1/3)}return Mt.toWorkingColorSpace(this,i),this}setStyle(t,e="srgb"){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,Mt.toWorkingColorSpace(this,e),n(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,Mt.toWorkingColorSpace(this,e),n(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const i=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,a=parseInt(t[3],10)/100;return n(t[4]),this.setHSL(i,r,a,e)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],n=t.length;if(3===n)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,Mt.toWorkingColorSpace(this,e),this;if(6===n)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,Mt.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e="srgb"){const n=bt[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=vt(t.r),this.g=vt(t.g),this.b=vt(t.b),this}copyLinearToSRGB(t){return this.r=xt(t.r),this.g=xt(t.g),this.b=xt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t="srgb"){return Mt.fromWorkingColorSpace(At(this,Tt),t),r(255*Tt.r,0,255)<<16^r(255*Tt.g,0,255)<<8^r(255*Tt.b,0,255)<<0}getHexString(t="srgb"){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e="srgb-linear"){Mt.fromWorkingColorSpace(At(this,Tt),e);const n=Tt.r,i=Tt.g,r=Tt.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 t=a-s;switch(l=c<=.5?t/(a+s):t/(2-a-s),a){case n:o=(i-r)/t+(i<r?6:0);break;case i:o=(r-n)/t+2;break;case r:o=(n-i)/t+4}o/=6}return t.h=o,t.s=l,t.l=c,t}getRGB(t,e="srgb-linear"){return Mt.fromWorkingColorSpace(At(this,Tt),e),t.r=Tt.r,t.g=Tt.g,t.b=Tt.b,t}getStyle(t="srgb"){return Mt.fromWorkingColorSpace(At(this,Tt),t),t!==ft?`color(${t} ${Tt.r} ${Tt.g} ${Tt.b})`:`rgb(${255*Tt.r|0},${255*Tt.g|0},${255*Tt.b|0})`}offsetHSL(t,e,n){return this.getHSL(St),St.h+=t,St.s+=e,St.l+=n,this.setHSL(St.h,St.s,St.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(St),t.getHSL(Et);const n=a(St.h,Et.h,e),i=a(St.s,Et.s,e),r=a(St.l,Et.l,e);return this.setHSL(n,i,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}Rt.NAMES=bt;const Ct=new c,Lt=new k;class Pt{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),r=new Rt),e[n++]=r.r,e[n++]=r.g,e[n++]=r.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),r=new k),e[n++]=r.x,e[n++]=r.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),r=new c),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),r=new G),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z,e[n++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Lt.fromBufferAttribute(this,e),Lt.applyMatrix3(t),this.setXY(e,Lt.x,Lt.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ct.fromBufferAttribute(this,e),Ct.applyMatrix3(t),this.setXYZ(e,Ct.x,Ct.y,Ct.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Ct.fromBufferAttribute(this,e),Ct.applyMatrix4(t),this.setXYZ(e,Ct.x,Ct.y,Ct.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ct.fromBufferAttribute(this,e),Ct.applyNormalMatrix(t),this.setXYZ(e,Ct.x,Ct.y,Ct.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ct.fromBufferAttribute(this,e),Ct.transformDirection(t),this.setXYZ(e,Ct.x,Ct.y,Ct.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}class Dt extends Pt{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Nt extends Pt{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class It extends Pt{constructor(t,e,n){super(new Float32Array(t),e,n)}}class Ot extends Pt{constructor(t,e,n,i=1){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}class Ut{constructor(t=new c(1/0,1/0,1/0),e=new c(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.length;o<l;o+=3){const l=t[o],c=t[o+1],h=t[o+2];l<e&&(e=l),c<n&&(n=c),h<i&&(i=h),l>r&&(r=l),c>a&&(a=c),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,a,s),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.count;o<l;o++){const l=t.getX(o),c=t.getY(o),h=t.getZ(o);l<e&&(e=l),c<n&&(n=c),h<i&&(i=h),l>r&&(r=l),c>a&&(a=c),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,a,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=zt.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n)if(e&&null!=n.attributes&&void 0!==n.attributes.position){const e=n.attributes.position;for(let n=0,i=e.count;n<i;n++)zt.fromBufferAttribute(e,n).applyMatrix4(t.matrixWorld),this.expandByPoint(zt)}else null===n.boundingBox&&n.computeBoundingBox(),Bt.copy(n.boundingBox),Bt.applyMatrix4(t.matrixWorld),this.union(Bt);const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,zt),zt.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(qt),jt.subVectors(this.max,qt),Ht.subVectors(t.a,qt),Gt.subVectors(t.b,qt),kt.subVectors(t.c,qt),Wt.subVectors(Gt,Ht),Vt.subVectors(kt,Gt),Xt.subVectors(Ht,kt);let e=[0,-Wt.z,Wt.y,0,-Vt.z,Vt.y,0,-Xt.z,Xt.y,Wt.z,0,-Wt.x,Vt.z,0,-Vt.x,Xt.z,0,-Xt.x,-Wt.y,Wt.x,0,-Vt.y,Vt.x,0,-Xt.y,Xt.x,0];return!!Kt(e,Ht,Gt,kt,jt)&&(e=[1,0,0,0,1,0,0,0,1],!!Kt(e,Ht,Gt,kt,jt)&&(Yt.crossVectors(Wt,Vt),e=[Yt.x,Yt.y,Yt.z],Kt(e,Ht,Gt,kt,jt)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return zt.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(zt).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ft[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ft[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ft[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ft[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ft[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ft[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ft[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ft[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ft)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ft=[new c,new c,new c,new c,new c,new c,new c,new c],zt=new c,Bt=new Ut,Ht=new c,Gt=new c,kt=new c,Wt=new c,Vt=new c,Xt=new c,qt=new c,jt=new c,Yt=new c,Zt=new c;function Kt(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){Zt.fromArray(t,a);const s=r.x*Math.abs(Zt.x)+r.y*Math.abs(Zt.y)+r.z*Math.abs(Zt.z),o=e.dot(Zt),l=n.dot(Zt),c=i.dot(Zt);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const Jt=new Ut,Qt=new c,$t=new c,te=new c;class ee{constructor(t=new c,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):Jt.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){te.subVectors(t,this.center);const e=te.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(te.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return!0===this.center.equals(t.center)?$t.set(0,0,1).multiplyScalar(t.radius):$t.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(Qt.copy(t.center).add($t)),this.expandByPoint(Qt.copy(t.center).sub($t)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const ne=new c,ie=new c,re=new c,ae=new c,se=new c,oe=new c,le=new c;class ce{constructor(t=new c,e=new c(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ne)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=ne.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ne.copy(this.direction).multiplyScalar(e).add(this.origin),ne.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){ie.copy(t).add(e).multiplyScalar(.5),re.copy(e).sub(t).normalize(),ae.copy(this.origin).sub(ie);const r=.5*t.distanceTo(e),a=-this.direction.dot(re),s=ae.dot(this.direction),o=-ae.dot(re),l=ae.lengthSq(),c=Math.abs(1-a*a);let h,u,d,f;if(c>0)if(h=a*o-s,u=a*s-o,f=r*c,h>=0)if(u>=-f)if(u<=f){const t=1/c;h*=t,u*=t,d=h*(h+a*u+2*s)+u*(a*h+u+2*o)+l}else u=r,h=Math.max(0,-(a*u+s)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(a*u+s)),d=-h*h+u*(u+2*o)+l;else u<=-f?(h=Math.max(0,-(-a*r+s)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=f?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(a*r+s)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=a>0?-r:r,h=Math.max(0,-(a*u+s)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(re).multiplyScalar(u).add(ie),d}intersectSphere(t,e){ne.subVectors(t.center,this.origin);const n=ne.dot(this.direction),i=ne.dot(ne)-n*n,r=t.radius*t.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+a;return s<0&&o<0?null:s<0?this.at(o,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,a,s,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,a=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,a=(t.min.y-u.y)*c),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a<i||i!=i)&&(i=a),h>=0?(s=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(s=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||s>i?null:((s>n||n!=n)&&(n=s),(o<i||i!=i)&&(i=o),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,ne)}intersectTriangle(t,e,n,i,r){se.subVectors(e,t),oe.subVectors(n,t),le.crossVectors(se,oe);let a,s=this.direction.dot(le);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}ae.subVectors(this.origin,t);const o=a*this.direction.dot(oe.crossVectors(ae,oe));if(o<0)return null;const l=a*this.direction.dot(se.cross(ae));if(l<0)return null;if(o+l>s)return null;const c=-a*ae.dot(le);return c<0?null:this.at(c/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}const he=new c,ue=new c,de=new c,fe=new c,pe=new c,me=new c,ge=new c,_e=new c,ve=new c,xe=new c;class ye{constructor(t=new c,e=new c,n=new c){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),he.subVectors(t,e),i.cross(he);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){he.subVectors(i,e),ue.subVectors(n,e),de.subVectors(t,e);const a=he.dot(he),s=he.dot(ue),o=he.dot(de),l=ue.dot(ue),c=ue.dot(de),h=a*l-s*s;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*o-s*c)*u,f=(a*c-s*o)*u;return r.set(1-d-f,f,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,fe),fe.x>=0&&fe.y>=0&&fe.x+fe.y<=1}static getUV(t,e,n,i,r,a,s,o){return this.getBarycoord(t,e,n,i,fe),o.set(0,0),o.addScaledVector(r,fe.x),o.addScaledVector(a,fe.y),o.addScaledVector(s,fe.z),o}static isFrontFacing(t,e,n,i){return he.subVectors(n,e),ue.subVectors(t,e),he.cross(ue).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return he.subVectors(this.c,this.b),ue.subVectors(this.a,this.b),.5*he.cross(ue).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ye.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ye.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return ye.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return ye.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ye.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let a,s;pe.subVectors(i,n),me.subVectors(r,n),_e.subVectors(t,n);const o=pe.dot(_e),l=me.dot(_e);if(o<=0&&l<=0)return e.copy(n);ve.subVectors(t,i);const c=pe.dot(ve),h=me.dot(ve);if(c>=0&&h<=c)return e.copy(i);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return a=o/(o-c),e.copy(n).addScaledVector(pe,a);xe.subVectors(t,r);const d=pe.dot(xe),f=me.dot(xe);if(f>=0&&d<=f)return e.copy(r);const p=d*l-o*f;if(p<=0&&l>=0&&f<=0)return s=l/(l-f),e.copy(n).addScaledVector(me,s);const m=c*f-d*h;if(m<=0&&h-c>=0&&d-f>=0)return ge.subVectors(r,i),s=(h-c)/(h-c+(d-f)),e.copy(i).addScaledVector(ge,s);const g=1/(m+p+u);return a=p*g,s=u*g,e.copy(n).addScaledVector(pe,a).addScaledVector(me,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Me=0;class be extends y{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Me++}),this.uuid=i(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=W,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=mt,this.stencilZFail=mt,this.stencilZPass=mt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}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()),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(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),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(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),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(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(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),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,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.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class Te extends be{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Rt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}function Se(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}function Ee(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let we=0;const Ae=new d,Re=new B,Ce=new c,Le=new Ut,Pe=new Ut,De=new c;class Ne extends y{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:we++}),this.uuid=i(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Se(t)?Nt:Dt)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new E).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ae.makeRotationFromQuaternion(t),this.applyMatrix4(Ae),this}rotateX(t){return Ae.makeRotationX(t),this.applyMatrix4(Ae),this}rotateY(t){return Ae.makeRotationY(t),this.applyMatrix4(Ae),this}rotateZ(t){return Ae.makeRotationZ(t),this.applyMatrix4(Ae),this}translate(t,e,n){return Ae.makeTranslation(t,e,n),this.applyMatrix4(Ae),this}scale(t,e,n){return Ae.makeScale(t,e,n),this.applyMatrix4(Ae),this}lookAt(t){return Re.lookAt(t),Re.updateMatrix(),this.applyMatrix4(Re.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ce).negate(),this.translate(Ce.x,Ce.y,Ce.z),this}setFromPoints(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new It(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ut);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new c(-1/0,-1/0,-1/0),new c(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Le.setFromBufferAttribute(n),this.morphTargetsRelative?(De.addVectors(this.boundingBox.min,Le.min),this.boundingBox.expandByPoint(De),De.addVectors(this.boundingBox.max,Le.max),this.boundingBox.expandByPoint(De)):(this.boundingBox.expandByPoint(Le.min),this.boundingBox.expandByPoint(Le.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new ee);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new c,1/0);if(t){const n=this.boundingSphere.center;if(Le.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Pe.setFromBufferAttribute(n),this.morphTargetsRelative?(De.addVectors(Le.min,Pe.min),Le.expandByPoint(De),De.addVectors(Le.max,Pe.max),Le.expandByPoint(De)):(Le.expandByPoint(Pe.min),Le.expandByPoint(Pe.max))}Le.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)De.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(De));if(e)for(let r=0,a=e.length;r<a;r++){const a=e[r],s=this.morphTargetsRelative;for(let e=0,r=a.count;e<r;e++)De.fromBufferAttribute(a,e),s&&(Ce.fromBufferAttribute(t,e),De.add(Ce)),i=Math.max(i,n.distanceToSquared(De))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,i=e.position.array,r=e.normal.array,a=e.uv.array,s=i.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Pt(new Float32Array(4*s),4));const o=this.getAttribute("tangent").array,l=[],h=[];for(let t=0;t<s;t++)l[t]=new c,h[t]=new c;const u=new c,d=new c,f=new c,p=new k,m=new k,g=new k,_=new c,v=new c;function x(t,e,n){u.fromArray(i,3*t),d.fromArray(i,3*e),f.fromArray(i,3*n),p.fromArray(a,2*t),m.fromArray(a,2*e),g.fromArray(a,2*n),d.sub(u),f.sub(u),m.sub(p),g.sub(p);const r=1/(m.x*g.y-g.x*m.y);isFinite(r)&&(_.copy(d).multiplyScalar(g.y).addScaledVector(f,-m.y).multiplyScalar(r),v.copy(f).multiplyScalar(m.x).addScaledVector(d,-g.x).multiplyScalar(r),l[t].add(_),l[e].add(_),l[n].add(_),h[t].add(v),h[e].add(v),h[n].add(v))}let y=this.groups;0===y.length&&(y=[{start:0,count:n.length}]);for(let t=0,e=y.length;t<e;++t){const e=y[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)x(n[t+0],n[t+1],n[t+2])}const M=new c,b=new c,T=new c,S=new c;function E(t){T.fromArray(r,3*t),S.copy(T);const e=l[t];M.copy(e),M.sub(T.multiplyScalar(T.dot(e))).normalize(),b.crossVectors(S,e);const n=b.dot(h[t])<0?-1:1;o[4*t]=M.x,o[4*t+1]=M.y,o[4*t+2]=M.z,o[4*t+3]=n}for(let t=0,e=y.length;t<e;++t){const e=y[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)E(n[t+0]),E(n[t+1]),E(n[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new Pt(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new c,r=new c,a=new c,s=new c,o=new c,l=new c,h=new c,u=new c;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),f=t.getX(c+1),p=t.getX(c+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,f),a.fromBufferAttribute(e,p),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),s.fromBufferAttribute(n,d),o.fromBufferAttribute(n,f),l.fromBufferAttribute(n,p),s.add(h),o.add(h),l.add(h),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),h.subVectors(a,r),u.subVectors(i,r),h.cross(u),n.setXYZ(t+0,h.x,h.y,h.z),n.setXYZ(t+1,h.x,h.y,h.z),n.setXYZ(t+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(void 0===t.attributes[i])continue;const r=n[i].array,a=t.attributes[i],s=a.array,o=a.itemSize*e,l=Math.min(s.length,r.length-o);for(let t=0,e=o;t<l;t++,e++)r[e]=s[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)De.fromBufferAttribute(t,e),De.normalize(),t.setXYZ(e,De.x,De.y,De.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,a=new n.constructor(e.length*i);let s=0,o=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)a[o++]=n[s++]}return new Pt(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Ne,n=this.index.array,i=this.attributes;for(const r in i){const a=t(i[r],n);e.setAttribute(r,a)}const r=this.morphAttributes;for(const i in r){const a=[],s=r[i];for(let e=0,i=s.length;e<i;e++){const i=t(s[e],n);a.push(i)}e.morphAttributes[i]=a}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let t=0,n=a.length;t<n;t++){const n=a[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],a=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];a.push(i.toJSON(t.data))}a.length>0&&(i[e]=a,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let t=0,e=a.length;t<e;t++){const e=a[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,void 0!==t.parameters&&(this.parameters=Object.assign({},t.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ie=new d,Oe=new ce,Ue=new ee,Fe=new c,ze=new c,Be=new c,He=new c,Ge=new c,ke=new c,We=new c,Ve=new c,Xe=new c,qe=new k,je=new k,Ye=new k,Ze=new c,Ke=new c;class Je extends B{constructor(t=new Ne,e=new Te){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ue.copy(n.boundingSphere),Ue.applyMatrix4(r),!1===t.ray.intersectsSphere(Ue))return;if(Ie.copy(r).invert(),Oe.copy(t.ray).applyMatrix4(Ie),null!==n.boundingBox&&!1===Oe.intersectsBox(n.boundingBox))return;let a;const s=n.index,o=n.attributes.position,l=n.morphAttributes.position,c=n.morphTargetsRelative,h=n.attributes.uv,u=n.attributes.uv2,d=n.groups,f=n.drawRange;if(null!==s)if(Array.isArray(i))for(let n=0,r=d.length;n<r;n++){const r=d[n],p=i[r.materialIndex];for(let n=Math.max(r.start,f.start),i=Math.min(s.count,Math.min(r.start+r.count,f.start+f.count));n<i;n+=3){const i=s.getX(n),d=s.getX(n+1),f=s.getX(n+2);a=Qe(this,p,t,Oe,o,l,c,h,u,i,d,f),a&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=r.materialIndex,e.push(a))}}else for(let n=Math.max(0,f.start),r=Math.min(s.count,f.start+f.count);n<r;n+=3){const r=s.getX(n),d=s.getX(n+1),f=s.getX(n+2);a=Qe(this,i,t,Oe,o,l,c,h,u,r,d,f),a&&(a.faceIndex=Math.floor(n/3),e.push(a))}else if(void 0!==o)if(Array.isArray(i))for(let n=0,r=d.length;n<r;n++){const r=d[n],s=i[r.materialIndex];for(let n=Math.max(r.start,f.start),i=Math.min(o.count,Math.min(r.start+r.count,f.start+f.count));n<i;n+=3)a=Qe(this,s,t,Oe,o,l,c,h,u,n,n+1,n+2),a&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=r.materialIndex,e.push(a))}else for(let n=Math.max(0,f.start),r=Math.min(o.count,f.start+f.count);n<r;n+=3)a=Qe(this,i,t,Oe,o,l,c,h,u,n,n+1,n+2),a&&(a.faceIndex=Math.floor(n/3),e.push(a))}}function Qe(t,e,n,i,r,a,s,o,l,h,u,d){Fe.fromBufferAttribute(r,h),ze.fromBufferAttribute(r,u),Be.fromBufferAttribute(r,d);const f=t.morphTargetInfluences;if(a&&f){We.set(0,0,0),Ve.set(0,0,0),Xe.set(0,0,0);for(let t=0,e=a.length;t<e;t++){const e=f[t],n=a[t];0!==e&&(He.fromBufferAttribute(n,h),Ge.fromBufferAttribute(n,u),ke.fromBufferAttribute(n,d),s?(We.addScaledVector(He,e),Ve.addScaledVector(Ge,e),Xe.addScaledVector(ke,e)):(We.addScaledVector(He.sub(Fe),e),Ve.addScaledVector(Ge.sub(ze),e),Xe.addScaledVector(ke.sub(Be),e)))}Fe.add(We),ze.add(Ve),Be.add(Xe)}t.isSkinnedMesh&&(t.boneTransform(h,Fe),t.boneTransform(u,ze),t.boneTransform(d,Be));const p=function(t,e,n,i,r,a,s,o){let l;if(l=1===e.side?i.intersectTriangle(s,a,r,!0,o):i.intersectTriangle(r,a,s,2!==e.side,o),null===l)return null;Ke.copy(o),Ke.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Ke);return c<n.near||c>n.far?null:{distance:c,point:Ke.clone(),object:t}}(t,e,n,i,Fe,ze,Be,Ze);if(p){o&&(qe.fromBufferAttribute(o,h),je.fromBufferAttribute(o,u),Ye.fromBufferAttribute(o,d),p.uv=ye.getUV(Ze,Fe,ze,Be,qe,je,Ye,new k)),l&&(qe.fromBufferAttribute(l,h),je.fromBufferAttribute(l,u),Ye.fromBufferAttribute(l,d),p.uv2=ye.getUV(Ze,Fe,ze,Be,qe,je,Ye,new k));const t={a:h,b:u,c:d,normal:new c,materialIndex:0};ye.getNormal(Fe,ze,Be,t.normal),p.face=t}return p}const $e=new d,tn=new d,en=[],nn=new Je;class rn extends Je{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Ot(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const n=this.matrixWorld,i=this.count;if(nn.geometry=this.geometry,nn.material=this.material,void 0!==nn.material)for(let r=0;r<i;r++){this.getMatrixAt(r,$e),tn.multiplyMatrices(n,$e),nn.matrixWorld=tn,nn.raycast(t,en);for(let t=0,n=en.length;t<n;t++){const n=en[t];n.instanceId=r,n.object=this,e.push(n)}en.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Ot(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class an extends Ne{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,a=e/2,s=Math.floor(n),o=Math.floor(i),l=s+1,c=o+1,h=t/s,u=e/o,d=[],f=[],p=[],m=[];for(let t=0;t<c;t++){const e=t*u-a;for(let n=0;n<l;n++){const i=n*h-r;f.push(i,-e,0),p.push(0,0,1),m.push(n/s),m.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<s;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),a=e+1+l*t;d.push(n,i,a),d.push(i,r,a)}this.setIndex(d),this.setAttribute("position",new It(f,3)),this.setAttribute("normal",new It(p,3)),this.setAttribute("uv",new It(m,2))}static fromJSON(t){return new an(t.width,t.height,t.widthSegments,t.heightSegments)}}function sn(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function on(t){const e={};for(let n=0;n<t.length;n++){const i=sn(t[n]);for(const t in i)e[t]=i[t]}return e}const ln={clone:sn,merge:on};class cn extends be{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="\nvoid main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n",this.fragmentShader="\nvoid main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}\n",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=sn(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class hn{constructor(t,e,n=0,i=1/0){this.ray=new ce(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new S,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}intersectObject(t,e=!0,n=[]){return dn(t,this,n,e),n.sort(un),n}intersectObjects(t,e=!0,n=[]){for(let i=0,r=t.length;i<r;i++)dn(t[i],this,n,e);return n.sort(un),n}}function un(t,e){return t.distance-e.distance}function dn(t,e,n,i){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)dn(i[t],e,n,!0)}}class fn extends B{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}const pn=new c,mn=new c,gn=new E;class _n{constructor(t=new c(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=pn.subVectors(n,e).cross(mn.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(pn),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||gn.getNormalMatrix(t),i=this.coplanarPoint(pn).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const vn=new ee,xn=new c;class yn{constructor(t=new _n,e=new _n,n=new _n,i=new _n,r=new _n,a=new _n){this.planes=[t,e,n,i,r,a]}set(t,e,n,i,r,a){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],a=n[2],s=n[3],o=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],f=n[10],p=n[11],m=n[12],g=n[13],_=n[14],v=n[15];return e[0].setComponents(s-i,h-o,p-u,v-m).normalize(),e[1].setComponents(s+i,h+o,p+u,v+m).normalize(),e[2].setComponents(s+r,h+l,p+d,v+g).normalize(),e[3].setComponents(s-r,h-l,p-d,v-g).normalize(),e[4].setComponents(s-a,h-c,p-f,v-_).normalize(),e[5].setComponents(s+a,h+c,p+f,v+_).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),vn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(vn)}intersectsSprite(t){return vn.center.set(0,0,0),vn.radius=.7071067811865476,vn.applyMatrix4(t.matrixWorld),this.intersectsSphere(vn)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)<i)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(xn.x=i.normal.x>0?t.max.x:t.min.x,xn.y=i.normal.y>0?t.max.y:t.min.y,xn.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(xn)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Mn(){let t=null,e=!1,n=null,i=null;function r(e,a){n(e,a),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function bn(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version<e.version)&&i.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const a=i.get(e);void 0===a?i.set(e,function(e,i){const r=e.array,a=e.usage,s=t.createBuffer();let o;if(t.bindBuffer(i,s),t.bufferData(i,r,a),e.onUploadCallback(),r instanceof Float32Array)o=t.FLOAT;else if(r instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");o=t.HALF_FLOAT}else o=t.UNSIGNED_SHORT;else if(r instanceof Int16Array)o=t.SHORT;else if(r instanceof Uint32Array)o=t.UNSIGNED_INT;else if(r instanceof Int32Array)o=t.INT;else if(r instanceof Int8Array)o=t.BYTE;else if(r instanceof Uint8Array)o=t.UNSIGNED_BYTE;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);o=t.UNSIGNED_BYTE}return{buffer:s,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):a.version<e.version&&(function(e,i,r){const a=i.array,s=i.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,a):(n?t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1)}(a.buffer,e,r),a.version=e.version)}}}class Tn extends Ne{constructor(t=1,e=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,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=[],h=[],u=[];let d=0,f=0;function p(t,e,n,i,r,a,p,m,g,_,v){const x=a/g,y=p/_,M=a/2,b=p/2,T=m/2,S=g+1,E=_+1;let w=0,A=0;const R=new c;for(let a=0;a<E;a++){const s=a*y-b;for(let o=0;o<S;o++){const c=o*x-M;R[t]=c*i,R[e]=s*r,R[n]=T,l.push(R.x,R.y,R.z),R[t]=0,R[e]=0,R[n]=m>0?1:-1,h.push(R.x,R.y,R.z),u.push(o/g),u.push(1-a/_),w+=1}}for(let t=0;t<_;t++)for(let e=0;e<g;e++){const n=d+e+S*t,i=d+e+S*(t+1),r=d+(e+1)+S*(t+1),a=d+(e+1)+S*t;o.push(n,i,a),o.push(i,r,a),A+=6}s.addGroup(f,A,v),f+=A,d+=w}p("z","y","x",-1,-1,n,e,t,a,r,0),p("z","y","x",1,-1,n,e,-t,a,r,1),p("x","z","y",1,1,t,n,e,i,a,2),p("x","z","y",1,-1,t,n,-e,i,a,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new It(l,3)),this.setAttribute("normal",new It(h,3)),this.setAttribute("uv",new It(u,2))}static fromJSON(t){return new Tn(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}const Sn={alphamap_fragment:"\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",alphamap_pars_fragment:"\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",alphatest_fragment:"\n#ifdef USE_ALPHATEST\n\n\tif ( diffuseColor.a < alphaTest ) discard;\n\n#endif\n",alphatest_pars_fragment:"\n#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif\n",aomap_fragment:"\n#ifdef USE_AOMAP\n\n\t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\n\t#endif\n\n#endif\n",aomap_pars_fragment:"\n#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif\n",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n\n#ifdef USE_TANGENT\n\n\tvec3 objectTangent = vec3( tangent.xyz );\n\n#endif\n",bsdfs:"\n\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\n\treturn RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n\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\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney’s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\n\tfloat alpha = pow2( roughness ); // UE4's roughness\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\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\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\tfloat D = D_GGX( alpha, dotNH );\n\n\treturn F * ( V * D );\n\n}\n\n#ifdef USE_IRIDESCENCE\n\n\tvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n\n\t\tfloat alpha = pow2( roughness ); // UE4's roughness\n\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\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\n\t\tvec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t\treturn F * ( V * D );\n\n\t}\n\n#endif\n\n// Rect Area Light\n\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\n// code: https://github.com/selfshadow/ltc_code/\n\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\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\n\tfloat dotNV = saturate( dot( N, V ) );\n\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\treturn uv;\n\n}\n\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\n\t// An approximation of the form factor of a horizon-clipped rectangle.\n\n\tfloat l = length( f );\n\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n\n}\n\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\n\tfloat x = dot( v1, v2 );\n\n\tfloat y = abs( x );\n\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\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\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\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\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\n\t// transform rect\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\n\t// project rect onto sphere\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\n\t// calculate vector form factor\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\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see referece)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\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\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat D_Charlie( float roughness, float dotNH ) {\n\n\tfloat alpha = pow2( roughness );\n\n\t// Estevez and Kulla 2017, \"Production Friendly Microfacet Sheen BRDF\"\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\n\t// Neubelt and Pettineo 2013, \"Crafting a Next-gen Material Pipeline for The Order: 1886\"\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n\n}\n\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\n\treturn sheenColor * ( D * V );\n\n}\n\n#endif\n",iridescence_fragment:"\n\n#ifdef USE_IRIDESCENCE\n\n\t// XYZ to linear-sRGB color space\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\n\t// Assume air interface for top\n\t// Note: We don't handle the case fresnel0 == 1\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\n\t}\n\n\t// Conversion FO/IOR\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\n\t}\n\n\t// ior is a value between 1.0 and 3.0. 1.0 is air interface\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\n\t}\n\n\t// Fresnel equations for dielectric/dielectric interfaces.\n\t// Ref: https://belcour.github.io/blog/research/2017/05/01/brdf-thin-film.html\n\t// Evaluation XYZ sensitivity curves in Fourier space\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\n\t}\n\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\n\t\tvec3 I;\n\n\t\t// Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\t// Evaluate the cosTheta on the base layer (Snell law)\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\n\t\t// Handle TIR:\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\n\t\t\t return vec3( 1.0 );\n\n\t\t}\n\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\n\t\t// First interface\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\n\t\t// Second interface\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against 1.0\n\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\n\t\t// Phase shift\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\n\t\t// Compound terms\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\n\t\t// Reflectance term for m = 0 (DC term amplitude)\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\n\t\t// Reflectance term for m > 0 (pairs of diracs)\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\n\t\t}\n\n\t\t// Since out of gamut colors might be produced, negative color values are clamped to 0.\n\t\treturn max( I, vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n",bumpmap_pars_fragment:"\n#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n\t// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm; // normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",clipping_planes_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvec4 plane;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\tbool clipped = true;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\tif ( clipped ) discard;\n\n\t#endif\n\n#endif\n",clipping_planes_pars_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n",clipping_planes_pars_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n#endif\n",clipping_planes_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvClipPosition = - mvPosition.xyz;\n\n#endif\n",color_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tdiffuseColor *= vColor;\n\n#elif defined( USE_COLOR )\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif\n",color_pars_fragment:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_pars_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\n\tvarying vec3 vColor;\n\n#endif\n",color_vertex:"\n#if defined( USE_COLOR_ALPHA )\n\n\tvColor = vec4( 1.0 );\n\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\n\tvColor = vec3( 1.0 );\n\n#endif\n\n#ifdef USE_COLOR\n\n\tvColor *= color;\n\n#endif\n\n#ifdef USE_INSTANCING_COLOR\n\n\tvColor.xyz *= instanceColor.xyz;\n\n#endif\n",common:"\n#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\n#ifndef saturate\n// <tonemapping_pars_fragment> may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\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 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n\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\n\treturn fract( sin( sn ) * c );\n\n}\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\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t// dir can be either a direction vector or a normal vector\n\t// upper-left 3x3 of matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nmat3 transposeMat3( const in mat3 m ) {\n\n\tmat3 tmp;\n\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\n\treturn tmp;\n\n}\n\nfloat luminance( const in vec3 rgb ) {\n\n\t// assumes rgb is in linear color space with sRGB primaries and D65 white point\n\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\n\treturn dot( weights, rgb );\n\n}\n\nbool isPerspectiveMatrix( mat4 m ) {\n\n\treturn m[ 2 ][ 3 ] == - 1.0;\n\n}\n\nvec2 equirectUv( in vec3 dir ) {\n\n\t// dir is assumed to be unit length\n\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\treturn vec2( u, v );\n\n}\n",cube_uv_reflection_fragment:"\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\n\t// These shader functions convert between the UV coordinates of a single face of\n\t// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n\t// sampling a textureCube (not generally normalized ).\n\n\tfloat getFace( vec3 direction ) {\n\n\t\tvec3 absDirection = abs( direction );\n\n\t\tfloat face = - 1.0;\n\n\t\tif ( absDirection.x > absDirection.z ) {\n\n\t\t\tif ( absDirection.x > absDirection.y )\n\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t} else {\n\n\t\t\tif ( absDirection.z > absDirection.y )\n\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t}\n\n\t\treturn face;\n\n\t}\n\n\t// RH coordinate system; PMREM face-indexing convention\n\tvec2 getUV( vec3 direction, float face ) {\n\n\t\tvec2 uv;\n\n\t\tif ( face == 0.0 ) {\n\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x\n\n\t\t} else if ( face == 1.0 ) {\n\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n\n\t\t} else if ( face == 2.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n\n\t\t} else if ( face == 3.0 ) {\n\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n\n\t\t} else if ( face == 4.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n\n\t\t} else {\n\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n\n\t\t}\n\n\t\treturn 0.5 * ( uv + 1.0 );\n\n\t}\n\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\n\t\tfloat face = getFace( direction );\n\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\n\t\tfloat faceSize = exp2( mipInt );\n\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\n\t\tif ( face > 2.0 ) {\n\n\t\t\tuv.y += faceSize;\n\n\t\t\tface -= 3.0;\n\n\t\t}\n\n\t\tuv.x += face * faceSize;\n\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\n\t\t#ifdef texture2DGradEXT\n\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; // disable anisotropic filtering\n\n\t\t#else\n\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\n\t\t#endif\n\n\t}\n\n\t// These defines must match with PMREMGenerator\n\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\n\tfloat roughnessToMip( float roughness ) {\n\n\t\tfloat mip = 0.0;\n\n\t\tif ( roughness >= r1 ) {\n\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\n\t\t} else if ( roughness >= r4 ) {\n\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\n\t\t} else if ( roughness >= r5 ) {\n\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\n\t\t} else if ( roughness >= r6 ) {\n\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\n\t\t} else {\n\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25\n\t\t}\n\n\t\treturn mip;\n\n\t}\n\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\n\t\tfloat mipF = fract( mip );\n\n\t\tfloat mipInt = floor( mip );\n\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\n\t\tif ( mipF == 0.0 ) {\n\n\t\t\treturn vec4( color0, 1.0 );\n\n\t\t} else {\n\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\n\t\t}\n\n\t}\n\n#endif\n",defaultnormal_vertex:"\nvec3 transformedNormal = objectNormal;\n\n#ifdef USE_INSTANCING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// shear transforms in the instance matrix are not supported\n\n\tmat3 m = mat3( instanceMatrix );\n\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\n\ttransformedNormal = m * transformedNormal;\n\n#endif\n\ntransformedNormal = normalMatrix * transformedNormal;\n\n#ifdef FLIP_SIDED\n\n\ttransformedNormal = - transformedNormal;\n\n#endif\n\n#ifdef USE_TANGENT\n\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#ifdef FLIP_SIDED\n\n\t\ttransformedTangent = - transformedTangent;\n\n\t#endif\n\n#endif\n",displacementmap_pars_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n",displacementmap_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n\n#endif\n",emissivemap_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n",emissivemap_pars_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n",encodings_fragment:"\ngl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\n\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\n\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\n\n",envmap_fragment:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvec3 cameraToFrag;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\n\t\t}\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\n\t#else\n\n\t\tvec4 envColor = vec4( 0.0 );\n\n\t#endif\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",envmap_common_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\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\n",envmap_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n\n#endif\n",envmap_pars_vertex:"\n#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n",envmap_physical_pars_fragment:"\n#if defined( USE_ENVMAP )\n\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\n\t\t\t// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n#endif\n",envmap_vertex:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\t}\n\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\n\n\tvFogDepth = - mvPosition.z;\n\n#endif\n",fog_pars_vertex:"\n#ifdef USE_FOG\n\n\tvarying float vFogDepth;\n\n#endif\n",fog_fragment:"\n#ifdef USE_FOG\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n",fog_pars_fragment:"\n#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\n\t#endif\n\n#endif\n",gradientmap_pars_fragment:"\n\n#ifdef USE_GRADIENTMAP\n\n\tuniform sampler2D gradientMap;\n\n#endif\n\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\n\t// dotNL will be from -1.0 to 1.0\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\n\t#ifdef USE_GRADIENTMAP\n\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\n\t#else\n\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\n\t#endif\n\n}\n",lightmap_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n\n#endif\n",lightmap_pars_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif\n",lights_lambert_vertex:"\nvec3 diffuse = vec3( 1.0 );\n\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\n\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\n\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\n\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\n\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n\n#ifdef DOUBLE_SIDED\n\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n\n#endif\n\n#if NUM_POINT_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_SPOT_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_DIR_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_HEMI_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n",lights_pars_begin:"\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\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\n\t// band 2\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\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\treturn irradiance;\n\n}\n\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\n\t\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t\t// page 32, equation 26: E[window1]\n\t\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\t\tif ( cutoffDistance > 0.0 ) {\n\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t\t}\n\n\t\treturn distanceFalloff;\n\n\t#else\n\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n\t\t}\n\n\t\treturn 1.0;\n\n\t#endif\n\n}\n\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n\n}\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\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\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\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\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\n\t\tif ( spotAttenuation > 0.0 ) {\n\n\t\t\tfloat lightDistance = length( lVector );\n\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\n\t\t} else {\n\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n",lights_toon_fragment:"\nToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\n",lights_toon_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct ToonMaterial {\n\n\tvec3 diffuseColor;\n\n};\n\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n\n#define Material_LightProbeLOD( material )\t(0)\n",lights_phong_fragment:"\nBlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"\nvarying vec3 vViewPosition;\n\nstruct BlinnPhongMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\n\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\n\nmaterial.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.\nmaterial.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n\n#ifdef IOR\n\n\t#ifdef SPECULAR\n\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\n\t\t#endif\n\n\t\t#ifdef USE_SPECULARCOLORMAP\n\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\n\t\t#endif\n\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\n\t#else\n\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\n\t#endif\n\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\n\t#ifdef USE_CLEARCOATMAP\n\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\n\t#endif\n\n\tmaterial.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\n\t#ifdef USE_IRIDESCENCEMAP\n\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\n\t#else\n\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\n\t#endif\n\n#endif\n\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheenColor;\n\n\t#ifdef USE_SHEENCOLORMAP\n\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\n\t#endif\n\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\n\t#ifdef USE_SHEENROUGHNESSMAP\n\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\n\t#endif\n\n#endif\n",lights_physical_pars_fragment:'\nstruct PhysicalMaterial {\n\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\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\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\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\n};\n\n// temporary\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\n\n// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from \n// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found\n// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tfloat r2 = roughness * roughness;\n\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\n\treturn saturate( DG * RECIPROCAL_PI );\n\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via \'environmentBRDF\' from "Physically Based Shading on Mobile"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\n\treturn fab;\n\n}\n\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\treturn specularColor * fab.x + specularF90 * fab.y;\n\n}\n\n// Fdez-Agüera\'s "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\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\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\n\t#else\n\n\t\tvec3 Fr = specularColor;\n\n\t#endif\n\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\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\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t}\n\n#endif\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\n\t#else\n\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\n\t#endif\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\n\t#endif\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\n\t#else\n\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\n\t#endif\n\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\n}\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\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n',lights_fragment_begin:"\n/**\n * This is a template that can be used to light a material, it uses pluggable\n * RenderEquations (RE)for specific lighting scenarios.\n *\n * Instructions for use:\n * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n * - If you have defined an RE_IndirectSpecular, you need to also provide a Material_LightProbeLOD. <---- ???\n * - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n *\n * TODO:\n * - Add area light support.\n * - Add sphere light support.\n * - Add diffuse light probe (irradiance cubemap) support.\n */\n\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef USE_CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\n\tif ( material.iridescenceThickness == 0.0 ) {\n\n\t\tmaterial.iridescence = 0.0;\n\n\t} else {\n\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\n\t}\n\n\tif ( material.iridescence > 0.0 ) {\n\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\n\t\t// Iridescence F0 approximation\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\n\t}\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_fragment_maps:"\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\n\t#endif\n\n#endif\n",lights_fragment_end:"\n#if defined( RE_IndirectDiffuse )\n\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n\n#endif\n",logdepthbuf_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\t// Doing a strict comparison with == 1.0 can cause noise artifacts\n\t// on some platforms. See issue #17623.\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n\n#endif\n",logdepthbuf_pars_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n",logdepthbuf_pars_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\n\t#else\n\n\t\tuniform float logDepthBufFC;\n\n\t#endif\n\n#endif\n",logdepthbuf_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\n\t#else\n\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\n\t\t\tgl_Position.z *= gl_Position.w;\n\n\t\t}\n\n\t#endif\n\n#endif\n",map_fragment:"\n#ifdef USE_MAP\n\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// inline sRGB decode (TODO: Remove this code when https://crbug.com/1256340 is solved)\n\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\n\t#endif\n\n\tdiffuseColor *= sampledDiffuseColor;\n\n#endif\n",map_pars_fragment:"\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n",map_particle_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, uv );\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n\n#endif\n",map_particle_pars_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tuniform mat3 uvTransform;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",metalnessmap_fragment:"\nfloat metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tmetalnessFactor *= texelMetalness.b;\n\n#endif\n",metalnessmap_pars_fragment:"\n#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif\n",morphcolor_vertex:"\n#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tvColor *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t#if defined( USE_COLOR_ALPHA )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\n\t\t#elif defined( USE_COLOR )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\n\t\t#endif\n\n\t}\n\n#endif\n",morphnormal_vertex:"\n#ifdef USE_MORPHNORMALS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tobjectNormal *= morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\n\t\t}\n\n\t#else\n\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\n\t#endif\n\n#endif\n",morphtarget_pars_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\tuniform float morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\n\t\t}\n\n\t#else\n\n\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\n\t\t#else\n\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",morphtarget_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\ttransformed *= morphTargetBaseInfluence;\n\n\t#ifdef MORPHTARGETS_TEXTURE\n\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\n\t\t}\n\n\t#else\n\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\n\t\t#ifndef USE_MORPHNORMALS\n\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",normal_fragment_begin:"\nfloat faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n\n#ifdef FLAT_SHADED\n\n\t// Workaround for Adreno GPUs not able to do dFdx( vViewPosition )\n\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#else\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\t#ifdef USE_TANGENT\n\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\n\t\t#endif\n\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n\n// non perturbed normal for clearcoat among others\n\nvec3 geometryNormal = normal;\n\n",normal_fragment_maps:"\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n\t#ifdef FLIP_SIDED\n\n\t\tnormal = - normal;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\tnormal = normalize( normalMatrix * normal );\n\n#elif defined( TANGENTSPACE_NORMALMAP )\n\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tnormal = normalize( vTBN * mapN );\n\n\t#else\n\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\n\t#endif\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n\n#endif\n",normal_pars_fragment:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_pars_vertex:"\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n",normal_vertex:"\n#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n",normalmap_pars_fragment:"\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n#endif\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tuniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\n\t// Normal Mapping Without Precomputed Tangents\n\t// http://www.thetenthplanet.de/archives/1180\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 N = surf_norm; // normalized\n\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\n\t}\n\n#endif\n",clearcoat_normal_fragment_begin:"\n#ifdef USE_CLEARCOAT\n\n\tvec3 clearcoatNormal = geometryNormal;\n\n#endif\n",clearcoat_normal_fragment_maps:"\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\n\t#else\n\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\n\t#endif\n\n#endif\n",clearcoat_pars_fragment:"\n\n#ifdef USE_CLEARCOATMAP\n\n\tuniform sampler2D clearcoatMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform sampler2D clearcoatRoughnessMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n\n#endif\n",iridescence_pars_fragment:"\n\n#ifdef USE_IRIDESCENCEMAP\n\n\tuniform sampler2D iridescenceMap;\n\n#endif\n\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tuniform sampler2D iridescenceThicknessMap;\n\n#endif\n",output_fragment:"\n#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n\n// https://github.com/mrdoob/three.js/pull/22425\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\n\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n",packing:"\nvec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\n\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\n\nconst float ShiftRight8 = 1. / 256.;\n\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8; // tidy overflow\n\treturn r * PackUpscale;\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\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}\n\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\n\n// NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions\n\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\n\n// NOTE: https://twitter.com/gonnavis/status/1377183786949959682\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"\n#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n",project_vertex:"\nvec4 mvPosition = vec4( transformed, 1.0 );\n\n#ifdef USE_INSTANCING\n\n\tmvPosition = instanceMatrix * mvPosition;\n\n#endif\n\nmvPosition = modelViewMatrix * mvPosition;\n\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"\n#ifdef DITHERING\n\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n\n#endif\n",dithering_pars_fragment:"\n#ifdef DITHERING\n\n\t// based on https://www.shadertoy.com/view/MslGR8\n\tvec3 dithering( vec3 color ) {\n\t\t//Calculate grid position\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\n\t\t//modify shift according to grid position.\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\n\t\t//shift the color by dither_shift\n\t\treturn color + dither_shift_RGB;\n\t}\n\n#endif\n",roughnessmap_fragment:"\nfloat roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\troughnessFactor *= texelRoughness.g;\n\n#endif\n",roughnessmap_pars_fragment:"\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n",shadowmap_pars_fragment:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): create uniforms for area light shadows\n\n\t#endif\n\t*/\n\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n\t}\n\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\n\t}\n\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\n\t\tfloat occlusion = 1.0;\n\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\n\t\tfloat hard_shadow = step( compare , distribution.x ); // Hard Shadow\n\n\t\tif (hard_shadow != 1.0 ) {\n\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 ); // Chebeyshevs inequality\n\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed\n\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\n\t\t}\n\t\treturn occlusion;\n\n\t}\n\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\n\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t// if ( all( something, something ) ) using this instead\n\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\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\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\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\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\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#else // no percentage-closer filtering:\n\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#endif\n\n\t\t}\n\n\t\treturn shadow;\n\n\t}\n\n\t// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n\t// vector suitable for 2D texture mapping. This code uses the following layout for the\n\t// 2D texture:\n\t//\n\t// xzXZ\n\t// y Y\n\t//\n\t// Y - Positive y direction\n\t// y - Negative y direction\n\t// X - Positive x direction\n\t// x - Negative x direction\n\t// Z - Positive z direction\n\t// z - Negative z direction\n\t//\n\t// Source and test bed:\n\t// https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\t\t// Number of texels to avoid at the edge of each square\n\n\t\tvec3 absV = abs( v );\n\n\t\t// Intersect unit cube\n\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\n\t\t// Apply scale to avoid seams\n\n\t\t// two texels less per square (one texel will do for NEAREST)\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\t\t// Unwrap\n\n\t\t// space: -1 ... 1 range for each square\n\t\t//\n\t\t// #X##\t\tdim := ( 4 , 2 )\n\t\t// # #\t\tcenter := ( 1 , 1 )\n\n\t\tvec2 planar = v.xy;\n\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\tif ( absV.z >= almostOne ) {\n\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t} else if ( absV.y >= almostOne ) {\n\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\n\t\t}\n\n\t\t// Transform to UV space\n\n\t\t// scale := 0.5 / dim\n\t\t// translate := ( center + 0.5 ) / dim\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t}\n\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// dp = normalized distance from light to fragment position\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\n\t\tdp += shadowBias;\n\n\t\t// bd3D = base direction 3D\n\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\n\t\t#else // no percentage-closer filtering\n\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\n\t\t#endif\n\n\t}\n\n#endif\n",shadowmap_pars_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): uniforms for area light shadows\n\n\t#endif\n\t*/\n\n#endif\n",shadowmap_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\t// Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\n\t#endif\n\t*/\n\n#endif\n",shadowmask_pars_fragment:"\nfloat getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\tDirectionalLightShadow directionalLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\tSpotLightShadow spotLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\tPointLightShadow pointLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update shadow for Area light\n\n\t#endif\n\t*/\n\n\t#endif\n\n\treturn shadow;\n\n}\n",skinbase_vertex:"\n#ifdef USE_SKINNING\n\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\n#endif\n",skinning_pars_vertex:"\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\n\tmat4 getBoneMatrix( const in float i ) {\n\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\n\t\ty = dy * ( y + 0.5 );\n\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\treturn bone;\n\n\t}\n\n#endif\n",skinning_vertex:"\n#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\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\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n",skinnormal_vertex:"\n#ifdef USE_SKINNING\n\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\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n",specularmap_fragment:"\nfloat specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif\n",specularmap_pars_fragment:"\n#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif\n",tonemapping_fragment:"\n#if defined( TONE_MAPPING )\n\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n",tonemapping_pars_fragment:"\n#ifndef saturate\n// <common> may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n\nuniform float toneMappingExposure;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n\treturn toneMappingExposure * color;\n\n}\n\n// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf\nvec3 ReinhardToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\n\t// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\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\n}\n\n// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\nvec3 RRTAndODTFit( vec3 v ) {\n\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\n}\n\n// this implementation of ACES is modified to accommodate a brighter viewing environment.\n// the scale factor of 1/0.6 is subjective. see discussion in #19621.\n\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\n\t// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ), // transposed from source\n\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\n\t// ODT_SAT => XYZ => D60_2_D65 => sRGB\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ), // transposed from source\n\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\n\tcolor *= toneMappingExposure / 0.6;\n\n\tcolor = ACESInputMat * color;\n\n\t// Apply RRT and ODT\n\tcolor = RRTAndODTFit( color );\n\n\tcolor = ACESOutputMat * color;\n\n\t// Clamp to [0, 1]\n\treturn saturate( color );\n\n}\n\nvec3 CustomToneMapping( vec3 color ) { return color; }\n",transmission_fragment:"\n#ifdef USE_TRANSMISSION\n\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\n\t#endif\n\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif\n",transmission_pars_fragment:"\n#ifdef USE_TRANSMISSION\n\n\t// Transmission code is based on glTF-Sampler-Viewer\n\t// https://github.com/KhronosGroup/glTF-Sample-Viewer\n\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tuniform sampler2D transmissionMap;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tuniform sampler2D thicknessMap;\n\n\t#endif\n\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\n\tvarying vec3 vWorldPosition;\n\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\n\t\t// Direction of refracted light.\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\n\t\t// Compute rotation-independant scaling of the model matrix.\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\n\t\t// The thickness is specified in local space.\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\n\t}\n\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\n\t\t// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and\n\t\t// an IOR of 1.5 results in the default amount of microfacet refraction.\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\n\t}\n\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\n\t\t#ifdef texture2DLodEXT\n\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\n\t\t#else\n\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\n\t\t#endif\n\n\t}\n\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tif ( attenuationDistance == 0.0 ) {\n\n\t\t\t// Attenuation distance is +∞ (which we indicate by zero), i.e. the transmitted color is not attenuated at all.\n\t\t\treturn radiance;\n\n\t\t} else {\n\n\t\t\t// Compute light attenuation using Beer's law.\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law\n\t\t\treturn transmittance * radiance;\n\n\t\t}\n\n\t}\n\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 ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\n\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\n\t\t// Get the specular component.\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\n\t}\n#endif\n",uv_pars_fragment:"\n#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\n\tvarying vec2 vUv;\n\n#endif\n",uv_pars_vertex:"\n#ifdef USE_UV\n\n\t#ifdef UVS_VERTEX_ONLY\n\n\t\tvec2 vUv;\n\n\t#else\n\n\t\tvarying vec2 vUv;\n\n\t#endif\n\n\tuniform mat3 uvTransform;\n\n#endif\n",uv_vertex:"\n#ifdef USE_UV\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n#endif\n",uv2_pars_fragment:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif\n",uv2_pars_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n\tuniform mat3 uv2Transform;\n\n#endif\n",uv2_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n\n#endif\n",worldpos_vertex:"\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n\n#endif\n",background_vert:"\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n",background_frag:"\nuniform sampler2D t2D;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tgl_FragColor = texture2D( t2D, vUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// inline sRGB decode (TODO: Remove this code when https://crbug.com/1256340 is solved)\n\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\n\t#endif\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\n}\n",cube_vert:"\nvarying vec3 vWorldDirection;\n\n#include <common>\n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n",cube_frag:"\n#include <envmap_common_pars_fragment>\nuniform float opacity;\n\nvarying vec3 vWorldDirection;\n\n#include <cube_uv_reflection_fragment>\n\nvoid main() {\n\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\n}\n",depth_vert:"\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\n// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.\n// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for\n// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include <uv_vertex>\n\n\t#include <skinbase_vertex>\n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvHighPrecisionZW = gl_Position.zw;\n\n}\n",depth_frag:"\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\n\t#include <logdepthbuf_fragment>\n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#endif\n\n}\n",distanceRGBA_vert:"\n#define DISTANCE\n\nvarying vec3 vWorldPosition;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\n\t#include <skinbase_vertex>\n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvWorldPosition = worldPosition.xyz;\n\n}\n",distanceRGBA_frag:"\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main () {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = packDepthToRGBA( dist );\n\n}\n",equirect_vert:"\nvarying vec3 vWorldDirection;\n\n#include <common>\n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\n}\n",equirect_frag:"\nuniform sampler2D tEquirect;\n\nvarying vec3 vWorldDirection;\n\n#include <common>\n\nvoid main() {\n\n\tvec3 direction = normalize( vWorldDirection );\n\n\tvec2 sampleUV = equirectUv( direction );\n\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\n}\n",linedashed_vert:"\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\tvLineDistance = scale * lineDistance;\n\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\n}\n",linedashed_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\n}\n",meshbasic_vert:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n\n}\n",meshbasic_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include <envmap_fragment>\n\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\n}\n",meshlambert_vert:"\n#define LAMBERT\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\n\t#endif\n\n\t#include <lightmap_fragment>\n\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\n\t#else\n\n\t\treflectedLight.directDiffuse = vLightFront;\n\n\t#endif\n\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\n\t// modulation\n\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include <envmap_fragment>\n\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshmatcap_vert:"\n#define MATCAP\n\nvarying vec3 vViewPosition;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n}\n",meshmatcap_frag:"\n#define MATCAP\n\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\n\nvarying vec3 vViewPosition;\n\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\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; // 0.495 to remove artifacts caused by undersized matcap disks\n\n\t#ifdef USE_MATCAP\n\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\n\t#else\n\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing\n\n\t#endif\n\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\n}\n",meshnormal_vert:"\n#define NORMAL\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvViewPosition = - mvPosition.xyz;\n\n#endif\n\n}\n",meshnormal_frag:"\n#define NORMAL\n\nuniform float opacity;\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\n\t#ifdef OPAQUE\n\n\t\tgl_FragColor.a = 1.0;\n\n\t#endif\n\n}\n",meshphong_vert:"\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n\n}\n",meshphong_frag:"\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\n}\n",meshphysical_vert:"\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n}\n",meshphysical_frag:"\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include <transmission_fragment>\n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n\t#ifdef USE_SHEEN\n\n\t\t// Sheen energy compensation approximation calculation can be found at the end of\n\t\t// https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\n\t#endif\n\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\n}\n",meshtoon_vert:"\n#define TOON\n\nvarying vec3 vViewPosition;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n\n}\n",meshtoon_frag:"\n#define TOON\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\n}\n",points_vert:"\nuniform float size;\nuniform float scale;\n\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\n\tgl_PointSize = size;\n\n\t#ifdef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\n\t#endif\n\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n\n}\n",points_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\n}\n",shadow_vert:"\n#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n\nvoid main() {\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n\n}\n",shadow_frag:"\nuniform vec3 color;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n\nvoid main() {\n\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n",sprite_vert:"\nuniform float rotation;\nuniform vec2 center;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\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\n\t#ifndef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\n\t#endif\n\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\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\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\n}\n",sprite_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n"},En={common:{diffuse:{value:new Rt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new E},uv2Transform:{value:new E},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new k(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Rt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Rt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new E}},sprite:{diffuse:{value:new Rt(16777215)},opacity:{value:1},center:{value:new k(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new E}}},wn={basic:{uniforms:on([En.common,En.specularmap,En.envmap,En.aomap,En.lightmap,En.fog]),vertexShader:Sn.meshbasic_vert,fragmentShader:Sn.meshbasic_frag},lambert:{uniforms:on([En.common,En.specularmap,En.envmap,En.aomap,En.lightmap,En.emissivemap,En.fog,En.lights,{emissive:{value:new Rt(0)}}]),vertexShader:Sn.meshlambert_vert,fragmentShader:Sn.meshlambert_frag},phong:{uniforms:on([En.common,En.specularmap,En.envmap,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.fog,En.lights,{emissive:{value:new Rt(0)},specular:{value:new Rt(1118481)},shininess:{value:30}}]),vertexShader:Sn.meshphong_vert,fragmentShader:Sn.meshphong_frag},standard:{uniforms:on([En.common,En.envmap,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.roughnessmap,En.metalnessmap,En.fog,En.lights,{emissive:{value:new Rt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Sn.meshphysical_vert,fragmentShader:Sn.meshphysical_frag},toon:{uniforms:on([En.common,En.aomap,En.lightmap,En.emissivemap,En.bumpmap,En.normalmap,En.displacementmap,En.gradientmap,En.fog,En.lights,{emissive:{value:new Rt(0)}}]),vertexShader:Sn.meshtoon_vert,fragmentShader:Sn.meshtoon_frag},matcap:{uniforms:on([En.common,En.bumpmap,En.normalmap,En.displacementmap,En.fog,{matcap:{value:null}}]),vertexShader:Sn.meshmatcap_vert,fragmentShader:Sn.meshmatcap_frag},points:{uniforms:on([En.points,En.fog]),vertexShader:Sn.points_vert,fragmentShader:Sn.points_frag},dashed:{uniforms:on([En.common,En.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Sn.linedashed_vert,fragmentShader:Sn.linedashed_frag},depth:{uniforms:on([En.common,En.displacementmap]),vertexShader:Sn.depth_vert,fragmentShader:Sn.depth_frag},normal:{uniforms:on([En.common,En.bumpmap,En.normalmap,En.displacementmap,{opacity:{value:1}}]),vertexShader:Sn.meshnormal_vert,fragmentShader:Sn.meshnormal_frag},sprite:{uniforms:on([En.sprite,En.fog]),vertexShader:Sn.sprite_vert,fragmentShader:Sn.sprite_frag},background:{uniforms:{uvTransform:{value:new E},t2D:{value:null}},vertexShader:Sn.background_vert,fragmentShader:Sn.background_frag},cube:{uniforms:on([En.envmap,{opacity:{value:1}}]),vertexShader:Sn.cube_vert,fragmentShader:Sn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Sn.equirect_vert,fragmentShader:Sn.equirect_frag},distanceRGBA:{uniforms:on([En.common,En.displacementmap,{referencePosition:{value:new c},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Sn.distanceRGBA_vert,fragmentShader:Sn.distanceRGBA_frag},shadow:{uniforms:on([En.lights,En.fog,{color:{value:new Rt(0)},opacity:{value:1}}]),vertexShader:Sn.shadow_vert,fragmentShader:Sn.shadow_frag}};function An(t,e,n,i,r,a){const s=new Rt(0);let o,l,c=!0===r?0:1,h=null,u=0,d=null;function f(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,a)}return{getClearColor:function(){return s},setClearColor:function(t,e=1){s.set(t),c=e,f(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(t){c=t,f(s,c)},render:function(n,r){let a=!1,p=!0===r.isScene?r.background:null;p&&p.isTexture&&(p=e.get(p));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(p=null),null===p?f(s,c):p&&p.isColor&&(f(p,1),a=!0),(t.autoClear||a)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),p&&(p.isCubeTexture||p.mapping===q)?(void 0===l&&(l=new Je(new Tn(1,1,1),new cn({name:"BackgroundCubeMaterial",uniforms:sn(wn.cube.uniforms),vertexShader:wn.cube.vertexShader,fragmentShader:wn.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=p,l.material.uniforms.flipEnvMap.value=p.isCubeTexture&&!1===p.isRenderTargetTexture?-1:1,h===p&&u===p.version&&d===t.toneMapping||(l.material.needsUpdate=!0,h=p,u=p.version,d=t.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null)):p&&p.isTexture&&(void 0===o&&(o=new Je(new an(2,2),new cn({name:"BackgroundMaterial",uniforms:sn(wn.background.uniforms),vertexShader:wn.background.vertexShader,fragmentShader:wn.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.uniforms.t2D.value=p,!0===p.matrixAutoUpdate&&p.updateMatrix(),o.material.uniforms.uvTransform.value.copy(p.matrix),h===p&&u===p.version&&d===t.toneMapping||(o.material.needsUpdate=!0,h=p,u=p.version,d=t.toneMapping),o.layers.enableAll(),n.unshift(o,o.geometry,o.material,0,0,null))}}}function Rn(t,e,n,i){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),a=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||null!==a,o={},l=f(null);let c=l,h=!1;function u(e){return i.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function d(e){return i.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function f(t){const e=[],n=[],i=[];for(let t=0;t<r;t++)e[t]=0,n[t]=0,i[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function p(){const t=c.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function m(t){g(t,0)}function g(n,r){const a=c.newAttributes,s=c.enabledAttributes,o=c.attributeDivisors;a[n]=1,0===s[n]&&(t.enableVertexAttribArray(n),s[n]=1),o[n]!==r&&((i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),o[n]=r)}function _(){const e=c.newAttributes,n=c.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function v(e,n,r,a,s,o){!0!==i.isWebGL2||r!==t.INT&&r!==t.UNSIGNED_INT?t.vertexAttribPointer(e,n,r,a,s,o):t.vertexAttribIPointer(e,n,r,s,o)}function x(){y(),h=!0,c!==l&&(c=l,u(c.object))}function y(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,d,x,y){let M=!1;if(s){const e=function(e,n,r){const s=!0===r.wireframe;let l=o[e.id];void 0===l&&(l={},o[e.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let h=c[s];return void 0===h&&(h=f(i.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),c[s]=h),h}(x,d,l);c!==e&&(c=e,u(c.object)),M=function(t,e,n,i){const r=c.attributes,a=e.attributes;let s=0;const o=n.getAttributes();for(const e in o)if(o[e].location>=0){const n=r[e];let i=a[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;s++}return c.attributesNum!==s||c.index!==i}(r,x,d,y),M&&function(t,e,n,i){const r={},a=e.attributes;let s=0;const o=n.getAttributes();for(const e in o)if(o[e].location>=0){let n=a[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,s++}c.attributes=r,c.attributesNum=s,c.index=i}(r,x,d,y)}else{const t=!0===l.wireframe;c.geometry===x.id&&c.program===d.id&&c.wireframe===t||(c.geometry=x.id,c.program=d.id,c.wireframe=t,M=!0)}null!==y&&n.update(y,t.ELEMENT_ARRAY_BUFFER),(M||h)&&(h=!1,function(r,a,s,o){if(!1===i.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=o.attributes,c=s.getAttributes(),h=a.defaultAttributeValues;for(const e in c){const i=c[e];if(i.location>=0){let a=l[e];if(void 0===a&&("instanceMatrix"===e&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){const e=a.normalized,s=a.itemSize,l=n.get(a);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(a.isInterleavedBufferAttribute){const n=a.data,l=n.stride,d=a.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t<i.locationSize;t++)g(i.location+t,n.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let t=0;t<i.locationSize;t++)m(i.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<i.locationSize;t++)v(i.location+t,s/i.locationSize,h,e,l*u,(d+s/i.locationSize*t)*u)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<i.locationSize;t++)g(i.location+t,a.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<i.locationSize;t++)m(i.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<i.locationSize;t++)v(i.location+t,s/i.locationSize,h,e,s*u,s/i.locationSize*t*u)}}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i.location,n);break;case 3:t.vertexAttrib3fv(i.location,n);break;case 4:t.vertexAttrib4fv(i.location,n);break;default:t.vertexAttrib1fv(i.location,n)}}}}_()}(r,l,d,x),null!==y&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(y).buffer))},reset:x,resetDefaultState:y,dispose:function(){x();for(const t in o){const e=o[t];for(const t in e){const n=e[t];for(const t in n)d(n[t].object),delete n[t];delete e[t]}delete o[t]}},releaseStatesOfGeometry:function(t){if(void 0===o[t.id])return;const e=o[t.id];for(const t in e){const n=e[t];for(const t in n)d(n[t].object),delete n[t];delete e[t]}delete o[t.id]},releaseStatesOfProgram:function(t){for(const e in o){const n=o[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)d(i[t].object),delete i[t];delete n[t.id]}},initAttributes:p,enableAttribute:m,disableUnusedAttributes:_}}function Cn(t,e,n,i){const r=i.isWebGL2;let a;this.setMode=function(t){a=t},this.render=function(e,i){t.drawArrays(a,e,i),n.update(i,a,1)},this.renderInstances=function(i,s,o){if(0===o)return;let l,c;if(r)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](a,i,s,o),n.update(s,a,o)}}function Ln(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const o=r(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=a||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_TEXTURE_SIZE),f=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),m=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),g=t.getParameter(t.MAX_VARYING_VECTORS),_=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=u>0,x=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:v,floatFragmentTextures:x,floatVertexTextures:v&&x,maxSamples:a?t.getParameter(t.MAX_SAMPLES):0}}function Pn(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new _n,o=new E,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const a=null!==t?t.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const e=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=i;e!==a;++e,n+=4)s.copy(t[e]).applyMatrix4(r,o),s.normal.toArray(c,n),c[n+3]=s.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,a){const s=0!==t.length||e||0!==i||r;return r=e,n=h(t,a,0),i=t.length,s},this.beginShadows=function(){a=!0,h(null)},this.endShadows=function(){a=!1,c()},this.setState=function(e,s,o){const u=e.clippingPlanes,d=e.clipIntersection,f=e.clipShadows,p=t.get(e);if(!r||null===u||0===u.length||a&&!f)a?h(null):c();else{const t=a?0:i,e=4*t;let r=p.clippingState||null;l.value=r,r=h(u,s,e,o);for(let t=0;t!==e;++t)r[t]=n[t];p.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}let Dn;wn.physical={uniforms:on([wn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new k(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Rt(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new k},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Rt(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Rt(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Sn.meshphysical_vert,fragmentShader:Sn.meshphysical_frag};class Nn{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Dn&&(Dn=Ee("canvas")),Dn.width=t.width,Dn.height=t.height;const n=Dn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Dn}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Ee("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*vt(r[t]/255);return n.putImageData(i,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*vt(e[t]/255)):e[t]=vt(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}class In{constructor(t=null){this.isSource=!0,this.uuid=i(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(On(i[e].image)):t.push(On(i[e]))}else t=On(i);n.url=t}return e||(t.images[this.uuid]=n),n}}function On(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Nn.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Un=0;class Fn extends y{constructor(t=Fn.DEFAULT_IMAGE,e=Fn.DEFAULT_MAPPING,n=1001,r=1001,a=1006,s=1008,o=1023,l=1009,c=1,h=3e3){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Un++}),this.uuid=i(),this.name="",this.source=new In(t),this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=a,this.minFilter=s,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new k(0,0),this.repeat=new k(1,1),this.center=new k(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new E,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case j:t.x=t.x-Math.floor(t.x);break;case Y:t.x=t.x<0?0:1;break;case Z:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case j:t.y=t.y-Math.floor(t.y);break;case Y:t.y=t.y<0?0:1;break;case Z:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}Fn.DEFAULT_IMAGE=null,Fn.DEFAULT_MAPPING=300;class zn extends y{constructor(t,e,n={}){super(),this.isWebGLRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new G(0,0,t,e),this.scissorTest=!1,this.viewport=new G(0,0,t,e);const i={width:t,height:e,depth:1};this.texture=new Fn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:J,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null,this.samples=void 0!==n.samples?n.samples:0}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new In(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Bn extends B{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new d,this.projectionMatrix=new d,this.projectionMatrixInverse=new d}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class Hn extends Bn{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*n*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*e*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*n*Math.atan(Math.tan(.5*e*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let n=t*Math.tan(.5*e*this.fov)/this.zoom,i=2*n,r=this.aspect*i,a=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,e=s.fullHeight;a+=s.offsetX*r/t,n-=s.offsetY*i/e,r*=s.width/t,i*=s.height/e}const o=this.filmOffset;0!==o&&(a+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+r,n,n-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Gn=90;class kn extends B{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new Hn(Gn,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new c(1,0,0)),this.add(i);const r=new Hn(Gn,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new c(-1,0,0)),this.add(r);const a=new Hn(Gn,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new c(0,1,0)),this.add(a);const s=new Hn(Gn,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new c(0,-1,0)),this.add(s);const o=new Hn(Gn,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new c(0,0,1)),this.add(o);const l=new Hn(Gn,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new c(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,a,s,o,l]=this.children,c=t.getRenderTarget(),h=t.toneMapping,u=t.xr.enabled;t.toneMapping=0,t.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,a),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,o),n.texture.generateMipmaps=d,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(c),t.toneMapping=h,t.xr.enabled=u,n.texture.needsPMREMUpdate=!0}}class Wn extends Fn{constructor(t,e,n,i,r,a,s,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:V,n,i,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Vn extends zn{constructor(t,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new Wn(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:J}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.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 <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\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 <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new Tn(5,5,5),s=new cn({name:"CubemapFromEquirect",uniforms:sn(n),vertexShader:i,fragmentShader:r,side:1,blending:0});s.uniforms.tEquirect.value=e;const o=new Je(a,s),l=e.minFilter;return e.minFilter===Q&&(e.minFilter=J),new kn(1,10,this).update(t,o),e.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}function Xn(t){let e=new WeakMap;function n(t,e){return 303===e?t.mapping=V:304===e&&(t.mapping=X),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const a=r.mapping;if(303===a||304===a){if(e.has(r))return n(e.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const s=new Vn(a.height/2);return s.fromEquirectangularTexture(t,r),e.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}class qn extends Bn{constructor(t=-1,e=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,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=t,this.view.fullHeight=e,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 t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,a=n+t,s=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,s-=e*this.view.offsetY,o=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const jn=[.125,.215,.35,.446,.526,.582],Yn=new qn,Zn=new Rt;let Kn=null;const Jn=(1+Math.sqrt(5))/2,Qn=1/Jn,$n=[new c(1,1,1),new c(-1,1,1),new c(1,1,-1),new c(-1,1,-1),new c(0,Jn,Qn),new c(0,Jn,-Qn),new c(Qn,0,Jn),new c(-Qn,0,Jn),new c(Jn,Qn,0),new c(-Jn,Qn,0)];class ti{constructor(t){this._renderer=t,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(t,e=0,n=.1,i=100){Kn=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=ri(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=ii(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Kn),t.scissorTest=!1,ni(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===V||t.mapping===X?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Kn=this._renderer.getRenderTarget();const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:J,minFilter:J,generateMipmaps:!1,type:nt,format:rt,encoding:ut,depthBuffer:!1},i=ei(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=ei(t,e,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],i=[];let r=t;const a=t-4+1+jn.length;for(let s=0;s<a;s++){const a=Math.pow(2,r);n.push(a);let o=1/a;s>t-4?o=jn[s-t+4-1]:0===s&&(o=0),i.push(o);const l=1/(a-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,f=6,p=3,m=2,g=1,_=new Float32Array(p*f*d),v=new Float32Array(m*f*d),x=new Float32Array(g*f*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];_.set(i,p*f*t),v.set(u,m*f*t);const r=[t,t,t,t,t,t];x.set(r,g*f*t)}const y=new Ne;y.setAttribute("position",new Pt(_,p)),y.setAttribute("uv",new Pt(v,m)),y.setAttribute("faceIndex",new Pt(x,g)),e.push(y),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new c(0,1,0);return new cn({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.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 <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new Je(this._lodPlanes[0],t);this._renderer.compile(e,Yn)}_sceneToCubeUV(t,e,n,i){const r=new Hn(90,1,e,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(Zn),o.toneMapping=0,o.autoClear=!1;const h=new Te({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),u=new Je(new Tn,h);let d=!1;const f=t.background;f?f.isColor&&(h.color.copy(f),t.background=null,d=!0):(h.color.copy(Zn),d=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,a[e],0),r.lookAt(s[e],0,0)):1===n?(r.up.set(0,0,a[e]),r.lookAt(0,s[e],0)):(r.up.set(0,a[e],0),r.lookAt(0,0,s[e]));const l=this._cubeSize;ni(i,n*l,e>2?l:0,l,l),o.setRenderTarget(i),d&&o.render(u,r),o.render(t,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=c,o.autoClear=l,t.background=f}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===V||t.mapping===X;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=ri()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=ii());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Je(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const s=this._cubeSize;ni(e,0,0,3*s,2*s),n.setRenderTarget(e),n.render(a,Yn)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e<this._lodPlanes.length;e++){const n=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),i=$n[(e-1)%$n.length];this._blur(t,e-1,e,n,i)}e.autoClear=n}_blur(t,e,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,i,"latitudinal",r),this._halfBlur(a,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,a,s){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Je(this._lodPlanes[i],l),h=l.uniforms,u=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,f=r/d,p=isFinite(r)?1+Math.floor(3*f):20;p>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<20;++t){const e=t/f,n=Math.exp(-e*e/2);m.push(n),0===t?g+=n:t<p&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;h.envMap.value=t.texture,h.samples.value=p,h.weights.value=m,h.latitudinal.value="latitudinal"===a,s&&(h.poleAxis.value=s);const{_lodMax:_}=this;h.dTheta.value=d,h.mipInt.value=_-n;const v=this._sizeLods[i];ni(e,3*v*(i>_-4?i-_+4:0),4*(this._cubeSize-v),3*v,2*v),o.setRenderTarget(e),o.render(c,Yn)}}function ei(t,e,n){const i=new zn(t,e,n);return i.texture.mapping=q,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ni(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function ii(){return new cn({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 <common>\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 ri(){return new cn({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 ai(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,s=303===a||304===a,o=a===V||a===X;if(s||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=e.get(r);return null===n&&(n=new ti(t)),i=s?n.fromEquirectangular(r,i):n.fromCubemap(r,i),e.set(r,i),i.texture}if(e.has(r))return e.get(r).texture;{const a=r.image;if(s&&a&&a.height>0||o&&a&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(a)){null===n&&(n=new ti(t));const a=s?n.fromEquirectangular(r):n.fromCubemap(r);return e.set(r,a),r.addEventListener("dispose",i),a.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function si(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function oi(t,e,n,i){const r={},a=new WeakMap;function s(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",s),delete r[o.id];const l=a.get(o);l&&(e.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],a=t[e+2];n.push(i,r,r,a,a,i)}}else{const t=r.array;s=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}const o=new(Se(n)?Nt:Dt)(n,1);o.version=s;const l=a.get(t);l&&e.remove(l),a.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,n.memory.geometries++),e},update:function(n){const i=n.attributes;for(const n in i)e.update(i[n],t.ARRAY_BUFFER);const r=n.morphAttributes;for(const n in r){const i=r[n];for(let n=0,r=i.length;n<r;n++)e.update(i[n],t.ARRAY_BUFFER)}},getWireframeAttribute:function(t){const e=a.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&o(t)}else o(t);return a.get(t)}}}function li(t,e,n,i){const r=i.isWebGL2;let a,s,o;this.setMode=function(t){a=t},this.setIndex=function(t){s=t.type,o=t.bytesPerElement},this.render=function(e,i){t.drawElements(a,i,s,e*o),n.update(i,a,1)},this.renderInstances=function(i,l,c){if(0===c)return;let h,u;if(r)h=t,u="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[u](a,l,s,i*o,c),n.update(l,a,c)}}function ci(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}class hi extends Fn{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=K,this.minFilter=K,this.wrapR=Y,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}function ui(t,e){return t[0]-e[0]}function di(t,e){return Math.abs(e[1])-Math.abs(t[1])}function fi(t,e){let n=1;const i=e.isInterleavedBufferAttribute?e.data.array:e.array;i instanceof Int8Array?n=127:i instanceof Uint8Array?n=255:i instanceof Uint16Array?n=65535:i instanceof Int16Array?n=32767:i instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",i),t.divideScalar(n)}function pi(t,e,n){const i={},r=new Float32Array(8),a=new WeakMap,s=new G,o=[];for(let t=0;t<8;t++)o[t]=[t,0];return{update:function(l,c,h,u){const d=l.morphTargetInfluences;if(!0===e.isWebGL2){const f=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,p=void 0!==f?f.length:0;let m=a.get(c);if(void 0===m||m.count!==p){void 0!==m&&m.texture.dispose();const v=void 0!==c.morphAttributes.position,x=void 0!==c.morphAttributes.normal,y=void 0!==c.morphAttributes.color,M=c.morphAttributes.position||[],b=c.morphAttributes.normal||[],T=c.morphAttributes.color||[];let S=0;!0===v&&(S=1),!0===x&&(S=2),!0===y&&(S=3);let E=c.attributes.position.count*S,w=1;E>e.maxTextureSize&&(w=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const A=new Float32Array(E*w*4*p),R=new hi(A,E,w,p);R.type=et,R.needsUpdate=!0;const C=4*S;for(let P=0;P<p;P++){const D=M[P],N=b[P],I=T[P],O=E*w*4*P;for(let U=0;U<D.count;U++){const F=U*C;!0===v&&(s.fromBufferAttribute(D,U),!0===D.normalized&&fi(s,D),A[O+F+0]=s.x,A[O+F+1]=s.y,A[O+F+2]=s.z,A[O+F+3]=0),!0===x&&(s.fromBufferAttribute(N,U),!0===N.normalized&&fi(s,N),A[O+F+4]=s.x,A[O+F+5]=s.y,A[O+F+6]=s.z,A[O+F+7]=0),!0===y&&(s.fromBufferAttribute(I,U),!0===I.normalized&&fi(s,I),A[O+F+8]=s.x,A[O+F+9]=s.y,A[O+F+10]=s.z,A[O+F+11]=4===I.itemSize?s.w:1)}}function L(){R.dispose(),a.delete(c),c.removeEventListener("dispose",L)}m={count:p,texture:R,size:new k(E,w)},a.set(c,m),c.addEventListener("dispose",L)}let g=0;for(let z=0;z<d.length;z++)g+=d[z];const _=c.morphTargetsRelative?1:1-g;u.getUniforms().setValue(t,"morphTargetBaseInfluence",_),u.getUniforms().setValue(t,"morphTargetInfluences",d),u.getUniforms().setValue(t,"morphTargetsTexture",m.texture,n),u.getUniforms().setValue(t,"morphTargetsTextureSize",m.size)}else{const B=void 0===d?0:d.length;let H=i[c.id];if(void 0===H||H.length!==B){H=[];for(let q=0;q<B;q++)H[q]=[q,0];i[c.id]=H}for(let j=0;j<B;j++){const Y=H[j];Y[0]=j,Y[1]=d[j]}H.sort(di);for(let Z=0;Z<8;Z++)Z<B&&H[Z][1]?(o[Z][0]=H[Z][0],o[Z][1]=H[Z][1]):(o[Z][0]=Number.MAX_SAFE_INTEGER,o[Z][1]=0);o.sort(ui);const G=c.morphAttributes.position,W=c.morphAttributes.normal;let V=0;for(let K=0;K<8;K++){const J=o[K],Q=J[0],$=J[1];Q!==Number.MAX_SAFE_INTEGER&&$?(G&&c.getAttribute("morphTarget"+K)!==G[Q]&&c.setAttribute("morphTarget"+K,G[Q]),W&&c.getAttribute("morphNormal"+K)!==W[Q]&&c.setAttribute("morphNormal"+K,W[Q]),r[K]=$,V+=$):(G&&!0===c.hasAttribute("morphTarget"+K)&&c.deleteAttribute("morphTarget"+K),W&&!0===c.hasAttribute("morphNormal"+K)&&c.deleteAttribute("morphNormal"+K),r[K]=0)}const X=c.morphTargetsRelative?1:1-V;u.getUniforms().setValue(t,"morphTargetBaseInfluence",X),u.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function mi(t,e,n,i){let r=new WeakMap;function a(t){const e=t.target;e.removeEventListener("dispose",a),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(s){const o=i.render.frame,l=s.geometry,c=e.get(s,l);return r.get(c)!==o&&(e.update(c),r.set(c,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),n.update(s.instanceMatrix,t.ARRAY_BUFFER),null!==s.instanceColor&&n.update(s.instanceColor,t.ARRAY_BUFFER)),c},dispose:function(){r=new WeakMap}}}class gi extends Fn{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=K,this.minFilter=K,this.wrapR=Y,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const _i=new Fn,vi=new hi,xi=new gi,yi=new Wn,Mi=[],bi=[],Ti=new Float32Array(16),Si=new Float32Array(9),Ei=new Float32Array(4);function wi(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let a=Mi[r];if(void 0===a&&(a=new Float32Array(r),Mi[r]=a),0!==e){i.toArray(a,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(a,r)}return a}function Ai(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Ri(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function Ci(t,e){let n=bi[e];void 0===n&&(n=new Int32Array(e),bi[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Li(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Pi(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Ai(n,e))return;t.uniform2fv(this.addr,e),Ri(n,e)}}function Di(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Ai(n,e))return;t.uniform3fv(this.addr,e),Ri(n,e)}}function Ni(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Ai(n,e))return;t.uniform4fv(this.addr,e),Ri(n,e)}}function Ii(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Ai(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ri(n,e)}else{if(Ai(n,i))return;Ei.set(i),t.uniformMatrix2fv(this.addr,!1,Ei),Ri(n,i)}}function Oi(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Ai(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ri(n,e)}else{if(Ai(n,i))return;Si.set(i),t.uniformMatrix3fv(this.addr,!1,Si),Ri(n,i)}}function Ui(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Ai(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ri(n,e)}else{if(Ai(n,i))return;Ti.set(i),t.uniformMatrix4fv(this.addr,!1,Ti),Ri(n,i)}}function Fi(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function zi(t,e){const n=this.cache;Ai(n,e)||(t.uniform2iv(this.addr,e),Ri(n,e))}function Bi(t,e){const n=this.cache;Ai(n,e)||(t.uniform3iv(this.addr,e),Ri(n,e))}function Hi(t,e){const n=this.cache;Ai(n,e)||(t.uniform4iv(this.addr,e),Ri(n,e))}function Gi(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function ki(t,e){const n=this.cache;Ai(n,e)||(t.uniform2uiv(this.addr,e),Ri(n,e))}function Wi(t,e){const n=this.cache;Ai(n,e)||(t.uniform3uiv(this.addr,e),Ri(n,e))}function Vi(t,e){const n=this.cache;Ai(n,e)||(t.uniform4uiv(this.addr,e),Ri(n,e))}function Xi(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2D(e||_i,r)}function qi(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||xi,r)}function ji(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||yi,r)}function Yi(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||vi,r)}function Zi(t,e){t.uniform1fv(this.addr,e)}function Ki(t,e){const n=wi(e,this.size,2);t.uniform2fv(this.addr,n)}function Ji(t,e){const n=wi(e,this.size,3);t.uniform3fv(this.addr,n)}function Qi(t,e){const n=wi(e,this.size,4);t.uniform4fv(this.addr,n)}function $i(t,e){const n=wi(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function tr(t,e){const n=wi(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function er(t,e){const n=wi(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function nr(t,e){t.uniform1iv(this.addr,e)}function ir(t,e){t.uniform2iv(this.addr,e)}function rr(t,e){t.uniform3iv(this.addr,e)}function ar(t,e){t.uniform4iv(this.addr,e)}function sr(t,e){t.uniform1uiv(this.addr,e)}function or(t,e){t.uniform2uiv(this.addr,e)}function lr(t,e){t.uniform3uiv(this.addr,e)}function cr(t,e){t.uniform4uiv(this.addr,e)}function hr(t,e,n){const i=e.length,r=Ci(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture2D(e[t]||_i,r[t])}function ur(t,e,n){const i=e.length,r=Ci(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture3D(e[t]||xi,r[t])}function dr(t,e,n){const i=e.length,r=Ci(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTextureCube(e[t]||yi,r[t])}function fr(t,e,n){const i=e.length,r=Ci(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture2DArray(e[t]||vi,r[t])}class pr{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Li;case 35664:return Pi;case 35665:return Di;case 35666:return Ni;case 35674:return Ii;case 35675:return Oi;case 35676:return Ui;case 5124:case 35670:return Fi;case 35667:case 35671:return zi;case 35668:case 35672:return Bi;case 35669:case 35673:return Hi;case 5125:return Gi;case 36294:return ki;case 36295:return Wi;case 36296:return Vi;case 35678:case 36198:case 36298:case 36306:case 35682:return Xi;case 35679:case 36299:case 36307:return qi;case 35680:case 36300:case 36308:case 36293:return ji;case 36289:case 36303:case 36311:case 36292:return Yi}}(e.type)}}class mr{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Zi;case 35664:return Ki;case 35665:return Ji;case 35666:return Qi;case 35674:return $i;case 35675:return tr;case 35676:return er;case 5124:case 35670:return nr;case 35667:case 35671:return ir;case 35668:case 35672:return rr;case 35669:case 35673:return ar;case 5125:return sr;case 36294:return or;case 36295:return lr;case 36296:return cr;case 35678:case 36198:case 36298:case 36306:case 35682:return hr;case 35679:case 36299:case 36307:return ur;case 35680:case 36300:case 36308:case 36293:return dr;case 36289:case 36303:case 36311:case 36292:return fr}}(e.type)}}class gr{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const a=i[r];a.setValue(t,e[a.id],n)}}}const _r=/(\w+)(\])?(\[|\.)?/g;function vr(t,e){t.seq.push(e),t.map[e.id]=e}function xr(t,e,n){const i=t.name,r=i.length;for(_r.lastIndex=0;;){const a=_r.exec(i),s=_r.lastIndex;let o=a[1];const l="]"===a[2],c=a[3];if(l&&(o|=0),void 0===c||"["===c&&s+2===r){vr(n,void 0===c?new pr(o,t,e):new mr(o,t,e));break}{let t=n.map[o];void 0===t&&(t=new gr(o),vr(n,t)),n=t}}}class yr{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);xr(n,t.getUniformLocation(e,n.name),this)}}setValue(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,a=e.length;r!==a;++r){const a=e[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n}}function Mr(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}let br=0;function Tr(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const n=t.split("\n"),i=[],r=Math.max(e-6,0),a=Math.min(e+6,n.length);for(let t=r;t<a;t++){const r=t+1;i.push(`${r===e?">":" "} ${r}: ${n[t]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function Sr(t,e){const n=function(t){switch(t){case ut:return["Linear","( value )"];case dt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Er(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function wr(t){return""!==t}function Ar(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Rr(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Cr=/^[ \t]*#include +<([\w\d./]+)>/gm;function Lr(t){return t.replace(Cr,Pr)}function Pr(t,e){const n=Sn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Lr(n)}const Dr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Nr=/#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 Ir(t){return t.replace(Nr,Ur).replace(Dr,Or)}function Or(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ur(0,e,n,i)}function Ur(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Fr(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function zr(t,e,n,i){const r=t.getContext(),a=n.defines;let s=n.vertexShader,o=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case V:case X:e="ENVMAP_TYPE_CUBE";break;case q:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),h=function(t){let e="ENVMAP_MODE_REFLECTION";return t.envMap&&t.envMapMode===X&&(e="ENVMAP_MODE_REFRACTION"),e}(n),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),d=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),f=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(wr).join("\n")}(n),p=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(a),m=r.createProgram();let g,_,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[p].filter(wr).join("\n"),g.length>0&&(g+="\n"),_=[f,p].filter(wr).join("\n"),_.length>0&&(_+="\n")):(g=[Fr(n),"#define SHADER_NAME "+n.shaderName,p,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(wr).join("\n"),_=[f,Fr(n),"#define SHADER_NAME "+n.shaderName,p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Sn.tonemapping_pars_fragment:"",0!==n.toneMapping?Er("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Sn.encodings_pars_fragment,Sr("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(wr).join("\n")),s=Lr(s),s=Ar(s,n),s=Rr(s,n),o=Lr(o),o=Ar(o,n),o=Rr(o,n),s=Ir(s),o=Ir(o),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,_=["#define varying in",n.glslVersion===gt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===gt?"":"#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"+_);const x=v+g+s,y=v+_+o,M=Mr(r,r.VERTEX_SHADER,x),b=Mr(r,r.FRAGMENT_SHADER,y);if(r.attachShader(m,M),r.attachShader(m,b),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(M).trim(),n=r.getShaderInfoLog(b).trim();let i=!0,a=!0;if(!1===r.getProgramParameter(m,r.LINK_STATUS)){i=!1;const e=Tr(r,M,"vertex"),n=Tr(r,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,r.VALIDATE_STATUS)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(a=!1);a&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:_}})}let T,S;return r.deleteShader(M),r.deleteShader(b),this.getUniforms=function(){return void 0===T&&(T=new yr(r,m)),T},this.getAttributes=function(){return void 0===S&&(S=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),a=i.name;let s=1;i.type===t.FLOAT_MAT2&&(s=2),i.type===t.FLOAT_MAT3&&(s=3),i.type===t.FLOAT_MAT4&&(s=4),n[a]={type:i.type,location:t.getAttribLocation(e,a),locationSize:s}}return n}(r,m)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=br++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=M,this.fragmentShader=b,this}let Br=0;class Hr{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;return!1===e.has(t)&&e.set(t,new Set),e.get(t)}_getShaderStage(t){const e=this.shaderCache;if(!1===e.has(t)){const n=new Gr(t);e.set(t,n)}return e.get(t)}}class Gr{constructor(t){this.id=Br++,this.code=t,this.usedTimes=0}}function kr(t,e,n,i,r,a,s){const o=new S,l=new Hr,c=[],h=r.isWebGL2,u=r.logarithmicDepthBuffer,d=r.vertexTextures;let f=r.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};return{getParameters:function(a,o,c,m,g){const _=m.fog,v=g.geometry,x=a.isMeshStandardMaterial?m.environment:null,y=(a.isMeshStandardMaterial?n:e).get(a.envMap||x),M=y&&y.mapping===q?y.image.height:null,b=p[a.type];null!==a.precision&&(f=r.getMaxPrecision(a.precision),f!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead."));const T=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,S=void 0!==T?T.length:0;let E,w,A,R,C=0;if(void 0!==v.morphAttributes.position&&(C=1),void 0!==v.morphAttributes.normal&&(C=2),void 0!==v.morphAttributes.color&&(C=3),b){const t=wn[b];E=t.vertexShader,w=t.fragmentShader}else E=a.vertexShader,w=a.fragmentShader,l.update(a),A=l.getVertexShaderID(a),R=l.getFragmentShaderID(a);const L=t.getRenderTarget(),P=a.alphaTest>0,D=a.clearcoat>0,N=a.iridescence>0;return{isWebGL2:h,shaderID:b,shaderName:a.type,vertexShader:E,fragmentShader:w,defines:a.defines,customVertexShaderID:A,customFragmentShaderID:R,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:d,outputEncoding:null===L?t.outputEncoding:!0===L.isXRRenderTarget?L.texture.encoding:ut,map:!!a.map,matcap:!!a.matcap,envMap:!!y,envMapMode:y&&y.mapping,envMapCubeUVHeight:M,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:0===a.normalMapType,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===dt,clearcoat:D,clearcoatMap:D&&!!a.clearcoatMap,clearcoatRoughnessMap:D&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:D&&!!a.clearcoatNormalMap,iridescence:N,iridescenceMap:N&&!!a.iridescenceMap,iridescenceThicknessMap:N&&!!a.iridescenceThicknessMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&1===a.blending,alphaMap:!!a.alphaMap,alphaTest:P,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!v.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!v.attributes.color&&4===v.attributes.color.itemSize,vertexUvs:!!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatMap||a.clearcoatRoughnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheenColorMap||a.sheenRoughnessMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap||!a.displacementMap),fog:!!_,useFog:!0===a.fog,fogExp2:_&&_.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==v.morphAttributes.position,morphNormals:void 0!==v.morphAttributes.normal,morphColors:void 0!==v.morphAttributes.color,morphTargetsCount:S,morphTextureStride:C,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.length>0,shadowMapType:t.shadowMap.type,toneMapping:a.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:!!a.depthPacking,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0),e.supportsVertexTextures&&o.enable(1),e.instancing&&o.enable(2),e.instancingColor&&o.enable(3),e.map&&o.enable(4),e.matcap&&o.enable(5),e.envMap&&o.enable(6),e.lightMap&&o.enable(7),e.aoMap&&o.enable(8),e.emissiveMap&&o.enable(9),e.bumpMap&&o.enable(10),e.normalMap&&o.enable(11),e.objectSpaceNormalMap&&o.enable(12),e.tangentSpaceNormalMap&&o.enable(13),e.clearcoat&&o.enable(14),e.clearcoatMap&&o.enable(15),e.clearcoatRoughnessMap&&o.enable(16),e.clearcoatNormalMap&&o.enable(17),e.iridescence&&o.enable(18),e.iridescenceMap&&o.enable(19),e.iridescenceThicknessMap&&o.enable(20),e.displacementMap&&o.enable(21),e.specularMap&&o.enable(22),e.roughnessMap&&o.enable(23),e.metalnessMap&&o.enable(24),e.gradientMap&&o.enable(25),e.alphaMap&&o.enable(26),e.alphaTest&&o.enable(27),e.vertexColors&&o.enable(28),e.vertexAlphas&&o.enable(29),e.vertexUvs&&o.enable(30),e.vertexTangents&&o.enable(31),e.uvsVertexOnly&&o.enable(32),e.fog&&o.enable(33),t.push(o.mask),o.disableAll(),e.useFog&&o.enable(0),e.flatShading&&o.enable(1),e.logarithmicDepthBuffer&&o.enable(2),e.skinning&&o.enable(3),e.morphTargets&&o.enable(4),e.morphNormals&&o.enable(5),e.morphColors&&o.enable(6),e.premultipliedAlpha&&o.enable(7),e.shadowMapEnabled&&o.enable(8),e.physicallyCorrectLights&&o.enable(9),e.doubleSided&&o.enable(10),e.flipSided&&o.enable(11),e.useDepthPacking&&o.enable(12),e.dithering&&o.enable(13),e.specularIntensityMap&&o.enable(14),e.specularColorMap&&o.enable(15),e.transmission&&o.enable(16),e.transmissionMap&&o.enable(17),e.thicknessMap&&o.enable(18),e.sheen&&o.enable(19),e.sheenColorMap&&o.enable(20),e.sheenRoughnessMap&&o.enable(21),e.decodeVideoTexture&&o.enable(22),e.opaque&&o.enable(23),t.push(o.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=p[t.type];let n;if(e){const t=wn[e];n=ln.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=c.length;t<e;t++){const e=c[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new zr(t,n,e,a),c.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=c.indexOf(t);c[e]=c[c.length-1],c.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:c,dispose:function(){l.dispose()}}}function Wr(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Vr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Xr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function qr(){const t=[];let e=0;const n=[],i=[],r=[];function a(n,i,r,a,s,o){let l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:s,group:o},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=s,l.group=o),e++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,s,o,l,c){const h=a(t,e,s,o,l,c);s.transmission>0?i.push(h):!0===s.transparent?r.push(h):n.push(h)},unshift:function(t,e,s,o,l,c){const h=a(t,e,s,o,l,c);s.transmission>0?i.unshift(h):!0===s.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n<i;n++){const e=t[n];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){n.length>1&&n.sort(t||Vr),i.length>1&&i.sort(e||Xr),r.length>1&&r.sort(e||Xr)}}}function jr(){let t=new WeakMap;return{get:function(e,n){let i;return!1===t.has(e)?(i=new qr,t.set(e,[i])):n>=t.get(e).length?(i=new qr,t.get(e).push(i)):i=t.get(e)[n],i},dispose:function(){t=new WeakMap}}}function Yr(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new c,color:new Rt};break;case"SpotLight":n={position:new c,direction:new c,color:new Rt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new c,color:new Rt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new c,skyColor:new Rt,groundColor:new Rt};break;case"RectAreaLight":n={color:new Rt,position:new c,halfWidth:new c,halfHeight:new c}}return t[e.id]=n,n}}}let Zr=0;function Kr(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Jr(t,e){const n=new Yr,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new k};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new k,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new c);const a=new c,s=new d,o=new d;return{setup:function(a,s){let o=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,d=0,f=0,p=0,m=0,g=0,_=0;a.sort(Kr);const v=!0!==s?Math.PI:1;for(let t=0,e=a.length;t<e;t++){const e=a[t],s=e.color,x=e.intensity,y=e.distance,M=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=s.r*x*v,l+=s.g*x*v,c+=s.b*x*v;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],x);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*v),e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.directionalShadow[h]=n,r.directionalShadowMap[h]=M,r.directionalShadowMatrix[h]=e.shadow.matrix,m++}r.directional[h]=t,h++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(s).multiplyScalar(x*v),t.distance=y,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.spotShadow[d]=n,r.spotShadowMap[d]=M,r.spotShadowMatrix[d]=e.shadow.matrix,_++}r.spot[d]=t,d++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(s).multiplyScalar(x),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[f]=t,f++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*v),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,r.pointShadow[u]=n,r.pointShadowMap[u]=M,r.pointShadowMatrix[u]=e.shadow.matrix,g++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(x*v),t.groundColor.copy(e.groundColor).multiplyScalar(x*v),r.hemi[p]=t,p++}}f>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=En.LTC_FLOAT_1,r.rectAreaLTC2=En.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=En.LTC_HALF_1,r.rectAreaLTC2=En.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=c;const x=r.hash;x.directionalLength===h&&x.pointLength===u&&x.spotLength===d&&x.rectAreaLength===f&&x.hemiLength===p&&x.numDirectionalShadows===m&&x.numPointShadows===g&&x.numSpotShadows===_||(r.directional.length=h,r.spot.length=d,r.rectArea.length=f,r.point.length=u,r.hemi.length=p,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=_,x.directionalLength=h,x.pointLength=u,x.spotLength=d,x.rectAreaLength=f,x.hemiLength=p,x.numDirectionalShadows=m,x.numPointShadows=g,x.numSpotShadows=_,r.version=Zr++)},setupView:function(t,e){let n=0,i=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),n++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=r.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),c++}else if(d.isPointLight){const t=r.point[i];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),i++}else if(d.isHemisphereLight){const t=r.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),h++}}},state:r}}function Qr(t,e){const n=new Jr(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(t){n.setup(i,t)},setupLightsView:function(t){n.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function $r(t,e){let n=new WeakMap;return{get:function(i,r=0){let a;return!1===n.has(i)?(a=new Qr(t,e),n.set(i,[a])):r>=n.get(i).length?(a=new Qr(t,e),n.get(i).push(a)):a=n.get(i)[r],a},dispose:function(){n=new WeakMap}}}class ta extends be{constructor(t){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(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class ea extends be{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new c,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function na(t,e,n){let i=new yn;const r=new k,a=new k,s=new G,o=new ta({depthPacking:3201}),l=new ea,c={},h=n.maxTextureSize,u={0:1,1:0,2:2},d=new cn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new k},radius:{value:4}},vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}\n",fragmentShader:"\nuniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n\n#include <packing>\n\nvoid main() {\n\n\tconst float samples = float( VSM_SAMPLES );\n\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\n\t// This seems totally useless but it's a crazy work around for a Adreno compiler bug\n\t// float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\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\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\n\t\t#ifdef HORIZONTAL_PASS\n\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\n\t\t#else\n\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\n\t\t#endif\n\n\t}\n\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n\n}\n"}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const p=new Ne;p.setAttribute("position",new Pt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Je(p,d),g=this;function _(n,i){const a=e.update(m);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new zn(r.x,r.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,a,d,m,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,a,f,m,null)}function v(e,n,i,r,a,s){let h=null;const d=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(h=void 0!==d?d:!0===i.isPointLight?l:o,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const t=h.uuid,e=n.uuid;let i=c[t];void 0===i&&(i={},c[t]=i);let r=i[e];void 0===r&&(r=h.clone(),i[e]=r),h=r}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=3===s?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],h.alphaMap=n.alphaMap,h.alphaTest=n.alphaTest,h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.displacementMap=n.displacementMap,h.displacementScale=n.displacementScale,h.displacementBias=n.displacementBias,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===i.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=r,h.farDistance=a),h}function x(n,r,a,s,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,c=e.length;l<c;l++){const c=e[l],h=r[c.materialIndex];if(h&&h.visible){const e=v(n,h,s,a.near,a.far,o);t.renderBufferDirect(a,null,i,e,n,c)}}}else if(r.visible){const e=v(n,r,s,a.near,a.far,o);t.renderBufferDirect(a,null,i,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)x(l[t],r,a,s,o)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,o){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,c=e.length;l<c;l++){const c=e[l],u=c.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const f=u.getFrameExtents();if(r.multiply(f),a.copy(u.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(a.x=Math.floor(h/f.x),r.x=a.x*f.x,u.mapSize.x=a.x),r.y>h&&(a.y=Math.floor(h/f.y),r.y=a.y*f.y,u.mapSize.y=a.y)),null===u.map){const t=3!==this.type?{minFilter:K,magFilter:K}:{};u.map=new zn(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const p=u.getViewportCount();for(let t=0;t<p;t++){const e=u.getViewport(t);s.set(a.x*e.x,a.y*e.y,a.x*e.z,a.y*e.w),d.viewport(s),u.updateMatrices(c,t),i=u.getFrustum(),x(n,o,u.camera,c,this.type)}!0!==u.isPointLightShadow&&3===this.type&&_(u,o),u.needsUpdate=!1}g.needsUpdate=!1,t.setRenderTarget(l,c,u)}}function ia(t,e,n){const i=n.isWebGL2,r=new function(){let e=!1;const n=new G;let i=null;const r=new G(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,a,s,o){!0===o&&(e*=s,i*=s,a*=s),n.set(e,i,a,s),!1===r.equals(n)&&(t.clearColor(e,i,a,s),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},a=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(e){e?H(t.DEPTH_TEST):k(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}else t.depthFunc(t.LEQUAL);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},s=new function(){let e=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null;return{setTest:function(n){e||(n?H(t.STENCIL_TEST):k(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,s){i===e&&r===n&&a===s||(t.stencilFunc(e,n,s),i=e,r=n,a=s)},setOp:function(e,n,i){s===e&&o===n&&l===i||(t.stencilOp(e,n,i),s=e,o=n,l=i)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null}}},o=new WeakMap,l=new WeakMap;let c={},h={},u=new WeakMap,d=[],f=null,p=!1,m=null,g=null,_=null,v=null,x=null,y=null,M=null,b=!1,T=null,S=null,E=null,w=null,A=null;const R=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let C=!1,L=0;const P=t.getParameter(t.VERSION);-1!==P.indexOf("WebGL")?(L=parseFloat(/^WebGL (\d)/.exec(P)[1]),C=L>=1):-1!==P.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),C=L>=2);let D=null,N={};const I=t.getParameter(t.SCISSOR_BOX),O=t.getParameter(t.VIEWPORT),U=(new G).fromArray(I),F=(new G).fromArray(O);function z(e,n,i){const r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let e=0;e<i;e++)t.texImage2D(n+e,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return a}const B={};function H(e){!0!==c[e]&&(t.enable(e),c[e]=!0)}function k(e){!1!==c[e]&&(t.disable(e),c[e]=!1)}B[t.TEXTURE_2D]=z(t.TEXTURE_2D,t.TEXTURE_2D,1),B[t.TEXTURE_CUBE_MAP]=z(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),r.setClear(0,0,0,1),a.setClear(1),s.setClear(0),H(t.DEPTH_TEST),a.setFunc(3),j(!1),Y(1),H(t.CULL_FACE),q(0);const V={[W]:t.FUNC_ADD,101:t.FUNC_SUBTRACT,102:t.FUNC_REVERSE_SUBTRACT};if(i)V[103]=t.MIN,V[104]=t.MAX;else{const t=e.get("EXT_blend_minmax");null!==t&&(V[103]=t.MIN_EXT,V[104]=t.MAX_EXT)}const X={200:t.ZERO,201:t.ONE,202:t.SRC_COLOR,204:t.SRC_ALPHA,210:t.SRC_ALPHA_SATURATE,208:t.DST_COLOR,206:t.DST_ALPHA,203:t.ONE_MINUS_SRC_COLOR,205:t.ONE_MINUS_SRC_ALPHA,209:t.ONE_MINUS_DST_COLOR,207:t.ONE_MINUS_DST_ALPHA};function q(e,n,i,r,a,s,o,l){if(0!==e){if(!1===p&&(H(t.BLEND),p=!0),5===e)a=a||n,s=s||i,o=o||r,n===g&&a===x||(t.blendEquationSeparate(V[n],V[a]),g=n,x=a),i===_&&r===v&&s===y&&o===M||(t.blendFuncSeparate(X[i],X[r],X[s],X[o]),_=i,v=r,y=s,M=o),m=e,b=null;else if(e!==m||l!==b){if(g===W&&x===W||(t.blendEquation(t.FUNC_ADD),g=W,x=W),l)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}_=null,v=null,y=null,M=null,m=e,b=l}}else!0===p&&(k(t.BLEND),p=!1)}function j(e){T!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),T=e)}function Y(e){0!==e?(H(t.CULL_FACE),e!==S&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):k(t.CULL_FACE),S=e}function Z(e,n,i){e?(H(t.POLYGON_OFFSET_FILL),w===n&&A===i||(t.polygonOffset(n,i),w=n,A=i)):k(t.POLYGON_OFFSET_FILL)}function K(e){void 0===e&&(e=t.TEXTURE0+R-1),D!==e&&(t.activeTexture(e),D=e)}return{buffers:{color:r,depth:a,stencil:s},enable:H,disable:k,bindFramebuffer:function(e,n){return h[e]!==n&&(t.bindFramebuffer(e,n),h[e]=n,i&&(e===t.DRAW_FRAMEBUFFER&&(h[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(h[t.DRAW_FRAMEBUFFER]=n)),!0)},drawBuffers:function(i,r){let a=d,s=!1;if(i)if(a=u.get(r),void 0===a&&(a=[],u.set(r,a)),i.isWebGLMultipleRenderTargets){const e=i.texture;if(a.length!==e.length||a[0]!==t.COLOR_ATTACHMENT0){for(let n=0,i=e.length;n<i;n++)a[n]=t.COLOR_ATTACHMENT0+n;a.length=e.length,s=!0}}else a[0]!==t.COLOR_ATTACHMENT0&&(a[0]=t.COLOR_ATTACHMENT0,s=!0);else a[0]!==t.BACK&&(a[0]=t.BACK,s=!0);s&&(n.isWebGL2?t.drawBuffers(a):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(e){return f!==e&&(t.useProgram(e),f=e,!0)},setBlending:q,setMaterial:function(e,n){2===e.side?k(t.CULL_FACE):H(t.CULL_FACE);let i=1===e.side;n&&(i=!i),j(i),1===e.blending&&!1===e.transparent?q(0):q(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),r.setMask(e.colorWrite);const o=e.stencilWrite;s.setTest(o),o&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Z(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?H(t.SAMPLE_ALPHA_TO_COVERAGE):k(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:j,setCullFace:Y,setLineWidth:function(e){e!==E&&(C&&t.lineWidth(e),E=e)},setPolygonOffset:Z,setScissorTest:function(e){e?H(t.SCISSOR_TEST):k(t.SCISSOR_TEST)},activeTexture:K,bindTexture:function(e,n){null===D&&K();let i=N[D];void 0===i&&(i={type:void 0,texture:void 0},N[D]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||B[e]),i.type=e,i.texture=n)},unbindTexture:function(){const e=N[D];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,n){let i=l.get(n);void 0===i&&(i=new WeakMap,l.set(n,i));let r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))},uniformBlockBinding:function(e,n){const i=l.get(n).get(e);o.get(e)!==i&&(t.uniformBlockBinding(n,i,e.__bindingPointIndex),o.set(e,i))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===U.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),U.copy(e))},viewport:function(e){!1===F.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),F.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),!0===i&&(t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),c={},D=null,N={},h={},u=new WeakMap,d=[],f=null,p=!1,m=null,g=null,_=null,v=null,x=null,y=null,M=null,b=!1,T=null,S=null,E=null,w=null,A=null,U.set(0,0,t.canvas.width,t.canvas.height),F.set(0,0,t.canvas.width,t.canvas.height),r.reset(),a.reset(),s.reset()}}}function ra(t,e,n,i,r,a,l){const c=r.isWebGL2,h=r.maxTextures,u=r.maxCubemapSize,d=r.maxTextureSize,f=r.maxSamples,p=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,m=/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap;let _;const v=new WeakMap;let x=!1;try{x="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function y(t,e){return x?new OffscreenCanvas(t,e):Ee("canvas")}function M(t,e,n,i){let r=1;if((t.width>i||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?o:Math.floor,a=i(r*t.width),s=i(r*t.height);void 0===_&&(_=y(a,s));const l=n?y(a,s):_;return l.width=a,l.height=s,l.getContext("2d").drawImage(t,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+s+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function b(t){return s(t.width)&&s(t.height)}function T(t,e){return t.generateMipmaps&&e&&t.minFilter!==K&&t.minFilter!==J}function S(e){t.generateMipmap(e)}function E(n,i,r,a,s=!1){if(!1===c)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;return i===t.RED&&(r===t.FLOAT&&(o=t.R32F),r===t.HALF_FLOAT&&(o=t.R16F),r===t.UNSIGNED_BYTE&&(o=t.R8)),i===t.RG&&(r===t.FLOAT&&(o=t.RG32F),r===t.HALF_FLOAT&&(o=t.RG16F),r===t.UNSIGNED_BYTE&&(o=t.RG8)),i===t.RGBA&&(r===t.FLOAT&&(o=t.RGBA32F),r===t.HALF_FLOAT&&(o=t.RGBA16F),r===t.UNSIGNED_BYTE&&(o=a===dt&&!1===s?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(o=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(o=t.RGB5_A1)),o!==t.R16F&&o!==t.R32F&&o!==t.RG16F&&o!==t.RG32F&&o!==t.RGBA16F&&o!==t.RGBA32F||e.get("EXT_color_buffer_float"),o}function w(t,e,n){return!0===T(t,n)||t.isFramebufferTexture&&t.minFilter!==K&&t.minFilter!==J?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function A(e){return e===K||1004===e||1005===e?t.NEAREST:t.LINEAR}function R(t){const e=t.target;e.removeEventListener("dispose",R),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=v.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&L(t),0===Object.keys(r).length&&v.delete(n)}i.remove(t)}(e),e.isVideoTexture&&g.delete(e)}function C(e){const n=e.target;n.removeEventListener("dispose",C),function(e){const n=e.texture,r=i.get(e),a=i.get(n);if(void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),l.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else{if(t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let e=0;e<r.__webglColorRenderbuffer.length;e++)r.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(r.__webglColorRenderbuffer[e]);r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer)}if(e.isWebGLMultipleRenderTargets)for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),l.memory.textures--),i.remove(n[e])}i.remove(n),i.remove(e)}(n)}function L(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source;delete v.get(r)[n.__cacheKey],l.memory.textures--}let P=0;function D(e,r){const a=i.get(e);if(e.isVideoTexture&&function(t){const e=l.render.frame;g.get(t)!==e&&(g.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&a.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void F(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_2D,a.__webglTexture)}const N={[j]:t.REPEAT,[Y]:t.CLAMP_TO_EDGE,[Z]:t.MIRRORED_REPEAT},I={[K]:t.NEAREST,1004:t.NEAREST_MIPMAP_NEAREST,1005:t.NEAREST_MIPMAP_LINEAR,[J]:t.LINEAR,1007:t.LINEAR_MIPMAP_NEAREST,[Q]:t.LINEAR_MIPMAP_LINEAR};function O(n,a,s){if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,N[a.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,N[a.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,N[a.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,I[a.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,I[a.minFilter])):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),a.wrapS===Y&&a.wrapT===Y||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,t.TEXTURE_MAG_FILTER,A(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,A(a.minFilter)),a.minFilter!==K&&a.minFilter!==J&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(a.type===et&&!1===e.has("OES_texture_float_linear"))return;if(!1===c&&a.type===nt&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function U(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",R));const r=n.source;let a=v.get(r);void 0===a&&(a={},v.set(r,a));const s=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(n);if(s!==e.__cacheKey){void 0===a[s]&&(a[s]={texture:t.createTexture(),usedTimes:0},l.memory.textures++,i=!0),a[s].usedTimes++;const r=a[e.__cacheKey];void 0!==r&&(a[e.__cacheKey].usedTimes--,0===r.usedTimes&&L(n)),e.__cacheKey=s,e.__webglTexture=a[s].texture}return i}function F(e,i,r){let s=t.TEXTURE_2D;i.isDataArrayTexture&&(s=t.TEXTURE_2D_ARRAY),i.isData3DTexture&&(s=t.TEXTURE_3D);const o=U(e,i),l=i.source;if(n.activeTexture(t.TEXTURE0+r),n.bindTexture(s,e.__webglTexture),l.version!==l.__currentVersion||!0===o){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const e=function(t){return!c&&(t.wrapS!==Y||t.wrapT!==Y||t.minFilter!==K&&t.minFilter!==J)}(i)&&!1===b(i.image);let r=M(i.image,e,!1,d);r=W(i,r);const h=b(r)||c,u=a.convert(i.format,i.encoding);let f,p=a.convert(i.type),m=E(i.internalFormat,u,p,i.encoding,i.isVideoTexture);O(s,i,h);const g=i.mipmaps,_=c&&!0!==i.isVideoTexture,v=void 0===l.__currentVersion||!0===o,x=w(i,r,h);if(i.isDepthTexture)m=t.DEPTH_COMPONENT,c?m=i.type===et?t.DEPTH_COMPONENT32F:i.type===tt?t.DEPTH_COMPONENT24:i.type===it?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT16:i.type===et&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===at&&m===t.DEPTH_COMPONENT&&1012!==i.type&&i.type!==tt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=tt,p=a.convert(i.type)),i.format===st&&m===t.DEPTH_COMPONENT&&(m=t.DEPTH_STENCIL,i.type!==it&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=it,p=a.convert(i.type))),v&&(_?n.texStorage2D(t.TEXTURE_2D,1,m,r.width,r.height):n.texImage2D(t.TEXTURE_2D,0,m,r.width,r.height,0,u,p,null));else if(i.isDataTexture)if(g.length>0&&h){_&&v&&n.texStorage2D(t.TEXTURE_2D,x,m,g[0].width,g[0].height);for(let e=0,i=g.length;e<i;e++)f=g[e],_?n.texSubImage2D(t.TEXTURE_2D,e,0,0,f.width,f.height,u,p,f.data):n.texImage2D(t.TEXTURE_2D,e,m,f.width,f.height,0,u,p,f.data);i.generateMipmaps=!1}else _?(v&&n.texStorage2D(t.TEXTURE_2D,x,m,r.width,r.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,r.width,r.height,u,p,r.data)):n.texImage2D(t.TEXTURE_2D,0,m,r.width,r.height,0,u,p,r.data);else if(i.isCompressedTexture){_&&v&&n.texStorage2D(t.TEXTURE_2D,x,m,g[0].width,g[0].height);for(let e=0,r=g.length;e<r;e++)f=g[e],i.format!==rt?null!==u?_?n.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,f.width,f.height,u,f.data):n.compressedTexImage2D(t.TEXTURE_2D,e,m,f.width,f.height,0,f.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?n.texSubImage2D(t.TEXTURE_2D,e,0,0,f.width,f.height,u,p,f.data):n.texImage2D(t.TEXTURE_2D,e,m,f.width,f.height,0,u,p,f.data)}else if(i.isDataArrayTexture)_?(v&&n.texStorage3D(t.TEXTURE_2D_ARRAY,x,m,r.width,r.height,r.depth),n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,r.width,r.height,r.depth,u,p,r.data)):n.texImage3D(t.TEXTURE_2D_ARRAY,0,m,r.width,r.height,r.depth,0,u,p,r.data);else if(i.isData3DTexture)_?(v&&n.texStorage3D(t.TEXTURE_3D,x,m,r.width,r.height,r.depth),n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,r.width,r.height,r.depth,u,p,r.data)):n.texImage3D(t.TEXTURE_3D,0,m,r.width,r.height,r.depth,0,u,p,r.data);else if(i.isFramebufferTexture){if(v)if(_)n.texStorage2D(t.TEXTURE_2D,x,m,r.width,r.height);else{let e=r.width,i=r.height;for(let r=0;r<x;r++)n.texImage2D(t.TEXTURE_2D,r,m,e,i,0,u,p,null),e>>=1,i>>=1}}else if(g.length>0&&h){_&&v&&n.texStorage2D(t.TEXTURE_2D,x,m,g[0].width,g[0].height);for(let e=0,i=g.length;e<i;e++)f=g[e],_?n.texSubImage2D(t.TEXTURE_2D,e,0,0,u,p,f):n.texImage2D(t.TEXTURE_2D,e,m,u,p,f);i.generateMipmaps=!1}else _?(v&&n.texStorage2D(t.TEXTURE_2D,x,m,r.width,r.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,u,p,r)):n.texImage2D(t.TEXTURE_2D,0,m,u,p,r);T(i,h)&&S(s),l.__currentVersion=l.version,i.onUpdate&&i.onUpdate(i)}e.__version=i.version}function z(e,r,s,o,l){const c=a.convert(s.format,s.encoding),h=a.convert(s.type),u=E(s.internalFormat,c,h,s.encoding);i.get(r).__hasExternalTextures||(l===t.TEXTURE_3D||l===t.TEXTURE_2D_ARRAY?n.texImage3D(l,0,u,r.width,r.height,r.depth,0,c,h,null):n.texImage2D(l,0,u,r.width,r.height,0,c,h,null)),n.bindFramebuffer(t.FRAMEBUFFER,e),k(r)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,o,l,i.get(s).__webglTexture,0,G(r)):t.framebufferTexture2D(t.FRAMEBUFFER,o,l,i.get(s).__webglTexture,0),n.bindFramebuffer(t.FRAMEBUFFER,null)}function B(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer){let r=t.DEPTH_COMPONENT16;if(i||k(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===et?r=t.DEPTH_COMPONENT32F:e.type===tt&&(r=t.DEPTH_COMPONENT24));const i=G(n);k(n)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,i,r,n.width,n.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,i,r,n.width,n.height)}else t.renderbufferStorage(t.RENDERBUFFER,r,n.width,n.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)}else if(n.depthBuffer&&n.stencilBuffer){const r=G(n);i&&!1===k(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,n.width,n.height):k(n)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let r=0;r<e.length;r++){const s=e[r],o=a.convert(s.format,s.encoding),l=a.convert(s.type),c=E(s.internalFormat,o,l,s.encoding),h=G(n);i&&!1===k(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,h,c,n.width,n.height):k(n)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,h,c,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,c,n.width,n.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function H(e){const r=i.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),D(r.depthTexture,0);const a=i.get(r.depthTexture).__webglTexture,s=G(r);if(r.depthTexture.format===at)k(r)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0,s):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==st)throw new Error("Unknown depthTexture format");k(r)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0,s):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=t.createRenderbuffer(),B(r.__webglDepthbuffer[i],e,!1)}else n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),B(r.__webglDepthbuffer,e,!1);n.bindFramebuffer(t.FRAMEBUFFER,null)}function G(t){return Math.min(f,t.samples)}function k(t){const n=i.get(t);return c&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function W(t,n){const i=t.encoding,r=t.format,a=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===_t||i!==ut&&(i===dt?!1===c?!0===e.has("EXT_sRGB")&&r===rt?(t.format=_t,t.minFilter=J,t.generateMipmaps=!1):n=Nn.sRGBToLinear(n):r===rt&&a===$||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=function(){const t=P;return t>=h&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+h),P+=1,t},this.resetTextureUnits=function(){P=0},this.setTexture2D=D,this.setTexture2DArray=function(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?F(a,e,r):(n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_2D_ARRAY,a.__webglTexture))},this.setTexture3D=function(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?F(a,e,r):(n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_3D,a.__webglTexture))},this.setTextureCube=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;const s=U(e,i),o=i.source;if(n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture),o.version!==o.__currentVersion||!0===s){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const e=i.isCompressedTexture||i.image[0].isCompressedTexture,r=i.image[0]&&i.image[0].isDataTexture,l=[];for(let t=0;t<6;t++)l[t]=e||r?r?i.image[t].image:i.image[t]:M(i.image[t],!1,!0,u),l[t]=W(i,l[t]);const h=l[0],d=b(h)||c,f=a.convert(i.format,i.encoding),p=a.convert(i.type),m=E(i.internalFormat,f,p,i.encoding),g=c&&!0!==i.isVideoTexture,_=void 0===o.__currentVersion||!0===s;let v,x=w(i,h,d);if(O(t.TEXTURE_CUBE_MAP,i,d),e){g&&_&&n.texStorage2D(t.TEXTURE_CUBE_MAP,x,m,h.width,h.height);for(let e=0;e<6;e++){v=l[e].mipmaps;for(let r=0;r<v.length;r++){const a=v[r];i.format!==rt?null!==f?g?n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,0,0,a.width,a.height,f,a.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,m,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,0,0,a.width,a.height,f,p,a.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,r,m,a.width,a.height,0,f,p,a.data)}}}else{v=i.mipmaps,g&&_&&(v.length>0&&x++,n.texStorage2D(t.TEXTURE_CUBE_MAP,x,m,l[0].width,l[0].height));for(let e=0;e<6;e++)if(r){g?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,l[e].width,l[e].height,f,p,l[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,m,l[e].width,l[e].height,0,f,p,l[e].data);for(let i=0;i<v.length;i++){const r=v[i].image[e].image;g?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,r.width,r.height,f,p,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,m,r.width,r.height,0,f,p,r.data)}}else{g?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,f,p,l[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,m,f,p,l[e]);for(let i=0;i<v.length;i++){const r=v[i];g?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,f,p,r.image[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,m,f,p,r.image[e])}}}T(i,d)&&S(t.TEXTURE_CUBE_MAP),o.__currentVersion=o.version,i.onUpdate&&i.onUpdate(i)}e.__version=i.version}(s,e,r):(n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,s.__webglTexture))},this.rebindTextures=function(e,n,r){const a=i.get(e);void 0!==n&&z(a.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),void 0!==r&&H(e)},this.setupRenderTarget=function(e){const s=e.texture,o=i.get(e),h=i.get(s);e.addEventListener("dispose",C),!0!==e.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=t.createTexture()),h.__version=s.version,l.memory.textures++);const u=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,f=b(e)||c;if(u){o.__webglFramebuffer=[];for(let e=0;e<6;e++)o.__webglFramebuffer[e]=t.createFramebuffer()}else{if(o.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const n=e.texture;for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),l.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(c&&e.samples>0&&!1===k(e)){const i=d?s:[s];o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<i.length;n++){const r=i[n];o.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o.__webglColorRenderbuffer[n]);const s=a.convert(r.format,r.encoding),l=a.convert(r.type),c=E(r.internalFormat,s,l,r.encoding),h=G(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,c,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+n,t.RENDERBUFFER,o.__webglColorRenderbuffer[n])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(o.__webglDepthRenderbuffer=t.createRenderbuffer(),B(o.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(u){n.bindTexture(t.TEXTURE_CUBE_MAP,h.__webglTexture),O(t.TEXTURE_CUBE_MAP,s,f);for(let n=0;n<6;n++)z(o.__webglFramebuffer[n],e,s,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n);T(s,f)&&S(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){const r=e.texture;for(let a=0,s=r.length;a<s;a++){const s=r[a],l=i.get(s);n.bindTexture(t.TEXTURE_2D,l.__webglTexture),O(t.TEXTURE_2D,s,f),z(o.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0+a,t.TEXTURE_2D),T(s,f)&&S(t.TEXTURE_2D)}n.unbindTexture()}else{let i=t.TEXTURE_2D;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(c?i=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(i,h.__webglTexture),O(i,s,f),z(o.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0,i),T(s,f)&&S(i),n.unbindTexture()}e.depthBuffer&&H(e)},this.updateRenderTargetMipmap=function(e){const r=b(e)||c,a=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture];for(let s=0,o=a.length;s<o;s++){const o=a[s];if(T(o,r)){const r=e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=i.get(o).__webglTexture;n.bindTexture(r,a),S(r),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(c&&e.samples>0&&!1===k(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=e.width,s=e.height;let o=t.COLOR_BUFFER_BIT;const l=[],c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=i.get(e),u=!0===e.isWebGLMultipleRenderTargets;if(u)for(let e=0;e<r.length;e++)n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){l.push(t.COLOR_ATTACHMENT0+n),e.depthBuffer&&l.push(c);const d=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;if(!1===d&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),u&&t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[n]),!0===d&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[c]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[c])),u){const e=i.get(r[n]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,a,s,0,0,a,s,o,t.NEAREST),m&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,l)}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),u)for(let e=0;e<r.length;e++){n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const a=i.get(r[e]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,a,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=H,this.setupFrameBufferTexture=z,this.useMultisampledRTT=k}function aa(t,e,n){const i=n.isWebGL2;return{convert:function(n,r=null){let a;if(n===$)return t.UNSIGNED_BYTE;if(1017===n)return t.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return t.UNSIGNED_SHORT_5_5_5_1;if(1010===n)return t.BYTE;if(1011===n)return t.SHORT;if(1012===n)return t.UNSIGNED_SHORT;if(1013===n)return t.INT;if(n===tt)return t.UNSIGNED_INT;if(n===et)return t.FLOAT;if(n===nt)return i?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),null!==a?a.HALF_FLOAT_OES:null);if(1021===n)return t.ALPHA;if(n===rt)return t.RGBA;if(1024===n)return t.LUMINANCE;if(1025===n)return t.LUMINANCE_ALPHA;if(n===at)return t.DEPTH_COMPONENT;if(n===st)return t.DEPTH_STENCIL;if(1028===n)return t.RED;if(1022===n)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),t.RGBA;if(n===_t)return a=e.get("EXT_sRGB"),null!==a?a.SRGB_ALPHA_EXT:null;if(1029===n)return t.RED_INTEGER;if(1030===n)return t.RG;if(1031===n)return t.RG_INTEGER;if(1033===n)return t.RGBA_INTEGER;if(n===ot||n===lt||n===ct||n===ht)if(r===dt){if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===a)return null;if(n===ot)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===lt)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ct)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ht)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(a=e.get("WEBGL_compressed_texture_s3tc"),null===a)return null;if(n===ot)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===lt)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ct)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ht)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===n||35841===n||35842===n||35843===n){if(a=e.get("WEBGL_compressed_texture_pvrtc"),null===a)return null;if(35840===n)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===n)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===n)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===n)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===n)return a=e.get("WEBGL_compressed_texture_etc1"),null!==a?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===n||37496===n){if(a=e.get("WEBGL_compressed_texture_etc"),null===a)return null;if(37492===n)return r===dt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(37808===n||37809===n||37810===n||37811===n||37812===n||37813===n||37814===n||37815===n||37816===n||37817===n||37818===n||37819===n||37820===n||37821===n){if(a=e.get("WEBGL_compressed_texture_astc"),null===a)return null;if(37808===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return r===dt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===n){if(a=e.get("EXT_texture_compression_bptc"),null===a)return null;if(36492===n)return r===dt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===it?i?t.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),null!==a?a.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[n]?t[n]:null}}}class sa extends Hn{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}const oa={type:"move"};class la{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new H,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new H,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new c,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new c),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new H,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new c,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new c),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,a=null;const s=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){a=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const t=new H;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[i.jointName]=t,l.add(t)}const r=l.joints[i.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&s>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),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=e.getPose(t.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),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(oa)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}}class ca extends Fn{constructor(t,e,n,i,r,a,s,o,l,c){if((c=void 0!==c?c:at)!==at&&c!==st)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===at&&(n=tt),void 0===n&&c===st&&(n=it),super(null,i,r,a,s,o,c,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==s?s:K,this.minFilter=void 0!==o?o:K,this.flipY=!1,this.generateMipmaps=!1}}class ha extends y{constructor(t,e){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=null,l=null,h=null,u=null,d=null,f=null;const p=e.getContextAttributes();let m=null,g=null;const _=[],v=[],x=new Hn;x.layers.enable(1),x.viewport=new G;const y=new Hn;y.layers.enable(2),y.viewport=new G;const M=[x,y],b=new sa;b.layers.enable(1),b.layers.enable(2);let T=null,S=null;function E(t){const e=v.indexOf(t.inputSource);if(-1===e)return;const n=_[e];void 0!==n&&n.dispatchEvent({type:t.type,data:t.inputSource})}function w(){i.removeEventListener("select",E),i.removeEventListener("selectstart",E),i.removeEventListener("selectend",E),i.removeEventListener("squeeze",E),i.removeEventListener("squeezestart",E),i.removeEventListener("squeezeend",E),i.removeEventListener("end",w),i.removeEventListener("inputsourceschange",A);for(let t=0;t<_.length;t++){const e=v[t];null!==e&&(v[t]=null,_[t].disconnect(e))}T=null,S=null,t.setRenderTarget(m),d=null,u=null,h=null,i=null,g=null,D.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function A(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=v.indexOf(n);i>=0&&(v[i]=null,_[i].dispatchEvent({type:"disconnected",data:n}))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let i=v.indexOf(n);if(-1===i){for(let t=0;t<_.length;t++){if(t>=v.length){v.push(n),i=t;break}if(null===v[t]){v[t]=n,i=t;break}}if(-1===i)break}const r=_[i];r&&r.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=_[t];return void 0===e&&(e=new la,_[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=_[t];return void 0===e&&(e=new la,_[t]=e),e.getGripSpace()},this.getHand=function(t){let e=_[t];return void 0===e&&(e=new la,_[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){s=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o||a},this.setReferenceSpace=function(t){o=t},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=async function(l){if(i=l,null!==i){if(m=t.getRenderTarget(),i.addEventListener("select",E),i.addEventListener("selectstart",E),i.addEventListener("selectend",E),i.addEventListener("squeeze",E),i.addEventListener("squeezestart",E),i.addEventListener("squeezeend",E),i.addEventListener("end",w),i.addEventListener("inputsourceschange",A),!0!==p.xrCompatible&&await e.makeXRCompatible(),void 0===i.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==i.renderState.layers||p.antialias,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:d}),g=new zn(d.framebufferWidth,d.framebufferHeight,{format:rt,type:$,encoding:t.outputEncoding})}else{let n=null,a=null,s=null;p.depth&&(s=p.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,n=p.stencil?st:at,a=p.stencil?it:tt);const o={colorFormat:e.RGBA8,depthFormat:s,scaleFactor:r};h=new XRWebGLBinding(i,e),u=h.createProjectionLayer(o),i.updateRenderState({layers:[u]}),g=new zn(u.textureWidth,u.textureHeight,{format:rt,type:$,depthTexture:new ca(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:p.stencil,encoding:t.outputEncoding,samples:p.antialias?4:0}),t.properties.get(g).__ignoreDepthValues=u.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(1),o=null,a=await i.requestReferenceSpace(s),D.setContext(i),D.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const R=new c,C=new c;function L(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;b.near=y.near=x.near=t.near,b.far=y.far=x.far=t.far,T===b.near&&S===b.far||(i.updateRenderState({depthNear:b.near,depthFar:b.far}),T=b.near,S=b.far);const e=t.parent,n=b.cameras;L(b,e);for(let t=0;t<n.length;t++)L(n[t],e);b.matrixWorld.decompose(b.position,b.quaternion,b.scale),t.position.copy(b.position),t.quaternion.copy(b.quaternion),t.scale.copy(b.scale),t.matrix.copy(b.matrix),t.matrixWorld.copy(b.matrixWorld);const r=t.children;for(let t=0,e=r.length;t<e;t++)r[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){R.setFromMatrixPosition(e.matrixWorld),C.setFromMatrixPosition(n.matrixWorld);const i=R.distanceTo(C),r=e.projectionMatrix.elements,a=n.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(a[8]+1)/a[0],d=s*h,f=s*u,p=i/(-h+u),m=p*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(p),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=s+p,_=o+p,v=d-m,x=f+(i-m),y=l*o/_*g,M=c*o/_*g;t.projectionMatrix.makePerspective(v,x,y,M,g,_)}(b,x,y):b.projectionMatrix.copy(x.projectionMatrix)},this.getCamera=function(){return b},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==d?d.fixedFoveation:void 0},this.setFoveation=function(t){null!==u&&(u.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)};let P=null;const D=new Mn;D.setAnimationLoop((function(e,n){if(l=n.getViewerPose(o||a),f=n,null!==l){const e=l.views;null!==d&&(t.setRenderTargetFramebuffer(g,d.framebuffer),t.setRenderTarget(g));let n=!1;e.length!==b.cameras.length&&(b.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let a=null;if(null!==d)a=d.getViewport(r);else{const e=h.getViewSubImage(u,r);a=e.viewport,0===i&&(t.setRenderTargetTextures(g,e.colorTexture,u.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(g))}let s=M[i];void 0===s&&(s=new Hn,s.layers.enable(i),s.viewport=new G,M[i]=s),s.matrix.fromArray(r.transform.matrix),s.projectionMatrix.fromArray(r.projectionMatrix),s.viewport.set(a.x,a.y,a.width,a.height),0===i&&b.matrix.copy(s.matrix),!0===n&&b.cameras.push(s)}}for(let t=0;t<_.length;t++){const e=v[t],i=_[t];null!==e&&void 0!==i&&i.update(e,n,o||a)}P&&P(e,n),f=null})),this.setAnimationLoop=function(t){P=t},this.dispose=function(){}}}function ua(t,e){function n(n,i){n.opacity.value=i.opacity,i.color&&n.diffuse.value.copy(i.color),i.emissive&&n.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(n.map.value=i.map),i.alphaMap&&(n.alphaMap.value=i.alphaMap),i.bumpMap&&(n.bumpMap.value=i.bumpMap,n.bumpScale.value=i.bumpScale,1===i.side&&(n.bumpScale.value*=-1)),i.displacementMap&&(n.displacementMap.value=i.displacementMap,n.displacementScale.value=i.displacementScale,n.displacementBias.value=i.displacementBias),i.emissiveMap&&(n.emissiveMap.value=i.emissiveMap),i.normalMap&&(n.normalMap.value=i.normalMap,n.normalScale.value.copy(i.normalScale),1===i.side&&n.normalScale.value.negate()),i.specularMap&&(n.specularMap.value=i.specularMap),i.alphaTest>0&&(n.alphaTest.value=i.alphaTest);const r=e.get(i).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;const e=!0!==t.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*e}let a,s;i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?a=i.map:i.specularMap?a=i.specularMap:i.displacementMap?a=i.displacementMap:i.normalMap?a=i.normalMap:i.bumpMap?a=i.bumpMap:i.roughnessMap?a=i.roughnessMap:i.metalnessMap?a=i.metalnessMap:i.alphaMap?a=i.alphaMap:i.emissiveMap?a=i.emissiveMap:i.clearcoatMap?a=i.clearcoatMap:i.clearcoatNormalMap?a=i.clearcoatNormalMap:i.clearcoatRoughnessMap?a=i.clearcoatRoughnessMap:i.iridescenceMap?a=i.iridescenceMap:i.iridescenceThicknessMap?a=i.iridescenceThicknessMap:i.specularIntensityMap?a=i.specularIntensityMap:i.specularColorMap?a=i.specularColorMap:i.transmissionMap?a=i.transmissionMap:i.thicknessMap?a=i.thicknessMap:i.sheenColorMap?a=i.sheenColorMap:i.sheenRoughnessMap&&(a=i.sheenRoughnessMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uvTransform.value.copy(a.matrix)),i.aoMap?s=i.aoMap:i.lightMap&&(s=i.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uv2Transform.value.copy(s.matrix))}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,a,s){i.isMeshBasicMaterial||i.isMeshLambertMaterial?n(t,i):i.isMeshToonMaterial?(n(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,i)):i.isMeshPhongMaterial?(n(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,i)):i.isMeshStandardMaterial?(n(t,i),function(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap),e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}(t,i),i.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap)),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate())),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap)),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,i,s)):i.isMeshMatcapMaterial?(n(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,i)):i.isMeshDepthMaterial?n(t,i):i.isMeshDistanceMaterial?(n(t,i),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?n(t,i):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){let r;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?r=e.map:e.alphaMap&&(r=e.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,a):i.isSpriteMaterial?function(t,e){let n;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?n=e.map:e.alphaMap&&(n=e.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function da(t,e,n,i){let r={},a={},s=[];const o=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(t,e,n){const i=t.value;if(void 0===n[e])return n[e]="number"==typeof i?i:i.clone(),!0;if("number"==typeof i){if(n[e]!==i)return n[e]=i,!0}else{const t=n[e];if(!1===t.equals(i))return t.copy(i),!0}return!1}function c(t){const e=t.value,n={boundary:0,storage:0};return"number"==typeof e?(n.boundary=4,n.storage=4):e.isVector2?(n.boundary=8,n.storage=8):e.isVector3||e.isColor?(n.boundary=16,n.storage=12):e.isVector4?(n.boundary=16,n.storage=16):e.isMatrix3?(n.boundary=48,n.storage=48):e.isMatrix4?(n.boundary=64,n.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),n}function h(e){const n=e.target;n.removeEventListener("dispose",h);const i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,u){let d=r[n.id];void 0===d&&(function(t){const e=t.uniforms;let n=0;let i=0;for(let t=0,r=e.length;t<r;t++){const r=e[t],a=c(r);if(r.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),r.__offset=n,t>0){i=n%16;const t=16-i;0!==i&&t-a.boundary<0&&(n+=16-i,r.__offset=n)}n+=a.storage}i=n%16,i>0&&(n+=16-i),t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t<o;t++)if(-1===s.indexOf(t))return s.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=n;const i=t.createBuffer(),r=e.__size,a=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,a),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",h));const f=u.program;i.updateUBOMapping(n,f);const p=e.render.frame;a[n.id]!==p&&(function(e){const n=r[e.id],i=e.uniforms,a=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(let e=0,n=i.length;e<n;e++){const n=i[e];if(!0===l(n,e,a)){const e=n.value,i=n.__offset;"number"==typeof e?(n.__data[0]=e,t.bufferSubData(t.UNIFORM_BUFFER,i,n.__data)):(n.value.isMatrix3?(n.__data[0]=n.value.elements[0],n.__data[1]=n.value.elements[1],n.__data[2]=n.value.elements[2],n.__data[3]=n.value.elements[0],n.__data[4]=n.value.elements[3],n.__data[5]=n.value.elements[4],n.__data[6]=n.value.elements[5],n.__data[7]=n.value.elements[0],n.__data[8]=n.value.elements[6],n.__data[9]=n.value.elements[7],n.__data[10]=n.value.elements[8],n.__data[11]=n.value.elements[0]):e.toArray(n.__data),t.bufferSubData(t.UNIFORM_BUFFER,i,n.__data))}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);s=[],r={},a={}}}}function fa(t={}){this.isWebGLRenderer=!0;const e=void 0!==t.canvas?t.canvas:function(){const t=Ee("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,i=void 0===t.depth||t.depth,r=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,h=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let f;f=null!==n?n.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let p=null,m=null;const g=[],_=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ut,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const v=this;let x=!1,y=0,M=0,b=null,T=-1,S=null;const E=new G,w=new G;let A=null,R=e.width,C=e.height,L=1,P=null,D=null;const N=new G(0,0,R,C),I=new G(0,0,R,C);let O=!1;const U=new yn;let F=!1,z=!1,B=null;const H=new d,W=new k,V=new c,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return null===b?L:1}let j,Y,Z,K,J,tt,it,at,st,ot,lt,ct,ht,dt,ft,pt,mt,gt,_t,vt,xt,yt,Mt,bt,Tt=n;function St(t,n){for(let i=0;i<t.length;i++){const r=t[i],a=e.getContext(r,n);if(null!==a)return a}return null}try{const t={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r143"),e.addEventListener("webglcontextlost",At,!1),e.addEventListener("webglcontextrestored",Rt,!1),e.addEventListener("webglcontextcreationerror",Ct,!1),null===Tt){const e=["webgl2","webgl","experimental-webgl"];if(!0===v.isWebGL1Renderer&&e.shift(),Tt=St(e,t),null===Tt)throw St(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===Tt.getShaderPrecisionFormat&&(Tt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Et(){j=new si(Tt),Y=new Ln(Tt,j,t),j.init(Y),yt=new aa(Tt,j,Y),Z=new ia(Tt,j,Y),K=new ci(Tt),J=new Wr,tt=new ra(Tt,j,Z,J,Y,yt,K),it=new Xn(v),at=new ai(v),st=new bn(Tt,Y),Mt=new Rn(Tt,j,st,Y),ot=new oi(Tt,st,K,Mt),lt=new mi(Tt,ot,st,K),_t=new pi(Tt,Y,tt),pt=new Pn(J),ct=new kr(v,it,at,j,Y,Mt,pt),ht=new ua(v,J),dt=new jr,ft=new $r(j,Y),gt=new An(v,it,Z,lt,f,s),mt=new na(v,lt,Y),bt=new da(Tt,K,Y,Z),vt=new Cn(Tt,j,K,Y),xt=new li(Tt,j,K,Y),K.programs=ct.programs,v.capabilities=Y,v.extensions=j,v.properties=J,v.renderLists=dt,v.shadowMap=mt,v.state=Z,v.info=K}Et();const wt=new ha(v,Tt);function At(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function Rt(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;const t=K.autoReset,e=mt.enabled,n=mt.autoUpdate,i=mt.needsUpdate,r=mt.type;Et(),K.autoReset=t,mt.enabled=e,mt.autoUpdate=n,mt.needsUpdate=i,mt.type=r}function Ct(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Lt(t){const e=t.target;e.removeEventListener("dispose",Lt),function(t){(function(t){const e=J.get(t).programs;void 0!==e&&(e.forEach((function(t){ct.releaseProgram(t)})),t.isShaderMaterial&&ct.releaseShaderCache(t))})(t),J.remove(t)}(e)}this.xr=wt,this.getContext=function(){return Tt},this.getContextAttributes=function(){return Tt.getContextAttributes()},this.forceContextLoss=function(){const t=j.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=j.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(t){void 0!==t&&(L=t,this.setSize(R,C,!1))},this.getSize=function(t){return t.set(R,C)},this.setSize=function(t,n,i){wt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(R=t,C=n,e.width=Math.floor(t*L),e.height=Math.floor(n*L),!1!==i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(R*L,C*L).floor()},this.setDrawingBufferSize=function(t,n,i){R=t,C=n,L=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(E)},this.getViewport=function(t){return t.copy(N)},this.setViewport=function(t,e,n,i){t.isVector4?N.set(t.x,t.y,t.z,t.w):N.set(t,e,n,i),Z.viewport(E.copy(N).multiplyScalar(L).floor())},this.getScissor=function(t){return t.copy(I)},this.setScissor=function(t,e,n,i){t.isVector4?I.set(t.x,t.y,t.z,t.w):I.set(t,e,n,i),Z.scissor(w.copy(I).multiplyScalar(L).floor())},this.getScissorTest=function(){return O},this.setScissorTest=function(t){Z.setScissorTest(O=t)},this.setOpaqueSort=function(t){P=t},this.setTransparentSort=function(t){D=t},this.getClearColor=function(t){return t.copy(gt.getClearColor())},this.setClearColor=function(){gt.setClearColor.apply(gt,arguments)},this.getClearAlpha=function(){return gt.getClearAlpha()},this.setClearAlpha=function(){gt.setClearAlpha.apply(gt,arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;t&&(i|=Tt.COLOR_BUFFER_BIT),e&&(i|=Tt.DEPTH_BUFFER_BIT),n&&(i|=Tt.STENCIL_BUFFER_BIT),Tt.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(){e.removeEventListener("webglcontextlost",At,!1),e.removeEventListener("webglcontextrestored",Rt,!1),e.removeEventListener("webglcontextcreationerror",Ct,!1),dt.dispose(),ft.dispose(),J.dispose(),it.dispose(),at.dispose(),lt.dispose(),Mt.dispose(),bt.dispose(),ct.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",Dt),wt.removeEventListener("sessionend",Nt),B&&(B.dispose(),B=null),It.stop()},this.renderBufferDirect=function(t,e,n,i,r,a){null===e&&(e=X);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,n,i,r){!0!==e.isScene&&(e=X),tt.resetTextureUnits();const a=e.fog,s=i.isMeshStandardMaterial?e.environment:null,o=null===b?v.outputEncoding:!0===b.isXRRenderTarget?b.texture.encoding:ut,l=(i.isMeshStandardMaterial?at:it).get(i.envMap||s),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!i.normalMap&&!!n.attributes.tangent,u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,p=i.toneMapped?v.toneMapping:0,g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=void 0!==g?g.length:0,x=J.get(i),y=m.state.lights;if(!0===F&&(!0===z||t!==S)){const e=t===S&&i.id===T;pt.setState(i,t,e)}let M=!1;i.version===x.__version?x.needsLights&&x.lightsStateVersion!==y.state.version||x.outputEncoding!==o||r.isInstancedMesh&&!1===x.instancing?M=!0:r.isInstancedMesh||!0!==x.instancing?r.isSkinnedMesh&&!1===x.skinning?M=!0:r.isSkinnedMesh||!0!==x.skinning?x.envMap!==l||!0===i.fog&&x.fog!==a?M=!0:void 0===x.numClippingPlanes||x.numClippingPlanes===pt.numPlanes&&x.numIntersection===pt.numIntersection?(x.vertexAlphas!==c||x.vertexTangents!==h||x.morphTargets!==u||x.morphNormals!==d||x.morphColors!==f||x.toneMapping!==p||!0===Y.isWebGL2&&x.morphTargetsCount!==_)&&(M=!0):M=!0:M=!0:M=!0:(M=!0,x.__version=i.version);let E=x.currentProgram;!0===M&&(E=Bt(i,e,r));let w=!1,A=!1,R=!1;const P=E.getUniforms(),D=x.uniforms;if(Z.useProgram(E.program)&&(w=!0,A=!0,R=!0),i.id!==T&&(T=i.id,A=!0),w||S!==t){if(P.setValue(Tt,"projectionMatrix",t.projectionMatrix),Y.logarithmicDepthBuffer&&P.setValue(Tt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),S!==t&&(S=t,A=!0,R=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=P.map.cameraPosition;void 0!==e&&e.setValue(Tt,V.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&P.setValue(Tt,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||r.isSkinnedMesh)&&P.setValue(Tt,"viewMatrix",t.matrixWorldInverse)}if(r.isSkinnedMesh){P.setOptional(Tt,r,"bindMatrix"),P.setOptional(Tt,r,"bindMatrixInverse");const t=r.skeleton;t&&(Y.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),P.setValue(Tt,"boneTexture",t.boneTexture,tt),P.setValue(Tt,"boneTextureSize",t.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const N=n.morphAttributes;var I,O;if((void 0!==N.position||void 0!==N.normal||void 0!==N.color&&!0===Y.isWebGL2)&&_t.update(r,n,i,E),(A||x.receiveShadow!==r.receiveShadow)&&(x.receiveShadow=r.receiveShadow,P.setValue(Tt,"receiveShadow",r.receiveShadow)),A&&(P.setValue(Tt,"toneMappingExposure",v.toneMappingExposure),x.needsLights&&(O=R,(I=D).ambientLightColor.needsUpdate=O,I.lightProbe.needsUpdate=O,I.directionalLights.needsUpdate=O,I.directionalLightShadows.needsUpdate=O,I.pointLights.needsUpdate=O,I.pointLightShadows.needsUpdate=O,I.spotLights.needsUpdate=O,I.spotLightShadows.needsUpdate=O,I.rectAreaLights.needsUpdate=O,I.hemisphereLights.needsUpdate=O),a&&!0===i.fog&&ht.refreshFogUniforms(D,a),ht.refreshMaterialUniforms(D,i,L,C,B),yr.upload(Tt,x.uniformsList,D,tt)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(yr.upload(Tt,x.uniformsList,D,tt),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&P.setValue(Tt,"center",r.center),P.setValue(Tt,"modelViewMatrix",r.modelViewMatrix),P.setValue(Tt,"normalMatrix",r.normalMatrix),P.setValue(Tt,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e<n;e++)if(Y.isWebGL2){const n=t[e];bt.update(n,E),bt.bind(n,E)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return E}(t,e,n,i,r);Z.setMaterial(i,s);let l=n.index;const c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let h,u=1;!0===i.wireframe&&(l=ot.getWireframeAttribute(n),u=2),Mt.setup(r,i,o,n,l);let d=vt;null!==l&&(h=st.get(l),d=xt,d.setIndex(h));const f=null!==l?l.count:c.count,p=n.drawRange.start*u,g=n.drawRange.count*u,_=null!==a?a.start*u:0,x=null!==a?a.count*u:1/0,y=Math.max(p,_),M=Math.min(f,p+g,_+x)-1,E=Math.max(0,M-y+1);if(0!==E){if(r.isMesh)!0===i.wireframe?(Z.setLineWidth(i.wireframeLinewidth*q()),d.setMode(Tt.LINES)):d.setMode(Tt.TRIANGLES);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),Z.setLineWidth(t*q()),r.isLineSegments?d.setMode(Tt.LINES):r.isLineLoop?d.setMode(Tt.LINE_LOOP):d.setMode(Tt.LINE_STRIP)}else r.isPoints?d.setMode(Tt.POINTS):r.isSprite&&d.setMode(Tt.TRIANGLES);if(r.isInstancedMesh)d.renderInstances(y,E,r.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,E,t)}else d.render(y,E)}},this.compile=function(t,e){m=ft.get(t),m.init(),_.push(m),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(m.pushLight(t),t.castShadow&&m.pushShadow(t))})),m.setupLights(v.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let i=0;i<n.length;i++)Bt(n[i],t,e);else Bt(n,t,e)})),_.pop(),m=null};let Pt=null;function Dt(){It.stop()}function Nt(){It.start()}const It=new Mn;function Ot(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)m.pushLight(t),t.castShadow&&m.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||U.intersectsSprite(t)){i&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=lt.update(t),r=t.material;r.visible&&p.push(t,e,r,n,V.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==K.render.frame&&(t.skeleton.update(),t.skeleton.frame=K.render.frame),!t.frustumCulled||U.intersectsObject(t))){i&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=lt.update(t),r=t.material;if(Array.isArray(r)){const i=e.groups;for(let a=0,s=i.length;a<s;a++){const s=i[a],o=r[s.materialIndex];o&&o.visible&&p.push(t,e,o,n,V.z,s)}}else r.visible&&p.push(t,e,r,n,V.z,null)}const r=t.children;for(let t=0,a=r.length;t<a;t++)Ot(r[t],e,n,i)}function Ut(t,e,n,i){const r=t.opaque,s=t.transmissive,l=t.transparent;m.setupLightsView(n),s.length>0&&function(t,e,n){const i=Y.isWebGL2;null===B&&(B=new zn(1,1,{generateMipmaps:!0,type:j.has("EXT_color_buffer_half_float")?nt:$,minFilter:Q,samples:i&&!0===a?4:0})),v.getDrawingBufferSize(W),i?B.setSize(W.x,W.y):B.setSize(o(W.x),o(W.y));const r=v.getRenderTarget();v.setRenderTarget(B),v.clear();const s=v.toneMapping;v.toneMapping=0,Ft(t,e,n),v.toneMapping=s,tt.updateMultisampleRenderTarget(B),tt.updateRenderTargetMipmap(B),v.setRenderTarget(r)}(r,e,n),i&&Z.viewport(E.copy(i)),r.length>0&&Ft(r,e,n),s.length>0&&Ft(s,e,n),l.length>0&&Ft(l,e,n),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Ft(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=a.object,o=a.geometry,l=null===i?a.material:i,c=a.group;s.layers.test(n.layers)&&zt(s,e,n,o,l,c)}}function zt(t,e,n,i,r,a){t.onBeforeRender(v,e,n,i,r,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(v,e,n,i,t,a),!0===r.transparent&&2===r.side?(r.side=1,r.needsUpdate=!0,v.renderBufferDirect(n,e,i,r,t,a),r.side=0,r.needsUpdate=!0,v.renderBufferDirect(n,e,i,r,t,a),r.side=2):v.renderBufferDirect(n,e,i,r,t,a),t.onAfterRender(v,e,n,i,r,a)}function Bt(t,e,n){!0!==e.isScene&&(e=X);const i=J.get(t),r=m.state.lights,a=m.state.shadowsArray,s=r.state.version,o=ct.getParameters(t,r.state,a,e,n),l=ct.getProgramCacheKey(o);let c=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?at:it).get(t.envMap||i.environment),void 0===c&&(t.addEventListener("dispose",Lt),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===s)return Ht(t,o),h}else o.uniforms=ct.getUniforms(t),t.onBuild(n,o,v),t.onBeforeCompile(o,v),h=ct.acquireProgram(o,l),c.set(l,h),i.uniforms=o.uniforms;const u=i.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=pt.uniform),Ht(t,o),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=s,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix);const d=h.getUniforms(),f=yr.seqWithValue(d.seq,u);return i.currentProgram=h,i.uniformsList=f,h}function Ht(t,e){const n=J.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}It.setAnimationLoop((function(t){Pt&&Pt(t)})),"undefined"!=typeof self&&It.setContext(self),this.setAnimationLoop=function(t){Pt=t,wt.setAnimationLoop(t),null===t?It.stop():It.start()},wt.addEventListener("sessionstart",Dt),wt.addEventListener("sessionend",Nt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===x)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===wt.enabled&&!0===wt.isPresenting&&(!0===wt.cameraAutoUpdate&&wt.updateCamera(e),e=wt.getCamera()),!0===t.isScene&&t.onBeforeRender(v,t,e,b),m=ft.get(t,_.length),m.init(),_.push(m),H.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),U.setFromProjectionMatrix(H),z=this.localClippingEnabled,F=pt.init(this.clippingPlanes,z,e),p=dt.get(t,g.length),p.init(),g.push(p),Ot(t,e,0,v.sortObjects),p.finish(),!0===v.sortObjects&&p.sort(P,D),!0===F&&pt.beginShadows();const n=m.state.shadowsArray;if(mt.render(n,t,e),!0===F&&pt.endShadows(),!0===this.info.autoReset&&this.info.reset(),gt.render(p,t),m.setupLights(v.physicallyCorrectLights),e.isArrayCamera){const n=e.cameras;for(let e=0,i=n.length;e<i;e++){const i=n[e];Ut(p,t,i,i.viewport)}}else Ut(p,t,e);null!==b&&(tt.updateMultisampleRenderTarget(b),tt.updateRenderTargetMipmap(b)),!0===t.isScene&&t.onAfterRender(v,t,e),Mt.resetDefaultState(),T=-1,S=null,_.pop(),m=_.length>0?_[_.length-1]:null,g.pop(),p=g.length>0?g[g.length-1]:null},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(t,e,n){J.get(t.texture).__webglTexture=e,J.get(t.depthTexture).__webglTexture=n;const i=J.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===j.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(t,e){const n=J.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){b=t,y=e,M=n;let i=!0;if(t){const e=J.get(t);void 0!==e.__useDefaultFramebuffer?(Z.bindFramebuffer(Tt.FRAMEBUFFER,null),i=!1):void 0===e.__webglFramebuffer?tt.setupRenderTarget(t):e.__hasExternalTextures&&tt.rebindTextures(t,J.get(t.texture).__webglTexture,J.get(t.depthTexture).__webglTexture)}let r=null,a=!1,s=!1;if(t){const n=t.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(s=!0);const i=J.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=i[e],a=!0):r=Y.isWebGL2&&t.samples>0&&!1===tt.useMultisampledRTT(t)?J.get(t).__webglMultisampledFramebuffer:i,E.copy(t.viewport),w.copy(t.scissor),A=t.scissorTest}else E.copy(N).multiplyScalar(L).floor(),w.copy(I).multiplyScalar(L).floor(),A=O;if(Z.bindFramebuffer(Tt.FRAMEBUFFER,r)&&Y.drawBuffers&&i&&Z.drawBuffers(t,r),Z.viewport(E),Z.scissor(w),Z.setScissorTest(A),a){const i=J.get(t.texture);Tt.framebufferTexture2D(Tt.FRAMEBUFFER,Tt.COLOR_ATTACHMENT0,Tt.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(s){const i=J.get(t.texture),r=e||0;Tt.framebufferTextureLayer(Tt.FRAMEBUFFER,Tt.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}T=-1},this.readRenderTargetPixels=function(t,e,n,i,r,a,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=J.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){Z.bindFramebuffer(Tt.FRAMEBUFFER,o);try{const s=t.texture,o=s.format,l=s.type;if(o!==rt&&yt.convert(o)!==Tt.getParameter(Tt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===nt&&(j.has("EXT_color_buffer_half_float")||Y.isWebGL2&&j.has("EXT_color_buffer_float"));if(!(l===$||yt.convert(l)===Tt.getParameter(Tt.IMPLEMENTATION_COLOR_READ_TYPE)||l===et&&(Y.isWebGL2||j.has("OES_texture_float")||j.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Tt.readPixels(e,n,i,r,yt.convert(o),yt.convert(l),a)}finally{const t=null!==b?J.get(b).__webglFramebuffer:null;Z.bindFramebuffer(Tt.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i);tt.setTexture2D(e,0),Tt.copyTexSubImage2D(Tt.TEXTURE_2D,n,0,0,t.x,t.y,r,a),Z.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,a=e.image.height,s=yt.convert(n.format),o=yt.convert(n.type);tt.setTexture2D(n,0),Tt.pixelStorei(Tt.UNPACK_FLIP_Y_WEBGL,n.flipY),Tt.pixelStorei(Tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Tt.pixelStorei(Tt.UNPACK_ALIGNMENT,n.unpackAlignment),e.isDataTexture?Tt.texSubImage2D(Tt.TEXTURE_2D,i,t.x,t.y,r,a,s,o,e.image.data):e.isCompressedTexture?Tt.compressedTexSubImage2D(Tt.TEXTURE_2D,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):Tt.texSubImage2D(Tt.TEXTURE_2D,i,t.x,t.y,s,o,e.image),0===i&&n.generateMipmaps&&Tt.generateMipmap(Tt.TEXTURE_2D),Z.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(v.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const a=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=yt.convert(i.format),c=yt.convert(i.type);let h;if(i.isData3DTexture)tt.setTexture3D(i,0),h=Tt.TEXTURE_3D;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");tt.setTexture2DArray(i,0),h=Tt.TEXTURE_2D_ARRAY}Tt.pixelStorei(Tt.UNPACK_FLIP_Y_WEBGL,i.flipY),Tt.pixelStorei(Tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Tt.pixelStorei(Tt.UNPACK_ALIGNMENT,i.unpackAlignment);const u=Tt.getParameter(Tt.UNPACK_ROW_LENGTH),d=Tt.getParameter(Tt.UNPACK_IMAGE_HEIGHT),f=Tt.getParameter(Tt.UNPACK_SKIP_PIXELS),p=Tt.getParameter(Tt.UNPACK_SKIP_ROWS),m=Tt.getParameter(Tt.UNPACK_SKIP_IMAGES),g=n.isCompressedTexture?n.mipmaps[0]:n.image;Tt.pixelStorei(Tt.UNPACK_ROW_LENGTH,g.width),Tt.pixelStorei(Tt.UNPACK_IMAGE_HEIGHT,g.height),Tt.pixelStorei(Tt.UNPACK_SKIP_PIXELS,t.min.x),Tt.pixelStorei(Tt.UNPACK_SKIP_ROWS,t.min.y),Tt.pixelStorei(Tt.UNPACK_SKIP_IMAGES,t.min.z),n.isDataTexture||n.isData3DTexture?Tt.texSubImage3D(h,r,e.x,e.y,e.z,a,s,o,l,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Tt.compressedTexSubImage3D(h,r,e.x,e.y,e.z,a,s,o,l,g.data)):Tt.texSubImage3D(h,r,e.x,e.y,e.z,a,s,o,l,c,g),Tt.pixelStorei(Tt.UNPACK_ROW_LENGTH,u),Tt.pixelStorei(Tt.UNPACK_IMAGE_HEIGHT,d),Tt.pixelStorei(Tt.UNPACK_SKIP_PIXELS,f),Tt.pixelStorei(Tt.UNPACK_SKIP_ROWS,p),Tt.pixelStorei(Tt.UNPACK_SKIP_IMAGES,m),0===r&&i.generateMipmaps&&Tt.generateMipmap(h),Z.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?tt.setTextureCube(t,0):t.isData3DTexture?tt.setTexture3D(t,0):t.isDataArrayTexture?tt.setTexture2DArray(t,0):tt.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){y=0,M=0,b=null,Z.reset(),Mt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class pa extends B{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Rt(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}const ma=new d,ga=new c,_a=new c,va=new d,xa=new c,ya=new c;class Ma extends class{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new k(512,512),this.map=null,this.mapPass=null,this.matrix=new d,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new yn,this._frameExtents=new k(1,1),this._viewportCount=1,this._viewports=[new G(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;ga.setFromMatrixPosition(t.matrixWorld),e.position.copy(ga),_a.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(_a),e.updateMatrixWorld(),ma.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ma),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}{constructor(){super(new Hn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new k(4,2),this._viewportCount=6,this._viewports=[new G(2,1,1,1),new G(0,1,1,1),new G(3,1,1,1),new G(1,1,1,1),new G(3,0,1,1),new G(1,0,1,1)],this._cubeDirections=[new c(1,0,0),new c(-1,0,0),new c(0,0,1),new c(0,0,-1),new c(0,1,0),new c(0,-1,0)],this._cubeUps=[new c(0,1,0),new c(0,1,0),new c(0,1,0),new c(0,1,0),new c(0,0,1),new c(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),xa.setFromMatrixPosition(t.matrixWorld),n.position.copy(xa),ya.copy(n.position),ya.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(ya),n.updateMatrixWorld(),i.makeTranslation(-xa.x,-xa.y,-xa.z),va.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(va)}}class ba extends pa{constructor(t,e,n=0,i=1){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Ma}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}var Ta;Ta=matchMedia("(max-width: 736px)").matches?[[[[0,[0,1,2,4,5,10,11,12,14,15,20,21,22,25,31,32,35]],[1,[2,12]],[4,[0,1,11,4,14,24]],[5,[5]],[6,[10]],[7,[12,13,3]]],[[0,[2,12,22,32,4,14,24,5,35]],[4,[12,4,14,5,15,25,6]],[5,[14]],[7,[3,6,13,16]]]],[[[0,[0,10,20,1,11,21,31,2,12,3,13,23,33]],[4,[0,10,11,2,12,22,3,13]],[5,[10]]],[[0,[1,11,21,31,2,22,3,13,4,14,24,5,35]],[1,[1,11,22,32]],[4,[3,13,23,4,14,5,15,25]],[5,[14]],[7,[11,2]]]],[[[0,[1,11,3,33,4,14,24,34,6,16,26,36,7,17,27,8,18,28,38]],[4,[0,1,2,3,5,6,7,8,11,13,16,17,21,23,24,28]],[5,[17]],[7,[0,10,2,12,5,15]]],[[0,[0,10,30,1,11,21,31,2,12,22,32,3,13,23,33,5,15,25,35,6,16,26,36]],[1,[2,12]],[4,[10,1,11,3,13,4,5,15]],[5,[6]],[6,[0]],[7,[12,4,14,7,17]]]],[[[0,[1,11,2,12,22,32,3,13,23,33,4,14,5,15,25,35,6,16,36]],[4,[0,1,11,21,2,12,24,5,15,16,26]],[5,[6]],[1,[3,13]],[7,[0,10,13]]]],[[[0,[0,30,1,11,3,13,23,33]],[4,[0,10,20,1,11,21,31,2,13]],[7,[2,12]]],[[0,[0,30,2,12,3,13,33,4,14,5,15,6,16,26,36,7,17,27,37,8,18,38]],[1,[33]],[4,[0,10,20,2,12,22,3,23,4,14,24,25,6,16,27,18,28]],[5,[8]],[7,[1,11]]]],[[[0,[0,10,20,30,1,11,21,31,2,12,22,4,14,34,5,15,25,35]],[1,[0,10]],[4,[1,11,2,12,14,5,25]],[5,[12]],[6,[4]],[7,[10,3,13]]],[[0,[0,10,20,30,1,11,21,31,2,12,22]],[1,[0,10]],[4,[1,21,2,12]],[5,[12]],[7,[10,3,13]]]],[[[0,[0,30,1,11,21,31,2,12]],[4,[0,10,20,1,21,22,3]],[7,[3,13]]],[[0,[1,11,2,12,3,13,23,33]],[1,[43,53]],[4,[21,2,12,22,5,6]],[7,[3,4,14,5,15,6,16]]]],[[[0,[0,10,20,1,11,21,31,2,12,3,13,23,33,4,14,5,15]],[4,[0,10,1,11,2,12,3,13,4,14,24,25]],[5,[10]]],[[0,[0,10,20,1,11,21,31,22,3,13,4,14,24,34,5,15,25,6,16,26,36,7,17,27,37,8,18]],[4,[0,10,1,21,2,22,3,13,23,5,6,16,7,17,28]],[5,[10,4]],[6,[12,15]]]],[[[0,[0,10,1,11,21,31,2,22,3,13,23,33,4,14,24,34,5,15,35]],[1,[22,32,35]],[4,[20,21,3,13,5,25]],[5,[4]],[7,[2]]]],[[[0,[0,30,1,21,2,12,22,32,3,13,23,33,4,34,5,15,25,35,6,16,36,7,17]],[1,[21,31]],[4,[0,10,20,22,4,14,24,25,16,7,17,27]],[5,[3]],[6,[6]],[7,[1]]],[[0,[1,11,21,31,2,12,32,3,13,23,33,4,14,24,34,5,15,25,35]],[1,[44,54]],[4,[0,1,11,12,3,13,5,25]],[4,[0,1,11,12,3,13,5,25]],[6,[2]],[7,[0,10,4]]]],[[[0,[1,11,21,31,3,13,23,33,4,14]],[4,[0,1,11,13,4,14,24]],[7,[0,10,2,12,5,15]]],[[0,[0,30,1,11,21,31]],[4,[0,10,20,11]],[7,[2,12,3,13]]]],[[[0,[0,10,20,30,1,11,21,31,2,32,3,13,23,33,4,14,34]],[1,[0,10]],[4,[1,11,2,12,22,3,13,14]],[6,[4]],[7,[10,5,15]]],[[0,[1,11,2,12,22,32,23,33,5,15,25,35,6,16,26,36,8,18,28,38]],[4,[1,11,22,23,15,6,16,7,8,18]],[7,[4,14,7,17]]]],[[[0,[0,10,20,30,1,11,31,2,12,22,3,13,23,33,5,15,25,35,6,16]],[4,[20,11,2,12,3,13,5,6,16,26]],[5,[12]],[6,[1]],[7,[4,14]]],[[0,[0,10,20,1,11,21,31,2,12,22,32]],[4,[0,1,11,2,22]],[6,[10]]]]]:[[[[0,[0,1,2,4,5,10,11,12,14,15,20,21,22,25,31,32,35]],[1,[2,12]],[4,[0,1,11,4,14,24]],[5,[5]],[6,[10]],[7,[12,13,3]]],[[0,[1,11,21,31,3,13,23,4,34]],[4,[11,3,13,4,14,24,5]],[5,[13]],[7,[2,5,12,15]]]],[[[0,[0,10,20,1,11,21,31,2,12,3,13,23,33]],[4,[0,10,11,2,12,22,3,13]],[5,[10]]],[[0,[1,11,21,31,2,22,3,13,4,14,24,5,35]],[1,[1,11,22,32]],[4,[3,13,23,4,14,5,15,25]],[5,[14]],[7,[11,2]]]],[[[0,[1,11,3,33,4,14,24,34,6,16,26,36,7,17,27,8,18,28,38]],[4,[0,1,2,3,5,6,7,8,11,13,16,17,21,23,24,28]],[5,[17]],[7,[0,10,2,12,5,15]]],[[0,[1,11,31,2,12,22,32,3,13,23,33,4,14,24,34,6,16,26,36,7,17,27,37]],[1,[3,13]],[4,[11,2,12,4,14,5,6,16]],[5,[7]],[6,[1]],[7,[13,5,15,8,18]]]],[[[0,[1,11,2,12,22,32,3,13,23,33]],[4,[0,1,11,21,2,12]],[1,[3,13]],[7,[0,10,13]]],[[0,[1,11,2,12,22,32,3,13,33]],[4,[21,2,12,13,23]],[5,[3]]]],[[[0,[0,30,1,11,3,13,23,33]],[4,[0,10,20,1,11,21,31,2,13]],[7,[2,12]]],[[0,[1,31,3,13,4,14,34,5,15,6,16,7,17,27,37,8,18,28,38,9,19,39]],[1,[34]],[4,[1,11,21,3,13,23,4,24,5,15,25,26,7,17,28,19,29]],[5,[9]],[7,[2,12]]]],[[[0,[0,10,20,30,1,11,21,31,2,12,22,4,14,34,5,15,25,35]],[1,[0,10]],[4,[1,11,2,12,14,5,25]],[5,[12]],[6,[4]],[7,[10,3,13]]],[[0,[2,12,22,32,3,13,23,33,4,14,24]],[1,[2,12]],[4,[3,23,4,14]],[5,[14]],[7,[12,5,15]]]],[[[0,[0,30,1,11,21,31,2,12]],[4,[0,10,20,1,21,22,3]],[7,[3,13]]],[[0,[1,11,2,12,3,13,23,33]],[1,[43,53]],[4,[21,2,12,22,5,6]],[7,[3,4,14,5,15,6,16]]]],[[[0,[0,10,20,1,11,21,31,2,12,3,13,23,33,4,14,5,15]],[4,[0,10,1,11,2,12,3,13,4,14,24,25]],[5,[10]]],[[0,[1,11,21,2,12,22,32,23,4,14,5,15,25,35,6,16,26,7,17,27,37,8,18,28,38,9,19]],[4,[1,11,2,22,3,23,4,14,24,6,7,17,8,18,29]],[5,[11,5]],[6,[13,16]]]],[[[0,[0,10,1,11,21,31,2,22,3,13,23,33,4,14,24,34,5,15,35]],[1,[22,32,35]],[4,[20,21,3,13,5,25]],[5,[4]],[7,[2]]]],[[[0,[0,30,1,21,2,12,22,32,3,13,23,33,4,34,5,15,25,35,6,16,36,7,17]],[1,[21,31]],[4,[0,10,20,22,4,14,24,25,16,7,17,27]],[5,[3]],[6,[6]],[7,[1]]],[[0,[2,12,22,32,3,13,33,4,14,24,34,5,15,25,35,6,16,26,36]],[1,[45,55]],[4,[1,2,12,13,4,14,6,26]],[6,[3]],[7,[1,11,5]]]],[[[0,[1,11,21,31,3,13,23,33,4,14]],[4,[0,1,11,13,4,14,24]],[7,[0,10,2,12,5,15]]],[[0,[1,31,2,12,22,32]],[4,[1,11,21,12]],[7,[3,13,4,14]]]],[[[0,[0,10,20,30,1,11,21,31,2,32,3,13,23,33,4,14,34]],[1,[0,10]],[4,[1,11,2,12,22,3,13,14]],[6,[4]],[7,[10,5,15]]],[[0,[1,11,2,12,22,32,23,33,5,15,25,35,6,16,26,36,8,18,28,38]],[4,[1,11,22,23,15,6,16,7,8,18]],[7,[4,14,7,17]]]],[[[0,[0,10,20,30,1,11,31,2,12,22,3,13,23,33,5,15,25,35,6,16,7,17,27,8,18,28,38,9,19,29,39]],[4,[20,11,2,12,3,13,5,6,16,26,7,8,18,9,29]],[5,[12]],[6,[1,17]],[7,[4,14]]]]];class Sa{constructor(){this.Rodmatrix=[[[-15.5,16.75,5,30.5,0,0],[-15.5,-16.75,5,30.5,0,0],[15.5,16.75,5,30.5,0,0],[15.5,-16.75,5,30.5,0,0]],[[-7,34,5,12,0,90],[7,34,5,12,0,90],[-7,0,5,12,0,90],[7,0,5,12,0,90],[-7,-34,5,12,0,90],[7,-34,5,12,0,90]],[[-6,23,5,Math.sqrt(196.5625),0,45],[6,10.375,5,Math.sqrt(196.5625),0,45],[-6,-10.375,5,Math.sqrt(196.5625),0,45],[6,-23,5,Math.sqrt(196.5625),0,45]],[[6,23,5,Math.sqrt(196.5625),0,-45],[-6,10.375,5,Math.sqrt(196.5625),0,-45],[6,-10.375,5,Math.sqrt(196.5625),0,-45],[-6,-23,5,Math.sqrt(196.5625),0,-45]],[[0,34,5,24,0,90],[0,0,5,24,0,90],[0,-34,5,24,0,90]],[[0,16,6,Math.sqrt(1041.25),0,45],[0,-16,6,Math.sqrt(1041.25),0,45]],[[0,16,6,Math.sqrt(1041.25),0,-45],[0,-16,6,Math.sqrt(1041.25),0,-45]],[[0,-18.25,6,28,-10,0],[0,14.25,6,28,-10,0]]]}randomAlpha(t){const e=[];this.createRandomArray(e);for(let n=0;n<t.children.length;n++)for(let i=0;i<e[n].length;i++)t.children[n].geometry.attributes.a_active.array[i]=1,t.children[n].geometry.attributes.a_lagActive.array[i]=1}createTitle(t,e){for(let n=0;n<Ta[e].length;n++)this.showletter(t.children[n],Ta[e][n])}showletter(t,e){for(let n=0;n<e.length;n++)for(let i=0;i<e[n][1].length;i++){let r=e[n][0],a=e[n][1][i];t.children[r].geometry.attributes.a_alpha.array[a]=1}}createRandomArray(t){this.randomArray=[[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,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,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,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,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,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,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,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,0,0,0,0,0,0]];for(let e=0;e<this.randomArray.length;e++){const n=[];t.push(n);for(let t=0;t<this.randomArray[e].length;t++){const t=Math.floor(2*Math.random());n.push(t)}}}attrUpdate(t){for(let e=0;e<t.children.length;e++)for(let n=0;n<t.children[e].children.length;n++)for(let i=0;i<t.children[e].children[n].children.length;i++)t.children[e].children[n].children[i].geometry.attributes.a_alpha.needsUpdate=!0,t.children[e].children[n].children[i].geometry.attributes.a_active.needsUpdate=!0,t.children[e].children[n].children[i].geometry.attributes.a_lagActive.needsUpdate=!0}createTitleArea(t,e,n,i){this.titleArea=new H,this.allNum=0,this.sizeW=48,this.sizeH=84,this.h=e,this.w=t,this.inH=Math.floor(this.h/this.sizeH),this.marginY=3,this.fixY=(this.h-this.inH*this.sizeH+12)/2,this.inH%2==0&&(this.marginY=4);for(let t=0;t<i;t++)this.addrod(n),this.title.position.set(0,84*-(t-i/2),0),this.titleArea.add(this.title);return this.titleArea}addrod(t){this.TRANSPARENT=!0,this.ALPHA_COVERGE=!0,this.sizeW=48,this.sizeH=84,this.fixX=0,t%2==0&&(this.fixX=24),this.title=new H;for(let e=0;e<this.Rodmatrix.length;e++){this.rodPositions=this.Rodmatrix[e];let n=this.rodPositions.length*t;this.transform=new B,this.rodW=this.rodPositions[0][2],this.rodH=this.rodPositions[0][3],this.createRodgeo(this.rodW,this.rodH),this.rod=new rn(this.geo,this.mat,n);let i=new Float32Array(1*n),r=new Float32Array(3*n),a=new Float32Array(1*n),s=new Float32Array(1*n),o=new Float32Array(1*n),l=new Float32Array(1*n),c=new Float32Array(1*n),h=0;this.allNum=this.allNum+1;for(let e=0,n=0,u=this.rodPositions.length;e<u;e++,n+=3)for(let u=0;u<t;u++)i[h]=h,c[h]=this.allNum,s[h]=0,a[h]=0,l[h]=0,o[h]=Math.random(),r[n+0]=this.rodPositions[e][0],r[n+1]=this.rodPositions[e][1],r[n+2]=0,this.transform.position.set(this.rodPositions[e][0]+(u-t/2)*this.sizeW+this.fixX,this.rodPositions[e][1],0),this.rod.rotation.set(0,0,Math.PI/180*this.rodPositions[e][5]),this.transform.updateMatrix(),this.rod.setMatrixAt(h++,this.transform.matrix),this.title.add(this.rod),this.rod.instanceMatrix.needsUpdate=!0;this.rod.geometry.setAttribute("a_num",new Ot(i,1)),this.rod.geometry.setAttribute("a_pos",new Ot(r,3)),this.rod.geometry.setAttribute("a_lagActive",new Ot(a,1)),this.rod.geometry.setAttribute("a_active",new Ot(s,1)),this.rod.geometry.setAttribute("a_random",new Ot(o,1)),this.rod.geometry.setAttribute("a_alpha",new Ot(l,1)),this.rod.geometry.setAttribute("a_allNum",new Ot(c,1))}return this.title}createRodmat(){return this.mat=new cn({uniforms:{uTime:{type:"f",value:0},resolution:{value:new k(1,1)},uAlpha:{value:0}},vertexShader:"// attribute vec4 color;\nuniform float uTime;\nvarying vec2 vUv;\n// varying vec4 vColor\nattribute float a_num;\nattribute float a_allNum;\nattribute float a_lagActive;\nattribute float a_active;\nattribute vec3 a_pos;\nattribute float a_alpha;\nattribute float a_random;\nvarying float vNum;\nvarying float vAllNum;\nvarying float vLagActive;\nvarying float vActive;\nvarying float vAlpha;\nvarying float vRandom;\nvarying vec3 vPos;\nvarying vec3 vPosition;\nconst float PI = 3.14159;\n\nvoid main(){\n vUv = uv;\n vNum = a_num;\n vAllNum = a_allNum;\n vLagActive = a_lagActive;\n vActive = a_active;\n vAlpha = a_alpha;\n vRandom = a_random;\n vPos = a_pos;\n vPosition = position;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.);\n gl_Position = projectionMatrix * instanceMatrix * mvPosition;\n}\n",fragmentShader:"uniform float uTime;\nuniform float progress;\nuniform float uAlpha;\nuniform vec2 resolution;\nvarying vec3 vPosition;\nvarying vec2 vUv;\nvarying float vNum;\nvarying float vAllNum;\nvarying float vLagActive;\nvarying float vActive;\nvarying float vAlpha;\nvarying float vRandom;\nvarying vec3 vPos;\n\n void main(){\n float motionStart ;\n float motionend ;\n float on = 0.0;\n float off = 0.8;\n float off2 = 1.0;\n float first;\n float end;\n float activeRand = cos(uTime*2.5 + vRandom * 6.) + cos(vNum+vRandom+vPos.x*vPos.y);\n float activeRand02 = cos(uTime+vNum*vRandom) * cos(vPos.x+vPos.y)+ sin(vNum+vPos.x+vPos.y);\n\t\n float activeRandText = (cos(uTime*3.5 + vRandom * 6.)+cos(vNum+vRandom));\n float delayin = cos(uTime) + sin(uTime) - sin(uTime) + 0.1;\n float delayout = cos(uTime) + sin(uTime) + sin(uTime)*0.5 + 0.2;\n first = (vAllNum/300. < delayout)? off : on;\n motionStart = (vAllNum/300. < delayout)? on : off2;\n end = (delayin < vAllNum/300.)? off : on;\n motionend = (delayin < vAllNum/300.)? on : off2;\n \n\tfloat t = uTime;\n\tfloat ft = (vNum+8.0*cos(uTime*3.5 + vRandom * 6.))-(t*10.);\n\tfloat a = 1.0-vAlpha;\n\tfloat show = activeRandText*sin(ft);\n\tfloat showorder = (1.8+vNum+(vRandom+0.1)*(vRandom+0.1)) - (t+vNum);\n\tfloat check = step(0.9,showorder);\n\tfloat tcheck0 = step(t,1.2);\n\tfloat tcheck1 = step(t,1.2);\n\ttcheck1 = step(t,1.8);\n\tfloat tcheck2 = step(1.8,t);\n\tfloat textShow = (show*tcheck0 + (activeRandText*sin(ft)*vAlpha)*tcheck1 + (vAlpha-(showorder*check))*tcheck2)*vActive;\n gl_FragColor = vec4(255.,255.,255.,textShow);\n\n\n\n \n }\n",side:2,transparent:!0,alphaToCoverage:!0,opacity:0}),this.mat}createRodgeo(t,e){this.geo=new an(t,e,2,1);var n=this.geo.attributes.position.array;for(let t=0;t<n.length/3;t++){const e=n[3*t+1];0!==t&&2!==t||(n[3*t+1]=e-2),3!==t&&5!==t||(n[3*t+1]=e+2)}return this.geo}}const Ea={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class wa{constructor(t,e,n){const i=this;let r,a=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===a&&void 0!==i.onStart&&i.onStart(t,s,o),a=!0},this.itemEnd=function(t){s++,void 0!==i.onProgress&&i.onProgress(t,s,o),s===o&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const Aa=new wa;class Ra{constructor(t){this.manager=void 0!==t?t:Aa,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}class Ca extends Ra{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=Ea.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const s=Ee("img");function o(){c(),Ea.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class La extends Ra{constructor(t){super(t)}load(t,e,n,i){const r=new Fn,a=new Ca(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class Pa{constructor(t,e,n){this.w=t,this.h=e,this.isSp=n,this.init()}init(){document.querySelectorAll(".nft_content_img")[0].getBoundingClientRect()}createImgGroup(){this.textures=document.querySelectorAll(".js-Atexture");const t=new H;for(let e=0;e<this.textures.length;e++){const n=this.textures[e].getBoundingClientRect(),i=this.createImgmat(this.textures[e]),r=new an(n.width*this.isSp,n.height*this.isSp,2,1),a=new Je(r,i);this.setImgPos(a,this.textures[e],n),t.add(a)}return t}setImgPos(t,e,n){const i=new k(n.x+n.width/2,n.y+n.height/2),r=new k(i.x-this.w/2,i.y-this.h/2);t.position.set(r.x*(2-this.isSp)*this.isSp,-r.y*this.isSp,0)}createImgMesh(t){const e=new an(t.width*this.isSp,t.height*this.isSp,2,1);return new Je(e,mat)}async loadTex(t){const e=new La;return await e.loadAsync(t)}createImgmat(t){const e=new La;let n;return n=matchMedia("(max-width: 736px)").matches?t.src.slice(0,-4)+"_sp.jpg":t.src,this.mat=new Te({map:e.load(n),transparent:!0,alphaToCoverage:!0,opacity:.7}),this.mat}}function Da(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Na(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var Ia,Oa,Ua,Fa,za,Ba,Ha,Ga,ka,Wa,Va,Xa,qa,ja,Ya,Za={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Ka={duration:.5,overwrite:!1,delay:0},Ja=1e8,Qa=1e-8,$a=2*Math.PI,ts=$a/4,es=0,ns=Math.sqrt,is=Math.cos,rs=Math.sin,as=function(t){return"string"==typeof t},ss=function(t){return"function"==typeof t},os=function(t){return"number"==typeof t},ls=function(t){return void 0===t},cs=function(t){return"object"==typeof t},hs=function(t){return!1!==t},us=function(){return"undefined"!=typeof window},ds=function(t){return ss(t)||as(t)},fs="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},ps=Array.isArray,ms=/(?:-?\.?\d|\.)+/gi,gs=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,_s=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,vs=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,xs=/[+-]=-?[.\d]+/,ys=/[^,'"\[\]\s]+/gi,Ms=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,bs={},Ts={},Ss=function(t){return(Ts=Qs(t,bs))&&Ql},Es=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},ws=function(t,e){return!e&&console.warn(t)},As=function(t,e){return t&&(bs[t]=e)&&Ts&&(Ts[t]=e)||bs},Rs=function(){return 0},Cs={suppressEvents:!0,isStart:!0},Ls={suppressEvents:!0},Ps={},Ds=[],Ns={},Is={},Os={},Us=30,Fs=[],zs="",Bs=function(t){var e,n,i=t[0];if(cs(i)||ss(i)||(t=[t]),!(e=(i._gsap||{}).harness)){for(n=Fs.length;n--&&!Fs[n].targetTest(i););e=Fs[n]}for(n=t.length;n--;)t[n]&&(t[n]._gsap||(t[n]._gsap=new fl(t[n],e)))||t.splice(n,1);return t},Hs=function(t){return t._gsap||Bs(Po(t))[0]._gsap},Gs=function(t,e,n){return(n=t[e])&&ss(n)?t[e]():ls(n)&&t.getAttribute&&t.getAttribute(e)||n},ks=function(t,e){return(t=t.split(",")).forEach(e)||t},Ws=function(t){return Math.round(1e5*t)/1e5||0},Vs=function(t){return Math.round(1e7*t)/1e7||0},Xs=function(t,e){var n=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),"+"===n?t+i:"-"===n?t-i:"*"===n?t*i:t/i},qs=function(t,e){for(var n=e.length,i=0;t.indexOf(e[i])<0&&++i<n;);return i<n},js=function(){var t,e,n=Ds.length,i=Ds.slice(0);for(Ns={},Ds.length=0,t=0;t<n;t++)(e=i[t])&&e._lazy&&(e.render(e._lazy[0],e._lazy[1],!0)._lazy=0)},Ys=function(t,e,n,i){Ds.length&&js(),t.render(e,n,i||Oa),Ds.length&&js()},Zs=function(t){var e=parseFloat(t);return(e||0===e)&&(t+"").match(ys).length<2?e:as(t)?t.trim():t},Ks=function(t){return t},Js=function(t,e){for(var n in e)n in t||(t[n]=e[n]);return t},Qs=function(t,e){for(var n in e)t[n]=e[n];return t},$s=function t(e,n){for(var i in n)"__proto__"!==i&&"constructor"!==i&&"prototype"!==i&&(e[i]=cs(n[i])?t(e[i]||(e[i]={}),n[i]):n[i]);return e},to=function(t,e){var n,i={};for(n in t)n in e||(i[n]=t[n]);return i},eo=function(t){var e,n=t.parent||Fa,i=t.keyframes?(e=ps(t.keyframes),function(t,n){for(var i in n)i in t||"duration"===i&&e||"ease"===i||(t[i]=n[i])}):Js;if(hs(t.inherit))for(;n;)i(t,n.vars.defaults),n=n.parent||n._dp;return t},no=function(t,e,n,i,r){void 0===n&&(n="_first"),void 0===i&&(i="_last");var a,s=t[i];if(r)for(a=e[r];s&&s[r]>a;)s=s._prev;return s?(e._next=s._next,s._next=e):(e._next=t[n],t[n]=e),e._next?e._next._prev=e:t[i]=e,e._prev=s,e.parent=e._dp=t,e},io=function(t,e,n,i){void 0===n&&(n="_first"),void 0===i&&(i="_last");var r=e._prev,a=e._next;r?r._next=a:t[n]===e&&(t[n]=a),a?a._prev=r:t[i]===e&&(t[i]=r),e._next=e._prev=e.parent=null},ro=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove(t),t._act=0},ao=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var n=t;n;)n._dirty=1,n=n.parent;return t},so=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},oo=function(t,e,n,i){return t._startAt&&(Oa?t._startAt.revert(Ls):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},lo=function t(e){return!e||e._ts&&t(e.parent)},co=function(t){return t._repeat?ho(t._tTime,t=t.duration()+t._rDelay)*t:0},ho=function(t,e){var n=Math.floor(t/=e);return t&&n===t?n-1:n},uo=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},fo=function(t){return t._end=Vs(t._start+(t._tDur/Math.abs(t._ts||t._rts||Qa)||0))},po=function(t,e){var n=t._dp;return n&&n.smoothChildTiming&&t._ts&&(t._start=Vs(n._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),fo(t),n._dirty||ao(n,t)),t},mo=function(t,e){var n;if((e._time||e._initted&&!e._dur)&&(n=uo(t.rawTime(),e),(!e._dur||Ao(0,e.totalDuration(),n)-e._tTime>Qa)&&e.render(n,!0)),ao(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(n=t;n._dp;)n.rawTime()>=0&&n.totalTime(n._tTime),n=n._dp;t._zTime=-1e-8}},go=function(t,e,n,i){return e.parent&&ro(e),e._start=Vs((os(n)?n:n||t!==Fa?So(t,n,e):t._time)+e._delay),e._end=Vs(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),no(t,e,"_first","_last",t._sort?"_start":0),yo(e)||(t._recent=e),i||mo(t,e),t._ts<0&&po(t,t._tTime),t},_o=function(t,e){return(bs.ScrollTrigger||Es("scrollTrigger",e))&&bs.ScrollTrigger.create(e,t)},vo=function(t,e,n,i){return Ml(t,e),t._initted?!n&&t._pt&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&ka!==tl.frame?(Ds.push(t),t._lazy=[e,i],1):void 0:1},xo=function t(e){var n=e.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||t(n))},yo=function(t){var e=t.data;return"isFromStart"===e||"isStart"===e},Mo=function(t,e,n,i){var r=t._repeat,a=Vs(e)||0,s=t._tTime/t._tDur;return s&&!i&&(t._time*=a/t._dur),t._dur=a,t._tDur=r?r<0?1e10:Vs(a*(r+1)+t._rDelay*r):a,s>0&&!i?po(t,t._tTime=t._tDur*s):t.parent&&fo(t),n||ao(t.parent,t),t},bo=function(t){return t instanceof ml?ao(t):Mo(t,t._dur)},To={_start:0,endTime:Rs,totalDuration:Rs},So=function t(e,n,i){var r,a,s,o=e.labels,l=e._recent||To,c=e.duration()>=Ja?l.endTime(!1):e._dur;return as(n)&&(isNaN(n)||n in o)?(a=n.charAt(0),s="%"===n.substr(-1),r=n.indexOf("="),"<"===a||">"===a?(r>=0&&(n=n.replace(/=/,"")),("<"===a?l._start:l.endTime(l._repeat>=0))+(parseFloat(n.substr(1))||0)*(s?(r<0?l:i).totalDuration()/100:1)):r<0?(n in o||(o[n]=c),o[n]):(a=parseFloat(n.charAt(r-1)+n.substr(r+1)),s&&i&&(a=a/100*(ps(i)?i[0]:i).totalDuration()),r>1?t(e,n.substr(0,r-1),i)+a:c+a)):null==n?c:+n},Eo=function(t,e,n){var i,r,a=os(e[1]),s=(a?2:1)+(t<2?0:1),o=e[s];if(a&&(o.duration=e[1]),o.parent=n,t){for(i=o,r=n;r&&!("immediateRender"in i);)i=r.vars.defaults||{},r=hs(r.vars.inherit)&&r.parent;o.immediateRender=hs(i.immediateRender),t<2?o.runBackwards=1:o.startAt=e[s-1]}return new wl(e[0],o,e[s+1])},wo=function(t,e){return t||0===t?e(t):e},Ao=function(t,e,n){return n<t?t:n>e?e:n},Ro=function(t,e){return as(t)&&(e=Ms.exec(t))?e[1]:""},Co=[].slice,Lo=function(t,e){return t&&cs(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&cs(t[0]))&&!t.nodeType&&t!==za},Po=function(t,e,n){return Ua&&!e&&Ua.selector?Ua.selector(t):!as(t)||n||!Ba&&el()?ps(t)?function(t,e,n){return void 0===n&&(n=[]),t.forEach((function(t){var i;return as(t)&&!e||Lo(t,1)?(i=n).push.apply(i,Po(t)):n.push(t)}))||n}(t,n):Lo(t)?Co.call(t,0):t?[t]:[]:Co.call((e||Ha).querySelectorAll(t),0)},Do=function(t){return t=Po(t)[0]||ws("Invalid scope")||{},function(e){var n=t.current||t.nativeElement||t;return Po(e,n.querySelectorAll?n:n===t?ws("Invalid scope")||Ha.createElement("div"):t)}},No=function(t){return t.sort((function(){return.5-Math.random()}))},Io=function(t){if(ss(t))return t;var e=cs(t)?t:{each:t},n=ll(e.ease),i=e.from||0,r=parseFloat(e.base)||0,a={},s=i>0&&i<1,o=isNaN(i)||s,l=e.axis,c=i,h=i;return as(i)?c=h={center:.5,edges:.5,end:1}[i]||0:!s&&o&&(c=i[0],h=i[1]),function(t,s,u){var d,f,p,m,g,_,v,x,y,M=(u||e).length,b=a[M];if(!b){if(!(y="auto"===e.grid?0:(e.grid||[1,Ja])[1])){for(v=-Ja;v<(v=u[y++].getBoundingClientRect().left)&&y<M;);y--}for(b=a[M]=[],d=o?Math.min(y,M)*c-.5:i%y,f=y===Ja?0:o?M*h/y-.5:i/y|0,v=0,x=Ja,_=0;_<M;_++)p=_%y-d,m=f-(_/y|0),b[_]=g=l?Math.abs("y"===l?m:p):ns(p*p+m*m),g>v&&(v=g),g<x&&(x=g);"random"===i&&No(b),b.max=v-x,b.min=x,b.v=M=(parseFloat(e.amount)||parseFloat(e.each)*(y>M?M-1:l?"y"===l?M/y:y:Math.max(y,M/y))||0)*("edges"===i?-1:1),b.b=M<0?r-M:r,b.u=Ro(e.amount||e.each)||0,n=n&&M<0?sl(n):n}return M=(b[t]-b.min)/b.max||0,Vs(b.b+(n?n(M):M)*b.v)+b.u}},Oo=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(n){var i=Vs(Math.round(parseFloat(n)/t)*t*e);return(i-i%1)/e+(os(n)?0:Ro(n))}},Uo=function(t,e){var n,i,r=ps(t);return!r&&cs(t)&&(n=r=t.radius||Ja,t.values?(t=Po(t.values),(i=!os(t[0]))&&(n*=n)):t=Oo(t.increment)),wo(e,r?ss(t)?function(e){return i=t(e),Math.abs(i-e)<=n?i:e}:function(e){for(var r,a,s=parseFloat(i?e.x:e),o=parseFloat(i?e.y:0),l=Ja,c=0,h=t.length;h--;)(r=i?(r=t[h].x-s)*r+(a=t[h].y-o)*a:Math.abs(t[h]-s))<l&&(l=r,c=h);return c=!n||l<=n?t[c]:e,i||c===e||os(e)?c:c+Ro(e)}:Oo(t))},Fo=function(t,e,n,i){return wo(ps(t)?!e:!0===n?!!(n=0):!i,(function(){return ps(t)?t[~~(Math.random()*t.length)]:(n=n||1e-5)&&(i=n<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((t-n/2+Math.random()*(e-t+.99*n))/n)*n*i)/i}))},zo=function(t,e,n){return wo(n,(function(n){return t[~~e(n)]}))},Bo=function(t){for(var e,n,i,r,a=0,s="";~(e=t.indexOf("random(",a));)i=t.indexOf(")",e),r="["===t.charAt(e+7),n=t.substr(e+7,i-e-7).match(r?ys:ms),s+=t.substr(a,e-a)+Fo(r?n:+n[0],r?0:+n[1],+n[2]||1e-5),a=i+1;return s+t.substr(a,t.length-a)},Ho=function(t,e,n,i,r){var a=e-t,s=i-n;return wo(r,(function(e){return n+((e-t)/a*s||0)}))},Go=function(t,e,n){var i,r,a,s=t.labels,o=Ja;for(i in s)(r=s[i]-e)<0==!!n&&r&&o>(r=Math.abs(r))&&(a=i,o=r);return a},ko=function(t,e,n){var i,r,a,s=t.vars,o=s[e],l=Ua,c=t._ctx;if(o)return i=s[e+"Params"],r=s.callbackScope||t,n&&Ds.length&&js(),c&&(Ua=c),a=i?o.apply(r,i):o.call(r),Ua=l,a},Wo=function(t){return ro(t),t.scrollTrigger&&t.scrollTrigger.kill(!1),t.progress()<1&&ko(t,"onInterrupt"),t},Vo=function(t){var e=(t=!t.name&&t.default||t).name,n=ss(t),i=e&&!n&&t.init?function(){this._props=[]}:t,r={init:Rs,render:Ol,add:xl,kill:Fl,modifier:Ul,rawVars:0},a={targetTest:0,get:0,getSetter:Pl,aliases:{},register:0};if(el(),t!==i){if(Is[e])return;Js(i,Js(to(t,r),a)),Qs(i.prototype,Qs(r,to(t,a))),Is[i.prop=e]=i,t.targetTest&&(Fs.push(i),Ps[e]=1),e=("css"===e?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}As(e,i),t.register&&t.register(Ql,i,Hl)},Xo=255,qo={aqua:[0,Xo,Xo],lime:[0,Xo,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Xo],navy:[0,0,128],white:[Xo,Xo,Xo],olive:[128,128,0],yellow:[Xo,Xo,0],orange:[Xo,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Xo,0,0],pink:[Xo,192,203],cyan:[0,Xo,Xo],transparent:[Xo,Xo,Xo,0]},jo=function(t,e,n){return(6*(t+=t<0?1:t>1?-1:0)<1?e+(n-e)*t*6:t<.5?n:3*t<2?e+(n-e)*(2/3-t)*6:e)*Xo+.5|0},Yo=function(t,e,n){var i,r,a,s,o,l,c,h,u,d,f=t?os(t)?[t>>16,t>>8&Xo,t&Xo]:0:qo.black;if(!f){if(","===t.substr(-1)&&(t=t.substr(0,t.length-1)),qo[t])f=qo[t];else if("#"===t.charAt(0)){if(t.length<6&&(i=t.charAt(1),r=t.charAt(2),a=t.charAt(3),t="#"+i+i+r+r+a+a+(5===t.length?t.charAt(4)+t.charAt(4):"")),9===t.length)return[(f=parseInt(t.substr(1,6),16))>>16,f>>8&Xo,f&Xo,parseInt(t.substr(7),16)/255];f=[(t=parseInt(t.substr(1),16))>>16,t>>8&Xo,t&Xo]}else if("hsl"===t.substr(0,3))if(f=d=t.match(ms),e){if(~t.indexOf("="))return f=t.match(gs),n&&f.length<4&&(f[3]=1),f}else s=+f[0]%360/360,o=+f[1]/100,i=2*(l=+f[2]/100)-(r=l<=.5?l*(o+1):l+o-l*o),f.length>3&&(f[3]*=1),f[0]=jo(s+1/3,i,r),f[1]=jo(s,i,r),f[2]=jo(s-1/3,i,r);else f=t.match(ms)||qo.transparent;f=f.map(Number)}return e&&!d&&(i=f[0]/Xo,r=f[1]/Xo,a=f[2]/Xo,l=((c=Math.max(i,r,a))+(h=Math.min(i,r,a)))/2,c===h?s=o=0:(u=c-h,o=l>.5?u/(2-c-h):u/(c+h),s=c===i?(r-a)/u+(r<a?6:0):c===r?(a-i)/u+2:(i-r)/u+4,s*=60),f[0]=~~(s+.5),f[1]=~~(100*o+.5),f[2]=~~(100*l+.5)),n&&f.length<4&&(f[3]=1),f},Zo=function(t){var e=[],n=[],i=-1;return t.split(Jo).forEach((function(t){var r=t.match(_s)||[];e.push.apply(e,r),n.push(i+=r.length+1)})),e.c=n,e},Ko=function(t,e,n){var i,r,a,s,o="",l=(t+o).match(Jo),c=e?"hsla(":"rgba(",h=0;if(!l)return t;if(l=l.map((function(t){return(t=Yo(t,e,1))&&c+(e?t[0]+","+t[1]+"%,"+t[2]+"%,"+t[3]:t.join(","))+")"})),n&&(a=Zo(t),(i=n.c).join(o)!==a.c.join(o)))for(s=(r=t.replace(Jo,"1").split(_s)).length-1;h<s;h++)o+=r[h]+(~i.indexOf(h)?l.shift()||c+"0,0,0,0)":(a.length?a:l.length?l:n).shift());if(!r)for(s=(r=t.split(Jo)).length-1;h<s;h++)o+=r[h]+l[h];return o+r[s]},Jo=function(){var t,e="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(t in qo)e+="|"+t+"\\b";return new RegExp(e+")","gi")}(),Qo=/hsl[a]?\(/,$o=function(t){var e,n=t.join(" ");if(Jo.lastIndex=0,Jo.test(n))return e=Qo.test(n),t[1]=Ko(t[1],e),t[0]=Ko(t[0],e,Zo(t[1])),!0},tl=function(){var t,e,n,i,r,a,s=Date.now,o=500,l=33,c=s(),h=c,u=1e3/240,d=u,f=[],p=function n(p){var m,g,_,v,x=s()-h,y=!0===p;if(x>o&&(c+=x-l),((m=(_=(h+=x)-c)-d)>0||y)&&(v=++i.frame,r=_-1e3*i.time,i.time=_/=1e3,d+=m+(m>=u?4:u-m),g=1),y||(t=e(n)),g)for(a=0;a<f.length;a++)f[a](_,r,v,p)};return i={time:0,frame:0,tick:function(){p(!0)},deltaRatio:function(t){return r/(1e3/(t||60))},wake:function(){Ga&&(!Ba&&us()&&(za=Ba=window,Ha=za.document||{},bs.gsap=Ql,(za.gsapVersions||(za.gsapVersions=[])).push(Ql.version),Ss(Ts||za.GreenSockGlobals||!za.gsap&&za||{}),n=za.requestAnimationFrame),t&&i.sleep(),e=n||function(t){return setTimeout(t,d-1e3*i.time+1|0)},Va=1,p(2))},sleep:function(){(n?za.cancelAnimationFrame:clearTimeout)(t),Va=0,e=Rs},lagSmoothing:function(t,e){o=t||1e8,l=Math.min(e,o,0)},fps:function(t){u=1e3/(t||240),d=1e3*i.time+u},add:function(t,e,n){var r=e?function(e,n,a,s){t(e,n,a,s),i.remove(r)}:t;return i.remove(t),f[n?"unshift":"push"](r),el(),r},remove:function(t,e){~(e=f.indexOf(t))&&f.splice(e,1)&&a>=e&&a--},_listeners:f}}(),el=function(){return!Va&&tl.wake()},nl={},il=/^[\d.\-M][\d.\-,\s]/,rl=/["']/g,al=function(t){for(var e,n,i,r={},a=t.substr(1,t.length-3).split(":"),s=a[0],o=1,l=a.length;o<l;o++)n=a[o],e=o!==l-1?n.lastIndexOf(","):n.length,i=n.substr(0,e),r[s]=isNaN(i)?i.replace(rl,"").trim():+i,s=n.substr(e+1).trim();return r},sl=function(t){return function(e){return 1-t(1-e)}},ol=function t(e,n){for(var i,r=e._first;r;)r instanceof ml?t(r,n):!r.vars.yoyoEase||r._yoyo&&r._repeat||r._yoyo===n||(r.timeline?t(r.timeline,n):(i=r._ease,r._ease=r._yEase,r._yEase=i,r._yoyo=n)),r=r._next},ll=function(t,e){return t&&(ss(t)?t:nl[t]||function(t){var e,n,i,r,a=(t+"").split("("),s=nl[a[0]];return s&&a.length>1&&s.config?s.config.apply(null,~t.indexOf("{")?[al(a[1])]:(e=t,n=e.indexOf("(")+1,i=e.indexOf(")"),r=e.indexOf("(",n),e.substring(n,~r&&r<i?e.indexOf(")",i+1):i)).split(",").map(Zs)):nl._CE&&il.test(t)?nl._CE("",t):s}(t))||e},cl=function(t,e,n,i){void 0===n&&(n=function(t){return 1-e(1-t)}),void 0===i&&(i=function(t){return t<.5?e(2*t)/2:1-e(2*(1-t))/2});var r,a={easeIn:e,easeOut:n,easeInOut:i};return ks(t,(function(t){for(var e in nl[t]=bs[t]=a,nl[r=t.toLowerCase()]=n,a)nl[r+("easeIn"===e?".in":"easeOut"===e?".out":".inOut")]=nl[t+"."+e]=a[e]})),a},hl=function(t){return function(e){return e<.5?(1-t(1-2*e))/2:.5+t(2*(e-.5))/2}},ul=function t(e,n,i){var r=n>=1?n:1,a=(i||(e?.3:.45))/(n<1?n:1),s=a/$a*(Math.asin(1/r)||0),o=function(t){return 1===t?1:r*Math.pow(2,-10*t)*rs((t-s)*a)+1},l="out"===e?o:"in"===e?function(t){return 1-o(1-t)}:hl(o);return a=$a/a,l.config=function(n,i){return t(e,n,i)},l},dl=function t(e,n){void 0===n&&(n=1.70158);var i=function(t){return t?--t*t*((n+1)*t+n)+1:0},r="out"===e?i:"in"===e?function(t){return 1-i(1-t)}:hl(i);return r.config=function(n){return t(e,n)},r};ks("Linear,Quad,Cubic,Quart,Quint,Strong",(function(t,e){var n=e<5?e+1:e;cl(t+",Power"+(n-1),e?function(t){return Math.pow(t,n)}:function(t){return t},(function(t){return 1-Math.pow(1-t,n)}),(function(t){return t<.5?Math.pow(2*t,n)/2:1-Math.pow(2*(1-t),n)/2}))})),nl.Linear.easeNone=nl.none=nl.Linear.easeIn,cl("Elastic",ul("in"),ul("out"),ul()),Xa=7.5625,ja=1/(qa=2.75),cl("Bounce",(function(t){return 1-Ya(1-t)}),Ya=function(t){return t<ja?Xa*t*t:t<.7272727272727273?Xa*Math.pow(t-1.5/qa,2)+.75:t<.9090909090909092?Xa*(t-=2.25/qa)*t+.9375:Xa*Math.pow(t-2.625/qa,2)+.984375}),cl("Expo",(function(t){return t?Math.pow(2,10*(t-1)):0})),cl("Circ",(function(t){return-(ns(1-t*t)-1)})),cl("Sine",(function(t){return 1===t?1:1-is(t*ts)})),cl("Back",dl("in"),dl("out"),dl()),nl.SteppedEase=nl.steps=bs.SteppedEase={config:function(t,e){void 0===t&&(t=1);var n=1/t,i=t+(e?0:1),r=e?1:0;return function(t){return((i*Ao(0,.99999999,t)|0)+r)*n}}},Ka.ease=nl["quad.out"],ks("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(t){return zs+=t+","+t+"Params,"}));var fl=function(t,e){this.id=es++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:Gs,this.set=e?e.getSetter:Pl},pl=function(){function t(t){this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,Mo(this,+t.duration,1,1),this.data=t.data,Ua&&(this._ctx=Ua,Ua.data.push(this)),Va||tl.wake()}var e=t.prototype;return e.delay=function(t){return t||0===t?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+t-this._delay),this._delay=t,this):this._delay},e.duration=function(t){return arguments.length?this.totalDuration(this._repeat>0?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},e.totalDuration=function(t){return arguments.length?(this._dirty=0,Mo(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(t,e){if(el(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(po(this,t),!n._dp||n.parent||mo(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&t<this._tDur||this._ts<0&&t>0||!this._tDur&&!t)&&go(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!e||this._initted&&Math.abs(this._zTime)===Qa||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),Ys(this,t,e)),this},e.time=function(t,e){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+co(this))%(this._dur+this._rDelay)||(t?this._dur:0),e):this._time},e.totalProgress=function(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},e.progress=function(t,e){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?t:1-t)+co(this),e):this.duration()?Math.min(1,this._time/this._dur):this.ratio},e.iteration=function(t,e){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*n,e):this._repeat?ho(this._tTime,n)+1:1},e.timeScale=function(t){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===t)return this;var e=this.parent&&this._ts?uo(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||-1e-8===t?0:this._rts,this.totalTime(Ao(-this._delay,this._tDur,e),!0),fo(this),so(this)},e.paused=function(t){return arguments.length?(this._ps!==t&&(this._ps=t,t?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(el(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Qa&&(this._tTime-=Qa)))),this):this._ps},e.startTime=function(t){if(arguments.length){this._start=t;var e=this.parent||this._dp;return e&&(e._sort||!this.parent)&&go(e,this,t-this._delay),this}return this._start},e.endTime=function(t){return this._start+(hs(t)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(t){var e=this.parent||this._dp;return e?t&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?uo(e.rawTime(t),this):this._tTime:this._tTime},e.revert=function(t){void 0===t&&(t=Ls);var e=Oa;return Oa=t,this.timeline&&this.timeline.revert(t),this.totalTime(-.01,t.suppressEvents),"nested"!==this.data&&ro(this),Oa=e,this},e.globalTime=function(t){for(var e=this,n=arguments.length?t:e.rawTime();e;)n=e._start+n/(e._ts||1),e=e._dp;return!this.parent&&this.vars.immediateRender?-1:n},e.repeat=function(t){return arguments.length?(this._repeat=t===1/0?-2:t,bo(this)):-2===this._repeat?1/0:this._repeat},e.repeatDelay=function(t){if(arguments.length){var e=this._time;return this._rDelay=t,bo(this),e?this.time(e):this}return this._rDelay},e.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},e.seek=function(t,e){return this.totalTime(So(this,t),hs(e))},e.restart=function(t,e){return this.play().totalTime(t?-this._delay:0,hs(e))},e.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},e.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},e.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-1e-8:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},e.isActive=function(){var t,e=this.parent||this._dp,n=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(t=e.rawTime(!0))>=n&&t<this.endTime(!0)-Qa))},e.eventCallback=function(t,e,n){var i=this.vars;return arguments.length>1?(e?(i[t]=e,n&&(i[t+"Params"]=n),"onUpdate"===t&&(this._onUpdate=e)):delete i[t],this):i[t]},e.then=function(t){var e=this;return new Promise((function(n){var i=ss(t)?t:Ks,r=function(){var t=e.then;e.then=null,ss(i)&&(i=i(e))&&(i.then||i===e)&&(e.then=t),n(i),e.then=t};e._initted&&1===e.totalProgress()&&e._ts>=0||!e._tTime&&e._ts<0?r():e._prom=r}))},e.kill=function(){Wo(this)},t}();Js(pl.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var ml=function(t){function e(e,n){var i;return void 0===e&&(e={}),(i=t.call(this,e)||this).labels={},i.smoothChildTiming=!!e.smoothChildTiming,i.autoRemoveChildren=!!e.autoRemoveChildren,i._sort=hs(e.sortChildren),Fa&&go(e.parent||Fa,Da(i),n),e.reversed&&i.reverse(),e.paused&&i.paused(!0),e.scrollTrigger&&_o(Da(i),e.scrollTrigger),i}Na(e,t);var n=e.prototype;return n.to=function(t,e,n){return Eo(0,arguments,this),this},n.from=function(t,e,n){return Eo(1,arguments,this),this},n.fromTo=function(t,e,n,i){return Eo(2,arguments,this),this},n.set=function(t,e,n){return e.duration=0,e.parent=this,eo(e).repeatDelay||(e.repeat=0),e.immediateRender=!!e.immediateRender,new wl(t,e,So(this,n),1),this},n.call=function(t,e,n){return go(this,wl.delayedCall(0,t,e),n)},n.staggerTo=function(t,e,n,i,r,a,s){return n.duration=e,n.stagger=n.stagger||i,n.onComplete=a,n.onCompleteParams=s,n.parent=this,new wl(t,n,So(this,r)),this},n.staggerFrom=function(t,e,n,i,r,a,s){return n.runBackwards=1,eo(n).immediateRender=hs(n.immediateRender),this.staggerTo(t,e,n,i,r,a,s)},n.staggerFromTo=function(t,e,n,i,r,a,s,o){return i.startAt=n,eo(i).immediateRender=hs(i.immediateRender),this.staggerTo(t,e,i,r,a,s,o)},n.render=function(t,e,n){var i,r,a,s,o,l,c,h,u,d,f,p,m=this._time,g=this._dirty?this.totalDuration():this._tDur,_=this._dur,v=t<=0?0:Vs(t),x=this._zTime<0!=t<0&&(this._initted||!_);if(this!==Fa&&v>g&&t>=0&&(v=g),v!==this._tTime||n||x){if(m!==this._time&&_&&(v+=this._time-m,t+=this._time-m),i=v,u=this._start,l=!(h=this._ts),x&&(_||(m=this._zTime),(t||!e)&&(this._zTime=t)),this._repeat){if(f=this._yoyo,o=_+this._rDelay,this._repeat<-1&&t<0)return this.totalTime(100*o+t,e,n);if(i=Vs(v%o),v===g?(s=this._repeat,i=_):((s=~~(v/o))&&s===v/o&&(i=_,s--),i>_&&(i=_)),d=ho(this._tTime,o),!m&&this._tTime&&d!==s&&(d=s),f&&1&s&&(i=_-i,p=1),s!==d&&!this._lock){var y=f&&1&d,M=y===(f&&1&s);if(s<d&&(y=!y),m=y?0:_,this._lock=1,this.render(m||(p?0:Vs(s*o)),e,!_)._lock=0,this._tTime=v,!e&&this.parent&&ko(this,"onRepeat"),this.vars.repeatRefresh&&!p&&(this.invalidate()._lock=1),m&&m!==this._time||l!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(_=this._dur,g=this._tDur,M&&(this._lock=2,m=y?_:-1e-4,this.render(m,!0),this.vars.repeatRefresh&&!p&&this.invalidate()),this._lock=0,!this._ts&&!l)return this;ol(this,p)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(c=function(t,e,n){var i;if(n>e)for(i=t._first;i&&i._start<=n;){if("isPause"===i.data&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=n;){if("isPause"===i.data&&i._start<e)return i;i=i._prev}}(this,Vs(m),Vs(i)),c&&(v-=i-(i=c._start))),this._tTime=v,this._time=i,this._act=!h,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=t,m=0),!m&&i&&!e&&(ko(this,"onStart"),this._tTime!==v))return this;if(i>=m&&t>=0)for(r=this._first;r;){if(a=r._next,(r._act||i>=r._start)&&r._ts&&c!==r){if(r.parent!==this)return this.render(t,e,n);if(r.render(r._ts>0?(i-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(i-r._start)*r._ts,e,n),i!==this._time||!this._ts&&!l){c=0,a&&(v+=this._zTime=-1e-8);break}}r=a}else{n=n||Oa,r=this._last;for(var b=t<0?t:i;r;){if(a=r._prev,(r._act||b<=r._end)&&r._ts&&c!==r){if(r.parent!==this)return this.render(t,e,n);if(r.render(r._ts>0?(b-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(b-r._start)*r._ts,e,n),i!==this._time||!this._ts&&!l){c=0,a&&(v+=this._zTime=b?-1e-8:Qa);break}}r=a}}if(c&&!e&&(this.pause(),c.render(i>=m?0:-1e-8)._zTime=i>=m?1:-1,this._ts))return this._start=u,fo(this),this.render(t,e,n);this._onUpdate&&!e&&ko(this,"onUpdate",!0),(v===g&&this._tTime>=this.totalDuration()||!v&&m)&&(u!==this._start&&Math.abs(h)===Math.abs(this._ts)||this._lock||((t||!_)&&(v===g&&this._ts>0||!v&&this._ts<0)&&ro(this,1),e||t<0&&!m||!v&&!m&&g||(ko(this,v===g&&t>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(v<g&&this.timeScale()>0)&&this._prom())))}return this},n.add=function(t,e){var n=this;if(os(e)||(e=So(this,e,t)),!(t instanceof pl)){if(ps(t))return t.forEach((function(t){return n.add(t,e)})),this;if(as(t))return this.addLabel(t,e);if(!ss(t))return this;t=wl.delayedCall(0,t)}return this!==t?go(this,t,e):this},n.getChildren=function(t,e,n,i){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===n&&(n=!0),void 0===i&&(i=-Ja);for(var r=[],a=this._first;a;)a._start>=i&&(a instanceof wl?e&&r.push(a):(n&&r.push(a),t&&r.push.apply(r,a.getChildren(!0,e,n)))),a=a._next;return r},n.getById=function(t){for(var e=this.getChildren(1,1,1),n=e.length;n--;)if(e[n].vars.id===t)return e[n]},n.remove=function(t){return as(t)?this.removeLabel(t):ss(t)?this.killTweensOf(t):(io(this,t),t===this._recent&&(this._recent=this._last),ao(this))},n.totalTime=function(e,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Vs(tl.time-(this._ts>0?e/this._ts:(this.totalDuration()-e)/-this._ts))),t.prototype.totalTime.call(this,e,n),this._forcing=0,this):this._tTime},n.addLabel=function(t,e){return this.labels[t]=So(this,e),this},n.removeLabel=function(t){return delete this.labels[t],this},n.addPause=function(t,e,n){var i=wl.delayedCall(0,e||Rs,n);return i.data="isPause",this._hasPause=1,go(this,i,So(this,t))},n.removePause=function(t){var e=this._first;for(t=So(this,t);e;)e._start===t&&"isPause"===e.data&&ro(e),e=e._next},n.killTweensOf=function(t,e,n){for(var i=this.getTweensOf(t,n),r=i.length;r--;)gl!==i[r]&&i[r].kill(t,e);return this},n.getTweensOf=function(t,e){for(var n,i=[],r=Po(t),a=this._first,s=os(e);a;)a instanceof wl?qs(a._targets,r)&&(s?(!gl||a._initted&&a._ts)&&a.globalTime(0)<=e&&a.globalTime(a.totalDuration())>e:!e||a.isActive())&&i.push(a):(n=a.getTweensOf(r,e)).length&&i.push.apply(i,n),a=a._next;return i},n.tweenTo=function(t,e){e=e||{};var n,i=this,r=So(i,t),a=e,s=a.startAt,o=a.onStart,l=a.onStartParams,c=a.immediateRender,h=wl.to(i,Js({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:r,overwrite:"auto",duration:e.duration||Math.abs((r-(s&&"time"in s?s.time:i._time))/i.timeScale())||Qa,onStart:function(){if(i.pause(),!n){var t=e.duration||Math.abs((r-(s&&"time"in s?s.time:i._time))/i.timeScale());h._dur!==t&&Mo(h,t,0,1).render(h._time,!0,!0),n=1}o&&o.apply(h,l||[])}},e));return c?h.render(0):h},n.tweenFromTo=function(t,e,n){return this.tweenTo(e,Js({startAt:{time:So(this,t)}},n))},n.recent=function(){return this._recent},n.nextLabel=function(t){return void 0===t&&(t=this._time),Go(this,So(this,t))},n.previousLabel=function(t){return void 0===t&&(t=this._time),Go(this,So(this,t),1)},n.currentLabel=function(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+Qa)},n.shiftChildren=function(t,e,n){void 0===n&&(n=0);for(var i,r=this._first,a=this.labels;r;)r._start>=n&&(r._start+=t,r._end+=t),r=r._next;if(e)for(i in a)a[i]>=n&&(a[i]+=t);return ao(this)},n.invalidate=function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return t.prototype.invalidate.call(this)},n.clear=function(t){void 0===t&&(t=!0);for(var e,n=this._first;n;)e=n._next,this.remove(n),n=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),ao(this)},n.totalDuration=function(t){var e,n,i,r=0,a=this,s=a._last,o=Ja;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-t:t));if(a._dirty){for(i=a.parent;s;)e=s._prev,s._dirty&&s.totalDuration(),(n=s._start)>o&&a._sort&&s._ts&&!a._lock?(a._lock=1,go(a,s,n-s._delay,1)._lock=0):o=n,n<0&&s._ts&&(r-=n,(!i&&!a._dp||i&&i.smoothChildTiming)&&(a._start+=n/a._ts,a._time-=n,a._tTime-=n),a.shiftChildren(-n,!1,-Infinity),o=0),s._end>r&&s._ts&&(r=s._end),s=e;Mo(a,a===Fa&&a._time>r?a._time:r,1,1),a._dirty=0}return a._tDur},e.updateRoot=function(t){if(Fa._ts&&(Ys(Fa,uo(t,Fa)),ka=tl.frame),tl.frame>=Us){Us+=Za.autoSleep||120;var e=Fa._first;if((!e||!e._ts)&&Za.autoSleep&&tl._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||tl.sleep()}}},e}(pl);Js(ml.prototype,{_lock:0,_hasPause:0,_forcing:0});var gl,_l,vl=function(t,e,n,i,r,a,s){var o,l,c,h,u,d,f,p,m=new Hl(this._pt,t,e,0,1,Il,null,r),g=0,_=0;for(m.b=n,m.e=i,n+="",(f=~(i+="").indexOf("random("))&&(i=Bo(i)),a&&(a(p=[n,i],t,e),n=p[0],i=p[1]),l=n.match(vs)||[];o=vs.exec(i);)h=o[0],u=i.substring(g,o.index),c?c=(c+1)%5:"rgba("===u.substr(-5)&&(c=1),h!==l[_++]&&(d=parseFloat(l[_-1])||0,m._pt={_next:m._pt,p:u||1===_?u:",",s:d,c:"="===h.charAt(1)?Xs(d,h)-d:parseFloat(h)-d,m:c&&c<4?Math.round:0},g=vs.lastIndex);return m.c=g<i.length?i.substring(g,i.length):"",m.fp=s,(xs.test(i)||f)&&(m.e=0),this._pt=m,m},xl=function(t,e,n,i,r,a,s,o,l,c){ss(i)&&(i=i(r||0,t,a));var h,u=t[e],d="get"!==n?n:ss(u)?l?t[e.indexOf("set")||!ss(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():u,f=ss(u)?l?Cl:Rl:Al;if(as(i)&&(~i.indexOf("random(")&&(i=Bo(i)),"="===i.charAt(1)&&((h=Xs(d,i)+(Ro(d)||0))||0===h)&&(i=h)),!c||d!==i||_l)return isNaN(d*i)||""===i?(!u&&!(e in t)&&Es(e,i),vl.call(this,t,e,d,i,f,o||Za.stringFilter,l)):(h=new Hl(this._pt,t,e,+d||0,i-(d||0),"boolean"==typeof u?Nl:Dl,0,f),l&&(h.fp=l),s&&h.modifier(s,this,t),this._pt=h)},yl=function(t,e,n,i,r,a){var s,o,l,c;if(Is[t]&&!1!==(s=new Is[t]).init(r,s.rawVars?e[t]:function(t,e,n,i,r){if(ss(t)&&(t=Tl(t,r,e,n,i)),!cs(t)||t.style&&t.nodeType||ps(t)||fs(t))return as(t)?Tl(t,r,e,n,i):t;var a,s={};for(a in t)s[a]=Tl(t[a],r,e,n,i);return s}(e[t],i,r,a,n),n,i,a)&&(n._pt=o=new Hl(n._pt,r,t,0,1,s.render,s,0,s.priority),n!==Wa))for(l=n._ptLookup[n._targets.indexOf(r)],c=s._props.length;c--;)l[s._props[c]]=o;return s},Ml=function t(e,n){var i,r,a,s,o,l,c,h,u,d,f,p,m,g=e.vars,_=g.ease,v=g.startAt,x=g.immediateRender,y=g.lazy,M=g.onUpdate,b=g.onUpdateParams,T=g.callbackScope,S=g.runBackwards,E=g.yoyoEase,w=g.keyframes,A=g.autoRevert,R=e._dur,C=e._startAt,L=e._targets,P=e.parent,D=P&&"nested"===P.data?P.parent._targets:L,N="auto"===e._overwrite&&!Ia,I=e.timeline;if(I&&(!w||!_)&&(_="none"),e._ease=ll(_,Ka.ease),e._yEase=E?sl(ll(!0===E?_:E,Ka.ease)):0,E&&e._yoyo&&!e._repeat&&(E=e._yEase,e._yEase=e._ease,e._ease=E),e._from=!I&&!!g.runBackwards,!I||w&&!g.stagger){if(p=(h=L[0]?Hs(L[0]).harness:0)&&g[h.prop],i=to(g,Ps),C&&(C.revert(S&&R?Ls:Cs),C._lazy=0),v){if(ro(e._startAt=wl.set(L,Js({data:"isStart",overwrite:!1,parent:P,immediateRender:!0,lazy:hs(y),startAt:null,delay:0,onUpdate:M,onUpdateParams:b,callbackScope:T,stagger:0},v))),n<0&&(Oa||!x&&!A)&&e._startAt.revert(Ls),x&&R&&n<=0)return void(n&&(e._zTime=n))}else if(S&&R&&!C)if(n&&(x=!1),a=Js({overwrite:!1,data:"isFromStart",lazy:x&&hs(y),immediateRender:x,stagger:0,parent:P},i),p&&(a[h.prop]=p),ro(e._startAt=wl.set(L,a)),n<0&&(Oa?e._startAt.revert(Ls):e._startAt.render(-1,!0)),e._zTime=n,x){if(!n)return}else t(e._startAt,Qa);for(e._pt=e._ptCache=0,y=R&&hs(y)||y&&!R,r=0;r<L.length;r++){if(c=(o=L[r])._gsap||Bs(L)[r]._gsap,e._ptLookup[r]=d={},Ns[c.id]&&Ds.length&&js(),f=D===L?r:D.indexOf(o),h&&!1!==(u=new h).init(o,p||i,e,f,D)&&(e._pt=s=new Hl(e._pt,o,u.name,0,1,u.render,u,0,u.priority),u._props.forEach((function(t){d[t]=s})),u.priority&&(l=1)),!h||p)for(a in i)Is[a]&&(u=yl(a,i,e,f,o,D))?u.priority&&(l=1):d[a]=s=xl.call(e,o,a,"get",i[a],f,D,0,g.stringFilter);e._op&&e._op[r]&&e.kill(o,e._op[r]),N&&e._pt&&(gl=e,Fa.killTweensOf(o,d,e.globalTime(n)),m=!e.parent,gl=0),e._pt&&y&&(Ns[c.id]=1)}l&&Bl(e),e._onInit&&e._onInit(e)}e._onUpdate=M,e._initted=(!e._op||e._pt)&&!m,w&&n<=0&&I.render(Ja,!0,!0)},bl=function(t,e,n,i){var r,a,s=e.ease||i||"power1.inOut";if(ps(e))a=n[t]||(n[t]=[]),e.forEach((function(t,n){return a.push({t:n/(e.length-1)*100,v:t,e:s})}));else for(r in e)a=n[r]||(n[r]=[]),"ease"===r||a.push({t:parseFloat(t),v:e[r],e:s})},Tl=function(t,e,n,i,r){return ss(t)?t.call(e,n,i,r):as(t)&&~t.indexOf("random(")?Bo(t):t},Sl=zs+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",El={};ks(Sl+",id,stagger,delay,duration,paused,scrollTrigger",(function(t){return El[t]=1}));var wl=function(t){function e(e,n,i,r){var a;"number"==typeof n&&(i.duration=n,n=i,i=null);var s,o,l,c,h,u,d,f,p=(a=t.call(this,r?n:eo(n))||this).vars,m=p.duration,g=p.delay,_=p.immediateRender,v=p.stagger,x=p.overwrite,y=p.keyframes,M=p.defaults,b=p.scrollTrigger,T=p.yoyoEase,S=n.parent||Fa,E=(ps(e)||fs(e)?os(e[0]):"length"in n)?[e]:Po(e);if(a._targets=E.length?Bs(E):ws("GSAP target "+e+" not found. https://greensock.com",!Za.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=x,y||v||ds(m)||ds(g)){if(n=a.vars,(s=a.timeline=new ml({data:"nested",defaults:M||{}})).kill(),s.parent=s._dp=Da(a),s._start=0,v||ds(m)||ds(g)){if(c=E.length,d=v&&Io(v),cs(v))for(h in v)~Sl.indexOf(h)&&(f||(f={}),f[h]=v[h]);for(o=0;o<c;o++)(l=to(n,El)).stagger=0,T&&(l.yoyoEase=T),f&&Qs(l,f),u=E[o],l.duration=+Tl(m,Da(a),o,u,E),l.delay=(+Tl(g,Da(a),o,u,E)||0)-a._delay,!v&&1===c&&l.delay&&(a._delay=g=l.delay,a._start+=g,l.delay=0),s.to(u,l,d?d(o,u,E):0),s._ease=nl.none;s.duration()?m=g=0:a.timeline=0}else if(y){eo(Js(s.vars.defaults,{ease:"none"})),s._ease=ll(y.ease||n.ease||"none");var w,A,R,C=0;if(ps(y))y.forEach((function(t){return s.to(E,t,">")})),s.duration();else{for(h in l={},y)"ease"===h||"easeEach"===h||bl(h,y[h],l,y.easeEach);for(h in l)for(w=l[h].sort((function(t,e){return t.t-e.t})),C=0,o=0;o<w.length;o++)(R={ease:(A=w[o]).e,duration:(A.t-(o?w[o-1].t:0))/100*m})[h]=A.v,s.to(E,R,C),C+=R.duration;s.duration()<m&&s.to({},{duration:m-s.duration()})}}m||a.duration(m=s.duration())}else a.timeline=0;return!0!==x||Ia||(gl=Da(a),Fa.killTweensOf(E),gl=0),go(S,Da(a),i),n.reversed&&a.reverse(),n.paused&&a.paused(!0),(_||!m&&!y&&a._start===Vs(S._time)&&hs(_)&&lo(Da(a))&&"nested"!==S.data)&&(a._tTime=-1e-8,a.render(Math.max(0,-g))),b&&_o(Da(a),b),a}Na(e,t);var n=e.prototype;return n.render=function(t,e,n){var i,r,a,s,o,l,c,h,u,d=this._time,f=this._tDur,p=this._dur,m=t<0,g=t>f-Qa&&!m?f:t<Qa?0:t;if(p){if(g!==this._tTime||!t||n||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==m){if(i=g,h=this.timeline,this._repeat){if(s=p+this._rDelay,this._repeat<-1&&m)return this.totalTime(100*s+t,e,n);if(i=Vs(g%s),g===f?(a=this._repeat,i=p):((a=~~(g/s))&&a===g/s&&(i=p,a--),i>p&&(i=p)),(l=this._yoyo&&1&a)&&(u=this._yEase,i=p-i),o=ho(this._tTime,s),i===d&&!n&&this._initted)return this._tTime=g,this;a!==o&&(h&&this._yEase&&ol(h,l),!this.vars.repeatRefresh||l||this._lock||(this._lock=n=1,this.render(Vs(s*a),!0).invalidate()._lock=0))}if(!this._initted){if(vo(this,m?t:i,n,e))return this._tTime=0,this;if(d!==this._time)return this;if(p!==this._dur)return this.render(t,e,n)}if(this._tTime=g,this._time=i,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=c=(u||this._ease)(i/p),this._from&&(this.ratio=c=1-c),i&&!d&&!e&&(ko(this,"onStart"),this._tTime!==g))return this;for(r=this._pt;r;)r.r(c,r.d),r=r._next;h&&h.render(t<0?t:!i&&l?-1e-8:h._dur*h._ease(i/this._dur),e,n)||this._startAt&&(this._zTime=t),this._onUpdate&&!e&&(m&&oo(this,t,0,n),ko(this,"onUpdate")),this._repeat&&a!==o&&this.vars.onRepeat&&!e&&this.parent&&ko(this,"onRepeat"),g!==this._tDur&&g||this._tTime!==g||(m&&!this._onUpdate&&oo(this,t,0,!0),(t||!p)&&(g===this._tDur&&this._ts>0||!g&&this._ts<0)&&ro(this,1),e||m&&!d||!g&&!d||(ko(this,g===f?"onComplete":"onReverseComplete",!0),this._prom&&!(g<f&&this.timeScale()>0)&&this._prom()))}}else!function(t,e,n,i){var r,a,s,o=t.ratio,l=e<0||!e&&(!t._start&&xo(t)&&(t._initted||!yo(t))||(t._ts<0||t._dp._ts<0)&&!yo(t))?0:1,c=t._rDelay,h=0;if(c&&t._repeat&&(h=Ao(0,t._tDur,e),a=ho(h,c),t._yoyo&&1&a&&(l=1-l),a!==ho(t._tTime,c)&&(o=1-l,t.vars.repeatRefresh&&t._initted&&t.invalidate())),l!==o||Oa||i||t._zTime===Qa||!e&&t._zTime){if(!t._initted&&vo(t,e,i,n))return;for(s=t._zTime,t._zTime=e||(n?Qa:0),n||(n=e&&!s),t.ratio=l,t._from&&(l=1-l),t._time=0,t._tTime=h,r=t._pt;r;)r.r(l,r.d),r=r._next;e<0&&oo(t,e,0,!0),t._onUpdate&&!n&&ko(t,"onUpdate"),h&&t._repeat&&!n&&t.parent&&ko(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===l&&(l&&ro(t,1),n||(ko(t,l?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,n);return this},n.targets=function(){return this._targets},n.invalidate=function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),t.prototype.invalidate.call(this)},n.resetTo=function(t,e,n,i){Va||tl.wake(),this._ts||this.play();var r=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Ml(this,r),function(t,e,n,i,r,a,s){var o,l,c,h,u=(t._pt&&t._ptCache||(t._ptCache={}))[e];if(!u)for(u=t._ptCache[e]=[],c=t._ptLookup,h=t._targets.length;h--;){if((o=c[h][e])&&o.d&&o.d._pt)for(o=o.d._pt;o&&o.p!==e&&o.fp!==e;)o=o._next;if(!o)return _l=1,t.vars[e]="+=0",Ml(t,s),_l=0,1;u.push(o)}for(h=u.length;h--;)(o=(l=u[h])._pt||l).s=!i&&0!==i||r?o.s+(i||0)+a*o.c:i,o.c=n-o.s,l.e&&(l.e=Ws(n)+Ro(l.e)),l.b&&(l.b=o.s+Ro(l.b))}(this,t,e,n,i,this._ease(r/this._dur),r)?this.resetTo(t,e,n,i):(po(this,0),this.parent||no(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},n.kill=function(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?Wo(this):this;if(this.timeline){var n=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,gl&&!0!==gl.vars.overwrite)._first||Wo(this),this.parent&&n!==this.timeline.totalDuration()&&Mo(this,this._dur*this.timeline._tDur/n,0,1),this}var i,r,a,s,o,l,c,h=this._targets,u=t?Po(t):h,d=this._ptLookup,f=this._pt;if((!e||"all"===e)&&function(t,e){for(var n=t.length,i=n===e.length;i&&n--&&t[n]===e[n];);return n<0}(h,u))return"all"===e&&(this._pt=0),Wo(this);for(i=this._op=this._op||[],"all"!==e&&(as(e)&&(o={},ks(e,(function(t){return o[t]=1})),e=o),e=function(t,e){var n,i,r,a,s=t[0]?Hs(t[0]).harness:0,o=s&&s.aliases;if(!o)return e;for(i in n=Qs({},e),o)if(i in n)for(r=(a=o[i].split(",")).length;r--;)n[a[r]]=n[i];return n}(h,e)),c=h.length;c--;)if(~u.indexOf(h[c]))for(o in r=d[c],"all"===e?(i[c]=e,s=r,a={}):(a=i[c]=i[c]||{},s=e),s)(l=r&&r[o])&&("kill"in l.d&&!0!==l.d.kill(o)||io(this,l,"_pt"),delete r[o]),"all"!==a&&(a[o]=1);return this._initted&&!this._pt&&f&&Wo(this),this},e.to=function(t,n){return new e(t,n,arguments[2])},e.from=function(t,e){return Eo(1,arguments)},e.delayedCall=function(t,n,i,r){return new e(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:n,onReverseComplete:n,onCompleteParams:i,onReverseCompleteParams:i,callbackScope:r})},e.fromTo=function(t,e,n){return Eo(2,arguments)},e.set=function(t,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new e(t,n)},e.killTweensOf=function(t,e,n){return Fa.killTweensOf(t,e,n)},e}(pl);Js(wl.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ks("staggerTo,staggerFrom,staggerFromTo",(function(t){wl[t]=function(){var e=new ml,n=Co.call(arguments,0);return n.splice("staggerFromTo"===t?5:4,0,0),e[t].apply(e,n)}}));var Al=function(t,e,n){return t[e]=n},Rl=function(t,e,n){return t[e](n)},Cl=function(t,e,n,i){return t[e](i.fp,n)},Ll=function(t,e,n){return t.setAttribute(e,n)},Pl=function(t,e){return ss(t[e])?Rl:ls(t[e])&&t.setAttribute?Ll:Al},Dl=function(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},Nl=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},Il=function(t,e){var n=e._pt,i="";if(!t&&e.b)i=e.b;else if(1===t&&e.e)i=e.e;else{for(;n;)i=n.p+(n.m?n.m(n.s+n.c*t):Math.round(1e4*(n.s+n.c*t))/1e4)+i,n=n._next;i+=e.c}e.set(e.t,e.p,i,e)},Ol=function(t,e){for(var n=e._pt;n;)n.r(t,n.d),n=n._next},Ul=function(t,e,n,i){for(var r,a=this._pt;a;)r=a._next,a.p===i&&a.modifier(t,e,n),a=r},Fl=function(t){for(var e,n,i=this._pt;i;)n=i._next,i.p===t&&!i.op||i.op===t?io(this,i,"_pt"):i.dep||(e=1),i=n;return!e},zl=function(t,e,n,i){i.mSet(t,e,i.m.call(i.tween,n,i.mt),i)},Bl=function(t){for(var e,n,i,r,a=t._pt;a;){for(e=a._next,n=i;n&&n.pr>a.pr;)n=n._next;(a._prev=n?n._prev:r)?a._prev._next=a:i=a,(a._next=n)?n._prev=a:r=a,a=e}t._pt=i},Hl=function(){function t(t,e,n,i,r,a,s,o,l){this.t=e,this.s=i,this.c=r,this.p=n,this.r=a||Dl,this.d=s||this,this.set=o||Al,this.pr=l||0,this._next=t,t&&(t._prev=this)}return t.prototype.modifier=function(t,e,n){this.mSet=this.mSet||this.set,this.set=zl,this.m=t,this.mt=n,this.tween=e},t}();ks(zs+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(t){return Ps[t]=1})),bs.TweenMax=bs.TweenLite=wl,bs.TimelineLite=bs.TimelineMax=ml,Fa=new ml({sortChildren:!1,defaults:Ka,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Za.stringFilter=$o;var Gl=[],kl={},Wl=[],Vl=0,Xl=function(t){return(kl[t]||Wl).map((function(t){return t()}))},ql=function(){var t=Date.now(),e=[];t-Vl>2&&(Xl("matchMediaInit"),Gl.forEach((function(t){var n,i,r,a,s=t.queries,o=t.conditions;for(i in s)(n=za.matchMedia(s[i]).matches)&&(r=1),n!==o[i]&&(o[i]=n,a=1);a&&(t.revert(),r&&e.push(t))})),Xl("matchMediaRevert"),e.forEach((function(t){return t.onMatch(t)})),Vl=t,Xl("matchMedia"))},jl=function(){function t(t,e){this.selector=e&&Do(e),this.data=[],this._r=[],this.isReverted=!1,t&&this.add(t)}var e=t.prototype;return e.add=function(t,e,n){ss(t)&&(n=e,e=t,t=ss);var i=this,r=function(){var t,r=Ua,a=i.selector;return r&&r.data.push(i),n&&(i.selector=Do(n)),Ua=i,t=e.apply(i,arguments),ss(t)&&i._r.push(t),Ua=r,i.selector=a,i.isReverted=!1,t};return i.last=r,t===ss?r(i):t?i[t]=r:r},e.ignore=function(t){var e=Ua;Ua=null,t(this),Ua=e},e.getTweens=function(){var e=[];return this.data.forEach((function(n){return n instanceof t?e.push.apply(e,n.getTweens()):n instanceof wl&&n._targets[0]!==n.vars.onComplete&&e.push(n)})),e},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(t,e){var n=this;if(t?(this.getTweens().map((function(t){return{g:t.globalTime(0),t}})).sort((function(t,e){return e.g-t.g||-1})).forEach((function(e){return e.t.revert(t)})),this.data.forEach((function(e){return!(e instanceof pl)&&e.revert&&e.revert(t)})),this._r.forEach((function(e){return e(t,n)})),this.isReverted=!0):this.data.forEach((function(t){return t.kill&&t.kill()})),this.clear(),e){var i=Gl.indexOf(this);~i&&Gl.splice(i,1)}},e.revert=function(t){this.kill(t||{})},t}(),Yl=function(){function t(t){this.contexts=[],this.scope=t}var e=t.prototype;return e.add=function(t,e,n){cs(t)||(t={matches:t});var i,r,a,s=new jl(0,n||this.scope),o=s.conditions={};for(r in this.contexts.push(s),e=s.add("onMatch",e),s.queries=t,t)"all"===r?a=1:(i=za.matchMedia(t[r]))&&(Gl.indexOf(s)<0&&Gl.push(s),(o[r]=i.matches)&&(a=1),i.addListener?i.addListener(ql):i.addEventListener("change",ql));return a&&e(s),this},e.revert=function(t){this.kill(t||{})},e.kill=function(t){this.contexts.forEach((function(e){return e.kill(t,!0)}))},t}(),Zl={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e.forEach((function(t){return Vo(t)}))},timeline:function(t){return new ml(t)},getTweensOf:function(t,e){return Fa.getTweensOf(t,e)},getProperty:function(t,e,n,i){as(t)&&(t=Po(t)[0]);var r=Hs(t||{}).get,a=n?Ks:Zs;return"native"===n&&(n=""),t?e?a((Is[e]&&Is[e].get||r)(t,e,n,i)):function(e,n,i){return a((Is[e]&&Is[e].get||r)(t,e,n,i))}:t},quickSetter:function(t,e,n){if((t=Po(t)).length>1){var i=t.map((function(t){return Ql.quickSetter(t,e,n)})),r=i.length;return function(t){for(var e=r;e--;)i[e](t)}}t=t[0]||{};var a=Is[e],s=Hs(t),o=s.harness&&(s.harness.aliases||{})[e]||e,l=a?function(e){var i=new a;Wa._pt=0,i.init(t,n?e+n:e,Wa,0,[t]),i.render(1,i),Wa._pt&&Ol(1,Wa)}:s.set(t,o);return a?l:function(e){return l(t,o,n?e+n:e,s,1)}},quickTo:function(t,e,n){var i,r=Ql.to(t,Qs(((i={})[e]="+=0.1",i.paused=!0,i),n||{})),a=function(t,n,i){return r.resetTo(e,t,n,i)};return a.tween=r,a},isTweening:function(t){return Fa.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=ll(t.ease,Ka.ease)),$s(Ka,t||{})},config:function(t){return $s(Za,t||{})},registerEffect:function(t){var e=t.name,n=t.effect,i=t.plugins,r=t.defaults,a=t.extendTimeline;(i||"").split(",").forEach((function(t){return t&&!Is[t]&&!bs[t]&&ws(e+" effect requires "+t+" plugin.")})),Os[e]=function(t,e,i){return n(Po(t),Js(e||{},r),i)},a&&(ml.prototype[e]=function(t,n,i){return this.add(Os[e](t,cs(n)?n:(i=n)&&{},this),i)})},registerEase:function(t,e){nl[t]=ll(e)},parseEase:function(t,e){return arguments.length?ll(t,e):nl},getById:function(t){return Fa.getById(t)},exportRoot:function(t,e){void 0===t&&(t={});var n,i,r=new ml(t);for(r.smoothChildTiming=hs(t.smoothChildTiming),Fa.remove(r),r._dp=0,r._time=r._tTime=Fa._time,n=Fa._first;n;)i=n._next,!e&&!n._dur&&n instanceof wl&&n.vars.onComplete===n._targets[0]||go(r,n,n._start-n._delay),n=i;return go(Fa,r,0),r},context:function(t,e){return t?new jl(t,e):Ua},matchMedia:function(t){return new Yl(t)},matchMediaRefresh:function(){return Gl.forEach((function(t){var e,n,i=t.conditions;for(n in i)i[n]&&(i[n]=!1,e=1);e&&t.revert()}))||ql()},addEventListener:function(t,e){var n=kl[t]||(kl[t]=[]);~n.indexOf(e)||n.push(e)},removeEventListener:function(t,e){var n=kl[t],i=n&&n.indexOf(e);i>=0&&n.splice(i,1)},utils:{wrap:function t(e,n,i){var r=n-e;return ps(e)?zo(e,t(0,e.length),n):wo(i,(function(t){return(r+(t-e)%r)%r+e}))},wrapYoyo:function t(e,n,i){var r=n-e,a=2*r;return ps(e)?zo(e,t(0,e.length-1),n):wo(i,(function(t){return e+((t=(a+(t-e)%a)%a||0)>r?a-t:t)}))},distribute:Io,random:Fo,snap:Uo,normalize:function(t,e,n){return Ho(t,e,0,1,n)},getUnit:Ro,clamp:function(t,e,n){return wo(n,(function(n){return Ao(t,e,n)}))},splitColor:Yo,toArray:Po,selector:Do,mapRange:Ho,pipe:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){return e.reduce((function(t,e){return e(t)}),t)}},unitize:function(t,e){return function(n){return t(parseFloat(n))+(e||Ro(n))}},interpolate:function t(e,n,i,r){var a=isNaN(e+n)?0:function(t){return(1-t)*e+t*n};if(!a){var s,o,l,c,h,u=as(e),d={};if(!0===i&&(r=1)&&(i=null),u)e={p:e},n={p:n};else if(ps(e)&&!ps(n)){for(l=[],c=e.length,h=c-2,o=1;o<c;o++)l.push(t(e[o-1],e[o]));c--,a=function(t){t*=c;var e=Math.min(h,~~t);return l[e](t-e)},i=n}else r||(e=Qs(ps(e)?[]:{},e));if(!l){for(s in n)xl.call(d,e,s,"get",n[s]);a=function(t){return Ol(t,d)||(u?e.p:e)}}}return wo(i,a)},shuffle:No},install:Ss,effects:Os,ticker:tl,updateRoot:ml.updateRoot,plugins:Is,globalTimeline:Fa,core:{PropTween:Hl,globals:As,Tween:wl,Timeline:ml,Animation:pl,getCache:Hs,_removeLinkedListItem:io,reverting:function(){return Oa},context:function(t){return t&&Ua&&(Ua.data.push(t),t._ctx=Ua),Ua},suppressOverwrites:function(t){return Ia=t}}};ks("to,from,fromTo,delayedCall,set,killTweensOf",(function(t){return Zl[t]=wl[t]})),tl.add(ml.updateRoot),Wa=Zl.to({},{duration:0});var Kl=function(t,e){for(var n=t._pt;n&&n.p!==e&&n.op!==e&&n.fp!==e;)n=n._next;return n},Jl=function(t,e){return{name:t,rawVars:1,init:function(t,n,i){i._onInit=function(t){var i,r;if(as(n)&&(i={},ks(n,(function(t){return i[t]=1})),n=i),e){for(r in i={},n)i[r]=e(n[r]);n=i}!function(t,e){var n,i,r,a=t._targets;for(n in e)for(i=a.length;i--;)(r=t._ptLookup[i][n])&&(r=r.d)&&(r._pt&&(r=Kl(r,n)),r&&r.modifier&&r.modifier(e[n],t,a[i],n))}(t,n)}}}},Ql=Zl.registerPlugin({name:"attr",init:function(t,e,n,i,r){var a,s,o;for(a in this.tween=n,e)o=t.getAttribute(a)||"",(s=this.add(t,"setAttribute",(o||0)+"",e[a],i,r,0,0,a)).op=a,s.b=o,this._props.push(a)},render:function(t,e){for(var n=e._pt;n;)Oa?n.set(n.t,n.p,n.b,n):n.r(t,n.d),n=n._next}},{name:"endArray",init:function(t,e){for(var n=e.length;n--;)this.add(t,n,t[n]||0,e[n],0,0,0,0,0,1)}},Jl("roundProps",Oo),Jl("modifiers"),Jl("snap",Uo))||Zl;wl.version=ml.version=Ql.version="3.11.0",Ga=1,us()&&el(),nl.Power0,nl.Power1,nl.Power2;var $l,tc,ec,nc,ic,rc,ac,sc,oc=nl.Power3,lc=(nl.Power4,nl.Linear,nl.Quad,nl.Cubic,nl.Quart,nl.Quint,nl.Strong,nl.Elastic),cc=(nl.Back,nl.SteppedEase,nl.Bounce,nl.Sine,nl.Expo,nl.Circ,{}),hc=180/Math.PI,uc=Math.PI/180,dc=Math.atan2,fc=/([A-Z])/g,pc=/(left|right|width|margin|padding|x)/i,mc=/[\s,\(]\S/,gc={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},_c=function(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},vc=function(t,e){return e.set(e.t,e.p,1===t?e.e:Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},xc=function(t,e){return e.set(e.t,e.p,t?Math.round(1e4*(e.s+e.c*t))/1e4+e.u:e.b,e)},yc=function(t,e){var n=e.s+e.c*t;e.set(e.t,e.p,~~(n+(n<0?-.5:.5))+e.u,e)},Mc=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},bc=function(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)},Tc=function(t,e,n){return t.style[e]=n},Sc=function(t,e,n){return t.style.setProperty(e,n)},Ec=function(t,e,n){return t._gsap[e]=n},wc=function(t,e,n){return t._gsap.scaleX=t._gsap.scaleY=n},Ac=function(t,e,n,i,r){var a=t._gsap;a.scaleX=a.scaleY=n,a.renderTransform(r,a)},Rc=function(t,e,n,i,r){var a=t._gsap;a[e]=n,a.renderTransform(r,a)},Cc="transform",Lc=Cc+"Origin",Pc=function(t){var e=this,n=this.target,i=n.style;if(t in cc){if(this.tfm=this.tfm||{},"transform"!==t&&(~(t=gc[t]||t).indexOf(",")?t.split(",").forEach((function(t){return e.tfm[t]=Zc(n,t)})):this.tfm[t]=n._gsap.x?n._gsap[t]:Zc(n,t)),n._gsap.svg&&(this.svg=n.getAttribute(t)||""),this.props.indexOf(Cc)>=0)return;t=Cc}i&&this.props.push(t,i[t])},Dc=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},Nc=function(){var t,e,n=this.props,i=this.target,r=i.style,a=i._gsap;for(t=0;t<n.length;t+=2)n[t+1]?r[n[t]]=n[t+1]:r.removeProperty(n[t].replace(fc,"-$1").toLowerCase());if(this.tfm){for(e in a.svg&&i.setAttribute("transform",this.svg||""),this.tfm)a[e]=this.tfm[e];!(t=ac())||t.isStart||r[Cc]||(Dc(r),a.uncache=1)}},Ic=function(t,e){var n={target:t,props:[],revert:Nc,save:Pc};return e&&e.split(",").forEach((function(t){return n.save(t)})),n},Oc=function(t,e){var n=tc.createElementNS?tc.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):tc.createElement(t);return n.style?n:tc.createElement(t)},Uc=function t(e,n,i){var r=getComputedStyle(e);return r[n]||r.getPropertyValue(n.replace(fc,"-$1").toLowerCase())||r.getPropertyValue(n)||!i&&t(e,zc(n)||n,1)||""},Fc="O,Moz,ms,Ms,Webkit".split(","),zc=function(t,e,n){var i=(e||ic).style,r=5;if(t in i&&!n)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);r--&&!(Fc[r]+t in i););return r<0?null:(3===r?"ms":r>=0?Fc[r]:"")+t},Bc=function(){"undefined"!=typeof window&&window.document&&($l=window,tc=$l.document,ec=tc.documentElement,ic=Oc("div")||{style:{}},Oc("div"),Cc=zc(Cc),Lc=Cc+"Origin",ic.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",sc=!!zc("perspective"),ac=Ql.core.reverting,nc=1)},Hc=function t(e){var n,i=Oc("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,a=this.nextSibling,s=this.style.cssText;if(ec.appendChild(i),i.appendChild(this),this.style.display="block",e)try{n=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=t}catch(t){}else this._gsapBBox&&(n=this._gsapBBox());return r&&(a?r.insertBefore(this,a):r.appendChild(this)),ec.removeChild(i),this.style.cssText=s,n},Gc=function(t,e){for(var n=e.length;n--;)if(t.hasAttribute(e[n]))return t.getAttribute(e[n])},kc=function(t){var e;try{e=t.getBBox()}catch(n){e=Hc.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===Hc||(e=Hc.call(t,!0)),!e||e.width||e.x||e.y?e:{x:+Gc(t,["x","cx","x1"])||0,y:+Gc(t,["y","cy","y1"])||0,width:0,height:0}},Wc=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!kc(t))},Vc=function(t,e){if(e){var n=t.style;e in cc&&e!==Lc&&(e=Cc),n.removeProperty?("ms"!==e.substr(0,2)&&"webkit"!==e.substr(0,6)||(e="-"+e),n.removeProperty(e.replace(fc,"-$1").toLowerCase())):n.removeAttribute(e)}},Xc=function(t,e,n,i,r,a){var s=new Hl(t._pt,e,n,0,1,a?bc:Mc);return t._pt=s,s.b=i,s.e=r,t._props.push(n),s},qc={deg:1,rad:1,turn:1},jc={grid:1,flex:1},Yc=function t(e,n,i,r){var a,s,o,l,c=parseFloat(i)||0,h=(i+"").trim().substr((c+"").length)||"px",u=ic.style,d=pc.test(n),f="svg"===e.tagName.toLowerCase(),p=(f?"client":"offset")+(d?"Width":"Height"),m=100,g="px"===r,_="%"===r;return r===h||!c||qc[r]||qc[h]?c:("px"!==h&&!g&&(c=t(e,n,i,"px")),l=e.getCTM&&Wc(e),!_&&"%"!==h||!cc[n]&&!~n.indexOf("adius")?(u[d?"width":"height"]=m+(g?h:r),s=~n.indexOf("adius")||"em"===r&&e.appendChild&&!f?e:e.parentNode,l&&(s=(e.ownerSVGElement||{}).parentNode),s&&s!==tc&&s.appendChild||(s=tc.body),(o=s._gsap)&&_&&o.width&&d&&o.time===tl.time&&!o.uncache?Ws(c/o.width*m):((_||"%"===h)&&!jc[Uc(s,"display")]&&(u.position=Uc(e,"position")),s===e&&(u.position="static"),s.appendChild(ic),a=ic[p],s.removeChild(ic),u.position="absolute",d&&_&&((o=Hs(s)).time=tl.time,o.width=s[p]),Ws(g?a*c/m:a&&c?m/a*c:0))):(a=l?e.getBBox()[d?"width":"height"]:e[p],Ws(_?c/a*m:c/100*a)))},Zc=function(t,e,n,i){var r;return nc||Bc(),e in gc&&"transform"!==e&&~(e=gc[e]).indexOf(",")&&(e=e.split(",")[0]),cc[e]&&"transform"!==e?(r=sh(t,i),r="transformOrigin"!==e?r[e]:r.svg?r.origin:oh(Uc(t,Lc))+" "+r.zOrigin+"px"):(!(r=t.style[e])||"auto"===r||i||~(r+"").indexOf("calc("))&&(r=$c[e]&&$c[e](t,e,n)||Uc(t,e)||Gs(t,e)||("opacity"===e?1:0)),n&&!~(r+"").trim().indexOf(" ")?Yc(t,e,r,n)+n:r},Kc=function(t,e,n,i){if(!n||"none"===n){var r=zc(e,t,1),a=r&&Uc(t,r,1);a&&a!==n?(e=r,n=a):"borderColor"===e&&(n=Uc(t,"borderTopColor"))}var s,o,l,c,h,u,d,f,p,m,g,_=new Hl(this._pt,t.style,e,0,1,Il),v=0,x=0;if(_.b=n,_.e=i,n+="","auto"==(i+="")&&(t.style[e]=i,i=Uc(t,e)||i,t.style[e]=n),$o(s=[n,i]),i=s[1],l=(n=s[0]).match(_s)||[],(i.match(_s)||[]).length){for(;o=_s.exec(i);)d=o[0],p=i.substring(v,o.index),h?h=(h+1)%5:"rgba("!==p.substr(-5)&&"hsla("!==p.substr(-5)||(h=1),d!==(u=l[x++]||"")&&(c=parseFloat(u)||0,g=u.substr((c+"").length),"="===d.charAt(1)&&(d=Xs(c,d)+g),f=parseFloat(d),m=d.substr((f+"").length),v=_s.lastIndex-m.length,m||(m=m||Za.units[e]||g,v===i.length&&(i+=m,_.e+=m)),g!==m&&(c=Yc(t,e,u,m)||0),_._pt={_next:_._pt,p:p||1===x?p:",",s:c,c:f-c,m:h&&h<4||"zIndex"===e?Math.round:0});_.c=v<i.length?i.substring(v,i.length):""}else _.r="display"===e&&"none"===i?bc:Mc;return xs.test(i)&&(_.e=0),this._pt=_,_},Jc={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},Qc=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var n,i,r,a=e.t,s=a.style,o=e.u,l=a._gsap;if("all"===o||!0===o)s.cssText="",i=1;else for(r=(o=o.split(",")).length;--r>-1;)n=o[r],cc[n]&&(i=1,n="transformOrigin"===n?Lc:Cc),Vc(a,n);i&&(Vc(a,Cc),l&&(l.svg&&a.removeAttribute("transform"),sh(a,1),l.uncache=1,Dc(s)))}},$c={clearProps:function(t,e,n,i,r){if("isFromStart"!==r.data){var a=t._pt=new Hl(t._pt,e,n,0,0,Qc);return a.u=i,a.pr=-10,a.tween=r,t._props.push(n),1}}},th=[1,0,0,1,0,0],eh={},nh=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},ih=function(t){var e=Uc(t,Cc);return nh(e)?th:e.substr(7).match(gs).map(Ws)},rh=function(t,e){var n,i,r,a,s=t._gsap||Hs(t),o=t.style,l=ih(t);return s.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(l=[(r=t.transform.baseVal.consolidate().matrix).a,r.b,r.c,r.d,r.e,r.f]).join(",")?th:l:(l!==th||t.offsetParent||t===ec||s.svg||(r=o.display,o.display="block",(n=t.parentNode)&&t.offsetParent||(a=1,i=t.nextElementSibling,ec.appendChild(t)),l=ih(t),r?o.display=r:Vc(t,"display"),a&&(i?n.insertBefore(t,i):n?n.appendChild(t):ec.removeChild(t))),e&&l.length>6?[l[0],l[1],l[4],l[5],l[12],l[13]]:l)},ah=function(t,e,n,i,r,a){var s,o,l,c=t._gsap,h=r||rh(t,!0),u=c.xOrigin||0,d=c.yOrigin||0,f=c.xOffset||0,p=c.yOffset||0,m=h[0],g=h[1],_=h[2],v=h[3],x=h[4],y=h[5],M=e.split(" "),b=parseFloat(M[0])||0,T=parseFloat(M[1])||0;n?h!==th&&(o=m*v-g*_)&&(l=b*(-g/o)+T*(m/o)-(m*y-g*x)/o,b=b*(v/o)+T*(-_/o)+(_*y-v*x)/o,T=l):(b=(s=kc(t)).x+(~M[0].indexOf("%")?b/100*s.width:b),T=s.y+(~(M[1]||M[0]).indexOf("%")?T/100*s.height:T)),i||!1!==i&&c.smooth?(x=b-u,y=T-d,c.xOffset=f+(x*m+y*_)-x,c.yOffset=p+(x*g+y*v)-y):c.xOffset=c.yOffset=0,c.xOrigin=b,c.yOrigin=T,c.smooth=!!i,c.origin=e,c.originIsAbsolute=!!n,t.style[Lc]="0px 0px",a&&(Xc(a,c,"xOrigin",u,b),Xc(a,c,"yOrigin",d,T),Xc(a,c,"xOffset",f,c.xOffset),Xc(a,c,"yOffset",p,c.yOffset)),t.setAttribute("data-svg-origin",b+" "+T)},sh=function(t,e){var n=t._gsap||new fl(t);if("x"in n&&!e&&!n.uncache)return n;var i,r,a,s,o,l,c,h,u,d,f,p,m,g,_,v,x,y,M,b,T,S,E,w,A,R,C,L,P,D,N,I,O=t.style,U=n.scaleX<0,F="px",z="deg",B=getComputedStyle(t),H=Uc(t,Lc)||"0";return i=r=a=l=c=h=u=d=f=0,s=o=1,n.svg=!(!t.getCTM||!Wc(t)),B.translate&&("none"===B.translate&&"none"===B.scale&&"none"===B.rotate||(O[Cc]=("none"!==B.translate?"translate3d("+(B.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==B.rotate?"rotate("+B.rotate+") ":"")+("none"!==B.scale?"scale("+B.scale.split(" ").join(",")+") ":"")+B[Cc]),O.scale=O.rotate=O.translate="none"),g=rh(t,n.svg),n.svg&&(w=(!n.uncache||"0px 0px"===H)&&!e&&t.getAttribute("data-svg-origin"),ah(t,w||H,!!w||n.originIsAbsolute,!1!==n.smooth,g)),p=n.xOrigin||0,m=n.yOrigin||0,g!==th&&(y=g[0],M=g[1],b=g[2],T=g[3],i=S=g[4],r=E=g[5],6===g.length?(s=Math.sqrt(y*y+M*M),o=Math.sqrt(T*T+b*b),l=y||M?dc(M,y)*hc:0,(u=b||T?dc(b,T)*hc+l:0)&&(o*=Math.abs(Math.cos(u*uc))),n.svg&&(i-=p-(p*y+m*b),r-=m-(p*M+m*T))):(I=g[6],D=g[7],C=g[8],L=g[9],P=g[10],N=g[11],i=g[12],r=g[13],a=g[14],c=(_=dc(I,P))*hc,_&&(w=S*(v=Math.cos(-_))+C*(x=Math.sin(-_)),A=E*v+L*x,R=I*v+P*x,C=S*-x+C*v,L=E*-x+L*v,P=I*-x+P*v,N=D*-x+N*v,S=w,E=A,I=R),h=(_=dc(-b,P))*hc,_&&(v=Math.cos(-_),N=T*(x=Math.sin(-_))+N*v,y=w=y*v-C*x,M=A=M*v-L*x,b=R=b*v-P*x),l=(_=dc(M,y))*hc,_&&(w=y*(v=Math.cos(_))+M*(x=Math.sin(_)),A=S*v+E*x,M=M*v-y*x,E=E*v-S*x,y=w,S=A),c&&Math.abs(c)+Math.abs(l)>359.9&&(c=l=0,h=180-h),s=Ws(Math.sqrt(y*y+M*M+b*b)),o=Ws(Math.sqrt(E*E+I*I)),_=dc(S,E),u=Math.abs(_)>2e-4?_*hc:0,f=N?1/(N<0?-N:N):0),n.svg&&(w=t.getAttribute("transform"),n.forceCSS=t.setAttribute("transform","")||!nh(Uc(t,Cc)),w&&t.setAttribute("transform",w))),Math.abs(u)>90&&Math.abs(u)<270&&(U?(s*=-1,u+=l<=0?180:-180,l+=l<=0?180:-180):(o*=-1,u+=u<=0?180:-180)),e=e||n.uncache,n.x=i-((n.xPercent=i&&(!e&&n.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-i)?-50:0)))?t.offsetWidth*n.xPercent/100:0)+F,n.y=r-((n.yPercent=r&&(!e&&n.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-r)?-50:0)))?t.offsetHeight*n.yPercent/100:0)+F,n.z=a+F,n.scaleX=Ws(s),n.scaleY=Ws(o),n.rotation=Ws(l)+z,n.rotationX=Ws(c)+z,n.rotationY=Ws(h)+z,n.skewX=u+z,n.skewY=d+z,n.transformPerspective=f+F,(n.zOrigin=parseFloat(H.split(" ")[2])||0)&&(O[Lc]=oh(H)),n.xOffset=n.yOffset=0,n.force3D=Za.force3D,n.renderTransform=n.svg?ph:sc?fh:ch,n.uncache=0,n},oh=function(t){return(t=t.split(" "))[0]+" "+t[1]},lh=function(t,e,n){var i=Ro(e);return Ws(parseFloat(e)+parseFloat(Yc(t,"x",n+"px",i)))+i},ch=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,fh(t,e)},hh="0deg",uh="0px",dh=") ",fh=function(t,e){var n=e||this,i=n.xPercent,r=n.yPercent,a=n.x,s=n.y,o=n.z,l=n.rotation,c=n.rotationY,h=n.rotationX,u=n.skewX,d=n.skewY,f=n.scaleX,p=n.scaleY,m=n.transformPerspective,g=n.force3D,_=n.target,v=n.zOrigin,x="",y="auto"===g&&t&&1!==t||!0===g;if(v&&(h!==hh||c!==hh)){var M,b=parseFloat(c)*uc,T=Math.sin(b),S=Math.cos(b);b=parseFloat(h)*uc,M=Math.cos(b),a=lh(_,a,T*M*-v),s=lh(_,s,-Math.sin(b)*-v),o=lh(_,o,S*M*-v+v)}m!==uh&&(x+="perspective("+m+dh),(i||r)&&(x+="translate("+i+"%, "+r+"%) "),(y||a!==uh||s!==uh||o!==uh)&&(x+=o!==uh||y?"translate3d("+a+", "+s+", "+o+") ":"translate("+a+", "+s+dh),l!==hh&&(x+="rotate("+l+dh),c!==hh&&(x+="rotateY("+c+dh),h!==hh&&(x+="rotateX("+h+dh),u===hh&&d===hh||(x+="skew("+u+", "+d+dh),1===f&&1===p||(x+="scale("+f+", "+p+dh),_.style[Cc]=x||"translate(0, 0)"},ph=function(t,e){var n,i,r,a,s,o=e||this,l=o.xPercent,c=o.yPercent,h=o.x,u=o.y,d=o.rotation,f=o.skewX,p=o.skewY,m=o.scaleX,g=o.scaleY,_=o.target,v=o.xOrigin,x=o.yOrigin,y=o.xOffset,M=o.yOffset,b=o.forceCSS,T=parseFloat(h),S=parseFloat(u);d=parseFloat(d),f=parseFloat(f),(p=parseFloat(p))&&(f+=p=parseFloat(p),d+=p),d||f?(d*=uc,f*=uc,n=Math.cos(d)*m,i=Math.sin(d)*m,r=Math.sin(d-f)*-g,a=Math.cos(d-f)*g,f&&(p*=uc,s=Math.tan(f-p),r*=s=Math.sqrt(1+s*s),a*=s,p&&(s=Math.tan(p),n*=s=Math.sqrt(1+s*s),i*=s)),n=Ws(n),i=Ws(i),r=Ws(r),a=Ws(a)):(n=m,a=g,i=r=0),(T&&!~(h+"").indexOf("px")||S&&!~(u+"").indexOf("px"))&&(T=Yc(_,"x",h,"px"),S=Yc(_,"y",u,"px")),(v||x||y||M)&&(T=Ws(T+v-(v*n+x*r)+y),S=Ws(S+x-(v*i+x*a)+M)),(l||c)&&(s=_.getBBox(),T=Ws(T+l/100*s.width),S=Ws(S+c/100*s.height)),s="matrix("+n+","+i+","+r+","+a+","+T+","+S+")",_.setAttribute("transform",s),b&&(_.style[Cc]=s)},mh=function(t,e,n,i,r){var a,s,o=360,l=as(r),c=parseFloat(r)*(l&&~r.indexOf("rad")?hc:1)-i,h=i+c+"deg";return l&&("short"===(a=r.split("_")[1])&&(c%=o)!=c%180&&(c+=c<0?o:-360),"cw"===a&&c<0?c=(c+36e9)%o-~~(c/o)*o:"ccw"===a&&c>0&&(c=(c-36e9)%o-~~(c/o)*o)),t._pt=s=new Hl(t._pt,e,n,i,c,vc),s.e=h,s.u="deg",t._props.push(n),s},gh=function(t,e){for(var n in e)t[n]=e[n];return t},_h=function(t,e,n){var i,r,a,s,o,l,c,h=gh({},n._gsap),u=n.style;for(r in h.svg?(a=n.getAttribute("transform"),n.setAttribute("transform",""),u[Cc]=e,i=sh(n,1),Vc(n,Cc),n.setAttribute("transform",a)):(a=getComputedStyle(n)[Cc],u[Cc]=e,i=sh(n,1),u[Cc]=a),cc)(a=h[r])!==(s=i[r])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(r)<0&&(o=Ro(a)!==(c=Ro(s))?Yc(n,r,a,c):parseFloat(a),l=parseFloat(s),t._pt=new Hl(t._pt,i,r,o,l-o,_c),t._pt.u=c||0,t._props.push(r));gh(i,h)};ks("padding,margin,Width,Radius",(function(t,e){var n="Top",i="Right",r="Bottom",a="Left",s=(e<3?[n,i,r,a]:[n+a,n+i,r+i,r+a]).map((function(n){return e<2?t+n:"border"+n+t}));$c[e>1?"border"+t:t]=function(t,e,n,i,r){var a,o;if(arguments.length<4)return a=s.map((function(e){return Zc(t,e,n)})),5===(o=a.join(" ")).split(a[0]).length?a[0]:o;a=(i+"").split(" "),o={},s.forEach((function(t,e){return o[t]=a[e]=a[e]||a[(e-1)/2|0]})),t.init(e,o,r)}}));var vh,xh,yh={name:"css",register:Bc,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,n,i,r){var a,s,o,l,c,h,u,d,f,p,m,g,_,v,x,y,M,b,T,S,E=this._props,w=t.style,A=n.vars.startAt;for(u in nc||Bc(),this.styles=this.styles||Ic(t),y=this.styles.props,this.tween=n,e)if("autoRound"!==u&&(s=e[u],!Is[u]||!yl(u,e,n,i,t,r)))if(c=typeof s,h=$c[u],"function"===c&&(c=typeof(s=s.call(n,i,t,r))),"string"===c&&~s.indexOf("random(")&&(s=Bo(s)),h)h(this,t,u,s,n)&&(x=1);else if("--"===u.substr(0,2))a=(getComputedStyle(t).getPropertyValue(u)+"").trim(),s+="",Jo.lastIndex=0,Jo.test(a)||(d=Ro(a),f=Ro(s)),f?d!==f&&(a=Yc(t,u,a,f)+f):d&&(s+=d),this.add(w,"setProperty",a,s,i,r,0,0,u),E.push(u),y.push(u,w[u]);else if("undefined"!==c){if(A&&u in A?(a="function"==typeof A[u]?A[u].call(n,i,t,r):A[u],as(a)&&~a.indexOf("random(")&&(a=Bo(a)),Ro(a+"")||(a+=Za.units[u]||Ro(Zc(t,u))||""),"="===(a+"").charAt(1)&&(a=Zc(t,u))):a=Zc(t,u),l=parseFloat(a),(p="string"===c&&"="===s.charAt(1)&&s.substr(0,2))&&(s=s.substr(2)),o=parseFloat(s),u in gc&&("autoAlpha"===u&&(1===l&&"hidden"===Zc(t,"visibility")&&o&&(l=0),y.push("visibility",w.visibility),Xc(this,w,"visibility",l?"inherit":"hidden",o?"inherit":"hidden",!o)),"scale"!==u&&"transform"!==u&&~(u=gc[u]).indexOf(",")&&(u=u.split(",")[0])),m=u in cc)if(this.styles.save(u),g||((_=t._gsap).renderTransform&&!e.parseTransform||sh(t,e.parseTransform),v=!1!==e.smoothOrigin&&_.smooth,(g=this._pt=new Hl(this._pt,w,Cc,0,1,_.renderTransform,_,0,-1)).dep=1),"scale"===u)this._pt=new Hl(this._pt,_,"scaleY",_.scaleY,(p?Xs(_.scaleY,p+o):o)-_.scaleY||0,_c),this._pt.u=0,E.push("scaleY",u),u+="X";else{if("transformOrigin"===u){y.push(Lc,w[Lc]),b=void 0,T=void 0,S=void 0,T=(b=(M=s).split(" "))[0],S=b[1]||"50%","top"!==T&&"bottom"!==T&&"left"!==S&&"right"!==S||(M=T,T=S,S=M),b[0]=Jc[T]||T,b[1]=Jc[S]||S,s=b.join(" "),_.svg?ah(t,s,0,v,0,this):((f=parseFloat(s.split(" ")[2])||0)!==_.zOrigin&&Xc(this,_,"zOrigin",_.zOrigin,f),Xc(this,w,u,oh(a),oh(s)));continue}if("svgOrigin"===u){ah(t,s,1,v,0,this);continue}if(u in eh){mh(this,_,u,l,p?Xs(l,p+s):s);continue}if("smoothOrigin"===u){Xc(this,_,"smooth",_.smooth,s);continue}if("force3D"===u){_[u]=s;continue}if("transform"===u){_h(this,s,t);continue}}else u in w||(u=zc(u)||u);if(m||(o||0===o)&&(l||0===l)&&!mc.test(s)&&u in w)o||(o=0),(d=(a+"").substr((l+"").length))!==(f=Ro(s)||(u in Za.units?Za.units[u]:d))&&(l=Yc(t,u,a,f)),this._pt=new Hl(this._pt,m?_:w,u,l,(p?Xs(l,p+o):o)-l,m||"px"!==f&&"zIndex"!==u||!1===e.autoRound?_c:yc),this._pt.u=f||0,d!==f&&"%"!==f&&(this._pt.b=a,this._pt.r=xc);else if(u in w)Kc.call(this,t,u,a,p?p+s:s);else{if(!(u in t)){Es(u,s);continue}this.add(t,u,a||t[u],p?p+s:s,i,r)}m||y.push(u,w[u]),E.push(u)}x&&Bl(this)},render:function(t,e){if(e.tween._time||!ac())for(var n=e._pt;n;)n.r(t,n.d),n=n._next;else e.styles.revert()},get:Zc,aliases:gc,getSetter:function(t,e,n){var i=gc[e];return i&&i.indexOf(",")<0&&(e=i),e in cc&&e!==Lc&&(t._gsap.x||Zc(t,"x"))?n&&rc===n?"scale"===e?wc:Ec:(rc=n||{})&&("scale"===e?Ac:Rc):t.style&&!ls(t.style[e])?Tc:~e.indexOf("-")?Sc:Pl(t,e)},core:{_removeProperty:Vc,_getMatrix:rh}};Ql.utils.checkPrefix=zc,Ql.core.getStyleSaver=Ic,xh=ks("x,y,z,scale,scaleX,scaleY,xPercent,yPercent"+","+(vh="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(t){cc[t]=1})),ks(vh,(function(t){Za.units[t]="deg",eh[t]=1})),gc[xh[13]]="x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+vh,ks("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(t){var e=t.split(":");gc[e[1]]=xh[e[0]]})),ks("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(t){Za.units[t]="px"})),Ql.registerPlugin(yh);var Mh=Ql.registerPlugin(yh)||Ql;Mh.core.Tween;class bh{constructor(t,e,n,i,r){this.w=t,this.h=e,this.screenW=n,this.screenH=i,this.isSp=r}attrUpdate(){for(let t=0;t<this.effectBg.children.length;t++)for(let e=0;e<this.effectBg.children[t].children.length;e++)for(let n=0;n<this.effectBg.children[t].children[e].children.length;n++)this.effectBg.children[t].children[e].children[n].geometry.attributes.a_alpha.needsUpdate=!0,this.effectBg.children[t].children[e].children[n].geometry.attributes.a_active.needsUpdate=!0,this.effectBg.children[t].children[e].children[n].geometry.attributes.a_lagActive.needsUpdate=!0}createEffectBg(){this.allNum=0,this.effectBg=new H,this.sizeW=48,this.sizeH=84,this.inH=Math.floor(this.screenH/this.sizeH),this.marginY=3,this.ROW_NUM=(Math.floor(this.screenH/this.sizeH)+this.marginY)*this.isSp,this.fixY=(this.screenH-this.inH*this.sizeH+12)/2,this.inH%2==0&&(this.marginY=4);for(let t=0;t<this.ROW_NUM;t++)this.addrod(t),this.obj.position.set(0,84*-(t-this.ROW_NUM/2)-(this.screenH-this.h)/2+this.fixY,0),this.effectBg.position.x=-4,this.effectBg.add(this.obj);return this.effectBg}addrod(t){this.rodPositionMatrix=[[[-15.5,-16.75,5,30.5,0,0],[-15.5,16.75,5,30.5,0,0],[15.5,16.75,5,30.5,0,0],[15.5,-16.75,5,30.5,0,0]],[[-7,-34,5,12,0,90],[-7,34,5,12,0,90],[7,34,5,12,0,90],[7,-34,5,12,0,90],[-7,0,5,12,0,90],[7,0,5,12,0,90]],[[6,23,5,Math.sqrt(196.5625),0,-45],[-6,10.375,5,Math.sqrt(196.5625),0,-45],[6,-10.375,5,Math.sqrt(196.5625),0,-45],[-6,-23,5,Math.sqrt(196.5625),0,-45]],[[-6,23,5,Math.sqrt(196.5625),0,45],[6,10.375,5,Math.sqrt(196.5625),0,45],[-6,-10.375,5,Math.sqrt(196.5625),0,45],[6,-23,5,Math.sqrt(196.5625),0,45]]],this.TRANSPARENT=!0,this.ALPHA_COVERGE=!0,this.sizeW=48,this.sizeH=84,this.COL_NUM=(Math.ceil(this.screenW/this.sizeW)+4)*this.isSp,this.fixX=0,this.COL_NUM%2==0&&(this.fixX=24),this.obj=new H;let e=0,n=t+1;for(let t=0;t<this.rodPositionMatrix.length;t++){this.rodPositions=this.rodPositionMatrix[t];let i=this.rodPositions.length*this.COL_NUM;this.transform=new B,this.rodW=this.rodPositions[0][2],this.rodH=this.rodPositions[0][3],this.createRodgeo(this.rodW,this.rodH),this.rod=new rn(this.geo,this.mat,i);let r=new Float32Array(1*i),a=new Float32Array(1*i),s=new Float32Array(1*i),o=new Float32Array(1*i),l=new Float32Array(1*i),c=new Float32Array(1*i),h=new Float32Array(1*i),u=0;this.allNum=this.allNum+1;for(let i=0,d=0,f=this.rodPositions.length;i<f;i++,d+=3)for(let d=0;d<this.COL_NUM;d++)e+=1,r[u]=(u-(d-t)-i-t)/(this.COL_NUM-1)+(e-1-u)/this.COL_NUM,h[u]=d+1,a[u]=n,o[u]=0,s[u]=0,c[u]=0,l[u]=Math.random(),this.transform.position.set(this.rodPositions[i][0]+(d-this.COL_NUM/2)*this.sizeW+this.fixX,this.rodPositions[i][1],0),this.rod.rotation.set(0,0,Math.PI/180*this.rodPositions[i][5]),this.transform.updateMatrix(),this.rod.setMatrixAt(u++,this.transform.matrix),this.obj.add(this.rod),this.rod.instanceMatrix.needsUpdate=!0;this.rod.geometry.setAttribute("a_num",new Ot(r,1)),this.rod.geometry.setAttribute("a_rowNum",new Ot(a,1)),this.rod.geometry.setAttribute("a_lagActive",new Ot(s,1)),this.rod.geometry.setAttribute("a_active",new Ot(o,1)),this.rod.geometry.setAttribute("a_random",new Ot(l,1)),this.rod.geometry.setAttribute("a_alpha",new Ot(c,1)),this.rod.geometry.setAttribute("a_allNum",new Ot(h,1))}return this.obj}createRodmat(){return this.mat=new cn({uniforms:{uTime:{type:"f",value:0},resolution:{value:new k(1,1)},uAlpha:{value:0}},vertexShader:"// attribute vec4 color;\nuniform float uTime;\nvarying vec2 vUv;\n// varying vec4 vColor\nattribute float a_num;\nattribute float a_allNum;\nattribute float a_rowNum;\nattribute float a_lagActive;\nattribute float a_active;\nattribute float a_alpha;\nattribute float a_random;\nvarying float vNum;\nvarying float vAllNum;\nvarying float vRowNum;\nvarying float vLagActive;\nvarying float vActive;\nvarying float vAlpha;\nvarying float vRandom;\nvarying vec3 vPosition;\nconst float PI = 3.14159;\n\nvoid main(){\n vUv = uv;\n vNum = a_num;\n vAllNum = a_allNum;\n vRowNum = a_rowNum;\n vLagActive = a_lagActive;\n vActive = a_active;\n vAlpha = a_alpha;\n vRandom = a_random;\n vPosition = position;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.);\n gl_Position = projectionMatrix * instanceMatrix * mvPosition;\n}\n",fragmentShader:"uniform float uTime;\nuniform float progress;\nuniform float uAlpha;\nuniform vec2 resolution;\nvarying vec3 vPosition;\nvarying vec2 vUv;\nvarying float vNum;\nvarying float vAllNum;\nvarying float vRowNum;\nvarying float vLagActive;\nvarying float vActive;\nvarying float vAlpha;\nvarying float vRandom;\n\n void main(){\n //左から右へのアニメーション\n float fadeout = step(2.,uTime);\n float b2 = cos(uTime - vAllNum/vRowNum);\n float eCheck1 = step(vRandom,b2);\n b2 += (cos(5.5*uTime - vNum*vRandom)-0.7)*eCheck1;\n b2 -= (uTime-2.)*fadeout;\n gl_FragColor = vec4(255.,255.,255., b2);\n }",side:2,transparent:!0,alphaToCoverage:!0,opacity:0}),this.mat}createRodgeo(t,e){this.geo=new an(t,e,2,1);var n=this.geo.attributes.position.array;for(let t=0;t<n.length/3;t++){const e=n[3*t+1];0!==t&&2!==t||(n[3*t+1]=e-2),3!==t&&5!==t||(n[3*t+1]=e+2)}return this.geo}}const Th="uniform float uTime;\nvarying vec2 vUv;\nvarying vec3 vPosition;\n\n\nvoid main(){\n vUv = uv;\n vPosition = position;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.);\n gl_PointSize = 10. * (1. / - mvPosition.z);\n gl_Position = projectionMatrix * mvPosition;\n}\n",Sh="uniform float uTime;\nuniform float progress;\n// uniform vec2 uMouse;\nuniform vec2 res;\nvarying vec2 vUv;\nvarying vec3 vPosition;\n\n\nfloat rand(vec2 p){\n return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);\n}\nfloat circle(in vec2 _st, in float _radius, in float blurriness){\n\tvec2 dist = _st;\n\treturn 1.-smoothstep(_radius-(_radius*blurriness), _radius+(_radius*blurriness), dot(dist,dist)*4.0);\n}\nvoid main(){\t\n\tvec2 newUv = vUv + 0.1*vec2(sin(10.*vUv.x), sin(10.*vUv.x));\n\n\t//ベース\n\tvec2 p = 2.*vUv - vec2(1.);\n\tp += 0.1*sin(rand(vec2(1.,0.4))*p.yx + uTime - vec2(1.2,2.4));\n\tp += 0.2*sin(1.7*p.yx - 1.4*uTime + rand(vec2(2.2,3.4)));\n\tp += 0.1*sin(1.*p.yx - 2.6*uTime - rand(vec2(cos(uTime*2.),3.4)));\n\tp += 0.3*sin(-0.2*p.yx + 3.6*uTime - rand(vec2(1.2,4.4)));\n\tp += cos(uTime*0.3 +p.y*rand(vec2(1.,1.4)) - p.x*0.5);\n\n\tfloat opacity = length(p);\n\topacity = opacity*(1.-step(0.7,opacity)) + 0.7*step(0.7,opacity);\n\tvec4 color = vec4(0.,0.,0.,opacity);\n\n \tgl_FragColor = color;\n}\n";class Eh{constructor(){this.init()}init(){}createSheetmesh(t,e){return this.mat=new cn({uniforms:{uTime:{type:"f",value:0},uAlpha:{value:0}},vertexShader:Th,fragmentShader:Sh}),this.geo=new an(t,e,100,100),new Je(this.geo,this.mesh)}createSheetgeo(t,e){return this.geo=new an(t,e,100,100),this.geo}createSheetmat(t,e){return this.mat=new cn({uniforms:{uTime:{type:"f",value:0},uAlpha:{value:0},res:{value:new k(t,e)}},vertexShader:Th,fragmentShader:Sh,defines:{PR:window.devicePixelRatio.toFixed(1)},transparent:!0,alphaToCoverage:!0,opacity:0}),this.mat}}let wh,Ah=1,Rh=document.querySelectorAll(".nft_content_title"),Ch=document.querySelectorAll(".js_nft_location"),Lh=(document.querySelectorAll(".nft_content_room"),!1),Ph=[0,0,0,0,0,0,0,0,0,0,0,0,0],Dh=!1,Nh=!1,Ih=!1,Oh=0,Uh=0,Fh=document.querySelector(".js_scrollable"),zh=null,Bh=document.querySelector(".js_scrollable");zh=new class{constructor(){this.w=window.innerWidth,this.lastInnerWidth=window.innerWidth,navigator.userAgent.indexOf("iPhone")>0&&-1==navigator.userAgent.indexOf("iPad")||navigator.userAgent.indexOf("iPod")>0||navigator.userAgent.indexOf("Android")>0?(this.h=window.screen.availHeight,this.lastInnerHeight=window.screen.availHeight):(this.h=window.innerHeight,this.lastInnerHeight=window.innerHeight),this.screenW=window.screen.availWidth,this.screenH=window.screen.availHeight,this.currntScreenW=window.screen.availWidth,this.currentScreenH=window.screen.availHeight,this.kvPreHeight=document.querySelector(".nft_kv").getBoundingClientRect().height,Ah=matchMedia("(max-width: 736px)").matches?2:1,this.sizeW=48,this.sizeH=84,this.renderer=new fa({alpha:!0}),this.renderer.setSize(this.w/3,this.h),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setClearColor(0,1),this.container=document.getElementById("canvas01"),this.container.appendChild(this.renderer.domElement),this.fov=60,this.fovRad=this.fov/2*(Math.PI/180),this.dist=this.h/2/Math.tan(this.fovRad)*Ah,this.cameraY=0,this.camera=new Hn(this.fov,this.w/this.h,1,2*this.dist),this.camera.position.z=this.dist,this.camera.position.y=this.cameraY,this.Bgtime=0,this.Texttime=0,this.eSheetTime=0,this.scene=new fn,this.light=new ba(65535),this.light.position.set(2,2,2),this.scene.add(this.light),this.raycaster=new hn,this.mouse=new k(0,0),this.scrollY=0,this.prePosition=0,document.querySelector("canvas").style.width=document.body.clientWidth+"px",Oh=window.innerWidth-document.body.clientWidth,this.objects=[],this.createRodmat(),this.createRodgeo(5,30.5),this.createGrid(),this.scene.add(this.GridBg),this.eSheetInit(),this.ImgInit(),this.CreateTitle=new Sa,this.titleGroup=new H,this.textmat=this.CreateTitle.createRodmat(),this.textgeo=this.CreateTitle.createRodgeo();for(let t=0;t<Rh.length;t++)this.titleArea=this.CreateTitle.createTitleArea(this.w,this.h,10,2),this.titleGroup.add(this.titleArea),this.CreateTitle.createTitle(this.titleGroup.children[t],t);this.scene.add(this.titleGroup),this.addAttr(),this.eBgInit(),this.intersectObjects(),this.intersectNav();for(let t=0;t<this.GridBg.children.length;t++)this.InOutActive(this.GridBg.children[t]);this.Ebgtime=0;for(let t=0;t<this.effectBg.children.length;t++)this.InOutActive(this.effectBg.children[t]);setTimeout((()=>{for(let t=0;t<this.GridBg.children.length;t++)for(let e=0;e<this.rodPositionMatrix.length;e++)for(let n=0;n<this.rodPositionMatrix[e].length*this.COL_NUM;n++)this.GridBg.children[t].children[e].geometry.attributes.a_bg1.array[n]=1,this.GridBg.children[t].children[e].geometry.attributes.a_lagActive.array[n]=0}),2600),this.kvSetHeight(),this.setImgSp(),this.setupResize(),this.resize(),this.render()}ImgInit(){this.CreateImg=new Pa(this.w,this.h,Ah),this.imgGroup=this.CreateImg.createImgGroup(),this.scene.add(this.imgGroup),this.textures=document.querySelectorAll(".js-Atexture"),setTimeout((()=>{for(let t=0;t<this.textures.length;t++){const e=this.textures[t].getBoundingClientRect();this.CreateImg.setImgPos(this.imgGroup.children[t],this.textures[t],e)}}),100)}eBgInit(){this.eBg=new bh(this.w,this.h,this.screenW,this.screenH,Ah),this.eBgmat=this.eBg.createRodmat(),this.eBggeo=this.eBg.createRodgeo(),this.effectBg=this.eBg.createEffectBg(),Oh>0&&(this.effectBg.position.x=-(Oh-3.5)),this.scene.add(this.effectBg)}eSheetInit(){this.eS=new Eh,this.eSmat=this.eS.createSheetmat(this.w*Ah,(this.screenH+2*this.sizeH)*Ah),this.eSgeo=this.eS.createSheetgeo(this.screenW*Ah,(this.screenH+2*this.sizeH)*Ah),this.eSheet=new Je(this.eSgeo,this.eSmat),this.scene.add(this.eSheet)}intersectObjects(){const t=new IntersectionObserver(this.doWhenIntersect,{root:null,rootMargin:"0px 0px -25% 0px",threshold:0});for(let e=0;e<Rh.length;e++)t.observe(Rh[e])}doWhenIntersect(t){t.forEach((t=>{if(t.isIntersecting)for(let e=0;e<Rh.length;e++)Rh[e]===t.target&&0===Ph[e]&&(wh=e,Lh=!0,window.addEventListener("scroll",(t=>{Lh=!1,Ph[e]=1})))}))}intersectNav(){const t=new IntersectionObserver(this.nowLocation,{root:null,rootMargin:"-50% 0px",threshold:0});Ch.forEach((e=>{this.count=1,t.observe(e)}))}nowLocation(t){const e=document.querySelectorAll(".nft_nav_scale"),n=document.querySelector(".nft_nav"),i=(document.querySelector(".nft_nav_chapter").textContent,document.querySelector(".nft_nav_chapter")),r=(document.querySelector(".nft_nav_name").textContent,document.querySelector(".nft_nav_name"));t.forEach((a=>{if(a.isIntersecting){const t=document.querySelector(".nft_nav_scale.__active");null!==t&&t.classList.remove("__active");for(let t=0;t<Ch.length;t++)Ch[t]===a.target&&(e[t].classList.add("__active"),0===t?(r.textContent="--",Dh=!0,Dh&&window.addEventListener("scroll",(t=>{Dh=!1}))):1===t?r.textContent="Shared,Common,Partial":5===t?(i.textContent="Section1",r.textContent="Shared,Common,Partial"):6===t?(i.textContent="Section2",r.textContent="--",Uh<document.documentElement.scrollTop?(Dh=!0,Dh&&window.addEventListener("scroll",(t=>{Dh=!1}))):(Nh=!0,Nh&&window.addEventListener("scroll",(t=>{Nh=!1})))):7===t?r.textContent="The Aura of Digital Works":10===t?(i.textContent="Section2",r.textContent="The Aura of Digital Works"):11===t?(i.textContent="Section3",r.textContent="--",Uh<document.documentElement.scrollTop?(Nh=!0,Nh&&window.addEventListener("scroll",(t=>{Nh=!1}))):(Ih=!0,Ih&&window.addEventListener("scroll",(t=>{Ih=!1})))):12===t&&(i.textContent="Section3",r.textContent="The DAO as a Supranational Power and Social Movement"))}t[0].isIntersecting&&null!==document.querySelector(".nft_nav.__hidden")&&n.classList.remove("__hidden")}))}hideNav(){const t=document.querySelector(".nft_nav"),e=document.getElementsByClassName("nft_content")[0],n=e.getBoundingClientRect().top+window.pageYOffset-this.h/2,i=e.getBoundingClientRect().bottom+window.pageYOffset-this.h/2;n>this.scrollY&&t.classList.add("__hidden"),i<this.scrollY&&t.classList.add("__hidden")}bgSwitching(){if(Dh){this.Bgtime=0;for(let t=0;t<this.GridBg.children.length;t++)for(let e=0;e<this.rodPositionMatrix.length;e++)for(let n=0;n<this.rodPositionMatrix[e].length*this.COL_NUM;n++)this.GridBg.children[t].children[e].geometry.attributes.a_bg1.array[n]=1,this.GridBg.children[t].children[e].geometry.attributes.a_bg2.array[n]=0,this.GridBg.children[t].children[e].geometry.attributes.a_lagActive.array[n]=0}if(Nh){this.Bgtime=0;for(let t=0;t<this.GridBg.children.length;t++)for(let e=0;e<this.rodPositionMatrix.length;e++)for(let n=0;n<this.rodPositionMatrix[e].length*this.COL_NUM;n++)this.GridBg.children[t].children[e].geometry.attributes.a_bg1.array[n]=0,this.GridBg.children[t].children[e].geometry.attributes.a_bg2.array[n]=1,this.GridBg.children[t].children[e].geometry.attributes.a_bg3.array[n]=0}if(Ih){this.Bgtime=0;for(let t=0;t<this.GridBg.children.length;t++)for(let e=0;e<this.rodPositionMatrix.length;e++)for(let n=0;n<this.rodPositionMatrix[e].length*this.COL_NUM;n++)this.GridBg.children[t].children[e].geometry.attributes.a_bg2.array[n]=0,this.GridBg.children[t].children[e].geometry.attributes.a_bg3.array[n]=1}}animationTitle(){Lh&&(this.titleShow(wh),function(t){const e=document.querySelectorAll(".nft_content_title"),n=document.querySelectorAll(".nft_content_desc");Mh.timeline().fromTo(e[t],{opacity:0},{opacity:1,ease:lc.easeInOut.config(1,.1),duration:2}).fromTo(n[t],{opacity:0},{opacity:1,ease:lc.easeInOut.config(1,.1),duration:2},"<")}(wh))}titleShow(t){this.Texttime=0;for(let e=0;e<this.titleGroup.children[t].children.length;e++)this.CreateTitle.randomAlpha(this.titleGroup.children[t].children[e]);this.Ebgtime=0;for(let t=0;t<this.effectBg.children.length;t++)this.InOutActive(this.effectBg.children[t])}setTitlePosition(t,e,n,i){const r=e.getBoundingClientRect(),a=new k((r.x-this.w/2)*Ah,(r.y-this.h/2)*Ah);t.position.set(a.x+this.sizeW*n/2+7*Ah,-a.y-1.5*this.sizeH-6*Ah,0),matchMedia("(max-width: 736px)").matches&&t.position.set(a.x+this.sizeW*n/2+14.5*Ah,-a.y-1.5*this.sizeH-6*Ah,0),t.matrix.needsUpdate=!0}render(){performance.now(),this.Bgtime+=.05,this.Texttime+=.05,this.Ebgtime+=.05,this.eSheetTime+=.01,this.mat.uniforms.uTime.value=this.Bgtime,this.textmat.uniforms.uTime.value=this.Texttime,this.eBgmat.uniforms.uTime.value=this.Ebgtime,this.eSmat.uniforms.uTime.value=this.eSheetTime,this.attrUpdate(),this.CreateTitle.attrUpdate(this.titleGroup),this.eBg.attrUpdate(),Fh.style.transform=`translate3d(0,${-this.scrollY}px,0)`,this.GridBg.position.y=this.scrollY*Ah,this.effectBg.position.y=this.scrollY*Ah,this.titleGroup.position.y=this.scrollY*Ah,this.imgGroup.position.y=this.scrollY*Ah,requestAnimationFrame(this.render.bind(this)),this.renderer.render(this.scene,this.camera)}setupResize(){window.addEventListener("resize",this.resize.bind(this))}resize(){if(this.w=window.innerWidth,this.h=window.innerHeight,matchMedia("(max-width: 736px)").matches?this.h=window.screen.availHeight:this.h=window.innerHeight,this.screenW=window.screen.availWidth,this.screenH=window.screen.availHeight,this.renderer.setSize(this.w,this.h),this.camera.aspect=this.w/this.h,this.dist=this.h/2/Math.tan(this.fovRad)*Ah,this.camera.position.z=this.dist,this.camera.updateProjectionMatrix(),matchMedia("(max-width: 736px)").matches){if(this.lastInnerHeight!=window.screen.availHeight){const t=(window.screen.availHeight-this.lastInnerHeight)/2;this.camera.position.y=this.cameraY-t,this.lastInnerHeight=window.screen.availHeight,this.cameraY=this.camera.position.y}}else if(this.lastInnerHeight!=window.innerHeight){const t=(window.innerHeight-this.lastInnerHeight)/2;this.camera.position.y=this.cameraY-t,this.lastInnerHeight=window.innerHeight,this.cameraY=this.camera.position.y}(this.currentScreenH<this.screenH||this.currntScreenW<this.screenW)&&window.location.reload()}kvSetHeight(){const t=document.querySelector(".nft_kv"),e=document.querySelector(".nft_kv_container");let n=0,i=0;matchMedia("(max-width: 736px)").matches?(this.h=window.screen.availHeight,n=9*this.sizeH,i=Math.round((this.h-e.getBoundingClientRect().height)/this.sizeH/2)*this.sizeH+this.sizeH/2,this.container.style.height=this.screenH+"px",document.querySelector(".js_wrapper").style.height=this.screenH+"px",t.style.height=n+"px",e.style.top=i+"px"):(n=Math.ceil(this.h/this.sizeH)*this.sizeH,i=Math.round((this.h-e.getBoundingClientRect().height)/this.sizeH/2)*this.sizeH,t.style.height=n+"px",e.style.top=i+"px"),this.KvHeightDiff=n-this.kvPreHeight+this.scrollY,setTimeout((()=>{for(let t=0;t<Rh.length;t++)this.setTitlePosition(this.titleGroup.children[t],Rh[t],10,2)}),100)}setImgSp(){const t=[],e=document.querySelectorAll(".nft_kv_img img"),n=document.querySelectorAll(".nft_content_introImg img");if(t.push(e),t.push(n),matchMedia("(max-width: 736px)").matches)for(let e=0;e<t.length;e++)for(let n=0;n<t[e].length;n++){const i=t[e][n].src.slice(0,-4)+"_sp.jpg";t[e][n].setAttribute("src",i)}}attrUpdate(){for(let t=0;t<this.GridBg.children.length;t++)for(let e=0;e<this.rodPositionMatrix.length;e++)this.GridBg.children[t].children[e].geometry.attributes.a_lagActive.needsUpdate=!0,this.GridBg.children[t].children[e].geometry.attributes.a_bg1.needsUpdate=!0,this.GridBg.children[t].children[e].geometry.attributes.a_bg2.needsUpdate=!0,this.GridBg.children[t].children[e].geometry.attributes.a_bg3.needsUpdate=!0}createBg(){const t=(this.h/2+this.sizeH)*Ah,e=(-this.screenH/2-2*this.sizeH)*Ah;this.checkY;for(let n=0;n<this.ROW_NUM;n++)if(this.checkY=this.GridBg.children[n].getWorldPosition(new c),t<this.checkY.y){const t=this.GridBg.children[n].position.y;this.GridBg.children[n].position.y=t-this.ROW_NUM*this.sizeH,this.effectBg.children[n].position.y=t-this.ROW_NUM*this.sizeH}else if(this.checkY.y<e){const t=this.GridBg.children[n].position.y;this.GridBg.children[n].position.y=t+this.ROW_NUM*this.sizeH,this.effectBg.children[n].position.y=t+this.ROW_NUM*this.sizeH}}createGrid(){this.allNum=0,this.GridBg=new H,this.sizeW=48,this.sizeH=84,this.inH=Math.floor(this.screenH/(this.sizeH/Ah)),this.marginY=3,this.ROW_NUM=(Math.floor(this.screenH/this.sizeH)+this.marginY)*Ah,this.fixY=(this.screenH-this.inH*this.sizeH+12)/2,this.inH%2==0&&(this.marginY=4);for(let t=0;t<this.ROW_NUM;t++)this.addrod(t),matchMedia("(max-width: 736px)").matches?(this.inH=Math.floor(this.screenH*Ah/this.sizeH),this.inH%2==0&&(this.inH=this.inH-1),this.fixY=(this.screenH*Ah-this.inH*this.sizeH+22)/2,this.marginY=3,this.ROW_NUM=this.inH+this.marginY,this.obj.position.set(0,-(t-this.ROW_NUM/2)*this.sizeH+this.fixY,0)):this.obj.position.set(0,84*-(t-this.ROW_NUM/2)-(this.screenH-this.h)/2+this.fixY,0),this.GridBg.position.x=-3.5,Oh>0&&(this.GridBg.position.x=-1*(Oh-3.5)),this.GridBg.add(this.obj);return this.GridBg}addAttr(){for(let t=0;t<this.GridBg.children.length;t++)for(let e=0;e<this.rodPositionMatrix.length;e++)for(let n=0;n<this.rodPositionMatrix[e].length;n++)this.GridBg.children[t].children[e].geometry.attributes.a_allNum.array[n]=t}addrod(t){this.rodPositionMatrix=[[[-15.5,-16.75,5,30.5,0,0],[-15.5,16.75,5,30.5,0,0],[15.5,16.75,5,30.5,0,0],[15.5,-16.75,5,30.5,0,0]],[[-7,-34,5,12,0,90],[-7,34,5,12,0,90],[7,34,5,12,0,90],[7,-34,5,12,0,90],[-7,0,5,12,0,90],[7,0,5,12,0,90]],[[6,23,5,Math.sqrt(196.5625),0,-45],[-6,10.375,5,Math.sqrt(196.5625),0,-45],[6,-10.375,5,Math.sqrt(196.5625),0,-45],[-6,-23,5,Math.sqrt(196.5625),0,-45]],[[-6,23,5,Math.sqrt(196.5625),0,45],[6,10.375,5,Math.sqrt(196.5625),0,45],[-6,-10.375,5,Math.sqrt(196.5625),0,45],[6,-23,5,Math.sqrt(196.5625),0,45]]],this.sizeW=48,this.sizeH=84,this.COL_NUM=(Math.ceil(this.screenW/this.sizeW)+4)*Ah,this.fixX=0,this.COL_NUM%2==0&&(this.fixX=24),this.obj=new H;let e=0,n=t+1;for(let t=0;t<this.rodPositionMatrix.length;t++){this.rodPositions=this.rodPositionMatrix[t];let i=this.rodPositions.length*this.COL_NUM;this.transform=new B,this.rodW=this.rodPositions[0][2],this.rodH=this.rodPositions[0][3],this.createRodgeo(this.rodW,this.rodH),this.rod=new rn(this.geo,this.mat,i);let r=new Float32Array(1*i),a=new Float32Array(1*i),s=new Float32Array(1*i),o=new Float32Array(1*i),l=new Float32Array(1*i),c=new Float32Array(1*i),h=new Float32Array(1*i),u=new Float32Array(1*i),d=new Float32Array(1*i),f=0;this.allNum=this.allNum+1;for(let i=0,d=0,p=this.rodPositions.length;i<p;i++,d+=3)for(let d=0;d<this.COL_NUM;d++)e+=1,r[f]=(f-(d-t)-i-t)/(this.COL_NUM-1)+(e-1-f)/this.COL_NUM,c[f]=d+1,a[f]=n,l[f]=1,s[f]=0,h[f]=0,u[f]=0,l[f]=.85,o[f]=Math.random(),this.transform.position.set(this.rodPositions[i][0]+(d-this.COL_NUM/2)*this.sizeW+this.fixX,this.rodPositions[i][1],0),this.rod.rotation.set(0,0,Math.PI/180*this.rodPositions[i][5]),this.transform.updateMatrix(),this.rod.setMatrixAt(f++,this.transform.matrix),this.obj.add(this.rod),this.rod.instanceMatrix.needsUpdate=!0;this.rod.geometry.setAttribute("a_num",new Ot(r,1)),this.rod.geometry.setAttribute("a_rowNum",new Ot(a,1)),this.rod.geometry.setAttribute("a_lagActive",new Ot(s,1)),this.rod.geometry.setAttribute("a_random",new Ot(o,1)),this.rod.geometry.setAttribute("a_alpha",new Ot(l,1)),this.rod.geometry.setAttribute("a_allNum",new Ot(c,1)),this.rod.geometry.setAttribute("a_bg1",new Ot(h,1)),this.rod.geometry.setAttribute("a_bg2",new Ot(u,1)),this.rod.geometry.setAttribute("a_bg3",new Ot(d,1))}return this.obj}createRodgeo(t,e){this.geo=new an(t,e,2,1);var n=this.geo.attributes.position.array;for(let t=0;t<n.length/3;t++){const e=n[3*t+1];0!==t&&2!==t||(n[3*t+1]=e-2),3!==t&&5!==t||(n[3*t+1]=e+2)}return this.geo}createRodmat(){return this.mat=new cn({uniforms:{uTime:{type:"f",value:0},resolution:{value:new k(1,1)},uAlpha:{value:0}},vertexShader:"// attribute vec4 color;\nuniform float uTime;\nvarying vec2 vUv;\n// varying vec4 vColor\nattribute float a_num;\nattribute float a_allNum;\nattribute float a_rowNum;\nattribute float a_lagActive;\n// attribute float a_active;\nattribute float a_alpha;\nattribute float a_random;\nattribute float a_bg1;\nattribute float a_bg2;\nattribute float a_bg3;\nvarying float vNum;\nvarying float vAllNum;\nvarying float vRowNum;\nvarying float vLagActive;\n// varying float vActive;\nvarying float vAlpha;\nvarying float vRandom;\nvarying float vbg1;\nvarying float vbg2;\nvarying float vbg3;\nvarying vec3 vPosition;\nconst float PI = 3.14159;\n\nvoid main(){\n vUv = uv;\n vNum = a_num;\n vAllNum = a_allNum;\n vRowNum = a_rowNum;\n vLagActive = a_lagActive;\n vAlpha = a_alpha;\n vRandom = a_random;\n vbg1 = a_bg1;\n vbg2 = a_bg2;\n vbg3 = a_bg3;\n vPosition = position;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.);\n gl_Position = projectionMatrix * instanceMatrix * mvPosition;\n}\n",fragmentShader:"uniform float uTime;\nuniform float progress;\nuniform float uAlpha;\nuniform vec2 resolution;\nvarying vec3 vPosition;\nvarying vec2 vUv;\nvarying float vNum;\nvarying float vAllNum;\nvarying float vRowNum;\nvarying float vLagActive;\n// varying float vActive;\nvarying float vAlpha;\nvarying float vRandom;\nvarying float vbg1;\nvarying float vbg2;\nvarying float vbg3;\n\n float rand(vec2 p){\n return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);\n }\n\n void main(){\n float motionStart ;\n float motionend ;\n float on = 0.0;\n float off = 0.9;\n float off2 = 1.0;\n float first;\n float end;\n float activeRand = (uTime+uTime)*vLagActive + (cos(uTime*2.5 + vRandom * 6.) + cos(vNum+vRandom+vRowNum));\n float delayin =uTime*2.0 + cos(uTime+vRowNum)*cos(uTime+vRowNum) + cos(uTime) + 0.2 - cos(uTime)*0.6;\n float delayout = uTime*2.0 + cos(uTime+vRowNum) + sin(uTime*vAllNum*vNum) + 0.5;\n\n \n\n float aRcheckHight = step(1.0,activeRand);\n float aRcheckRow = step(activeRand,0.0);\n activeRand = 0.6*aRcheckHight + 0.7*aRcheckRow;\n\n first = (vAllNum*vRowNum/100. < delayout)? off : on;\n\n motionStart = step(delayout,vAllNum*vRowNum/100.);\n\n end = (delayin < vAllNum*vRowNum/100.)? off : on;\n\n motionend = step(vAllNum*vRowNum/100.,delayin);\n float lagMotion = (activeRand * motionStart * motionend + first + end)*vLagActive;\n\n\n float random01 = cos(pow(rand(vec2(vRandom,0.3)*uTime),8.));\n random01 = step(random01,1.0) + step(1.0,random01);\n\n //ランダム\n float bg1 = 8.*cos(-0.07*uTime-vAllNum*vRowNum);\n bg1 -= cos(-0.07*uTime -vRowNum*vAllNum)*vRandom;\n bg1 -= cos(-0.2*uTime-vNum*vRandom);\n bg1 -= cos(-0.5*uTime - vNum-vAllNum);\n float fixAlpha = 0.5*cos(vRowNum*uTime*0.07*vRandom)*cos(vRowNum*uTime*0.07*vRandom);\n bg1 = clamp(bg1,0.7,0.85) + clamp(fixAlpha,0.0,0.15);\n float hightA1 = step(0.83,bg1) * (1.-step(0.87,bg1));\n float hightA1_2 = step(0.8,bg1) * (1.-step(0.85,bg1));\n\n //ブロック\n float bg2 = -8.*cos(0.15*uTime-vAllNum)*cos(0.15*uTime-vRowNum);\n bg2 -= -sin(-0.15*uTime -vRowNum*vAllNum/vRowNum)*vRandom;\n bg2 -= -sin(-0.15*uTime-vNum*vRandom*vNum);\n bg2 = clamp(bg2,0.75,0.85) + clamp(fixAlpha,0.0,0.15);\n float hightA2 = step(0.85,bg2) * (1.-step(0.87,bg2));\n // bg2 -= 0.15*hightA2;\n\n //斜め\n float bg3 = 4.*sin(-0.5*uTime -vRowNum+vAllNum);\n bg3 -= -sin(-0.15*uTime-vNum*vRandom*vNum);\n bg3 = clamp(bg3,0.8,0.9) + clamp(fixAlpha,0.0,0.2);\n\n float bg3a = cos(0.25*uTime + (vRowNum/10.)*(vAllNum/10.));\n bg3a += cos(0.3*uTime*vRowNum/2.*vAllNum/2.);\n bg3a = clamp(bg3a,0.7,0.85) + clamp(fixAlpha,0.0,0.2);\n\n \n // float bg3b = cos(0.25*uTime + (vRowNum/10.)*(vAllNum/10.));\n // float bg3b = 5.*cos((vRowNum/8.+vAllNum/vRowNum*2.)-0.3*uTime);\n float bg3b = 5.*cos((vRowNum/vAllNum*10.+vAllNum/20.*2.)-0.3*uTime);\n bg3b = clamp(bg3b,0.7,0.85) + clamp(fixAlpha,0.0,0.15);\n float hightA3 = step(0.85,bg3b) * (1.-step(0.9,bg3b))*random01;\n // bg3b -= 0.15*hightA3;\n\n float bg3c = 5.*cos(((vRowNum/vAllNum*2.)/(vAllNum/4.))+uTime);\n bg3c = clamp(bg3c,0.7,0.85) + clamp(fixAlpha,0.0,0.2);\n\n float fadeInOut = 1.0*step(1.5,uTime)-(cos((2.0+uTime*1.5))-0.5)*step(uTime,1.5);\n float bgkinds = lagMotion + bg1*vbg1*fadeInOut + bg2*vbg2*fadeInOut + bg3b*vbg3*fadeInOut;\n // fadeInOut = step(fadeInOut,1.0);\n gl_FragColor = vec4(0.,0.,0.,bgkinds);\n\n\n\n \n }\n",side:2})}hoverMotion(){this.raycaster.setFromCamera(this.mouse,this.camera),this.raycaster.intersectObjects(this.objects[0].parents)}mouseMoved(t,e){this.mouse.x=(2*t-this.w)/Math.min(this.w,this.h),this.mouse.y=-(2*e-this.h)/Math.min(this.w,this.h)}scrolled(t){this.scrollY=t,Uh<document.documentElement.scrollTop&&matchMedia("(max-width: 736px)").matches&&(this.scrollY=t+40),Uh=document.documentElement.scrollTop}randomActive(t,e){for(let n=0;n<this.rodPositionMatrix.length;n++)for(let i=0;i<this.rodPositionMatrix[n].length*this.COL_NUM;i++)t.children[n].geometry.attributes.a_active.array[i]=1*e}InOutActive(t){for(let e=0;e<this.rodPositionMatrix.length;e++)for(let n=0;n<this.rodPositionMatrix[e].length*this.COL_NUM;n++)t.children[e].geometry.attributes.a_lagActive.array[n]=1}orderAnime01(t,e){const n=[];this.randomOrder(n,t.length,0);for(let i=0;i<n.length;i++){const r=n[i];setTimeout((()=>{t[r]=e}),60*i)}}},function(){const t=document.getElementsByClassName("nft_kv_container"),e=document.querySelectorAll(".nft_kv_titleText"),n=document.getElementsByClassName("nft_kv_bgContent"),i=Mh.timeline();matchMedia("(max-width: 736px)").matches?i.fromTo(t,{opacity:0},{opacity:1,ease:lc.easeInOut.config(1,.1),duration:2.8},"0.3").fromTo(e[0],{opacity:0,y:15},{opacity:1,y:0,ease:oc.easeInOut,duration:.5},"-=1.6").fromTo(e[1],{opacity:0,y:-15},{opacity:1,y:0,ease:oc.easeInOut,duration:.5},"<").fromTo(e[2],{opacity:0,y:15},{opacity:1,y:0,ease:oc.easeInOut,duration:.5},"<").fromTo(n,{opacity:0},{opacity:.7,ease:oc.easeInOut,duration:1.5},"-=1.2"):i.fromTo(t,{opacity:0},{opacity:1,ease:lc.easeInOut.config(1,.1),duration:2.8},"0.2").fromTo(e[0],{opacity:0,x:100},{opacity:1,x:0,ease:oc.easeInOut,duration:.5},"-=1.6").fromTo(e[1],{opacity:0,x:-100},{opacity:1,x:0,ease:oc.easeInOut,duration:.5},"<").fromTo(e[2],{opacity:0,x:100},{opacity:1,x:0,ease:oc.easeInOut,duration:.5},"<").fromTo(n,{opacity:0},{opacity:.7,ease:oc.easeInOut,duration:1.5},"-=1.2")}(),window.addEventListener("mousemove",(t=>{zh.mouseMoved(t.clientX,t.clientY)})),window.addEventListener("scroll",(t=>{zh.scrolled(window.scrollY),zh.createBg(),zh.hideNav(),zh.bgSwitching(),zh.animationTitle()})),function t(){requestAnimationFrame(t)}(),window.onbeforeunload=function(){window.scrollTo(0,0)},function(){const t=document.querySelector(".nft_profile_open"),e=document.querySelector(".nft_profile");let n=0;t.addEventListener("click",(function(){this.w=window.innerWidth,this.h=window.innerHeight,"nft_profile"===e.classList.value?(this.innerHTML="<p>Close</p>",e.classList.add("__show"),setTimeout((()=>{zh.createBg(),document.body.style.height=Bh.getBoundingClientRect().height+"px",document.querySelector(".nft_wrapper").style.height=Bh.getBoundingClientRect().height+"px",zh.createBg(),n=window.scrollY}),10)):(e.classList.remove("__show"),this.innerHTML="<p>Read more</p>",matchMedia("(min-width: 736px)").matches&&window.scrollTo(0,n),setTimeout((()=>{zh.createBg(),document.body.style.height=Bh.getBoundingClientRect().height+"px",document.querySelector(".nft_wrapper").style.height=Bh.getBoundingClientRect().height+"px",zh.createBg()}),10))}))}(),setInterval((()=>{document.querySelectorAll(".js_slideBg").forEach((t=>{const e=t.firstElementChild,n=t.lastElementChild;t.classList.add("__slide"),t.classList.remove("__fadeIn"),t.classList.add("__fadeOut"),t.addEventListener("transitionend",(function(){t.insertBefore(e,n.nextSibling),t.classList.remove("__slide"),t.classList.add("__fadeIn"),t.classList.remove("__fadeOut")}))}))}),6500),document.body.style.height=Bh.getBoundingClientRect().height+"px",document.querySelector(".nft_wrapper").style.height=Bh.getBoundingClientRect().height+"px"})();}
);
var $pageWrapper = $('#jsi-page-wrapper'); if($pageWrapper.hasClass('jsc-art-detail') && (GYRE.ARTDETAIL.INIT.length > 0)){ GYRE.ARTDETAIL.DESTORY_ONE_FLAG = true; GYRE.ARTDETAIL.INIT.forEach(function(value){ value(); }); } else { GYRE.ARTDETAIL.DESTORY_ONE_FLAG = false; }