globe.gl 2.26.3 → 2.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- // Version 2.26.3 globe.gl - https://github.com/vasturiano/globe.gl
2
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Globe=e()}(this,(function(){"use strict";function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function e(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?t(Object(i),!0).forEach((function(t){n(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function i(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}const o="143",s={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},A=0,l=1,u=2,c=3,h=100,f=301,d=302,p=306,m=1e3,g=1001,v=1002,x=1003,y=1006,_=1008,b=1009,w=1014,M=1015,S=1016,E=1020,T=1023,C=1026,q=1027,P=33776,D=33777,L=33778,R=33779,I=3e3,O=3001,B="srgb",k="srgb-linear",U=7680,z=35044,N="300 es",F=1035;class G{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,r=n.length;e<r;e++)n[e].call(this,t);t.target=null}}}const H=["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"];let j=1234567;const V=Math.PI/180,W=180/Math.PI;function Q(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(H[255&t]+H[t>>8&255]+H[t>>16&255]+H[t>>24&255]+"-"+H[255&e]+H[e>>8&255]+"-"+H[e>>16&15|64]+H[e>>24&255]+"-"+H[63&n|128]+H[n>>8&255]+"-"+H[n>>16&255]+H[n>>24&255]+H[255&r]+H[r>>8&255]+H[r>>16&255]+H[r>>24&255]).toLowerCase()}function Y(t,e,n){return Math.max(e,Math.min(n,t))}function X(t,e){return(t%e+e)%e}function Z(t,e,n){return(1-n)*t+n*e}function J(t){return 0==(t&t-1)&&0!==t}function K(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var $=Object.freeze({__proto__:null,DEG2RAD:V,RAD2DEG:W,generateUUID:Q,clamp:Y,euclideanModulo:X,mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:Z,damp:function(t,e,n,r){return Z(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(X(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(j=t);let e=j+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*V},radToDeg:function(t){return t*W},isPowerOfTwo:J,ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:K,setQuaternionFromProperEuler:function(t,e,n,r,i){const a=Math.cos,o=Math.sin,s=a(n/2),A=o(n/2),l=a((e+r)/2),u=o((e+r)/2),c=a((e-r)/2),h=o((e-r)/2),f=a((r-e)/2),d=o((r-e)/2);switch(i){case"XYX":t.set(s*u,A*c,A*h,s*l);break;case"YZY":t.set(A*h,s*u,A*c,s*l);break;case"ZXZ":t.set(A*c,A*h,s*u,s*l);break;case"XZX":t.set(s*u,A*d,A*f,s*l);break;case"YXY":t.set(A*f,s*u,A*d,s*l);break;case"ZYZ":t.set(A*d,A*f,s*u,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}},denormalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}});class tt{constructor(t=0,e=0){tt.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,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[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),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class et{constructor(){et.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,n,r,i,a,o,s,A){const l=this.elements;return l[0]=t,l[1]=r,l[2]=o,l[3]=e,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=A,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,r=e.elements,i=this.elements,a=n[0],o=n[3],s=n[6],A=n[1],l=n[4],u=n[7],c=n[2],h=n[5],f=n[8],d=r[0],p=r[3],m=r[6],g=r[1],v=r[4],x=r[7],y=r[2],_=r[5],b=r[8];return i[0]=a*d+o*g+s*y,i[3]=a*p+o*v+s*_,i[6]=a*m+o*x+s*b,i[1]=A*d+l*g+u*y,i[4]=A*p+l*v+u*_,i[7]=A*m+l*x+u*b,i[2]=c*d+h*g+f*y,i[5]=c*p+h*v+f*_,i[8]=c*m+h*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],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],A=t[7],l=t[8];return e*a*l-e*o*A-n*i*l+n*o*s+r*i*A-r*a*s}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],A=t[7],l=t[8],u=l*a-o*A,c=o*s-l*i,h=A*i-a*s,f=e*u+n*c+r*h;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const d=1/f;return t[0]=u*d,t[1]=(r*A-l*n)*d,t[2]=(o*n-r*a)*d,t[3]=c*d,t[4]=(l*e-r*s)*d,t[5]=(r*i-o*e)*d,t[6]=h*d,t[7]=(n*s-A*e)*d,t[8]=(a*e-n*i)*d,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,r,i,a,o){const s=Math.cos(i),A=Math.sin(i);return this.set(n*s,n*A,-n*(s*a+A*o)+a+t,-r*A,r*s,-r*(-A*a+s*o)+o+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),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],A=r[4],l=r[7];return r[0]=e*i+n*s,r[3]=e*a+n*A,r[6]=e*o+n*l,r[1]=-n*i+e*s,r[4]=-n*a+e*A,r[7]=-n*o+e*l,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)}}function nt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}function rt(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function it(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function at(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ot={[B]:{[k]:it},[k]:{[B]:at}},st={legacyMode:!0,get workingColorSpace(){return k},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(ot[e]&&void 0!==ot[e][n]){const r=ot[e][n];return t.r=r(t.r),t.g=r(t.g),t.b=r(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)}},At={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},lt={r:0,g:0,b:0},ut={h:0,s:0,l:0},ct={h:0,s:0,l:0};function ht(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 ft(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class dt{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,st.toWorkingColorSpace(this,e),this}setRGB(t,e,n,r="srgb-linear"){return this.r=t,this.g=e,this.b=n,st.toWorkingColorSpace(this,r),this}setHSL(t,e,n,r="srgb-linear"){if(t=X(t,1),e=Y(e,0,1),n=Y(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=ht(i,r,t+1/3),this.g=ht(i,r,t),this.b=ht(i,r,t-1/3)}return st.toWorkingColorSpace(this,r),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 r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=r[1],a=r[2];switch(i){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,st.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,st.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 r=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,a=parseInt(t[3],10)/100;return n(t[4]),this.setHSL(r,i,a,e)}}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=r[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,st.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,st.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e="srgb"){const n=At[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=it(t.r),this.g=it(t.g),this.b=it(t.b),this}copyLinearToSRGB(t){return this.r=at(t.r),this.g=at(t.g),this.b=at(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t="srgb"){return st.fromWorkingColorSpace(ft(this,lt),t),Y(255*lt.r,0,255)<<16^Y(255*lt.g,0,255)<<8^Y(255*lt.b,0,255)<<0}getHexString(t="srgb"){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e="srgb-linear"){st.fromWorkingColorSpace(ft(this,lt),e);const n=lt.r,r=lt.g,i=lt.b,a=Math.max(n,r,i),o=Math.min(n,r,i);let s,A;const l=(o+a)/2;if(o===a)s=0,A=0;else{const t=a-o;switch(A=l<=.5?t/(a+o):t/(2-a-o),a){case n:s=(r-i)/t+(r<i?6:0);break;case r:s=(i-n)/t+2;break;case i:s=(n-r)/t+4}s/=6}return t.h=s,t.s=A,t.l=l,t}getRGB(t,e="srgb-linear"){return st.fromWorkingColorSpace(ft(this,lt),e),t.r=lt.r,t.g=lt.g,t.b=lt.b,t}getStyle(t="srgb"){return st.fromWorkingColorSpace(ft(this,lt),t),t!==B?`color(${t} ${lt.r} ${lt.g} ${lt.b})`:`rgb(${255*lt.r|0},${255*lt.g|0},${255*lt.b|0})`}offsetHSL(t,e,n){return this.getHSL(ut),ut.h+=t,ut.s+=e,ut.l+=n,this.setHSL(ut.h,ut.s,ut.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(ut),t.getHSL(ct);const n=Z(ut.h,ct.h,e),r=Z(ut.s,ct.s,e),i=Z(ut.l,ct.l,e);return this.setHSL(n,r,i),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}}let pt;dt.NAMES=At;class mt{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===pt&&(pt=rt("canvas")),pt.width=t.width,pt.height=t.height;const n=pt.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=pt}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=rt("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const r=n.getImageData(0,0,t.width,t.height),i=r.data;for(let t=0;t<i.length;t++)i[t]=255*it(i[t]/255);return n.putImageData(r,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*it(e[t]/255)):e[t]=it(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 gt{constructor(t=null){this.isSource=!0,this.uuid=Q(),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:""},r=this.data;if(null!==r){let t;if(Array.isArray(r)){t=[];for(let e=0,n=r.length;e<n;e++)r[e].isDataTexture?t.push(vt(r[e].image)):t.push(vt(r[e]))}else t=vt(r);n.url=t}return e||(t.images[this.uuid]=n),n}}function vt(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?mt.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 xt=0;class yt extends G{constructor(t=yt.DEFAULT_IMAGE,e=yt.DEFAULT_MAPPING,n=1001,r=1001,i=1006,a=1008,o=1023,s=1009,A=1,l=3e3){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:xt++}),this.uuid=Q(),this.name="",this.source=new gt(t),this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=a,this.anisotropy=A,this.format=o,this.internalFormat=null,this.type=s,this.offset=new tt(0,0),this.repeat=new tt(1,1),this.center=new tt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new et,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l,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 m:t.x=t.x-Math.floor(t.x);break;case g:t.x=t.x<0?0:1;break;case v: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 m:t.y=t.y-Math.floor(t.y);break;case g:t.y=t.y<0?0:1;break;case v: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)}}yt.DEFAULT_IMAGE=null,yt.DEFAULT_MAPPING=300;class _t{constructor(t=0,e=0,n=0,r=1){_t.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=r}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,r){return this.x=t,this.y=e,this.z=n,this.w=r,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,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,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,r,i;const a=.01,o=.1,s=t.elements,A=s[0],l=s[4],u=s[8],c=s[1],h=s[5],f=s[9],d=s[2],p=s[6],m=s[10];if(Math.abs(l-c)<a&&Math.abs(u-d)<a&&Math.abs(f-p)<a){if(Math.abs(l+c)<o&&Math.abs(u+d)<o&&Math.abs(f+p)<o&&Math.abs(A+h+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(A+1)/2,s=(h+1)/2,g=(m+1)/2,v=(l+c)/4,x=(u+d)/4,y=(f+p)/4;return t>s&&t>g?t<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(t),r=v/n,i=x/n):s>g?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=y/r):g<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(g),n=x/i,r=y/i),this.set(n,r,i,e),this}let g=Math.sqrt((p-f)*(p-f)+(u-d)*(u-d)+(c-l)*(c-l));return Math.abs(g)<.001&&(g=1),this.x=(p-f)/g,this.y=(u-d)/g,this.z=(c-l)/g,this.w=Math.acos((A+h+m-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 bt extends G{constructor(t,e,n={}){super(),this.isWebGLRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new _t(0,0,t,e),this.scissorTest=!1,this.viewport=new _t(0,0,t,e);const r={width:t,height:e,depth:1};this.texture=new yt(r,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:y,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 gt(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 wt extends yt{constructor(t=null,e=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=x,this.minFilter=x,this.wrapR=g,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Mt extends yt{constructor(t=null,e=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=x,this.minFilter=x,this.wrapR=g,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class St{constructor(t=0,e=0,n=0,r=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=r}static slerpFlat(t,e,n,r,i,a,o){let s=n[r+0],A=n[r+1],l=n[r+2],u=n[r+3];const c=i[a+0],h=i[a+1],f=i[a+2],d=i[a+3];if(0===o)return t[e+0]=s,t[e+1]=A,t[e+2]=l,void(t[e+3]=u);if(1===o)return t[e+0]=c,t[e+1]=h,t[e+2]=f,void(t[e+3]=d);if(u!==d||s!==c||A!==h||l!==f){let t=1-o;const e=s*c+A*h+l*f+u*d,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),a=Math.atan2(i,e*n);t=Math.sin(t*a)/i,o=Math.sin(o*a)/i}const i=o*n;if(s=s*t+c*i,A=A*t+h*i,l=l*t+f*i,u=u*t+d*i,t===1-o){const t=1/Math.sqrt(s*s+A*A+l*l+u*u);s*=t,A*=t,l*=t,u*=t}}t[e]=s,t[e+1]=A,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,i,a){const o=n[r],s=n[r+1],A=n[r+2],l=n[r+3],u=i[a],c=i[a+1],h=i[a+2],f=i[a+3];return t[e]=o*f+l*u+s*h-A*c,t[e+1]=s*f+l*c+A*u-o*h,t[e+2]=A*f+l*h+o*c-s*u,t[e+3]=l*f-o*u-s*c-A*h,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,r){return this._x=t,this._y=e,this._z=n,this._w=r,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,r=t._y,i=t._z,a=t._order,o=Math.cos,s=Math.sin,A=o(n/2),l=o(r/2),u=o(i/2),c=s(n/2),h=s(r/2),f=s(i/2);switch(a){case"XYZ":this._x=c*l*u+A*h*f,this._y=A*h*u-c*l*f,this._z=A*l*f+c*h*u,this._w=A*l*u-c*h*f;break;case"YXZ":this._x=c*l*u+A*h*f,this._y=A*h*u-c*l*f,this._z=A*l*f-c*h*u,this._w=A*l*u+c*h*f;break;case"ZXY":this._x=c*l*u-A*h*f,this._y=A*h*u+c*l*f,this._z=A*l*f+c*h*u,this._w=A*l*u-c*h*f;break;case"ZYX":this._x=c*l*u-A*h*f,this._y=A*h*u+c*l*f,this._z=A*l*f-c*h*u,this._w=A*l*u+c*h*f;break;case"YZX":this._x=c*l*u+A*h*f,this._y=A*h*u+c*l*f,this._z=A*l*f-c*h*u,this._w=A*l*u-c*h*f;break;case"XZY":this._x=c*l*u-A*h*f,this._y=A*h*u-c*l*f,this._z=A*l*f+c*h*u,this._w=A*l*u+c*h*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,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],a=e[1],o=e[5],s=e[9],A=e[2],l=e[6],u=e[10],c=n+o+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-s)*t,this._y=(i-A)*t,this._z=(a-r)*t}else if(n>o&&n>u){const t=2*Math.sqrt(1+n-o-u);this._w=(l-s)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(i+A)/t}else if(o>u){const t=2*Math.sqrt(1+o-n-u);this._w=(i-A)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(s+l)/t}else{const t=2*Math.sqrt(1+u-n-o);this._w=(a-r)/t,this._x=(i+A)/t,this._y=(s+l)/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(Y(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(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,r=t._y,i=t._z,a=t._w,o=e._x,s=e._y,A=e._z,l=e._w;return this._x=n*l+a*o+r*A-i*s,this._y=r*l+a*s+i*o-n*A,this._z=i*l+a*A+n*s-r*o,this._w=a*l-n*o-r*s-i*A,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,a=this._w;let o=a*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;const s=1-o*o;if(s<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const A=Math.sqrt(s),l=Math.atan2(A,o),u=Math.sin((1-e)*l)/A,c=Math.sin(e*l)/A;return this._w=a*u+this._w*c,this._x=n*u+this._x*c,this._y=r*u+this._y*c,this._z=i*u+this._z*c,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),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(e*Math.cos(r),n*Math.sin(i),n*Math.cos(i),e*Math.sin(r))}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 Et{constructor(t=0,e=0,n=0){Et.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(Ct.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Ct.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,a=t.y,o=t.z,s=t.w,A=s*e+a*r-o*n,l=s*n+o*e-i*r,u=s*r+i*n-a*e,c=-i*e-a*n-o*r;return this.x=A*s+c*-i+l*-o-u*-a,this.y=l*s+c*-a+u*-i-A*-o,this.z=u*s+c*-o+A*-a-l*-i,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,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,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,r=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*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 Tt.copy(this).projectOnVector(t),this.sub(Tt)}reflect(t){return this.sub(Tt.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(Y(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}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 r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*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(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,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 Tt=new Et,Ct=new St;class qt{constructor(t=new Et(1/0,1/0,1/0),e=new Et(-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,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(let s=0,A=t.length;s<A;s+=3){const A=t[s],l=t[s+1],u=t[s+2];A<e&&(e=A),l<n&&(n=l),u<r&&(r=u),A>i&&(i=A),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,n,r),this.max.set(i,a,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(let s=0,A=t.count;s<A;s++){const A=t.getX(s),l=t.getY(s),u=t.getZ(s);A<e&&(e=A),l<n&&(n=l),u<r&&(r=u),A>i&&(i=A),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,n,r),this.max.set(i,a,o),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=Dt.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,r=e.count;n<r;n++)Dt.fromBufferAttribute(e,n).applyMatrix4(t.matrixWorld),this.expandByPoint(Dt)}else null===n.boundingBox&&n.computeBoundingBox(),Lt.copy(n.boundingBox),Lt.applyMatrix4(t.matrixWorld),this.union(Lt);const r=t.children;for(let t=0,n=r.length;t<n;t++)this.expandByObject(r[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,Dt),Dt.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(zt),Nt.subVectors(this.max,zt),Rt.subVectors(t.a,zt),It.subVectors(t.b,zt),Ot.subVectors(t.c,zt),Bt.subVectors(It,Rt),kt.subVectors(Ot,It),Ut.subVectors(Rt,Ot);let e=[0,-Bt.z,Bt.y,0,-kt.z,kt.y,0,-Ut.z,Ut.y,Bt.z,0,-Bt.x,kt.z,0,-kt.x,Ut.z,0,-Ut.x,-Bt.y,Bt.x,0,-kt.y,kt.x,0,-Ut.y,Ut.x,0];return!!Ht(e,Rt,It,Ot,Nt)&&(e=[1,0,0,0,1,0,0,0,1],!!Ht(e,Rt,It,Ot,Nt)&&(Ft.crossVectors(Bt,kt),e=[Ft.x,Ft.y,Ft.z],Ht(e,Rt,It,Ot,Nt)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Dt.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Dt).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()||(Pt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Pt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Pt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Pt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Pt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Pt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Pt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Pt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Pt)),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 Pt=[new Et,new Et,new Et,new Et,new Et,new Et,new Et,new Et],Dt=new Et,Lt=new qt,Rt=new Et,It=new Et,Ot=new Et,Bt=new Et,kt=new Et,Ut=new Et,zt=new Et,Nt=new Et,Ft=new Et,Gt=new Et;function Ht(t,e,n,r,i){for(let a=0,o=t.length-3;a<=o;a+=3){Gt.fromArray(t,a);const o=i.x*Math.abs(Gt.x)+i.y*Math.abs(Gt.y)+i.z*Math.abs(Gt.z),s=e.dot(Gt),A=n.dot(Gt),l=r.dot(Gt);if(Math.max(-Math.max(s,A,l),Math.min(s,A,l))>o)return!1}return!0}const jt=new qt,Vt=new Et,Wt=new Et,Qt=new Et;class Yt{constructor(t=new Et,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 r=0;for(let e=0,i=t.length;e<i;e++)r=Math.max(r,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(r),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){Qt.subVectors(t,this.center);const e=Qt.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(Qt.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return!0===this.center.equals(t.center)?Wt.set(0,0,1).multiplyScalar(t.radius):Wt.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(Vt.copy(t.center).add(Wt)),this.expandByPoint(Vt.copy(t.center).sub(Wt)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Xt=new Et,Zt=new Et,Jt=new Et,Kt=new Et,$t=new Et,te=new Et,ee=new Et;class ne{constructor(t=new Et,e=new Et(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,Xt)),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=Xt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Xt.copy(this.direction).multiplyScalar(e).add(this.origin),Xt.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){Zt.copy(t).add(e).multiplyScalar(.5),Jt.copy(e).sub(t).normalize(),Kt.copy(this.origin).sub(Zt);const i=.5*t.distanceTo(e),a=-this.direction.dot(Jt),o=Kt.dot(this.direction),s=-Kt.dot(Jt),A=Kt.lengthSq(),l=Math.abs(1-a*a);let u,c,h,f;if(l>0)if(u=a*s-o,c=a*o-s,f=i*l,u>=0)if(c>=-f)if(c<=f){const t=1/l;u*=t,c*=t,h=u*(u+a*c+2*o)+c*(a*u+c+2*s)+A}else c=i,u=Math.max(0,-(a*c+o)),h=-u*u+c*(c+2*s)+A;else c=-i,u=Math.max(0,-(a*c+o)),h=-u*u+c*(c+2*s)+A;else c<=-f?(u=Math.max(0,-(-a*i+o)),c=u>0?-i:Math.min(Math.max(-i,-s),i),h=-u*u+c*(c+2*s)+A):c<=f?(u=0,c=Math.min(Math.max(-i,-s),i),h=c*(c+2*s)+A):(u=Math.max(0,-(a*i+o)),c=u>0?i:Math.min(Math.max(-i,-s),i),h=-u*u+c*(c+2*s)+A);else c=a>0?-i:i,u=Math.max(0,-(a*c+o)),h=-u*u+c*(c+2*s)+A;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(Jt).multiplyScalar(c).add(Zt),h}intersectSphere(t,e){Xt.subVectors(t.center,this.origin);const n=Xt.dot(this.direction),r=Xt.dot(Xt)-n*n,i=t.radius*t.radius;if(r>i)return null;const a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,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);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,a,o,s;const A=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,c=this.origin;return A>=0?(n=(t.min.x-c.x)*A,r=(t.max.x-c.x)*A):(n=(t.max.x-c.x)*A,r=(t.min.x-c.x)*A),l>=0?(i=(t.min.y-c.y)*l,a=(t.max.y-c.y)*l):(i=(t.max.y-c.y)*l,a=(t.min.y-c.y)*l),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),u>=0?(o=(t.min.z-c.z)*u,s=(t.max.z-c.z)*u):(o=(t.max.z-c.z)*u,s=(t.min.z-c.z)*u),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,Xt)}intersectTriangle(t,e,n,r,i){$t.subVectors(e,t),te.subVectors(n,t),ee.crossVectors($t,te);let a,o=this.direction.dot(ee);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Kt.subVectors(this.origin,t);const s=a*this.direction.dot(te.crossVectors(Kt,te));if(s<0)return null;const A=a*this.direction.dot($t.cross(Kt));if(A<0)return null;if(s+A>o)return null;const l=-a*Kt.dot(ee);return l<0?null:this.at(l/o,i)}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)}}class re{constructor(){re.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,r,i,a,o,s,A,l,u,c,h,f,d,p){const m=this.elements;return m[0]=t,m[4]=e,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=A,m[6]=l,m[10]=u,m[14]=c,m[3]=h,m[7]=f,m[11]=d,m[15]=p,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 re).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,r=1/ie.setFromMatrixColumn(t,0).length(),i=1/ie.setFromMatrixColumn(t,1).length(),a=1/ie.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,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,r=t.y,i=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),A=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){const t=a*l,n=a*u,r=o*l,i=o*u;e[0]=s*l,e[4]=-s*u,e[8]=A,e[1]=n+r*A,e[5]=t-i*A,e[9]=-o*s,e[2]=i-t*A,e[6]=r+n*A,e[10]=a*s}else if("YXZ"===t.order){const t=s*l,n=s*u,r=A*l,i=A*u;e[0]=t+i*o,e[4]=r*o-n,e[8]=a*A,e[1]=a*u,e[5]=a*l,e[9]=-o,e[2]=n*o-r,e[6]=i+t*o,e[10]=a*s}else if("ZXY"===t.order){const t=s*l,n=s*u,r=A*l,i=A*u;e[0]=t-i*o,e[4]=-a*u,e[8]=r+n*o,e[1]=n+r*o,e[5]=a*l,e[9]=i-t*o,e[2]=-a*A,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){const t=a*l,n=a*u,r=o*l,i=o*u;e[0]=s*l,e[4]=r*A-n,e[8]=t*A+i,e[1]=s*u,e[5]=i*A+t,e[9]=n*A-r,e[2]=-A,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){const t=a*s,n=a*A,r=o*s,i=o*A;e[0]=s*l,e[4]=i-t*u,e[8]=r*u+n,e[1]=u,e[5]=a*l,e[9]=-o*l,e[2]=-A*l,e[6]=n*u+r,e[10]=t-i*u}else if("XZY"===t.order){const t=a*s,n=a*A,r=o*s,i=o*A;e[0]=s*l,e[4]=-u,e[8]=A*l,e[1]=t*u+i,e[5]=a*l,e[9]=n*u-r,e[2]=r*u-n,e[6]=o*l,e[10]=i*u+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(oe,t,se)}lookAt(t,e,n){const r=this.elements;return ue.subVectors(t,e),0===ue.lengthSq()&&(ue.z=1),ue.normalize(),Ae.crossVectors(n,ue),0===Ae.lengthSq()&&(1===Math.abs(n.z)?ue.x+=1e-4:ue.z+=1e-4,ue.normalize(),Ae.crossVectors(n,ue)),Ae.normalize(),le.crossVectors(ue,Ae),r[0]=Ae.x,r[4]=le.x,r[8]=ue.x,r[1]=Ae.y,r[5]=le.y,r[9]=ue.y,r[2]=Ae.z,r[6]=le.z,r[10]=ue.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[4],s=n[8],A=n[12],l=n[1],u=n[5],c=n[9],h=n[13],f=n[2],d=n[6],p=n[10],m=n[14],g=n[3],v=n[7],x=n[11],y=n[15],_=r[0],b=r[4],w=r[8],M=r[12],S=r[1],E=r[5],T=r[9],C=r[13],q=r[2],P=r[6],D=r[10],L=r[14],R=r[3],I=r[7],O=r[11],B=r[15];return i[0]=a*_+o*S+s*q+A*R,i[4]=a*b+o*E+s*P+A*I,i[8]=a*w+o*T+s*D+A*O,i[12]=a*M+o*C+s*L+A*B,i[1]=l*_+u*S+c*q+h*R,i[5]=l*b+u*E+c*P+h*I,i[9]=l*w+u*T+c*D+h*O,i[13]=l*M+u*C+c*L+h*B,i[2]=f*_+d*S+p*q+m*R,i[6]=f*b+d*E+p*P+m*I,i[10]=f*w+d*T+p*D+m*O,i[14]=f*M+d*C+p*L+m*B,i[3]=g*_+v*S+x*q+y*R,i[7]=g*b+v*E+x*P+y*I,i[11]=g*w+v*T+x*D+y*O,i[15]=g*M+v*C+x*L+y*B,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],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],A=t[13],l=t[2],u=t[6],c=t[10],h=t[14];return t[3]*(+i*s*u-r*A*u-i*o*c+n*A*c+r*o*h-n*s*h)+t[7]*(+e*s*h-e*A*c+i*a*c-r*a*h+r*A*l-i*s*l)+t[11]*(+e*A*u-e*o*h-i*a*u+n*a*h+i*o*l-n*A*l)+t[15]*(-r*o*l-e*s*u+e*o*c+r*a*u-n*a*c+n*s*l)}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 r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],A=t[7],l=t[8],u=t[9],c=t[10],h=t[11],f=t[12],d=t[13],p=t[14],m=t[15],g=u*p*A-d*c*A+d*s*h-o*p*h-u*s*m+o*c*m,v=f*c*A-l*p*A-f*s*h+a*p*h+l*s*m-a*c*m,x=l*d*A-f*u*A+f*o*h-a*d*h-l*o*m+a*u*m,y=f*u*s-l*d*s-f*o*c+a*d*c+l*o*p-a*u*p,_=e*g+n*v+r*x+i*y;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/_;return t[0]=g*b,t[1]=(d*c*i-u*p*i-d*r*h+n*p*h+u*r*m-n*c*m)*b,t[2]=(o*p*i-d*s*i+d*r*A-n*p*A-o*r*m+n*s*m)*b,t[3]=(u*s*i-o*c*i-u*r*A+n*c*A+o*r*h-n*s*h)*b,t[4]=v*b,t[5]=(l*p*i-f*c*i+f*r*h-e*p*h-l*r*m+e*c*m)*b,t[6]=(f*s*i-a*p*i-f*r*A+e*p*A+a*r*m-e*s*m)*b,t[7]=(a*c*i-l*s*i+l*r*A-e*c*A-a*r*h+e*s*h)*b,t[8]=x*b,t[9]=(f*u*i-l*d*i-f*n*h+e*d*h+l*n*m-e*u*m)*b,t[10]=(a*d*i-f*o*i+f*n*A-e*d*A-a*n*m+e*o*m)*b,t[11]=(l*o*i-a*u*i-l*n*A+e*u*A+a*n*h-e*o*h)*b,t[12]=y*b,t[13]=(l*d*r-f*u*r+f*n*c-e*d*c-l*n*p+e*u*p)*b,t[14]=(f*o*r-a*d*r-f*n*s+e*d*s+a*n*p-e*o*p)*b,t[15]=(a*u*r-l*o*r+l*n*s-e*u*s-a*n*c+e*o*c)*b,this}scale(t){const e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,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],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}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),r=Math.sin(e),i=1-n,a=t.x,o=t.y,s=t.z,A=i*a,l=i*o;return this.set(A*a+n,A*o-r*s,A*s+r*o,0,A*o+r*s,l*o+n,l*s-r*a,0,A*s-r*o,l*s+r*a,i*s*s+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,r,i,a){return this.set(1,n,i,0,t,1,a,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,a=e._y,o=e._z,s=e._w,A=i+i,l=a+a,u=o+o,c=i*A,h=i*l,f=i*u,d=a*l,p=a*u,m=o*u,g=s*A,v=s*l,x=s*u,y=n.x,_=n.y,b=n.z;return r[0]=(1-(d+m))*y,r[1]=(h+x)*y,r[2]=(f-v)*y,r[3]=0,r[4]=(h-x)*_,r[5]=(1-(c+m))*_,r[6]=(p+g)*_,r[7]=0,r[8]=(f+v)*b,r[9]=(p-g)*b,r[10]=(1-(c+d))*b,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=ie.set(r[0],r[1],r[2]).length();const a=ie.set(r[4],r[5],r[6]).length(),o=ie.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],ae.copy(this);const s=1/i,A=1/a,l=1/o;return ae.elements[0]*=s,ae.elements[1]*=s,ae.elements[2]*=s,ae.elements[4]*=A,ae.elements[5]*=A,ae.elements[6]*=A,ae.elements[8]*=l,ae.elements[9]*=l,ae.elements[10]*=l,e.setFromRotationMatrix(ae),n.x=i,n.y=a,n.z=o,this}makePerspective(t,e,n,r,i,a){const o=this.elements,s=2*i/(e-t),A=2*i/(n-r),l=(e+t)/(e-t),u=(n+r)/(n-r),c=-(a+i)/(a-i),h=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=A,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=c,o[14]=h,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,r,i,a){const o=this.elements,s=1/(e-t),A=1/(n-r),l=1/(a-i),u=(e+t)*s,c=(n+r)*A,h=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*A,o[9]=0,o[13]=-c,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-h,o[3]=0,o[7]=0,o[11]=0,o[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 ie=new Et,ae=new re,oe=new Et(0,0,0),se=new Et(1,1,1),Ae=new Et,le=new Et,ue=new Et,ce=new re,he=new St;class fe{constructor(t=0,e=0,n=0,r=fe.DefaultOrder){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=r}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,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,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 r=t.elements,i=r[0],a=r[4],o=r[8],s=r[1],A=r[5],l=r[9],u=r[2],c=r[6],h=r[10];switch(e){case"XYZ":this._y=Math.asin(Y(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(c,A),this._z=0);break;case"YXZ":this._x=Math.asin(-Y(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,h),this._z=Math.atan2(s,A)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(Y(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-a,A)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-Y(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(c,h),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,A));break;case"YZX":this._z=Math.asin(Y(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,A),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,h));break;case"XZY":this._z=Math.asin(-Y(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(c,A),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,h),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 ce.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ce,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return he.setFromEuler(this),this.setFromQuaternion(he,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")}}fe.DefaultOrder="XYZ",fe.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class de{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))}}let pe=0;const me=new Et,ge=new St,ve=new re,xe=new Et,ye=new Et,_e=new Et,be=new St,we=new Et(1,0,0),Me=new Et(0,1,0),Se=new Et(0,0,1),Ee={type:"added"},Te={type:"removed"};class Ce extends G{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:pe++}),this.uuid=Q(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ce.DefaultUp.clone();const t=new Et,e=new fe,n=new St,r=new Et(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 re},normalMatrix:{value:new et}}),this.matrix=new re,this.matrixWorld=new re,this.matrixAutoUpdate=Ce.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new de,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 ge.setFromAxisAngle(t,e),this.quaternion.multiply(ge),this}rotateOnWorldAxis(t,e){return ge.setFromAxisAngle(t,e),this.quaternion.premultiply(ge),this}rotateX(t){return this.rotateOnAxis(we,t)}rotateY(t){return this.rotateOnAxis(Me,t)}rotateZ(t){return this.rotateOnAxis(Se,t)}translateOnAxis(t,e){return me.copy(t).applyQuaternion(this.quaternion),this.position.add(me.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(we,t)}translateY(t){return this.translateOnAxis(Me,t)}translateZ(t){return this.translateOnAxis(Se,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(ve.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?xe.copy(t):xe.set(t,e,n);const r=this.parent;this.updateWorldMatrix(!0,!1),ye.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ve.lookAt(ye,xe,this.up):ve.lookAt(xe,ye,this.up),this.quaternion.setFromRotationMatrix(ve),r&&(ve.extractRotation(r.matrixWorld),ge.setFromRotationMatrix(ve),this.quaternion.premultiply(ge.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(Ee)):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(Te)),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(Te)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),ve.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),ve.multiply(t.parent.matrixWorld)),t.applyMatrix4(ve),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,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(t,e);if(void 0!==r)return r}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ye,t,_e),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ye,be,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,r=e.length;n<r;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,r=e.length;n<r;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,r=e.length;n<r;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 r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(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,r=n.length;e<r;e++){const r=n[e];i(t.shapes,r)}else i(t.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,r=this.material.length;n<r;n++)e.push(i(t.materials,this.material[n]));r.material=e}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(let e=0;e<this.children.length;e++)r.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];r.animations.push(i(t.animations,n))}}if(e){const e=a(t.geometries),r=a(t.materials),i=a(t.textures),o=a(t.images),s=a(t.shapes),A=a(t.skeletons),l=a(t.animations),u=a(t.nodes);e.length>0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),A.length>0&&(n.skeletons=A),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}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}}Ce.DefaultUp=new Et(0,1,0),Ce.DefaultMatrixAutoUpdate=!0;const qe=new Et,Pe=new Et,De=new Et,Le=new Et,Re=new Et,Ie=new Et,Oe=new Et,Be=new Et,ke=new Et,Ue=new Et;class ze{constructor(t=new Et,e=new Et,n=new Et){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){r.subVectors(n,e),qe.subVectors(t,e),r.cross(qe);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){qe.subVectors(r,e),Pe.subVectors(n,e),De.subVectors(t,e);const a=qe.dot(qe),o=qe.dot(Pe),s=qe.dot(De),A=Pe.dot(Pe),l=Pe.dot(De),u=a*A-o*o;if(0===u)return i.set(-2,-1,-1);const c=1/u,h=(A*s-o*l)*c,f=(a*l-o*s)*c;return i.set(1-h-f,f,h)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,Le),Le.x>=0&&Le.y>=0&&Le.x+Le.y<=1}static getUV(t,e,n,r,i,a,o,s){return this.getBarycoord(t,e,n,r,Le),s.set(0,0),s.addScaledVector(i,Le.x),s.addScaledVector(a,Le.y),s.addScaledVector(o,Le.z),s}static isFrontFacing(t,e,n,r){return qe.subVectors(n,e),Pe.subVectors(t,e),qe.cross(Pe).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),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 qe.subVectors(this.c,this.b),Pe.subVectors(this.a,this.b),.5*qe.cross(Pe).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ze.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ze.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return ze.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return ze.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ze.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,r=this.b,i=this.c;let a,o;Re.subVectors(r,n),Ie.subVectors(i,n),Be.subVectors(t,n);const s=Re.dot(Be),A=Ie.dot(Be);if(s<=0&&A<=0)return e.copy(n);ke.subVectors(t,r);const l=Re.dot(ke),u=Ie.dot(ke);if(l>=0&&u<=l)return e.copy(r);const c=s*u-l*A;if(c<=0&&s>=0&&l<=0)return a=s/(s-l),e.copy(n).addScaledVector(Re,a);Ue.subVectors(t,i);const h=Re.dot(Ue),f=Ie.dot(Ue);if(f>=0&&h<=f)return e.copy(i);const d=h*A-s*f;if(d<=0&&A>=0&&f<=0)return o=A/(A-f),e.copy(n).addScaledVector(Ie,o);const p=l*f-h*u;if(p<=0&&u-l>=0&&h-f>=0)return Oe.subVectors(i,r),o=(u-l)/(u-l+(h-f)),e.copy(r).addScaledVector(Oe,o);const m=1/(p+d+c);return a=d*m,o=c*m,e.copy(n).addScaledVector(Re,a).addScaledVector(Ie,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ne=0;class Fe extends G{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ne++}),this.uuid=Q(),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=h,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=U,this.stencilZFail=U,this.stencilZPass=U,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 r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.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 r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}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=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}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 r=0;r!==t;++r)n[r]=e[r].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 Ge extends Fe{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new dt(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}}const He=new Et,je=new tt;class Ve{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=z,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 r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new dt),e[n++]=i.r,e[n++]=i.g,e[n++]=i.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new tt),e[n++]=i.x,e[n++]=i.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new Et),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new _t),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z,e[n++]=i.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)je.fromBufferAttribute(this,e),je.applyMatrix3(t),this.setXY(e,je.x,je.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)He.fromBufferAttribute(this,e),He.applyMatrix3(t),this.setXYZ(e,He.x,He.y,He.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)He.fromBufferAttribute(this,e),He.applyMatrix4(t),this.setXYZ(e,He.x,He.y,He.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)He.fromBufferAttribute(this,e),He.applyNormalMatrix(t),this.setXYZ(e,He.x,He.y,He.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)He.fromBufferAttribute(this,e),He.transformDirection(t),this.setXYZ(e,He.x,He.y,He.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,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,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),this.usage!==z&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}class We extends Ve{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Qe extends Ve{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Ye extends Ve{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Xe=0;const Ze=new re,Je=new Ce,Ke=new Et,$e=new qt,tn=new qt,en=new Et;class nn extends G{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Xe++}),this.uuid=Q(),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(nt(t)?Qe:We)(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 et).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ze.makeRotationFromQuaternion(t),this.applyMatrix4(Ze),this}rotateX(t){return Ze.makeRotationX(t),this.applyMatrix4(Ze),this}rotateY(t){return Ze.makeRotationY(t),this.applyMatrix4(Ze),this}rotateZ(t){return Ze.makeRotationZ(t),this.applyMatrix4(Ze),this}translate(t,e,n){return Ze.makeTranslation(t,e,n),this.applyMatrix4(Ze),this}scale(t,e,n){return Ze.makeScale(t,e,n),this.applyMatrix4(Ze),this}lookAt(t){return Je.lookAt(t),Je.updateMatrix(),this.applyMatrix4(Je.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ke).negate(),this.translate(Ke.x,Ke.y,Ke.z),this}setFromPoints(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ye(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new qt);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 Et(-1/0,-1/0,-1/0),new Et(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];$e.setFromBufferAttribute(n),this.morphTargetsRelative?(en.addVectors(this.boundingBox.min,$e.min),this.boundingBox.expandByPoint(en),en.addVectors(this.boundingBox.max,$e.max),this.boundingBox.expandByPoint(en)):(this.boundingBox.expandByPoint($e.min),this.boundingBox.expandByPoint($e.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 Yt);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 Et,1/0);if(t){const n=this.boundingSphere.center;if($e.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];tn.setFromBufferAttribute(n),this.morphTargetsRelative?(en.addVectors($e.min,tn.min),$e.expandByPoint(en),en.addVectors($e.max,tn.max),$e.expandByPoint(en)):($e.expandByPoint(tn.min),$e.expandByPoint(tn.max))}$e.getCenter(n);let r=0;for(let e=0,i=t.count;e<i;e++)en.fromBufferAttribute(t,e),r=Math.max(r,n.distanceToSquared(en));if(e)for(let i=0,a=e.length;i<a;i++){const a=e[i],o=this.morphTargetsRelative;for(let e=0,i=a.count;e<i;e++)en.fromBufferAttribute(a,e),o&&(Ke.fromBufferAttribute(t,e),en.add(Ke)),r=Math.max(r,n.distanceToSquared(en))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}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,r=e.position.array,i=e.normal.array,a=e.uv.array,o=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Ve(new Float32Array(4*o),4));const s=this.getAttribute("tangent").array,A=[],l=[];for(let t=0;t<o;t++)A[t]=new Et,l[t]=new Et;const u=new Et,c=new Et,h=new Et,f=new tt,d=new tt,p=new tt,m=new Et,g=new Et;function v(t,e,n){u.fromArray(r,3*t),c.fromArray(r,3*e),h.fromArray(r,3*n),f.fromArray(a,2*t),d.fromArray(a,2*e),p.fromArray(a,2*n),c.sub(u),h.sub(u),d.sub(f),p.sub(f);const i=1/(d.x*p.y-p.x*d.y);isFinite(i)&&(m.copy(c).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(i),g.copy(h).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(i),A[t].add(m),A[e].add(m),A[n].add(m),l[t].add(g),l[e].add(g),l[n].add(g))}let x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(let t=0,e=x.length;t<e;++t){const e=x[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)v(n[t+0],n[t+1],n[t+2])}const y=new Et,_=new Et,b=new Et,w=new Et;function M(t){b.fromArray(i,3*t),w.copy(b);const e=A[t];y.copy(e),y.sub(b.multiplyScalar(b.dot(e))).normalize(),_.crossVectors(w,e);const n=_.dot(l[t])<0?-1:1;s[4*t]=y.x,s[4*t+1]=y.y,s[4*t+2]=y.z,s[4*t+3]=n}for(let t=0,e=x.length;t<e;++t){const e=x[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)M(n[t+0]),M(n[t+1]),M(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 Ve(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 r=new Et,i=new Et,a=new Et,o=new Et,s=new Et,A=new Et,l=new Et,u=new Et;if(t)for(let c=0,h=t.count;c<h;c+=3){const h=t.getX(c+0),f=t.getX(c+1),d=t.getX(c+2);r.fromBufferAttribute(e,h),i.fromBufferAttribute(e,f),a.fromBufferAttribute(e,d),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,h),s.fromBufferAttribute(n,f),A.fromBufferAttribute(n,d),o.add(l),s.add(l),A.add(l),n.setXYZ(h,o.x,o.y,o.z),n.setXYZ(f,s.x,s.y,s.z),n.setXYZ(d,A.x,A.y,A.z)}else for(let t=0,o=e.count;t<o;t+=3)r.fromBufferAttribute(e,t+0),i.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(t+0,l.x,l.y,l.z),n.setXYZ(t+1,l.x,l.y,l.z),n.setXYZ(t+2,l.x,l.y,l.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 r in n){if(void 0===t.attributes[r])continue;const i=n[r].array,a=t.attributes[r],o=a.array,s=a.itemSize*e,A=Math.min(o.length,i.length-s);for(let t=0,e=s;t<A;t++,e++)i[e]=o[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)en.fromBufferAttribute(t,e),en.normalize(),t.setXYZ(e,en.x,en.y,en.z)}toNonIndexed(){function t(t,e){const n=t.array,r=t.itemSize,i=t.normalized,a=new n.constructor(e.length*r);let o=0,s=0;for(let i=0,A=e.length;i<A;i++){o=t.isInterleavedBufferAttribute?e[i]*t.data.stride+t.offset:e[i]*r;for(let t=0;t<r;t++)a[s++]=n[o++]}return new Ve(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new nn,n=this.index.array,r=this.attributes;for(const i in r){const a=t(r[i],n);e.setAttribute(i,a)}const i=this.morphAttributes;for(const r in i){const a=[],o=i[r];for(let e=0,r=o.length;e<r;e++){const r=t(o[e],n);a.push(r)}e.morphAttributes[r]=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 r=n[e];t.data.attributes[e]=r.toJSON(t.data)}const r={};let i=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],a=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];a.push(r.toJSON(t.data))}a.length>0&&(r[e]=a,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.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 r=t.attributes;for(const t in r){const n=r[t];this.setAttribute(t,n.clone(e))}const i=t.morphAttributes;for(const t in i){const n=[],r=i[t];for(let t=0,i=r.length;t<i;t++)n.push(r[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 o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const s=t.boundingSphere;return null!==s&&(this.boundingSphere=s.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 rn=new re,an=new ne,on=new Yt,sn=new Et,An=new Et,ln=new Et,un=new Et,cn=new Et,hn=new Et,fn=new Et,dn=new Et,pn=new Et,mn=new tt,gn=new tt,vn=new tt,xn=new Et,yn=new Et;class _n extends Ce{constructor(t=new nn,e=new Ge){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,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),on.copy(n.boundingSphere),on.applyMatrix4(i),!1===t.ray.intersectsSphere(on))return;if(rn.copy(i).invert(),an.copy(t.ray).applyMatrix4(rn),null!==n.boundingBox&&!1===an.intersectsBox(n.boundingBox))return;let a;const o=n.index,s=n.attributes.position,A=n.morphAttributes.position,l=n.morphTargetsRelative,u=n.attributes.uv,c=n.attributes.uv2,h=n.groups,f=n.drawRange;if(null!==o)if(Array.isArray(r))for(let n=0,i=h.length;n<i;n++){const i=h[n],d=r[i.materialIndex];for(let n=Math.max(i.start,f.start),r=Math.min(o.count,Math.min(i.start+i.count,f.start+f.count));n<r;n+=3){const r=o.getX(n),h=o.getX(n+1),f=o.getX(n+2);a=bn(this,d,t,an,s,A,l,u,c,r,h,f),a&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=i.materialIndex,e.push(a))}}else{for(let n=Math.max(0,f.start),i=Math.min(o.count,f.start+f.count);n<i;n+=3){const i=o.getX(n),h=o.getX(n+1),f=o.getX(n+2);a=bn(this,r,t,an,s,A,l,u,c,i,h,f),a&&(a.faceIndex=Math.floor(n/3),e.push(a))}}else if(void 0!==s)if(Array.isArray(r))for(let n=0,i=h.length;n<i;n++){const i=h[n],o=r[i.materialIndex];for(let n=Math.max(i.start,f.start),r=Math.min(s.count,Math.min(i.start+i.count,f.start+f.count));n<r;n+=3){a=bn(this,o,t,an,s,A,l,u,c,n,n+1,n+2),a&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=i.materialIndex,e.push(a))}}else{for(let n=Math.max(0,f.start),i=Math.min(s.count,f.start+f.count);n<i;n+=3){a=bn(this,r,t,an,s,A,l,u,c,n,n+1,n+2),a&&(a.faceIndex=Math.floor(n/3),e.push(a))}}}}function bn(t,e,n,r,i,a,o,s,A,l,u,c){sn.fromBufferAttribute(i,l),An.fromBufferAttribute(i,u),ln.fromBufferAttribute(i,c);const h=t.morphTargetInfluences;if(a&&h){fn.set(0,0,0),dn.set(0,0,0),pn.set(0,0,0);for(let t=0,e=a.length;t<e;t++){const e=h[t],n=a[t];0!==e&&(un.fromBufferAttribute(n,l),cn.fromBufferAttribute(n,u),hn.fromBufferAttribute(n,c),o?(fn.addScaledVector(un,e),dn.addScaledVector(cn,e),pn.addScaledVector(hn,e)):(fn.addScaledVector(un.sub(sn),e),dn.addScaledVector(cn.sub(An),e),pn.addScaledVector(hn.sub(ln),e)))}sn.add(fn),An.add(dn),ln.add(pn)}t.isSkinnedMesh&&(t.boneTransform(l,sn),t.boneTransform(u,An),t.boneTransform(c,ln));const f=function(t,e,n,r,i,a,o,s){let A;if(A=1===e.side?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,2!==e.side,s),null===A)return null;yn.copy(s),yn.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(yn);return l<n.near||l>n.far?null:{distance:l,point:yn.clone(),object:t}}(t,e,n,r,sn,An,ln,xn);if(f){s&&(mn.fromBufferAttribute(s,l),gn.fromBufferAttribute(s,u),vn.fromBufferAttribute(s,c),f.uv=ze.getUV(xn,sn,An,ln,mn,gn,vn,new tt)),A&&(mn.fromBufferAttribute(A,l),gn.fromBufferAttribute(A,u),vn.fromBufferAttribute(A,c),f.uv2=ze.getUV(xn,sn,An,ln,mn,gn,vn,new tt));const t={a:l,b:u,c:c,normal:new Et,materialIndex:0};ze.getNormal(sn,An,ln,t.normal),f.face=t}return f}class wn extends nn{constructor(t=1,e=1,n=1,r=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};const o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);const s=[],A=[],l=[],u=[];let c=0,h=0;function f(t,e,n,r,i,a,f,d,p,m,g){const v=a/p,x=f/m,y=a/2,_=f/2,b=d/2,w=p+1,M=m+1;let S=0,E=0;const T=new Et;for(let a=0;a<M;a++){const o=a*x-_;for(let s=0;s<w;s++){const c=s*v-y;T[t]=c*r,T[e]=o*i,T[n]=b,A.push(T.x,T.y,T.z),T[t]=0,T[e]=0,T[n]=d>0?1:-1,l.push(T.x,T.y,T.z),u.push(s/p),u.push(1-a/m),S+=1}}for(let t=0;t<m;t++)for(let e=0;e<p;e++){const n=c+e+w*t,r=c+e+w*(t+1),i=c+(e+1)+w*(t+1),a=c+(e+1)+w*t;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(h,E,g),h+=E,c+=S}f("z","y","x",-1,-1,n,e,t,a,i,0),f("z","y","x",1,-1,n,e,-t,a,i,1),f("x","z","y",1,1,t,n,e,r,a,2),f("x","z","y",1,-1,t,n,-e,r,a,3),f("x","y","z",1,-1,t,e,n,r,i,4),f("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(s),this.setAttribute("position",new Ye(A,3)),this.setAttribute("normal",new Ye(l,3)),this.setAttribute("uv",new Ye(u,2))}static fromJSON(t){return new wn(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Mn(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function Sn(t){const e={};for(let n=0;n<t.length;n++){const r=Mn(t[n]);for(const t in r)e[t]=r[t]}return e}const En={clone:Mn,merge:Sn};class Tn extends Fe{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.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=Mn(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 r=this.uniforms[n].value;r&&r.isTexture?e.uniforms[n]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[n]={type:"m4",value:r.toArray()}:e.uniforms[n]={value:r}}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 Cn extends Ce{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new re,this.projectionMatrix=new re,this.projectionMatrixInverse=new re}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 qn extends Cn{constructor(t=50,e=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,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*W*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*V*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*W*Math.atan(Math.tan(.5*V*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,r,i,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=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*V*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const a=this.view;if(null!==this.view&&this.view.enabled){const t=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/t,e-=a.offsetY*n/o,r*=a.width/t,n*=a.height/o}const o=this.filmOffset;0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,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 Pn=90;class Dn extends Ce{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 r=new qn(Pn,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Et(1,0,0)),this.add(r);const i=new qn(Pn,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Et(-1,0,0)),this.add(i);const a=new qn(Pn,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new Et(0,1,0)),this.add(a);const o=new qn(Pn,1,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Et(0,-1,0)),this.add(o);const s=new qn(Pn,1,t,e);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Et(0,0,1)),this.add(s);const A=new qn(Pn,1,t,e);A.layers=this.layers,A.up.set(0,-1,0),A.lookAt(new Et(0,0,-1)),this.add(A)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,a,o,s,A]=this.children,l=t.getRenderTarget(),u=t.toneMapping,c=t.xr.enabled;t.toneMapping=0,t.xr.enabled=!1;const h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,a),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,s),n.texture.generateMipmaps=h,t.setRenderTarget(n,5),t.render(e,A),t.setRenderTarget(l),t.toneMapping=u,t.xr.enabled=c,n.texture.needsPMREMUpdate=!0}}class Ln extends yt{constructor(t,e,n,r,i,a,o,s,A,l){super(t=void 0!==t?t:[],e=void 0!==e?e:f,n,r,i,a,o,s,A,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Rn extends bt{constructor(t,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},r=[n,n,n,n,n,n];this.texture=new Ln(r,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:y}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={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new wn(5,5,5),i=new Tn({name:"CubemapFromEquirect",uniforms:Mn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=e;const a=new _n(r,i),o=e.minFilter;e.minFilter===_&&(e.minFilter=y);return new Dn(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let i=0;i<6;i++)t.setRenderTarget(this,i),t.clear(e,n,r);t.setRenderTarget(i)}}const In=new Et,On=new Et,Bn=new et;class kn{constructor(t=new Et(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,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const r=In.subVectors(n,e).cross(On.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,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(In),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const i=-(t.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:e.copy(n).multiplyScalar(i).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||Bn.getNormalMatrix(t),r=this.coplanarPoint(In).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),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 Un=new Yt,zn=new Et;class Nn{constructor(t=new kn,e=new kn,n=new kn,r=new kn,i=new kn,a=new kn){this.planes=[t,e,n,r,i,a]}set(t,e,n,r,i,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[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,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],A=n[5],l=n[6],u=n[7],c=n[8],h=n[9],f=n[10],d=n[11],p=n[12],m=n[13],g=n[14],v=n[15];return e[0].setComponents(o-r,u-s,d-c,v-p).normalize(),e[1].setComponents(o+r,u+s,d+c,v+p).normalize(),e[2].setComponents(o+i,u+A,d+h,v+m).normalize(),e[3].setComponents(o-i,u-A,d-h,v-m).normalize(),e[4].setComponents(o-a,u-l,d-f,v-g).normalize(),e[5].setComponents(o+a,u+l,d+f,v+g).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Un.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Un)}intersectsSprite(t){return Un.center.set(0,0,0),Un.radius=.7071067811865476,Un.applyMatrix4(t.matrixWorld),this.intersectsSphere(Un)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)<r)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const r=e[n];if(zn.x=r.normal.x>0?t.max.x:t.min.x,zn.y=r.normal.y>0?t.max.y:t.min.y,zn.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(zn)<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 Fn(){let t=null,e=!1,n=null,r=null;function i(e,a){n(e,a),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Gn(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version<e.version)&&r.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const a=r.get(e);void 0===a?r.set(e,function(e,r){const i=e.array,a=e.usage,o=t.createBuffer();let s;if(t.bindBuffer(r,o),t.bufferData(r,i,a),e.onUploadCallback(),i instanceof Float32Array)s=5126;else if(i instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");s=5131}else s=5123;else if(i instanceof Int16Array)s=5122;else if(i instanceof Uint32Array)s=5125;else if(i instanceof Int32Array)s=5124;else if(i instanceof Int8Array)s=5120;else if(i instanceof Uint8Array)s=5121;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);s=5121}return{buffer:o,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(e,i)):a.version<e.version&&(!function(e,r,i){const a=r.array,o=r.updateRange;t.bindBuffer(i,e),-1===o.count?t.bufferSubData(i,0,a):(n?t.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):t.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(a.buffer,e,i),a.version=e.version)}}}class Hn extends nn{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};const i=t/2,a=e/2,o=Math.floor(n),s=Math.floor(r),A=o+1,l=s+1,u=t/o,c=e/s,h=[],f=[],d=[],p=[];for(let t=0;t<l;t++){const e=t*c-a;for(let n=0;n<A;n++){const r=n*u-i;f.push(r,-e,0),d.push(0,0,1),p.push(n/o),p.push(1-t/s)}}for(let t=0;t<s;t++)for(let e=0;e<o;e++){const n=e+A*t,r=e+A*(t+1),i=e+1+A*(t+1),a=e+1+A*t;h.push(n,r,a),h.push(r,i,a)}this.setIndex(h),this.setAttribute("position",new Ye(f,3)),this.setAttribute("normal",new Ye(d,3)),this.setAttribute("uv",new Ye(p,2))}static fromJSON(t){return new Hn(t.width,t.height,t.widthSegments,t.heightSegments)}}const jn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\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\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\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\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\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\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\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\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\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\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\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\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\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\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\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\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\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\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}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\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\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\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\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\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\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\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\t\t#ifndef USE_MORPHNORMALS\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\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = 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\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\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\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\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\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\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\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\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\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <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}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\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}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\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\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <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>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\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}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <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 <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <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>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\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}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\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\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <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}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_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\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <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>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\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}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_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\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\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}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_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\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\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}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\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}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Vn={common:{diffuse:{value:new dt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new et},uv2Transform:{value:new et},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 tt(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 dt(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 dt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new et}},sprite:{diffuse:{value:new dt(16777215)},opacity:{value:1},center:{value:new tt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new et}}},Wn={basic:{uniforms:Sn([Vn.common,Vn.specularmap,Vn.envmap,Vn.aomap,Vn.lightmap,Vn.fog]),vertexShader:jn.meshbasic_vert,fragmentShader:jn.meshbasic_frag},lambert:{uniforms:Sn([Vn.common,Vn.specularmap,Vn.envmap,Vn.aomap,Vn.lightmap,Vn.emissivemap,Vn.fog,Vn.lights,{emissive:{value:new dt(0)}}]),vertexShader:jn.meshlambert_vert,fragmentShader:jn.meshlambert_frag},phong:{uniforms:Sn([Vn.common,Vn.specularmap,Vn.envmap,Vn.aomap,Vn.lightmap,Vn.emissivemap,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,Vn.fog,Vn.lights,{emissive:{value:new dt(0)},specular:{value:new dt(1118481)},shininess:{value:30}}]),vertexShader:jn.meshphong_vert,fragmentShader:jn.meshphong_frag},standard:{uniforms:Sn([Vn.common,Vn.envmap,Vn.aomap,Vn.lightmap,Vn.emissivemap,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,Vn.roughnessmap,Vn.metalnessmap,Vn.fog,Vn.lights,{emissive:{value:new dt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:jn.meshphysical_vert,fragmentShader:jn.meshphysical_frag},toon:{uniforms:Sn([Vn.common,Vn.aomap,Vn.lightmap,Vn.emissivemap,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,Vn.gradientmap,Vn.fog,Vn.lights,{emissive:{value:new dt(0)}}]),vertexShader:jn.meshtoon_vert,fragmentShader:jn.meshtoon_frag},matcap:{uniforms:Sn([Vn.common,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,Vn.fog,{matcap:{value:null}}]),vertexShader:jn.meshmatcap_vert,fragmentShader:jn.meshmatcap_frag},points:{uniforms:Sn([Vn.points,Vn.fog]),vertexShader:jn.points_vert,fragmentShader:jn.points_frag},dashed:{uniforms:Sn([Vn.common,Vn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:jn.linedashed_vert,fragmentShader:jn.linedashed_frag},depth:{uniforms:Sn([Vn.common,Vn.displacementmap]),vertexShader:jn.depth_vert,fragmentShader:jn.depth_frag},normal:{uniforms:Sn([Vn.common,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,{opacity:{value:1}}]),vertexShader:jn.meshnormal_vert,fragmentShader:jn.meshnormal_frag},sprite:{uniforms:Sn([Vn.sprite,Vn.fog]),vertexShader:jn.sprite_vert,fragmentShader:jn.sprite_frag},background:{uniforms:{uvTransform:{value:new et},t2D:{value:null}},vertexShader:jn.background_vert,fragmentShader:jn.background_frag},cube:{uniforms:Sn([Vn.envmap,{opacity:{value:1}}]),vertexShader:jn.cube_vert,fragmentShader:jn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:jn.equirect_vert,fragmentShader:jn.equirect_frag},distanceRGBA:{uniforms:Sn([Vn.common,Vn.displacementmap,{referencePosition:{value:new Et},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:jn.distanceRGBA_vert,fragmentShader:jn.distanceRGBA_frag},shadow:{uniforms:Sn([Vn.lights,Vn.fog,{color:{value:new dt(0)},opacity:{value:1}}]),vertexShader:jn.shadow_vert,fragmentShader:jn.shadow_frag}};function Qn(t,e,n,r,i,a){const o=new dt(0);let s,A,l=!0===i?0:1,u=null,c=0,h=null;function f(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,a)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),l=e,f(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,f(o,l)},render:function(n,i){let a=!1,d=!0===i.isScene?i.background:null;d&&d.isTexture&&(d=e.get(d));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(d=null),null===d?f(o,l):d&&d.isColor&&(f(d,1),a=!0),(t.autoClear||a)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),d&&(d.isCubeTexture||d.mapping===p)?(void 0===A&&(A=new _n(new wn(1,1,1),new Tn({name:"BackgroundCubeMaterial",uniforms:Mn(Wn.cube.uniforms),vertexShader:Wn.cube.vertexShader,fragmentShader:Wn.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),A.geometry.deleteAttribute("uv"),A.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(A.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(A)),A.material.uniforms.envMap.value=d,A.material.uniforms.flipEnvMap.value=d.isCubeTexture&&!1===d.isRenderTargetTexture?-1:1,u===d&&c===d.version&&h===t.toneMapping||(A.material.needsUpdate=!0,u=d,c=d.version,h=t.toneMapping),A.layers.enableAll(),n.unshift(A,A.geometry,A.material,0,0,null)):d&&d.isTexture&&(void 0===s&&(s=new _n(new Hn(2,2),new Tn({name:"BackgroundMaterial",uniforms:Mn(Wn.background.uniforms),vertexShader:Wn.background.vertexShader,fragmentShader:Wn.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=d,!0===d.matrixAutoUpdate&&d.updateMatrix(),s.material.uniforms.uvTransform.value.copy(d.matrix),u===d&&c===d.version&&h===t.toneMapping||(s.material.needsUpdate=!0,u=d,c=d.version,h=t.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null))}}}function Yn(t,e,n,r){const i=t.getParameter(34921),a=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},A=f(null);let l=A,u=!1;function c(e){return r.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function h(e){return r.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function f(t){const e=[],n=[],r=[];for(let t=0;t<i;t++)e[t]=0,n[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function d(){const t=l.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function p(t){m(t,0)}function m(n,i){const a=l.newAttributes,o=l.enabledAttributes,s=l.attributeDivisors;if(a[n]=1,0===o[n]&&(t.enableVertexAttribArray(n),o[n]=1),s[n]!==i){(r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i}}function g(){const e=l.newAttributes,n=l.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function v(e,n,i,a,o,s){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,a,o,s):t.vertexAttribIPointer(e,n,i,o,s)}function x(){y(),u=!0,l!==A&&(l=A,c(l.object))}function y(){A.geometry=null,A.program=null,A.wireframe=!1}return{setup:function(i,A,h,x,y){let _=!1;if(o){const e=function(e,n,i){const o=!0===i.wireframe;let A=s[e.id];void 0===A&&(A={},s[e.id]=A);let l=A[n.id];void 0===l&&(l={},A[n.id]=l);let u=l[o];void 0===u&&(u=f(r.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),l[o]=u);return u}(x,h,A);l!==e&&(l=e,c(l.object)),_=function(t,e,n,r){const i=l.attributes,a=e.attributes;let o=0;const s=n.getAttributes();for(const e in s){if(s[e].location>=0){const n=i[e];let r=a[e];if(void 0===r&&("instanceMatrix"===e&&t.instanceMatrix&&(r=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(r=t.instanceColor)),void 0===n)return!0;if(n.attribute!==r)return!0;if(r&&n.data!==r.data)return!0;o++}}return l.attributesNum!==o||l.index!==r}(i,x,h,y),_&&function(t,e,n,r){const i={},a=e.attributes;let o=0;const s=n.getAttributes();for(const e in s){if(s[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 r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[e]=r,o++}}l.attributes=i,l.attributesNum=o,l.index=r}(i,x,h,y)}else{const t=!0===A.wireframe;l.geometry===x.id&&l.program===h.id&&l.wireframe===t||(l.geometry=x.id,l.program=h.id,l.wireframe=t,_=!0)}null!==y&&n.update(y,34963),(_||u)&&(u=!1,function(i,a,o,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;d();const A=s.attributes,l=o.getAttributes(),u=a.defaultAttributeValues;for(const e in l){const r=l[e];if(r.location>=0){let a=A[e];if(void 0===a&&("instanceMatrix"===e&&i.instanceMatrix&&(a=i.instanceMatrix),"instanceColor"===e&&i.instanceColor&&(a=i.instanceColor)),void 0!==a){const e=a.normalized,o=a.itemSize,A=n.get(a);if(void 0===A)continue;const l=A.buffer,u=A.type,c=A.bytesPerElement;if(a.isInterleavedBufferAttribute){const n=a.data,A=n.stride,h=a.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)m(r.location+t,n.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let t=0;t<r.locationSize;t++)p(r.location+t);t.bindBuffer(34962,l);for(let t=0;t<r.locationSize;t++)v(r.location+t,o/r.locationSize,u,e,A*c,(h+o/r.locationSize*t)*c)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)m(r.location+t,a.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<r.locationSize;t++)p(r.location+t);t.bindBuffer(34962,l);for(let t=0;t<r.locationSize;t++)v(r.location+t,o/r.locationSize,u,e,o*c,o/r.locationSize*t*c)}}else if(void 0!==u){const n=u[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r.location,n);break;case 3:t.vertexAttrib3fv(r.location,n);break;case 4:t.vertexAttrib4fv(r.location,n);break;default:t.vertexAttrib1fv(r.location,n)}}}}g()}(i,A,h,x),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:x,resetDefaultState:y,dispose:function(){x();for(const t in s){const e=s[t];for(const t in e){const n=e[t];for(const t in n)h(n[t].object),delete n[t];delete e[t]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0===s[t.id])return;const e=s[t.id];for(const t in e){const n=e[t];for(const t in n)h(n[t].object),delete n[t];delete e[t]}delete s[t.id]},releaseStatesOfProgram:function(t){for(const e in s){const n=s[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)h(r[t].object),delete r[t];delete n[t.id]}},initAttributes:d,enableAttribute:p,disableUnusedAttributes:g}}function Xn(t,e,n,r){const i=r.isWebGL2;let a;this.setMode=function(t){a=t},this.render=function(e,r){t.drawArrays(a,e,r),n.update(r,a,1)},this.renderInstances=function(r,o,s){if(0===s)return;let A,l;if(i)A=t,l="drawArraysInstanced";else if(A=e.get("ANGLE_instanced_arrays"),l="drawArraysInstancedANGLE",null===A)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");A[l](a,r,o,s),n.update(o,a,s)}}function Zn(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const A=a||e.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,u=t.getParameter(34930),c=t.getParameter(35660),h=t.getParameter(3379),f=t.getParameter(34076),d=t.getParameter(34921),p=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),v=c>0,x=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:A,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:c,maxTextureSize:h,maxCubemapSize:f,maxAttributes:d,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:x,floatVertexTextures:v&&x,maxSamples:a?t.getParameter(36183):0}}function Jn(t){const e=this;let n=null,r=0,i=!1,a=!1;const o=new kn,s=new et,A={value:null,needsUpdate:!1};function l(){A.value!==n&&(A.value=n,A.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(t,n,r,i){const a=null!==t?t.length:0;let l=null;if(0!==a){if(l=A.value,!0!==i||null===l){const e=r+4*a,i=n.matrixWorldInverse;s.getNormalMatrix(i),(null===l||l.length<e)&&(l=new Float32Array(e));for(let e=0,n=r;e!==a;++e,n+=4)o.copy(t[e]).applyMatrix4(i,s),o.normal.toArray(l,n),l[n+3]=o.constant}A.value=l,A.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,l}this.uniform=A,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,a){const o=0!==t.length||e||0!==r||i;return i=e,n=u(t,a,0),r=t.length,o},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1,l()},this.setState=function(e,o,s){const c=e.clippingPlanes,h=e.clipIntersection,f=e.clipShadows,d=t.get(e);if(!i||null===c||0===c.length||a&&!f)a?u(null):l();else{const t=a?0:r,e=4*t;let i=d.clippingState||null;A.value=i,i=u(c,o,e,s);for(let t=0;t!==e;++t)i[t]=n[t];d.clippingState=i,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=t}}}function Kn(t){let e=new WeakMap;function n(t,e){return 303===e?t.mapping=f:304===e&&(t.mapping=d),t}function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){const a=i.mapping;if(303===a||304===a){if(e.has(i)){return n(e.get(i).texture,i.mapping)}{const a=i.image;if(a&&a.height>0){const o=new Rn(a.height/2);return o.fromEquirectangularTexture(t,i),e.set(i,o),i.addEventListener("dispose",r),n(o.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}Wn.physical={uniforms:Sn([Wn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new tt(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 dt(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new tt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new dt(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new dt(1,1,1)},specularColorMap:{value:null}}]),vertexShader:jn.meshphysical_vert,fragmentShader:jn.meshphysical_frag};class $n extends Cn{constructor(t=-1,e=1,n=1,r=-1,i=.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=r,this.near=i,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,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,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,r=(this.top+this.bottom)/2;let i=n-t,a=n+t,o=r+e,s=r-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;i+=t*this.view.offsetX,a=i+t*this.view.width,o-=e*this.view.offsetY,s=o-e*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,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 tr=[.125,.215,.35,.446,.526,.582],er=20,nr=new $n,rr=new dt;let ir=null;const ar=(1+Math.sqrt(5))/2,or=1/ar,sr=[new Et(1,1,1),new Et(-1,1,1),new Et(1,1,-1),new Et(-1,1,-1),new Et(0,ar,or),new Et(0,ar,-or),new Et(or,0,ar),new Et(-or,0,ar),new Et(ar,or,0),new Et(-ar,or,0)];class Ar{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,r=100){ir=this._renderer.getRenderTarget(),this._setSize(256);const i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=hr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=cr(),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(ir),t.scissorTest=!1,ur(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===f||t.mapping===d?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),ir=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:y,minFilter:y,generateMipmaps:!1,type:S,format:T,encoding:I,depthBuffer:!1},r=lr(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=lr(t,e,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],r=[];let i=t;const a=t-4+1+tr.length;for(let o=0;o<a;o++){const a=Math.pow(2,i);n.push(a);let s=1/a;o>t-4?s=tr[o-t+4-1]:0===o&&(s=0),r.push(s);const A=1/(a-2),l=-A,u=1+A,c=[l,l,u,l,u,u,l,l,u,u,l,u],h=6,f=6,d=3,p=2,m=1,g=new Float32Array(d*f*h),v=new Float32Array(p*f*h),x=new Float32Array(m*f*h);for(let t=0;t<h;t++){const e=t%3*2/3-1,n=t>2?0:-1,r=[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];g.set(r,d*f*t),v.set(c,p*f*t);const i=[t,t,t,t,t,t];x.set(i,m*f*t)}const y=new nn;y.setAttribute("position",new Ve(g,d)),y.setAttribute("uv",new Ve(v,p)),y.setAttribute("faceIndex",new Ve(x,m)),e.push(y),i>4&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}(r)),this._blurMaterial=function(t,e,n){const r=new Float32Array(er),i=new Et(0,1,0);return new Tn({name:"SphericalGaussianBlur",defines:{n:er,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:fr(),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})}(r,t,e)}return r}_compileMaterial(t){const e=new _n(this._lodPlanes[0],t);this._renderer.compile(e,nr)}_sceneToCubeUV(t,e,n,r){const i=new qn(90,1,e,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,A=s.autoClear,l=s.toneMapping;s.getClearColor(rr),s.toneMapping=0,s.autoClear=!1;const u=new Ge({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),c=new _n(new wn,u);let h=!1;const f=t.background;f?f.isColor&&(u.color.copy(f),t.background=null,h=!0):(u.color.copy(rr),h=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(i.up.set(0,a[e],0),i.lookAt(o[e],0,0)):1===n?(i.up.set(0,0,a[e]),i.lookAt(0,o[e],0)):(i.up.set(0,a[e],0),i.lookAt(0,0,o[e]));const A=this._cubeSize;ur(r,n*A,e>2?A:0,A,A),s.setRenderTarget(r),h&&s.render(c,i),s.render(t,i)}c.geometry.dispose(),c.material.dispose(),s.toneMapping=l,s.autoClear=A,t.background=f}_textureToCubeUV(t,e){const n=this._renderer,r=t.mapping===f||t.mapping===d;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=hr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=cr());const i=r?this._cubemapMaterial:this._equirectMaterial,a=new _n(this._lodPlanes[0],i);i.uniforms.envMap.value=t;const o=this._cubeSize;ur(e,0,0,3*o,2*o),n.setRenderTarget(e),n.render(a,nr)}_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]),r=sr[(e-1)%sr.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,r,i){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,r,"latitudinal",i),this._halfBlur(a,t,n,n,r,"longitudinal",i)}_halfBlur(t,e,n,r,i,a,o){const s=this._renderer,A=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const l=new _n(this._lodPlanes[r],A),u=A.uniforms,c=this._sizeLods[n]-1,h=isFinite(i)?Math.PI/(2*c):2*Math.PI/39,f=i/h,d=isFinite(i)?1+Math.floor(3*f):er;d>er&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${d} samples when the maximum is set to 20`);const p=[];let m=0;for(let t=0;t<er;++t){const e=t/f,n=Math.exp(-e*e/2);p.push(n),0===t?m+=n:t<d&&(m+=2*n)}for(let t=0;t<p.length;t++)p[t]=p[t]/m;u.envMap.value=t.texture,u.samples.value=d,u.weights.value=p,u.latitudinal.value="latitudinal"===a,o&&(u.poleAxis.value=o);const{_lodMax:g}=this;u.dTheta.value=h,u.mipInt.value=g-n;const v=this._sizeLods[r];ur(e,3*v*(r>g-4?r-g+4:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(e),s.render(l,nr)}}function lr(t,e,n){const r=new bt(t,e,n);return r.texture.mapping=p,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function ur(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function cr(){return new Tn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:fr(),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 hr(){return new Tn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:fr(),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 fr(){return"\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"}function dr(t){let e=new WeakMap,n=null;function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const a=i.mapping,o=303===a||304===a,s=a===f||a===d;if(o||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;let r=e.get(i);return null===n&&(n=new Ar(t)),r=o?n.fromEquirectangular(i,r):n.fromCubemap(i,r),e.set(i,r),r.texture}if(e.has(i))return e.get(i).texture;{const a=i.image;if(o&&a&&a.height>0||s&&a&&function(t){let e=0;const n=6;for(let r=0;r<n;r++)void 0!==t[r]&&e++;return e===n}(a)){null===n&&(n=new Ar(t));const a=o?n.fromEquirectangular(i):n.fromCubemap(i);return e.set(i,a),i.addEventListener("dispose",r),a.texture}return null}}}return i},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function pr(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=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":r=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":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}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 mr(t,e,n,r){const i={},a=new WeakMap;function o(t){const s=t.target;null!==s.index&&e.remove(s.index);for(const t in s.attributes)e.remove(s.attributes[t]);s.removeEventListener("dispose",o),delete i[s.id];const A=a.get(s);A&&(e.remove(A),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t){const n=[],r=t.index,i=t.attributes.position;let o=0;if(null!==r){const t=r.array;o=r.version;for(let e=0,r=t.length;e<r;e+=3){const r=t[e+0],i=t[e+1],a=t[e+2];n.push(r,i,i,a,a,r)}}else{const t=i.array;o=i.version;for(let e=0,r=t.length/3-1;e<r;e+=3){const t=e+0,r=e+1,i=e+2;n.push(t,r,r,i,i,t)}}const s=new(nt(n)?Qe:We)(n,1);s.version=o;const A=a.get(t);A&&e.remove(A),a.set(t,s)}return{get:function(t,e){return!0===i[e.id]||(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const r=t.morphAttributes;for(const t in r){const n=r[t];for(let t=0,r=n.length;t<r;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=a.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&s(t)}else s(t);return a.get(t)}}}function gr(t,e,n,r){const i=r.isWebGL2;let a,o,s;this.setMode=function(t){a=t},this.setIndex=function(t){o=t.type,s=t.bytesPerElement},this.render=function(e,r){t.drawElements(a,r,o,e*s),n.update(r,a,1)},this.renderInstances=function(r,A,l){if(0===l)return;let u,c;if(i)u=t,c="drawElementsInstanced";else if(u=e.get("ANGLE_instanced_arrays"),c="drawElementsInstancedANGLE",null===u)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[c](a,A,o,r*s,l),n.update(A,a,l)}}function vr(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(t,n,r){switch(e.calls++,n){case 4:e.triangles+=r*(t/3);break;case 1:e.lines+=r*(t/2);break;case 3:e.lines+=r*(t-1);break;case 2:e.lines+=r*t;break;case 0:e.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function xr(t,e){return t[0]-e[0]}function yr(t,e){return Math.abs(e[1])-Math.abs(t[1])}function _r(t,e){let n=1;const r=e.isInterleavedBufferAttribute?e.data.array:e.array;r instanceof Int8Array?n=127:r instanceof Uint8Array?n=255:r instanceof Uint16Array?n=65535:r instanceof Int16Array?n=32767:r instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",r),t.divideScalar(n)}function br(t,e,n){const r={},i=new Float32Array(8),a=new WeakMap,o=new _t,s=[];for(let t=0;t<8;t++)s[t]=[t,0];return{update:function(A,l,u,c){const h=A.morphTargetInfluences;if(!0===e.isWebGL2){const f=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,d=void 0!==f?f.length:0;let p=a.get(l);if(void 0===p||p.count!==d){void 0!==p&&p.texture.dispose();const v=void 0!==l.morphAttributes.position,x=void 0!==l.morphAttributes.normal,y=void 0!==l.morphAttributes.color,_=l.morphAttributes.position||[],b=l.morphAttributes.normal||[],w=l.morphAttributes.color||[];let S=0;!0===v&&(S=1),!0===x&&(S=2),!0===y&&(S=3);let E=l.attributes.position.count*S,T=1;E>e.maxTextureSize&&(T=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const C=new Float32Array(E*T*4*d),q=new wt(C,E,T,d);q.type=M,q.needsUpdate=!0;const P=4*S;for(let L=0;L<d;L++){const R=_[L],I=b[L],O=w[L],B=E*T*4*L;for(let k=0;k<R.count;k++){const U=k*P;!0===v&&(o.fromBufferAttribute(R,k),!0===R.normalized&&_r(o,R),C[B+U+0]=o.x,C[B+U+1]=o.y,C[B+U+2]=o.z,C[B+U+3]=0),!0===x&&(o.fromBufferAttribute(I,k),!0===I.normalized&&_r(o,I),C[B+U+4]=o.x,C[B+U+5]=o.y,C[B+U+6]=o.z,C[B+U+7]=0),!0===y&&(o.fromBufferAttribute(O,k),!0===O.normalized&&_r(o,O),C[B+U+8]=o.x,C[B+U+9]=o.y,C[B+U+10]=o.z,C[B+U+11]=4===O.itemSize?o.w:1)}}function D(){q.dispose(),a.delete(l),l.removeEventListener("dispose",D)}p={count:d,texture:q,size:new tt(E,T)},a.set(l,p),l.addEventListener("dispose",D)}let m=0;for(let z=0;z<h.length;z++)m+=h[z];const g=l.morphTargetsRelative?1:1-m;c.getUniforms().setValue(t,"morphTargetBaseInfluence",g),c.getUniforms().setValue(t,"morphTargetInfluences",h),c.getUniforms().setValue(t,"morphTargetsTexture",p.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",p.size)}else{const N=void 0===h?0:h.length;let F=r[l.id];if(void 0===F||F.length!==N){F=[];for(let W=0;W<N;W++)F[W]=[W,0];r[l.id]=F}for(let Q=0;Q<N;Q++){const Y=F[Q];Y[0]=Q,Y[1]=h[Q]}F.sort(yr);for(let X=0;X<8;X++)X<N&&F[X][1]?(s[X][0]=F[X][0],s[X][1]=F[X][1]):(s[X][0]=Number.MAX_SAFE_INTEGER,s[X][1]=0);s.sort(xr);const G=l.morphAttributes.position,H=l.morphAttributes.normal;let j=0;for(let Z=0;Z<8;Z++){const J=s[Z],K=J[0],$=J[1];K!==Number.MAX_SAFE_INTEGER&&$?(G&&l.getAttribute("morphTarget"+Z)!==G[K]&&l.setAttribute("morphTarget"+Z,G[K]),H&&l.getAttribute("morphNormal"+Z)!==H[K]&&l.setAttribute("morphNormal"+Z,H[K]),i[Z]=$,j+=$):(G&&!0===l.hasAttribute("morphTarget"+Z)&&l.deleteAttribute("morphTarget"+Z),H&&!0===l.hasAttribute("morphNormal"+Z)&&l.deleteAttribute("morphNormal"+Z),i[Z]=0)}const V=l.morphTargetsRelative?1:1-j;c.getUniforms().setValue(t,"morphTargetBaseInfluence",V),c.getUniforms().setValue(t,"morphTargetInfluences",i)}}}}function wr(t,e,n,r){let i=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(t){const o=r.render.frame,s=t.geometry,A=e.get(t,s);return i.get(A)!==o&&(e.update(A),i.set(A,o)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",a)&&t.addEventListener("dispose",a),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),A},dispose:function(){i=new WeakMap}}}const Mr=new yt,Sr=new wt,Er=new Mt,Tr=new Ln,Cr=[],qr=[],Pr=new Float32Array(16),Dr=new Float32Array(9),Lr=new Float32Array(4);function Rr(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let a=Cr[i];if(void 0===a&&(a=new Float32Array(i),Cr[i]=a),0!==e){r.toArray(a,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(a,i)}return a}function Ir(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Or(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function Br(t,e){let n=qr[e];void 0===n&&(n=new Int32Array(e),qr[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function kr(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Ur(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(Ir(n,e))return;t.uniform2fv(this.addr,e),Or(n,e)}}function zr(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(Ir(n,e))return;t.uniform3fv(this.addr,e),Or(n,e)}}function Nr(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(Ir(n,e))return;t.uniform4fv(this.addr,e),Or(n,e)}}function Fr(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(Ir(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Or(n,e)}else{if(Ir(n,r))return;Lr.set(r),t.uniformMatrix2fv(this.addr,!1,Lr),Or(n,r)}}function Gr(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(Ir(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Or(n,e)}else{if(Ir(n,r))return;Dr.set(r),t.uniformMatrix3fv(this.addr,!1,Dr),Or(n,r)}}function Hr(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(Ir(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Or(n,e)}else{if(Ir(n,r))return;Pr.set(r),t.uniformMatrix4fv(this.addr,!1,Pr),Or(n,r)}}function jr(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Vr(t,e){const n=this.cache;Ir(n,e)||(t.uniform2iv(this.addr,e),Or(n,e))}function Wr(t,e){const n=this.cache;Ir(n,e)||(t.uniform3iv(this.addr,e),Or(n,e))}function Qr(t,e){const n=this.cache;Ir(n,e)||(t.uniform4iv(this.addr,e),Or(n,e))}function Yr(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Xr(t,e){const n=this.cache;Ir(n,e)||(t.uniform2uiv(this.addr,e),Or(n,e))}function Zr(t,e){const n=this.cache;Ir(n,e)||(t.uniform3uiv(this.addr,e),Or(n,e))}function Jr(t,e){const n=this.cache;Ir(n,e)||(t.uniform4uiv(this.addr,e),Or(n,e))}function Kr(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(e||Mr,i)}function $r(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||Er,i)}function ti(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||Tr,i)}function ei(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Sr,i)}function ni(t,e){t.uniform1fv(this.addr,e)}function ri(t,e){const n=Rr(e,this.size,2);t.uniform2fv(this.addr,n)}function ii(t,e){const n=Rr(e,this.size,3);t.uniform3fv(this.addr,n)}function ai(t,e){const n=Rr(e,this.size,4);t.uniform4fv(this.addr,n)}function oi(t,e){const n=Rr(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function si(t,e){const n=Rr(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Ai(t,e){const n=Rr(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function li(t,e){t.uniform1iv(this.addr,e)}function ui(t,e){t.uniform2iv(this.addr,e)}function ci(t,e){t.uniform3iv(this.addr,e)}function hi(t,e){t.uniform4iv(this.addr,e)}function fi(t,e){t.uniform1uiv(this.addr,e)}function di(t,e){t.uniform2uiv(this.addr,e)}function pi(t,e){t.uniform3uiv(this.addr,e)}function mi(t,e){t.uniform4uiv(this.addr,e)}function gi(t,e,n){const r=e.length,i=Br(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.setTexture2D(e[t]||Mr,i[t])}function vi(t,e,n){const r=e.length,i=Br(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.setTexture3D(e[t]||Er,i[t])}function xi(t,e,n){const r=e.length,i=Br(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.setTextureCube(e[t]||Tr,i[t])}function yi(t,e,n){const r=e.length,i=Br(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.setTexture2DArray(e[t]||Sr,i[t])}class _i{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return kr;case 35664:return Ur;case 35665:return zr;case 35666:return Nr;case 35674:return Fr;case 35675:return Gr;case 35676:return Hr;case 5124:case 35670:return jr;case 35667:case 35671:return Vr;case 35668:case 35672:return Wr;case 35669:case 35673:return Qr;case 5125:return Yr;case 36294:return Xr;case 36295:return Zr;case 36296:return Jr;case 35678:case 36198:case 36298:case 36306:case 35682:return Kr;case 35679:case 36299:case 36307:return $r;case 35680:case 36300:case 36308:case 36293:return ti;case 36289:case 36303:case 36311:case 36292:return ei}}(e.type)}}class bi{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 ni;case 35664:return ri;case 35665:return ii;case 35666:return ai;case 35674:return oi;case 35675:return si;case 35676:return Ai;case 5124:case 35670:return li;case 35667:case 35671:return ui;case 35668:case 35672:return ci;case 35669:case 35673:return hi;case 5125:return fi;case 36294:return di;case 36295:return pi;case 36296:return mi;case 35678:case 36198:case 36298:case 36306:case 35682:return gi;case 35679:case 36299:case 36307:return vi;case 35680:case 36300:case 36308:case 36293:return xi;case 36289:case 36303:case 36311:case 36292:return yi}}(e.type)}}class wi{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const r=this.seq;for(let i=0,a=r.length;i!==a;++i){const a=r[i];a.setValue(t,e[a.id],n)}}}const Mi=/(\w+)(\])?(\[|\.)?/g;function Si(t,e){t.seq.push(e),t.map[e.id]=e}function Ei(t,e,n){const r=t.name,i=r.length;for(Mi.lastIndex=0;;){const a=Mi.exec(r),o=Mi.lastIndex;let s=a[1];const A="]"===a[2],l=a[3];if(A&&(s|=0),void 0===l||"["===l&&o+2===i){Si(n,void 0===l?new _i(s,t,e):new bi(s,t,e));break}{let t=n.map[s];void 0===t&&(t=new wi(s),Si(n,t)),n=t}}}class Ti{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let r=0;r<n;++r){const n=t.getActiveUniform(e,r);Ei(n,t.getUniformLocation(e,n.name),this)}}setValue(t,e,n,r){const i=this.map[e];void 0!==i&&i.setValue(t,n,r)}setOptional(t,e,n){const r=e[n];void 0!==r&&this.setValue(t,n,r)}static upload(t,e,n,r){for(let i=0,a=e.length;i!==a;++i){const a=e[i],o=n[a.id];!1!==o.needsUpdate&&a.setValue(t,o.value,r)}}static seqWithValue(t,e){const n=[];for(let r=0,i=t.length;r!==i;++r){const i=t[r];i.id in e&&n.push(i)}return n}}function Ci(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}let qi=0;function Pi(t,e,n){const r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();if(r&&""===i)return"";const a=/ERROR: 0:(\d+)/.exec(i);if(a){const r=parseInt(a[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(t,e){const n=t.split("\n"),r=[],i=Math.max(e-6,0),a=Math.min(e+6,n.length);for(let t=i;t<a;t++){const i=t+1;r.push(`${i===e?">":" "} ${i}: ${n[t]}`)}return r.join("\n")}(t.getShaderSource(e),r)}return i}function Di(t,e){const n=function(t){switch(t){case I:return["Linear","( value )"];case O: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 Li(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 Ri(t){return""!==t}function Ii(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 Oi(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Bi=/^[ \t]*#include +<([\w\d./]+)>/gm;function ki(t){return t.replace(Bi,Ui)}function Ui(t,e){const n=jn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return ki(n)}const zi=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ni=/#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 Fi(t){return t.replace(Ni,Hi).replace(zi,Gi)}function Gi(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Hi(t,e,n,r)}function Hi(t,e,n,r){let i="";for(let t=parseInt(e);t<parseInt(n);t++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return i}function ji(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 Vi(t,e,n,r){const i=t.getContext(),a=n.defines;let o=n.vertexShader,s=n.fragmentShader;const A=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),l=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case f:case d:e="ENVMAP_TYPE_CUBE";break;case p:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),u=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===d&&(e="ENVMAP_MODE_REFRACTION");return e}(n),c=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),h=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}(n),m=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(Ri).join("\n")}(n),g=function(t){const e=[];for(const n in t){const r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(a),v=i.createProgram();let x,y,_=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(x=[g].filter(Ri).join("\n"),x.length>0&&(x+="\n"),y=[m,g].filter(Ri).join("\n"),y.length>0&&(y+="\n")):(x=[ji(n),"#define SHADER_NAME "+n.shaderName,g,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 "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.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 "+A:"",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(Ri).join("\n"),y=[m,ji(n),"#define SHADER_NAME "+n.shaderName,g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+c:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.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 "+A:"",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?jn.tonemapping_pars_fragment:"",0!==n.toneMapping?Li("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",jn.encodings_pars_fragment,Di("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ri).join("\n")),o=ki(o),o=Ii(o,n),o=Oi(o,n),s=ki(s),s=Ii(s,n),s=Oi(s,n),o=Fi(o),s=Fi(s),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(_="#version 300 es\n",x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,y=["#define varying in",n.glslVersion===N?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===N?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+y);const b=_+y+s,w=Ci(i,35633,_+x+o),M=Ci(i,35632,b);if(i.attachShader(v,w),i.attachShader(v,M),void 0!==n.index0AttributeName?i.bindAttribLocation(v,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(v,0,"position"),i.linkProgram(v),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(v).trim(),e=i.getShaderInfoLog(w).trim(),n=i.getShaderInfoLog(M).trim();let r=!0,a=!0;if(!1===i.getProgramParameter(v,35714)){r=!1;const e=Pi(i,w,"vertex"),n=Pi(i,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(v,35715)+"\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:r,programLog:t,vertexShader:{log:e,prefix:x},fragmentShader:{log:n,prefix:y}})}let S,E;return i.deleteShader(w),i.deleteShader(M),this.getUniforms=function(){return void 0===S&&(S=new Ti(i,v)),S},this.getAttributes=function(){return void 0===E&&(E=function(t,e){const n={},r=t.getProgramParameter(e,35721);for(let i=0;i<r;i++){const r=t.getActiveAttrib(e,i),a=r.name;let o=1;35674===r.type&&(o=2),35675===r.type&&(o=3),35676===r.type&&(o=4),n[a]={type:r.type,location:t.getAttribLocation(e,a),locationSize:o}}return n}(i,v)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(v),this.program=void 0},this.name=n.shaderName,this.id=qi++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=w,this.fragmentShader=M,this}let Wi=0;class Qi{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,r=this._getShaderStage(e),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(i)&&(a.add(i),i.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 Yi(t);e.set(t,n)}return e.get(t)}}class Yi{constructor(t){this.id=Wi++,this.code=t,this.usedTimes=0}}function Xi(t,e,n,r,i,a,o){const s=new de,A=new Qi,l=[],u=i.isWebGL2,c=i.logarithmicDepthBuffer,h=i.vertexTextures;let f=i.precision;const d={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,s,l,m,g){const v=m.fog,x=g.geometry,y=a.isMeshStandardMaterial?m.environment:null,_=(a.isMeshStandardMaterial?n:e).get(a.envMap||y),b=_&&_.mapping===p?_.image.height:null,w=d[a.type];null!==a.precision&&(f=i.getMaxPrecision(a.precision),f!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead."));const M=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,S=void 0!==M?M.length:0;let E,T,C,q,P=0;if(void 0!==x.morphAttributes.position&&(P=1),void 0!==x.morphAttributes.normal&&(P=2),void 0!==x.morphAttributes.color&&(P=3),w){const t=Wn[w];E=t.vertexShader,T=t.fragmentShader}else E=a.vertexShader,T=a.fragmentShader,A.update(a),C=A.getVertexShaderID(a),q=A.getFragmentShaderID(a);const D=t.getRenderTarget(),L=a.alphaTest>0,R=a.clearcoat>0,B=a.iridescence>0;return{isWebGL2:u,shaderID:w,shaderName:a.type,vertexShader:E,fragmentShader:T,defines:a.defines,customVertexShaderID:C,customFragmentShaderID:q,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:h,outputEncoding:null===D?t.outputEncoding:!0===D.isXRRenderTarget?D.texture.encoding:I,map:!!a.map,matcap:!!a.matcap,envMap:!!_,envMapMode:_&&_.mapping,envMapCubeUVHeight:b,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===O,clearcoat:R,clearcoatMap:R&&!!a.clearcoatMap,clearcoatRoughnessMap:R&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:R&&!!a.clearcoatNormalMap,iridescence:B,iridescenceMap:B&&!!a.iridescenceMap,iridescenceThicknessMap:B&&!!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:L,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&&!!x.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!x.attributes.color&&4===x.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:!!v,useFog:!0===a.fog,fogExp2:v&&v.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:c,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:S,morphTextureStride:P,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&l.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:u||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||r.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){s.disableAll(),e.isWebGL2&&s.enable(0);e.supportsVertexTextures&&s.enable(1);e.instancing&&s.enable(2);e.instancingColor&&s.enable(3);e.map&&s.enable(4);e.matcap&&s.enable(5);e.envMap&&s.enable(6);e.lightMap&&s.enable(7);e.aoMap&&s.enable(8);e.emissiveMap&&s.enable(9);e.bumpMap&&s.enable(10);e.normalMap&&s.enable(11);e.objectSpaceNormalMap&&s.enable(12);e.tangentSpaceNormalMap&&s.enable(13);e.clearcoat&&s.enable(14);e.clearcoatMap&&s.enable(15);e.clearcoatRoughnessMap&&s.enable(16);e.clearcoatNormalMap&&s.enable(17);e.iridescence&&s.enable(18);e.iridescenceMap&&s.enable(19);e.iridescenceThicknessMap&&s.enable(20);e.displacementMap&&s.enable(21);e.specularMap&&s.enable(22);e.roughnessMap&&s.enable(23);e.metalnessMap&&s.enable(24);e.gradientMap&&s.enable(25);e.alphaMap&&s.enable(26);e.alphaTest&&s.enable(27);e.vertexColors&&s.enable(28);e.vertexAlphas&&s.enable(29);e.vertexUvs&&s.enable(30);e.vertexTangents&&s.enable(31);e.uvsVertexOnly&&s.enable(32);e.fog&&s.enable(33);t.push(s.mask),s.disableAll(),e.useFog&&s.enable(0);e.flatShading&&s.enable(1);e.logarithmicDepthBuffer&&s.enable(2);e.skinning&&s.enable(3);e.morphTargets&&s.enable(4);e.morphNormals&&s.enable(5);e.morphColors&&s.enable(6);e.premultipliedAlpha&&s.enable(7);e.shadowMapEnabled&&s.enable(8);e.physicallyCorrectLights&&s.enable(9);e.doubleSided&&s.enable(10);e.flipSided&&s.enable(11);e.useDepthPacking&&s.enable(12);e.dithering&&s.enable(13);e.specularIntensityMap&&s.enable(14);e.specularColorMap&&s.enable(15);e.transmission&&s.enable(16);e.transmissionMap&&s.enable(17);e.thicknessMap&&s.enable(18);e.sheen&&s.enable(19);e.sheenColorMap&&s.enable(20);e.sheenRoughnessMap&&s.enable(21);e.decodeVideoTexture&&s.enable(22);e.opaque&&s.enable(23);t.push(s.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=d[t.type];let n;if(e){const t=Wn[e];n=En.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let r;for(let t=0,e=l.length;t<e;t++){const e=l[t];if(e.cacheKey===n){r=e,++r.usedTimes;break}}return void 0===r&&(r=new Vi(t,n,e,a),l.push(r)),r},releaseProgram:function(t){if(0==--t.usedTimes){const e=l.indexOf(t);l[e]=l[l.length-1],l.pop(),t.destroy()}},releaseShaderCache:function(t){A.remove(t)},programs:l,dispose:function(){A.dispose()}}}function Zi(){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,r){t.get(e)[n]=r},dispose:function(){t=new WeakMap}}}function Ji(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 Ki(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 $i(){const t=[];let e=0;const n=[],r=[],i=[];function a(n,r,i,a,o,s){let A=t[e];return void 0===A?(A={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},t[e]=A):(A.id=n.id,A.object=n,A.geometry=r,A.material=i,A.groupOrder=a,A.renderOrder=n.renderOrder,A.z=o,A.group=s),e++,A}return{opaque:n,transmissive:r,transparent:i,init:function(){e=0,n.length=0,r.length=0,i.length=0},push:function(t,e,o,s,A,l){const u=a(t,e,o,s,A,l);o.transmission>0?r.push(u):!0===o.transparent?i.push(u):n.push(u)},unshift:function(t,e,o,s,A,l){const u=a(t,e,o,s,A,l);o.transmission>0?r.unshift(u):!0===o.transparent?i.unshift(u):n.unshift(u)},finish:function(){for(let n=e,r=t.length;n<r;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||Ji),r.length>1&&r.sort(e||Ki),i.length>1&&i.sort(e||Ki)}}}function ta(){let t=new WeakMap;return{get:function(e,n){let r;return!1===t.has(e)?(r=new $i,t.set(e,[r])):n>=t.get(e).length?(r=new $i,t.get(e).push(r)):r=t.get(e)[n],r},dispose:function(){t=new WeakMap}}}function ea(){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 Et,color:new dt};break;case"SpotLight":n={position:new Et,direction:new Et,color:new dt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Et,color:new dt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Et,skyColor:new dt,groundColor:new dt};break;case"RectAreaLight":n={color:new dt,position:new Et,halfWidth:new Et,halfHeight:new Et}}return t[e.id]=n,n}}}let na=0;function ra(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function ia(t,e){const n=new ea,r=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 tt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)i.probe.push(new Et);const a=new Et,o=new re,s=new re;return{setup:function(a,o){let s=0,A=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0;a.sort(ra);const v=!0!==o?Math.PI:1;for(let t=0,e=a.length;t<e;t++){const e=a[t],o=e.color,x=e.intensity,y=e.distance,_=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=o.r*x*v,A+=o.g*x*v,l+=o.b*x*v;else if(e.isLightProbe)for(let t=0;t<9;t++)i.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=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.directionalShadow[u]=n,i.directionalShadowMap[u]=_,i.directionalShadowMatrix[u]=e.shadow.matrix,p++}i.directional[u]=t,u++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(o).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=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.spotShadow[h]=n,i.spotShadowMap[h]=_,i.spotShadowMatrix[h]=e.shadow.matrix,g++}i.spot[h]=t,h++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(o).multiplyScalar(x),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),i.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=r.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,i.pointShadow[c]=n,i.pointShadowMap[c]=_,i.pointShadowMatrix[c]=e.shadow.matrix,m++}i.point[c]=t,c++}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),i.hemi[d]=t,d++}}f>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=Vn.LTC_FLOAT_1,i.rectAreaLTC2=Vn.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=Vn.LTC_HALF_1,i.rectAreaLTC2=Vn.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=s,i.ambient[1]=A,i.ambient[2]=l;const x=i.hash;x.directionalLength===u&&x.pointLength===c&&x.spotLength===h&&x.rectAreaLength===f&&x.hemiLength===d&&x.numDirectionalShadows===p&&x.numPointShadows===m&&x.numSpotShadows===g||(i.directional.length=u,i.spot.length=h,i.rectArea.length=f,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=m,i.pointShadowMap.length=m,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=m,i.spotShadowMatrix.length=g,x.directionalLength=u,x.pointLength=c,x.spotLength=h,x.rectAreaLength=f,x.hemiLength=d,x.numDirectionalShadows=p,x.numPointShadows=m,x.numSpotShadows=g,i.version=na++)},setupView:function(t,e){let n=0,r=0,A=0,l=0,u=0;const c=e.matrixWorldInverse;for(let e=0,h=t.length;e<h;e++){const h=t[e];if(h.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(h.matrixWorld),a.setFromMatrixPosition(h.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(c),n++}else if(h.isSpotLight){const t=i.spot[A];t.position.setFromMatrixPosition(h.matrixWorld),t.position.applyMatrix4(c),t.direction.setFromMatrixPosition(h.matrixWorld),a.setFromMatrixPosition(h.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(c),A++}else if(h.isRectAreaLight){const t=i.rectArea[l];t.position.setFromMatrixPosition(h.matrixWorld),t.position.applyMatrix4(c),s.identity(),o.copy(h.matrixWorld),o.premultiply(c),s.extractRotation(o),t.halfWidth.set(.5*h.width,0,0),t.halfHeight.set(0,.5*h.height,0),t.halfWidth.applyMatrix4(s),t.halfHeight.applyMatrix4(s),l++}else if(h.isPointLight){const t=i.point[r];t.position.setFromMatrixPosition(h.matrixWorld),t.position.applyMatrix4(c),r++}else if(h.isHemisphereLight){const t=i.hemi[u];t.direction.setFromMatrixPosition(h.matrixWorld),t.direction.transformDirection(c),u++}}},state:i}}function aa(t,e){const n=new ia(t,e),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(t){n.setup(r,t)},setupLightsView:function(t){n.setupView(r,t)},pushLight:function(t){r.push(t)},pushShadow:function(t){i.push(t)}}}function oa(t,e){let n=new WeakMap;return{get:function(r,i=0){let a;return!1===n.has(r)?(a=new aa(t,e),n.set(r,[a])):i>=n.get(r).length?(a=new aa(t,e),n.get(r).push(a)):a=n.get(r)[i],a},dispose:function(){n=new WeakMap}}}class sa extends Fe{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 Aa extends Fe{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Et,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 la(t,e,n){let r=new Nn;const i=new tt,a=new tt,o=new _t,s=new sa({depthPacking:3201}),A=new Aa,l={},u=n.maxTextureSize,c={0:1,1:0,2:2},h=new Tn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new tt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const d=new nn;d.setAttribute("position",new Ve(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const p=new _n(d,h),m=this;function g(n,r){const a=e.update(p);h.defines.VSM_SAMPLES!==n.blurSamples&&(h.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new bt(i.x,i.y)),h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,a,h,p,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(r,null,a,f,p,null)}function v(e,n,r,i,a,o){let u=null;const h=!0===r.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(u=void 0!==h?h:!0===r.isPointLight?A:s,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=u.uuid,e=n.uuid;let r=l[t];void 0===r&&(r={},l[t]=r);let i=r[e];void 0===i&&(i=u.clone(),r[e]=i),u=i}return u.visible=n.visible,u.wireframe=n.wireframe,u.side=3===o?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:c[n.side],u.alphaMap=n.alphaMap,u.alphaTest=n.alphaTest,u.clipShadows=n.clipShadows,u.clippingPlanes=n.clippingPlanes,u.clipIntersection=n.clipIntersection,u.displacementMap=n.displacementMap,u.displacementScale=n.displacementScale,u.displacementBias=n.displacementBias,u.wireframeLinewidth=n.wireframeLinewidth,u.linewidth=n.linewidth,!0===r.isPointLight&&!0===u.isMeshDistanceMaterial&&(u.referencePosition.setFromMatrixPosition(r.matrixWorld),u.nearDistance=i,u.farDistance=a),u}function y(n,i,a,o,s){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let A=0,l=e.length;A<l;A++){const l=e[A],u=i[l.materialIndex];if(u&&u.visible){const e=v(n,u,o,a.near,a.far,s);t.renderBufferDirect(a,null,r,e,n,l)}}}else if(i.visible){const e=v(n,i,o,a.near,a.far,s);t.renderBufferDirect(a,null,r,e,n,null)}}const A=n.children;for(let t=0,e=A.length;t<e;t++)y(A[t],i,a,o,s)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,s){if(!1===m.enabled)return;if(!1===m.autoUpdate&&!1===m.needsUpdate)return;if(0===e.length)return;const A=t.getRenderTarget(),l=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),h=t.state;h.setBlending(0),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(let A=0,l=e.length;A<l;A++){const l=e[A],c=l.shadow;if(void 0===c){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;i.copy(c.mapSize);const f=c.getFrameExtents();if(i.multiply(f),a.copy(c.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/f.x),i.x=a.x*f.x,c.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/f.y),i.y=a.y*f.y,c.mapSize.y=a.y)),null===c.map){const t=3!==this.type?{minFilter:x,magFilter:x}:{};c.map=new bt(i.x,i.y,t),c.map.texture.name=l.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const d=c.getViewportCount();for(let t=0;t<d;t++){const e=c.getViewport(t);o.set(a.x*e.x,a.y*e.y,a.x*e.z,a.y*e.w),h.viewport(o),c.updateMatrices(l,t),r=c.getFrustum(),y(n,s,c.camera,l,this.type)}!0!==c.isPointLightShadow&&3===this.type&&g(c,s),c.needsUpdate=!1}m.needsUpdate=!1,t.setRenderTarget(A,l,c)}}function ua(t,e,n){const r=n.isWebGL2;const i=new function(){let e=!1;const n=new _t;let r=null;const i=new _t(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,a,o,s){!0===s&&(e*=o,r*=o,a*=o),n.set(e,r,a,o),!1===i.equals(n)&&(t.clearColor(e,r,a,o),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},a=new function(){let e=!1,n=null,r=null,i=null;return{setTest:function(t){t?F(2929):G(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},o=new function(){let e=!1,n=null,r=null,i=null,a=null,o=null,s=null,A=null,l=null;return{setTest:function(t){e||(t?F(2960):G(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,o){r===e&&i===n&&a===o||(t.stencilFunc(e,n,o),r=e,i=n,a=o)},setOp:function(e,n,r){o===e&&s===n&&A===r||(t.stencilOp(e,n,r),o=e,s=n,A=r)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,n=null,r=null,i=null,a=null,o=null,s=null,A=null,l=null}}},s=new WeakMap,A=new WeakMap;let l={},u={},c=new WeakMap,f=[],d=null,p=!1,m=null,g=null,v=null,x=null,y=null,_=null,b=null,w=!1,M=null,S=null,E=null,T=null,C=null;const q=t.getParameter(35661);let P=!1,D=0;const L=t.getParameter(7938);-1!==L.indexOf("WebGL")?(D=parseFloat(/^WebGL (\d)/.exec(L)[1]),P=D>=1):-1!==L.indexOf("OpenGL ES")&&(D=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),P=D>=2);let R=null,I={};const O=t.getParameter(3088),B=t.getParameter(2978),k=(new _t).fromArray(O),U=(new _t).fromArray(B);function z(e,n,r){const i=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<r;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,i);return a}const N={};function F(e){!0!==l[e]&&(t.enable(e),l[e]=!0)}function G(e){!1!==l[e]&&(t.disable(e),l[e]=!1)}N[3553]=z(3553,3553,1),N[34067]=z(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),o.setClear(0),F(2929),a.setFunc(3),W(!1),Q(1),F(2884),V(0);const H={[h]:32774,101:32778,102:32779};if(r)H[103]=32775,H[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(H[103]=t.MIN_EXT,H[104]=t.MAX_EXT)}const j={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function V(e,n,r,i,a,o,s,A){if(0!==e){if(!1===p&&(F(3042),p=!0),5===e)a=a||n,o=o||r,s=s||i,n===g&&a===y||(t.blendEquationSeparate(H[n],H[a]),g=n,y=a),r===v&&i===x&&o===_&&s===b||(t.blendFuncSeparate(j[r],j[i],j[o],j[s]),v=r,x=i,_=o,b=s),m=e,w=null;else if(e!==m||A!==w){if(g===h&&y===h||(t.blendEquation(32774),g=h,y=h),A)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}v=null,x=null,_=null,b=null,m=e,w=A}}else!0===p&&(G(3042),p=!1)}function W(e){M!==e&&(e?t.frontFace(2304):t.frontFace(2305),M=e)}function Q(e){0!==e?(F(2884),e!==S&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):G(2884),S=e}function Y(e,n,r){e?(F(32823),T===n&&C===r||(t.polygonOffset(n,r),T=n,C=r)):G(32823)}function X(e){void 0===e&&(e=33984+q-1),R!==e&&(t.activeTexture(e),R=e)}return{buffers:{color:i,depth:a,stencil:o},enable:F,disable:G,bindFramebuffer:function(e,n){return u[e]!==n&&(t.bindFramebuffer(e,n),u[e]=n,r&&(36009===e&&(u[36160]=n),36160===e&&(u[36009]=n)),!0)},drawBuffers:function(r,i){let a=f,o=!1;if(r)if(a=c.get(i),void 0===a&&(a=[],c.set(i,a)),r.isWebGLMultipleRenderTargets){const t=r.texture;if(a.length!==t.length||36064!==a[0]){for(let e=0,n=t.length;e<n;e++)a[e]=36064+e;a.length=t.length,o=!0}}else 36064!==a[0]&&(a[0]=36064,o=!0);else 1029!==a[0]&&(a[0]=1029,o=!0);o&&(n.isWebGL2?t.drawBuffers(a):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(e){return d!==e&&(t.useProgram(e),d=e,!0)},setBlending:V,setMaterial:function(t,e){2===t.side?G(2884):F(2884);let n=1===t.side;e&&(n=!n),W(n),1===t.blending&&!1===t.transparent?V(0):V(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),i.setMask(t.colorWrite);const r=t.stencilWrite;o.setTest(r),r&&(o.setMask(t.stencilWriteMask),o.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),o.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Y(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?F(32926):G(32926)},setFlipSided:W,setCullFace:Q,setLineWidth:function(e){e!==E&&(P&&t.lineWidth(e),E=e)},setPolygonOffset:Y,setScissorTest:function(t){t?F(3089):G(3089)},activeTexture:X,bindTexture:function(e,n){null===R&&X();let r=I[R];void 0===r&&(r={type:void 0,texture:void 0},I[R]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||N[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=I[R];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 r=A.get(n);void 0===r&&(r=new WeakMap,A.set(n,r));let i=r.get(e);void 0===i&&(i=t.getUniformBlockIndex(n,e.name),r.set(e,i))},uniformBlockBinding:function(e,n){const r=A.get(n).get(e);s.get(e)!==r&&(t.uniformBlockBinding(n,r,e.__bindingPointIndex),s.set(e,r))},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===k.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),k.copy(e))},viewport:function(e){!1===U.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),U.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===r&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,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),l={},R=null,I={},u={},c=new WeakMap,f=[],d=null,p=!1,m=null,g=null,v=null,x=null,y=null,_=null,b=null,w=!1,M=null,S=null,E=null,T=null,C=null,k.set(0,0,t.canvas.width,t.canvas.height),U.set(0,0,t.canvas.width,t.canvas.height),i.reset(),a.reset(),o.reset()}}}function ca(t,e,n,r,i,a,o){const s=i.isWebGL2,A=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,c=i.maxSamples,h=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,f=/OculusBrowser/g.test(navigator.userAgent),d=new WeakMap;let p;const P=new WeakMap;let D=!1;try{D="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function L(t,e){return D?new OffscreenCanvas(t,e):rt("canvas")}function R(t,e,n,r){let i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?K:Math.floor,a=r(i*t.width),o=r(i*t.height);void 0===p&&(p=L(a,o));const s=n?L(a,o):p;s.width=a,s.height=o;return s.getContext("2d").drawImage(t,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+o+")."),s}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 J(t.width)&&J(t.height)}function k(t,e){return t.generateMipmaps&&e&&t.minFilter!==x&&t.minFilter!==y}function U(e){t.generateMipmap(e)}function z(n,r,i,a,o=!1){if(!1===s)return r;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 A=r;return 6403===r&&(5126===i&&(A=33326),5131===i&&(A=33325),5121===i&&(A=33321)),33319===r&&(5126===i&&(A=33328),5131===i&&(A=33327),5121===i&&(A=33323)),6408===r&&(5126===i&&(A=34836),5131===i&&(A=34842),5121===i&&(A=a===O&&!1===o?35907:32856),32819===i&&(A=32854),32820===i&&(A=32855)),33325!==A&&33326!==A&&33327!==A&&33328!==A&&34842!==A&&34836!==A||e.get("EXT_color_buffer_float"),A}function N(t,e,n){return!0===k(t,n)||t.isFramebufferTexture&&t.minFilter!==x&&t.minFilter!==y?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 G(t){return t===x||1004===t||1005===t?9728:9729}function H(t){const e=t.target;e.removeEventListener("dispose",H),function(t){const e=r.get(t);if(void 0===e.__webglInit)return;const n=t.source,i=P.get(n);if(i){const r=i[e.__cacheKey];r.usedTimes--,0===r.usedTimes&&V(t),0===Object.keys(i).length&&P.delete(n)}r.remove(t)}(e),e.isVideoTexture&&d.delete(e)}function j(e){const n=e.target;n.removeEventListener("dispose",j),function(e){const n=e.texture,i=r.get(e),a=r.get(n);void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),o.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e]);else{if(t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let e=0;e<i.__webglColorRenderbuffer.length;e++)i.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(i.__webglColorRenderbuffer[e]);i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer)}if(e.isWebGLMultipleRenderTargets)for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),o.memory.textures--),r.remove(n[e])}r.remove(n),r.remove(e)}(n)}function V(e){const n=r.get(e);t.deleteTexture(n.__webglTexture);const i=e.source;delete P.get(i)[n.__cacheKey],o.memory.textures--}let W=0;function Q(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=o.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&i.__version!==t.version){const n=t.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void tt(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}const Y={[m]:10497,[g]:33071,[v]:33648},X={[x]:9728,1004:9984,1005:9986,[y]:9729,1007:9985,[_]:9987};function Z(n,a,o){if(o?(t.texParameteri(n,10242,Y[a.wrapS]),t.texParameteri(n,10243,Y[a.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,Y[a.wrapR]),t.texParameteri(n,10240,X[a.magFilter]),t.texParameteri(n,10241,X[a.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),a.wrapS===g&&a.wrapT===g||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,G(a.magFilter)),t.texParameteri(n,10241,G(a.minFilter)),a.minFilter!==x&&a.minFilter!==y&&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 o=e.get("EXT_texture_filter_anisotropic");if(a.type===M&&!1===e.has("OES_texture_float_linear"))return;if(!1===s&&a.type===S&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function $(e,n){let r=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",H));const i=n.source;let a=P.get(i);void 0===a&&(a={},P.set(i,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},o.memory.textures++,r=!0),a[s].usedTimes++;const i=a[e.__cacheKey];void 0!==i&&(a[e.__cacheKey].usedTimes--,0===i.usedTimes&&V(n)),e.__cacheKey=s,e.__webglTexture=a[s].texture}return r}function tt(e,r,i){let o=3553;r.isDataArrayTexture&&(o=35866),r.isData3DTexture&&(o=32879);const A=$(e,r),l=r.source;if(n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),l.version!==l.__currentVersion||!0===A){t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const e=function(t){return!s&&(t.wrapS!==g||t.wrapT!==g||t.minFilter!==x&&t.minFilter!==y)}(r)&&!1===B(r.image);let i=R(r.image,e,!1,u);i=st(r,i);const c=B(i)||s,h=a.convert(r.format,r.encoding);let f,d=a.convert(r.type),p=z(r.internalFormat,h,d,r.encoding,r.isVideoTexture);Z(o,r,c);const m=r.mipmaps,v=s&&!0!==r.isVideoTexture,_=void 0===l.__currentVersion||!0===A,b=N(r,i,c);if(r.isDepthTexture)p=6402,s?p=r.type===M?36012:r.type===w?33190:r.type===E?35056:33189:r.type===M&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===C&&6402===p&&1012!==r.type&&r.type!==w&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=w,d=a.convert(r.type)),r.format===q&&6402===p&&(p=34041,r.type!==E&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=E,d=a.convert(r.type))),_&&(v?n.texStorage2D(3553,1,p,i.width,i.height):n.texImage2D(3553,0,p,i.width,i.height,0,h,d,null));else if(r.isDataTexture)if(m.length>0&&c){v&&_&&n.texStorage2D(3553,b,p,m[0].width,m[0].height);for(let t=0,e=m.length;t<e;t++)f=m[t],v?n.texSubImage2D(3553,t,0,0,f.width,f.height,h,d,f.data):n.texImage2D(3553,t,p,f.width,f.height,0,h,d,f.data);r.generateMipmaps=!1}else v?(_&&n.texStorage2D(3553,b,p,i.width,i.height),n.texSubImage2D(3553,0,0,0,i.width,i.height,h,d,i.data)):n.texImage2D(3553,0,p,i.width,i.height,0,h,d,i.data);else if(r.isCompressedTexture){v&&_&&n.texStorage2D(3553,b,p,m[0].width,m[0].height);for(let t=0,e=m.length;t<e;t++)f=m[t],r.format!==T?null!==h?v?n.compressedTexSubImage2D(3553,t,0,0,f.width,f.height,h,f.data):n.compressedTexImage2D(3553,t,p,f.width,f.height,0,f.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):v?n.texSubImage2D(3553,t,0,0,f.width,f.height,h,d,f.data):n.texImage2D(3553,t,p,f.width,f.height,0,h,d,f.data)}else if(r.isDataArrayTexture)v?(_&&n.texStorage3D(35866,b,p,i.width,i.height,i.depth),n.texSubImage3D(35866,0,0,0,0,i.width,i.height,i.depth,h,d,i.data)):n.texImage3D(35866,0,p,i.width,i.height,i.depth,0,h,d,i.data);else if(r.isData3DTexture)v?(_&&n.texStorage3D(32879,b,p,i.width,i.height,i.depth),n.texSubImage3D(32879,0,0,0,0,i.width,i.height,i.depth,h,d,i.data)):n.texImage3D(32879,0,p,i.width,i.height,i.depth,0,h,d,i.data);else if(r.isFramebufferTexture){if(_)if(v)n.texStorage2D(3553,b,p,i.width,i.height);else{let t=i.width,e=i.height;for(let r=0;r<b;r++)n.texImage2D(3553,r,p,t,e,0,h,d,null),t>>=1,e>>=1}}else if(m.length>0&&c){v&&_&&n.texStorage2D(3553,b,p,m[0].width,m[0].height);for(let t=0,e=m.length;t<e;t++)f=m[t],v?n.texSubImage2D(3553,t,0,0,h,d,f):n.texImage2D(3553,t,p,h,d,f);r.generateMipmaps=!1}else v?(_&&n.texStorage2D(3553,b,p,i.width,i.height),n.texSubImage2D(3553,0,0,0,h,d,i)):n.texImage2D(3553,0,p,h,d,i);k(r,c)&&U(o),l.__currentVersion=l.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}function et(e,i,o,s,A){const l=a.convert(o.format,o.encoding),u=a.convert(o.type),c=z(o.internalFormat,l,u,o.encoding);r.get(i).__hasExternalTextures||(32879===A||35866===A?n.texImage3D(A,0,c,i.width,i.height,i.depth,0,l,u,null):n.texImage2D(A,0,c,i.width,i.height,0,l,u,null)),n.bindFramebuffer(36160,e),ot(i)?h.framebufferTexture2DMultisampleEXT(36160,s,A,r.get(o).__webglTexture,0,at(i)):t.framebufferTexture2D(36160,s,A,r.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function nt(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r||ot(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===M?i=36012:e.type===w&&(i=33190));const r=at(n);ot(n)?h.renderbufferStorageMultisampleEXT(36161,r,i,n.width,n.height):t.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){const i=at(n);r&&!1===ot(n)?t.renderbufferStorageMultisample(36161,i,35056,n.width,n.height):ot(n)?h.renderbufferStorageMultisampleEXT(36161,i,35056,n.width,n.height):t.renderbufferStorage(36161,34041,n.width,n.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let i=0;i<e.length;i++){const o=e[i],s=a.convert(o.format,o.encoding),A=a.convert(o.type),l=z(o.internalFormat,s,A,o.encoding),u=at(n);r&&!1===ot(n)?t.renderbufferStorageMultisample(36161,u,l,n.width,n.height):ot(n)?h.renderbufferStorageMultisampleEXT(36161,u,l,n.width,n.height):t.renderbufferStorage(36161,l,n.width,n.height)}}t.bindRenderbuffer(36161,null)}function it(e){const i=r.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),Q(i.depthTexture,0);const a=r.get(i.depthTexture).__webglTexture,o=at(i);if(i.depthTexture.format===C)ot(i)?h.framebufferTexture2DMultisampleEXT(36160,36096,3553,a,0,o):t.framebufferTexture2D(36160,36096,3553,a,0);else{if(i.depthTexture.format!==q)throw new Error("Unknown depthTexture format");ot(i)?h.framebufferTexture2DMultisampleEXT(36160,33306,3553,a,0,o):t.framebufferTexture2D(36160,33306,3553,a,0)}}(i.__webglFramebuffer,e)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)n.bindFramebuffer(36160,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]=t.createRenderbuffer(),nt(i.__webglDepthbuffer[r],e,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),nt(i.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function at(t){return Math.min(c,t.samples)}function ot(t){const n=r.get(t);return s&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function st(t,n){const r=t.encoding,i=t.format,a=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===F||r!==I&&(r===O?!1===s?!0===e.has("EXT_sRGB")&&i===T?(t.format=F,t.minFilter=y,t.generateMipmaps=!1):n=mt.sRGBToLinear(n):i===T&&a===b||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),n}this.allocateTextureUnit=function(){const t=W;return t>=A&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+A),W+=1,t},this.resetTextureUnits=function(){W=0},this.setTexture2D=Q,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?tt(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?tt(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=function(e,i){const o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;const o=$(e,r),A=r.source;if(n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),A.version!==A.__currentVersion||!0===o){t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const e=r.isCompressedTexture||r.image[0].isCompressedTexture,i=r.image[0]&&r.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=e||i?i?r.image[t].image:r.image[t]:R(r.image[t],!1,!0,l),u[t]=st(r,u[t]);const c=u[0],h=B(c)||s,f=a.convert(r.format,r.encoding),d=a.convert(r.type),p=z(r.internalFormat,f,d,r.encoding),m=s&&!0!==r.isVideoTexture,g=void 0===A.__currentVersion||!0===o;let v,x=N(r,c,h);if(Z(34067,r,h),e){m&&g&&n.texStorage2D(34067,x,p,c.width,c.height);for(let t=0;t<6;t++){v=u[t].mipmaps;for(let e=0;e<v.length;e++){const i=v[e];r.format!==T?null!==f?m?n.compressedTexSubImage2D(34069+t,e,0,0,i.width,i.height,f,i.data):n.compressedTexImage2D(34069+t,e,p,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):m?n.texSubImage2D(34069+t,e,0,0,i.width,i.height,f,d,i.data):n.texImage2D(34069+t,e,p,i.width,i.height,0,f,d,i.data)}}}else{v=r.mipmaps,m&&g&&(v.length>0&&x++,n.texStorage2D(34067,x,p,u[0].width,u[0].height));for(let t=0;t<6;t++)if(i){m?n.texSubImage2D(34069+t,0,0,0,u[t].width,u[t].height,f,d,u[t].data):n.texImage2D(34069+t,0,p,u[t].width,u[t].height,0,f,d,u[t].data);for(let e=0;e<v.length;e++){const r=v[e].image[t].image;m?n.texSubImage2D(34069+t,e+1,0,0,r.width,r.height,f,d,r.data):n.texImage2D(34069+t,e+1,p,r.width,r.height,0,f,d,r.data)}}else{m?n.texSubImage2D(34069+t,0,0,0,f,d,u[t]):n.texImage2D(34069+t,0,p,f,d,u[t]);for(let e=0;e<v.length;e++){const r=v[e];m?n.texSubImage2D(34069+t,e+1,0,0,f,d,r.image[t]):n.texImage2D(34069+t,e+1,p,f,d,r.image[t])}}}k(r,h)&&U(34067),A.__currentVersion=A.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}(o,e,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(t,e,n){const i=r.get(t);void 0!==e&&et(i.__webglFramebuffer,t,t.texture,36064,3553),void 0!==n&&it(t)},this.setupRenderTarget=function(e){const A=e.texture,l=r.get(e),u=r.get(A);e.addEventListener("dispose",j),!0!==e.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=t.createTexture()),u.__version=A.version,o.memory.textures++);const c=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultipleRenderTargets,f=B(e)||s;if(c){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else{if(l.__webglFramebuffer=t.createFramebuffer(),h)if(i.drawBuffers){const n=e.texture;for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);void 0===i.__webglTexture&&(i.__webglTexture=t.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(s&&e.samples>0&&!1===ot(e)){const r=h?A:[A];l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer);for(let n=0;n<r.length;n++){const i=r[n];l.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer[n]);const o=a.convert(i.format,i.encoding),s=a.convert(i.type),A=z(i.internalFormat,o,s,i.encoding),u=at(e);t.renderbufferStorageMultisample(36161,u,A,e.width,e.height),t.framebufferRenderbuffer(36160,36064+n,36161,l.__webglColorRenderbuffer[n])}t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),nt(l.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}}if(c){n.bindTexture(34067,u.__webglTexture),Z(34067,A,f);for(let t=0;t<6;t++)et(l.__webglFramebuffer[t],e,A,36064,34069+t);k(A,f)&&U(34067),n.unbindTexture()}else if(h){const t=e.texture;for(let i=0,a=t.length;i<a;i++){const a=t[i],o=r.get(a);n.bindTexture(3553,o.__webglTexture),Z(3553,a,f),et(l.__webglFramebuffer,e,a,36064+i,3553),k(a,f)&&U(3553)}n.unbindTexture()}else{let t=3553;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(s?t=e.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(t,u.__webglTexture),Z(t,A,f),et(l.__webglFramebuffer,e,A,36064,t),k(A,f)&&U(t),n.unbindTexture()}e.depthBuffer&&it(e)},this.updateRenderTargetMipmap=function(t){const e=B(t)||s,i=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let a=0,o=i.length;a<o;a++){const o=i[a];if(k(o,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,i=r.get(o).__webglTexture;n.bindTexture(e,i),U(e),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(s&&e.samples>0&&!1===ot(e)){const i=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=e.width,o=e.height;let s=16384;const A=[],l=e.stencilBuffer?33306:36096,u=r.get(e),c=!0===e.isWebGLMultipleRenderTargets;if(c)for(let e=0;e<i.length;e++)n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,null),n.bindFramebuffer(36160,u.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,null,0);n.bindFramebuffer(36008,u.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,u.__webglFramebuffer);for(let n=0;n<i.length;n++){A.push(36064+n),e.depthBuffer&&A.push(l);const h=void 0!==u.__ignoreDepthValues&&u.__ignoreDepthValues;if(!1===h&&(e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024)),c&&t.framebufferRenderbuffer(36008,36064,36161,u.__webglColorRenderbuffer[n]),!0===h&&(t.invalidateFramebuffer(36008,[l]),t.invalidateFramebuffer(36009,[l])),c){const e=r.get(i[n]).__webglTexture;t.framebufferTexture2D(36009,36064,3553,e,0)}t.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728),f&&t.invalidateFramebuffer(36008,A)}if(n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,null),c)for(let e=0;e<i.length;e++){n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,u.__webglColorRenderbuffer[e]);const a=r.get(i[e]).__webglTexture;n.bindFramebuffer(36160,u.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,a,0)}n.bindFramebuffer(36009,u.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=it,this.setupFrameBufferTexture=et,this.useMultisampledRTT=ot}function ha(t,e,n){const r=n.isWebGL2;return{convert:function(n,i=null){let a;if(n===b)return 5121;if(1017===n)return 32819;if(1018===n)return 32820;if(1010===n)return 5120;if(1011===n)return 5122;if(1012===n)return 5123;if(1013===n)return 5124;if(n===w)return 5125;if(n===M)return 5126;if(n===S)return r?5131:(a=e.get("OES_texture_half_float"),null!==a?a.HALF_FLOAT_OES:null);if(1021===n)return 6406;if(n===T)return 6408;if(1024===n)return 6409;if(1025===n)return 6410;if(n===C)return 6402;if(n===q)return 34041;if(1028===n)return 6403;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"),6408;if(n===F)return a=e.get("EXT_sRGB"),null!==a?a.SRGB_ALPHA_EXT:null;if(1029===n)return 36244;if(1030===n)return 33319;if(1031===n)return 33320;if(1033===n)return 36249;if(n===P||n===D||n===L||n===R)if(i===O){if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===a)return null;if(n===P)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===D)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===L)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===R)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(a=e.get("WEBGL_compressed_texture_s3tc"),null===a)return null;if(n===P)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===D)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===L)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===R)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 i===O?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===n)return i===O?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 i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return i===O?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 i===O?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===E?r?34042:(a=e.get("WEBGL_depth_texture"),null!==a?a.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[n]?t[n]:null}}}class fa extends qn{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class da extends Ce{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pa={type:"move"};class ma{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new da,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 da,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Et,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Et),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new da,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Et,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Et),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 r=null,i=null,a=null;const o=this._targetRay,s=this._grip,A=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(A&&t.hand){a=!0;for(const r of t.hand.values()){const t=e.getJointPose(r,n);if(void 0===A.joints[r.jointName]){const t=new da;t.matrixAutoUpdate=!1,t.visible=!1,A.joints[r.jointName]=t,A.add(t)}const i=A.joints[r.jointName];null!==t&&(i.matrix.fromArray(t.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=t.radius),i.visible=null!==t}const r=A.joints["index-finger-tip"],i=A.joints["thumb-tip"],o=r.position.distanceTo(i.position),s=.02,l=.005;A.inputState.pinching&&o>s+l?(A.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!A.inputState.pinching&&o<=s-l&&(A.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==s&&t.gripSpace&&(i=e.getPose(t.gripSpace,n),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));null!==o&&(r=e.getPose(t.targetRaySpace,n),null===r&&null!==i&&(r=i),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,this.dispatchEvent(pa)))}return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==A&&(A.visible=null!==a),this}}class ga extends yt{constructor(t,e,n,r,i,a,o,s,A,l){if((l=void 0!==l?l:C)!==C&&l!==q)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===C&&(n=w),void 0===n&&l===q&&(n=E),super(null,r,i,a,o,s,l,n,A),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==o?o:x,this.minFilter=void 0!==s?s:x,this.flipY=!1,this.generateMipmaps=!1}}class va extends G{constructor(t,e){super();const n=this;let r=null,i=1,a=null,o="local-floor",s=null,A=null,l=null,u=null,c=null,h=null;const f=e.getContextAttributes();let d=null,p=null;const m=[],g=[],v=new qn;v.layers.enable(1),v.viewport=new _t;const x=new qn;x.layers.enable(2),x.viewport=new _t;const y=[v,x],_=new fa;_.layers.enable(1),_.layers.enable(2);let M=null,S=null;function P(t){const e=g.indexOf(t.inputSource);if(-1===e)return;const n=m[e];void 0!==n&&n.dispatchEvent({type:t.type,data:t.inputSource})}function D(){r.removeEventListener("select",P),r.removeEventListener("selectstart",P),r.removeEventListener("selectend",P),r.removeEventListener("squeeze",P),r.removeEventListener("squeezestart",P),r.removeEventListener("squeezeend",P),r.removeEventListener("end",D),r.removeEventListener("inputsourceschange",L);for(let t=0;t<m.length;t++){const e=g[t];null!==e&&(g[t]=null,m[t].disconnect(e))}M=null,S=null,t.setRenderTarget(d),c=null,u=null,l=null,r=null,p=null,k.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function L(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],r=g.indexOf(n);r>=0&&(g[r]=null,m[r].dispatchEvent({type:"disconnected",data:n}))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let r=g.indexOf(n);if(-1===r){for(let t=0;t<m.length;t++){if(t>=g.length){g.push(n),r=t;break}if(null===g[t]){g[t]=n,r=t;break}}if(-1===r)break}const i=m[r];i&&i.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=m[t];return void 0===e&&(e=new ma,m[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=m[t];return void 0===e&&(e=new ma,m[t]=e),e.getGripSpace()},this.getHand=function(t){let e=m[t];return void 0===e&&(e=new ma,m[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){i=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s||a},this.setReferenceSpace=function(t){s=t},this.getBaseLayer=function(){return null!==u?u:c},this.getBinding=function(){return l},this.getFrame=function(){return h},this.getSession=function(){return r},this.setSession=async function(A){if(r=A,null!==r){if(d=t.getRenderTarget(),r.addEventListener("select",P),r.addEventListener("selectstart",P),r.addEventListener("selectend",P),r.addEventListener("squeeze",P),r.addEventListener("squeezestart",P),r.addEventListener("squeezeend",P),r.addEventListener("end",D),r.addEventListener("inputsourceschange",L),!0!==f.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==r.renderState.layers||f.antialias,alpha:f.alpha,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:i};c=new XRWebGLLayer(r,e,n),r.updateRenderState({baseLayer:c}),p=new bt(c.framebufferWidth,c.framebufferHeight,{format:T,type:b,encoding:t.outputEncoding})}else{let n=null,a=null,o=null;f.depth&&(o=f.stencil?35056:33190,n=f.stencil?q:C,a=f.stencil?E:w);const s={colorFormat:32856,depthFormat:o,scaleFactor:i};l=new XRWebGLBinding(r,e),u=l.createProjectionLayer(s),r.updateRenderState({layers:[u]}),p=new bt(u.textureWidth,u.textureHeight,{format:T,type:b,depthTexture:new ga(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:f.stencil,encoding:t.outputEncoding,samples:f.antialias?4:0});t.properties.get(p).__ignoreDepthValues=u.ignoreDepthValues}p.isXRRenderTarget=!0,this.setFoveation(1),s=null,a=await r.requestReferenceSpace(o),k.setContext(r),k.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const R=new Et,I=new Et;function O(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===r)return;_.near=x.near=v.near=t.near,_.far=x.far=v.far=t.far,M===_.near&&S===_.far||(r.updateRenderState({depthNear:_.near,depthFar:_.far}),M=_.near,S=_.far);const e=t.parent,n=_.cameras;O(_,e);for(let t=0;t<n.length;t++)O(n[t],e);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),t.position.copy(_.position),t.quaternion.copy(_.quaternion),t.scale.copy(_.scale),t.matrix.copy(_.matrix),t.matrixWorld.copy(_.matrixWorld);const i=t.children;for(let t=0,e=i.length;t<e;t++)i[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){R.setFromMatrixPosition(e.matrixWorld),I.setFromMatrixPosition(n.matrixWorld);const r=R.distanceTo(I),i=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),A=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],c=(a[8]+1)/a[0],h=o*u,f=o*c,d=r/(-u+c),p=d*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(p),t.translateZ(d),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const m=o+d,g=s+d,v=h-p,x=f+(r-p),y=A*s/g*m,_=l*s/g*m;t.projectionMatrix.makePerspective(v,x,y,_,m,g)}(_,v,x):_.projectionMatrix.copy(v.projectionMatrix)},this.getCamera=function(){return _},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==c?c.fixedFoveation:void 0},this.setFoveation=function(t){null!==u&&(u.fixedFoveation=t),null!==c&&void 0!==c.fixedFoveation&&(c.fixedFoveation=t)};let B=null;const k=new Fn;k.setAnimationLoop((function(e,n){if(A=n.getViewerPose(s||a),h=n,null!==A){const e=A.views;null!==c&&(t.setRenderTargetFramebuffer(p,c.framebuffer),t.setRenderTarget(p));let n=!1;e.length!==_.cameras.length&&(_.cameras.length=0,n=!0);for(let r=0;r<e.length;r++){const i=e[r];let a=null;if(null!==c)a=c.getViewport(i);else{const e=l.getViewSubImage(u,i);a=e.viewport,0===r&&(t.setRenderTargetTextures(p,e.colorTexture,u.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(p))}let o=y[r];void 0===o&&(o=new qn,o.layers.enable(r),o.viewport=new _t,y[r]=o),o.matrix.fromArray(i.transform.matrix),o.projectionMatrix.fromArray(i.projectionMatrix),o.viewport.set(a.x,a.y,a.width,a.height),0===r&&_.matrix.copy(o.matrix),!0===n&&_.cameras.push(o)}}for(let t=0;t<m.length;t++){const e=g[t],r=m[t];null!==e&&void 0!==r&&r.update(e,n,s||a)}B&&B(e,n),h=null})),this.setAnimationLoop=function(t){B=t},this.dispose=function(){}}}function xa(t,e){function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map),r.alphaMap&&(n.alphaMap.value=r.alphaMap),r.bumpMap&&(n.bumpMap.value=r.bumpMap,n.bumpScale.value=r.bumpScale,1===r.side&&(n.bumpScale.value*=-1)),r.displacementMap&&(n.displacementMap.value=r.displacementMap,n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap),r.normalMap&&(n.normalMap.value=r.normalMap,n.normalScale.value.copy(r.normalScale),1===r.side&&n.normalScale.value.negate()),r.specularMap&&(n.specularMap.value=r.specularMap),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);const i=e.get(r).envMap;if(i&&(n.envMap.value=i,n.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;const e=!0!==t.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*e}let a,o;r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity),r.map?a=r.map:r.specularMap?a=r.specularMap:r.displacementMap?a=r.displacementMap:r.normalMap?a=r.normalMap:r.bumpMap?a=r.bumpMap:r.roughnessMap?a=r.roughnessMap:r.metalnessMap?a=r.metalnessMap:r.alphaMap?a=r.alphaMap:r.emissiveMap?a=r.emissiveMap:r.clearcoatMap?a=r.clearcoatMap:r.clearcoatNormalMap?a=r.clearcoatNormalMap:r.clearcoatRoughnessMap?a=r.clearcoatRoughnessMap:r.iridescenceMap?a=r.iridescenceMap:r.iridescenceThicknessMap?a=r.iridescenceThicknessMap:r.specularIntensityMap?a=r.specularIntensityMap:r.specularColorMap?a=r.specularColorMap:r.transmissionMap?a=r.transmissionMap:r.thicknessMap?a=r.thicknessMap:r.sheenColorMap?a=r.sheenColorMap:r.sheenRoughnessMap&&(a=r.sheenRoughnessMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uvTransform.value.copy(a.matrix)),r.aoMap?o=r.aoMap:r.lightMap&&(o=r.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),n.uv2Transform.value.copy(o.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,r,i,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(t,r):r.isMeshToonMaterial?(n(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(n(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(n(t,r),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,r),r.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,r,o)):r.isMeshMatcapMaterial?(n(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?n(t,r):r.isMeshDistanceMaterial?(n(t,r),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,r)):r.isMeshNormalMaterial?n(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,r,i,a):r.isSpriteMaterial?function(t,e){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);let n;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,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function ya(t,e,n,r){let i={},a={},o=[];const s=n.isWebGL2?t.getParameter(35375):0;function A(t,e,n){const r=t.value;if(void 0===n[e])return n[e]="number"==typeof r?r:r.clone(),!0;if("number"==typeof r){if(n[e]!==r)return n[e]=r,!0}else{const t=n[e];if(!1===t.equals(r))return t.copy(r),!0}return!1}function l(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 u(e){const n=e.target;n.removeEventListener("dispose",u);const r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),t.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(t,e){const n=e.program;r.uniformBlockBinding(t,n)},update:function(n,c){let h=i[n.id];void 0===h&&(!function(t){const e=t.uniforms;let n=0;const r=16;let i=0;for(let t=0,a=e.length;t<a;t++){const a=e[t],o=l(a);if(a.__data=new Float32Array(o.storage/Float32Array.BYTES_PER_ELEMENT),a.__offset=n,t>0){i=n%r;const t=r-i;0!==i&&t-o.boundary<0&&(n+=r-i,a.__offset=n)}n+=o.storage}i=n%r,i>0&&(n+=r-i);t.__size=n,t.__cache={}}(n),h=function(e){const n=function(){for(let t=0;t<s;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=n;const r=t.createBuffer(),i=e.__size,a=e.usage;return t.bindBuffer(35345,r),t.bufferData(35345,i,a),t.bindBuffer(35345,null),t.bindBufferBase(35345,n,r),r}(n),i[n.id]=h,n.addEventListener("dispose",u));const f=c.program;r.updateUBOMapping(n,f);const d=e.render.frame;a[n.id]!==d&&(!function(e){const n=i[e.id],r=e.uniforms,a=e.__cache;t.bindBuffer(35345,n);for(let e=0,n=r.length;e<n;e++){const n=r[e];if(!0===A(n,e,a)){const e=n.value,r=n.__offset;"number"==typeof e?(n.__data[0]=e,t.bufferSubData(35345,r,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(35345,r,n.__data))}}t.bindBuffer(35345,null)}(n),a[n.id]=d)},dispose:function(){for(const e in i)t.deleteBuffer(i[e]);o=[],i={},a={}}}}function _a(t={}){this.isWebGLRenderer=!0;const e=void 0!==t.canvas?t.canvas:function(){const t=rt("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,r=void 0===t.depth||t.depth,i=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,s=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,A=void 0!==t.powerPreference?t.powerPreference:"default",l=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u;u=null!==n?n.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let c=null,h=null;const f=[],d=[];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=I,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 p=this;let m=!1,g=0,v=0,x=null,y=-1,w=null;const E=new _t,C=new _t;let q=null,P=e.width,D=e.height,L=1,R=null,O=null;const B=new _t(0,0,P,D),k=new _t(0,0,P,D);let U=!1;const z=new Nn;let N=!1,F=!1,G=null;const H=new re,j=new tt,V=new Et,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Q(){return null===x?L:1}let Y,X,Z,J,$,et,nt,it,at,ot,st,At,lt,ut,ct,ht,ft,dt,pt,mt,gt,vt,xt,yt,wt=n;function Mt(t,n){for(let r=0;r<t.length;r++){const i=t[r],a=e.getContext(i,n);if(null!==a)return a}return null}try{const t={alpha:!0,depth:r,stencil:i,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:s,powerPreference:A,failIfMajorPerformanceCaveat:l};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r143"),e.addEventListener("webglcontextlost",Ct,!1),e.addEventListener("webglcontextrestored",qt,!1),e.addEventListener("webglcontextcreationerror",Pt,!1),null===wt){const e=["webgl2","webgl","experimental-webgl"];if(!0===p.isWebGL1Renderer&&e.shift(),wt=Mt(e,t),null===wt)throw Mt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===wt.getShaderPrecisionFormat&&(wt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function St(){Y=new pr(wt),X=new Zn(wt,Y,t),Y.init(X),vt=new ha(wt,Y,X),Z=new ua(wt,Y,X),J=new vr,$=new Zi,et=new ca(wt,Y,Z,$,X,vt,J),nt=new Kn(p),it=new dr(p),at=new Gn(wt,X),xt=new Yn(wt,Y,at,X),ot=new mr(wt,at,J,xt),st=new wr(wt,ot,at,J),pt=new br(wt,X,et),ht=new Jn($),At=new Xi(p,nt,it,Y,X,xt,ht),lt=new xa(p,$),ut=new ta,ct=new oa(Y,X),dt=new Qn(p,nt,Z,st,u,o),ft=new la(p,st,X),yt=new ya(wt,J,X,Z),mt=new Xn(wt,Y,J,X),gt=new gr(wt,Y,J,X),J.programs=At.programs,p.capabilities=X,p.extensions=Y,p.properties=$,p.renderLists=ut,p.shadowMap=ft,p.state=Z,p.info=J}St();const Tt=new va(p,wt);function Ct(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function qt(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1;const t=J.autoReset,e=ft.enabled,n=ft.autoUpdate,r=ft.needsUpdate,i=ft.type;St(),J.autoReset=t,ft.enabled=e,ft.autoUpdate=n,ft.needsUpdate=r,ft.type=i}function Pt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Dt(t){const e=t.target;e.removeEventListener("dispose",Dt),function(t){(function(t){const e=$.get(t).programs;void 0!==e&&(e.forEach((function(t){At.releaseProgram(t)})),t.isShaderMaterial&&At.releaseShaderCache(t))})(t),$.remove(t)}(e)}this.xr=Tt,this.getContext=function(){return wt},this.getContextAttributes=function(){return wt.getContextAttributes()},this.forceContextLoss=function(){const t=Y.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=Y.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(t){void 0!==t&&(L=t,this.setSize(P,D,!1))},this.getSize=function(t){return t.set(P,D)},this.setSize=function(t,n,r){Tt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(P=t,D=n,e.width=Math.floor(t*L),e.height=Math.floor(n*L),!1!==r&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(P*L,D*L).floor()},this.setDrawingBufferSize=function(t,n,r){P=t,D=n,L=r,e.width=Math.floor(t*r),e.height=Math.floor(n*r),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(E)},this.getViewport=function(t){return t.copy(B)},this.setViewport=function(t,e,n,r){t.isVector4?B.set(t.x,t.y,t.z,t.w):B.set(t,e,n,r),Z.viewport(E.copy(B).multiplyScalar(L).floor())},this.getScissor=function(t){return t.copy(k)},this.setScissor=function(t,e,n,r){t.isVector4?k.set(t.x,t.y,t.z,t.w):k.set(t,e,n,r),Z.scissor(C.copy(k).multiplyScalar(L).floor())},this.getScissorTest=function(){return U},this.setScissorTest=function(t){Z.setScissorTest(U=t)},this.setOpaqueSort=function(t){R=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(dt.getClearColor())},this.setClearColor=function(){dt.setClearColor.apply(dt,arguments)},this.getClearAlpha=function(){return dt.getClearAlpha()},this.setClearAlpha=function(){dt.setClearAlpha.apply(dt,arguments)},this.clear=function(t=!0,e=!0,n=!0){let r=0;t&&(r|=16384),e&&(r|=256),n&&(r|=1024),wt.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Ct,!1),e.removeEventListener("webglcontextrestored",qt,!1),e.removeEventListener("webglcontextcreationerror",Pt,!1),ut.dispose(),ct.dispose(),$.dispose(),nt.dispose(),it.dispose(),st.dispose(),xt.dispose(),yt.dispose(),At.dispose(),Tt.dispose(),Tt.removeEventListener("sessionstart",Rt),Tt.removeEventListener("sessionend",It),G&&(G.dispose(),G=null),Ot.stop()},this.renderBufferDirect=function(t,e,n,r,i,a){null===e&&(e=W);const o=i.isMesh&&i.matrixWorld.determinant()<0,s=function(t,e,n,r,i){!0!==e.isScene&&(e=W);et.resetTextureUnits();const a=e.fog,o=r.isMeshStandardMaterial?e.environment:null,s=null===x?p.outputEncoding:!0===x.isXRRenderTarget?x.texture.encoding:I,A=(r.isMeshStandardMaterial?it:nt).get(r.envMap||o),l=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!r.normalMap&&!!n.attributes.tangent,c=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,d=!!n.morphAttributes.color,m=r.toneMapped?p.toneMapping:0,g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==g?g.length:0,_=$.get(r),b=h.state.lights;if(!0===N&&(!0===F||t!==w)){const e=t===w&&r.id===y;ht.setState(r,t,e)}let M=!1;r.version===_.__version?_.needsLights&&_.lightsStateVersion!==b.state.version||_.outputEncoding!==s||i.isInstancedMesh&&!1===_.instancing?M=!0:i.isInstancedMesh||!0!==_.instancing?i.isSkinnedMesh&&!1===_.skinning?M=!0:i.isSkinnedMesh||!0!==_.skinning?_.envMap!==A||!0===r.fog&&_.fog!==a?M=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===ht.numPlanes&&_.numIntersection===ht.numIntersection?(_.vertexAlphas!==l||_.vertexTangents!==u||_.morphTargets!==c||_.morphNormals!==f||_.morphColors!==d||_.toneMapping!==m||!0===X.isWebGL2&&_.morphTargetsCount!==v)&&(M=!0):M=!0:M=!0:M=!0:(M=!0,_.__version=r.version);let S=_.currentProgram;!0===M&&(S=Nt(r,e,i));let E=!1,T=!1,C=!1;const q=S.getUniforms(),P=_.uniforms;Z.useProgram(S.program)&&(E=!0,T=!0,C=!0);r.id!==y&&(y=r.id,T=!0);if(E||w!==t){if(q.setValue(wt,"projectionMatrix",t.projectionMatrix),X.logarithmicDepthBuffer&&q.setValue(wt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),w!==t&&(w=t,T=!0,C=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){const e=q.map.cameraPosition;void 0!==e&&e.setValue(wt,V.setFromMatrixPosition(t.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&q.setValue(wt,"isOrthographic",!0===t.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&q.setValue(wt,"viewMatrix",t.matrixWorldInverse)}if(i.isSkinnedMesh){q.setOptional(wt,i,"bindMatrix"),q.setOptional(wt,i,"bindMatrixInverse");const t=i.skeleton;t&&(X.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),q.setValue(wt,"boneTexture",t.boneTexture,et),q.setValue(wt,"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 R=n.morphAttributes;(void 0!==R.position||void 0!==R.normal||void 0!==R.color&&!0===X.isWebGL2)&&pt.update(i,n,r,S);(T||_.receiveShadow!==i.receiveShadow)&&(_.receiveShadow=i.receiveShadow,q.setValue(wt,"receiveShadow",i.receiveShadow));T&&(q.setValue(wt,"toneMappingExposure",p.toneMappingExposure),_.needsLights&&(B=C,(O=P).ambientLightColor.needsUpdate=B,O.lightProbe.needsUpdate=B,O.directionalLights.needsUpdate=B,O.directionalLightShadows.needsUpdate=B,O.pointLights.needsUpdate=B,O.pointLightShadows.needsUpdate=B,O.spotLights.needsUpdate=B,O.spotLightShadows.needsUpdate=B,O.rectAreaLights.needsUpdate=B,O.hemisphereLights.needsUpdate=B),a&&!0===r.fog&&lt.refreshFogUniforms(P,a),lt.refreshMaterialUniforms(P,r,L,D,G),Ti.upload(wt,_.uniformsList,P,et));var O,B;r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(Ti.upload(wt,_.uniformsList,P,et),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&q.setValue(wt,"center",i.center);if(q.setValue(wt,"modelViewMatrix",i.modelViewMatrix),q.setValue(wt,"normalMatrix",i.normalMatrix),q.setValue(wt,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){const t=r.uniformsGroups;for(let e=0,n=t.length;e<n;e++)if(X.isWebGL2){const n=t[e];yt.update(n,S),yt.bind(n,S)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return S}(t,e,n,r,i);Z.setMaterial(r,o);let A=n.index;const l=n.attributes.position;if(null===A){if(void 0===l||0===l.count)return}else if(0===A.count)return;let u,c=1;!0===r.wireframe&&(A=ot.getWireframeAttribute(n),c=2),xt.setup(i,r,s,n,A);let f=mt;null!==A&&(u=at.get(A),f=gt,f.setIndex(u));const d=null!==A?A.count:l.count,m=n.drawRange.start*c,g=n.drawRange.count*c,v=null!==a?a.start*c:0,_=null!==a?a.count*c:1/0,b=Math.max(m,v),M=Math.min(d,m+g,v+_)-1,S=Math.max(0,M-b+1);if(0!==S){if(i.isMesh)!0===r.wireframe?(Z.setLineWidth(r.wireframeLinewidth*Q()),f.setMode(1)):f.setMode(4);else if(i.isLine){let t=r.linewidth;void 0===t&&(t=1),Z.setLineWidth(t*Q()),i.isLineSegments?f.setMode(1):i.isLineLoop?f.setMode(2):f.setMode(3)}else i.isPoints?f.setMode(0):i.isSprite&&f.setMode(4);if(i.isInstancedMesh)f.renderInstances(b,S,i.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);f.renderInstances(b,S,t)}else f.render(b,S)}},this.compile=function(t,e){h=ct.get(t),h.init(),d.push(h),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(h.pushLight(t),t.castShadow&&h.pushShadow(t))})),h.setupLights(p.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){Nt(n[r],t,e)}else Nt(n,t,e)})),d.pop(),h=null};let Lt=null;function Rt(){Ot.stop()}function It(){Ot.start()}const Ot=new Fn;function Bt(t,e,n,r){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)h.pushLight(t),t.castShadow&&h.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||z.intersectsSprite(t)){r&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=st.update(t),i=t.material;i.visible&&c.push(t,e,i,n,V.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==J.render.frame&&(t.skeleton.update(),t.skeleton.frame=J.render.frame),!t.frustumCulled||z.intersectsObject(t))){r&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=st.update(t),i=t.material;if(Array.isArray(i)){const r=e.groups;for(let a=0,o=r.length;a<o;a++){const o=r[a],s=i[o.materialIndex];s&&s.visible&&c.push(t,e,s,n,V.z,o)}}else i.visible&&c.push(t,e,i,n,V.z,null)}const i=t.children;for(let t=0,a=i.length;t<a;t++)Bt(i[t],e,n,r)}function kt(t,e,n,r){const i=t.opaque,o=t.transmissive,s=t.transparent;h.setupLightsView(n),o.length>0&&function(t,e,n){const r=X.isWebGL2;null===G&&(G=new bt(1,1,{generateMipmaps:!0,type:Y.has("EXT_color_buffer_half_float")?S:b,minFilter:_,samples:r&&!0===a?4:0}));p.getDrawingBufferSize(j),r?G.setSize(j.x,j.y):G.setSize(K(j.x),K(j.y));const i=p.getRenderTarget();p.setRenderTarget(G),p.clear();const o=p.toneMapping;p.toneMapping=0,Ut(t,e,n),p.toneMapping=o,et.updateMultisampleRenderTarget(G),et.updateRenderTargetMipmap(G),p.setRenderTarget(i)}(i,e,n),r&&Z.viewport(E.copy(r)),i.length>0&&Ut(i,e,n),o.length>0&&Ut(o,e,n),s.length>0&&Ut(s,e,n),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Ut(t,e,n){const r=!0===e.isScene?e.overrideMaterial:null;for(let i=0,a=t.length;i<a;i++){const a=t[i],o=a.object,s=a.geometry,A=null===r?a.material:r,l=a.group;o.layers.test(n.layers)&&zt(o,e,n,s,A,l)}}function zt(t,e,n,r,i,a){t.onBeforeRender(p,e,n,r,i,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),i.onBeforeRender(p,e,n,r,t,a),!0===i.transparent&&2===i.side?(i.side=1,i.needsUpdate=!0,p.renderBufferDirect(n,e,r,i,t,a),i.side=0,i.needsUpdate=!0,p.renderBufferDirect(n,e,r,i,t,a),i.side=2):p.renderBufferDirect(n,e,r,i,t,a),t.onAfterRender(p,e,n,r,i,a)}function Nt(t,e,n){!0!==e.isScene&&(e=W);const r=$.get(t),i=h.state.lights,a=h.state.shadowsArray,o=i.state.version,s=At.getParameters(t,i.state,a,e,n),A=At.getProgramCacheKey(s);let l=r.programs;r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=(t.isMeshStandardMaterial?it:nt).get(t.envMap||r.environment),void 0===l&&(t.addEventListener("dispose",Dt),l=new Map,r.programs=l);let u=l.get(A);if(void 0!==u){if(r.currentProgram===u&&r.lightsStateVersion===o)return Ft(t,s),u}else s.uniforms=At.getUniforms(t),t.onBuild(n,s,p),t.onBeforeCompile(s,p),u=At.acquireProgram(s,A),l.set(A,u),r.uniforms=s.uniforms;const c=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(c.clippingPlanes=ht.uniform),Ft(t,s),r.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),r.lightsStateVersion=o,r.needsLights&&(c.ambientLightColor.value=i.state.ambient,c.lightProbe.value=i.state.probe,c.directionalLights.value=i.state.directional,c.directionalLightShadows.value=i.state.directionalShadow,c.spotLights.value=i.state.spot,c.spotLightShadows.value=i.state.spotShadow,c.rectAreaLights.value=i.state.rectArea,c.ltc_1.value=i.state.rectAreaLTC1,c.ltc_2.value=i.state.rectAreaLTC2,c.pointLights.value=i.state.point,c.pointLightShadows.value=i.state.pointShadow,c.hemisphereLights.value=i.state.hemi,c.directionalShadowMap.value=i.state.directionalShadowMap,c.directionalShadowMatrix.value=i.state.directionalShadowMatrix,c.spotShadowMap.value=i.state.spotShadowMap,c.spotShadowMatrix.value=i.state.spotShadowMatrix,c.pointShadowMap.value=i.state.pointShadowMap,c.pointShadowMatrix.value=i.state.pointShadowMatrix);const f=u.getUniforms(),d=Ti.seqWithValue(f.seq,c);return r.currentProgram=u,r.uniformsList=d,u}function Ft(t,e){const n=$.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}Ot.setAnimationLoop((function(t){Lt&&Lt(t)})),"undefined"!=typeof self&&Ot.setContext(self),this.setAnimationLoop=function(t){Lt=t,Tt.setAnimationLoop(t),null===t?Ot.stop():Ot.start()},Tt.addEventListener("sessionstart",Rt),Tt.addEventListener("sessionend",It),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===m)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===Tt.enabled&&!0===Tt.isPresenting&&(!0===Tt.cameraAutoUpdate&&Tt.updateCamera(e),e=Tt.getCamera()),!0===t.isScene&&t.onBeforeRender(p,t,e,x),h=ct.get(t,d.length),h.init(),d.push(h),H.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),z.setFromProjectionMatrix(H),F=this.localClippingEnabled,N=ht.init(this.clippingPlanes,F,e),c=ut.get(t,f.length),c.init(),f.push(c),Bt(t,e,0,p.sortObjects),c.finish(),!0===p.sortObjects&&c.sort(R,O),!0===N&&ht.beginShadows();const n=h.state.shadowsArray;if(ft.render(n,t,e),!0===N&&ht.endShadows(),!0===this.info.autoReset&&this.info.reset(),dt.render(c,t),h.setupLights(p.physicallyCorrectLights),e.isArrayCamera){const n=e.cameras;for(let e=0,r=n.length;e<r;e++){const r=n[e];kt(c,t,r,r.viewport)}}else kt(c,t,e);null!==x&&(et.updateMultisampleRenderTarget(x),et.updateRenderTargetMipmap(x)),!0===t.isScene&&t.onAfterRender(p,t,e),xt.resetDefaultState(),y=-1,w=null,d.pop(),h=d.length>0?d[d.length-1]:null,f.pop(),c=f.length>0?f[f.length-1]:null},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return v},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(t,e,n){$.get(t.texture).__webglTexture=e,$.get(t.depthTexture).__webglTexture=n;const r=$.get(t);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===Y.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=$.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){x=t,g=e,v=n;let r=!0;if(t){const e=$.get(t);void 0!==e.__useDefaultFramebuffer?(Z.bindFramebuffer(36160,null),r=!1):void 0===e.__webglFramebuffer?et.setupRenderTarget(t):e.__hasExternalTextures&&et.rebindTextures(t,$.get(t.texture).__webglTexture,$.get(t.depthTexture).__webglTexture)}let i=null,a=!1,o=!1;if(t){const n=t.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(o=!0);const r=$.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=r[e],a=!0):i=X.isWebGL2&&t.samples>0&&!1===et.useMultisampledRTT(t)?$.get(t).__webglMultisampledFramebuffer:r,E.copy(t.viewport),C.copy(t.scissor),q=t.scissorTest}else E.copy(B).multiplyScalar(L).floor(),C.copy(k).multiplyScalar(L).floor(),q=U;if(Z.bindFramebuffer(36160,i)&&X.drawBuffers&&r&&Z.drawBuffers(t,i),Z.viewport(E),Z.scissor(C),Z.setScissorTest(q),a){const r=$.get(t.texture);wt.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(o){const r=$.get(t.texture),i=e||0;wt.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}y=-1},this.readRenderTargetPixels=function(t,e,n,r,i,a,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=$.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){Z.bindFramebuffer(36160,s);try{const o=t.texture,s=o.format,A=o.type;if(s!==T&&vt.convert(s)!==wt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const l=A===S&&(Y.has("EXT_color_buffer_half_float")||X.isWebGL2&&Y.has("EXT_color_buffer_float"));if(!(A===b||vt.convert(A)===wt.getParameter(35738)||A===M&&(X.isWebGL2||Y.has("OES_texture_float")||Y.has("WEBGL_color_buffer_float"))||l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&wt.readPixels(e,n,r,i,vt.convert(s),vt.convert(A),a)}finally{const t=null!==x?$.get(x).__webglFramebuffer:null;Z.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r);et.setTexture2D(e,0),wt.copyTexSubImage2D(3553,n,0,0,t.x,t.y,i,a),Z.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,a=e.image.height,o=vt.convert(n.format),s=vt.convert(n.type);et.setTexture2D(n,0),wt.pixelStorei(37440,n.flipY),wt.pixelStorei(37441,n.premultiplyAlpha),wt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?wt.texSubImage2D(3553,r,t.x,t.y,i,a,o,s,e.image.data):e.isCompressedTexture?wt.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):wt.texSubImage2D(3553,r,t.x,t.y,o,s,e.image),0===r&&n.generateMipmaps&&wt.generateMipmap(3553),Z.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(p.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const a=t.max.x-t.min.x+1,o=t.max.y-t.min.y+1,s=t.max.z-t.min.z+1,A=vt.convert(r.format),l=vt.convert(r.type);let u;if(r.isData3DTexture)et.setTexture3D(r,0),u=32879;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");et.setTexture2DArray(r,0),u=35866}wt.pixelStorei(37440,r.flipY),wt.pixelStorei(37441,r.premultiplyAlpha),wt.pixelStorei(3317,r.unpackAlignment);const c=wt.getParameter(3314),h=wt.getParameter(32878),f=wt.getParameter(3316),d=wt.getParameter(3315),m=wt.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;wt.pixelStorei(3314,g.width),wt.pixelStorei(32878,g.height),wt.pixelStorei(3316,t.min.x),wt.pixelStorei(3315,t.min.y),wt.pixelStorei(32877,t.min.z),n.isDataTexture||n.isData3DTexture?wt.texSubImage3D(u,i,e.x,e.y,e.z,a,o,s,A,l,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),wt.compressedTexSubImage3D(u,i,e.x,e.y,e.z,a,o,s,A,g.data)):wt.texSubImage3D(u,i,e.x,e.y,e.z,a,o,s,A,l,g),wt.pixelStorei(3314,c),wt.pixelStorei(32878,h),wt.pixelStorei(3316,f),wt.pixelStorei(3315,d),wt.pixelStorei(32877,m),0===i&&r.generateMipmaps&&wt.generateMipmap(u),Z.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?et.setTextureCube(t,0):t.isData3DTexture?et.setTexture3D(t,0):t.isDataArrayTexture?et.setTexture2DArray(t,0):et.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){g=0,v=0,x=null,Z.reset(),xt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends _a{}).prototype.isWebGL1Renderer=!0;class ba{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=z,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Q()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Q()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Q()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const wa=new Et;class Ma{constructor(t,e,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)wa.fromBufferAttribute(this,e),wa.applyMatrix4(t),this.setXYZ(e,wa.x,wa.y,wa.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)wa.fromBufferAttribute(this,e),wa.applyNormalMatrix(t),this.setXYZ(e,wa.x,wa.y,wa.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)wa.fromBufferAttribute(this,e),wa.transformDirection(t),this.setXYZ(e,wa.x,wa.y,wa.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new Ve(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Ma(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Sa extends Ve{constructor(t,e,n,r=1){"number"==typeof n&&(r=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=r}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 Ea extends Fe{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new dt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const Ta=new Et,Ca=new Et,qa=new re,Pa=new ne,Da=new Yt;class La extends Ce{constructor(t=new nn,e=new Ea){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,r=e.count;t<r;t++)Ta.fromBufferAttribute(e,t-1),Ca.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=Ta.distanceTo(Ca);t.setAttribute("lineDistance",new Ye(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Da.copy(n.boundingSphere),Da.applyMatrix4(r),Da.radius+=i,!1===t.ray.intersectsSphere(Da))return;qa.copy(r).invert(),Pa.copy(t.ray).applyMatrix4(qa);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,A=new Et,l=new Et,u=new Et,c=new Et,h=this.isLineSegments?2:1,f=n.index,d=n.attributes.position;if(null!==f){for(let n=Math.max(0,a.start),r=Math.min(f.count,a.start+a.count)-1;n<r;n+=h){const r=f.getX(n),i=f.getX(n+1);A.fromBufferAttribute(d,r),l.fromBufferAttribute(d,i);if(Pa.distanceSqToSegment(A,l,c,u)>s)continue;c.applyMatrix4(this.matrixWorld);const a=t.ray.origin.distanceTo(c);a<t.near||a>t.far||e.push({distance:a,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,a.start),r=Math.min(d.count,a.start+a.count)-1;n<r;n+=h){A.fromBufferAttribute(d,n),l.fromBufferAttribute(d,n+1);if(Pa.distanceSqToSegment(A,l,c,u)>s)continue;c.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(c);r<t.near||r>t.far||e.push({distance:r,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object: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}}}}}const Ra=new Et,Ia=new Et;class Oa extends La{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;t<r;t+=2)Ra.fromBufferAttribute(e,t),Ia.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+Ra.distanceTo(Ia);t.setAttribute("lineDistance",new Ye(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Ba{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),i+=n.distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const i=n.length;let a;a=e||t*n[i-1];let o,s=0,A=i-1;for(;s<=A;)if(r=Math.floor(s+(A-s)/2),o=n[r]-a,o<0)s=r+1;else{if(!(o>0)){A=r;break}A=r-1}if(r=A,n[r]===a)return r/(i-1);const l=n[r];return(r+(a-l)/(n[r+1]-l))/(i-1)}getTangent(t,e){const n=1e-4;let r=t-n,i=t+n;r<0&&(r=0),i>1&&(i=1);const a=this.getPoint(r),o=this.getPoint(i),s=e||(a.isVector2?new tt:new Et);return s.copy(o).sub(a).normalize(),s}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new Et,r=[],i=[],a=[],o=new Et,s=new re;for(let e=0;e<=t;e++){const n=e/t;r[e]=this.getTangentAt(n,new Et)}i[0]=new Et,a[0]=new Et;let A=Number.MAX_VALUE;const l=Math.abs(r[0].x),u=Math.abs(r[0].y),c=Math.abs(r[0].z);l<=A&&(A=l,n.set(1,0,0)),u<=A&&(A=u,n.set(0,1,0)),c<=A&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let e=1;e<=t;e++){if(i[e]=i[e-1].clone(),a[e]=a[e-1].clone(),o.crossVectors(r[e-1],r[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Y(r[e-1].dot(r[e]),-1,1));i[e].applyMatrix4(s.makeRotationAxis(o,t))}a[e].crossVectors(r[e],i[e])}if(!0===e){let e=Math.acos(Y(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],e*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class ka extends Ba{constructor(t=0,e=0,n=1,r=1,i=0,a=2*Math.PI,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(t,e){const n=e||new tt,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const a=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);const o=this.aStartAngle+t*i;let s=this.aX+this.xRadius*Math.cos(o),A=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=s-this.aX,r=A-this.aY;s=n*t-r*e+this.aX,A=n*e+r*t+this.aY}return n.set(s,A)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function Ua(){let t=0,e=0,n=0,r=0;function i(i,a,o,s){t=i,e=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(t,e,n,r,a){i(e,n,a*(n-t),a*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,a,o,s){let A=(e-t)/a-(n-t)/(a+o)+(n-e)/o,l=(n-e)/o-(r-e)/(o+s)+(r-n)/s;A*=o,l*=o,i(e,n,A,l)},calc:function(i){const a=i*i;return t+e*i+n*a+r*(a*i)}}}const za=new Et,Na=new Ua,Fa=new Ua,Ga=new Ua;function Ha(t,e,n,r,i){const a=.5*(r-e),o=.5*(i-n),s=t*t;return(2*n-2*r+a+o)*(t*s)+(-3*n+3*r-2*a-o)*s+a*t+n}function ja(t,e,n,r){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}function Va(t,e,n,r,i){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,r)+function(t,e){return t*t*t*e}(t,i)}class Wa extends Ba{constructor(t=new tt,e=new tt,n=new tt,r=new tt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new tt){const n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Va(t,r.x,i.x,a.x,o.x),Va(t,r.y,i.y,a.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Qa extends Ba{constructor(t=new Et,e=new Et,n=new Et,r=new Et){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new Et){const n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Va(t,r.x,i.x,a.x,o.x),Va(t,r.y,i.y,a.y,o.y),Va(t,r.z,i.z,a.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Ya extends Ba{constructor(t=new tt,e=new tt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new tt){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new tt;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Xa extends Ba{constructor(t=new tt,e=new tt,n=new tt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new tt){const n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(ja(t,r.x,i.x,a.x),ja(t,r.y,i.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Za extends Ba{constructor(t=new Et,e=new Et,n=new Et){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Et){const n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(ja(t,r.x,i.x,a.x),ja(t,r.y,i.y,a.y),ja(t,r.z,i.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Ja extends Ba{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new tt){const n=e,r=this.points,i=(r.length-1)*t,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],A=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Ha(o,s.x,A.x,l.x,u.x),Ha(o,s.y,A.y,l.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new tt).fromArray(n))}return this}}var Ka=Object.freeze({__proto__:null,ArcCurve:class extends ka{constructor(t,e,n,r,i,a){super(t,e,n,n,r,i,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Ba{constructor(t=[],e=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=r}getPoint(t,e=new Et){const n=e,r=this.points,i=r.length,a=(i-(this.closed?0:1))*t;let o,s,A=Math.floor(a),l=a-A;this.closed?A+=A>0?0:(Math.floor(Math.abs(A)/i)+1)*i:0===l&&A===i-1&&(A=i-2,l=1),this.closed||A>0?o=r[(A-1)%i]:(za.subVectors(r[0],r[1]).add(r[0]),o=za);const u=r[A%i],c=r[(A+1)%i];if(this.closed||A+2<i?s=r[(A+2)%i]:(za.subVectors(r[i-1],r[i-2]).add(r[i-1]),s=za),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(c),t),r=Math.pow(c.distanceToSquared(s),t);n<1e-4&&(n=1),e<1e-4&&(e=n),r<1e-4&&(r=n),Na.initNonuniformCatmullRom(o.x,u.x,c.x,s.x,e,n,r),Fa.initNonuniformCatmullRom(o.y,u.y,c.y,s.y,e,n,r),Ga.initNonuniformCatmullRom(o.z,u.z,c.z,s.z,e,n,r)}else"catmullrom"===this.curveType&&(Na.initCatmullRom(o.x,u.x,c.x,s.x,this.tension),Fa.initCatmullRom(o.y,u.y,c.y,s.y,this.tension),Ga.initCatmullRom(o.z,u.z,c.z,s.z,this.tension));return n.set(Na.calc(l),Fa.calc(l),Ga.calc(l)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Et).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:Wa,CubicBezierCurve3:Qa,EllipseCurve:ka,LineCurve:Ya,LineCurve3:class extends Ba{constructor(t=new Et,e=new Et){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Et){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:Xa,QuadraticBezierCurve3:Za,SplineCurve:Ja});class $a extends Ba{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ya(e,t))}getPoint(t,e){const n=t*this.getLength(),r=this.getCurveLengths();let i=0;for(;i<r.length;){if(r[i]>=n){const t=r[i]-n,a=this.curves[i],o=a.getLength(),s=0===o?0:1-t/o;return a.getPointAt(s,e)}i++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const a=i[r],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o);for(let t=0;t<s.length;t++){const r=s[t];n&&n.equals(r)||(e.push(r),n=r)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Ka[n.type]).fromJSON(n))}return this}}class to extends $a{constructor(t){super(),this.type="Path",this.currentPoint=new tt,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new Ya(this.currentPoint.clone(),new tt(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){const i=new Xa(this.currentPoint.clone(),new tt(t,e),new tt(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(t,e,n,r,i,a){const o=new Wa(this.currentPoint.clone(),new tt(t,e),new tt(n,r),new tt(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Ja(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,i,a){const o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,n,r,i,a),this}absarc(t,e,n,r,i,a){return this.absellipse(t,e,n,n,r,i,a),this}ellipse(t,e,n,r,i,a,o,s){const A=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+A,e+l,n,r,i,a,o,s),this}absellipse(t,e,n,r,i,a,o,s){const A=new ka(t,e,n,r,i,a,o,s);if(this.curves.length>0){const t=A.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(A);const l=A.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class eo extends nn{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],a=[],o=[],s=[],A=new Et,l=new tt;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=e;i++,u+=3){const c=n+i/e*r;A.x=t*Math.cos(c),A.y=t*Math.sin(c),a.push(A.x,A.y,A.z),o.push(0,0,1),l.x=(a[u]/t+1)/2,l.y=(a[u+1]/t+1)/2,s.push(l.x,l.y)}for(let t=1;t<=e;t++)i.push(t,t+1,0);this.setIndex(i),this.setAttribute("position",new Ye(a,3)),this.setAttribute("normal",new Ye(o,3)),this.setAttribute("uv",new Ye(s,2))}static fromJSON(t){return new eo(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class no extends nn{constructor(t=1,e=1,n=1,r=8,i=1,a=!1,o=0,s=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};const A=this;r=Math.floor(r),i=Math.floor(i);const l=[],u=[],c=[],h=[];let f=0;const d=[],p=n/2;let m=0;function g(n){const i=f,a=new tt,d=new Et;let g=0;const v=!0===n?t:e,x=!0===n?1:-1;for(let t=1;t<=r;t++)u.push(0,p*x,0),c.push(0,x,0),h.push(.5,.5),f++;const y=f;for(let t=0;t<=r;t++){const e=t/r*s+o,n=Math.cos(e),i=Math.sin(e);d.x=v*i,d.y=p*x,d.z=v*n,u.push(d.x,d.y,d.z),c.push(0,x,0),a.x=.5*n+.5,a.y=.5*i*x+.5,h.push(a.x,a.y),f++}for(let t=0;t<r;t++){const e=i+t,r=y+t;!0===n?l.push(r,r+1,e):l.push(r+1,r,e),g+=3}A.addGroup(m,g,!0===n?1:2),m+=g}!function(){const a=new Et,g=new Et;let v=0;const x=(e-t)/n;for(let A=0;A<=i;A++){const l=[],m=A/i,v=m*(e-t)+t;for(let t=0;t<=r;t++){const e=t/r,i=e*s+o,A=Math.sin(i),d=Math.cos(i);g.x=v*A,g.y=-m*n+p,g.z=v*d,u.push(g.x,g.y,g.z),a.set(A,x,d).normalize(),c.push(a.x,a.y,a.z),h.push(e,1-m),l.push(f++)}d.push(l)}for(let t=0;t<r;t++)for(let e=0;e<i;e++){const n=d[e][t],r=d[e+1][t],i=d[e+1][t+1],a=d[e][t+1];l.push(n,r,a),l.push(r,i,a),v+=6}A.addGroup(m,v,0),m+=v}(),!1===a&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(l),this.setAttribute("position",new Ye(u,3)),this.setAttribute("normal",new Ye(c,3)),this.setAttribute("uv",new Ye(h,2))}static fromJSON(t){return new no(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ro extends to{constructor(t){super(t),this.uuid=Q(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new to).fromJSON(n))}return this}}const io=function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let a=ao(t,0,i,n,!0);const o=[];if(!a||a.next===a.prev)return o;let s,A,l,u,c,h,f;if(r&&(a=function(t,e,n,r){const i=[];let a,o,s,A,l;for(a=0,o=e.length;a<o;a++)s=e[a]*r,A=a<o-1?e[a+1]*r:t.length,l=ao(t,s,A,r,!1),l===l.next&&(l.steiner=!0),i.push(go(l));for(i.sort(ho),a=0;a<i.length;a++)fo(i[a],n),n=oo(n,n.next);return n}(t,e,a,n)),t.length>80*n){s=l=t[0],A=u=t[1];for(let e=n;e<i;e+=n)c=t[e],h=t[e+1],c<s&&(s=c),h<A&&(A=h),c>l&&(l=c),h>u&&(u=h);f=Math.max(l-s,u-A),f=0!==f?1/f:0}return so(a,o,n,s,A,f),o};function ao(t,e,n,r,i){let a,o;if(i===function(t,e,n,r){let i=0;for(let a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}(t,e,n,r)>0)for(a=e;a<n;a+=r)o=To(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=To(a,t[a],t[a+1],o);return o&&_o(o,o.next)&&(Co(o),o=o.next),o}function oo(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!_o(r,r.next)&&0!==yo(r.prev,r,r.next))r=r.next;else{if(Co(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function so(t,e,n,r,i,a,o){if(!t)return;!o&&a&&function(t,e,n,r){let i=t;do{null===i.z&&(i.z=mo(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n,r,i,a,o,s,A,l=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e<l&&(s++,r=r.nextZ,r);e++);for(A=l;s>0||A>0&&r;)0!==s&&(0===A||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,A--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,a);let s,A,l=t;for(;t.prev!==t.next;)if(s=t.prev,A=t.next,a?lo(t,r,i,a):Ao(t))e.push(s.i/n),e.push(t.i/n),e.push(A.i/n),Co(t),t=A.next,l=A.next;else if((t=A)===l){o?1===o?so(t=uo(oo(t),e,n),e,n,r,i,a,2):2===o&&co(t,e,n,r,i,a):so(oo(t),e,n,r,i,a,1);break}}function Ao(t){const e=t.prev,n=t,r=t.next;if(yo(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(vo(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&yo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function lo(t,e,n,r){const i=t.prev,a=t,o=t.next;if(yo(i,a,o)>=0)return!1;const s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,A=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,c=mo(s,A,e,n,r),h=mo(l,u,e,n,r);let f=t.prevZ,d=t.nextZ;for(;f&&f.z>=c&&d&&d.z<=h;){if(f!==t.prev&&f!==t.next&&vo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&yo(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,d!==t.prev&&d!==t.next&&vo(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&yo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&vo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&yo(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=h;){if(d!==t.prev&&d!==t.next&&vo(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&yo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function uo(t,e,n){let r=t;do{const i=r.prev,a=r.next.next;!_o(i,a)&&bo(i,r,r.next,a)&&So(i,a)&&So(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),Co(r),Co(r.next),r=t=a),r=r.next}while(r!==t);return oo(r)}function co(t,e,n,r,i,a){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&xo(o,t)){let s=Eo(o,t);return o=oo(o,o.next),s=oo(s,s.next),so(o,e,n,r,i,a),void so(s,e,n,r,i,a)}t=t.next}o=o.next}while(o!==t)}function ho(t,e){return t.x-e.x}function fo(t,e){if(e=function(t,e){let n=e;const r=t.x,i=t.y;let a,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o){if(o=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}a=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!a)return null;if(r===o)return a;const s=a,A=a.x,l=a.y;let u,c=1/0;n=a;do{r>=n.x&&n.x>=A&&r!==n.x&&vo(i<l?r:o,i,A,l,i<l?o:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),So(n,t)&&(u<c||u===c&&(n.x>a.x||n.x===a.x&&po(a,n)))&&(a=n,c=u)),n=n.next}while(n!==s);return a}(t,e),e){const n=Eo(e,t);oo(e,e.next),oo(n,n.next)}}function po(t,e){return yo(t.prev,t,e.prev)<0&&yo(e.next,t,t.next)<0}function mo(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function go(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function vo(t,e,n,r,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function xo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&bo(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(So(t,e)&&So(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(yo(t.prev,t,e.prev)||yo(t,e.prev,e))||_o(t,e)&&yo(t.prev,t,t.next)>0&&yo(e.prev,e,e.next)>0)}function yo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function _o(t,e){return t.x===e.x&&t.y===e.y}function bo(t,e,n,r){const i=Mo(yo(t,e,n)),a=Mo(yo(t,e,r)),o=Mo(yo(n,r,t)),s=Mo(yo(n,r,e));return i!==a&&o!==s||(!(0!==i||!wo(t,n,e))||(!(0!==a||!wo(t,r,e))||(!(0!==o||!wo(n,t,r))||!(0!==s||!wo(n,e,r)))))}function wo(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Mo(t){return t>0?1:t<0?-1:0}function So(t,e){return yo(t.prev,t,t.next)<0?yo(t,e,t.next)>=0&&yo(t,t.prev,e)>=0:yo(t,e,t.prev)<0||yo(t,t.next,e)<0}function Eo(t,e){const n=new qo(t.i,t.x,t.y),r=new qo(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function To(t,e,n,r){const i=new qo(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Co(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function qo(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Po{static area(t){const e=t.length;let n=0;for(let r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n}static isClockWise(t){return Po.area(t)<0}static triangulateShape(t,e){const n=[],r=[],i=[];Do(t),Lo(n,t);let a=t.length;e.forEach(Do);for(let t=0;t<e.length;t++)r.push(a),a+=e[t].length,Lo(n,e[t]);const o=io(n,r);for(let t=0;t<o.length;t+=3)i.push(o.slice(t,t+3));return i}}function Do(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Lo(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Ro extends nn{constructor(t=new ro([new tt(.5,.5),new tt(-.5,.5),new tt(-.5,-.5),new tt(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,r=[],i=[];for(let e=0,n=t.length;e<n;e++){a(t[e])}function a(t){const a=[],o=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1,A=void 0!==e.depth?e.depth:1;let l=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:.2,c=void 0!==e.bevelSize?e.bevelSize:u-.1,h=void 0!==e.bevelOffset?e.bevelOffset:0,f=void 0!==e.bevelSegments?e.bevelSegments:3;const d=e.extrudePath,p=void 0!==e.UVGenerator?e.UVGenerator:Io;let m,g,v,x,y,_=!1;d&&(m=d.getSpacedPoints(s),_=!0,l=!1,g=d.computeFrenetFrames(s,!1),v=new Et,x=new Et,y=new Et),l||(f=0,u=0,c=0,h=0);const b=t.extractPoints(o);let w=b.shape;const M=b.holes;if(!Po.isClockWise(w)){w=w.reverse();for(let t=0,e=M.length;t<e;t++){const e=M[t];Po.isClockWise(e)&&(M[t]=e.reverse())}}const S=Po.triangulateShape(w,M),E=w;for(let t=0,e=M.length;t<e;t++){const e=M[t];w=w.concat(e)}function T(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const C=w.length,q=S.length;function P(t,e,n){let r,i,a;const o=t.x-e.x,s=t.y-e.y,A=n.x-t.x,l=n.y-t.y,u=o*o+s*s,c=o*l-s*A;if(Math.abs(c)>Number.EPSILON){const c=Math.sqrt(u),h=Math.sqrt(A*A+l*l),f=e.x-s/c,d=e.y+o/c,p=((n.x-l/h-f)*l-(n.y+A/h-d)*A)/(o*l-s*A);r=f+o*p-t.x,i=d+s*p-t.y;const m=r*r+i*i;if(m<=2)return new tt(r,i);a=Math.sqrt(m/2)}else{let t=!1;o>Number.EPSILON?A>Number.EPSILON&&(t=!0):o<-Number.EPSILON?A<-Number.EPSILON&&(t=!0):Math.sign(s)===Math.sign(l)&&(t=!0),t?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new tt(r/a,i/a)}const D=[];for(let t=0,e=E.length,n=e-1,r=t+1;t<e;t++,n++,r++)n===e&&(n=0),r===e&&(r=0),D[t]=P(E[t],E[n],E[r]);const L=[];let R,I=D.concat();for(let t=0,e=M.length;t<e;t++){const e=M[t];R=[];for(let t=0,n=e.length,r=n-1,i=t+1;t<n;t++,r++,i++)r===n&&(r=0),i===n&&(i=0),R[t]=P(e[t],e[r],e[i]);L.push(R),I=I.concat(R)}for(let t=0;t<f;t++){const e=t/f,n=u*Math.cos(e*Math.PI/2),r=c*Math.sin(e*Math.PI/2)+h;for(let t=0,e=E.length;t<e;t++){const e=T(E[t],D[t],r);k(e.x,e.y,-n)}for(let t=0,e=M.length;t<e;t++){const e=M[t];R=L[t];for(let t=0,i=e.length;t<i;t++){const i=T(e[t],R[t],r);k(i.x,i.y,-n)}}}const O=c+h;for(let t=0;t<C;t++){const e=l?T(w[t],I[t],O):w[t];_?(x.copy(g.normals[0]).multiplyScalar(e.x),v.copy(g.binormals[0]).multiplyScalar(e.y),y.copy(m[0]).add(x).add(v),k(y.x,y.y,y.z)):k(e.x,e.y,0)}for(let t=1;t<=s;t++)for(let e=0;e<C;e++){const n=l?T(w[e],I[e],O):w[e];_?(x.copy(g.normals[t]).multiplyScalar(n.x),v.copy(g.binormals[t]).multiplyScalar(n.y),y.copy(m[t]).add(x).add(v),k(y.x,y.y,y.z)):k(n.x,n.y,A/s*t)}for(let t=f-1;t>=0;t--){const e=t/f,n=u*Math.cos(e*Math.PI/2),r=c*Math.sin(e*Math.PI/2)+h;for(let t=0,e=E.length;t<e;t++){const e=T(E[t],D[t],r);k(e.x,e.y,A+n)}for(let t=0,e=M.length;t<e;t++){const e=M[t];R=L[t];for(let t=0,i=e.length;t<i;t++){const i=T(e[t],R[t],r);_?k(i.x,i.y+m[s-1].y,m[s-1].x+n):k(i.x,i.y,A+n)}}}function B(t,e){let n=t.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=s+2*f;t<n;t++){const n=C*t,a=C*(t+1);z(e+r+n,e+i+n,e+i+a,e+r+a)}}}function k(t,e,n){a.push(t),a.push(e),a.push(n)}function U(t,e,i){N(t),N(e),N(i);const a=r.length/3,o=p.generateTopUV(n,r,a-3,a-2,a-1);F(o[0]),F(o[1]),F(o[2])}function z(t,e,i,a){N(t),N(e),N(a),N(e),N(i),N(a);const o=r.length/3,s=p.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);F(s[0]),F(s[1]),F(s[3]),F(s[1]),F(s[2]),F(s[3])}function N(t){r.push(a[3*t+0]),r.push(a[3*t+1]),r.push(a[3*t+2])}function F(t){i.push(t.x),i.push(t.y)}!function(){const t=r.length/3;if(l){let t=0,e=C*t;for(let t=0;t<q;t++){const n=S[t];U(n[2]+e,n[1]+e,n[0]+e)}t=s+2*f,e=C*t;for(let t=0;t<q;t++){const n=S[t];U(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<q;t++){const e=S[t];U(e[2],e[1],e[0])}for(let t=0;t<q;t++){const e=S[t];U(e[0]+C*s,e[1]+C*s,e[2]+C*s)}}n.addGroup(t,r.length/3-t,0)}(),function(){const t=r.length/3;let e=0;B(E,e),e+=E.length;for(let t=0,n=M.length;t<n;t++){const n=M[t];B(n,e),e+=n.length}n.addGroup(t,r.length/3-t,1)}()}this.setAttribute("position",new Ye(r,3)),this.setAttribute("uv",new Ye(i,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,r=t.length;e<r;e++){const r=t[e];n.shapes.push(r.uuid)}else n.shapes.push(t.uuid);n.options=Object.assign({},e),void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let r=0,i=t.shapes.length;r<i;r++){const i=e[t.shapes[r]];n.push(i)}const r=t.options.extrudePath;return void 0!==r&&(t.options.extrudePath=(new Ka[r.type]).fromJSON(r)),new Ro(n,t.options)}}const Io={generateTopUV:function(t,e,n,r,i){const a=e[3*n],o=e[3*n+1],s=e[3*r],A=e[3*r+1],l=e[3*i],u=e[3*i+1];return[new tt(a,o),new tt(s,A),new tt(l,u)]},generateSideWallUV:function(t,e,n,r,i,a){const o=e[3*n],s=e[3*n+1],A=e[3*n+2],l=e[3*r],u=e[3*r+1],c=e[3*r+2],h=e[3*i],f=e[3*i+1],d=e[3*i+2],p=e[3*a],m=e[3*a+1],g=e[3*a+2];return Math.abs(s-u)<Math.abs(o-l)?[new tt(o,1-A),new tt(l,1-c),new tt(h,1-d),new tt(p,1-g)]:[new tt(s,1-A),new tt(u,1-c),new tt(f,1-d),new tt(m,1-g)]}};class Oo extends nn{constructor(t=1,e=32,n=16,r=0,i=2*Math.PI,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const s=Math.min(a+o,Math.PI);let A=0;const l=[],u=new Et,c=new Et,h=[],f=[],d=[],p=[];for(let h=0;h<=n;h++){const m=[],g=h/n;let v=0;0==h&&0==a?v=.5/e:h==n&&s==Math.PI&&(v=-.5/e);for(let n=0;n<=e;n++){const s=n/e;u.x=-t*Math.cos(r+s*i)*Math.sin(a+g*o),u.y=t*Math.cos(a+g*o),u.z=t*Math.sin(r+s*i)*Math.sin(a+g*o),f.push(u.x,u.y,u.z),c.copy(u).normalize(),d.push(c.x,c.y,c.z),p.push(s+v,1-g),m.push(A++)}l.push(m)}for(let t=0;t<n;t++)for(let r=0;r<e;r++){const e=l[t][r+1],i=l[t][r],o=l[t+1][r],A=l[t+1][r+1];(0!==t||a>0)&&h.push(e,i,A),(t!==n-1||s<Math.PI)&&h.push(i,o,A)}this.setIndex(h),this.setAttribute("position",new Ye(f,3)),this.setAttribute("normal",new Ye(d,3)),this.setAttribute("uv",new Ye(p,2))}static fromJSON(t){return new Oo(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Bo extends nn{constructor(t=new Za(new Et(-1,-1,0),new Et(-1,1,0),new Et(1,1,0)),e=64,n=1,r=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i};const a=t.computeFrenetFrames(e,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new Et,s=new Et,A=new tt;let l=new Et;const u=[],c=[],h=[],f=[];function d(i){l=t.getPointAt(i/e,l);const A=a.normals[i],h=a.binormals[i];for(let t=0;t<=r;t++){const e=t/r*Math.PI*2,i=Math.sin(e),a=-Math.cos(e);s.x=a*A.x+i*h.x,s.y=a*A.y+i*h.y,s.z=a*A.z+i*h.z,s.normalize(),c.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,u.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)d(t);d(!1===i?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=r;n++)A.x=t/e,A.y=n/r,h.push(A.x,A.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=r;e++){const n=(r+1)*(t-1)+(e-1),i=(r+1)*t+(e-1),a=(r+1)*t+e,o=(r+1)*(t-1)+e;f.push(n,i,o),f.push(i,a,o)}}()}(),this.setIndex(f),this.setAttribute("position",new Ye(u,3)),this.setAttribute("normal",new Ye(c,3)),this.setAttribute("uv",new Ye(h,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Bo((new Ka[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}function ko(t,e,n){const r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r),n.add(i),!0)}class Uo extends Fe{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new dt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new dt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.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.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,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}}const zo={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 No{constructor(t,e,n){const r=this;let i,a=!1,o=0,s=0;const A=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){s++,!1===a&&void 0!==r.onStart&&r.onStart(t,o,s),a=!0},this.itemEnd=function(t){o++,void 0!==r.onProgress&&r.onProgress(t,o,s),o===s&&(a=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return i?i(t):t},this.setURLModifier=function(t){return i=t,this},this.addHandler=function(t,e){return A.push(t,e),this},this.removeHandler=function(t){const e=A.indexOf(t);return-1!==e&&A.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=A.length;e<n;e+=2){const n=A[e],r=A[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}}}const Fo=new No;class Go{constructor(t){this.manager=void 0!==t?t:Fo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(r,i){n.load(t,r,e,i)}))}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 Ho extends Go{constructor(t){super(t)}load(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,a=zo.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;const o=rt("img");function s(){l(),zo.add(t,this),e&&e(this),i.manager.itemEnd(t)}function A(e){l(),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}function l(){o.removeEventListener("load",s,!1),o.removeEventListener("error",A,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",A,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o}}class jo extends Go{constructor(t){super(t)}load(t,e,n,r){const i=new yt,a=new Ho(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(t){i.image=t,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}class Vo extends Ce{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new dt(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 Wo=new re,Qo=new Et,Yo=new Et;class Xo extends class{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new tt(512,512),this.map=null,this.mapPass=null,this.matrix=new re,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Nn,this._frameExtents=new tt(1,1),this._viewportCount=1,this._viewports=[new _t(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Qo.setFromMatrixPosition(t.matrixWorld),e.position.copy(Qo),Yo.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Yo),e.updateMatrixWorld(),Wo.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Wo),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 $n(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Zo{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Jo(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Jo();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Jo(){return("undefined"==typeof performance?Date:performance).now()}class Ko extends ba{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}function $o(t,e){return t.distance-e.distance}function ts(t,e,n,r){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===r){const r=t.children;for(let t=0,i=r.length;t<i;t++)ts(r[t],e,n,!0)}}class es{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Y(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const ns=new Et,rs=new Et;class is{constructor(){this.type="ShapePath",this.color=new dt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new to,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}bezierCurveTo(t,e,n,r,i,a){return this.currentPath.bezierCurveTo(t,e,n,r,i,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function n(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n],i=new ro;i.curves=r.curves,e.push(i)}return e}function r(t,e){const n=e.length;let r=!1;for(let i=n-1,a=0;a<n;i=a++){let n=e[i],o=e[a],s=o.x-n.x,A=o.y-n.y;if(Math.abs(A)>Number.EPSILON){if(A<0&&(n=e[a],s=-s,o=e[i],A=-A),t.y<n.y||t.y>o.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=A*(t.x-n.x)-s*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return r}const i=Po.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return n(a);let o,s,A;const l=[];if(1===a.length)return s=a[0],A=new ro,A.curves=s.curves,l.push(A),l;let u=!i(a[0].getPoints());u=t?!u:u;const c=[],h=[];let f,d,p=[],m=0;h[m]=void 0,p[m]=[];for(let e=0,n=a.length;e<n;e++)s=a[e],f=s.getPoints(),o=i(f),o=t?!o:o,o?(!u&&h[m]&&m++,h[m]={s:new ro,p:f},h[m].s.curves=s.curves,u&&m++,p[m]=[]):p[m].push({h:s,p:f[0]});if(!h[0])return n(a);if(h.length>1){let t=!1,e=0;for(let t=0,e=h.length;t<e;t++)c[t]=[];for(let n=0,i=h.length;n<i;n++){const i=p[n];for(let a=0;a<i.length;a++){const o=i[a];let s=!0;for(let i=0;i<h.length;i++)r(o.p,h[i].p)&&(n!==i&&e++,s?(s=!1,c[i].push(o)):t=!0);s&&c[n].push(o)}}e>0&&!1===t&&(p=c)}for(let t=0,e=h.length;t<e;t++){A=h[t].s,l.push(A),d=p[t];for(let t=0,e=d.length;t<e;t++)A.holes.push(d[t].h)}return l}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:o}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=o);const as=new Et,os=new re,ss=new re,As=new Et,ls=new Et;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function us(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function cs(t,e,n){var r,i,a,o,s;function A(){var l=Date.now()-o;l<e&&l>=0?r=setTimeout(A,e-l):(r=null,n||(s=t.apply(a,i),a=i=null))}null==e&&(e=100);var l=function(){a=this,i=arguments,o=Date.now();var l=n&&!r;return r||(r=setTimeout(A,e)),l&&(s=t.apply(a,i),a=i=null),s};return l.clear=function(){r&&(clearTimeout(r),r=null)},l.flush=function(){r&&(s=t.apply(a,i),a=i=null,clearTimeout(r),r=null)},l}cs.debounce=cs;var hs=cs;function fs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ds(t,e,n){return e&&fs(t.prototype,e),n&&fs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ps(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ms(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ms(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ms(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var gs=ds((function t(e,n){var r=n.default,i=void 0===r?null:r,a=n.triggerUpdate,o=void 0===a||a,s=n.onChange,A=void 0===s?function(t,e){}:s;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e,this.defaultVal=i,this.triggerUpdate=o,this.onChange=A}));function vs(t){var e=t.stateInit,n=void 0===e?function(){return{}}:e,r=t.props,i=void 0===r?{}:r,a=t.methods,o=void 0===a?{}:a,s=t.aliases,A=void 0===s?{}:s,l=t.init,u=void 0===l?function(){}:l,c=t.update,h=void 0===c?function(){}:c,f=Object.keys(i).map((function(t){return new gs(t,i[t])}));return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},n instanceof Function?n(t):n,{initialised:!1}),r={};function i(e){return a(e,t),s(),i}var a=function(t,n){u.call(i,t,e,n),e.initialised=!0},s=hs((function(){e.initialised&&(h.call(i,e,r),r={})}),1);return f.forEach((function(t){i[t.name]=function(t){var n=t.name,a=t.triggerUpdate,o=void 0!==a&&a,A=t.onChange,l=void 0===A?function(t,e){}:A,u=t.defaultVal,c=void 0===u?null:u;return function(t){var a=e[n];if(!arguments.length)return a;var A=void 0===t?c:t;return e[n]=A,l.call(i,A,e,a),!r.hasOwnProperty(n)&&(r[n]=a),o&&s(),i}}(t)})),Object.keys(o).forEach((function(t){i[t]=function(){for(var n,r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return(n=o[t]).call.apply(n,[i,e].concat(a))}})),Object.entries(A).forEach((function(t){var e=ps(t,2),n=e[0],r=e[1];return i[n]=i[r]})),i.resetProps=function(){return f.forEach((function(t){i[t.name](t.defaultVal)})),i},i.resetProps(),e._rerender=s,i}}var xs,ys={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-ys.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*ys.Bounce.In(2*t):.5*ys.Bounce.Out(2*t-1)+.5}}},_s="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},bs=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},t.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},t.prototype.update=function(t,e){void 0===t&&(t=_s()),void 0===e&&(e=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var i=this._tweens[n[r]],a=!e;i&&!1===i.update(t,a)&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),ws={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),a=ws.Utils.Linear;return e<0?a(t[0],t[1],r):e>1?a(t[n],t[n-1],n-r):a(t[i],t[i+1>n?n:i+1],r-i)},Bezier:function(t,e){for(var n=0,r=t.length-1,i=Math.pow,a=ws.Utils.Bernstein,o=0;o<=r;o++)n+=i(1-e,r-o)*i(e,o)*t[o]*a(r,o);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),a=ws.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),a(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(a(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(a(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):a(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],r-i)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=ws.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:(xs=[1],function(t){var e=1;if(xs[t])return xs[t];for(var n=t;n>1;n--)e*=n;return xs[t]=e,e}),CatmullRom:function(t,e,n,r,i){var a=.5*(n-t),o=.5*(r-e),s=i*i;return(2*e-2*n+a+o)*(i*s)+(-3*e+3*n-2*a-o)*s+a*i+e}}},Ms=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),Ss=new bs,Es=function(){function t(t,e){void 0===e&&(e=Ss),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ys.Linear.None,this._interpolationFunction=ws.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Ms.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?_s()+parseFloat(t):t:_s(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,n,r){for(var i in n){var a=t[i],o=Array.isArray(a),s=o?"array":typeof a,A=!o&&Array.isArray(n[i]);if("undefined"!==s&&"function"!==s){if(A){var l=n[i];if(0===l.length)continue;l=l.map(this._handleRelativeValue.bind(this,a)),n[i]=[a].concat(l)}if("object"!==s&&!o||!a||A)void 0===e[i]&&(e[i]=a),o||(e[i]*=1),r[i]=A?n[i].slice().reverse():e[i]||0;else{for(var u in e[i]=o?[]:{},a)e[i][u]=a[u];r[i]=o?[]:{},this._setupProperties(a,e[i],n[i],r[i])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=_s()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=_s()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return this._group=t,this},t.prototype.delay=function(t){return this._delayTime=t,this},t.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return this._yoyo=t,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(t,e){if(void 0===t&&(t=_s()),void 0===e&&(e=!0),this._isPaused)return!0;var n,r,i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>i)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),r=(t-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,s=this._chainedTweens.length;o<s;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,n,r){for(var i in n)if(void 0!==e[i]){var a=e[i]||0,o=n[i],s=Array.isArray(t[i]),A=Array.isArray(o);!s&&A?t[i]=this._interpolationFunction(o,r):"object"==typeof o&&o?this._updateProperties(t[i],a,o,r):"number"==typeof(o=this._handleRelativeValue(a,o))&&(t[i]=a+(o-a)*r)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof n?this._valuesStartRepeat[t]+parseFloat(n):this._valuesEnd[t],this._valuesEnd[t]=e},t}(),Ts=Ms.nextId,Cs=Ss,qs=Cs.getAll.bind(Cs),Ps=Cs.removeAll.bind(Cs),Ds=Cs.add.bind(Cs),Ls=Cs.remove.bind(Cs),Rs=Cs.update.bind(Cs),Is={Easing:ys,Group:bs,Interpolation:ws,now:_s,Sequence:Ms,nextId:Ts,Tween:Es,VERSION:"18.6.4",getAll:qs,removeAll:Ps,add:Ds,remove:Ls,update:Rs},Os={exports:{}};function Bs(t,e,n){n=n||2;var r,i,a,o,s,A,l,u=e&&e.length,c=u?e[0]*n:t.length,h=ks(t,0,c,n,!0),f=[];if(!h||h.next===h.prev)return f;if(u&&(h=function(t,e,n,r){var i,a,o,s=[];for(i=0,a=e.length;i<a;i++)(o=ks(t,e[i]*r,i<a-1?e[i+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),s.push(Ys(o));for(s.sort(js),i=0;i<s.length;i++)n=Vs(s[i],n);return n}(t,e,h,n)),t.length>80*n){r=a=t[0],i=o=t[1];for(var d=n;d<c;d+=n)(s=t[d])<r&&(r=s),(A=t[d+1])<i&&(i=A),s>a&&(a=s),A>o&&(o=A);l=0!==(l=Math.max(a-r,o-i))?32767/l:0}return zs(h,f,n,r,i,l,0),f}function ks(t,e,n,r,i){var a,o;if(i===sA(t,e,n,r)>0)for(a=e;a<n;a+=r)o=iA(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=iA(a,t[a],t[a+1],o);return o&&Ks(o,o.next)&&(aA(o),o=o.next),o}function Us(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Ks(r,r.next)&&0!==Js(r.prev,r,r.next))r=r.next;else{if(aA(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function zs(t,e,n,r,i,a,o){if(t){!o&&a&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=Qs(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,a,o,s,A,l=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e<l&&(s++,r=r.nextZ);e++);for(A=l;s>0||A>0&&r;)0!==s&&(0===A||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,A--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,a);for(var s,A,l=t;t.prev!==t.next;)if(s=t.prev,A=t.next,a?Fs(t,r,i,a):Ns(t))e.push(s.i/n|0),e.push(t.i/n|0),e.push(A.i/n|0),aA(t),t=A.next,l=A.next;else if((t=A)===l){o?1===o?zs(t=Gs(Us(t),e,n),e,n,r,i,a,2):2===o&&Hs(t,e,n,r,i,a):zs(Us(t),e,n,r,i,a,1);break}}}function Ns(t){var e=t.prev,n=t,r=t.next;if(Js(e,n,r)>=0)return!1;for(var i=e.x,a=n.x,o=r.x,s=e.y,A=n.y,l=r.y,u=i<a?i<o?i:o:a<o?a:o,c=s<A?s<l?s:l:A<l?A:l,h=i>a?i>o?i:o:a>o?a:o,f=s>A?s>l?s:l:A>l?A:l,d=r.next;d!==e;){if(d.x>=u&&d.x<=h&&d.y>=c&&d.y<=f&&Xs(i,s,a,A,o,l,d.x,d.y)&&Js(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Fs(t,e,n,r){var i=t.prev,a=t,o=t.next;if(Js(i,a,o)>=0)return!1;for(var s=i.x,A=a.x,l=o.x,u=i.y,c=a.y,h=o.y,f=s<A?s<l?s:l:A<l?A:l,d=u<c?u<h?u:h:c<h?c:h,p=s>A?s>l?s:l:A>l?A:l,m=u>c?u>h?u:h:c>h?c:h,g=Qs(f,d,e,n,r),v=Qs(p,m,e,n,r),x=t.prevZ,y=t.nextZ;x&&x.z>=g&&y&&y.z<=v;){if(x.x>=f&&x.x<=p&&x.y>=d&&x.y<=m&&x!==i&&x!==o&&Xs(s,u,A,c,l,h,x.x,x.y)&&Js(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,y.x>=f&&y.x<=p&&y.y>=d&&y.y<=m&&y!==i&&y!==o&&Xs(s,u,A,c,l,h,y.x,y.y)&&Js(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;x&&x.z>=g;){if(x.x>=f&&x.x<=p&&x.y>=d&&x.y<=m&&x!==i&&x!==o&&Xs(s,u,A,c,l,h,x.x,x.y)&&Js(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;y&&y.z<=v;){if(y.x>=f&&y.x<=p&&y.y>=d&&y.y<=m&&y!==i&&y!==o&&Xs(s,u,A,c,l,h,y.x,y.y)&&Js(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Gs(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!Ks(i,a)&&$s(i,r,r.next,a)&&nA(i,a)&&nA(a,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(a.i/n|0),aA(r),aA(r.next),r=t=a),r=r.next}while(r!==t);return Us(r)}function Hs(t,e,n,r,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Zs(o,s)){var A=rA(o,s);return o=Us(o,o.next),A=Us(A,A.next),zs(o,e,n,r,i,a,0),void zs(A,e,n,r,i,a,0)}s=s.next}o=o.next}while(o!==t)}function js(t,e){return t.x-e.x}function Vs(t,e){var n=function(t,e){var n,r=e,i=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o&&(o=s,n=r.x<r.next.x?r:r.next,s===i))return n}r=r.next}while(r!==e);if(!n)return null;var A,l=n,u=n.x,c=n.y,h=1/0;r=n;do{i>=r.x&&r.x>=u&&i!==r.x&&Xs(a<c?i:o,a,u,c,a<c?o:i,a,r.x,r.y)&&(A=Math.abs(a-r.y)/(i-r.x),nA(r,t)&&(A<h||A===h&&(r.x>n.x||r.x===n.x&&Ws(n,r)))&&(n=r,h=A)),r=r.next}while(r!==l);return n}(t,e);if(!n)return e;var r=rA(n,t);return Us(r,r.next),Us(n,n.next)}function Ws(t,e){return Js(t.prev,t,e.prev)<0&&Js(e.next,t,t.next)<0}function Qs(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ys(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Xs(t,e,n,r,i,a,o,s){return(i-o)*(e-s)>=(t-o)*(a-s)&&(t-o)*(r-s)>=(n-o)*(e-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function Zs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&$s(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(nA(t,e)&&nA(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(Js(t.prev,t,e.prev)||Js(t,e.prev,e))||Ks(t,e)&&Js(t.prev,t,t.next)>0&&Js(e.prev,e,e.next)>0)}function Js(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ks(t,e){return t.x===e.x&&t.y===e.y}function $s(t,e,n,r){var i=eA(Js(t,e,n)),a=eA(Js(t,e,r)),o=eA(Js(n,r,t)),s=eA(Js(n,r,e));return i!==a&&o!==s||(!(0!==i||!tA(t,n,e))||(!(0!==a||!tA(t,r,e))||(!(0!==o||!tA(n,t,r))||!(0!==s||!tA(n,e,r)))))}function tA(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function eA(t){return t>0?1:t<0?-1:0}function nA(t,e){return Js(t.prev,t,t.next)<0?Js(t,e,t.next)>=0&&Js(t,t.prev,e)>=0:Js(t,e,t.prev)<0||Js(t,t.next,e)<0}function rA(t,e){var n=new oA(t.i,t.x,t.y),r=new oA(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function iA(t,e,n,r){var i=new oA(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function aA(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function oA(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sA(t,e,n,r){for(var i=0,a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}function AA(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function lA(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function uA(t){let e,n,r;function i(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<0?i=e+1:a=e}while(i<a)}return i}return 2!==t.length?(e=AA,n=(e,n)=>AA(t(e),n),r=(e,n)=>t(e)-n):(e=t===AA||t===lA?t:cA,n=t,r=t),{left:i,center:function(t,e,n=0,a=t.length){const o=i(t,e,n,a-1);return o>n&&r(t[o-1],e)>-r(t[o],e)?o-1:o},right:function(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<=0?i=e+1:a=e}while(i<a)}return i}}}function cA(){return 0}Os.exports=Bs,Os.exports.default=Bs,Bs.deviation=function(t,e,n,r){var i=e&&e.length,a=i?e[0]*n:t.length,o=Math.abs(sA(t,0,a,n));if(i)for(var s=0,A=e.length;s<A;s++){var l=e[s]*n,u=s<A-1?e[s+1]*n:t.length;o-=Math.abs(sA(t,l,u,n))}var c=0;for(s=0;s<r.length;s+=3){var h=r[s]*n,f=r[s+1]*n,d=r[s+2]*n;c+=Math.abs((t[h]-t[d])*(t[f+1]-t[h+1])-(t[h]-t[f])*(t[d+1]-t[h+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},Bs.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var a=0;a<t[i].length;a++)for(var o=0;o<e;o++)n.vertices.push(t[i][a][o]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n};const hA=uA(AA).right;function fA(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(void 0===n?a>=a&&(n=r=a):(n>a&&(n=a),r<a&&(r=a)))}return[n,r]}uA((function(t){return null===t?NaN:+t})).center;class dA{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],a=t+i,o=Math.abs(t)<Math.abs(i)?t-(a-i):i-(a-t);o&&(e[n++]=o),t=a}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,a=0;if(i>0){for(a=t[--i];i>0&&(e=a,n=t[--i],a=e+n,r=n-(a-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=a+n,n==e-a&&(a=e))}return a}}var pA=Math.sqrt(50),mA=Math.sqrt(10),gA=Math.sqrt(2);function vA(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=pA?10:a>=mA?5:a>=gA?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=pA?10:a>=mA?5:a>=gA?2:1)}function xA(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n}function yA(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function _A(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r<i;)a[r]=t+r*n;return a}var bA=1e-6,wA=1e-12,MA=Math.PI,SA=MA/2,EA=MA/4,TA=2*MA,CA=180/MA,qA=MA/180,PA=Math.abs,DA=Math.atan,LA=Math.atan2,RA=Math.cos,IA=Math.ceil,OA=Math.hypot,BA=Math.sin,kA=Math.sign||function(t){return t>0?1:t<0?-1:0},UA=Math.sqrt;function zA(t){return t>1?SA:t<-1?-SA:Math.asin(t)}function NA(t){return(t=BA(t/2))*t}function FA(){}function GA(t,e){t&&jA.hasOwnProperty(t.type)&&jA[t.type](t,e)}var HA={Feature:function(t,e){GA(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)GA(n[r].geometry,e)}},jA={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){VA(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)VA(n[r],e,0)},Polygon:function(t,e){WA(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)WA(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)GA(n[r],e)}};function VA(t,e,n){var r,i=-1,a=t.length-n;for(e.lineStart();++i<a;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function WA(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)VA(t[n],e,1);e.polygonEnd()}function QA(t,e){t&&HA.hasOwnProperty(t.type)?HA[t.type](t,e):GA(t,e)}var YA,XA,ZA,JA,KA,$A,tl,el,nl,rl,il,al,ol,sl,Al,ll,ul=new dA,cl=new dA,hl={point:FA,lineStart:FA,lineEnd:FA,polygonStart:function(){ul=new dA,hl.lineStart=fl,hl.lineEnd=dl},polygonEnd:function(){var t=+ul;cl.add(t<0?TA+t:t),this.lineStart=this.lineEnd=this.point=FA},sphere:function(){cl.add(TA)}};function fl(){hl.point=pl}function dl(){ml(YA,XA)}function pl(t,e){hl.point=ml,YA=t,XA=e,ZA=t*=qA,JA=RA(e=(e*=qA)/2+EA),KA=BA(e)}function ml(t,e){var n=(t*=qA)-ZA,r=n>=0?1:-1,i=r*n,a=RA(e=(e*=qA)/2+EA),o=BA(e),s=KA*o,A=JA*a+s*RA(i),l=s*r*BA(i);ul.add(LA(l,A)),ZA=t,JA=a,KA=o}function gl(t){return[LA(t[1],t[0]),zA(t[2])]}function vl(t){var e=t[0],n=t[1],r=RA(n);return[r*RA(e),r*BA(e),BA(n)]}function xl(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function yl(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function _l(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function bl(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function wl(t){var e=UA(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Ml,Sl,El,Tl,Cl,ql,Pl,Dl,Ll,Rl,Il,Ol,Bl,kl,Ul,zl,Nl={point:Fl,lineStart:Hl,lineEnd:jl,polygonStart:function(){Nl.point=Vl,Nl.lineStart=Wl,Nl.lineEnd=Ql,sl=new dA,hl.polygonStart()},polygonEnd:function(){hl.polygonEnd(),Nl.point=Fl,Nl.lineStart=Hl,Nl.lineEnd=jl,ul<0?($A=-(el=180),tl=-(nl=90)):sl>bA?nl=90:sl<-1e-6&&(tl=-90),ll[0]=$A,ll[1]=el},sphere:function(){$A=-(el=180),tl=-(nl=90)}};function Fl(t,e){Al.push(ll=[$A=t,el=t]),e<tl&&(tl=e),e>nl&&(nl=e)}function Gl(t,e){var n=vl([t*qA,e*qA]);if(ol){var r=yl(ol,n),i=yl([r[1],-r[0],0],r);wl(i),i=gl(i);var a,o=t-rl,s=o>0?1:-1,A=i[0]*CA*s,l=PA(o)>180;l^(s*rl<A&&A<s*t)?(a=i[1]*CA)>nl&&(nl=a):l^(s*rl<(A=(A+360)%360-180)&&A<s*t)?(a=-i[1]*CA)<tl&&(tl=a):(e<tl&&(tl=e),e>nl&&(nl=e)),l?t<rl?Yl($A,t)>Yl($A,el)&&(el=t):Yl(t,el)>Yl($A,el)&&($A=t):el>=$A?(t<$A&&($A=t),t>el&&(el=t)):t>rl?Yl($A,t)>Yl($A,el)&&(el=t):Yl(t,el)>Yl($A,el)&&($A=t)}else Al.push(ll=[$A=t,el=t]);e<tl&&(tl=e),e>nl&&(nl=e),ol=n,rl=t}function Hl(){Nl.point=Gl}function jl(){ll[0]=$A,ll[1]=el,Nl.point=Fl,ol=null}function Vl(t,e){if(ol){var n=t-rl;sl.add(PA(n)>180?n+(n>0?360:-360):n)}else il=t,al=e;hl.point(t,e),Gl(t,e)}function Wl(){hl.lineStart()}function Ql(){Vl(il,al),hl.lineEnd(),PA(sl)>bA&&($A=-(el=180)),ll[0]=$A,ll[1]=el,ol=null}function Yl(t,e){return(e-=t)<0?e+360:e}function Xl(t,e){return t[0]-e[0]}function Zl(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}function Jl(t){var e,n,r,i,a,o,s;if(nl=el=-($A=tl=1/0),Al=[],QA(t,Nl),n=Al.length){for(Al.sort(Xl),e=1,a=[r=Al[0]];e<n;++e)Zl(r,(i=Al[e])[0])||Zl(r,i[1])?(Yl(r[0],i[1])>Yl(r[0],r[1])&&(r[1]=i[1]),Yl(i[0],r[1])>Yl(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,e=0,r=a[n=a.length-1];e<=n;r=i,++e)i=a[e],(s=Yl(r[1],i[0]))>o&&(o=s,$A=i[0],el=r[1])}return Al=ll=null,$A===1/0||tl===1/0?[[NaN,NaN],[NaN,NaN]]:[[$A,tl],[el,nl]]}var Kl={sphere:FA,point:$l,lineStart:eu,lineEnd:iu,polygonStart:function(){Kl.lineStart=au,Kl.lineEnd=ou},polygonEnd:function(){Kl.lineStart=eu,Kl.lineEnd=iu}};function $l(t,e){t*=qA;var n=RA(e*=qA);tu(n*RA(t),n*BA(t),BA(e))}function tu(t,e,n){++Ml,El+=(t-El)/Ml,Tl+=(e-Tl)/Ml,Cl+=(n-Cl)/Ml}function eu(){Kl.point=nu}function nu(t,e){t*=qA;var n=RA(e*=qA);kl=n*RA(t),Ul=n*BA(t),zl=BA(e),Kl.point=ru,tu(kl,Ul,zl)}function ru(t,e){t*=qA;var n=RA(e*=qA),r=n*RA(t),i=n*BA(t),a=BA(e),o=LA(UA((o=Ul*a-zl*i)*o+(o=zl*r-kl*a)*o+(o=kl*i-Ul*r)*o),kl*r+Ul*i+zl*a);Sl+=o,ql+=o*(kl+(kl=r)),Pl+=o*(Ul+(Ul=i)),Dl+=o*(zl+(zl=a)),tu(kl,Ul,zl)}function iu(){Kl.point=$l}function au(){Kl.point=su}function ou(){Au(Ol,Bl),Kl.point=$l}function su(t,e){Ol=t,Bl=e,t*=qA,e*=qA,Kl.point=Au;var n=RA(e);kl=n*RA(t),Ul=n*BA(t),zl=BA(e),tu(kl,Ul,zl)}function Au(t,e){t*=qA;var n=RA(e*=qA),r=n*RA(t),i=n*BA(t),a=BA(e),o=Ul*a-zl*i,s=zl*r-kl*a,A=kl*i-Ul*r,l=OA(o,s,A),u=zA(l),c=l&&-u/l;Ll.add(c*o),Rl.add(c*s),Il.add(c*A),Sl+=u,ql+=u*(kl+(kl=r)),Pl+=u*(Ul+(Ul=i)),Dl+=u*(zl+(zl=a)),tu(kl,Ul,zl)}function lu(t){Ml=Sl=El=Tl=Cl=ql=Pl=Dl=0,Ll=new dA,Rl=new dA,Il=new dA,QA(t,Kl);var e=+Ll,n=+Rl,r=+Il,i=OA(e,n,r);return i<wA&&(e=ql,n=Pl,r=Dl,Sl<bA&&(e=El,n=Tl,r=Cl),(i=OA(e,n,r))<wA)?[NaN,NaN]:[LA(n,e)*CA,zA(r/i)*CA]}function uu(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function cu(t,e){return[PA(t)>MA?t+Math.round(-t/TA)*TA:t,e]}function hu(t,e,n){return(t%=TA)?e||n?uu(du(t),pu(e,n)):du(t):e||n?pu(e,n):cu}function fu(t){return function(e,n){return[(e+=t)>MA?e-TA:e<-MA?e+TA:e,n]}}function du(t){var e=fu(t);return e.invert=fu(-t),e}function pu(t,e){var n=RA(t),r=BA(t),i=RA(e),a=BA(e);function o(t,e){var o=RA(e),s=RA(t)*o,A=BA(t)*o,l=BA(e),u=l*n+s*r;return[LA(A*i-u*a,s*n-l*r),zA(u*i+A*a)]}return o.invert=function(t,e){var o=RA(e),s=RA(t)*o,A=BA(t)*o,l=BA(e),u=l*i-A*a;return[LA(A*i+l*a,s*n+u*r),zA(u*n-s*r)]},o}function mu(t,e){(e=vl(e))[0]-=t,wl(e);var n,r=(n=-e[1])>1?0:n<-1?MA:Math.acos(n);return((-e[2]<0?-r:r)+TA-bA)%TA}function gu(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:FA,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function vu(t,e){return PA(t[0]-e[0])<bA&&PA(t[1]-e[1])<bA}function xu(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function yu(t,e,n,r,i){var a,o,s=[],A=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],o=t[e];if(vu(r,o)){if(!r[2]&&!o[2]){for(i.lineStart(),a=0;a<e;++a)i.point((r=t[a])[0],r[1]);return void i.lineEnd()}o[0]+=2e-6}s.push(n=new xu(r,t,null,!0)),A.push(n.o=new xu(r,null,n,!1)),s.push(n=new xu(o,t,null,!1)),A.push(n.o=new xu(o,null,n,!0))}})),s.length){for(A.sort(e),_u(s),_u(A),a=0,o=A.length;a<o;++a)A[a].e=n=!n;for(var l,u,c=s[0];;){for(var h=c,f=!0;h.v;)if((h=h.n)===c)return;l=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(f)for(a=0,o=l.length;a<o;++a)i.point((u=l[a])[0],u[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(f)for(l=h.p.z,a=l.length-1;a>=0;--a)i.point((u=l[a])[0],u[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,f=!f}while(!h.v);i.lineEnd()}}}function _u(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function bu(t){return PA(t[0])<=MA?t[0]:kA(t[0])*((PA(t[0])+MA)%TA-MA)}function wu(t,e){var n=bu(e),r=e[1],i=BA(r),a=[BA(n),-RA(n),0],o=0,s=0,A=new dA;1===i?r=SA+bA:-1===i&&(r=-SA-bA);for(var l=0,u=t.length;l<u;++l)if(h=(c=t[l]).length)for(var c,h,f=c[h-1],d=bu(f),p=f[1]/2+EA,m=BA(p),g=RA(p),v=0;v<h;++v,d=y,m=b,g=w,f=x){var x=c[v],y=bu(x),_=x[1]/2+EA,b=BA(_),w=RA(_),M=y-d,S=M>=0?1:-1,E=S*M,T=E>MA,C=m*b;if(A.add(LA(C*S*BA(E),g*w+C*RA(E))),o+=T?M+S*TA:M,T^d>=n^y>=n){var q=yl(vl(f),vl(x));wl(q);var P=yl(a,q);wl(P);var D=(T^M>=0?-1:1)*zA(P[2]);(r>D||r===D&&(q[0]||q[1]))&&(s+=T^M>=0?1:-1)}}return(o<-1e-6||o<bA&&A<-1e-12)^1&s}function Mu(t,e,n,r){return function(i){var a,o,s,A=e(i),l=gu(),u=e(l),c=!1,h={point:f,lineStart:p,lineEnd:m,polygonStart:function(){h.point=g,h.lineStart=v,h.lineEnd=x,o=[],a=[]},polygonEnd:function(){h.point=f,h.lineStart=p,h.lineEnd=m,o=yA(o);var t=wu(a,r);o.length?(c||(i.polygonStart(),c=!0),yu(o,Eu,t,n,i)):t&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),o=a=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function f(e,n){t(e,n)&&i.point(e,n)}function d(t,e){A.point(t,e)}function p(){h.point=d,A.lineStart()}function m(){h.point=f,A.lineEnd()}function g(t,e){s.push([t,e]),u.point(t,e)}function v(){u.lineStart(),s=[]}function x(){g(s[0][0],s[0][1]),u.lineEnd();var t,e,n,r,A=u.clean(),h=l.result(),f=h.length;if(s.pop(),a.push(s),s=null,f)if(1&A){if((e=(n=h[0]).length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else f>1&&2&A&&h.push(h.pop().concat(h.shift())),o.push(h.filter(Su))}return h}}function Su(t){return t.length>1}function Eu(t,e){return((t=t.x)[0]<0?t[1]-SA-bA:SA-t[1])-((e=e.x)[0]<0?e[1]-SA-bA:SA-e[1])}cu.invert=cu;var Tu=Mu((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?MA:-MA,A=PA(a-n);PA(A-MA)<bA?(t.point(n,r=(r+o)/2>0?SA:-SA),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(a,r),e=0):i!==s&&A>=MA&&(PA(n-i)<bA&&(n-=i*bA),PA(a-s)<bA&&(a-=s*bA),r=function(t,e,n,r){var i,a,o=BA(t-n);return PA(o)>bA?DA((BA(e)*(a=RA(r))*BA(n)-BA(r)*(i=RA(e))*BA(t))/(i*a*o)):(e+r)/2}(n,r,a,o),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=a,r=o),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*SA,r.point(-MA,i),r.point(0,i),r.point(MA,i),r.point(MA,0),r.point(MA,-i),r.point(0,-i),r.point(-MA,-i),r.point(-MA,0),r.point(-MA,i);else if(PA(t[0]-e[0])>bA){var a=t[0]<e[0]?MA:-MA;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(e[0],e[1])}),[-MA,-SA]);function Cu(t){var e=RA(t),n=6*qA,r=e>0,i=PA(e)>bA;function a(t,n){return RA(t)*RA(n)>e}function o(t,n,r){var i=[1,0,0],a=yl(vl(t),vl(n)),o=xl(a,a),s=a[0],A=o-s*s;if(!A)return!r&&t;var l=e*o/A,u=-e*s/A,c=yl(i,a),h=bl(i,l);_l(h,bl(a,u));var f=c,d=xl(h,f),p=xl(f,f),m=d*d-p*(xl(h,h)-1);if(!(m<0)){var g=UA(m),v=bl(f,(-d-g)/p);if(_l(v,h),v=gl(v),!r)return v;var x,y=t[0],_=n[0],b=t[1],w=n[1];_<y&&(x=y,y=_,_=x);var M=_-y,S=PA(M-MA)<bA;if(!S&&w<b&&(x=b,b=w,w=x),S||M<bA?S?b+w>0^v[1]<(PA(v[0]-y)<bA?b:w):b<=v[1]&&v[1]<=w:M>MA^(y<=v[0]&&v[0]<=_)){var E=bl(f,(-d+g)/p);return _l(E,h),[v,gl(E)]}}}function s(e,n){var i=r?t:MA-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return Mu(a,(function(t){var e,n,A,l,u;return{lineStart:function(){l=A=!1,u=1},point:function(c,h){var f,d=[c,h],p=a(c,h),m=r?p?0:s(c,h):p?s(c+(c<0?MA:-MA),h):0;if(!e&&(l=A=p)&&t.lineStart(),p!==A&&(!(f=o(e,d))||vu(e,f)||vu(d,f))&&(d[2]=1),p!==A)u=0,p?(t.lineStart(),f=o(d,e),t.point(f[0],f[1])):(f=o(e,d),t.point(f[0],f[1],2),t.lineEnd()),e=f;else if(i&&e&&r^p){var g;m&n||!(g=o(d,e,!0))||(u=0,r?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1],3)))}!p||e&&vu(e,d)||t.point(d[0],d[1]),e=d,A=p,n=m},lineEnd:function(){A&&t.lineEnd(),e=null},clean:function(){return u|(l&&A)<<1}}}),(function(e,r,i,a){!function(t,e,n,r,i,a){if(n){var o=RA(e),s=BA(e),A=r*n;null==i?(i=e+r*TA,a=e-A/2):(i=mu(o,i),a=mu(o,a),(r>0?i<a:i>a)&&(i+=r*TA));for(var l,u=i;r>0?u>a:u<a;u-=A)l=gl([o,-s*RA(u),-s*BA(u)]),t.point(l[0],l[1])}}(a,t,n,i,e,r)}),r?[0,-t]:[-MA,t-MA])}var qu,Pu,Du,Lu,Ru=1e9,Iu=-Ru;function Ou(t,e,n,r){function i(i,a){return t<=i&&i<=n&&e<=a&&a<=r}function a(i,a,s,l){var u=0,c=0;if(null==i||(u=o(i,s))!==(c=o(a,s))||A(i,a)<0^s>0)do{l.point(0===u||3===u?t:n,u>1?r:e)}while((u=(u+s+4)%4)!==c);else l.point(a[0],a[1])}function o(r,i){return PA(r[0]-t)<bA?i>0?0:3:PA(r[0]-n)<bA?i>0?2:1:PA(r[1]-e)<bA?i>0?1:0:i>0?3:2}function s(t,e){return A(t.x,e.x)}function A(t,e){var n=o(t,1),r=o(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(o){var A,l,u,c,h,f,d,p,m,g,v,x=o,y=gu(),_={point:b,lineStart:function(){_.point=w,l&&l.push(u=[]);g=!0,m=!1,d=p=NaN},lineEnd:function(){A&&(w(c,h),f&&m&&y.rejoin(),A.push(y.result()));_.point=b,m&&x.lineEnd()},polygonStart:function(){x=y,A=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;n<i;++n)for(var a,o,s=l[n],A=1,u=s.length,c=s[0],h=c[0],f=c[1];A<u;++A)a=h,o=f,h=(c=s[A])[0],f=c[1],o<=r?f>r&&(h-a)*(r-o)>(f-o)*(t-a)&&++e:f<=r&&(h-a)*(r-o)<(f-o)*(t-a)&&--e;return e}(),n=v&&e,i=(A=yA(A)).length;(n||i)&&(o.polygonStart(),n&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),i&&yu(A,s,e,a,o),o.polygonEnd());x=o,A=l=u=null}};function b(t,e){i(t,e)&&x.point(t,e)}function w(a,o){var s=i(a,o);if(l&&u.push([a,o]),g)c=a,h=o,f=s,g=!1,s&&(x.lineStart(),x.point(a,o));else if(s&&m)x.point(a,o);else{var A=[d=Math.max(Iu,Math.min(Ru,d)),p=Math.max(Iu,Math.min(Ru,p))],y=[a=Math.max(Iu,Math.min(Ru,a)),o=Math.max(Iu,Math.min(Ru,o))];!function(t,e,n,r,i,a){var o,s=t[0],A=t[1],l=0,u=1,c=e[0]-s,h=e[1]-A;if(o=n-s,c||!(o>0)){if(o/=c,c<0){if(o<l)return;o<u&&(u=o)}else if(c>0){if(o>u)return;o>l&&(l=o)}if(o=i-s,c||!(o<0)){if(o/=c,c<0){if(o>u)return;o>l&&(l=o)}else if(c>0){if(o<l)return;o<u&&(u=o)}if(o=r-A,h||!(o>0)){if(o/=h,h<0){if(o<l)return;o<u&&(u=o)}else if(h>0){if(o>u)return;o>l&&(l=o)}if(o=a-A,h||!(o<0)){if(o/=h,h<0){if(o>u)return;o>l&&(l=o)}else if(h>0){if(o<l)return;o<u&&(u=o)}return l>0&&(t[0]=s+l*c,t[1]=A+l*h),u<1&&(e[0]=s+u*c,e[1]=A+u*h),!0}}}}}(A,y,t,e,n,r)?s&&(x.lineStart(),x.point(a,o),v=!1):(m||(x.lineStart(),x.point(A[0],A[1])),x.point(y[0],y[1]),s||x.lineEnd(),v=!1)}d=a,p=o,m=s}return _}}var Bu={sphere:FA,point:FA,lineStart:function(){Bu.point=Uu,Bu.lineEnd=ku},lineEnd:FA,polygonStart:FA,polygonEnd:FA};function ku(){Bu.point=Bu.lineEnd=FA}function Uu(t,e){Pu=t*=qA,Du=BA(e*=qA),Lu=RA(e),Bu.point=zu}function zu(t,e){t*=qA;var n=BA(e*=qA),r=RA(e),i=PA(t-Pu),a=RA(i),o=r*BA(i),s=Lu*n-Du*r*a,A=Du*n+Lu*r*a;qu.add(LA(UA(o*o+s*s),A)),Pu=t,Du=n,Lu=r}var Nu=[null,null],Fu={type:"LineString",coordinates:Nu};function Gu(t,e){return Nu[0]=t,Nu[1]=e,function(t){return qu=new dA,QA(t,Bu),+qu}(Fu)}var Hu={Feature:function(t,e){return Vu(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)if(Vu(n[r].geometry,e))return!0;return!1}},ju={Sphere:function(){return!0},Point:function(t,e){return Wu(t.coordinates,e)},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Wu(n[r],e))return!0;return!1},LineString:function(t,e){return Qu(t.coordinates,e)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Qu(n[r],e))return!0;return!1},Polygon:function(t,e){return Yu(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Yu(n[r],e))return!0;return!1},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)if(Vu(n[r],e))return!0;return!1}};function Vu(t,e){return!(!t||!ju.hasOwnProperty(t.type))&&ju[t.type](t,e)}function Wu(t,e){return 0===Gu(t,e)}function Qu(t,e){for(var n,r,i,a=0,o=t.length;a<o;a++){if(0===(r=Gu(t[a],e)))return!0;if(a>0&&(i=Gu(t[a],t[a-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))<wA*i)return!0;n=r}return!1}function Yu(t,e){return!!wu(t.map(Xu),Zu(e))}function Xu(t){return(t=t.map(Zu)).pop(),t}function Zu(t){return[t[0]*qA,t[1]*qA]}function Ju(t,e){return(t&&Hu.hasOwnProperty(t.type)?Hu[t.type]:Vu)(t,e)}function Ku(t,e,n){var r=_A(t,e-bA,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function $u(t,e,n){var r=_A(t,e-bA,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}function tc(){return function(){var t,e,n,r,i,a,o,s,A,l,u,c,h=10,f=h,d=90,p=360,m=2.5;function g(){return{type:"MultiLineString",coordinates:v()}}function v(){return _A(IA(r/d)*d,n,d).map(u).concat(_A(IA(s/p)*p,o,p).map(c)).concat(_A(IA(e/h)*h,t,h).filter((function(t){return PA(t%d)>bA})).map(A)).concat(_A(IA(a/f)*f,i,f).filter((function(t){return PA(t%p)>bA})).map(l))}return g.lines=function(){return v().map((function(t){return{type:"LineString",coordinates:t}}))},g.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(c(o).slice(1),u(n).reverse().slice(1),c(s).reverse().slice(1))]}},g.extent=function(t){return arguments.length?g.extentMajor(t).extentMinor(t):g.extentMinor()},g.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],o=+t[1][1],r>n&&(t=r,r=n,n=t),s>o&&(t=s,s=o,o=t),g.precision(m)):[[r,s],[n,o]]},g.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],a=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),a>i&&(n=a,a=i,i=n),g.precision(m)):[[e,a],[t,i]]},g.step=function(t){return arguments.length?g.stepMajor(t).stepMinor(t):g.stepMinor()},g.stepMajor=function(t){return arguments.length?(d=+t[0],p=+t[1],g):[d,p]},g.stepMinor=function(t){return arguments.length?(h=+t[0],f=+t[1],g):[h,f]},g.precision=function(h){return arguments.length?(m=+h,A=Ku(a,i,90),l=$u(e,t,m),u=Ku(s,o,90),c=$u(r,n,m),g):m},g.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()()}function ec(t,e){var n=t[0]*qA,r=t[1]*qA,i=e[0]*qA,a=e[1]*qA,o=RA(r),s=BA(r),A=RA(a),l=BA(a),u=o*RA(n),c=o*BA(n),h=A*RA(i),f=A*BA(i),d=2*zA(UA(NA(a-r)+o*A*NA(i-n))),p=BA(d),m=d?function(t){var e=BA(t*=d)/p,n=BA(d-t)/p,r=n*u+e*h,i=n*c+e*f,a=n*s+e*l;return[LA(i,r)*CA,LA(a,UA(r*r+i*i))*CA]}:function(){return[n*CA,r*CA]};return m.distance=d,m}var nc=t=>t;new dA,new dA;var rc=1/0,ic=rc,ac=-rc,oc=ac,sc={point:function(t,e){t<rc&&(rc=t);t>ac&&(ac=t);e<ic&&(ic=e);e>oc&&(oc=e)},lineStart:FA,lineEnd:FA,polygonStart:FA,polygonEnd:FA,result:function(){var t=[[rc,ic],[ac,oc]];return ac=oc=-(ic=rc=1/0),t}};function Ac(t){return function(e){var n=new lc;for(var r in t)n[r]=t[r];return n.stream=e,n}}function lc(){}function uc(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),QA(n,t.stream(sc)),e(sc.result()),null!=r&&t.clipExtent(r),t}function cc(t,e,n){return uc(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+e[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-a*(n[1][1]+n[0][1]))/2;t.scale(150*a).translate([o,s])}),n)}new dA,lc.prototype={constructor:lc,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var hc=RA(30*qA);function fc(t,e){return+e?function(t,e){function n(r,i,a,o,s,A,l,u,c,h,f,d,p,m){var g=l-r,v=u-i,x=g*g+v*v;if(x>4*e&&p--){var y=o+h,_=s+f,b=A+d,w=UA(y*y+_*_+b*b),M=zA(b/=w),S=PA(PA(b)-1)<bA||PA(a-c)<bA?(a+c)/2:LA(_,y),E=t(S,M),T=E[0],C=E[1],q=T-r,P=C-i,D=v*q-g*P;(D*D/x>e||PA((g*q+v*P)/x-.5)>.3||o*h+s*f+A*d<hc)&&(n(r,i,a,o,s,A,T,C,S,y/=w,_/=w,b,p,m),m.point(T,C),n(T,C,S,y,_,b,l,u,c,h,f,d,p,m))}}return function(e){var r,i,a,o,s,A,l,u,c,h,f,d,p={point:m,lineStart:g,lineEnd:x,polygonStart:function(){e.polygonStart(),p.lineStart=y},polygonEnd:function(){e.polygonEnd(),p.lineStart=g}};function m(n,r){n=t(n,r),e.point(n[0],n[1])}function g(){u=NaN,p.point=v,e.lineStart()}function v(r,i){var a=vl([r,i]),o=t(r,i);n(u,c,l,h,f,d,u=o[0],c=o[1],l=r,h=a[0],f=a[1],d=a[2],16,e),e.point(u,c)}function x(){p.point=m,e.lineEnd()}function y(){g(),p.point=_,p.lineEnd=b}function _(t,e){v(r=t,e),i=u,a=c,o=h,s=f,A=d,p.point=v}function b(){n(u,c,l,h,f,d,i,a,r,o,s,A,16,e),p.lineEnd=x,x()}return p}}(t,e):function(t){return Ac({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var dc=Ac({point:function(t,e){this.stream.point(t*qA,e*qA)}});function pc(t,e,n,r,i,a){if(!a)return function(t,e,n,r,i){function a(a,o){return[e+t*(a*=r),n-t*(o*=i)]}return a.invert=function(a,o){return[(a-e)/t*r,(n-o)/t*i]},a}(t,e,n,r,i);var o=RA(a),s=BA(a),A=o*t,l=s*t,u=o/t,c=s/t,h=(s*n-o*e)/t,f=(s*e+o*n)/t;function d(t,a){return[A*(t*=r)-l*(a*=i)+e,n-l*t-A*a]}return d.invert=function(t,e){return[r*(u*t-c*e+h),i*(f-c*t-u*e)]},d}function mc(t){return function(t){var e,n,r,i,a,o,s,A,l,u,c=150,h=480,f=250,d=0,p=0,m=0,g=0,v=0,x=0,y=1,_=1,b=null,w=Tu,M=null,S=nc,E=.5;function T(t){return A(t[0]*qA,t[1]*qA)}function C(t){return(t=A.invert(t[0],t[1]))&&[t[0]*CA,t[1]*CA]}function q(){var t=pc(c,0,0,y,_,x).apply(null,e(d,p)),r=pc(c,h-t[0],f-t[1],y,_,x);return n=hu(m,g,v),s=uu(e,r),A=uu(n,s),o=fc(s,E),P()}function P(){return l=u=null,T}return T.stream=function(t){return l&&u===t?l:l=dc(function(t){return Ac({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(w(o(S(u=t)))))},T.preclip=function(t){return arguments.length?(w=t,b=void 0,P()):w},T.postclip=function(t){return arguments.length?(S=t,M=r=i=a=null,P()):S},T.clipAngle=function(t){return arguments.length?(w=+t?Cu(b=t*qA):(b=null,Tu),P()):b*CA},T.clipExtent=function(t){return arguments.length?(S=null==t?(M=r=i=a=null,nc):Ou(M=+t[0][0],r=+t[0][1],i=+t[1][0],a=+t[1][1]),P()):null==M?null:[[M,r],[i,a]]},T.scale=function(t){return arguments.length?(c=+t,q()):c},T.translate=function(t){return arguments.length?(h=+t[0],f=+t[1],q()):[h,f]},T.center=function(t){return arguments.length?(d=t[0]%360*qA,p=t[1]%360*qA,q()):[d*CA,p*CA]},T.rotate=function(t){return arguments.length?(m=t[0]%360*qA,g=t[1]%360*qA,v=t.length>2?t[2]%360*qA:0,q()):[m*CA,g*CA,v*CA]},T.angle=function(t){return arguments.length?(x=t%360*qA,q()):x*CA},T.reflectX=function(t){return arguments.length?(y=t?-1:1,q()):y<0},T.reflectY=function(t){return arguments.length?(_=t?-1:1,q()):_<0},T.precision=function(t){return arguments.length?(o=fc(s,E=t*t),P()):UA(E)},T.fitExtent=function(t,e){return cc(T,t,e)},T.fitSize=function(t,e){return function(t,e,n){return cc(t,[[0,0],e],n)}(T,t,e)},T.fitWidth=function(t,e){return function(t,e,n){return uc(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];t.scale(150*i).translate([a,o])}),n)}(T,t,e)},T.fitHeight=function(t,e){return function(t,e,n){return uc(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([a,o])}),n)}(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,q()}}((function(){return t}))()}function gc(t,e){return[t,e]}function vc(t,e){var n=RA(e),r=1+RA(t)*n;return[n*BA(t)/r,BA(e)/r]}function xc(){return mc(vc).scale(250).clipAngle(142)}function yc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _c(t){return _c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},_c(t)}function bc(t,e){return bc=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},bc(t,e)}function wc(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Mc(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=_c(t);if(e){var i=_c(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return wc(this,n)}}function Sc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(t,e)||Ec(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ec(t,e){if(t){if("string"==typeof t)return Tc(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tc(t,e):void 0}}function Tc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}gc.invert=gc,vc.invert=function(t){return function(e,n){var r=UA(e*e+n*n),i=t(r),a=BA(i),o=RA(i);return[LA(e*a,r*o),zA(r&&n*a/r)]}}((function(t){return 2*DA(t)}));var Cc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],r=null;return t.forEach((function(t){if(r){var i=180*Gu(t,r)/Math.PI;if(i>e)for(var a=ec(r,t),o=1/Math.ceil(i/e),s=o;s<1;)n.push(a(s)),s+=o}n.push(r=t)})),n},qc="undefined"!=typeof window&&window.THREE?window.THREE:{BufferGeometry:nn,Float32BufferAttribute:Ye},Pc=(new qc.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Dc=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&bc(t,e)}(n,t);var e=Mc(n);function n(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;yc(this,n),(r=e.call(this)).type="GeoJsonGeometry",r.parameters={geoJson:t,radius:i,resolution:a};var o=({Point:u,MultiPoint:c,LineString:h,MultiLineString:f,Polygon:d,MultiPolygon:p}[t.type]||function(){return[]})(t.coordinates,i),s=[],A=[],l=0;function u(t,e){return[{vertices:Ic(t[1],t[0],e),indices:[]}]}function c(t,e){var n={vertices:[],indices:[]};return t.map((function(t){return u(t,e)})).forEach((function(t){var e=Sc(t,1)[0];Lc(n,e)})),[n]}function h(t,e){for(var n=Cc(t,a).map((function(t){var n=Sc(t,2),r=n[0];return Ic(n[1],r,e)})),r=Os.exports.flatten([n]).vertices,i=Math.round(r.length/3),o=[],s=1;s<i;s++)o.push(s-1,s);return[{vertices:r,indices:o}]}function f(t,e){var n={vertices:[],indices:[]};return t.map((function(t){return h(t,e)})).forEach((function(t){var e=Sc(t,1)[0];Lc(n,e)})),[n]}function d(t,e){for(var n=t.map((function(t){return Cc(t,a).map((function(t){var n=Sc(t,2),r=n[0];return Ic(n[1],r,e)}))})),r=Os.exports.flatten(n),i=r.vertices,o=r.holes,s=o[0]||1/0,A=i.slice(0,3*s),l=i.slice(3*s),u=new Set(o),c=Math.round(i.length/3),h=[],f=[],d=1;d<c;d++)u.has(d)||(d<s?h.push(d-1,d):f.push(d-1-s,d-s));var p=[{indices:h,vertices:A}];return o.length&&p.push({indices:f,vertices:l}),p}function p(t,e){var n={vertices:[],indices:[]},r={vertices:[],indices:[]};t.map((function(t){return d(t,e)})).forEach((function(t){var e=Sc(t,2),i=e[0],a=e[1];Lc(n,i),a&&Lc(r,a)}));var i=[n];return r.vertices.length&&i.push(r),i}return o.forEach((function(t){var e=s.length;Lc({indices:s,vertices:A},t),r.addGroup(e,s.length-e,l++)})),s.length&&r.setIndex(s),A.length&&r[Pc]("position",new qc.Float32BufferAttribute(A,3)),r}return n}(qc.BufferGeometry);function Lc(t,e){var n=Math.round(t.vertices.length/3);Rc(t.vertices,e.vertices),Rc(t.indices,e.indices.map((function(t){return t+n})))}function Rc(t,e){var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ec(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.push(i)}}catch(t){r.e(t)}finally{r.f()}}function Ic(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-t)*Math.PI/180,i=(90-e)*Math.PI/180;return[n*Math.sin(r)*Math.cos(i),n*Math.cos(r),n*Math.sin(r)*Math.sin(i)]}function Oc(t){let e,n,r,i=0;for(let a=0;a<t.length;++a){const o=t[a];if(o.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===e&&(e=o.array.constructor),e!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=o.itemSize),n!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===r&&(r=o.normalized),r!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=o.array.length}const a=new e(i);let o=0;for(let e=0;e<t.length;++e)a.set(t[e].array,o),o+=t[e].array.length;return new Ve(a,n,r)}function Bc(t){const e=t.data.array.constructor,n=t.count,r=t.itemSize,i=t.normalized,a=new e(n*r);let o;o=t.isInstancedInterleavedBufferAttribute?new Sa(a,r,i,t.meshPerAttribute):new Ve(a,r,i);for(let e=0;e<n;e++)o.setX(e,t.getX(e)),r>=2&&o.setY(e,t.getY(e)),r>=3&&o.setZ(e,t.getZ(e)),r>=4&&o.setW(e,t.getW(e));return o}var kc=Object.freeze({__proto__:null,deinterleaveAttribute:Bc,deinterleaveGeometry:function(t){const e=t.attributes,n=t.morphTargets,r=new Map;for(const t in e){const n=e[t];n.isInterleavedBufferAttribute&&(r.has(n)||r.set(n,Bc(n)),e[t]=r.get(n))}for(const t in n){const e=n[t];e.isInterleavedBufferAttribute&&(r.has(e)||r.set(e,Bc(e)),n[t]=r.get(e))}},computeTangents:function(){throw new Error("BufferGeometryUtils: computeTangents renamed to computeMikkTSpaceTangents.")},computeMikkTSpaceTangents:function(t,e,n=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!t.hasAttribute("position")||!t.hasAttribute("normal")||!t.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function r(t){if(t.normalized||t.isInterleavedBufferAttribute){const e=t.isInterleavedBufferAttribute?t.data.array:t.array,n=new Float32Array(t.getCount()*t.itemSize);for(let r=0,i=0;r<t.getCount();r++)n[i++]=$.denormalize(t.getX(r),e),n[i++]=$.denormalize(t.getY(r),e),t.itemSize>2&&(n[i++]=$.denormalize(t.getZ(r),e));return n}return t.array instanceof Float32Array?t.array:new Float32Array(t.array)}const i=t.index?t.toNonIndexed():t,a=e.generateTangents(r(i.attributes.position),r(i.attributes.normal),r(i.attributes.uv));if(n)for(let t=3;t<a.length;t+=4)a[t]*=-1;return i.setAttribute("tangent",new Ve(a,4)),t!==i&&t.copy(i),t},mergeBufferGeometries:function(t,e=!1){const n=null!==t[0].index,r=new Set(Object.keys(t[0].attributes)),i=new Set(Object.keys(t[0].morphAttributes)),a={},o={},s=t[0].morphTargetsRelative,A=new nn;let l=0;for(let u=0;u<t.length;++u){const c=t[u];let h=0;if(n!==(null!==c.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const t in c.attributes){if(!r.has(t))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+t+'" attribute exists among all geometries, or in none of them.'),null;void 0===a[t]&&(a[t]=[]),a[t].push(c.attributes[t]),h++}if(h!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(s!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const t in c.morphAttributes){if(!i.has(t))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[t]&&(o[t]=[]),o[t].push(c.morphAttributes[t])}if(A.userData.mergedUserData=A.userData.mergedUserData||[],A.userData.mergedUserData.push(c.userData),e){let t;if(n)t=c.index.count;else{if(void 0===c.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;t=c.attributes.position.count}A.addGroup(l,t,u),l+=t}}if(n){let e=0;const n=[];for(let r=0;r<t.length;++r){const i=t[r].index;for(let t=0;t<i.count;++t)n.push(i.getX(t)+e);e+=t[r].attributes.position.count}A.setIndex(n)}for(const t in a){const e=Oc(a[t]);if(!e)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;A.setAttribute(t,e)}for(const t in o){const e=o[t][0].length;if(0===e)break;A.morphAttributes=A.morphAttributes||{},A.morphAttributes[t]=[];for(let n=0;n<e;++n){const e=[];for(let r=0;r<o[t].length;++r)e.push(o[t][r][n]);const r=Oc(e);if(!r)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" morphAttribute."),null;A.morphAttributes[t].push(r)}}return A},mergeBufferAttributes:Oc,interleaveAttributes:function(t){let e,n=0,r=0;for(let i=0,a=t.length;i<a;++i){const a=t[i];if(void 0===e&&(e=a.array.constructor),e!==a.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;n+=a.array.length,r+=a.itemSize}const i=new ba(new e(n),r);let a=0;const o=[],s=["getX","getY","getZ","getW"],A=["setX","setY","setZ","setW"];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.itemSize,l=n.count,u=new Ma(i,r,a,n.normalized);o.push(u),a+=r;for(let t=0;t<l;t++)for(let e=0;e<r;e++)u[A[e]](t,n[s[e]](t))}return o},estimateBytesUsed:function(t){let e=0;for(const n in t.attributes){const r=t.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}const n=t.getIndex();return e+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,e},mergeVertices:function(t,e=1e-4){e=Math.max(e,Number.EPSILON);const n={},r=t.getIndex(),i=t.getAttribute("position"),a=r?r.count:i.count;let o=0;const s=Object.keys(t.attributes),A={},l={},u=[],c=["getX","getY","getZ","getW"];for(let e=0,n=s.length;e<n;e++){const n=s[e];A[n]=[];const r=t.morphAttributes[n];r&&(l[n]=new Array(r.length).fill().map((()=>[])))}const h=Math.log10(1/e),f=Math.pow(10,h);for(let e=0;e<a;e++){const i=r?r.getX(e):e;let a="";for(let e=0,n=s.length;e<n;e++){const n=s[e],r=t.getAttribute(n),o=r.itemSize;for(let t=0;t<o;t++)a+=~~(r[c[t]](i)*f)+","}if(a in n)u.push(n[a]);else{for(let e=0,n=s.length;e<n;e++){const n=s[e],r=t.getAttribute(n),a=t.morphAttributes[n],o=r.itemSize,u=A[n],h=l[n];for(let t=0;t<o;t++){const e=c[t];if(u.push(r[e](i)),a)for(let t=0,n=a.length;t<n;t++)h[t].push(a[t][e](i))}}n[a]=o,u.push(o),o++}}const d=t.clone();for(let e=0,n=s.length;e<n;e++){const n=s[e],r=t.getAttribute(n),i=new r.array.constructor(A[n]),a=new Ve(i,r.itemSize,r.normalized);if(d.setAttribute(n,a),n in l)for(let e=0;e<l[n].length;e++){const r=t.morphAttributes[n][e],i=new r.array.constructor(l[n][e]),a=new Ve(i,r.itemSize,r.normalized);d.morphAttributes[n][e]=a}}return d.setIndex(u),d},toTrianglesDrawMode:function(t,e){if(0===e)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(2===e||1===e){let n=t.getIndex();if(null===n){const e=[],r=t.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<r.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const r=n.count-2,i=[];if(2===e)for(let t=1;t<=r;t++)i.push(n.getX(0)),i.push(n.getX(t)),i.push(n.getX(t+1));else for(let t=0;t<r;t++)t%2==0?(i.push(n.getX(t)),i.push(n.getX(t+1)),i.push(n.getX(t+2))):(i.push(n.getX(t+2)),i.push(n.getX(t+1)),i.push(n.getX(t)));i.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=t.clone();return a.setIndex(i),a.clearGroups(),a}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t},computeMorphedAttributes:function(t){if(!0!==t.geometry.isBufferGeometry)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;const e=new Et,n=new Et,r=new Et,i=new Et,a=new Et,o=new Et,s=new Et,A=new Et,l=new Et;function u(t,u,c,h,f,d,p,m){e.fromBufferAttribute(u,f),n.fromBufferAttribute(u,d),r.fromBufferAttribute(u,p);const g=t.morphTargetInfluences;if(c&&g){s.set(0,0,0),A.set(0,0,0),l.set(0,0,0);for(let t=0,u=c.length;t<u;t++){const u=g[t],m=c[t];0!==u&&(i.fromBufferAttribute(m,f),a.fromBufferAttribute(m,d),o.fromBufferAttribute(m,p),h?(s.addScaledVector(i,u),A.addScaledVector(a,u),l.addScaledVector(o,u)):(s.addScaledVector(i.sub(e),u),A.addScaledVector(a.sub(n),u),l.addScaledVector(o.sub(r),u)))}e.add(s),n.add(A),r.add(l)}t.isSkinnedMesh&&(t.boneTransform(f,e),t.boneTransform(d,n),t.boneTransform(p,r)),m[3*f+0]=e.x,m[3*f+1]=e.y,m[3*f+2]=e.z,m[3*d+0]=n.x,m[3*d+1]=n.y,m[3*d+2]=n.z,m[3*p+0]=r.x,m[3*p+1]=r.y,m[3*p+2]=r.z}const c=t.geometry,h=t.material;let f,d,p;const m=c.index,g=c.attributes.position,v=c.morphAttributes.position,x=c.morphTargetsRelative,y=c.attributes.normal,_=c.morphAttributes.position,b=c.groups,w=c.drawRange;let M,S,E,T,C,q,P;const D=new Float32Array(g.count*g.itemSize),L=new Float32Array(y.count*y.itemSize);if(null!==m)if(Array.isArray(h))for(M=0,E=b.length;M<E;M++)for(C=b[M],q=Math.max(C.start,w.start),P=Math.min(C.start+C.count,w.start+w.count),S=q,T=P;S<T;S+=3)f=m.getX(S),d=m.getX(S+1),p=m.getX(S+2),u(t,g,v,x,f,d,p,D),u(t,y,_,x,f,d,p,L);else for(q=Math.max(0,w.start),P=Math.min(m.count,w.start+w.count),M=q,E=P;M<E;M+=3)f=m.getX(M),d=m.getX(M+1),p=m.getX(M+2),u(t,g,v,x,f,d,p,D),u(t,y,_,x,f,d,p,L);else if(Array.isArray(h))for(M=0,E=b.length;M<E;M++)for(C=b[M],q=Math.max(C.start,w.start),P=Math.min(C.start+C.count,w.start+w.count),S=q,T=P;S<T;S+=3)f=S,d=S+1,p=S+2,u(t,g,v,x,f,d,p,D),u(t,y,_,x,f,d,p,L);else for(q=Math.max(0,w.start),P=Math.min(g.count,w.start+w.count),M=q,E=P;M<E;M+=3)f=M,d=M+1,p=M+2,u(t,g,v,x,f,d,p,D),u(t,y,_,x,f,d,p,L);return{positionAttribute:g,normalAttribute:y,morphedPositionAttribute:new Ye(D,3),morphedNormalAttribute:new Ye(L,3)}},mergeGroups:function(t){if(0===t.groups.length)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),t;let e=t.groups;if(e=e.sort(((t,e)=>t.materialIndex!==e.materialIndex?t.materialIndex-e.materialIndex:t.start-e.start)),null===t.getIndex()){const e=t.getAttribute("position"),n=[];for(let t=0;t<e.count;t+=3)n.push(t,t+1,t+2);t.setIndex(n)}const n=t.getIndex(),r=[];for(let t=0;t<e.length;t++){const i=e[t],a=i.start,o=a+i.count;for(let t=a;t<o;t++)r.push(n.getX(t))}t.dispose(),t.setIndex(r);let i=0;for(let t=0;t<e.length;t++){const n=e[t];n.start=i,i+=n.count}let a=e[0];t.groups=[a];for(let n=1;n<e.length;n++){const r=e[n];a.materialIndex===r.materialIndex?a.count+=r.count:(a=r,t.groups.push(a))}return t}}),Uc=function(t){return t instanceof Function?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}},zc={exports:{}};!function(t){!function(e){var n=/^\s+/,r=/\s+$/,i=0,a=e.round,o=e.min,s=e.max,A=e.random;function l(t,A){if(A=A||{},(t=t||"")instanceof l)return t;if(!(this instanceof l))return new l(t,A);var u=function(t){var i={r:0,g:0,b:0},a=1,A=null,l=null,u=null,c=!1,h=!1;"string"==typeof t&&(t=function(t){t=t.replace(n,"").replace(r,"").toLowerCase();var e,i=!1;if(T[t])t=T[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(e=N.rgb.exec(t))return{r:e[1],g:e[2],b:e[3]};if(e=N.rgba.exec(t))return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=N.hsl.exec(t))return{h:e[1],s:e[2],l:e[3]};if(e=N.hsla.exec(t))return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=N.hsv.exec(t))return{h:e[1],s:e[2],v:e[3]};if(e=N.hsva.exec(t))return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=N.hex8.exec(t))return{r:L(e[1]),g:L(e[2]),b:L(e[3]),a:B(e[4]),format:i?"name":"hex8"};if(e=N.hex6.exec(t))return{r:L(e[1]),g:L(e[2]),b:L(e[3]),format:i?"name":"hex"};if(e=N.hex4.exec(t))return{r:L(e[1]+""+e[1]),g:L(e[2]+""+e[2]),b:L(e[3]+""+e[3]),a:B(e[4]+""+e[4]),format:i?"name":"hex8"};if(e=N.hex3.exec(t))return{r:L(e[1]+""+e[1]),g:L(e[2]+""+e[2]),b:L(e[3]+""+e[3]),format:i?"name":"hex"};return!1}(t));"object"==typeof t&&(F(t.r)&&F(t.g)&&F(t.b)?(f=t.r,d=t.g,p=t.b,i={r:255*P(f,255),g:255*P(d,255),b:255*P(p,255)},c=!0,h="%"===String(t.r).substr(-1)?"prgb":"rgb"):F(t.h)&&F(t.s)&&F(t.v)?(A=I(t.s),l=I(t.v),i=function(t,n,r){t=6*P(t,360),n=P(n,100),r=P(r,100);var i=e.floor(t),a=t-i,o=r*(1-n),s=r*(1-a*n),A=r*(1-(1-a)*n),l=i%6;return{r:255*[r,s,o,o,A,r][l],g:255*[A,r,r,s,o,o][l],b:255*[o,o,A,r,r,s][l]}}(t.h,A,l),c=!0,h="hsv"):F(t.h)&&F(t.s)&&F(t.l)&&(A=I(t.s),u=I(t.l),i=function(t,e,n){var r,i,a;function o(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+(e-t)*(2/3-n)*6:t}if(t=P(t,360),e=P(e,100),n=P(n,100),0===e)r=i=a=n;else{var s=n<.5?n*(1+e):n+e-n*e,A=2*n-s;r=o(A,s,t+1/3),i=o(A,s,t),a=o(A,s,t-1/3)}return{r:255*r,g:255*i,b:255*a}}(t.h,A,u),c=!0,h="hsl"),t.hasOwnProperty("a")&&(a=t.a));var f,d,p;return a=q(a),{ok:c,format:t.format||h,r:o(255,s(i.r,0)),g:o(255,s(i.g,0)),b:o(255,s(i.b,0)),a:a}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=a(100*this._a)/100,this._format=A.format||u.format,this._gradientType=A.gradientType,this._r<1&&(this._r=a(this._r)),this._g<1&&(this._g=a(this._g)),this._b<1&&(this._b=a(this._b)),this._ok=u.ok,this._tc_id=i++}function u(t,e,n){t=P(t,255),e=P(e,255),n=P(n,255);var r,i,a=s(t,e,n),A=o(t,e,n),l=(a+A)/2;if(a==A)r=i=0;else{var u=a-A;switch(i=l>.5?u/(2-a-A):u/(a+A),a){case t:r=(e-n)/u+(e<n?6:0);break;case e:r=(n-t)/u+2;break;case n:r=(t-e)/u+4}r/=6}return{h:r,s:i,l:l}}function c(t,e,n){t=P(t,255),e=P(e,255),n=P(n,255);var r,i,a=s(t,e,n),A=o(t,e,n),l=a,u=a-A;if(i=0===a?0:u/a,a==A)r=0;else{switch(a){case t:r=(e-n)/u+(e<n?6:0);break;case e:r=(n-t)/u+2;break;case n:r=(t-e)/u+4}r/=6}return{h:r,s:i,v:l}}function h(t,e,n,r){var i=[R(a(t).toString(16)),R(a(e).toString(16)),R(a(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function f(t,e,n,r){return[R(O(r)),R(a(t).toString(16)),R(a(e).toString(16)),R(a(n).toString(16))].join("")}function d(t,e){e=0===e?0:e||10;var n=l(t).toHsl();return n.s-=e/100,n.s=D(n.s),l(n)}function p(t,e){e=0===e?0:e||10;var n=l(t).toHsl();return n.s+=e/100,n.s=D(n.s),l(n)}function m(t){return l(t).desaturate(100)}function g(t,e){e=0===e?0:e||10;var n=l(t).toHsl();return n.l+=e/100,n.l=D(n.l),l(n)}function v(t,e){e=0===e?0:e||10;var n=l(t).toRgb();return n.r=s(0,o(255,n.r-a(-e/100*255))),n.g=s(0,o(255,n.g-a(-e/100*255))),n.b=s(0,o(255,n.b-a(-e/100*255))),l(n)}function x(t,e){e=0===e?0:e||10;var n=l(t).toHsl();return n.l-=e/100,n.l=D(n.l),l(n)}function y(t,e){var n=l(t).toHsl(),r=(n.h+e)%360;return n.h=r<0?360+r:r,l(n)}function _(t){var e=l(t).toHsl();return e.h=(e.h+180)%360,l(e)}function b(t){var e=l(t).toHsl(),n=e.h;return[l(t),l({h:(n+120)%360,s:e.s,l:e.l}),l({h:(n+240)%360,s:e.s,l:e.l})]}function w(t){var e=l(t).toHsl(),n=e.h;return[l(t),l({h:(n+90)%360,s:e.s,l:e.l}),l({h:(n+180)%360,s:e.s,l:e.l}),l({h:(n+270)%360,s:e.s,l:e.l})]}function M(t){var e=l(t).toHsl(),n=e.h;return[l(t),l({h:(n+72)%360,s:e.s,l:e.l}),l({h:(n+216)%360,s:e.s,l:e.l})]}function S(t,e,n){e=e||6,n=n||30;var r=l(t).toHsl(),i=360/n,a=[l(t)];for(r.h=(r.h-(i*e>>1)+720)%360;--e;)r.h=(r.h+i)%360,a.push(l(r));return a}function E(t,e){e=e||6;for(var n=l(t).toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/e;e--;)o.push(l({h:r,s:i,v:a})),a=(a+s)%1;return o}l.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,i=this.toRgb();return t=i.r/255,n=i.g/255,r=i.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=q(t),this._roundA=a(100*this._a)/100,this},toHsv:function(){var t=c(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=c(this._r,this._g,this._b),e=a(360*t.h),n=a(100*t.s),r=a(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=u(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=u(this._r,this._g,this._b),e=a(360*t.h),n=a(100*t.s),r=a(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return h(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,n,r,i){var o=[R(a(t).toString(16)),R(a(e).toString(16)),R(a(n).toString(16)),R(O(r))];if(i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:a(this._r),g:a(this._g),b:a(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+a(this._r)+", "+a(this._g)+", "+a(this._b)+")":"rgba("+a(this._r)+", "+a(this._g)+", "+a(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:a(100*P(this._r,255))+"%",g:a(100*P(this._g,255))+"%",b:a(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*P(this._r,255))+"%, "+a(100*P(this._g,255))+"%, "+a(100*P(this._b,255))+"%)":"rgba("+a(100*P(this._r,255))+"%, "+a(100*P(this._g,255))+"%, "+a(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(C[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+f(this._r,this._g,this._b,this._a),n=e,r=this._gradientType?"GradientType = 1, ":"";if(t){var i=l(t);n="#"+f(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return l(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},l.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]="a"===r?t[r]:I(t[r]));t=n}return l(t,e)},l.equals=function(t,e){return!(!t||!e)&&l(t).toRgbString()==l(e).toRgbString()},l.random=function(){return l.fromRatio({r:A(),g:A(),b:A()})},l.mix=function(t,e,n){n=0===n?0:n||50;var r=l(t).toRgb(),i=l(e).toRgb(),a=n/100;return l({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},
1
+ // Version 2.26.4 globe.gl - https://github.com/vasturiano/globe.gl
2
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Globe=e()}(this,(function(){"use strict";function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function e(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?t(Object(i),!0).forEach((function(t){n(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function i(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}(".scene-container .clickable {\n cursor: pointer;\n}");const o="143",s={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},A=0,l=1,u=2,c=3,h=100,f=301,d=302,p=306,m=1e3,g=1001,v=1002,x=1003,y=1006,_=1008,b=1009,w=1014,M=1015,S=1016,E=1020,T=1023,C=1026,q=1027,P=33776,D=33777,L=33778,R=33779,I=3e3,O=3001,B="srgb",k="srgb-linear",U=7680,z=35044,N="300 es",F=1035;class G{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,r=n.length;e<r;e++)n[e].call(this,t);t.target=null}}}const H=["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"];let j=1234567;const V=Math.PI/180,W=180/Math.PI;function Q(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(H[255&t]+H[t>>8&255]+H[t>>16&255]+H[t>>24&255]+"-"+H[255&e]+H[e>>8&255]+"-"+H[e>>16&15|64]+H[e>>24&255]+"-"+H[63&n|128]+H[n>>8&255]+"-"+H[n>>16&255]+H[n>>24&255]+H[255&r]+H[r>>8&255]+H[r>>16&255]+H[r>>24&255]).toLowerCase()}function Y(t,e,n){return Math.max(e,Math.min(n,t))}function X(t,e){return(t%e+e)%e}function Z(t,e,n){return(1-n)*t+n*e}function J(t){return 0==(t&t-1)&&0!==t}function K(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var $=Object.freeze({__proto__:null,DEG2RAD:V,RAD2DEG:W,generateUUID:Q,clamp:Y,euclideanModulo:X,mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:Z,damp:function(t,e,n,r){return Z(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(X(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(j=t);let e=j+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*V},radToDeg:function(t){return t*W},isPowerOfTwo:J,ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:K,setQuaternionFromProperEuler:function(t,e,n,r,i){const a=Math.cos,o=Math.sin,s=a(n/2),A=o(n/2),l=a((e+r)/2),u=o((e+r)/2),c=a((e-r)/2),h=o((e-r)/2),f=a((r-e)/2),d=o((r-e)/2);switch(i){case"XYX":t.set(s*u,A*c,A*h,s*l);break;case"YZY":t.set(A*h,s*u,A*c,s*l);break;case"ZXZ":t.set(A*c,A*h,s*u,s*l);break;case"XZX":t.set(s*u,A*d,A*f,s*l);break;case"YXY":t.set(A*f,s*u,A*d,s*l);break;case"ZYZ":t.set(A*d,A*f,s*u,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}},denormalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}});class tt{constructor(t=0,e=0){tt.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,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[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),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class et{constructor(){et.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,n,r,i,a,o,s,A){const l=this.elements;return l[0]=t,l[1]=r,l[2]=o,l[3]=e,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=A,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,r=e.elements,i=this.elements,a=n[0],o=n[3],s=n[6],A=n[1],l=n[4],u=n[7],c=n[2],h=n[5],f=n[8],d=r[0],p=r[3],m=r[6],g=r[1],v=r[4],x=r[7],y=r[2],_=r[5],b=r[8];return i[0]=a*d+o*g+s*y,i[3]=a*p+o*v+s*_,i[6]=a*m+o*x+s*b,i[1]=A*d+l*g+u*y,i[4]=A*p+l*v+u*_,i[7]=A*m+l*x+u*b,i[2]=c*d+h*g+f*y,i[5]=c*p+h*v+f*_,i[8]=c*m+h*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],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],A=t[7],l=t[8];return e*a*l-e*o*A-n*i*l+n*o*s+r*i*A-r*a*s}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],A=t[7],l=t[8],u=l*a-o*A,c=o*s-l*i,h=A*i-a*s,f=e*u+n*c+r*h;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const d=1/f;return t[0]=u*d,t[1]=(r*A-l*n)*d,t[2]=(o*n-r*a)*d,t[3]=c*d,t[4]=(l*e-r*s)*d,t[5]=(r*i-o*e)*d,t[6]=h*d,t[7]=(n*s-A*e)*d,t[8]=(a*e-n*i)*d,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,r,i,a,o){const s=Math.cos(i),A=Math.sin(i);return this.set(n*s,n*A,-n*(s*a+A*o)+a+t,-r*A,r*s,-r*(-A*a+s*o)+o+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),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],A=r[4],l=r[7];return r[0]=e*i+n*s,r[3]=e*a+n*A,r[6]=e*o+n*l,r[1]=-n*i+e*s,r[4]=-n*a+e*A,r[7]=-n*o+e*l,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)}}function nt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}function rt(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function it(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function at(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ot={[B]:{[k]:it},[k]:{[B]:at}},st={legacyMode:!0,get workingColorSpace(){return k},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(ot[e]&&void 0!==ot[e][n]){const r=ot[e][n];return t.r=r(t.r),t.g=r(t.g),t.b=r(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)}},At={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},lt={r:0,g:0,b:0},ut={h:0,s:0,l:0},ct={h:0,s:0,l:0};function ht(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 ft(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class dt{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,st.toWorkingColorSpace(this,e),this}setRGB(t,e,n,r="srgb-linear"){return this.r=t,this.g=e,this.b=n,st.toWorkingColorSpace(this,r),this}setHSL(t,e,n,r="srgb-linear"){if(t=X(t,1),e=Y(e,0,1),n=Y(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=ht(i,r,t+1/3),this.g=ht(i,r,t),this.b=ht(i,r,t-1/3)}return st.toWorkingColorSpace(this,r),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 r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=r[1],a=r[2];switch(i){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,st.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,st.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 r=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,a=parseInt(t[3],10)/100;return n(t[4]),this.setHSL(r,i,a,e)}}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=r[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,st.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,st.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e="srgb"){const n=At[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=it(t.r),this.g=it(t.g),this.b=it(t.b),this}copyLinearToSRGB(t){return this.r=at(t.r),this.g=at(t.g),this.b=at(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t="srgb"){return st.fromWorkingColorSpace(ft(this,lt),t),Y(255*lt.r,0,255)<<16^Y(255*lt.g,0,255)<<8^Y(255*lt.b,0,255)<<0}getHexString(t="srgb"){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e="srgb-linear"){st.fromWorkingColorSpace(ft(this,lt),e);const n=lt.r,r=lt.g,i=lt.b,a=Math.max(n,r,i),o=Math.min(n,r,i);let s,A;const l=(o+a)/2;if(o===a)s=0,A=0;else{const t=a-o;switch(A=l<=.5?t/(a+o):t/(2-a-o),a){case n:s=(r-i)/t+(r<i?6:0);break;case r:s=(i-n)/t+2;break;case i:s=(n-r)/t+4}s/=6}return t.h=s,t.s=A,t.l=l,t}getRGB(t,e="srgb-linear"){return st.fromWorkingColorSpace(ft(this,lt),e),t.r=lt.r,t.g=lt.g,t.b=lt.b,t}getStyle(t="srgb"){return st.fromWorkingColorSpace(ft(this,lt),t),t!==B?`color(${t} ${lt.r} ${lt.g} ${lt.b})`:`rgb(${255*lt.r|0},${255*lt.g|0},${255*lt.b|0})`}offsetHSL(t,e,n){return this.getHSL(ut),ut.h+=t,ut.s+=e,ut.l+=n,this.setHSL(ut.h,ut.s,ut.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(ut),t.getHSL(ct);const n=Z(ut.h,ct.h,e),r=Z(ut.s,ct.s,e),i=Z(ut.l,ct.l,e);return this.setHSL(n,r,i),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}}let pt;dt.NAMES=At;class mt{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===pt&&(pt=rt("canvas")),pt.width=t.width,pt.height=t.height;const n=pt.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=pt}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=rt("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const r=n.getImageData(0,0,t.width,t.height),i=r.data;for(let t=0;t<i.length;t++)i[t]=255*it(i[t]/255);return n.putImageData(r,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*it(e[t]/255)):e[t]=it(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 gt{constructor(t=null){this.isSource=!0,this.uuid=Q(),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:""},r=this.data;if(null!==r){let t;if(Array.isArray(r)){t=[];for(let e=0,n=r.length;e<n;e++)r[e].isDataTexture?t.push(vt(r[e].image)):t.push(vt(r[e]))}else t=vt(r);n.url=t}return e||(t.images[this.uuid]=n),n}}function vt(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?mt.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 xt=0;class yt extends G{constructor(t=yt.DEFAULT_IMAGE,e=yt.DEFAULT_MAPPING,n=1001,r=1001,i=1006,a=1008,o=1023,s=1009,A=1,l=3e3){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:xt++}),this.uuid=Q(),this.name="",this.source=new gt(t),this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=a,this.anisotropy=A,this.format=o,this.internalFormat=null,this.type=s,this.offset=new tt(0,0),this.repeat=new tt(1,1),this.center=new tt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new et,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l,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 m:t.x=t.x-Math.floor(t.x);break;case g:t.x=t.x<0?0:1;break;case v: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 m:t.y=t.y-Math.floor(t.y);break;case g:t.y=t.y<0?0:1;break;case v: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)}}yt.DEFAULT_IMAGE=null,yt.DEFAULT_MAPPING=300;class _t{constructor(t=0,e=0,n=0,r=1){_t.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=r}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,r){return this.x=t,this.y=e,this.z=n,this.w=r,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,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,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,r,i;const a=.01,o=.1,s=t.elements,A=s[0],l=s[4],u=s[8],c=s[1],h=s[5],f=s[9],d=s[2],p=s[6],m=s[10];if(Math.abs(l-c)<a&&Math.abs(u-d)<a&&Math.abs(f-p)<a){if(Math.abs(l+c)<o&&Math.abs(u+d)<o&&Math.abs(f+p)<o&&Math.abs(A+h+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(A+1)/2,s=(h+1)/2,g=(m+1)/2,v=(l+c)/4,x=(u+d)/4,y=(f+p)/4;return t>s&&t>g?t<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(t),r=v/n,i=x/n):s>g?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=y/r):g<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(g),n=x/i,r=y/i),this.set(n,r,i,e),this}let g=Math.sqrt((p-f)*(p-f)+(u-d)*(u-d)+(c-l)*(c-l));return Math.abs(g)<.001&&(g=1),this.x=(p-f)/g,this.y=(u-d)/g,this.z=(c-l)/g,this.w=Math.acos((A+h+m-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 bt extends G{constructor(t,e,n={}){super(),this.isWebGLRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new _t(0,0,t,e),this.scissorTest=!1,this.viewport=new _t(0,0,t,e);const r={width:t,height:e,depth:1};this.texture=new yt(r,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:y,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 gt(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 wt extends yt{constructor(t=null,e=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=x,this.minFilter=x,this.wrapR=g,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Mt extends yt{constructor(t=null,e=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=x,this.minFilter=x,this.wrapR=g,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class St{constructor(t=0,e=0,n=0,r=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=r}static slerpFlat(t,e,n,r,i,a,o){let s=n[r+0],A=n[r+1],l=n[r+2],u=n[r+3];const c=i[a+0],h=i[a+1],f=i[a+2],d=i[a+3];if(0===o)return t[e+0]=s,t[e+1]=A,t[e+2]=l,void(t[e+3]=u);if(1===o)return t[e+0]=c,t[e+1]=h,t[e+2]=f,void(t[e+3]=d);if(u!==d||s!==c||A!==h||l!==f){let t=1-o;const e=s*c+A*h+l*f+u*d,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),a=Math.atan2(i,e*n);t=Math.sin(t*a)/i,o=Math.sin(o*a)/i}const i=o*n;if(s=s*t+c*i,A=A*t+h*i,l=l*t+f*i,u=u*t+d*i,t===1-o){const t=1/Math.sqrt(s*s+A*A+l*l+u*u);s*=t,A*=t,l*=t,u*=t}}t[e]=s,t[e+1]=A,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,i,a){const o=n[r],s=n[r+1],A=n[r+2],l=n[r+3],u=i[a],c=i[a+1],h=i[a+2],f=i[a+3];return t[e]=o*f+l*u+s*h-A*c,t[e+1]=s*f+l*c+A*u-o*h,t[e+2]=A*f+l*h+o*c-s*u,t[e+3]=l*f-o*u-s*c-A*h,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,r){return this._x=t,this._y=e,this._z=n,this._w=r,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,r=t._y,i=t._z,a=t._order,o=Math.cos,s=Math.sin,A=o(n/2),l=o(r/2),u=o(i/2),c=s(n/2),h=s(r/2),f=s(i/2);switch(a){case"XYZ":this._x=c*l*u+A*h*f,this._y=A*h*u-c*l*f,this._z=A*l*f+c*h*u,this._w=A*l*u-c*h*f;break;case"YXZ":this._x=c*l*u+A*h*f,this._y=A*h*u-c*l*f,this._z=A*l*f-c*h*u,this._w=A*l*u+c*h*f;break;case"ZXY":this._x=c*l*u-A*h*f,this._y=A*h*u+c*l*f,this._z=A*l*f+c*h*u,this._w=A*l*u-c*h*f;break;case"ZYX":this._x=c*l*u-A*h*f,this._y=A*h*u+c*l*f,this._z=A*l*f-c*h*u,this._w=A*l*u+c*h*f;break;case"YZX":this._x=c*l*u+A*h*f,this._y=A*h*u+c*l*f,this._z=A*l*f-c*h*u,this._w=A*l*u-c*h*f;break;case"XZY":this._x=c*l*u-A*h*f,this._y=A*h*u-c*l*f,this._z=A*l*f+c*h*u,this._w=A*l*u+c*h*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,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],a=e[1],o=e[5],s=e[9],A=e[2],l=e[6],u=e[10],c=n+o+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-s)*t,this._y=(i-A)*t,this._z=(a-r)*t}else if(n>o&&n>u){const t=2*Math.sqrt(1+n-o-u);this._w=(l-s)/t,this._x=.25*t,this._y=(r+a)/t,this._z=(i+A)/t}else if(o>u){const t=2*Math.sqrt(1+o-n-u);this._w=(i-A)/t,this._x=(r+a)/t,this._y=.25*t,this._z=(s+l)/t}else{const t=2*Math.sqrt(1+u-n-o);this._w=(a-r)/t,this._x=(i+A)/t,this._y=(s+l)/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(Y(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(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,r=t._y,i=t._z,a=t._w,o=e._x,s=e._y,A=e._z,l=e._w;return this._x=n*l+a*o+r*A-i*s,this._y=r*l+a*s+i*o-n*A,this._z=i*l+a*A+n*s-r*o,this._w=a*l-n*o-r*s-i*A,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,a=this._w;let o=a*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;const s=1-o*o;if(s<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const A=Math.sqrt(s),l=Math.atan2(A,o),u=Math.sin((1-e)*l)/A,c=Math.sin(e*l)/A;return this._w=a*u+this._w*c,this._x=n*u+this._x*c,this._y=r*u+this._y*c,this._z=i*u+this._z*c,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),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(e*Math.cos(r),n*Math.sin(i),n*Math.cos(i),e*Math.sin(r))}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 Et{constructor(t=0,e=0,n=0){Et.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(Ct.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Ct.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,a=t.y,o=t.z,s=t.w,A=s*e+a*r-o*n,l=s*n+o*e-i*r,u=s*r+i*n-a*e,c=-i*e-a*n-o*r;return this.x=A*s+c*-i+l*-o-u*-a,this.y=l*s+c*-a+u*-i-A*-o,this.z=u*s+c*-o+A*-a-l*-i,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,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,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,r=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*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 Tt.copy(this).projectOnVector(t),this.sub(Tt)}reflect(t){return this.sub(Tt.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(Y(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}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 r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*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(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,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 Tt=new Et,Ct=new St;class qt{constructor(t=new Et(1/0,1/0,1/0),e=new Et(-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,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(let s=0,A=t.length;s<A;s+=3){const A=t[s],l=t[s+1],u=t[s+2];A<e&&(e=A),l<n&&(n=l),u<r&&(r=u),A>i&&(i=A),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,n,r),this.max.set(i,a,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(let s=0,A=t.count;s<A;s++){const A=t.getX(s),l=t.getY(s),u=t.getZ(s);A<e&&(e=A),l<n&&(n=l),u<r&&(r=u),A>i&&(i=A),l>a&&(a=l),u>o&&(o=u)}return this.min.set(e,n,r),this.max.set(i,a,o),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=Dt.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,r=e.count;n<r;n++)Dt.fromBufferAttribute(e,n).applyMatrix4(t.matrixWorld),this.expandByPoint(Dt)}else null===n.boundingBox&&n.computeBoundingBox(),Lt.copy(n.boundingBox),Lt.applyMatrix4(t.matrixWorld),this.union(Lt);const r=t.children;for(let t=0,n=r.length;t<n;t++)this.expandByObject(r[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,Dt),Dt.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(zt),Nt.subVectors(this.max,zt),Rt.subVectors(t.a,zt),It.subVectors(t.b,zt),Ot.subVectors(t.c,zt),Bt.subVectors(It,Rt),kt.subVectors(Ot,It),Ut.subVectors(Rt,Ot);let e=[0,-Bt.z,Bt.y,0,-kt.z,kt.y,0,-Ut.z,Ut.y,Bt.z,0,-Bt.x,kt.z,0,-kt.x,Ut.z,0,-Ut.x,-Bt.y,Bt.x,0,-kt.y,kt.x,0,-Ut.y,Ut.x,0];return!!Ht(e,Rt,It,Ot,Nt)&&(e=[1,0,0,0,1,0,0,0,1],!!Ht(e,Rt,It,Ot,Nt)&&(Ft.crossVectors(Bt,kt),e=[Ft.x,Ft.y,Ft.z],Ht(e,Rt,It,Ot,Nt)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Dt.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Dt).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()||(Pt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Pt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Pt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Pt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Pt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Pt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Pt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Pt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Pt)),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 Pt=[new Et,new Et,new Et,new Et,new Et,new Et,new Et,new Et],Dt=new Et,Lt=new qt,Rt=new Et,It=new Et,Ot=new Et,Bt=new Et,kt=new Et,Ut=new Et,zt=new Et,Nt=new Et,Ft=new Et,Gt=new Et;function Ht(t,e,n,r,i){for(let a=0,o=t.length-3;a<=o;a+=3){Gt.fromArray(t,a);const o=i.x*Math.abs(Gt.x)+i.y*Math.abs(Gt.y)+i.z*Math.abs(Gt.z),s=e.dot(Gt),A=n.dot(Gt),l=r.dot(Gt);if(Math.max(-Math.max(s,A,l),Math.min(s,A,l))>o)return!1}return!0}const jt=new qt,Vt=new Et,Wt=new Et,Qt=new Et;class Yt{constructor(t=new Et,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 r=0;for(let e=0,i=t.length;e<i;e++)r=Math.max(r,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(r),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){Qt.subVectors(t,this.center);const e=Qt.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(Qt.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return!0===this.center.equals(t.center)?Wt.set(0,0,1).multiplyScalar(t.radius):Wt.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(Vt.copy(t.center).add(Wt)),this.expandByPoint(Vt.copy(t.center).sub(Wt)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Xt=new Et,Zt=new Et,Jt=new Et,Kt=new Et,$t=new Et,te=new Et,ee=new Et;class ne{constructor(t=new Et,e=new Et(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,Xt)),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=Xt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Xt.copy(this.direction).multiplyScalar(e).add(this.origin),Xt.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){Zt.copy(t).add(e).multiplyScalar(.5),Jt.copy(e).sub(t).normalize(),Kt.copy(this.origin).sub(Zt);const i=.5*t.distanceTo(e),a=-this.direction.dot(Jt),o=Kt.dot(this.direction),s=-Kt.dot(Jt),A=Kt.lengthSq(),l=Math.abs(1-a*a);let u,c,h,f;if(l>0)if(u=a*s-o,c=a*o-s,f=i*l,u>=0)if(c>=-f)if(c<=f){const t=1/l;u*=t,c*=t,h=u*(u+a*c+2*o)+c*(a*u+c+2*s)+A}else c=i,u=Math.max(0,-(a*c+o)),h=-u*u+c*(c+2*s)+A;else c=-i,u=Math.max(0,-(a*c+o)),h=-u*u+c*(c+2*s)+A;else c<=-f?(u=Math.max(0,-(-a*i+o)),c=u>0?-i:Math.min(Math.max(-i,-s),i),h=-u*u+c*(c+2*s)+A):c<=f?(u=0,c=Math.min(Math.max(-i,-s),i),h=c*(c+2*s)+A):(u=Math.max(0,-(a*i+o)),c=u>0?i:Math.min(Math.max(-i,-s),i),h=-u*u+c*(c+2*s)+A);else c=a>0?-i:i,u=Math.max(0,-(a*c+o)),h=-u*u+c*(c+2*s)+A;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(Jt).multiplyScalar(c).add(Zt),h}intersectSphere(t,e){Xt.subVectors(t.center,this.origin);const n=Xt.dot(this.direction),r=Xt.dot(Xt)-n*n,i=t.radius*t.radius;if(r>i)return null;const a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,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);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,a,o,s;const A=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,c=this.origin;return A>=0?(n=(t.min.x-c.x)*A,r=(t.max.x-c.x)*A):(n=(t.max.x-c.x)*A,r=(t.min.x-c.x)*A),l>=0?(i=(t.min.y-c.y)*l,a=(t.max.y-c.y)*l):(i=(t.max.y-c.y)*l,a=(t.min.y-c.y)*l),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),u>=0?(o=(t.min.z-c.z)*u,s=(t.max.z-c.z)*u):(o=(t.max.z-c.z)*u,s=(t.min.z-c.z)*u),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,Xt)}intersectTriangle(t,e,n,r,i){$t.subVectors(e,t),te.subVectors(n,t),ee.crossVectors($t,te);let a,o=this.direction.dot(ee);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Kt.subVectors(this.origin,t);const s=a*this.direction.dot(te.crossVectors(Kt,te));if(s<0)return null;const A=a*this.direction.dot($t.cross(Kt));if(A<0)return null;if(s+A>o)return null;const l=-a*Kt.dot(ee);return l<0?null:this.at(l/o,i)}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)}}class re{constructor(){re.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,r,i,a,o,s,A,l,u,c,h,f,d,p){const m=this.elements;return m[0]=t,m[4]=e,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=A,m[6]=l,m[10]=u,m[14]=c,m[3]=h,m[7]=f,m[11]=d,m[15]=p,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 re).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,r=1/ie.setFromMatrixColumn(t,0).length(),i=1/ie.setFromMatrixColumn(t,1).length(),a=1/ie.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,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,r=t.y,i=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),A=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){const t=a*l,n=a*u,r=o*l,i=o*u;e[0]=s*l,e[4]=-s*u,e[8]=A,e[1]=n+r*A,e[5]=t-i*A,e[9]=-o*s,e[2]=i-t*A,e[6]=r+n*A,e[10]=a*s}else if("YXZ"===t.order){const t=s*l,n=s*u,r=A*l,i=A*u;e[0]=t+i*o,e[4]=r*o-n,e[8]=a*A,e[1]=a*u,e[5]=a*l,e[9]=-o,e[2]=n*o-r,e[6]=i+t*o,e[10]=a*s}else if("ZXY"===t.order){const t=s*l,n=s*u,r=A*l,i=A*u;e[0]=t-i*o,e[4]=-a*u,e[8]=r+n*o,e[1]=n+r*o,e[5]=a*l,e[9]=i-t*o,e[2]=-a*A,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){const t=a*l,n=a*u,r=o*l,i=o*u;e[0]=s*l,e[4]=r*A-n,e[8]=t*A+i,e[1]=s*u,e[5]=i*A+t,e[9]=n*A-r,e[2]=-A,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){const t=a*s,n=a*A,r=o*s,i=o*A;e[0]=s*l,e[4]=i-t*u,e[8]=r*u+n,e[1]=u,e[5]=a*l,e[9]=-o*l,e[2]=-A*l,e[6]=n*u+r,e[10]=t-i*u}else if("XZY"===t.order){const t=a*s,n=a*A,r=o*s,i=o*A;e[0]=s*l,e[4]=-u,e[8]=A*l,e[1]=t*u+i,e[5]=a*l,e[9]=n*u-r,e[2]=r*u-n,e[6]=o*l,e[10]=i*u+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(oe,t,se)}lookAt(t,e,n){const r=this.elements;return ue.subVectors(t,e),0===ue.lengthSq()&&(ue.z=1),ue.normalize(),Ae.crossVectors(n,ue),0===Ae.lengthSq()&&(1===Math.abs(n.z)?ue.x+=1e-4:ue.z+=1e-4,ue.normalize(),Ae.crossVectors(n,ue)),Ae.normalize(),le.crossVectors(ue,Ae),r[0]=Ae.x,r[4]=le.x,r[8]=ue.x,r[1]=Ae.y,r[5]=le.y,r[9]=ue.y,r[2]=Ae.z,r[6]=le.z,r[10]=ue.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[4],s=n[8],A=n[12],l=n[1],u=n[5],c=n[9],h=n[13],f=n[2],d=n[6],p=n[10],m=n[14],g=n[3],v=n[7],x=n[11],y=n[15],_=r[0],b=r[4],w=r[8],M=r[12],S=r[1],E=r[5],T=r[9],C=r[13],q=r[2],P=r[6],D=r[10],L=r[14],R=r[3],I=r[7],O=r[11],B=r[15];return i[0]=a*_+o*S+s*q+A*R,i[4]=a*b+o*E+s*P+A*I,i[8]=a*w+o*T+s*D+A*O,i[12]=a*M+o*C+s*L+A*B,i[1]=l*_+u*S+c*q+h*R,i[5]=l*b+u*E+c*P+h*I,i[9]=l*w+u*T+c*D+h*O,i[13]=l*M+u*C+c*L+h*B,i[2]=f*_+d*S+p*q+m*R,i[6]=f*b+d*E+p*P+m*I,i[10]=f*w+d*T+p*D+m*O,i[14]=f*M+d*C+p*L+m*B,i[3]=g*_+v*S+x*q+y*R,i[7]=g*b+v*E+x*P+y*I,i[11]=g*w+v*T+x*D+y*O,i[15]=g*M+v*C+x*L+y*B,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],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],A=t[13],l=t[2],u=t[6],c=t[10],h=t[14];return t[3]*(+i*s*u-r*A*u-i*o*c+n*A*c+r*o*h-n*s*h)+t[7]*(+e*s*h-e*A*c+i*a*c-r*a*h+r*A*l-i*s*l)+t[11]*(+e*A*u-e*o*h-i*a*u+n*a*h+i*o*l-n*A*l)+t[15]*(-r*o*l-e*s*u+e*o*c+r*a*u-n*a*c+n*s*l)}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 r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],A=t[7],l=t[8],u=t[9],c=t[10],h=t[11],f=t[12],d=t[13],p=t[14],m=t[15],g=u*p*A-d*c*A+d*s*h-o*p*h-u*s*m+o*c*m,v=f*c*A-l*p*A-f*s*h+a*p*h+l*s*m-a*c*m,x=l*d*A-f*u*A+f*o*h-a*d*h-l*o*m+a*u*m,y=f*u*s-l*d*s-f*o*c+a*d*c+l*o*p-a*u*p,_=e*g+n*v+r*x+i*y;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/_;return t[0]=g*b,t[1]=(d*c*i-u*p*i-d*r*h+n*p*h+u*r*m-n*c*m)*b,t[2]=(o*p*i-d*s*i+d*r*A-n*p*A-o*r*m+n*s*m)*b,t[3]=(u*s*i-o*c*i-u*r*A+n*c*A+o*r*h-n*s*h)*b,t[4]=v*b,t[5]=(l*p*i-f*c*i+f*r*h-e*p*h-l*r*m+e*c*m)*b,t[6]=(f*s*i-a*p*i-f*r*A+e*p*A+a*r*m-e*s*m)*b,t[7]=(a*c*i-l*s*i+l*r*A-e*c*A-a*r*h+e*s*h)*b,t[8]=x*b,t[9]=(f*u*i-l*d*i-f*n*h+e*d*h+l*n*m-e*u*m)*b,t[10]=(a*d*i-f*o*i+f*n*A-e*d*A-a*n*m+e*o*m)*b,t[11]=(l*o*i-a*u*i-l*n*A+e*u*A+a*n*h-e*o*h)*b,t[12]=y*b,t[13]=(l*d*r-f*u*r+f*n*c-e*d*c-l*n*p+e*u*p)*b,t[14]=(f*o*r-a*d*r-f*n*s+e*d*s+a*n*p-e*o*p)*b,t[15]=(a*u*r-l*o*r+l*n*s-e*u*s-a*n*c+e*o*c)*b,this}scale(t){const e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,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],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}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),r=Math.sin(e),i=1-n,a=t.x,o=t.y,s=t.z,A=i*a,l=i*o;return this.set(A*a+n,A*o-r*s,A*s+r*o,0,A*o+r*s,l*o+n,l*s-r*a,0,A*s-r*o,l*s+r*a,i*s*s+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,r,i,a){return this.set(1,n,i,0,t,1,a,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,a=e._y,o=e._z,s=e._w,A=i+i,l=a+a,u=o+o,c=i*A,h=i*l,f=i*u,d=a*l,p=a*u,m=o*u,g=s*A,v=s*l,x=s*u,y=n.x,_=n.y,b=n.z;return r[0]=(1-(d+m))*y,r[1]=(h+x)*y,r[2]=(f-v)*y,r[3]=0,r[4]=(h-x)*_,r[5]=(1-(c+m))*_,r[6]=(p+g)*_,r[7]=0,r[8]=(f+v)*b,r[9]=(p-g)*b,r[10]=(1-(c+d))*b,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=ie.set(r[0],r[1],r[2]).length();const a=ie.set(r[4],r[5],r[6]).length(),o=ie.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],ae.copy(this);const s=1/i,A=1/a,l=1/o;return ae.elements[0]*=s,ae.elements[1]*=s,ae.elements[2]*=s,ae.elements[4]*=A,ae.elements[5]*=A,ae.elements[6]*=A,ae.elements[8]*=l,ae.elements[9]*=l,ae.elements[10]*=l,e.setFromRotationMatrix(ae),n.x=i,n.y=a,n.z=o,this}makePerspective(t,e,n,r,i,a){const o=this.elements,s=2*i/(e-t),A=2*i/(n-r),l=(e+t)/(e-t),u=(n+r)/(n-r),c=-(a+i)/(a-i),h=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=A,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=c,o[14]=h,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,r,i,a){const o=this.elements,s=1/(e-t),A=1/(n-r),l=1/(a-i),u=(e+t)*s,c=(n+r)*A,h=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*A,o[9]=0,o[13]=-c,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-h,o[3]=0,o[7]=0,o[11]=0,o[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 ie=new Et,ae=new re,oe=new Et(0,0,0),se=new Et(1,1,1),Ae=new Et,le=new Et,ue=new Et,ce=new re,he=new St;class fe{constructor(t=0,e=0,n=0,r=fe.DefaultOrder){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=r}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,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,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 r=t.elements,i=r[0],a=r[4],o=r[8],s=r[1],A=r[5],l=r[9],u=r[2],c=r[6],h=r[10];switch(e){case"XYZ":this._y=Math.asin(Y(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(c,A),this._z=0);break;case"YXZ":this._x=Math.asin(-Y(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,h),this._z=Math.atan2(s,A)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(Y(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-a,A)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-Y(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(c,h),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,A));break;case"YZX":this._z=Math.asin(Y(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,A),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,h));break;case"XZY":this._z=Math.asin(-Y(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(c,A),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,h),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 ce.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ce,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return he.setFromEuler(this),this.setFromQuaternion(he,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")}}fe.DefaultOrder="XYZ",fe.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class de{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))}}let pe=0;const me=new Et,ge=new St,ve=new re,xe=new Et,ye=new Et,_e=new Et,be=new St,we=new Et(1,0,0),Me=new Et(0,1,0),Se=new Et(0,0,1),Ee={type:"added"},Te={type:"removed"};class Ce extends G{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:pe++}),this.uuid=Q(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ce.DefaultUp.clone();const t=new Et,e=new fe,n=new St,r=new Et(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 re},normalMatrix:{value:new et}}),this.matrix=new re,this.matrixWorld=new re,this.matrixAutoUpdate=Ce.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new de,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 ge.setFromAxisAngle(t,e),this.quaternion.multiply(ge),this}rotateOnWorldAxis(t,e){return ge.setFromAxisAngle(t,e),this.quaternion.premultiply(ge),this}rotateX(t){return this.rotateOnAxis(we,t)}rotateY(t){return this.rotateOnAxis(Me,t)}rotateZ(t){return this.rotateOnAxis(Se,t)}translateOnAxis(t,e){return me.copy(t).applyQuaternion(this.quaternion),this.position.add(me.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(we,t)}translateY(t){return this.translateOnAxis(Me,t)}translateZ(t){return this.translateOnAxis(Se,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(ve.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?xe.copy(t):xe.set(t,e,n);const r=this.parent;this.updateWorldMatrix(!0,!1),ye.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ve.lookAt(ye,xe,this.up):ve.lookAt(xe,ye,this.up),this.quaternion.setFromRotationMatrix(ve),r&&(ve.extractRotation(r.matrixWorld),ge.setFromRotationMatrix(ve),this.quaternion.premultiply(ge.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(Ee)):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(Te)),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(Te)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),ve.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),ve.multiply(t.parent.matrixWorld)),t.applyMatrix4(ve),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,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(t,e);if(void 0!==r)return r}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ye,t,_e),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ye,be,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,r=e.length;n<r;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,r=e.length;n<r;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,r=e.length;n<r;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 r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(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,r=n.length;e<r;e++){const r=n[e];i(t.shapes,r)}else i(t.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,r=this.material.length;n<r;n++)e.push(i(t.materials,this.material[n]));r.material=e}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(let e=0;e<this.children.length;e++)r.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];r.animations.push(i(t.animations,n))}}if(e){const e=a(t.geometries),r=a(t.materials),i=a(t.textures),o=a(t.images),s=a(t.shapes),A=a(t.skeletons),l=a(t.animations),u=a(t.nodes);e.length>0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),A.length>0&&(n.skeletons=A),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}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}}Ce.DefaultUp=new Et(0,1,0),Ce.DefaultMatrixAutoUpdate=!0;const qe=new Et,Pe=new Et,De=new Et,Le=new Et,Re=new Et,Ie=new Et,Oe=new Et,Be=new Et,ke=new Et,Ue=new Et;class ze{constructor(t=new Et,e=new Et,n=new Et){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){r.subVectors(n,e),qe.subVectors(t,e),r.cross(qe);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){qe.subVectors(r,e),Pe.subVectors(n,e),De.subVectors(t,e);const a=qe.dot(qe),o=qe.dot(Pe),s=qe.dot(De),A=Pe.dot(Pe),l=Pe.dot(De),u=a*A-o*o;if(0===u)return i.set(-2,-1,-1);const c=1/u,h=(A*s-o*l)*c,f=(a*l-o*s)*c;return i.set(1-h-f,f,h)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,Le),Le.x>=0&&Le.y>=0&&Le.x+Le.y<=1}static getUV(t,e,n,r,i,a,o,s){return this.getBarycoord(t,e,n,r,Le),s.set(0,0),s.addScaledVector(i,Le.x),s.addScaledVector(a,Le.y),s.addScaledVector(o,Le.z),s}static isFrontFacing(t,e,n,r){return qe.subVectors(n,e),Pe.subVectors(t,e),qe.cross(Pe).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),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 qe.subVectors(this.c,this.b),Pe.subVectors(this.a,this.b),.5*qe.cross(Pe).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ze.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ze.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return ze.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return ze.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ze.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,r=this.b,i=this.c;let a,o;Re.subVectors(r,n),Ie.subVectors(i,n),Be.subVectors(t,n);const s=Re.dot(Be),A=Ie.dot(Be);if(s<=0&&A<=0)return e.copy(n);ke.subVectors(t,r);const l=Re.dot(ke),u=Ie.dot(ke);if(l>=0&&u<=l)return e.copy(r);const c=s*u-l*A;if(c<=0&&s>=0&&l<=0)return a=s/(s-l),e.copy(n).addScaledVector(Re,a);Ue.subVectors(t,i);const h=Re.dot(Ue),f=Ie.dot(Ue);if(f>=0&&h<=f)return e.copy(i);const d=h*A-s*f;if(d<=0&&A>=0&&f<=0)return o=A/(A-f),e.copy(n).addScaledVector(Ie,o);const p=l*f-h*u;if(p<=0&&u-l>=0&&h-f>=0)return Oe.subVectors(i,r),o=(u-l)/(u-l+(h-f)),e.copy(r).addScaledVector(Oe,o);const m=1/(p+d+c);return a=d*m,o=c*m,e.copy(n).addScaledVector(Re,a).addScaledVector(Ie,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ne=0;class Fe extends G{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ne++}),this.uuid=Q(),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=h,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=U,this.stencilZFail=U,this.stencilZPass=U,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 r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.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 r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}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=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}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 r=0;r!==t;++r)n[r]=e[r].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 Ge extends Fe{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new dt(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}}const He=new Et,je=new tt;class Ve{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=z,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 r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new dt),e[n++]=i.r,e[n++]=i.g,e[n++]=i.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new tt),e[n++]=i.x,e[n++]=i.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new Et),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new _t),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z,e[n++]=i.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)je.fromBufferAttribute(this,e),je.applyMatrix3(t),this.setXY(e,je.x,je.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)He.fromBufferAttribute(this,e),He.applyMatrix3(t),this.setXYZ(e,He.x,He.y,He.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)He.fromBufferAttribute(this,e),He.applyMatrix4(t),this.setXYZ(e,He.x,He.y,He.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)He.fromBufferAttribute(this,e),He.applyNormalMatrix(t),this.setXYZ(e,He.x,He.y,He.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)He.fromBufferAttribute(this,e),He.transformDirection(t),this.setXYZ(e,He.x,He.y,He.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,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,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),this.usage!==z&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}class We extends Ve{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Qe extends Ve{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Ye extends Ve{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Xe=0;const Ze=new re,Je=new Ce,Ke=new Et,$e=new qt,tn=new qt,en=new Et;class nn extends G{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Xe++}),this.uuid=Q(),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(nt(t)?Qe:We)(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 et).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ze.makeRotationFromQuaternion(t),this.applyMatrix4(Ze),this}rotateX(t){return Ze.makeRotationX(t),this.applyMatrix4(Ze),this}rotateY(t){return Ze.makeRotationY(t),this.applyMatrix4(Ze),this}rotateZ(t){return Ze.makeRotationZ(t),this.applyMatrix4(Ze),this}translate(t,e,n){return Ze.makeTranslation(t,e,n),this.applyMatrix4(Ze),this}scale(t,e,n){return Ze.makeScale(t,e,n),this.applyMatrix4(Ze),this}lookAt(t){return Je.lookAt(t),Je.updateMatrix(),this.applyMatrix4(Je.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ke).negate(),this.translate(Ke.x,Ke.y,Ke.z),this}setFromPoints(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ye(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new qt);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 Et(-1/0,-1/0,-1/0),new Et(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];$e.setFromBufferAttribute(n),this.morphTargetsRelative?(en.addVectors(this.boundingBox.min,$e.min),this.boundingBox.expandByPoint(en),en.addVectors(this.boundingBox.max,$e.max),this.boundingBox.expandByPoint(en)):(this.boundingBox.expandByPoint($e.min),this.boundingBox.expandByPoint($e.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 Yt);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 Et,1/0);if(t){const n=this.boundingSphere.center;if($e.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];tn.setFromBufferAttribute(n),this.morphTargetsRelative?(en.addVectors($e.min,tn.min),$e.expandByPoint(en),en.addVectors($e.max,tn.max),$e.expandByPoint(en)):($e.expandByPoint(tn.min),$e.expandByPoint(tn.max))}$e.getCenter(n);let r=0;for(let e=0,i=t.count;e<i;e++)en.fromBufferAttribute(t,e),r=Math.max(r,n.distanceToSquared(en));if(e)for(let i=0,a=e.length;i<a;i++){const a=e[i],o=this.morphTargetsRelative;for(let e=0,i=a.count;e<i;e++)en.fromBufferAttribute(a,e),o&&(Ke.fromBufferAttribute(t,e),en.add(Ke)),r=Math.max(r,n.distanceToSquared(en))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}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,r=e.position.array,i=e.normal.array,a=e.uv.array,o=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Ve(new Float32Array(4*o),4));const s=this.getAttribute("tangent").array,A=[],l=[];for(let t=0;t<o;t++)A[t]=new Et,l[t]=new Et;const u=new Et,c=new Et,h=new Et,f=new tt,d=new tt,p=new tt,m=new Et,g=new Et;function v(t,e,n){u.fromArray(r,3*t),c.fromArray(r,3*e),h.fromArray(r,3*n),f.fromArray(a,2*t),d.fromArray(a,2*e),p.fromArray(a,2*n),c.sub(u),h.sub(u),d.sub(f),p.sub(f);const i=1/(d.x*p.y-p.x*d.y);isFinite(i)&&(m.copy(c).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(i),g.copy(h).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(i),A[t].add(m),A[e].add(m),A[n].add(m),l[t].add(g),l[e].add(g),l[n].add(g))}let x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(let t=0,e=x.length;t<e;++t){const e=x[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)v(n[t+0],n[t+1],n[t+2])}const y=new Et,_=new Et,b=new Et,w=new Et;function M(t){b.fromArray(i,3*t),w.copy(b);const e=A[t];y.copy(e),y.sub(b.multiplyScalar(b.dot(e))).normalize(),_.crossVectors(w,e);const n=_.dot(l[t])<0?-1:1;s[4*t]=y.x,s[4*t+1]=y.y,s[4*t+2]=y.z,s[4*t+3]=n}for(let t=0,e=x.length;t<e;++t){const e=x[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)M(n[t+0]),M(n[t+1]),M(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 Ve(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 r=new Et,i=new Et,a=new Et,o=new Et,s=new Et,A=new Et,l=new Et,u=new Et;if(t)for(let c=0,h=t.count;c<h;c+=3){const h=t.getX(c+0),f=t.getX(c+1),d=t.getX(c+2);r.fromBufferAttribute(e,h),i.fromBufferAttribute(e,f),a.fromBufferAttribute(e,d),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,h),s.fromBufferAttribute(n,f),A.fromBufferAttribute(n,d),o.add(l),s.add(l),A.add(l),n.setXYZ(h,o.x,o.y,o.z),n.setXYZ(f,s.x,s.y,s.z),n.setXYZ(d,A.x,A.y,A.z)}else for(let t=0,o=e.count;t<o;t+=3)r.fromBufferAttribute(e,t+0),i.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(t+0,l.x,l.y,l.z),n.setXYZ(t+1,l.x,l.y,l.z),n.setXYZ(t+2,l.x,l.y,l.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 r in n){if(void 0===t.attributes[r])continue;const i=n[r].array,a=t.attributes[r],o=a.array,s=a.itemSize*e,A=Math.min(o.length,i.length-s);for(let t=0,e=s;t<A;t++,e++)i[e]=o[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)en.fromBufferAttribute(t,e),en.normalize(),t.setXYZ(e,en.x,en.y,en.z)}toNonIndexed(){function t(t,e){const n=t.array,r=t.itemSize,i=t.normalized,a=new n.constructor(e.length*r);let o=0,s=0;for(let i=0,A=e.length;i<A;i++){o=t.isInterleavedBufferAttribute?e[i]*t.data.stride+t.offset:e[i]*r;for(let t=0;t<r;t++)a[s++]=n[o++]}return new Ve(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new nn,n=this.index.array,r=this.attributes;for(const i in r){const a=t(r[i],n);e.setAttribute(i,a)}const i=this.morphAttributes;for(const r in i){const a=[],o=i[r];for(let e=0,r=o.length;e<r;e++){const r=t(o[e],n);a.push(r)}e.morphAttributes[r]=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 r=n[e];t.data.attributes[e]=r.toJSON(t.data)}const r={};let i=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],a=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];a.push(r.toJSON(t.data))}a.length>0&&(r[e]=a,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.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 r=t.attributes;for(const t in r){const n=r[t];this.setAttribute(t,n.clone(e))}const i=t.morphAttributes;for(const t in i){const n=[],r=i[t];for(let t=0,i=r.length;t<i;t++)n.push(r[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 o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const s=t.boundingSphere;return null!==s&&(this.boundingSphere=s.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 rn=new re,an=new ne,on=new Yt,sn=new Et,An=new Et,ln=new Et,un=new Et,cn=new Et,hn=new Et,fn=new Et,dn=new Et,pn=new Et,mn=new tt,gn=new tt,vn=new tt,xn=new Et,yn=new Et;class _n extends Ce{constructor(t=new nn,e=new Ge){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,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),on.copy(n.boundingSphere),on.applyMatrix4(i),!1===t.ray.intersectsSphere(on))return;if(rn.copy(i).invert(),an.copy(t.ray).applyMatrix4(rn),null!==n.boundingBox&&!1===an.intersectsBox(n.boundingBox))return;let a;const o=n.index,s=n.attributes.position,A=n.morphAttributes.position,l=n.morphTargetsRelative,u=n.attributes.uv,c=n.attributes.uv2,h=n.groups,f=n.drawRange;if(null!==o)if(Array.isArray(r))for(let n=0,i=h.length;n<i;n++){const i=h[n],d=r[i.materialIndex];for(let n=Math.max(i.start,f.start),r=Math.min(o.count,Math.min(i.start+i.count,f.start+f.count));n<r;n+=3){const r=o.getX(n),h=o.getX(n+1),f=o.getX(n+2);a=bn(this,d,t,an,s,A,l,u,c,r,h,f),a&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=i.materialIndex,e.push(a))}}else{for(let n=Math.max(0,f.start),i=Math.min(o.count,f.start+f.count);n<i;n+=3){const i=o.getX(n),h=o.getX(n+1),f=o.getX(n+2);a=bn(this,r,t,an,s,A,l,u,c,i,h,f),a&&(a.faceIndex=Math.floor(n/3),e.push(a))}}else if(void 0!==s)if(Array.isArray(r))for(let n=0,i=h.length;n<i;n++){const i=h[n],o=r[i.materialIndex];for(let n=Math.max(i.start,f.start),r=Math.min(s.count,Math.min(i.start+i.count,f.start+f.count));n<r;n+=3){a=bn(this,o,t,an,s,A,l,u,c,n,n+1,n+2),a&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=i.materialIndex,e.push(a))}}else{for(let n=Math.max(0,f.start),i=Math.min(s.count,f.start+f.count);n<i;n+=3){a=bn(this,r,t,an,s,A,l,u,c,n,n+1,n+2),a&&(a.faceIndex=Math.floor(n/3),e.push(a))}}}}function bn(t,e,n,r,i,a,o,s,A,l,u,c){sn.fromBufferAttribute(i,l),An.fromBufferAttribute(i,u),ln.fromBufferAttribute(i,c);const h=t.morphTargetInfluences;if(a&&h){fn.set(0,0,0),dn.set(0,0,0),pn.set(0,0,0);for(let t=0,e=a.length;t<e;t++){const e=h[t],n=a[t];0!==e&&(un.fromBufferAttribute(n,l),cn.fromBufferAttribute(n,u),hn.fromBufferAttribute(n,c),o?(fn.addScaledVector(un,e),dn.addScaledVector(cn,e),pn.addScaledVector(hn,e)):(fn.addScaledVector(un.sub(sn),e),dn.addScaledVector(cn.sub(An),e),pn.addScaledVector(hn.sub(ln),e)))}sn.add(fn),An.add(dn),ln.add(pn)}t.isSkinnedMesh&&(t.boneTransform(l,sn),t.boneTransform(u,An),t.boneTransform(c,ln));const f=function(t,e,n,r,i,a,o,s){let A;if(A=1===e.side?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,2!==e.side,s),null===A)return null;yn.copy(s),yn.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(yn);return l<n.near||l>n.far?null:{distance:l,point:yn.clone(),object:t}}(t,e,n,r,sn,An,ln,xn);if(f){s&&(mn.fromBufferAttribute(s,l),gn.fromBufferAttribute(s,u),vn.fromBufferAttribute(s,c),f.uv=ze.getUV(xn,sn,An,ln,mn,gn,vn,new tt)),A&&(mn.fromBufferAttribute(A,l),gn.fromBufferAttribute(A,u),vn.fromBufferAttribute(A,c),f.uv2=ze.getUV(xn,sn,An,ln,mn,gn,vn,new tt));const t={a:l,b:u,c:c,normal:new Et,materialIndex:0};ze.getNormal(sn,An,ln,t.normal),f.face=t}return f}class wn extends nn{constructor(t=1,e=1,n=1,r=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};const o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);const s=[],A=[],l=[],u=[];let c=0,h=0;function f(t,e,n,r,i,a,f,d,p,m,g){const v=a/p,x=f/m,y=a/2,_=f/2,b=d/2,w=p+1,M=m+1;let S=0,E=0;const T=new Et;for(let a=0;a<M;a++){const o=a*x-_;for(let s=0;s<w;s++){const c=s*v-y;T[t]=c*r,T[e]=o*i,T[n]=b,A.push(T.x,T.y,T.z),T[t]=0,T[e]=0,T[n]=d>0?1:-1,l.push(T.x,T.y,T.z),u.push(s/p),u.push(1-a/m),S+=1}}for(let t=0;t<m;t++)for(let e=0;e<p;e++){const n=c+e+w*t,r=c+e+w*(t+1),i=c+(e+1)+w*(t+1),a=c+(e+1)+w*t;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(h,E,g),h+=E,c+=S}f("z","y","x",-1,-1,n,e,t,a,i,0),f("z","y","x",1,-1,n,e,-t,a,i,1),f("x","z","y",1,1,t,n,e,r,a,2),f("x","z","y",1,-1,t,n,-e,r,a,3),f("x","y","z",1,-1,t,e,n,r,i,4),f("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(s),this.setAttribute("position",new Ye(A,3)),this.setAttribute("normal",new Ye(l,3)),this.setAttribute("uv",new Ye(u,2))}static fromJSON(t){return new wn(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Mn(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function Sn(t){const e={};for(let n=0;n<t.length;n++){const r=Mn(t[n]);for(const t in r)e[t]=r[t]}return e}const En={clone:Mn,merge:Sn};class Tn extends Fe{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.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=Mn(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 r=this.uniforms[n].value;r&&r.isTexture?e.uniforms[n]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[n]={type:"m4",value:r.toArray()}:e.uniforms[n]={value:r}}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 Cn extends Ce{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new re,this.projectionMatrix=new re,this.projectionMatrixInverse=new re}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 qn extends Cn{constructor(t=50,e=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,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*W*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*V*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*W*Math.atan(Math.tan(.5*V*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,r,i,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=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*V*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const a=this.view;if(null!==this.view&&this.view.enabled){const t=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/t,e-=a.offsetY*n/o,r*=a.width/t,n*=a.height/o}const o=this.filmOffset;0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,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 Pn=90;class Dn extends Ce{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 r=new qn(Pn,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Et(1,0,0)),this.add(r);const i=new qn(Pn,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Et(-1,0,0)),this.add(i);const a=new qn(Pn,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new Et(0,1,0)),this.add(a);const o=new qn(Pn,1,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Et(0,-1,0)),this.add(o);const s=new qn(Pn,1,t,e);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Et(0,0,1)),this.add(s);const A=new qn(Pn,1,t,e);A.layers=this.layers,A.up.set(0,-1,0),A.lookAt(new Et(0,0,-1)),this.add(A)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,a,o,s,A]=this.children,l=t.getRenderTarget(),u=t.toneMapping,c=t.xr.enabled;t.toneMapping=0,t.xr.enabled=!1;const h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,a),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,s),n.texture.generateMipmaps=h,t.setRenderTarget(n,5),t.render(e,A),t.setRenderTarget(l),t.toneMapping=u,t.xr.enabled=c,n.texture.needsPMREMUpdate=!0}}class Ln extends yt{constructor(t,e,n,r,i,a,o,s,A,l){super(t=void 0!==t?t:[],e=void 0!==e?e:f,n,r,i,a,o,s,A,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Rn extends bt{constructor(t,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},r=[n,n,n,n,n,n];this.texture=new Ln(r,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:y}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={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new wn(5,5,5),i=new Tn({name:"CubemapFromEquirect",uniforms:Mn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=e;const a=new _n(r,i),o=e.minFilter;e.minFilter===_&&(e.minFilter=y);return new Dn(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let i=0;i<6;i++)t.setRenderTarget(this,i),t.clear(e,n,r);t.setRenderTarget(i)}}const In=new Et,On=new Et,Bn=new et;class kn{constructor(t=new Et(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,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const r=In.subVectors(n,e).cross(On.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,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(In),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const i=-(t.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:e.copy(n).multiplyScalar(i).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||Bn.getNormalMatrix(t),r=this.coplanarPoint(In).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),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 Un=new Yt,zn=new Et;class Nn{constructor(t=new kn,e=new kn,n=new kn,r=new kn,i=new kn,a=new kn){this.planes=[t,e,n,r,i,a]}set(t,e,n,r,i,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[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,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],A=n[5],l=n[6],u=n[7],c=n[8],h=n[9],f=n[10],d=n[11],p=n[12],m=n[13],g=n[14],v=n[15];return e[0].setComponents(o-r,u-s,d-c,v-p).normalize(),e[1].setComponents(o+r,u+s,d+c,v+p).normalize(),e[2].setComponents(o+i,u+A,d+h,v+m).normalize(),e[3].setComponents(o-i,u-A,d-h,v-m).normalize(),e[4].setComponents(o-a,u-l,d-f,v-g).normalize(),e[5].setComponents(o+a,u+l,d+f,v+g).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Un.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Un)}intersectsSprite(t){return Un.center.set(0,0,0),Un.radius=.7071067811865476,Un.applyMatrix4(t.matrixWorld),this.intersectsSphere(Un)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)<r)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const r=e[n];if(zn.x=r.normal.x>0?t.max.x:t.min.x,zn.y=r.normal.y>0?t.max.y:t.min.y,zn.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(zn)<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 Fn(){let t=null,e=!1,n=null,r=null;function i(e,a){n(e,a),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Gn(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version<e.version)&&r.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const a=r.get(e);void 0===a?r.set(e,function(e,r){const i=e.array,a=e.usage,o=t.createBuffer();let s;if(t.bindBuffer(r,o),t.bufferData(r,i,a),e.onUploadCallback(),i instanceof Float32Array)s=5126;else if(i instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");s=5131}else s=5123;else if(i instanceof Int16Array)s=5122;else if(i instanceof Uint32Array)s=5125;else if(i instanceof Int32Array)s=5124;else if(i instanceof Int8Array)s=5120;else if(i instanceof Uint8Array)s=5121;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);s=5121}return{buffer:o,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(e,i)):a.version<e.version&&(!function(e,r,i){const a=r.array,o=r.updateRange;t.bindBuffer(i,e),-1===o.count?t.bufferSubData(i,0,a):(n?t.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):t.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(a.buffer,e,i),a.version=e.version)}}}class Hn extends nn{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};const i=t/2,a=e/2,o=Math.floor(n),s=Math.floor(r),A=o+1,l=s+1,u=t/o,c=e/s,h=[],f=[],d=[],p=[];for(let t=0;t<l;t++){const e=t*c-a;for(let n=0;n<A;n++){const r=n*u-i;f.push(r,-e,0),d.push(0,0,1),p.push(n/o),p.push(1-t/s)}}for(let t=0;t<s;t++)for(let e=0;e<o;e++){const n=e+A*t,r=e+A*(t+1),i=e+1+A*(t+1),a=e+1+A*t;h.push(n,r,a),h.push(r,i,a)}this.setIndex(h),this.setAttribute("position",new Ye(f,3)),this.setAttribute("normal",new Ye(d,3)),this.setAttribute("uv",new Ye(p,2))}static fromJSON(t){return new Hn(t.width,t.height,t.widthSegments,t.heightSegments)}}const jn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\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\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\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\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\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\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\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\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\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\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\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\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\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\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\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\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\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\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}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\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\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\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\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\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\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\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\t\t#ifndef USE_MORPHNORMALS\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\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = 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\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\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\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\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\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\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\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\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\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <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}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\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}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\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\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <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>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\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}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <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 <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <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>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\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}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\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\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <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}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_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\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <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>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\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}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_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\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\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}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_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\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\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}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\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}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Vn={common:{diffuse:{value:new dt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new et},uv2Transform:{value:new et},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 tt(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 dt(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 dt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new et}},sprite:{diffuse:{value:new dt(16777215)},opacity:{value:1},center:{value:new tt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new et}}},Wn={basic:{uniforms:Sn([Vn.common,Vn.specularmap,Vn.envmap,Vn.aomap,Vn.lightmap,Vn.fog]),vertexShader:jn.meshbasic_vert,fragmentShader:jn.meshbasic_frag},lambert:{uniforms:Sn([Vn.common,Vn.specularmap,Vn.envmap,Vn.aomap,Vn.lightmap,Vn.emissivemap,Vn.fog,Vn.lights,{emissive:{value:new dt(0)}}]),vertexShader:jn.meshlambert_vert,fragmentShader:jn.meshlambert_frag},phong:{uniforms:Sn([Vn.common,Vn.specularmap,Vn.envmap,Vn.aomap,Vn.lightmap,Vn.emissivemap,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,Vn.fog,Vn.lights,{emissive:{value:new dt(0)},specular:{value:new dt(1118481)},shininess:{value:30}}]),vertexShader:jn.meshphong_vert,fragmentShader:jn.meshphong_frag},standard:{uniforms:Sn([Vn.common,Vn.envmap,Vn.aomap,Vn.lightmap,Vn.emissivemap,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,Vn.roughnessmap,Vn.metalnessmap,Vn.fog,Vn.lights,{emissive:{value:new dt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:jn.meshphysical_vert,fragmentShader:jn.meshphysical_frag},toon:{uniforms:Sn([Vn.common,Vn.aomap,Vn.lightmap,Vn.emissivemap,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,Vn.gradientmap,Vn.fog,Vn.lights,{emissive:{value:new dt(0)}}]),vertexShader:jn.meshtoon_vert,fragmentShader:jn.meshtoon_frag},matcap:{uniforms:Sn([Vn.common,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,Vn.fog,{matcap:{value:null}}]),vertexShader:jn.meshmatcap_vert,fragmentShader:jn.meshmatcap_frag},points:{uniforms:Sn([Vn.points,Vn.fog]),vertexShader:jn.points_vert,fragmentShader:jn.points_frag},dashed:{uniforms:Sn([Vn.common,Vn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:jn.linedashed_vert,fragmentShader:jn.linedashed_frag},depth:{uniforms:Sn([Vn.common,Vn.displacementmap]),vertexShader:jn.depth_vert,fragmentShader:jn.depth_frag},normal:{uniforms:Sn([Vn.common,Vn.bumpmap,Vn.normalmap,Vn.displacementmap,{opacity:{value:1}}]),vertexShader:jn.meshnormal_vert,fragmentShader:jn.meshnormal_frag},sprite:{uniforms:Sn([Vn.sprite,Vn.fog]),vertexShader:jn.sprite_vert,fragmentShader:jn.sprite_frag},background:{uniforms:{uvTransform:{value:new et},t2D:{value:null}},vertexShader:jn.background_vert,fragmentShader:jn.background_frag},cube:{uniforms:Sn([Vn.envmap,{opacity:{value:1}}]),vertexShader:jn.cube_vert,fragmentShader:jn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:jn.equirect_vert,fragmentShader:jn.equirect_frag},distanceRGBA:{uniforms:Sn([Vn.common,Vn.displacementmap,{referencePosition:{value:new Et},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:jn.distanceRGBA_vert,fragmentShader:jn.distanceRGBA_frag},shadow:{uniforms:Sn([Vn.lights,Vn.fog,{color:{value:new dt(0)},opacity:{value:1}}]),vertexShader:jn.shadow_vert,fragmentShader:jn.shadow_frag}};function Qn(t,e,n,r,i,a){const o=new dt(0);let s,A,l=!0===i?0:1,u=null,c=0,h=null;function f(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,a)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),l=e,f(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,f(o,l)},render:function(n,i){let a=!1,d=!0===i.isScene?i.background:null;d&&d.isTexture&&(d=e.get(d));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(d=null),null===d?f(o,l):d&&d.isColor&&(f(d,1),a=!0),(t.autoClear||a)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),d&&(d.isCubeTexture||d.mapping===p)?(void 0===A&&(A=new _n(new wn(1,1,1),new Tn({name:"BackgroundCubeMaterial",uniforms:Mn(Wn.cube.uniforms),vertexShader:Wn.cube.vertexShader,fragmentShader:Wn.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),A.geometry.deleteAttribute("uv"),A.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(A.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(A)),A.material.uniforms.envMap.value=d,A.material.uniforms.flipEnvMap.value=d.isCubeTexture&&!1===d.isRenderTargetTexture?-1:1,u===d&&c===d.version&&h===t.toneMapping||(A.material.needsUpdate=!0,u=d,c=d.version,h=t.toneMapping),A.layers.enableAll(),n.unshift(A,A.geometry,A.material,0,0,null)):d&&d.isTexture&&(void 0===s&&(s=new _n(new Hn(2,2),new Tn({name:"BackgroundMaterial",uniforms:Mn(Wn.background.uniforms),vertexShader:Wn.background.vertexShader,fragmentShader:Wn.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=d,!0===d.matrixAutoUpdate&&d.updateMatrix(),s.material.uniforms.uvTransform.value.copy(d.matrix),u===d&&c===d.version&&h===t.toneMapping||(s.material.needsUpdate=!0,u=d,c=d.version,h=t.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null))}}}function Yn(t,e,n,r){const i=t.getParameter(34921),a=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},A=f(null);let l=A,u=!1;function c(e){return r.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function h(e){return r.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function f(t){const e=[],n=[],r=[];for(let t=0;t<i;t++)e[t]=0,n[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function d(){const t=l.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function p(t){m(t,0)}function m(n,i){const a=l.newAttributes,o=l.enabledAttributes,s=l.attributeDivisors;if(a[n]=1,0===o[n]&&(t.enableVertexAttribArray(n),o[n]=1),s[n]!==i){(r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i}}function g(){const e=l.newAttributes,n=l.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function v(e,n,i,a,o,s){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,a,o,s):t.vertexAttribIPointer(e,n,i,o,s)}function x(){y(),u=!0,l!==A&&(l=A,c(l.object))}function y(){A.geometry=null,A.program=null,A.wireframe=!1}return{setup:function(i,A,h,x,y){let _=!1;if(o){const e=function(e,n,i){const o=!0===i.wireframe;let A=s[e.id];void 0===A&&(A={},s[e.id]=A);let l=A[n.id];void 0===l&&(l={},A[n.id]=l);let u=l[o];void 0===u&&(u=f(r.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),l[o]=u);return u}(x,h,A);l!==e&&(l=e,c(l.object)),_=function(t,e,n,r){const i=l.attributes,a=e.attributes;let o=0;const s=n.getAttributes();for(const e in s){if(s[e].location>=0){const n=i[e];let r=a[e];if(void 0===r&&("instanceMatrix"===e&&t.instanceMatrix&&(r=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(r=t.instanceColor)),void 0===n)return!0;if(n.attribute!==r)return!0;if(r&&n.data!==r.data)return!0;o++}}return l.attributesNum!==o||l.index!==r}(i,x,h,y),_&&function(t,e,n,r){const i={},a=e.attributes;let o=0;const s=n.getAttributes();for(const e in s){if(s[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 r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[e]=r,o++}}l.attributes=i,l.attributesNum=o,l.index=r}(i,x,h,y)}else{const t=!0===A.wireframe;l.geometry===x.id&&l.program===h.id&&l.wireframe===t||(l.geometry=x.id,l.program=h.id,l.wireframe=t,_=!0)}null!==y&&n.update(y,34963),(_||u)&&(u=!1,function(i,a,o,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;d();const A=s.attributes,l=o.getAttributes(),u=a.defaultAttributeValues;for(const e in l){const r=l[e];if(r.location>=0){let a=A[e];if(void 0===a&&("instanceMatrix"===e&&i.instanceMatrix&&(a=i.instanceMatrix),"instanceColor"===e&&i.instanceColor&&(a=i.instanceColor)),void 0!==a){const e=a.normalized,o=a.itemSize,A=n.get(a);if(void 0===A)continue;const l=A.buffer,u=A.type,c=A.bytesPerElement;if(a.isInterleavedBufferAttribute){const n=a.data,A=n.stride,h=a.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)m(r.location+t,n.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let t=0;t<r.locationSize;t++)p(r.location+t);t.bindBuffer(34962,l);for(let t=0;t<r.locationSize;t++)v(r.location+t,o/r.locationSize,u,e,A*c,(h+o/r.locationSize*t)*c)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)m(r.location+t,a.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<r.locationSize;t++)p(r.location+t);t.bindBuffer(34962,l);for(let t=0;t<r.locationSize;t++)v(r.location+t,o/r.locationSize,u,e,o*c,o/r.locationSize*t*c)}}else if(void 0!==u){const n=u[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r.location,n);break;case 3:t.vertexAttrib3fv(r.location,n);break;case 4:t.vertexAttrib4fv(r.location,n);break;default:t.vertexAttrib1fv(r.location,n)}}}}g()}(i,A,h,x),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:x,resetDefaultState:y,dispose:function(){x();for(const t in s){const e=s[t];for(const t in e){const n=e[t];for(const t in n)h(n[t].object),delete n[t];delete e[t]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0===s[t.id])return;const e=s[t.id];for(const t in e){const n=e[t];for(const t in n)h(n[t].object),delete n[t];delete e[t]}delete s[t.id]},releaseStatesOfProgram:function(t){for(const e in s){const n=s[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)h(r[t].object),delete r[t];delete n[t.id]}},initAttributes:d,enableAttribute:p,disableUnusedAttributes:g}}function Xn(t,e,n,r){const i=r.isWebGL2;let a;this.setMode=function(t){a=t},this.render=function(e,r){t.drawArrays(a,e,r),n.update(r,a,1)},this.renderInstances=function(r,o,s){if(0===s)return;let A,l;if(i)A=t,l="drawArraysInstanced";else if(A=e.get("ANGLE_instanced_arrays"),l="drawArraysInstancedANGLE",null===A)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");A[l](a,r,o,s),n.update(o,a,s)}}function Zn(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const A=a||e.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,u=t.getParameter(34930),c=t.getParameter(35660),h=t.getParameter(3379),f=t.getParameter(34076),d=t.getParameter(34921),p=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),v=c>0,x=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:A,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:c,maxTextureSize:h,maxCubemapSize:f,maxAttributes:d,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:x,floatVertexTextures:v&&x,maxSamples:a?t.getParameter(36183):0}}function Jn(t){const e=this;let n=null,r=0,i=!1,a=!1;const o=new kn,s=new et,A={value:null,needsUpdate:!1};function l(){A.value!==n&&(A.value=n,A.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(t,n,r,i){const a=null!==t?t.length:0;let l=null;if(0!==a){if(l=A.value,!0!==i||null===l){const e=r+4*a,i=n.matrixWorldInverse;s.getNormalMatrix(i),(null===l||l.length<e)&&(l=new Float32Array(e));for(let e=0,n=r;e!==a;++e,n+=4)o.copy(t[e]).applyMatrix4(i,s),o.normal.toArray(l,n),l[n+3]=o.constant}A.value=l,A.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,l}this.uniform=A,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,a){const o=0!==t.length||e||0!==r||i;return i=e,n=u(t,a,0),r=t.length,o},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1,l()},this.setState=function(e,o,s){const c=e.clippingPlanes,h=e.clipIntersection,f=e.clipShadows,d=t.get(e);if(!i||null===c||0===c.length||a&&!f)a?u(null):l();else{const t=a?0:r,e=4*t;let i=d.clippingState||null;A.value=i,i=u(c,o,e,s);for(let t=0;t!==e;++t)i[t]=n[t];d.clippingState=i,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=t}}}function Kn(t){let e=new WeakMap;function n(t,e){return 303===e?t.mapping=f:304===e&&(t.mapping=d),t}function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){const a=i.mapping;if(303===a||304===a){if(e.has(i)){return n(e.get(i).texture,i.mapping)}{const a=i.image;if(a&&a.height>0){const o=new Rn(a.height/2);return o.fromEquirectangularTexture(t,i),e.set(i,o),i.addEventListener("dispose",r),n(o.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}Wn.physical={uniforms:Sn([Wn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new tt(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 dt(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new tt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new dt(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new dt(1,1,1)},specularColorMap:{value:null}}]),vertexShader:jn.meshphysical_vert,fragmentShader:jn.meshphysical_frag};class $n extends Cn{constructor(t=-1,e=1,n=1,r=-1,i=.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=r,this.near=i,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,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,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,r=(this.top+this.bottom)/2;let i=n-t,a=n+t,o=r+e,s=r-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;i+=t*this.view.offsetX,a=i+t*this.view.width,o-=e*this.view.offsetY,s=o-e*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,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 tr=[.125,.215,.35,.446,.526,.582],er=20,nr=new $n,rr=new dt;let ir=null;const ar=(1+Math.sqrt(5))/2,or=1/ar,sr=[new Et(1,1,1),new Et(-1,1,1),new Et(1,1,-1),new Et(-1,1,-1),new Et(0,ar,or),new Et(0,ar,-or),new Et(or,0,ar),new Et(-or,0,ar),new Et(ar,or,0),new Et(-ar,or,0)];class Ar{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,r=100){ir=this._renderer.getRenderTarget(),this._setSize(256);const i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=hr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=cr(),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(ir),t.scissorTest=!1,ur(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===f||t.mapping===d?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),ir=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:y,minFilter:y,generateMipmaps:!1,type:S,format:T,encoding:I,depthBuffer:!1},r=lr(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=lr(t,e,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],r=[];let i=t;const a=t-4+1+tr.length;for(let o=0;o<a;o++){const a=Math.pow(2,i);n.push(a);let s=1/a;o>t-4?s=tr[o-t+4-1]:0===o&&(s=0),r.push(s);const A=1/(a-2),l=-A,u=1+A,c=[l,l,u,l,u,u,l,l,u,u,l,u],h=6,f=6,d=3,p=2,m=1,g=new Float32Array(d*f*h),v=new Float32Array(p*f*h),x=new Float32Array(m*f*h);for(let t=0;t<h;t++){const e=t%3*2/3-1,n=t>2?0:-1,r=[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];g.set(r,d*f*t),v.set(c,p*f*t);const i=[t,t,t,t,t,t];x.set(i,m*f*t)}const y=new nn;y.setAttribute("position",new Ve(g,d)),y.setAttribute("uv",new Ve(v,p)),y.setAttribute("faceIndex",new Ve(x,m)),e.push(y),i>4&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}(r)),this._blurMaterial=function(t,e,n){const r=new Float32Array(er),i=new Et(0,1,0);return new Tn({name:"SphericalGaussianBlur",defines:{n:er,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:fr(),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})}(r,t,e)}return r}_compileMaterial(t){const e=new _n(this._lodPlanes[0],t);this._renderer.compile(e,nr)}_sceneToCubeUV(t,e,n,r){const i=new qn(90,1,e,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,A=s.autoClear,l=s.toneMapping;s.getClearColor(rr),s.toneMapping=0,s.autoClear=!1;const u=new Ge({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),c=new _n(new wn,u);let h=!1;const f=t.background;f?f.isColor&&(u.color.copy(f),t.background=null,h=!0):(u.color.copy(rr),h=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(i.up.set(0,a[e],0),i.lookAt(o[e],0,0)):1===n?(i.up.set(0,0,a[e]),i.lookAt(0,o[e],0)):(i.up.set(0,a[e],0),i.lookAt(0,0,o[e]));const A=this._cubeSize;ur(r,n*A,e>2?A:0,A,A),s.setRenderTarget(r),h&&s.render(c,i),s.render(t,i)}c.geometry.dispose(),c.material.dispose(),s.toneMapping=l,s.autoClear=A,t.background=f}_textureToCubeUV(t,e){const n=this._renderer,r=t.mapping===f||t.mapping===d;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=hr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=cr());const i=r?this._cubemapMaterial:this._equirectMaterial,a=new _n(this._lodPlanes[0],i);i.uniforms.envMap.value=t;const o=this._cubeSize;ur(e,0,0,3*o,2*o),n.setRenderTarget(e),n.render(a,nr)}_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]),r=sr[(e-1)%sr.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,r,i){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,r,"latitudinal",i),this._halfBlur(a,t,n,n,r,"longitudinal",i)}_halfBlur(t,e,n,r,i,a,o){const s=this._renderer,A=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const l=new _n(this._lodPlanes[r],A),u=A.uniforms,c=this._sizeLods[n]-1,h=isFinite(i)?Math.PI/(2*c):2*Math.PI/39,f=i/h,d=isFinite(i)?1+Math.floor(3*f):er;d>er&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${d} samples when the maximum is set to 20`);const p=[];let m=0;for(let t=0;t<er;++t){const e=t/f,n=Math.exp(-e*e/2);p.push(n),0===t?m+=n:t<d&&(m+=2*n)}for(let t=0;t<p.length;t++)p[t]=p[t]/m;u.envMap.value=t.texture,u.samples.value=d,u.weights.value=p,u.latitudinal.value="latitudinal"===a,o&&(u.poleAxis.value=o);const{_lodMax:g}=this;u.dTheta.value=h,u.mipInt.value=g-n;const v=this._sizeLods[r];ur(e,3*v*(r>g-4?r-g+4:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(e),s.render(l,nr)}}function lr(t,e,n){const r=new bt(t,e,n);return r.texture.mapping=p,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function ur(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function cr(){return new Tn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:fr(),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 hr(){return new Tn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:fr(),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 fr(){return"\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"}function dr(t){let e=new WeakMap,n=null;function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const a=i.mapping,o=303===a||304===a,s=a===f||a===d;if(o||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;let r=e.get(i);return null===n&&(n=new Ar(t)),r=o?n.fromEquirectangular(i,r):n.fromCubemap(i,r),e.set(i,r),r.texture}if(e.has(i))return e.get(i).texture;{const a=i.image;if(o&&a&&a.height>0||s&&a&&function(t){let e=0;const n=6;for(let r=0;r<n;r++)void 0!==t[r]&&e++;return e===n}(a)){null===n&&(n=new Ar(t));const a=o?n.fromEquirectangular(i):n.fromCubemap(i);return e.set(i,a),i.addEventListener("dispose",r),a.texture}return null}}}return i},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function pr(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=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":r=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":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}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 mr(t,e,n,r){const i={},a=new WeakMap;function o(t){const s=t.target;null!==s.index&&e.remove(s.index);for(const t in s.attributes)e.remove(s.attributes[t]);s.removeEventListener("dispose",o),delete i[s.id];const A=a.get(s);A&&(e.remove(A),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t){const n=[],r=t.index,i=t.attributes.position;let o=0;if(null!==r){const t=r.array;o=r.version;for(let e=0,r=t.length;e<r;e+=3){const r=t[e+0],i=t[e+1],a=t[e+2];n.push(r,i,i,a,a,r)}}else{const t=i.array;o=i.version;for(let e=0,r=t.length/3-1;e<r;e+=3){const t=e+0,r=e+1,i=e+2;n.push(t,r,r,i,i,t)}}const s=new(nt(n)?Qe:We)(n,1);s.version=o;const A=a.get(t);A&&e.remove(A),a.set(t,s)}return{get:function(t,e){return!0===i[e.id]||(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const r=t.morphAttributes;for(const t in r){const n=r[t];for(let t=0,r=n.length;t<r;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=a.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&s(t)}else s(t);return a.get(t)}}}function gr(t,e,n,r){const i=r.isWebGL2;let a,o,s;this.setMode=function(t){a=t},this.setIndex=function(t){o=t.type,s=t.bytesPerElement},this.render=function(e,r){t.drawElements(a,r,o,e*s),n.update(r,a,1)},this.renderInstances=function(r,A,l){if(0===l)return;let u,c;if(i)u=t,c="drawElementsInstanced";else if(u=e.get("ANGLE_instanced_arrays"),c="drawElementsInstancedANGLE",null===u)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[c](a,A,o,r*s,l),n.update(A,a,l)}}function vr(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(t,n,r){switch(e.calls++,n){case 4:e.triangles+=r*(t/3);break;case 1:e.lines+=r*(t/2);break;case 3:e.lines+=r*(t-1);break;case 2:e.lines+=r*t;break;case 0:e.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function xr(t,e){return t[0]-e[0]}function yr(t,e){return Math.abs(e[1])-Math.abs(t[1])}function _r(t,e){let n=1;const r=e.isInterleavedBufferAttribute?e.data.array:e.array;r instanceof Int8Array?n=127:r instanceof Uint8Array?n=255:r instanceof Uint16Array?n=65535:r instanceof Int16Array?n=32767:r instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",r),t.divideScalar(n)}function br(t,e,n){const r={},i=new Float32Array(8),a=new WeakMap,o=new _t,s=[];for(let t=0;t<8;t++)s[t]=[t,0];return{update:function(A,l,u,c){const h=A.morphTargetInfluences;if(!0===e.isWebGL2){const f=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,d=void 0!==f?f.length:0;let p=a.get(l);if(void 0===p||p.count!==d){void 0!==p&&p.texture.dispose();const v=void 0!==l.morphAttributes.position,x=void 0!==l.morphAttributes.normal,y=void 0!==l.morphAttributes.color,_=l.morphAttributes.position||[],b=l.morphAttributes.normal||[],w=l.morphAttributes.color||[];let S=0;!0===v&&(S=1),!0===x&&(S=2),!0===y&&(S=3);let E=l.attributes.position.count*S,T=1;E>e.maxTextureSize&&(T=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const C=new Float32Array(E*T*4*d),q=new wt(C,E,T,d);q.type=M,q.needsUpdate=!0;const P=4*S;for(let L=0;L<d;L++){const R=_[L],I=b[L],O=w[L],B=E*T*4*L;for(let k=0;k<R.count;k++){const U=k*P;!0===v&&(o.fromBufferAttribute(R,k),!0===R.normalized&&_r(o,R),C[B+U+0]=o.x,C[B+U+1]=o.y,C[B+U+2]=o.z,C[B+U+3]=0),!0===x&&(o.fromBufferAttribute(I,k),!0===I.normalized&&_r(o,I),C[B+U+4]=o.x,C[B+U+5]=o.y,C[B+U+6]=o.z,C[B+U+7]=0),!0===y&&(o.fromBufferAttribute(O,k),!0===O.normalized&&_r(o,O),C[B+U+8]=o.x,C[B+U+9]=o.y,C[B+U+10]=o.z,C[B+U+11]=4===O.itemSize?o.w:1)}}function D(){q.dispose(),a.delete(l),l.removeEventListener("dispose",D)}p={count:d,texture:q,size:new tt(E,T)},a.set(l,p),l.addEventListener("dispose",D)}let m=0;for(let z=0;z<h.length;z++)m+=h[z];const g=l.morphTargetsRelative?1:1-m;c.getUniforms().setValue(t,"morphTargetBaseInfluence",g),c.getUniforms().setValue(t,"morphTargetInfluences",h),c.getUniforms().setValue(t,"morphTargetsTexture",p.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",p.size)}else{const N=void 0===h?0:h.length;let F=r[l.id];if(void 0===F||F.length!==N){F=[];for(let W=0;W<N;W++)F[W]=[W,0];r[l.id]=F}for(let Q=0;Q<N;Q++){const Y=F[Q];Y[0]=Q,Y[1]=h[Q]}F.sort(yr);for(let X=0;X<8;X++)X<N&&F[X][1]?(s[X][0]=F[X][0],s[X][1]=F[X][1]):(s[X][0]=Number.MAX_SAFE_INTEGER,s[X][1]=0);s.sort(xr);const G=l.morphAttributes.position,H=l.morphAttributes.normal;let j=0;for(let Z=0;Z<8;Z++){const J=s[Z],K=J[0],$=J[1];K!==Number.MAX_SAFE_INTEGER&&$?(G&&l.getAttribute("morphTarget"+Z)!==G[K]&&l.setAttribute("morphTarget"+Z,G[K]),H&&l.getAttribute("morphNormal"+Z)!==H[K]&&l.setAttribute("morphNormal"+Z,H[K]),i[Z]=$,j+=$):(G&&!0===l.hasAttribute("morphTarget"+Z)&&l.deleteAttribute("morphTarget"+Z),H&&!0===l.hasAttribute("morphNormal"+Z)&&l.deleteAttribute("morphNormal"+Z),i[Z]=0)}const V=l.morphTargetsRelative?1:1-j;c.getUniforms().setValue(t,"morphTargetBaseInfluence",V),c.getUniforms().setValue(t,"morphTargetInfluences",i)}}}}function wr(t,e,n,r){let i=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(t){const o=r.render.frame,s=t.geometry,A=e.get(t,s);return i.get(A)!==o&&(e.update(A),i.set(A,o)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",a)&&t.addEventListener("dispose",a),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),A},dispose:function(){i=new WeakMap}}}const Mr=new yt,Sr=new wt,Er=new Mt,Tr=new Ln,Cr=[],qr=[],Pr=new Float32Array(16),Dr=new Float32Array(9),Lr=new Float32Array(4);function Rr(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let a=Cr[i];if(void 0===a&&(a=new Float32Array(i),Cr[i]=a),0!==e){r.toArray(a,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(a,i)}return a}function Ir(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Or(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function Br(t,e){let n=qr[e];void 0===n&&(n=new Int32Array(e),qr[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function kr(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Ur(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(Ir(n,e))return;t.uniform2fv(this.addr,e),Or(n,e)}}function zr(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(Ir(n,e))return;t.uniform3fv(this.addr,e),Or(n,e)}}function Nr(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(Ir(n,e))return;t.uniform4fv(this.addr,e),Or(n,e)}}function Fr(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(Ir(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Or(n,e)}else{if(Ir(n,r))return;Lr.set(r),t.uniformMatrix2fv(this.addr,!1,Lr),Or(n,r)}}function Gr(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(Ir(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Or(n,e)}else{if(Ir(n,r))return;Dr.set(r),t.uniformMatrix3fv(this.addr,!1,Dr),Or(n,r)}}function Hr(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(Ir(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Or(n,e)}else{if(Ir(n,r))return;Pr.set(r),t.uniformMatrix4fv(this.addr,!1,Pr),Or(n,r)}}function jr(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Vr(t,e){const n=this.cache;Ir(n,e)||(t.uniform2iv(this.addr,e),Or(n,e))}function Wr(t,e){const n=this.cache;Ir(n,e)||(t.uniform3iv(this.addr,e),Or(n,e))}function Qr(t,e){const n=this.cache;Ir(n,e)||(t.uniform4iv(this.addr,e),Or(n,e))}function Yr(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Xr(t,e){const n=this.cache;Ir(n,e)||(t.uniform2uiv(this.addr,e),Or(n,e))}function Zr(t,e){const n=this.cache;Ir(n,e)||(t.uniform3uiv(this.addr,e),Or(n,e))}function Jr(t,e){const n=this.cache;Ir(n,e)||(t.uniform4uiv(this.addr,e),Or(n,e))}function Kr(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(e||Mr,i)}function $r(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||Er,i)}function ti(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||Tr,i)}function ei(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Sr,i)}function ni(t,e){t.uniform1fv(this.addr,e)}function ri(t,e){const n=Rr(e,this.size,2);t.uniform2fv(this.addr,n)}function ii(t,e){const n=Rr(e,this.size,3);t.uniform3fv(this.addr,n)}function ai(t,e){const n=Rr(e,this.size,4);t.uniform4fv(this.addr,n)}function oi(t,e){const n=Rr(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function si(t,e){const n=Rr(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Ai(t,e){const n=Rr(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function li(t,e){t.uniform1iv(this.addr,e)}function ui(t,e){t.uniform2iv(this.addr,e)}function ci(t,e){t.uniform3iv(this.addr,e)}function hi(t,e){t.uniform4iv(this.addr,e)}function fi(t,e){t.uniform1uiv(this.addr,e)}function di(t,e){t.uniform2uiv(this.addr,e)}function pi(t,e){t.uniform3uiv(this.addr,e)}function mi(t,e){t.uniform4uiv(this.addr,e)}function gi(t,e,n){const r=e.length,i=Br(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.setTexture2D(e[t]||Mr,i[t])}function vi(t,e,n){const r=e.length,i=Br(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.setTexture3D(e[t]||Er,i[t])}function xi(t,e,n){const r=e.length,i=Br(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.setTextureCube(e[t]||Tr,i[t])}function yi(t,e,n){const r=e.length,i=Br(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.setTexture2DArray(e[t]||Sr,i[t])}class _i{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return kr;case 35664:return Ur;case 35665:return zr;case 35666:return Nr;case 35674:return Fr;case 35675:return Gr;case 35676:return Hr;case 5124:case 35670:return jr;case 35667:case 35671:return Vr;case 35668:case 35672:return Wr;case 35669:case 35673:return Qr;case 5125:return Yr;case 36294:return Xr;case 36295:return Zr;case 36296:return Jr;case 35678:case 36198:case 36298:case 36306:case 35682:return Kr;case 35679:case 36299:case 36307:return $r;case 35680:case 36300:case 36308:case 36293:return ti;case 36289:case 36303:case 36311:case 36292:return ei}}(e.type)}}class bi{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 ni;case 35664:return ri;case 35665:return ii;case 35666:return ai;case 35674:return oi;case 35675:return si;case 35676:return Ai;case 5124:case 35670:return li;case 35667:case 35671:return ui;case 35668:case 35672:return ci;case 35669:case 35673:return hi;case 5125:return fi;case 36294:return di;case 36295:return pi;case 36296:return mi;case 35678:case 36198:case 36298:case 36306:case 35682:return gi;case 35679:case 36299:case 36307:return vi;case 35680:case 36300:case 36308:case 36293:return xi;case 36289:case 36303:case 36311:case 36292:return yi}}(e.type)}}class wi{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const r=this.seq;for(let i=0,a=r.length;i!==a;++i){const a=r[i];a.setValue(t,e[a.id],n)}}}const Mi=/(\w+)(\])?(\[|\.)?/g;function Si(t,e){t.seq.push(e),t.map[e.id]=e}function Ei(t,e,n){const r=t.name,i=r.length;for(Mi.lastIndex=0;;){const a=Mi.exec(r),o=Mi.lastIndex;let s=a[1];const A="]"===a[2],l=a[3];if(A&&(s|=0),void 0===l||"["===l&&o+2===i){Si(n,void 0===l?new _i(s,t,e):new bi(s,t,e));break}{let t=n.map[s];void 0===t&&(t=new wi(s),Si(n,t)),n=t}}}class Ti{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let r=0;r<n;++r){const n=t.getActiveUniform(e,r);Ei(n,t.getUniformLocation(e,n.name),this)}}setValue(t,e,n,r){const i=this.map[e];void 0!==i&&i.setValue(t,n,r)}setOptional(t,e,n){const r=e[n];void 0!==r&&this.setValue(t,n,r)}static upload(t,e,n,r){for(let i=0,a=e.length;i!==a;++i){const a=e[i],o=n[a.id];!1!==o.needsUpdate&&a.setValue(t,o.value,r)}}static seqWithValue(t,e){const n=[];for(let r=0,i=t.length;r!==i;++r){const i=t[r];i.id in e&&n.push(i)}return n}}function Ci(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}let qi=0;function Pi(t,e,n){const r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();if(r&&""===i)return"";const a=/ERROR: 0:(\d+)/.exec(i);if(a){const r=parseInt(a[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(t,e){const n=t.split("\n"),r=[],i=Math.max(e-6,0),a=Math.min(e+6,n.length);for(let t=i;t<a;t++){const i=t+1;r.push(`${i===e?">":" "} ${i}: ${n[t]}`)}return r.join("\n")}(t.getShaderSource(e),r)}return i}function Di(t,e){const n=function(t){switch(t){case I:return["Linear","( value )"];case O: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 Li(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 Ri(t){return""!==t}function Ii(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 Oi(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Bi=/^[ \t]*#include +<([\w\d./]+)>/gm;function ki(t){return t.replace(Bi,Ui)}function Ui(t,e){const n=jn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return ki(n)}const zi=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ni=/#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 Fi(t){return t.replace(Ni,Hi).replace(zi,Gi)}function Gi(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Hi(t,e,n,r)}function Hi(t,e,n,r){let i="";for(let t=parseInt(e);t<parseInt(n);t++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return i}function ji(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 Vi(t,e,n,r){const i=t.getContext(),a=n.defines;let o=n.vertexShader,s=n.fragmentShader;const A=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),l=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case f:case d:e="ENVMAP_TYPE_CUBE";break;case p:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),u=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===d&&(e="ENVMAP_MODE_REFRACTION");return e}(n),c=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),h=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}(n),m=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(Ri).join("\n")}(n),g=function(t){const e=[];for(const n in t){const r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(a),v=i.createProgram();let x,y,_=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(x=[g].filter(Ri).join("\n"),x.length>0&&(x+="\n"),y=[m,g].filter(Ri).join("\n"),y.length>0&&(y+="\n")):(x=[ji(n),"#define SHADER_NAME "+n.shaderName,g,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 "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.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 "+A:"",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(Ri).join("\n"),y=[m,ji(n),"#define SHADER_NAME "+n.shaderName,g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+u:"",n.envMap?"#define "+c:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.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 "+A:"",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?jn.tonemapping_pars_fragment:"",0!==n.toneMapping?Li("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",jn.encodings_pars_fragment,Di("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ri).join("\n")),o=ki(o),o=Ii(o,n),o=Oi(o,n),s=ki(s),s=Ii(s,n),s=Oi(s,n),o=Fi(o),s=Fi(s),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(_="#version 300 es\n",x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+x,y=["#define varying in",n.glslVersion===N?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===N?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+y);const b=_+y+s,w=Ci(i,35633,_+x+o),M=Ci(i,35632,b);if(i.attachShader(v,w),i.attachShader(v,M),void 0!==n.index0AttributeName?i.bindAttribLocation(v,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(v,0,"position"),i.linkProgram(v),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(v).trim(),e=i.getShaderInfoLog(w).trim(),n=i.getShaderInfoLog(M).trim();let r=!0,a=!0;if(!1===i.getProgramParameter(v,35714)){r=!1;const e=Pi(i,w,"vertex"),n=Pi(i,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(v,35715)+"\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:r,programLog:t,vertexShader:{log:e,prefix:x},fragmentShader:{log:n,prefix:y}})}let S,E;return i.deleteShader(w),i.deleteShader(M),this.getUniforms=function(){return void 0===S&&(S=new Ti(i,v)),S},this.getAttributes=function(){return void 0===E&&(E=function(t,e){const n={},r=t.getProgramParameter(e,35721);for(let i=0;i<r;i++){const r=t.getActiveAttrib(e,i),a=r.name;let o=1;35674===r.type&&(o=2),35675===r.type&&(o=3),35676===r.type&&(o=4),n[a]={type:r.type,location:t.getAttribLocation(e,a),locationSize:o}}return n}(i,v)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(v),this.program=void 0},this.name=n.shaderName,this.id=qi++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=w,this.fragmentShader=M,this}let Wi=0;class Qi{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,r=this._getShaderStage(e),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(i)&&(a.add(i),i.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 Yi(t);e.set(t,n)}return e.get(t)}}class Yi{constructor(t){this.id=Wi++,this.code=t,this.usedTimes=0}}function Xi(t,e,n,r,i,a,o){const s=new de,A=new Qi,l=[],u=i.isWebGL2,c=i.logarithmicDepthBuffer,h=i.vertexTextures;let f=i.precision;const d={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,s,l,m,g){const v=m.fog,x=g.geometry,y=a.isMeshStandardMaterial?m.environment:null,_=(a.isMeshStandardMaterial?n:e).get(a.envMap||y),b=_&&_.mapping===p?_.image.height:null,w=d[a.type];null!==a.precision&&(f=i.getMaxPrecision(a.precision),f!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead."));const M=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,S=void 0!==M?M.length:0;let E,T,C,q,P=0;if(void 0!==x.morphAttributes.position&&(P=1),void 0!==x.morphAttributes.normal&&(P=2),void 0!==x.morphAttributes.color&&(P=3),w){const t=Wn[w];E=t.vertexShader,T=t.fragmentShader}else E=a.vertexShader,T=a.fragmentShader,A.update(a),C=A.getVertexShaderID(a),q=A.getFragmentShaderID(a);const D=t.getRenderTarget(),L=a.alphaTest>0,R=a.clearcoat>0,B=a.iridescence>0;return{isWebGL2:u,shaderID:w,shaderName:a.type,vertexShader:E,fragmentShader:T,defines:a.defines,customVertexShaderID:C,customFragmentShaderID:q,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:h,outputEncoding:null===D?t.outputEncoding:!0===D.isXRRenderTarget?D.texture.encoding:I,map:!!a.map,matcap:!!a.matcap,envMap:!!_,envMapMode:_&&_.mapping,envMapCubeUVHeight:b,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===O,clearcoat:R,clearcoatMap:R&&!!a.clearcoatMap,clearcoatRoughnessMap:R&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:R&&!!a.clearcoatNormalMap,iridescence:B,iridescenceMap:B&&!!a.iridescenceMap,iridescenceThicknessMap:B&&!!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:L,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&&!!x.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!x.attributes.color&&4===x.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:!!v,useFog:!0===a.fog,fogExp2:v&&v.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:c,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:S,morphTextureStride:P,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&l.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:u||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||r.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){s.disableAll(),e.isWebGL2&&s.enable(0);e.supportsVertexTextures&&s.enable(1);e.instancing&&s.enable(2);e.instancingColor&&s.enable(3);e.map&&s.enable(4);e.matcap&&s.enable(5);e.envMap&&s.enable(6);e.lightMap&&s.enable(7);e.aoMap&&s.enable(8);e.emissiveMap&&s.enable(9);e.bumpMap&&s.enable(10);e.normalMap&&s.enable(11);e.objectSpaceNormalMap&&s.enable(12);e.tangentSpaceNormalMap&&s.enable(13);e.clearcoat&&s.enable(14);e.clearcoatMap&&s.enable(15);e.clearcoatRoughnessMap&&s.enable(16);e.clearcoatNormalMap&&s.enable(17);e.iridescence&&s.enable(18);e.iridescenceMap&&s.enable(19);e.iridescenceThicknessMap&&s.enable(20);e.displacementMap&&s.enable(21);e.specularMap&&s.enable(22);e.roughnessMap&&s.enable(23);e.metalnessMap&&s.enable(24);e.gradientMap&&s.enable(25);e.alphaMap&&s.enable(26);e.alphaTest&&s.enable(27);e.vertexColors&&s.enable(28);e.vertexAlphas&&s.enable(29);e.vertexUvs&&s.enable(30);e.vertexTangents&&s.enable(31);e.uvsVertexOnly&&s.enable(32);e.fog&&s.enable(33);t.push(s.mask),s.disableAll(),e.useFog&&s.enable(0);e.flatShading&&s.enable(1);e.logarithmicDepthBuffer&&s.enable(2);e.skinning&&s.enable(3);e.morphTargets&&s.enable(4);e.morphNormals&&s.enable(5);e.morphColors&&s.enable(6);e.premultipliedAlpha&&s.enable(7);e.shadowMapEnabled&&s.enable(8);e.physicallyCorrectLights&&s.enable(9);e.doubleSided&&s.enable(10);e.flipSided&&s.enable(11);e.useDepthPacking&&s.enable(12);e.dithering&&s.enable(13);e.specularIntensityMap&&s.enable(14);e.specularColorMap&&s.enable(15);e.transmission&&s.enable(16);e.transmissionMap&&s.enable(17);e.thicknessMap&&s.enable(18);e.sheen&&s.enable(19);e.sheenColorMap&&s.enable(20);e.sheenRoughnessMap&&s.enable(21);e.decodeVideoTexture&&s.enable(22);e.opaque&&s.enable(23);t.push(s.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=d[t.type];let n;if(e){const t=Wn[e];n=En.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let r;for(let t=0,e=l.length;t<e;t++){const e=l[t];if(e.cacheKey===n){r=e,++r.usedTimes;break}}return void 0===r&&(r=new Vi(t,n,e,a),l.push(r)),r},releaseProgram:function(t){if(0==--t.usedTimes){const e=l.indexOf(t);l[e]=l[l.length-1],l.pop(),t.destroy()}},releaseShaderCache:function(t){A.remove(t)},programs:l,dispose:function(){A.dispose()}}}function Zi(){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,r){t.get(e)[n]=r},dispose:function(){t=new WeakMap}}}function Ji(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 Ki(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 $i(){const t=[];let e=0;const n=[],r=[],i=[];function a(n,r,i,a,o,s){let A=t[e];return void 0===A?(A={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},t[e]=A):(A.id=n.id,A.object=n,A.geometry=r,A.material=i,A.groupOrder=a,A.renderOrder=n.renderOrder,A.z=o,A.group=s),e++,A}return{opaque:n,transmissive:r,transparent:i,init:function(){e=0,n.length=0,r.length=0,i.length=0},push:function(t,e,o,s,A,l){const u=a(t,e,o,s,A,l);o.transmission>0?r.push(u):!0===o.transparent?i.push(u):n.push(u)},unshift:function(t,e,o,s,A,l){const u=a(t,e,o,s,A,l);o.transmission>0?r.unshift(u):!0===o.transparent?i.unshift(u):n.unshift(u)},finish:function(){for(let n=e,r=t.length;n<r;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||Ji),r.length>1&&r.sort(e||Ki),i.length>1&&i.sort(e||Ki)}}}function ta(){let t=new WeakMap;return{get:function(e,n){let r;return!1===t.has(e)?(r=new $i,t.set(e,[r])):n>=t.get(e).length?(r=new $i,t.get(e).push(r)):r=t.get(e)[n],r},dispose:function(){t=new WeakMap}}}function ea(){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 Et,color:new dt};break;case"SpotLight":n={position:new Et,direction:new Et,color:new dt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Et,color:new dt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Et,skyColor:new dt,groundColor:new dt};break;case"RectAreaLight":n={color:new dt,position:new Et,halfWidth:new Et,halfHeight:new Et}}return t[e.id]=n,n}}}let na=0;function ra(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function ia(t,e){const n=new ea,r=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 tt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)i.probe.push(new Et);const a=new Et,o=new re,s=new re;return{setup:function(a,o){let s=0,A=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0;a.sort(ra);const v=!0!==o?Math.PI:1;for(let t=0,e=a.length;t<e;t++){const e=a[t],o=e.color,x=e.intensity,y=e.distance,_=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=o.r*x*v,A+=o.g*x*v,l+=o.b*x*v;else if(e.isLightProbe)for(let t=0;t<9;t++)i.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=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.directionalShadow[u]=n,i.directionalShadowMap[u]=_,i.directionalShadowMatrix[u]=e.shadow.matrix,p++}i.directional[u]=t,u++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(o).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=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.spotShadow[h]=n,i.spotShadowMap[h]=_,i.spotShadowMatrix[h]=e.shadow.matrix,g++}i.spot[h]=t,h++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(o).multiplyScalar(x),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),i.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=r.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,i.pointShadow[c]=n,i.pointShadowMap[c]=_,i.pointShadowMatrix[c]=e.shadow.matrix,m++}i.point[c]=t,c++}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),i.hemi[d]=t,d++}}f>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=Vn.LTC_FLOAT_1,i.rectAreaLTC2=Vn.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=Vn.LTC_HALF_1,i.rectAreaLTC2=Vn.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=s,i.ambient[1]=A,i.ambient[2]=l;const x=i.hash;x.directionalLength===u&&x.pointLength===c&&x.spotLength===h&&x.rectAreaLength===f&&x.hemiLength===d&&x.numDirectionalShadows===p&&x.numPointShadows===m&&x.numSpotShadows===g||(i.directional.length=u,i.spot.length=h,i.rectArea.length=f,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=m,i.pointShadowMap.length=m,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=m,i.spotShadowMatrix.length=g,x.directionalLength=u,x.pointLength=c,x.spotLength=h,x.rectAreaLength=f,x.hemiLength=d,x.numDirectionalShadows=p,x.numPointShadows=m,x.numSpotShadows=g,i.version=na++)},setupView:function(t,e){let n=0,r=0,A=0,l=0,u=0;const c=e.matrixWorldInverse;for(let e=0,h=t.length;e<h;e++){const h=t[e];if(h.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(h.matrixWorld),a.setFromMatrixPosition(h.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(c),n++}else if(h.isSpotLight){const t=i.spot[A];t.position.setFromMatrixPosition(h.matrixWorld),t.position.applyMatrix4(c),t.direction.setFromMatrixPosition(h.matrixWorld),a.setFromMatrixPosition(h.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(c),A++}else if(h.isRectAreaLight){const t=i.rectArea[l];t.position.setFromMatrixPosition(h.matrixWorld),t.position.applyMatrix4(c),s.identity(),o.copy(h.matrixWorld),o.premultiply(c),s.extractRotation(o),t.halfWidth.set(.5*h.width,0,0),t.halfHeight.set(0,.5*h.height,0),t.halfWidth.applyMatrix4(s),t.halfHeight.applyMatrix4(s),l++}else if(h.isPointLight){const t=i.point[r];t.position.setFromMatrixPosition(h.matrixWorld),t.position.applyMatrix4(c),r++}else if(h.isHemisphereLight){const t=i.hemi[u];t.direction.setFromMatrixPosition(h.matrixWorld),t.direction.transformDirection(c),u++}}},state:i}}function aa(t,e){const n=new ia(t,e),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(t){n.setup(r,t)},setupLightsView:function(t){n.setupView(r,t)},pushLight:function(t){r.push(t)},pushShadow:function(t){i.push(t)}}}function oa(t,e){let n=new WeakMap;return{get:function(r,i=0){let a;return!1===n.has(r)?(a=new aa(t,e),n.set(r,[a])):i>=n.get(r).length?(a=new aa(t,e),n.get(r).push(a)):a=n.get(r)[i],a},dispose:function(){n=new WeakMap}}}class sa extends Fe{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 Aa extends Fe{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Et,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 la(t,e,n){let r=new Nn;const i=new tt,a=new tt,o=new _t,s=new sa({depthPacking:3201}),A=new Aa,l={},u=n.maxTextureSize,c={0:1,1:0,2:2},h=new Tn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new tt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const d=new nn;d.setAttribute("position",new Ve(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const p=new _n(d,h),m=this;function g(n,r){const a=e.update(p);h.defines.VSM_SAMPLES!==n.blurSamples&&(h.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new bt(i.x,i.y)),h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,a,h,p,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(r,null,a,f,p,null)}function v(e,n,r,i,a,o){let u=null;const h=!0===r.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(u=void 0!==h?h:!0===r.isPointLight?A:s,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=u.uuid,e=n.uuid;let r=l[t];void 0===r&&(r={},l[t]=r);let i=r[e];void 0===i&&(i=u.clone(),r[e]=i),u=i}return u.visible=n.visible,u.wireframe=n.wireframe,u.side=3===o?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:c[n.side],u.alphaMap=n.alphaMap,u.alphaTest=n.alphaTest,u.clipShadows=n.clipShadows,u.clippingPlanes=n.clippingPlanes,u.clipIntersection=n.clipIntersection,u.displacementMap=n.displacementMap,u.displacementScale=n.displacementScale,u.displacementBias=n.displacementBias,u.wireframeLinewidth=n.wireframeLinewidth,u.linewidth=n.linewidth,!0===r.isPointLight&&!0===u.isMeshDistanceMaterial&&(u.referencePosition.setFromMatrixPosition(r.matrixWorld),u.nearDistance=i,u.farDistance=a),u}function y(n,i,a,o,s){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let A=0,l=e.length;A<l;A++){const l=e[A],u=i[l.materialIndex];if(u&&u.visible){const e=v(n,u,o,a.near,a.far,s);t.renderBufferDirect(a,null,r,e,n,l)}}}else if(i.visible){const e=v(n,i,o,a.near,a.far,s);t.renderBufferDirect(a,null,r,e,n,null)}}const A=n.children;for(let t=0,e=A.length;t<e;t++)y(A[t],i,a,o,s)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,s){if(!1===m.enabled)return;if(!1===m.autoUpdate&&!1===m.needsUpdate)return;if(0===e.length)return;const A=t.getRenderTarget(),l=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),h=t.state;h.setBlending(0),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(let A=0,l=e.length;A<l;A++){const l=e[A],c=l.shadow;if(void 0===c){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;i.copy(c.mapSize);const f=c.getFrameExtents();if(i.multiply(f),a.copy(c.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/f.x),i.x=a.x*f.x,c.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/f.y),i.y=a.y*f.y,c.mapSize.y=a.y)),null===c.map){const t=3!==this.type?{minFilter:x,magFilter:x}:{};c.map=new bt(i.x,i.y,t),c.map.texture.name=l.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const d=c.getViewportCount();for(let t=0;t<d;t++){const e=c.getViewport(t);o.set(a.x*e.x,a.y*e.y,a.x*e.z,a.y*e.w),h.viewport(o),c.updateMatrices(l,t),r=c.getFrustum(),y(n,s,c.camera,l,this.type)}!0!==c.isPointLightShadow&&3===this.type&&g(c,s),c.needsUpdate=!1}m.needsUpdate=!1,t.setRenderTarget(A,l,c)}}function ua(t,e,n){const r=n.isWebGL2;const i=new function(){let e=!1;const n=new _t;let r=null;const i=new _t(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,a,o,s){!0===s&&(e*=o,r*=o,a*=o),n.set(e,r,a,o),!1===i.equals(n)&&(t.clearColor(e,r,a,o),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},a=new function(){let e=!1,n=null,r=null,i=null;return{setTest:function(t){t?F(2929):G(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},o=new function(){let e=!1,n=null,r=null,i=null,a=null,o=null,s=null,A=null,l=null;return{setTest:function(t){e||(t?F(2960):G(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,o){r===e&&i===n&&a===o||(t.stencilFunc(e,n,o),r=e,i=n,a=o)},setOp:function(e,n,r){o===e&&s===n&&A===r||(t.stencilOp(e,n,r),o=e,s=n,A=r)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,n=null,r=null,i=null,a=null,o=null,s=null,A=null,l=null}}},s=new WeakMap,A=new WeakMap;let l={},u={},c=new WeakMap,f=[],d=null,p=!1,m=null,g=null,v=null,x=null,y=null,_=null,b=null,w=!1,M=null,S=null,E=null,T=null,C=null;const q=t.getParameter(35661);let P=!1,D=0;const L=t.getParameter(7938);-1!==L.indexOf("WebGL")?(D=parseFloat(/^WebGL (\d)/.exec(L)[1]),P=D>=1):-1!==L.indexOf("OpenGL ES")&&(D=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),P=D>=2);let R=null,I={};const O=t.getParameter(3088),B=t.getParameter(2978),k=(new _t).fromArray(O),U=(new _t).fromArray(B);function z(e,n,r){const i=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<r;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,i);return a}const N={};function F(e){!0!==l[e]&&(t.enable(e),l[e]=!0)}function G(e){!1!==l[e]&&(t.disable(e),l[e]=!1)}N[3553]=z(3553,3553,1),N[34067]=z(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),o.setClear(0),F(2929),a.setFunc(3),W(!1),Q(1),F(2884),V(0);const H={[h]:32774,101:32778,102:32779};if(r)H[103]=32775,H[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(H[103]=t.MIN_EXT,H[104]=t.MAX_EXT)}const j={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function V(e,n,r,i,a,o,s,A){if(0!==e){if(!1===p&&(F(3042),p=!0),5===e)a=a||n,o=o||r,s=s||i,n===g&&a===y||(t.blendEquationSeparate(H[n],H[a]),g=n,y=a),r===v&&i===x&&o===_&&s===b||(t.blendFuncSeparate(j[r],j[i],j[o],j[s]),v=r,x=i,_=o,b=s),m=e,w=null;else if(e!==m||A!==w){if(g===h&&y===h||(t.blendEquation(32774),g=h,y=h),A)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}v=null,x=null,_=null,b=null,m=e,w=A}}else!0===p&&(G(3042),p=!1)}function W(e){M!==e&&(e?t.frontFace(2304):t.frontFace(2305),M=e)}function Q(e){0!==e?(F(2884),e!==S&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):G(2884),S=e}function Y(e,n,r){e?(F(32823),T===n&&C===r||(t.polygonOffset(n,r),T=n,C=r)):G(32823)}function X(e){void 0===e&&(e=33984+q-1),R!==e&&(t.activeTexture(e),R=e)}return{buffers:{color:i,depth:a,stencil:o},enable:F,disable:G,bindFramebuffer:function(e,n){return u[e]!==n&&(t.bindFramebuffer(e,n),u[e]=n,r&&(36009===e&&(u[36160]=n),36160===e&&(u[36009]=n)),!0)},drawBuffers:function(r,i){let a=f,o=!1;if(r)if(a=c.get(i),void 0===a&&(a=[],c.set(i,a)),r.isWebGLMultipleRenderTargets){const t=r.texture;if(a.length!==t.length||36064!==a[0]){for(let e=0,n=t.length;e<n;e++)a[e]=36064+e;a.length=t.length,o=!0}}else 36064!==a[0]&&(a[0]=36064,o=!0);else 1029!==a[0]&&(a[0]=1029,o=!0);o&&(n.isWebGL2?t.drawBuffers(a):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(e){return d!==e&&(t.useProgram(e),d=e,!0)},setBlending:V,setMaterial:function(t,e){2===t.side?G(2884):F(2884);let n=1===t.side;e&&(n=!n),W(n),1===t.blending&&!1===t.transparent?V(0):V(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),i.setMask(t.colorWrite);const r=t.stencilWrite;o.setTest(r),r&&(o.setMask(t.stencilWriteMask),o.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),o.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Y(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?F(32926):G(32926)},setFlipSided:W,setCullFace:Q,setLineWidth:function(e){e!==E&&(P&&t.lineWidth(e),E=e)},setPolygonOffset:Y,setScissorTest:function(t){t?F(3089):G(3089)},activeTexture:X,bindTexture:function(e,n){null===R&&X();let r=I[R];void 0===r&&(r={type:void 0,texture:void 0},I[R]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||N[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=I[R];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 r=A.get(n);void 0===r&&(r=new WeakMap,A.set(n,r));let i=r.get(e);void 0===i&&(i=t.getUniformBlockIndex(n,e.name),r.set(e,i))},uniformBlockBinding:function(e,n){const r=A.get(n).get(e);s.get(e)!==r&&(t.uniformBlockBinding(n,r,e.__bindingPointIndex),s.set(e,r))},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===k.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),k.copy(e))},viewport:function(e){!1===U.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),U.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===r&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,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),l={},R=null,I={},u={},c=new WeakMap,f=[],d=null,p=!1,m=null,g=null,v=null,x=null,y=null,_=null,b=null,w=!1,M=null,S=null,E=null,T=null,C=null,k.set(0,0,t.canvas.width,t.canvas.height),U.set(0,0,t.canvas.width,t.canvas.height),i.reset(),a.reset(),o.reset()}}}function ca(t,e,n,r,i,a,o){const s=i.isWebGL2,A=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,c=i.maxSamples,h=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,f=/OculusBrowser/g.test(navigator.userAgent),d=new WeakMap;let p;const P=new WeakMap;let D=!1;try{D="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function L(t,e){return D?new OffscreenCanvas(t,e):rt("canvas")}function R(t,e,n,r){let i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?K:Math.floor,a=r(i*t.width),o=r(i*t.height);void 0===p&&(p=L(a,o));const s=n?L(a,o):p;s.width=a,s.height=o;return s.getContext("2d").drawImage(t,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+o+")."),s}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 J(t.width)&&J(t.height)}function k(t,e){return t.generateMipmaps&&e&&t.minFilter!==x&&t.minFilter!==y}function U(e){t.generateMipmap(e)}function z(n,r,i,a,o=!1){if(!1===s)return r;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 A=r;return 6403===r&&(5126===i&&(A=33326),5131===i&&(A=33325),5121===i&&(A=33321)),33319===r&&(5126===i&&(A=33328),5131===i&&(A=33327),5121===i&&(A=33323)),6408===r&&(5126===i&&(A=34836),5131===i&&(A=34842),5121===i&&(A=a===O&&!1===o?35907:32856),32819===i&&(A=32854),32820===i&&(A=32855)),33325!==A&&33326!==A&&33327!==A&&33328!==A&&34842!==A&&34836!==A||e.get("EXT_color_buffer_float"),A}function N(t,e,n){return!0===k(t,n)||t.isFramebufferTexture&&t.minFilter!==x&&t.minFilter!==y?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 G(t){return t===x||1004===t||1005===t?9728:9729}function H(t){const e=t.target;e.removeEventListener("dispose",H),function(t){const e=r.get(t);if(void 0===e.__webglInit)return;const n=t.source,i=P.get(n);if(i){const r=i[e.__cacheKey];r.usedTimes--,0===r.usedTimes&&V(t),0===Object.keys(i).length&&P.delete(n)}r.remove(t)}(e),e.isVideoTexture&&d.delete(e)}function j(e){const n=e.target;n.removeEventListener("dispose",j),function(e){const n=e.texture,i=r.get(e),a=r.get(n);void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),o.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e]);else{if(t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let e=0;e<i.__webglColorRenderbuffer.length;e++)i.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(i.__webglColorRenderbuffer[e]);i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer)}if(e.isWebGLMultipleRenderTargets)for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),o.memory.textures--),r.remove(n[e])}r.remove(n),r.remove(e)}(n)}function V(e){const n=r.get(e);t.deleteTexture(n.__webglTexture);const i=e.source;delete P.get(i)[n.__cacheKey],o.memory.textures--}let W=0;function Q(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=o.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&i.__version!==t.version){const n=t.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void tt(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}const Y={[m]:10497,[g]:33071,[v]:33648},X={[x]:9728,1004:9984,1005:9986,[y]:9729,1007:9985,[_]:9987};function Z(n,a,o){if(o?(t.texParameteri(n,10242,Y[a.wrapS]),t.texParameteri(n,10243,Y[a.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,Y[a.wrapR]),t.texParameteri(n,10240,X[a.magFilter]),t.texParameteri(n,10241,X[a.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),a.wrapS===g&&a.wrapT===g||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,G(a.magFilter)),t.texParameteri(n,10241,G(a.minFilter)),a.minFilter!==x&&a.minFilter!==y&&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 o=e.get("EXT_texture_filter_anisotropic");if(a.type===M&&!1===e.has("OES_texture_float_linear"))return;if(!1===s&&a.type===S&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function $(e,n){let r=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",H));const i=n.source;let a=P.get(i);void 0===a&&(a={},P.set(i,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},o.memory.textures++,r=!0),a[s].usedTimes++;const i=a[e.__cacheKey];void 0!==i&&(a[e.__cacheKey].usedTimes--,0===i.usedTimes&&V(n)),e.__cacheKey=s,e.__webglTexture=a[s].texture}return r}function tt(e,r,i){let o=3553;r.isDataArrayTexture&&(o=35866),r.isData3DTexture&&(o=32879);const A=$(e,r),l=r.source;if(n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),l.version!==l.__currentVersion||!0===A){t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const e=function(t){return!s&&(t.wrapS!==g||t.wrapT!==g||t.minFilter!==x&&t.minFilter!==y)}(r)&&!1===B(r.image);let i=R(r.image,e,!1,u);i=st(r,i);const c=B(i)||s,h=a.convert(r.format,r.encoding);let f,d=a.convert(r.type),p=z(r.internalFormat,h,d,r.encoding,r.isVideoTexture);Z(o,r,c);const m=r.mipmaps,v=s&&!0!==r.isVideoTexture,_=void 0===l.__currentVersion||!0===A,b=N(r,i,c);if(r.isDepthTexture)p=6402,s?p=r.type===M?36012:r.type===w?33190:r.type===E?35056:33189:r.type===M&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===C&&6402===p&&1012!==r.type&&r.type!==w&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=w,d=a.convert(r.type)),r.format===q&&6402===p&&(p=34041,r.type!==E&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=E,d=a.convert(r.type))),_&&(v?n.texStorage2D(3553,1,p,i.width,i.height):n.texImage2D(3553,0,p,i.width,i.height,0,h,d,null));else if(r.isDataTexture)if(m.length>0&&c){v&&_&&n.texStorage2D(3553,b,p,m[0].width,m[0].height);for(let t=0,e=m.length;t<e;t++)f=m[t],v?n.texSubImage2D(3553,t,0,0,f.width,f.height,h,d,f.data):n.texImage2D(3553,t,p,f.width,f.height,0,h,d,f.data);r.generateMipmaps=!1}else v?(_&&n.texStorage2D(3553,b,p,i.width,i.height),n.texSubImage2D(3553,0,0,0,i.width,i.height,h,d,i.data)):n.texImage2D(3553,0,p,i.width,i.height,0,h,d,i.data);else if(r.isCompressedTexture){v&&_&&n.texStorage2D(3553,b,p,m[0].width,m[0].height);for(let t=0,e=m.length;t<e;t++)f=m[t],r.format!==T?null!==h?v?n.compressedTexSubImage2D(3553,t,0,0,f.width,f.height,h,f.data):n.compressedTexImage2D(3553,t,p,f.width,f.height,0,f.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):v?n.texSubImage2D(3553,t,0,0,f.width,f.height,h,d,f.data):n.texImage2D(3553,t,p,f.width,f.height,0,h,d,f.data)}else if(r.isDataArrayTexture)v?(_&&n.texStorage3D(35866,b,p,i.width,i.height,i.depth),n.texSubImage3D(35866,0,0,0,0,i.width,i.height,i.depth,h,d,i.data)):n.texImage3D(35866,0,p,i.width,i.height,i.depth,0,h,d,i.data);else if(r.isData3DTexture)v?(_&&n.texStorage3D(32879,b,p,i.width,i.height,i.depth),n.texSubImage3D(32879,0,0,0,0,i.width,i.height,i.depth,h,d,i.data)):n.texImage3D(32879,0,p,i.width,i.height,i.depth,0,h,d,i.data);else if(r.isFramebufferTexture){if(_)if(v)n.texStorage2D(3553,b,p,i.width,i.height);else{let t=i.width,e=i.height;for(let r=0;r<b;r++)n.texImage2D(3553,r,p,t,e,0,h,d,null),t>>=1,e>>=1}}else if(m.length>0&&c){v&&_&&n.texStorage2D(3553,b,p,m[0].width,m[0].height);for(let t=0,e=m.length;t<e;t++)f=m[t],v?n.texSubImage2D(3553,t,0,0,h,d,f):n.texImage2D(3553,t,p,h,d,f);r.generateMipmaps=!1}else v?(_&&n.texStorage2D(3553,b,p,i.width,i.height),n.texSubImage2D(3553,0,0,0,h,d,i)):n.texImage2D(3553,0,p,h,d,i);k(r,c)&&U(o),l.__currentVersion=l.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}function et(e,i,o,s,A){const l=a.convert(o.format,o.encoding),u=a.convert(o.type),c=z(o.internalFormat,l,u,o.encoding);r.get(i).__hasExternalTextures||(32879===A||35866===A?n.texImage3D(A,0,c,i.width,i.height,i.depth,0,l,u,null):n.texImage2D(A,0,c,i.width,i.height,0,l,u,null)),n.bindFramebuffer(36160,e),ot(i)?h.framebufferTexture2DMultisampleEXT(36160,s,A,r.get(o).__webglTexture,0,at(i)):t.framebufferTexture2D(36160,s,A,r.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function nt(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r||ot(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===M?i=36012:e.type===w&&(i=33190));const r=at(n);ot(n)?h.renderbufferStorageMultisampleEXT(36161,r,i,n.width,n.height):t.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){const i=at(n);r&&!1===ot(n)?t.renderbufferStorageMultisample(36161,i,35056,n.width,n.height):ot(n)?h.renderbufferStorageMultisampleEXT(36161,i,35056,n.width,n.height):t.renderbufferStorage(36161,34041,n.width,n.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let i=0;i<e.length;i++){const o=e[i],s=a.convert(o.format,o.encoding),A=a.convert(o.type),l=z(o.internalFormat,s,A,o.encoding),u=at(n);r&&!1===ot(n)?t.renderbufferStorageMultisample(36161,u,l,n.width,n.height):ot(n)?h.renderbufferStorageMultisampleEXT(36161,u,l,n.width,n.height):t.renderbufferStorage(36161,l,n.width,n.height)}}t.bindRenderbuffer(36161,null)}function it(e){const i=r.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),Q(i.depthTexture,0);const a=r.get(i.depthTexture).__webglTexture,o=at(i);if(i.depthTexture.format===C)ot(i)?h.framebufferTexture2DMultisampleEXT(36160,36096,3553,a,0,o):t.framebufferTexture2D(36160,36096,3553,a,0);else{if(i.depthTexture.format!==q)throw new Error("Unknown depthTexture format");ot(i)?h.framebufferTexture2DMultisampleEXT(36160,33306,3553,a,0,o):t.framebufferTexture2D(36160,33306,3553,a,0)}}(i.__webglFramebuffer,e)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)n.bindFramebuffer(36160,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]=t.createRenderbuffer(),nt(i.__webglDepthbuffer[r],e,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),nt(i.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function at(t){return Math.min(c,t.samples)}function ot(t){const n=r.get(t);return s&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function st(t,n){const r=t.encoding,i=t.format,a=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===F||r!==I&&(r===O?!1===s?!0===e.has("EXT_sRGB")&&i===T?(t.format=F,t.minFilter=y,t.generateMipmaps=!1):n=mt.sRGBToLinear(n):i===T&&a===b||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),n}this.allocateTextureUnit=function(){const t=W;return t>=A&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+A),W+=1,t},this.resetTextureUnits=function(){W=0},this.setTexture2D=Q,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?tt(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?tt(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=function(e,i){const o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;const o=$(e,r),A=r.source;if(n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),A.version!==A.__currentVersion||!0===o){t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const e=r.isCompressedTexture||r.image[0].isCompressedTexture,i=r.image[0]&&r.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=e||i?i?r.image[t].image:r.image[t]:R(r.image[t],!1,!0,l),u[t]=st(r,u[t]);const c=u[0],h=B(c)||s,f=a.convert(r.format,r.encoding),d=a.convert(r.type),p=z(r.internalFormat,f,d,r.encoding),m=s&&!0!==r.isVideoTexture,g=void 0===A.__currentVersion||!0===o;let v,x=N(r,c,h);if(Z(34067,r,h),e){m&&g&&n.texStorage2D(34067,x,p,c.width,c.height);for(let t=0;t<6;t++){v=u[t].mipmaps;for(let e=0;e<v.length;e++){const i=v[e];r.format!==T?null!==f?m?n.compressedTexSubImage2D(34069+t,e,0,0,i.width,i.height,f,i.data):n.compressedTexImage2D(34069+t,e,p,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):m?n.texSubImage2D(34069+t,e,0,0,i.width,i.height,f,d,i.data):n.texImage2D(34069+t,e,p,i.width,i.height,0,f,d,i.data)}}}else{v=r.mipmaps,m&&g&&(v.length>0&&x++,n.texStorage2D(34067,x,p,u[0].width,u[0].height));for(let t=0;t<6;t++)if(i){m?n.texSubImage2D(34069+t,0,0,0,u[t].width,u[t].height,f,d,u[t].data):n.texImage2D(34069+t,0,p,u[t].width,u[t].height,0,f,d,u[t].data);for(let e=0;e<v.length;e++){const r=v[e].image[t].image;m?n.texSubImage2D(34069+t,e+1,0,0,r.width,r.height,f,d,r.data):n.texImage2D(34069+t,e+1,p,r.width,r.height,0,f,d,r.data)}}else{m?n.texSubImage2D(34069+t,0,0,0,f,d,u[t]):n.texImage2D(34069+t,0,p,f,d,u[t]);for(let e=0;e<v.length;e++){const r=v[e];m?n.texSubImage2D(34069+t,e+1,0,0,f,d,r.image[t]):n.texImage2D(34069+t,e+1,p,f,d,r.image[t])}}}k(r,h)&&U(34067),A.__currentVersion=A.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}(o,e,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(t,e,n){const i=r.get(t);void 0!==e&&et(i.__webglFramebuffer,t,t.texture,36064,3553),void 0!==n&&it(t)},this.setupRenderTarget=function(e){const A=e.texture,l=r.get(e),u=r.get(A);e.addEventListener("dispose",j),!0!==e.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=t.createTexture()),u.__version=A.version,o.memory.textures++);const c=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultipleRenderTargets,f=B(e)||s;if(c){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else{if(l.__webglFramebuffer=t.createFramebuffer(),h)if(i.drawBuffers){const n=e.texture;for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);void 0===i.__webglTexture&&(i.__webglTexture=t.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(s&&e.samples>0&&!1===ot(e)){const r=h?A:[A];l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer);for(let n=0;n<r.length;n++){const i=r[n];l.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer[n]);const o=a.convert(i.format,i.encoding),s=a.convert(i.type),A=z(i.internalFormat,o,s,i.encoding),u=at(e);t.renderbufferStorageMultisample(36161,u,A,e.width,e.height),t.framebufferRenderbuffer(36160,36064+n,36161,l.__webglColorRenderbuffer[n])}t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),nt(l.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}}if(c){n.bindTexture(34067,u.__webglTexture),Z(34067,A,f);for(let t=0;t<6;t++)et(l.__webglFramebuffer[t],e,A,36064,34069+t);k(A,f)&&U(34067),n.unbindTexture()}else if(h){const t=e.texture;for(let i=0,a=t.length;i<a;i++){const a=t[i],o=r.get(a);n.bindTexture(3553,o.__webglTexture),Z(3553,a,f),et(l.__webglFramebuffer,e,a,36064+i,3553),k(a,f)&&U(3553)}n.unbindTexture()}else{let t=3553;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(s?t=e.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(t,u.__webglTexture),Z(t,A,f),et(l.__webglFramebuffer,e,A,36064,t),k(A,f)&&U(t),n.unbindTexture()}e.depthBuffer&&it(e)},this.updateRenderTargetMipmap=function(t){const e=B(t)||s,i=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let a=0,o=i.length;a<o;a++){const o=i[a];if(k(o,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,i=r.get(o).__webglTexture;n.bindTexture(e,i),U(e),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(s&&e.samples>0&&!1===ot(e)){const i=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=e.width,o=e.height;let s=16384;const A=[],l=e.stencilBuffer?33306:36096,u=r.get(e),c=!0===e.isWebGLMultipleRenderTargets;if(c)for(let e=0;e<i.length;e++)n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,null),n.bindFramebuffer(36160,u.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,null,0);n.bindFramebuffer(36008,u.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,u.__webglFramebuffer);for(let n=0;n<i.length;n++){A.push(36064+n),e.depthBuffer&&A.push(l);const h=void 0!==u.__ignoreDepthValues&&u.__ignoreDepthValues;if(!1===h&&(e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024)),c&&t.framebufferRenderbuffer(36008,36064,36161,u.__webglColorRenderbuffer[n]),!0===h&&(t.invalidateFramebuffer(36008,[l]),t.invalidateFramebuffer(36009,[l])),c){const e=r.get(i[n]).__webglTexture;t.framebufferTexture2D(36009,36064,3553,e,0)}t.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728),f&&t.invalidateFramebuffer(36008,A)}if(n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,null),c)for(let e=0;e<i.length;e++){n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,u.__webglColorRenderbuffer[e]);const a=r.get(i[e]).__webglTexture;n.bindFramebuffer(36160,u.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,a,0)}n.bindFramebuffer(36009,u.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=it,this.setupFrameBufferTexture=et,this.useMultisampledRTT=ot}function ha(t,e,n){const r=n.isWebGL2;return{convert:function(n,i=null){let a;if(n===b)return 5121;if(1017===n)return 32819;if(1018===n)return 32820;if(1010===n)return 5120;if(1011===n)return 5122;if(1012===n)return 5123;if(1013===n)return 5124;if(n===w)return 5125;if(n===M)return 5126;if(n===S)return r?5131:(a=e.get("OES_texture_half_float"),null!==a?a.HALF_FLOAT_OES:null);if(1021===n)return 6406;if(n===T)return 6408;if(1024===n)return 6409;if(1025===n)return 6410;if(n===C)return 6402;if(n===q)return 34041;if(1028===n)return 6403;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"),6408;if(n===F)return a=e.get("EXT_sRGB"),null!==a?a.SRGB_ALPHA_EXT:null;if(1029===n)return 36244;if(1030===n)return 33319;if(1031===n)return 33320;if(1033===n)return 36249;if(n===P||n===D||n===L||n===R)if(i===O){if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===a)return null;if(n===P)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===D)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===L)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===R)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(a=e.get("WEBGL_compressed_texture_s3tc"),null===a)return null;if(n===P)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===D)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===L)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===R)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 i===O?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===n)return i===O?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 i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return i===O?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return i===O?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 i===O?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===E?r?34042:(a=e.get("WEBGL_depth_texture"),null!==a?a.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[n]?t[n]:null}}}class fa extends qn{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class da extends Ce{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pa={type:"move"};class ma{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new da,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 da,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Et,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Et),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new da,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Et,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Et),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 r=null,i=null,a=null;const o=this._targetRay,s=this._grip,A=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(A&&t.hand){a=!0;for(const r of t.hand.values()){const t=e.getJointPose(r,n);if(void 0===A.joints[r.jointName]){const t=new da;t.matrixAutoUpdate=!1,t.visible=!1,A.joints[r.jointName]=t,A.add(t)}const i=A.joints[r.jointName];null!==t&&(i.matrix.fromArray(t.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=t.radius),i.visible=null!==t}const r=A.joints["index-finger-tip"],i=A.joints["thumb-tip"],o=r.position.distanceTo(i.position),s=.02,l=.005;A.inputState.pinching&&o>s+l?(A.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!A.inputState.pinching&&o<=s-l&&(A.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==s&&t.gripSpace&&(i=e.getPose(t.gripSpace,n),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));null!==o&&(r=e.getPose(t.targetRaySpace,n),null===r&&null!==i&&(r=i),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,this.dispatchEvent(pa)))}return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==A&&(A.visible=null!==a),this}}class ga extends yt{constructor(t,e,n,r,i,a,o,s,A,l){if((l=void 0!==l?l:C)!==C&&l!==q)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===C&&(n=w),void 0===n&&l===q&&(n=E),super(null,r,i,a,o,s,l,n,A),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==o?o:x,this.minFilter=void 0!==s?s:x,this.flipY=!1,this.generateMipmaps=!1}}class va extends G{constructor(t,e){super();const n=this;let r=null,i=1,a=null,o="local-floor",s=null,A=null,l=null,u=null,c=null,h=null;const f=e.getContextAttributes();let d=null,p=null;const m=[],g=[],v=new qn;v.layers.enable(1),v.viewport=new _t;const x=new qn;x.layers.enable(2),x.viewport=new _t;const y=[v,x],_=new fa;_.layers.enable(1),_.layers.enable(2);let M=null,S=null;function P(t){const e=g.indexOf(t.inputSource);if(-1===e)return;const n=m[e];void 0!==n&&n.dispatchEvent({type:t.type,data:t.inputSource})}function D(){r.removeEventListener("select",P),r.removeEventListener("selectstart",P),r.removeEventListener("selectend",P),r.removeEventListener("squeeze",P),r.removeEventListener("squeezestart",P),r.removeEventListener("squeezeend",P),r.removeEventListener("end",D),r.removeEventListener("inputsourceschange",L);for(let t=0;t<m.length;t++){const e=g[t];null!==e&&(g[t]=null,m[t].disconnect(e))}M=null,S=null,t.setRenderTarget(d),c=null,u=null,l=null,r=null,p=null,k.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function L(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],r=g.indexOf(n);r>=0&&(g[r]=null,m[r].dispatchEvent({type:"disconnected",data:n}))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let r=g.indexOf(n);if(-1===r){for(let t=0;t<m.length;t++){if(t>=g.length){g.push(n),r=t;break}if(null===g[t]){g[t]=n,r=t;break}}if(-1===r)break}const i=m[r];i&&i.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=m[t];return void 0===e&&(e=new ma,m[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=m[t];return void 0===e&&(e=new ma,m[t]=e),e.getGripSpace()},this.getHand=function(t){let e=m[t];return void 0===e&&(e=new ma,m[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){i=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s||a},this.setReferenceSpace=function(t){s=t},this.getBaseLayer=function(){return null!==u?u:c},this.getBinding=function(){return l},this.getFrame=function(){return h},this.getSession=function(){return r},this.setSession=async function(A){if(r=A,null!==r){if(d=t.getRenderTarget(),r.addEventListener("select",P),r.addEventListener("selectstart",P),r.addEventListener("selectend",P),r.addEventListener("squeeze",P),r.addEventListener("squeezestart",P),r.addEventListener("squeezeend",P),r.addEventListener("end",D),r.addEventListener("inputsourceschange",L),!0!==f.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==r.renderState.layers||f.antialias,alpha:f.alpha,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:i};c=new XRWebGLLayer(r,e,n),r.updateRenderState({baseLayer:c}),p=new bt(c.framebufferWidth,c.framebufferHeight,{format:T,type:b,encoding:t.outputEncoding})}else{let n=null,a=null,o=null;f.depth&&(o=f.stencil?35056:33190,n=f.stencil?q:C,a=f.stencil?E:w);const s={colorFormat:32856,depthFormat:o,scaleFactor:i};l=new XRWebGLBinding(r,e),u=l.createProjectionLayer(s),r.updateRenderState({layers:[u]}),p=new bt(u.textureWidth,u.textureHeight,{format:T,type:b,depthTexture:new ga(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:f.stencil,encoding:t.outputEncoding,samples:f.antialias?4:0});t.properties.get(p).__ignoreDepthValues=u.ignoreDepthValues}p.isXRRenderTarget=!0,this.setFoveation(1),s=null,a=await r.requestReferenceSpace(o),k.setContext(r),k.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const R=new Et,I=new Et;function O(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===r)return;_.near=x.near=v.near=t.near,_.far=x.far=v.far=t.far,M===_.near&&S===_.far||(r.updateRenderState({depthNear:_.near,depthFar:_.far}),M=_.near,S=_.far);const e=t.parent,n=_.cameras;O(_,e);for(let t=0;t<n.length;t++)O(n[t],e);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),t.position.copy(_.position),t.quaternion.copy(_.quaternion),t.scale.copy(_.scale),t.matrix.copy(_.matrix),t.matrixWorld.copy(_.matrixWorld);const i=t.children;for(let t=0,e=i.length;t<e;t++)i[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){R.setFromMatrixPosition(e.matrixWorld),I.setFromMatrixPosition(n.matrixWorld);const r=R.distanceTo(I),i=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),A=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],c=(a[8]+1)/a[0],h=o*u,f=o*c,d=r/(-u+c),p=d*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(p),t.translateZ(d),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const m=o+d,g=s+d,v=h-p,x=f+(r-p),y=A*s/g*m,_=l*s/g*m;t.projectionMatrix.makePerspective(v,x,y,_,m,g)}(_,v,x):_.projectionMatrix.copy(v.projectionMatrix)},this.getCamera=function(){return _},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==c?c.fixedFoveation:void 0},this.setFoveation=function(t){null!==u&&(u.fixedFoveation=t),null!==c&&void 0!==c.fixedFoveation&&(c.fixedFoveation=t)};let B=null;const k=new Fn;k.setAnimationLoop((function(e,n){if(A=n.getViewerPose(s||a),h=n,null!==A){const e=A.views;null!==c&&(t.setRenderTargetFramebuffer(p,c.framebuffer),t.setRenderTarget(p));let n=!1;e.length!==_.cameras.length&&(_.cameras.length=0,n=!0);for(let r=0;r<e.length;r++){const i=e[r];let a=null;if(null!==c)a=c.getViewport(i);else{const e=l.getViewSubImage(u,i);a=e.viewport,0===r&&(t.setRenderTargetTextures(p,e.colorTexture,u.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(p))}let o=y[r];void 0===o&&(o=new qn,o.layers.enable(r),o.viewport=new _t,y[r]=o),o.matrix.fromArray(i.transform.matrix),o.projectionMatrix.fromArray(i.projectionMatrix),o.viewport.set(a.x,a.y,a.width,a.height),0===r&&_.matrix.copy(o.matrix),!0===n&&_.cameras.push(o)}}for(let t=0;t<m.length;t++){const e=g[t],r=m[t];null!==e&&void 0!==r&&r.update(e,n,s||a)}B&&B(e,n),h=null})),this.setAnimationLoop=function(t){B=t},this.dispose=function(){}}}function xa(t,e){function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map),r.alphaMap&&(n.alphaMap.value=r.alphaMap),r.bumpMap&&(n.bumpMap.value=r.bumpMap,n.bumpScale.value=r.bumpScale,1===r.side&&(n.bumpScale.value*=-1)),r.displacementMap&&(n.displacementMap.value=r.displacementMap,n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap),r.normalMap&&(n.normalMap.value=r.normalMap,n.normalScale.value.copy(r.normalScale),1===r.side&&n.normalScale.value.negate()),r.specularMap&&(n.specularMap.value=r.specularMap),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);const i=e.get(r).envMap;if(i&&(n.envMap.value=i,n.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;const e=!0!==t.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*e}let a,o;r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity),r.map?a=r.map:r.specularMap?a=r.specularMap:r.displacementMap?a=r.displacementMap:r.normalMap?a=r.normalMap:r.bumpMap?a=r.bumpMap:r.roughnessMap?a=r.roughnessMap:r.metalnessMap?a=r.metalnessMap:r.alphaMap?a=r.alphaMap:r.emissiveMap?a=r.emissiveMap:r.clearcoatMap?a=r.clearcoatMap:r.clearcoatNormalMap?a=r.clearcoatNormalMap:r.clearcoatRoughnessMap?a=r.clearcoatRoughnessMap:r.iridescenceMap?a=r.iridescenceMap:r.iridescenceThicknessMap?a=r.iridescenceThicknessMap:r.specularIntensityMap?a=r.specularIntensityMap:r.specularColorMap?a=r.specularColorMap:r.transmissionMap?a=r.transmissionMap:r.thicknessMap?a=r.thicknessMap:r.sheenColorMap?a=r.sheenColorMap:r.sheenRoughnessMap&&(a=r.sheenRoughnessMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uvTransform.value.copy(a.matrix)),r.aoMap?o=r.aoMap:r.lightMap&&(o=r.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),n.uv2Transform.value.copy(o.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,r,i,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(t,r):r.isMeshToonMaterial?(n(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(n(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(n(t,r),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,r),r.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,r,o)):r.isMeshMatcapMaterial?(n(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?n(t,r):r.isMeshDistanceMaterial?(n(t,r),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,r)):r.isMeshNormalMaterial?n(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,r,i,a):r.isSpriteMaterial?function(t,e){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);let n;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,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function ya(t,e,n,r){let i={},a={},o=[];const s=n.isWebGL2?t.getParameter(35375):0;function A(t,e,n){const r=t.value;if(void 0===n[e])return n[e]="number"==typeof r?r:r.clone(),!0;if("number"==typeof r){if(n[e]!==r)return n[e]=r,!0}else{const t=n[e];if(!1===t.equals(r))return t.copy(r),!0}return!1}function l(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 u(e){const n=e.target;n.removeEventListener("dispose",u);const r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),t.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(t,e){const n=e.program;r.uniformBlockBinding(t,n)},update:function(n,c){let h=i[n.id];void 0===h&&(!function(t){const e=t.uniforms;let n=0;const r=16;let i=0;for(let t=0,a=e.length;t<a;t++){const a=e[t],o=l(a);if(a.__data=new Float32Array(o.storage/Float32Array.BYTES_PER_ELEMENT),a.__offset=n,t>0){i=n%r;const t=r-i;0!==i&&t-o.boundary<0&&(n+=r-i,a.__offset=n)}n+=o.storage}i=n%r,i>0&&(n+=r-i);t.__size=n,t.__cache={}}(n),h=function(e){const n=function(){for(let t=0;t<s;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=n;const r=t.createBuffer(),i=e.__size,a=e.usage;return t.bindBuffer(35345,r),t.bufferData(35345,i,a),t.bindBuffer(35345,null),t.bindBufferBase(35345,n,r),r}(n),i[n.id]=h,n.addEventListener("dispose",u));const f=c.program;r.updateUBOMapping(n,f);const d=e.render.frame;a[n.id]!==d&&(!function(e){const n=i[e.id],r=e.uniforms,a=e.__cache;t.bindBuffer(35345,n);for(let e=0,n=r.length;e<n;e++){const n=r[e];if(!0===A(n,e,a)){const e=n.value,r=n.__offset;"number"==typeof e?(n.__data[0]=e,t.bufferSubData(35345,r,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(35345,r,n.__data))}}t.bindBuffer(35345,null)}(n),a[n.id]=d)},dispose:function(){for(const e in i)t.deleteBuffer(i[e]);o=[],i={},a={}}}}function _a(t={}){this.isWebGLRenderer=!0;const e=void 0!==t.canvas?t.canvas:function(){const t=rt("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,r=void 0===t.depth||t.depth,i=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,s=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,A=void 0!==t.powerPreference?t.powerPreference:"default",l=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u;u=null!==n?n.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let c=null,h=null;const f=[],d=[];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=I,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 p=this;let m=!1,g=0,v=0,x=null,y=-1,w=null;const E=new _t,C=new _t;let q=null,P=e.width,D=e.height,L=1,R=null,O=null;const B=new _t(0,0,P,D),k=new _t(0,0,P,D);let U=!1;const z=new Nn;let N=!1,F=!1,G=null;const H=new re,j=new tt,V=new Et,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Q(){return null===x?L:1}let Y,X,Z,J,$,et,nt,it,at,ot,st,At,lt,ut,ct,ht,ft,dt,pt,mt,gt,vt,xt,yt,wt=n;function Mt(t,n){for(let r=0;r<t.length;r++){const i=t[r],a=e.getContext(i,n);if(null!==a)return a}return null}try{const t={alpha:!0,depth:r,stencil:i,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:s,powerPreference:A,failIfMajorPerformanceCaveat:l};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r143"),e.addEventListener("webglcontextlost",Ct,!1),e.addEventListener("webglcontextrestored",qt,!1),e.addEventListener("webglcontextcreationerror",Pt,!1),null===wt){const e=["webgl2","webgl","experimental-webgl"];if(!0===p.isWebGL1Renderer&&e.shift(),wt=Mt(e,t),null===wt)throw Mt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===wt.getShaderPrecisionFormat&&(wt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function St(){Y=new pr(wt),X=new Zn(wt,Y,t),Y.init(X),vt=new ha(wt,Y,X),Z=new ua(wt,Y,X),J=new vr,$=new Zi,et=new ca(wt,Y,Z,$,X,vt,J),nt=new Kn(p),it=new dr(p),at=new Gn(wt,X),xt=new Yn(wt,Y,at,X),ot=new mr(wt,at,J,xt),st=new wr(wt,ot,at,J),pt=new br(wt,X,et),ht=new Jn($),At=new Xi(p,nt,it,Y,X,xt,ht),lt=new xa(p,$),ut=new ta,ct=new oa(Y,X),dt=new Qn(p,nt,Z,st,u,o),ft=new la(p,st,X),yt=new ya(wt,J,X,Z),mt=new Xn(wt,Y,J,X),gt=new gr(wt,Y,J,X),J.programs=At.programs,p.capabilities=X,p.extensions=Y,p.properties=$,p.renderLists=ut,p.shadowMap=ft,p.state=Z,p.info=J}St();const Tt=new va(p,wt);function Ct(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function qt(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1;const t=J.autoReset,e=ft.enabled,n=ft.autoUpdate,r=ft.needsUpdate,i=ft.type;St(),J.autoReset=t,ft.enabled=e,ft.autoUpdate=n,ft.needsUpdate=r,ft.type=i}function Pt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Dt(t){const e=t.target;e.removeEventListener("dispose",Dt),function(t){(function(t){const e=$.get(t).programs;void 0!==e&&(e.forEach((function(t){At.releaseProgram(t)})),t.isShaderMaterial&&At.releaseShaderCache(t))})(t),$.remove(t)}(e)}this.xr=Tt,this.getContext=function(){return wt},this.getContextAttributes=function(){return wt.getContextAttributes()},this.forceContextLoss=function(){const t=Y.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=Y.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(t){void 0!==t&&(L=t,this.setSize(P,D,!1))},this.getSize=function(t){return t.set(P,D)},this.setSize=function(t,n,r){Tt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(P=t,D=n,e.width=Math.floor(t*L),e.height=Math.floor(n*L),!1!==r&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(P*L,D*L).floor()},this.setDrawingBufferSize=function(t,n,r){P=t,D=n,L=r,e.width=Math.floor(t*r),e.height=Math.floor(n*r),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(E)},this.getViewport=function(t){return t.copy(B)},this.setViewport=function(t,e,n,r){t.isVector4?B.set(t.x,t.y,t.z,t.w):B.set(t,e,n,r),Z.viewport(E.copy(B).multiplyScalar(L).floor())},this.getScissor=function(t){return t.copy(k)},this.setScissor=function(t,e,n,r){t.isVector4?k.set(t.x,t.y,t.z,t.w):k.set(t,e,n,r),Z.scissor(C.copy(k).multiplyScalar(L).floor())},this.getScissorTest=function(){return U},this.setScissorTest=function(t){Z.setScissorTest(U=t)},this.setOpaqueSort=function(t){R=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(dt.getClearColor())},this.setClearColor=function(){dt.setClearColor.apply(dt,arguments)},this.getClearAlpha=function(){return dt.getClearAlpha()},this.setClearAlpha=function(){dt.setClearAlpha.apply(dt,arguments)},this.clear=function(t=!0,e=!0,n=!0){let r=0;t&&(r|=16384),e&&(r|=256),n&&(r|=1024),wt.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Ct,!1),e.removeEventListener("webglcontextrestored",qt,!1),e.removeEventListener("webglcontextcreationerror",Pt,!1),ut.dispose(),ct.dispose(),$.dispose(),nt.dispose(),it.dispose(),st.dispose(),xt.dispose(),yt.dispose(),At.dispose(),Tt.dispose(),Tt.removeEventListener("sessionstart",Rt),Tt.removeEventListener("sessionend",It),G&&(G.dispose(),G=null),Ot.stop()},this.renderBufferDirect=function(t,e,n,r,i,a){null===e&&(e=W);const o=i.isMesh&&i.matrixWorld.determinant()<0,s=function(t,e,n,r,i){!0!==e.isScene&&(e=W);et.resetTextureUnits();const a=e.fog,o=r.isMeshStandardMaterial?e.environment:null,s=null===x?p.outputEncoding:!0===x.isXRRenderTarget?x.texture.encoding:I,A=(r.isMeshStandardMaterial?it:nt).get(r.envMap||o),l=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!r.normalMap&&!!n.attributes.tangent,c=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,d=!!n.morphAttributes.color,m=r.toneMapped?p.toneMapping:0,g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==g?g.length:0,_=$.get(r),b=h.state.lights;if(!0===N&&(!0===F||t!==w)){const e=t===w&&r.id===y;ht.setState(r,t,e)}let M=!1;r.version===_.__version?_.needsLights&&_.lightsStateVersion!==b.state.version||_.outputEncoding!==s||i.isInstancedMesh&&!1===_.instancing?M=!0:i.isInstancedMesh||!0!==_.instancing?i.isSkinnedMesh&&!1===_.skinning?M=!0:i.isSkinnedMesh||!0!==_.skinning?_.envMap!==A||!0===r.fog&&_.fog!==a?M=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===ht.numPlanes&&_.numIntersection===ht.numIntersection?(_.vertexAlphas!==l||_.vertexTangents!==u||_.morphTargets!==c||_.morphNormals!==f||_.morphColors!==d||_.toneMapping!==m||!0===X.isWebGL2&&_.morphTargetsCount!==v)&&(M=!0):M=!0:M=!0:M=!0:(M=!0,_.__version=r.version);let S=_.currentProgram;!0===M&&(S=Nt(r,e,i));let E=!1,T=!1,C=!1;const q=S.getUniforms(),P=_.uniforms;Z.useProgram(S.program)&&(E=!0,T=!0,C=!0);r.id!==y&&(y=r.id,T=!0);if(E||w!==t){if(q.setValue(wt,"projectionMatrix",t.projectionMatrix),X.logarithmicDepthBuffer&&q.setValue(wt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),w!==t&&(w=t,T=!0,C=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){const e=q.map.cameraPosition;void 0!==e&&e.setValue(wt,V.setFromMatrixPosition(t.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&q.setValue(wt,"isOrthographic",!0===t.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&q.setValue(wt,"viewMatrix",t.matrixWorldInverse)}if(i.isSkinnedMesh){q.setOptional(wt,i,"bindMatrix"),q.setOptional(wt,i,"bindMatrixInverse");const t=i.skeleton;t&&(X.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),q.setValue(wt,"boneTexture",t.boneTexture,et),q.setValue(wt,"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 R=n.morphAttributes;(void 0!==R.position||void 0!==R.normal||void 0!==R.color&&!0===X.isWebGL2)&&pt.update(i,n,r,S);(T||_.receiveShadow!==i.receiveShadow)&&(_.receiveShadow=i.receiveShadow,q.setValue(wt,"receiveShadow",i.receiveShadow));T&&(q.setValue(wt,"toneMappingExposure",p.toneMappingExposure),_.needsLights&&(B=C,(O=P).ambientLightColor.needsUpdate=B,O.lightProbe.needsUpdate=B,O.directionalLights.needsUpdate=B,O.directionalLightShadows.needsUpdate=B,O.pointLights.needsUpdate=B,O.pointLightShadows.needsUpdate=B,O.spotLights.needsUpdate=B,O.spotLightShadows.needsUpdate=B,O.rectAreaLights.needsUpdate=B,O.hemisphereLights.needsUpdate=B),a&&!0===r.fog&&lt.refreshFogUniforms(P,a),lt.refreshMaterialUniforms(P,r,L,D,G),Ti.upload(wt,_.uniformsList,P,et));var O,B;r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(Ti.upload(wt,_.uniformsList,P,et),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&q.setValue(wt,"center",i.center);if(q.setValue(wt,"modelViewMatrix",i.modelViewMatrix),q.setValue(wt,"normalMatrix",i.normalMatrix),q.setValue(wt,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){const t=r.uniformsGroups;for(let e=0,n=t.length;e<n;e++)if(X.isWebGL2){const n=t[e];yt.update(n,S),yt.bind(n,S)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return S}(t,e,n,r,i);Z.setMaterial(r,o);let A=n.index;const l=n.attributes.position;if(null===A){if(void 0===l||0===l.count)return}else if(0===A.count)return;let u,c=1;!0===r.wireframe&&(A=ot.getWireframeAttribute(n),c=2),xt.setup(i,r,s,n,A);let f=mt;null!==A&&(u=at.get(A),f=gt,f.setIndex(u));const d=null!==A?A.count:l.count,m=n.drawRange.start*c,g=n.drawRange.count*c,v=null!==a?a.start*c:0,_=null!==a?a.count*c:1/0,b=Math.max(m,v),M=Math.min(d,m+g,v+_)-1,S=Math.max(0,M-b+1);if(0!==S){if(i.isMesh)!0===r.wireframe?(Z.setLineWidth(r.wireframeLinewidth*Q()),f.setMode(1)):f.setMode(4);else if(i.isLine){let t=r.linewidth;void 0===t&&(t=1),Z.setLineWidth(t*Q()),i.isLineSegments?f.setMode(1):i.isLineLoop?f.setMode(2):f.setMode(3)}else i.isPoints?f.setMode(0):i.isSprite&&f.setMode(4);if(i.isInstancedMesh)f.renderInstances(b,S,i.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);f.renderInstances(b,S,t)}else f.render(b,S)}},this.compile=function(t,e){h=ct.get(t),h.init(),d.push(h),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(h.pushLight(t),t.castShadow&&h.pushShadow(t))})),h.setupLights(p.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){Nt(n[r],t,e)}else Nt(n,t,e)})),d.pop(),h=null};let Lt=null;function Rt(){Ot.stop()}function It(){Ot.start()}const Ot=new Fn;function Bt(t,e,n,r){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)h.pushLight(t),t.castShadow&&h.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||z.intersectsSprite(t)){r&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=st.update(t),i=t.material;i.visible&&c.push(t,e,i,n,V.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==J.render.frame&&(t.skeleton.update(),t.skeleton.frame=J.render.frame),!t.frustumCulled||z.intersectsObject(t))){r&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);const e=st.update(t),i=t.material;if(Array.isArray(i)){const r=e.groups;for(let a=0,o=r.length;a<o;a++){const o=r[a],s=i[o.materialIndex];s&&s.visible&&c.push(t,e,s,n,V.z,o)}}else i.visible&&c.push(t,e,i,n,V.z,null)}const i=t.children;for(let t=0,a=i.length;t<a;t++)Bt(i[t],e,n,r)}function kt(t,e,n,r){const i=t.opaque,o=t.transmissive,s=t.transparent;h.setupLightsView(n),o.length>0&&function(t,e,n){const r=X.isWebGL2;null===G&&(G=new bt(1,1,{generateMipmaps:!0,type:Y.has("EXT_color_buffer_half_float")?S:b,minFilter:_,samples:r&&!0===a?4:0}));p.getDrawingBufferSize(j),r?G.setSize(j.x,j.y):G.setSize(K(j.x),K(j.y));const i=p.getRenderTarget();p.setRenderTarget(G),p.clear();const o=p.toneMapping;p.toneMapping=0,Ut(t,e,n),p.toneMapping=o,et.updateMultisampleRenderTarget(G),et.updateRenderTargetMipmap(G),p.setRenderTarget(i)}(i,e,n),r&&Z.viewport(E.copy(r)),i.length>0&&Ut(i,e,n),o.length>0&&Ut(o,e,n),s.length>0&&Ut(s,e,n),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Ut(t,e,n){const r=!0===e.isScene?e.overrideMaterial:null;for(let i=0,a=t.length;i<a;i++){const a=t[i],o=a.object,s=a.geometry,A=null===r?a.material:r,l=a.group;o.layers.test(n.layers)&&zt(o,e,n,s,A,l)}}function zt(t,e,n,r,i,a){t.onBeforeRender(p,e,n,r,i,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),i.onBeforeRender(p,e,n,r,t,a),!0===i.transparent&&2===i.side?(i.side=1,i.needsUpdate=!0,p.renderBufferDirect(n,e,r,i,t,a),i.side=0,i.needsUpdate=!0,p.renderBufferDirect(n,e,r,i,t,a),i.side=2):p.renderBufferDirect(n,e,r,i,t,a),t.onAfterRender(p,e,n,r,i,a)}function Nt(t,e,n){!0!==e.isScene&&(e=W);const r=$.get(t),i=h.state.lights,a=h.state.shadowsArray,o=i.state.version,s=At.getParameters(t,i.state,a,e,n),A=At.getProgramCacheKey(s);let l=r.programs;r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=(t.isMeshStandardMaterial?it:nt).get(t.envMap||r.environment),void 0===l&&(t.addEventListener("dispose",Dt),l=new Map,r.programs=l);let u=l.get(A);if(void 0!==u){if(r.currentProgram===u&&r.lightsStateVersion===o)return Ft(t,s),u}else s.uniforms=At.getUniforms(t),t.onBuild(n,s,p),t.onBeforeCompile(s,p),u=At.acquireProgram(s,A),l.set(A,u),r.uniforms=s.uniforms;const c=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(c.clippingPlanes=ht.uniform),Ft(t,s),r.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),r.lightsStateVersion=o,r.needsLights&&(c.ambientLightColor.value=i.state.ambient,c.lightProbe.value=i.state.probe,c.directionalLights.value=i.state.directional,c.directionalLightShadows.value=i.state.directionalShadow,c.spotLights.value=i.state.spot,c.spotLightShadows.value=i.state.spotShadow,c.rectAreaLights.value=i.state.rectArea,c.ltc_1.value=i.state.rectAreaLTC1,c.ltc_2.value=i.state.rectAreaLTC2,c.pointLights.value=i.state.point,c.pointLightShadows.value=i.state.pointShadow,c.hemisphereLights.value=i.state.hemi,c.directionalShadowMap.value=i.state.directionalShadowMap,c.directionalShadowMatrix.value=i.state.directionalShadowMatrix,c.spotShadowMap.value=i.state.spotShadowMap,c.spotShadowMatrix.value=i.state.spotShadowMatrix,c.pointShadowMap.value=i.state.pointShadowMap,c.pointShadowMatrix.value=i.state.pointShadowMatrix);const f=u.getUniforms(),d=Ti.seqWithValue(f.seq,c);return r.currentProgram=u,r.uniformsList=d,u}function Ft(t,e){const n=$.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}Ot.setAnimationLoop((function(t){Lt&&Lt(t)})),"undefined"!=typeof self&&Ot.setContext(self),this.setAnimationLoop=function(t){Lt=t,Tt.setAnimationLoop(t),null===t?Ot.stop():Ot.start()},Tt.addEventListener("sessionstart",Rt),Tt.addEventListener("sessionend",It),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===m)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===Tt.enabled&&!0===Tt.isPresenting&&(!0===Tt.cameraAutoUpdate&&Tt.updateCamera(e),e=Tt.getCamera()),!0===t.isScene&&t.onBeforeRender(p,t,e,x),h=ct.get(t,d.length),h.init(),d.push(h),H.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),z.setFromProjectionMatrix(H),F=this.localClippingEnabled,N=ht.init(this.clippingPlanes,F,e),c=ut.get(t,f.length),c.init(),f.push(c),Bt(t,e,0,p.sortObjects),c.finish(),!0===p.sortObjects&&c.sort(R,O),!0===N&&ht.beginShadows();const n=h.state.shadowsArray;if(ft.render(n,t,e),!0===N&&ht.endShadows(),!0===this.info.autoReset&&this.info.reset(),dt.render(c,t),h.setupLights(p.physicallyCorrectLights),e.isArrayCamera){const n=e.cameras;for(let e=0,r=n.length;e<r;e++){const r=n[e];kt(c,t,r,r.viewport)}}else kt(c,t,e);null!==x&&(et.updateMultisampleRenderTarget(x),et.updateRenderTargetMipmap(x)),!0===t.isScene&&t.onAfterRender(p,t,e),xt.resetDefaultState(),y=-1,w=null,d.pop(),h=d.length>0?d[d.length-1]:null,f.pop(),c=f.length>0?f[f.length-1]:null},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return v},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(t,e,n){$.get(t.texture).__webglTexture=e,$.get(t.depthTexture).__webglTexture=n;const r=$.get(t);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===Y.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=$.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){x=t,g=e,v=n;let r=!0;if(t){const e=$.get(t);void 0!==e.__useDefaultFramebuffer?(Z.bindFramebuffer(36160,null),r=!1):void 0===e.__webglFramebuffer?et.setupRenderTarget(t):e.__hasExternalTextures&&et.rebindTextures(t,$.get(t.texture).__webglTexture,$.get(t.depthTexture).__webglTexture)}let i=null,a=!1,o=!1;if(t){const n=t.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(o=!0);const r=$.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=r[e],a=!0):i=X.isWebGL2&&t.samples>0&&!1===et.useMultisampledRTT(t)?$.get(t).__webglMultisampledFramebuffer:r,E.copy(t.viewport),C.copy(t.scissor),q=t.scissorTest}else E.copy(B).multiplyScalar(L).floor(),C.copy(k).multiplyScalar(L).floor(),q=U;if(Z.bindFramebuffer(36160,i)&&X.drawBuffers&&r&&Z.drawBuffers(t,i),Z.viewport(E),Z.scissor(C),Z.setScissorTest(q),a){const r=$.get(t.texture);wt.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(o){const r=$.get(t.texture),i=e||0;wt.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}y=-1},this.readRenderTargetPixels=function(t,e,n,r,i,a,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=$.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){Z.bindFramebuffer(36160,s);try{const o=t.texture,s=o.format,A=o.type;if(s!==T&&vt.convert(s)!==wt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const l=A===S&&(Y.has("EXT_color_buffer_half_float")||X.isWebGL2&&Y.has("EXT_color_buffer_float"));if(!(A===b||vt.convert(A)===wt.getParameter(35738)||A===M&&(X.isWebGL2||Y.has("OES_texture_float")||Y.has("WEBGL_color_buffer_float"))||l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&wt.readPixels(e,n,r,i,vt.convert(s),vt.convert(A),a)}finally{const t=null!==x?$.get(x).__webglFramebuffer:null;Z.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r);et.setTexture2D(e,0),wt.copyTexSubImage2D(3553,n,0,0,t.x,t.y,i,a),Z.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,a=e.image.height,o=vt.convert(n.format),s=vt.convert(n.type);et.setTexture2D(n,0),wt.pixelStorei(37440,n.flipY),wt.pixelStorei(37441,n.premultiplyAlpha),wt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?wt.texSubImage2D(3553,r,t.x,t.y,i,a,o,s,e.image.data):e.isCompressedTexture?wt.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):wt.texSubImage2D(3553,r,t.x,t.y,o,s,e.image),0===r&&n.generateMipmaps&&wt.generateMipmap(3553),Z.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(p.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const a=t.max.x-t.min.x+1,o=t.max.y-t.min.y+1,s=t.max.z-t.min.z+1,A=vt.convert(r.format),l=vt.convert(r.type);let u;if(r.isData3DTexture)et.setTexture3D(r,0),u=32879;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");et.setTexture2DArray(r,0),u=35866}wt.pixelStorei(37440,r.flipY),wt.pixelStorei(37441,r.premultiplyAlpha),wt.pixelStorei(3317,r.unpackAlignment);const c=wt.getParameter(3314),h=wt.getParameter(32878),f=wt.getParameter(3316),d=wt.getParameter(3315),m=wt.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;wt.pixelStorei(3314,g.width),wt.pixelStorei(32878,g.height),wt.pixelStorei(3316,t.min.x),wt.pixelStorei(3315,t.min.y),wt.pixelStorei(32877,t.min.z),n.isDataTexture||n.isData3DTexture?wt.texSubImage3D(u,i,e.x,e.y,e.z,a,o,s,A,l,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),wt.compressedTexSubImage3D(u,i,e.x,e.y,e.z,a,o,s,A,g.data)):wt.texSubImage3D(u,i,e.x,e.y,e.z,a,o,s,A,l,g),wt.pixelStorei(3314,c),wt.pixelStorei(32878,h),wt.pixelStorei(3316,f),wt.pixelStorei(3315,d),wt.pixelStorei(32877,m),0===i&&r.generateMipmaps&&wt.generateMipmap(u),Z.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?et.setTextureCube(t,0):t.isData3DTexture?et.setTexture3D(t,0):t.isDataArrayTexture?et.setTexture2DArray(t,0):et.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){g=0,v=0,x=null,Z.reset(),xt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends _a{}).prototype.isWebGL1Renderer=!0;class ba{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=z,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Q()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Q()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Q()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const wa=new Et;class Ma{constructor(t,e,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)wa.fromBufferAttribute(this,e),wa.applyMatrix4(t),this.setXYZ(e,wa.x,wa.y,wa.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)wa.fromBufferAttribute(this,e),wa.applyNormalMatrix(t),this.setXYZ(e,wa.x,wa.y,wa.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)wa.fromBufferAttribute(this,e),wa.transformDirection(t),this.setXYZ(e,wa.x,wa.y,wa.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new Ve(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Ma(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Sa extends Ve{constructor(t,e,n,r=1){"number"==typeof n&&(r=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=r}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 Ea extends Fe{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new dt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const Ta=new Et,Ca=new Et,qa=new re,Pa=new ne,Da=new Yt;class La extends Ce{constructor(t=new nn,e=new Ea){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,r=e.count;t<r;t++)Ta.fromBufferAttribute(e,t-1),Ca.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=Ta.distanceTo(Ca);t.setAttribute("lineDistance",new Ye(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Da.copy(n.boundingSphere),Da.applyMatrix4(r),Da.radius+=i,!1===t.ray.intersectsSphere(Da))return;qa.copy(r).invert(),Pa.copy(t.ray).applyMatrix4(qa);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,A=new Et,l=new Et,u=new Et,c=new Et,h=this.isLineSegments?2:1,f=n.index,d=n.attributes.position;if(null!==f){for(let n=Math.max(0,a.start),r=Math.min(f.count,a.start+a.count)-1;n<r;n+=h){const r=f.getX(n),i=f.getX(n+1);A.fromBufferAttribute(d,r),l.fromBufferAttribute(d,i);if(Pa.distanceSqToSegment(A,l,c,u)>s)continue;c.applyMatrix4(this.matrixWorld);const a=t.ray.origin.distanceTo(c);a<t.near||a>t.far||e.push({distance:a,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,a.start),r=Math.min(d.count,a.start+a.count)-1;n<r;n+=h){A.fromBufferAttribute(d,n),l.fromBufferAttribute(d,n+1);if(Pa.distanceSqToSegment(A,l,c,u)>s)continue;c.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(c);r<t.near||r>t.far||e.push({distance:r,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object: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}}}}}const Ra=new Et,Ia=new Et;class Oa extends La{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;t<r;t+=2)Ra.fromBufferAttribute(e,t),Ia.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+Ra.distanceTo(Ia);t.setAttribute("lineDistance",new Ye(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Ba{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),i+=n.distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const i=n.length;let a;a=e||t*n[i-1];let o,s=0,A=i-1;for(;s<=A;)if(r=Math.floor(s+(A-s)/2),o=n[r]-a,o<0)s=r+1;else{if(!(o>0)){A=r;break}A=r-1}if(r=A,n[r]===a)return r/(i-1);const l=n[r];return(r+(a-l)/(n[r+1]-l))/(i-1)}getTangent(t,e){const n=1e-4;let r=t-n,i=t+n;r<0&&(r=0),i>1&&(i=1);const a=this.getPoint(r),o=this.getPoint(i),s=e||(a.isVector2?new tt:new Et);return s.copy(o).sub(a).normalize(),s}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new Et,r=[],i=[],a=[],o=new Et,s=new re;for(let e=0;e<=t;e++){const n=e/t;r[e]=this.getTangentAt(n,new Et)}i[0]=new Et,a[0]=new Et;let A=Number.MAX_VALUE;const l=Math.abs(r[0].x),u=Math.abs(r[0].y),c=Math.abs(r[0].z);l<=A&&(A=l,n.set(1,0,0)),u<=A&&(A=u,n.set(0,1,0)),c<=A&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let e=1;e<=t;e++){if(i[e]=i[e-1].clone(),a[e]=a[e-1].clone(),o.crossVectors(r[e-1],r[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Y(r[e-1].dot(r[e]),-1,1));i[e].applyMatrix4(s.makeRotationAxis(o,t))}a[e].crossVectors(r[e],i[e])}if(!0===e){let e=Math.acos(Y(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],e*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class ka extends Ba{constructor(t=0,e=0,n=1,r=1,i=0,a=2*Math.PI,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(t,e){const n=e||new tt,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const a=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);const o=this.aStartAngle+t*i;let s=this.aX+this.xRadius*Math.cos(o),A=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=s-this.aX,r=A-this.aY;s=n*t-r*e+this.aX,A=n*e+r*t+this.aY}return n.set(s,A)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function Ua(){let t=0,e=0,n=0,r=0;function i(i,a,o,s){t=i,e=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(t,e,n,r,a){i(e,n,a*(n-t),a*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,a,o,s){let A=(e-t)/a-(n-t)/(a+o)+(n-e)/o,l=(n-e)/o-(r-e)/(o+s)+(r-n)/s;A*=o,l*=o,i(e,n,A,l)},calc:function(i){const a=i*i;return t+e*i+n*a+r*(a*i)}}}const za=new Et,Na=new Ua,Fa=new Ua,Ga=new Ua;function Ha(t,e,n,r,i){const a=.5*(r-e),o=.5*(i-n),s=t*t;return(2*n-2*r+a+o)*(t*s)+(-3*n+3*r-2*a-o)*s+a*t+n}function ja(t,e,n,r){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}function Va(t,e,n,r,i){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,r)+function(t,e){return t*t*t*e}(t,i)}class Wa extends Ba{constructor(t=new tt,e=new tt,n=new tt,r=new tt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new tt){const n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Va(t,r.x,i.x,a.x,o.x),Va(t,r.y,i.y,a.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Qa extends Ba{constructor(t=new Et,e=new Et,n=new Et,r=new Et){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new Et){const n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Va(t,r.x,i.x,a.x,o.x),Va(t,r.y,i.y,a.y,o.y),Va(t,r.z,i.z,a.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Ya extends Ba{constructor(t=new tt,e=new tt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new tt){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new tt;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Xa extends Ba{constructor(t=new tt,e=new tt,n=new tt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new tt){const n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(ja(t,r.x,i.x,a.x),ja(t,r.y,i.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Za extends Ba{constructor(t=new Et,e=new Et,n=new Et){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Et){const n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(ja(t,r.x,i.x,a.x),ja(t,r.y,i.y,a.y),ja(t,r.z,i.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Ja extends Ba{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new tt){const n=e,r=this.points,i=(r.length-1)*t,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],A=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Ha(o,s.x,A.x,l.x,u.x),Ha(o,s.y,A.y,l.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new tt).fromArray(n))}return this}}var Ka=Object.freeze({__proto__:null,ArcCurve:class extends ka{constructor(t,e,n,r,i,a){super(t,e,n,n,r,i,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Ba{constructor(t=[],e=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=r}getPoint(t,e=new Et){const n=e,r=this.points,i=r.length,a=(i-(this.closed?0:1))*t;let o,s,A=Math.floor(a),l=a-A;this.closed?A+=A>0?0:(Math.floor(Math.abs(A)/i)+1)*i:0===l&&A===i-1&&(A=i-2,l=1),this.closed||A>0?o=r[(A-1)%i]:(za.subVectors(r[0],r[1]).add(r[0]),o=za);const u=r[A%i],c=r[(A+1)%i];if(this.closed||A+2<i?s=r[(A+2)%i]:(za.subVectors(r[i-1],r[i-2]).add(r[i-1]),s=za),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(c),t),r=Math.pow(c.distanceToSquared(s),t);n<1e-4&&(n=1),e<1e-4&&(e=n),r<1e-4&&(r=n),Na.initNonuniformCatmullRom(o.x,u.x,c.x,s.x,e,n,r),Fa.initNonuniformCatmullRom(o.y,u.y,c.y,s.y,e,n,r),Ga.initNonuniformCatmullRom(o.z,u.z,c.z,s.z,e,n,r)}else"catmullrom"===this.curveType&&(Na.initCatmullRom(o.x,u.x,c.x,s.x,this.tension),Fa.initCatmullRom(o.y,u.y,c.y,s.y,this.tension),Ga.initCatmullRom(o.z,u.z,c.z,s.z,this.tension));return n.set(Na.calc(l),Fa.calc(l),Ga.calc(l)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Et).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:Wa,CubicBezierCurve3:Qa,EllipseCurve:ka,LineCurve:Ya,LineCurve3:class extends Ba{constructor(t=new Et,e=new Et){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Et){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:Xa,QuadraticBezierCurve3:Za,SplineCurve:Ja});class $a extends Ba{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ya(e,t))}getPoint(t,e){const n=t*this.getLength(),r=this.getCurveLengths();let i=0;for(;i<r.length;){if(r[i]>=n){const t=r[i]-n,a=this.curves[i],o=a.getLength(),s=0===o?0:1-t/o;return a.getPointAt(s,e)}i++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const a=i[r],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o);for(let t=0;t<s.length;t++){const r=s[t];n&&n.equals(r)||(e.push(r),n=r)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Ka[n.type]).fromJSON(n))}return this}}class to extends $a{constructor(t){super(),this.type="Path",this.currentPoint=new tt,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new Ya(this.currentPoint.clone(),new tt(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){const i=new Xa(this.currentPoint.clone(),new tt(t,e),new tt(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(t,e,n,r,i,a){const o=new Wa(this.currentPoint.clone(),new tt(t,e),new tt(n,r),new tt(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Ja(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,i,a){const o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,n,r,i,a),this}absarc(t,e,n,r,i,a){return this.absellipse(t,e,n,n,r,i,a),this}ellipse(t,e,n,r,i,a,o,s){const A=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+A,e+l,n,r,i,a,o,s),this}absellipse(t,e,n,r,i,a,o,s){const A=new ka(t,e,n,r,i,a,o,s);if(this.curves.length>0){const t=A.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(A);const l=A.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class eo extends nn{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],a=[],o=[],s=[],A=new Et,l=new tt;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=e;i++,u+=3){const c=n+i/e*r;A.x=t*Math.cos(c),A.y=t*Math.sin(c),a.push(A.x,A.y,A.z),o.push(0,0,1),l.x=(a[u]/t+1)/2,l.y=(a[u+1]/t+1)/2,s.push(l.x,l.y)}for(let t=1;t<=e;t++)i.push(t,t+1,0);this.setIndex(i),this.setAttribute("position",new Ye(a,3)),this.setAttribute("normal",new Ye(o,3)),this.setAttribute("uv",new Ye(s,2))}static fromJSON(t){return new eo(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class no extends nn{constructor(t=1,e=1,n=1,r=8,i=1,a=!1,o=0,s=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};const A=this;r=Math.floor(r),i=Math.floor(i);const l=[],u=[],c=[],h=[];let f=0;const d=[],p=n/2;let m=0;function g(n){const i=f,a=new tt,d=new Et;let g=0;const v=!0===n?t:e,x=!0===n?1:-1;for(let t=1;t<=r;t++)u.push(0,p*x,0),c.push(0,x,0),h.push(.5,.5),f++;const y=f;for(let t=0;t<=r;t++){const e=t/r*s+o,n=Math.cos(e),i=Math.sin(e);d.x=v*i,d.y=p*x,d.z=v*n,u.push(d.x,d.y,d.z),c.push(0,x,0),a.x=.5*n+.5,a.y=.5*i*x+.5,h.push(a.x,a.y),f++}for(let t=0;t<r;t++){const e=i+t,r=y+t;!0===n?l.push(r,r+1,e):l.push(r+1,r,e),g+=3}A.addGroup(m,g,!0===n?1:2),m+=g}!function(){const a=new Et,g=new Et;let v=0;const x=(e-t)/n;for(let A=0;A<=i;A++){const l=[],m=A/i,v=m*(e-t)+t;for(let t=0;t<=r;t++){const e=t/r,i=e*s+o,A=Math.sin(i),d=Math.cos(i);g.x=v*A,g.y=-m*n+p,g.z=v*d,u.push(g.x,g.y,g.z),a.set(A,x,d).normalize(),c.push(a.x,a.y,a.z),h.push(e,1-m),l.push(f++)}d.push(l)}for(let t=0;t<r;t++)for(let e=0;e<i;e++){const n=d[e][t],r=d[e+1][t],i=d[e+1][t+1],a=d[e][t+1];l.push(n,r,a),l.push(r,i,a),v+=6}A.addGroup(m,v,0),m+=v}(),!1===a&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(l),this.setAttribute("position",new Ye(u,3)),this.setAttribute("normal",new Ye(c,3)),this.setAttribute("uv",new Ye(h,2))}static fromJSON(t){return new no(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ro extends to{constructor(t){super(t),this.uuid=Q(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new to).fromJSON(n))}return this}}const io=function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let a=ao(t,0,i,n,!0);const o=[];if(!a||a.next===a.prev)return o;let s,A,l,u,c,h,f;if(r&&(a=function(t,e,n,r){const i=[];let a,o,s,A,l;for(a=0,o=e.length;a<o;a++)s=e[a]*r,A=a<o-1?e[a+1]*r:t.length,l=ao(t,s,A,r,!1),l===l.next&&(l.steiner=!0),i.push(go(l));for(i.sort(ho),a=0;a<i.length;a++)fo(i[a],n),n=oo(n,n.next);return n}(t,e,a,n)),t.length>80*n){s=l=t[0],A=u=t[1];for(let e=n;e<i;e+=n)c=t[e],h=t[e+1],c<s&&(s=c),h<A&&(A=h),c>l&&(l=c),h>u&&(u=h);f=Math.max(l-s,u-A),f=0!==f?1/f:0}return so(a,o,n,s,A,f),o};function ao(t,e,n,r,i){let a,o;if(i===function(t,e,n,r){let i=0;for(let a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}(t,e,n,r)>0)for(a=e;a<n;a+=r)o=To(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=To(a,t[a],t[a+1],o);return o&&_o(o,o.next)&&(Co(o),o=o.next),o}function oo(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!_o(r,r.next)&&0!==yo(r.prev,r,r.next))r=r.next;else{if(Co(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function so(t,e,n,r,i,a,o){if(!t)return;!o&&a&&function(t,e,n,r){let i=t;do{null===i.z&&(i.z=mo(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n,r,i,a,o,s,A,l=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e<l&&(s++,r=r.nextZ,r);e++);for(A=l;s>0||A>0&&r;)0!==s&&(0===A||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,A--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,a);let s,A,l=t;for(;t.prev!==t.next;)if(s=t.prev,A=t.next,a?lo(t,r,i,a):Ao(t))e.push(s.i/n),e.push(t.i/n),e.push(A.i/n),Co(t),t=A.next,l=A.next;else if((t=A)===l){o?1===o?so(t=uo(oo(t),e,n),e,n,r,i,a,2):2===o&&co(t,e,n,r,i,a):so(oo(t),e,n,r,i,a,1);break}}function Ao(t){const e=t.prev,n=t,r=t.next;if(yo(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(vo(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&yo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function lo(t,e,n,r){const i=t.prev,a=t,o=t.next;if(yo(i,a,o)>=0)return!1;const s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,A=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,c=mo(s,A,e,n,r),h=mo(l,u,e,n,r);let f=t.prevZ,d=t.nextZ;for(;f&&f.z>=c&&d&&d.z<=h;){if(f!==t.prev&&f!==t.next&&vo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&yo(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,d!==t.prev&&d!==t.next&&vo(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&yo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&vo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&yo(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=h;){if(d!==t.prev&&d!==t.next&&vo(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&yo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function uo(t,e,n){let r=t;do{const i=r.prev,a=r.next.next;!_o(i,a)&&bo(i,r,r.next,a)&&So(i,a)&&So(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),Co(r),Co(r.next),r=t=a),r=r.next}while(r!==t);return oo(r)}function co(t,e,n,r,i,a){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&xo(o,t)){let s=Eo(o,t);return o=oo(o,o.next),s=oo(s,s.next),so(o,e,n,r,i,a),void so(s,e,n,r,i,a)}t=t.next}o=o.next}while(o!==t)}function ho(t,e){return t.x-e.x}function fo(t,e){if(e=function(t,e){let n=e;const r=t.x,i=t.y;let a,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o){if(o=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}a=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!a)return null;if(r===o)return a;const s=a,A=a.x,l=a.y;let u,c=1/0;n=a;do{r>=n.x&&n.x>=A&&r!==n.x&&vo(i<l?r:o,i,A,l,i<l?o:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),So(n,t)&&(u<c||u===c&&(n.x>a.x||n.x===a.x&&po(a,n)))&&(a=n,c=u)),n=n.next}while(n!==s);return a}(t,e),e){const n=Eo(e,t);oo(e,e.next),oo(n,n.next)}}function po(t,e){return yo(t.prev,t,e.prev)<0&&yo(e.next,t,t.next)<0}function mo(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function go(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function vo(t,e,n,r,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function xo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&bo(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(So(t,e)&&So(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(yo(t.prev,t,e.prev)||yo(t,e.prev,e))||_o(t,e)&&yo(t.prev,t,t.next)>0&&yo(e.prev,e,e.next)>0)}function yo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function _o(t,e){return t.x===e.x&&t.y===e.y}function bo(t,e,n,r){const i=Mo(yo(t,e,n)),a=Mo(yo(t,e,r)),o=Mo(yo(n,r,t)),s=Mo(yo(n,r,e));return i!==a&&o!==s||(!(0!==i||!wo(t,n,e))||(!(0!==a||!wo(t,r,e))||(!(0!==o||!wo(n,t,r))||!(0!==s||!wo(n,e,r)))))}function wo(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Mo(t){return t>0?1:t<0?-1:0}function So(t,e){return yo(t.prev,t,t.next)<0?yo(t,e,t.next)>=0&&yo(t,t.prev,e)>=0:yo(t,e,t.prev)<0||yo(t,t.next,e)<0}function Eo(t,e){const n=new qo(t.i,t.x,t.y),r=new qo(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function To(t,e,n,r){const i=new qo(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Co(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function qo(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Po{static area(t){const e=t.length;let n=0;for(let r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n}static isClockWise(t){return Po.area(t)<0}static triangulateShape(t,e){const n=[],r=[],i=[];Do(t),Lo(n,t);let a=t.length;e.forEach(Do);for(let t=0;t<e.length;t++)r.push(a),a+=e[t].length,Lo(n,e[t]);const o=io(n,r);for(let t=0;t<o.length;t+=3)i.push(o.slice(t,t+3));return i}}function Do(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Lo(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Ro extends nn{constructor(t=new ro([new tt(.5,.5),new tt(-.5,.5),new tt(-.5,-.5),new tt(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,r=[],i=[];for(let e=0,n=t.length;e<n;e++){a(t[e])}function a(t){const a=[],o=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1,A=void 0!==e.depth?e.depth:1;let l=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:.2,c=void 0!==e.bevelSize?e.bevelSize:u-.1,h=void 0!==e.bevelOffset?e.bevelOffset:0,f=void 0!==e.bevelSegments?e.bevelSegments:3;const d=e.extrudePath,p=void 0!==e.UVGenerator?e.UVGenerator:Io;let m,g,v,x,y,_=!1;d&&(m=d.getSpacedPoints(s),_=!0,l=!1,g=d.computeFrenetFrames(s,!1),v=new Et,x=new Et,y=new Et),l||(f=0,u=0,c=0,h=0);const b=t.extractPoints(o);let w=b.shape;const M=b.holes;if(!Po.isClockWise(w)){w=w.reverse();for(let t=0,e=M.length;t<e;t++){const e=M[t];Po.isClockWise(e)&&(M[t]=e.reverse())}}const S=Po.triangulateShape(w,M),E=w;for(let t=0,e=M.length;t<e;t++){const e=M[t];w=w.concat(e)}function T(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const C=w.length,q=S.length;function P(t,e,n){let r,i,a;const o=t.x-e.x,s=t.y-e.y,A=n.x-t.x,l=n.y-t.y,u=o*o+s*s,c=o*l-s*A;if(Math.abs(c)>Number.EPSILON){const c=Math.sqrt(u),h=Math.sqrt(A*A+l*l),f=e.x-s/c,d=e.y+o/c,p=((n.x-l/h-f)*l-(n.y+A/h-d)*A)/(o*l-s*A);r=f+o*p-t.x,i=d+s*p-t.y;const m=r*r+i*i;if(m<=2)return new tt(r,i);a=Math.sqrt(m/2)}else{let t=!1;o>Number.EPSILON?A>Number.EPSILON&&(t=!0):o<-Number.EPSILON?A<-Number.EPSILON&&(t=!0):Math.sign(s)===Math.sign(l)&&(t=!0),t?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new tt(r/a,i/a)}const D=[];for(let t=0,e=E.length,n=e-1,r=t+1;t<e;t++,n++,r++)n===e&&(n=0),r===e&&(r=0),D[t]=P(E[t],E[n],E[r]);const L=[];let R,I=D.concat();for(let t=0,e=M.length;t<e;t++){const e=M[t];R=[];for(let t=0,n=e.length,r=n-1,i=t+1;t<n;t++,r++,i++)r===n&&(r=0),i===n&&(i=0),R[t]=P(e[t],e[r],e[i]);L.push(R),I=I.concat(R)}for(let t=0;t<f;t++){const e=t/f,n=u*Math.cos(e*Math.PI/2),r=c*Math.sin(e*Math.PI/2)+h;for(let t=0,e=E.length;t<e;t++){const e=T(E[t],D[t],r);k(e.x,e.y,-n)}for(let t=0,e=M.length;t<e;t++){const e=M[t];R=L[t];for(let t=0,i=e.length;t<i;t++){const i=T(e[t],R[t],r);k(i.x,i.y,-n)}}}const O=c+h;for(let t=0;t<C;t++){const e=l?T(w[t],I[t],O):w[t];_?(x.copy(g.normals[0]).multiplyScalar(e.x),v.copy(g.binormals[0]).multiplyScalar(e.y),y.copy(m[0]).add(x).add(v),k(y.x,y.y,y.z)):k(e.x,e.y,0)}for(let t=1;t<=s;t++)for(let e=0;e<C;e++){const n=l?T(w[e],I[e],O):w[e];_?(x.copy(g.normals[t]).multiplyScalar(n.x),v.copy(g.binormals[t]).multiplyScalar(n.y),y.copy(m[t]).add(x).add(v),k(y.x,y.y,y.z)):k(n.x,n.y,A/s*t)}for(let t=f-1;t>=0;t--){const e=t/f,n=u*Math.cos(e*Math.PI/2),r=c*Math.sin(e*Math.PI/2)+h;for(let t=0,e=E.length;t<e;t++){const e=T(E[t],D[t],r);k(e.x,e.y,A+n)}for(let t=0,e=M.length;t<e;t++){const e=M[t];R=L[t];for(let t=0,i=e.length;t<i;t++){const i=T(e[t],R[t],r);_?k(i.x,i.y+m[s-1].y,m[s-1].x+n):k(i.x,i.y,A+n)}}}function B(t,e){let n=t.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=s+2*f;t<n;t++){const n=C*t,a=C*(t+1);z(e+r+n,e+i+n,e+i+a,e+r+a)}}}function k(t,e,n){a.push(t),a.push(e),a.push(n)}function U(t,e,i){N(t),N(e),N(i);const a=r.length/3,o=p.generateTopUV(n,r,a-3,a-2,a-1);F(o[0]),F(o[1]),F(o[2])}function z(t,e,i,a){N(t),N(e),N(a),N(e),N(i),N(a);const o=r.length/3,s=p.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);F(s[0]),F(s[1]),F(s[3]),F(s[1]),F(s[2]),F(s[3])}function N(t){r.push(a[3*t+0]),r.push(a[3*t+1]),r.push(a[3*t+2])}function F(t){i.push(t.x),i.push(t.y)}!function(){const t=r.length/3;if(l){let t=0,e=C*t;for(let t=0;t<q;t++){const n=S[t];U(n[2]+e,n[1]+e,n[0]+e)}t=s+2*f,e=C*t;for(let t=0;t<q;t++){const n=S[t];U(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<q;t++){const e=S[t];U(e[2],e[1],e[0])}for(let t=0;t<q;t++){const e=S[t];U(e[0]+C*s,e[1]+C*s,e[2]+C*s)}}n.addGroup(t,r.length/3-t,0)}(),function(){const t=r.length/3;let e=0;B(E,e),e+=E.length;for(let t=0,n=M.length;t<n;t++){const n=M[t];B(n,e),e+=n.length}n.addGroup(t,r.length/3-t,1)}()}this.setAttribute("position",new Ye(r,3)),this.setAttribute("uv",new Ye(i,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,r=t.length;e<r;e++){const r=t[e];n.shapes.push(r.uuid)}else n.shapes.push(t.uuid);n.options=Object.assign({},e),void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let r=0,i=t.shapes.length;r<i;r++){const i=e[t.shapes[r]];n.push(i)}const r=t.options.extrudePath;return void 0!==r&&(t.options.extrudePath=(new Ka[r.type]).fromJSON(r)),new Ro(n,t.options)}}const Io={generateTopUV:function(t,e,n,r,i){const a=e[3*n],o=e[3*n+1],s=e[3*r],A=e[3*r+1],l=e[3*i],u=e[3*i+1];return[new tt(a,o),new tt(s,A),new tt(l,u)]},generateSideWallUV:function(t,e,n,r,i,a){const o=e[3*n],s=e[3*n+1],A=e[3*n+2],l=e[3*r],u=e[3*r+1],c=e[3*r+2],h=e[3*i],f=e[3*i+1],d=e[3*i+2],p=e[3*a],m=e[3*a+1],g=e[3*a+2];return Math.abs(s-u)<Math.abs(o-l)?[new tt(o,1-A),new tt(l,1-c),new tt(h,1-d),new tt(p,1-g)]:[new tt(s,1-A),new tt(u,1-c),new tt(f,1-d),new tt(m,1-g)]}};class Oo extends nn{constructor(t=1,e=32,n=16,r=0,i=2*Math.PI,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const s=Math.min(a+o,Math.PI);let A=0;const l=[],u=new Et,c=new Et,h=[],f=[],d=[],p=[];for(let h=0;h<=n;h++){const m=[],g=h/n;let v=0;0==h&&0==a?v=.5/e:h==n&&s==Math.PI&&(v=-.5/e);for(let n=0;n<=e;n++){const s=n/e;u.x=-t*Math.cos(r+s*i)*Math.sin(a+g*o),u.y=t*Math.cos(a+g*o),u.z=t*Math.sin(r+s*i)*Math.sin(a+g*o),f.push(u.x,u.y,u.z),c.copy(u).normalize(),d.push(c.x,c.y,c.z),p.push(s+v,1-g),m.push(A++)}l.push(m)}for(let t=0;t<n;t++)for(let r=0;r<e;r++){const e=l[t][r+1],i=l[t][r],o=l[t+1][r],A=l[t+1][r+1];(0!==t||a>0)&&h.push(e,i,A),(t!==n-1||s<Math.PI)&&h.push(i,o,A)}this.setIndex(h),this.setAttribute("position",new Ye(f,3)),this.setAttribute("normal",new Ye(d,3)),this.setAttribute("uv",new Ye(p,2))}static fromJSON(t){return new Oo(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Bo extends nn{constructor(t=new Za(new Et(-1,-1,0),new Et(-1,1,0),new Et(1,1,0)),e=64,n=1,r=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i};const a=t.computeFrenetFrames(e,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new Et,s=new Et,A=new tt;let l=new Et;const u=[],c=[],h=[],f=[];function d(i){l=t.getPointAt(i/e,l);const A=a.normals[i],h=a.binormals[i];for(let t=0;t<=r;t++){const e=t/r*Math.PI*2,i=Math.sin(e),a=-Math.cos(e);s.x=a*A.x+i*h.x,s.y=a*A.y+i*h.y,s.z=a*A.z+i*h.z,s.normalize(),c.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,u.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)d(t);d(!1===i?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=r;n++)A.x=t/e,A.y=n/r,h.push(A.x,A.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=r;e++){const n=(r+1)*(t-1)+(e-1),i=(r+1)*t+(e-1),a=(r+1)*t+e,o=(r+1)*(t-1)+e;f.push(n,i,o),f.push(i,a,o)}}()}(),this.setIndex(f),this.setAttribute("position",new Ye(u,3)),this.setAttribute("normal",new Ye(c,3)),this.setAttribute("uv",new Ye(h,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Bo((new Ka[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}function ko(t,e,n){const r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r),n.add(i),!0)}class Uo extends Fe{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new dt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new dt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.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.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,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}}const zo={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 No{constructor(t,e,n){const r=this;let i,a=!1,o=0,s=0;const A=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){s++,!1===a&&void 0!==r.onStart&&r.onStart(t,o,s),a=!0},this.itemEnd=function(t){o++,void 0!==r.onProgress&&r.onProgress(t,o,s),o===s&&(a=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return i?i(t):t},this.setURLModifier=function(t){return i=t,this},this.addHandler=function(t,e){return A.push(t,e),this},this.removeHandler=function(t){const e=A.indexOf(t);return-1!==e&&A.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=A.length;e<n;e+=2){const n=A[e],r=A[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}}}const Fo=new No;class Go{constructor(t){this.manager=void 0!==t?t:Fo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(r,i){n.load(t,r,e,i)}))}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 Ho extends Go{constructor(t){super(t)}load(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,a=zo.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;const o=rt("img");function s(){l(),zo.add(t,this),e&&e(this),i.manager.itemEnd(t)}function A(e){l(),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}function l(){o.removeEventListener("load",s,!1),o.removeEventListener("error",A,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",A,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o}}class jo extends Go{constructor(t){super(t)}load(t,e,n,r){const i=new yt,a=new Ho(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(t){i.image=t,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}class Vo extends Ce{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new dt(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 Wo=new re,Qo=new Et,Yo=new Et;class Xo extends class{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new tt(512,512),this.map=null,this.mapPass=null,this.matrix=new re,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Nn,this._frameExtents=new tt(1,1),this._viewportCount=1,this._viewports=[new _t(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Qo.setFromMatrixPosition(t.matrixWorld),e.position.copy(Qo),Yo.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Yo),e.updateMatrixWorld(),Wo.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Wo),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 $n(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Zo{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Jo(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Jo();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Jo(){return("undefined"==typeof performance?Date:performance).now()}class Ko extends ba{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}function $o(t,e){return t.distance-e.distance}function ts(t,e,n,r){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===r){const r=t.children;for(let t=0,i=r.length;t<i;t++)ts(r[t],e,n,!0)}}class es{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Y(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const ns=new Et,rs=new Et;class is{constructor(){this.type="ShapePath",this.color=new dt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new to,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}bezierCurveTo(t,e,n,r,i,a){return this.currentPath.bezierCurveTo(t,e,n,r,i,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function n(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n],i=new ro;i.curves=r.curves,e.push(i)}return e}function r(t,e){const n=e.length;let r=!1;for(let i=n-1,a=0;a<n;i=a++){let n=e[i],o=e[a],s=o.x-n.x,A=o.y-n.y;if(Math.abs(A)>Number.EPSILON){if(A<0&&(n=e[a],s=-s,o=e[i],A=-A),t.y<n.y||t.y>o.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=A*(t.x-n.x)-s*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return r}const i=Po.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return n(a);let o,s,A;const l=[];if(1===a.length)return s=a[0],A=new ro,A.curves=s.curves,l.push(A),l;let u=!i(a[0].getPoints());u=t?!u:u;const c=[],h=[];let f,d,p=[],m=0;h[m]=void 0,p[m]=[];for(let e=0,n=a.length;e<n;e++)s=a[e],f=s.getPoints(),o=i(f),o=t?!o:o,o?(!u&&h[m]&&m++,h[m]={s:new ro,p:f},h[m].s.curves=s.curves,u&&m++,p[m]=[]):p[m].push({h:s,p:f[0]});if(!h[0])return n(a);if(h.length>1){let t=!1,e=0;for(let t=0,e=h.length;t<e;t++)c[t]=[];for(let n=0,i=h.length;n<i;n++){const i=p[n];for(let a=0;a<i.length;a++){const o=i[a];let s=!0;for(let i=0;i<h.length;i++)r(o.p,h[i].p)&&(n!==i&&e++,s?(s=!1,c[i].push(o)):t=!0);s&&c[n].push(o)}}e>0&&!1===t&&(p=c)}for(let t=0,e=h.length;t<e;t++){A=h[t].s,l.push(A),d=p[t];for(let t=0,e=d.length;t<e;t++)A.holes.push(d[t].h)}return l}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:o}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=o);const as=new Et,os=new re,ss=new re,As=new Et,ls=new Et;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function us(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function cs(t,e,n){var r,i,a,o,s;function A(){var l=Date.now()-o;l<e&&l>=0?r=setTimeout(A,e-l):(r=null,n||(s=t.apply(a,i),a=i=null))}null==e&&(e=100);var l=function(){a=this,i=arguments,o=Date.now();var l=n&&!r;return r||(r=setTimeout(A,e)),l&&(s=t.apply(a,i),a=i=null),s};return l.clear=function(){r&&(clearTimeout(r),r=null)},l.flush=function(){r&&(s=t.apply(a,i),a=i=null,clearTimeout(r),r=null)},l}cs.debounce=cs;var hs=cs;function fs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ds(t,e,n){return e&&fs(t.prototype,e),n&&fs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ps(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ms(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ms(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ms(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var gs=ds((function t(e,n){var r=n.default,i=void 0===r?null:r,a=n.triggerUpdate,o=void 0===a||a,s=n.onChange,A=void 0===s?function(t,e){}:s;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e,this.defaultVal=i,this.triggerUpdate=o,this.onChange=A}));function vs(t){var e=t.stateInit,n=void 0===e?function(){return{}}:e,r=t.props,i=void 0===r?{}:r,a=t.methods,o=void 0===a?{}:a,s=t.aliases,A=void 0===s?{}:s,l=t.init,u=void 0===l?function(){}:l,c=t.update,h=void 0===c?function(){}:c,f=Object.keys(i).map((function(t){return new gs(t,i[t])}));return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},n instanceof Function?n(t):n,{initialised:!1}),r={};function i(e){return a(e,t),s(),i}var a=function(t,n){u.call(i,t,e,n),e.initialised=!0},s=hs((function(){e.initialised&&(h.call(i,e,r),r={})}),1);return f.forEach((function(t){i[t.name]=function(t){var n=t.name,a=t.triggerUpdate,o=void 0!==a&&a,A=t.onChange,l=void 0===A?function(t,e){}:A,u=t.defaultVal,c=void 0===u?null:u;return function(t){var a=e[n];if(!arguments.length)return a;var A=void 0===t?c:t;return e[n]=A,l.call(i,A,e,a),!r.hasOwnProperty(n)&&(r[n]=a),o&&s(),i}}(t)})),Object.keys(o).forEach((function(t){i[t]=function(){for(var n,r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return(n=o[t]).call.apply(n,[i,e].concat(a))}})),Object.entries(A).forEach((function(t){var e=ps(t,2),n=e[0],r=e[1];return i[n]=i[r]})),i.resetProps=function(){return f.forEach((function(t){i[t.name](t.defaultVal)})),i},i.resetProps(),e._rerender=s,i}}var xs,ys={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-ys.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*ys.Bounce.In(2*t):.5*ys.Bounce.Out(2*t-1)+.5}}},_s="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},bs=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},t.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},t.prototype.update=function(t,e){void 0===t&&(t=_s()),void 0===e&&(e=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var i=this._tweens[n[r]],a=!e;i&&!1===i.update(t,a)&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),ws={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),a=ws.Utils.Linear;return e<0?a(t[0],t[1],r):e>1?a(t[n],t[n-1],n-r):a(t[i],t[i+1>n?n:i+1],r-i)},Bezier:function(t,e){for(var n=0,r=t.length-1,i=Math.pow,a=ws.Utils.Bernstein,o=0;o<=r;o++)n+=i(1-e,r-o)*i(e,o)*t[o]*a(r,o);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),a=ws.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),a(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(a(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(a(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):a(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],r-i)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=ws.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:(xs=[1],function(t){var e=1;if(xs[t])return xs[t];for(var n=t;n>1;n--)e*=n;return xs[t]=e,e}),CatmullRom:function(t,e,n,r,i){var a=.5*(n-t),o=.5*(r-e),s=i*i;return(2*e-2*n+a+o)*(i*s)+(-3*e+3*n-2*a-o)*s+a*i+e}}},Ms=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),Ss=new bs,Es=function(){function t(t,e){void 0===e&&(e=Ss),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ys.Linear.None,this._interpolationFunction=ws.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Ms.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?_s()+parseFloat(t):t:_s(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,n,r){for(var i in n){var a=t[i],o=Array.isArray(a),s=o?"array":typeof a,A=!o&&Array.isArray(n[i]);if("undefined"!==s&&"function"!==s){if(A){var l=n[i];if(0===l.length)continue;l=l.map(this._handleRelativeValue.bind(this,a)),n[i]=[a].concat(l)}if("object"!==s&&!o||!a||A)void 0===e[i]&&(e[i]=a),o||(e[i]*=1),r[i]=A?n[i].slice().reverse():e[i]||0;else{for(var u in e[i]=o?[]:{},a)e[i][u]=a[u];r[i]=o?[]:{},this._setupProperties(a,e[i],n[i],r[i])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=_s()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=_s()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return this._group=t,this},t.prototype.delay=function(t){return this._delayTime=t,this},t.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return this._yoyo=t,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(t,e){if(void 0===t&&(t=_s()),void 0===e&&(e=!0),this._isPaused)return!0;var n,r,i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>i)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),r=(t-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,s=this._chainedTweens.length;o<s;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,n,r){for(var i in n)if(void 0!==e[i]){var a=e[i]||0,o=n[i],s=Array.isArray(t[i]),A=Array.isArray(o);!s&&A?t[i]=this._interpolationFunction(o,r):"object"==typeof o&&o?this._updateProperties(t[i],a,o,r):"number"==typeof(o=this._handleRelativeValue(a,o))&&(t[i]=a+(o-a)*r)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof n?this._valuesStartRepeat[t]+parseFloat(n):this._valuesEnd[t],this._valuesEnd[t]=e},t}(),Ts=Ms.nextId,Cs=Ss,qs=Cs.getAll.bind(Cs),Ps=Cs.removeAll.bind(Cs),Ds=Cs.add.bind(Cs),Ls=Cs.remove.bind(Cs),Rs=Cs.update.bind(Cs),Is={Easing:ys,Group:bs,Interpolation:ws,now:_s,Sequence:Ms,nextId:Ts,Tween:Es,VERSION:"18.6.4",getAll:qs,removeAll:Ps,add:Ds,remove:Ls,update:Rs},Os={exports:{}};function Bs(t,e,n){n=n||2;var r,i,a,o,s,A,l,u=e&&e.length,c=u?e[0]*n:t.length,h=ks(t,0,c,n,!0),f=[];if(!h||h.next===h.prev)return f;if(u&&(h=function(t,e,n,r){var i,a,o,s=[];for(i=0,a=e.length;i<a;i++)(o=ks(t,e[i]*r,i<a-1?e[i+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),s.push(Ys(o));for(s.sort(js),i=0;i<s.length;i++)n=Vs(s[i],n);return n}(t,e,h,n)),t.length>80*n){r=a=t[0],i=o=t[1];for(var d=n;d<c;d+=n)(s=t[d])<r&&(r=s),(A=t[d+1])<i&&(i=A),s>a&&(a=s),A>o&&(o=A);l=0!==(l=Math.max(a-r,o-i))?32767/l:0}return zs(h,f,n,r,i,l,0),f}function ks(t,e,n,r,i){var a,o;if(i===sA(t,e,n,r)>0)for(a=e;a<n;a+=r)o=iA(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=iA(a,t[a],t[a+1],o);return o&&Ks(o,o.next)&&(aA(o),o=o.next),o}function Us(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Ks(r,r.next)&&0!==Js(r.prev,r,r.next))r=r.next;else{if(aA(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function zs(t,e,n,r,i,a,o){if(t){!o&&a&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=Qs(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,a,o,s,A,l=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e<l&&(s++,r=r.nextZ);e++);for(A=l;s>0||A>0&&r;)0!==s&&(0===A||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,A--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,a);for(var s,A,l=t;t.prev!==t.next;)if(s=t.prev,A=t.next,a?Fs(t,r,i,a):Ns(t))e.push(s.i/n|0),e.push(t.i/n|0),e.push(A.i/n|0),aA(t),t=A.next,l=A.next;else if((t=A)===l){o?1===o?zs(t=Gs(Us(t),e,n),e,n,r,i,a,2):2===o&&Hs(t,e,n,r,i,a):zs(Us(t),e,n,r,i,a,1);break}}}function Ns(t){var e=t.prev,n=t,r=t.next;if(Js(e,n,r)>=0)return!1;for(var i=e.x,a=n.x,o=r.x,s=e.y,A=n.y,l=r.y,u=i<a?i<o?i:o:a<o?a:o,c=s<A?s<l?s:l:A<l?A:l,h=i>a?i>o?i:o:a>o?a:o,f=s>A?s>l?s:l:A>l?A:l,d=r.next;d!==e;){if(d.x>=u&&d.x<=h&&d.y>=c&&d.y<=f&&Xs(i,s,a,A,o,l,d.x,d.y)&&Js(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Fs(t,e,n,r){var i=t.prev,a=t,o=t.next;if(Js(i,a,o)>=0)return!1;for(var s=i.x,A=a.x,l=o.x,u=i.y,c=a.y,h=o.y,f=s<A?s<l?s:l:A<l?A:l,d=u<c?u<h?u:h:c<h?c:h,p=s>A?s>l?s:l:A>l?A:l,m=u>c?u>h?u:h:c>h?c:h,g=Qs(f,d,e,n,r),v=Qs(p,m,e,n,r),x=t.prevZ,y=t.nextZ;x&&x.z>=g&&y&&y.z<=v;){if(x.x>=f&&x.x<=p&&x.y>=d&&x.y<=m&&x!==i&&x!==o&&Xs(s,u,A,c,l,h,x.x,x.y)&&Js(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,y.x>=f&&y.x<=p&&y.y>=d&&y.y<=m&&y!==i&&y!==o&&Xs(s,u,A,c,l,h,y.x,y.y)&&Js(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;x&&x.z>=g;){if(x.x>=f&&x.x<=p&&x.y>=d&&x.y<=m&&x!==i&&x!==o&&Xs(s,u,A,c,l,h,x.x,x.y)&&Js(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;y&&y.z<=v;){if(y.x>=f&&y.x<=p&&y.y>=d&&y.y<=m&&y!==i&&y!==o&&Xs(s,u,A,c,l,h,y.x,y.y)&&Js(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Gs(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!Ks(i,a)&&$s(i,r,r.next,a)&&nA(i,a)&&nA(a,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(a.i/n|0),aA(r),aA(r.next),r=t=a),r=r.next}while(r!==t);return Us(r)}function Hs(t,e,n,r,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Zs(o,s)){var A=rA(o,s);return o=Us(o,o.next),A=Us(A,A.next),zs(o,e,n,r,i,a,0),void zs(A,e,n,r,i,a,0)}s=s.next}o=o.next}while(o!==t)}function js(t,e){return t.x-e.x}function Vs(t,e){var n=function(t,e){var n,r=e,i=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o&&(o=s,n=r.x<r.next.x?r:r.next,s===i))return n}r=r.next}while(r!==e);if(!n)return null;var A,l=n,u=n.x,c=n.y,h=1/0;r=n;do{i>=r.x&&r.x>=u&&i!==r.x&&Xs(a<c?i:o,a,u,c,a<c?o:i,a,r.x,r.y)&&(A=Math.abs(a-r.y)/(i-r.x),nA(r,t)&&(A<h||A===h&&(r.x>n.x||r.x===n.x&&Ws(n,r)))&&(n=r,h=A)),r=r.next}while(r!==l);return n}(t,e);if(!n)return e;var r=rA(n,t);return Us(r,r.next),Us(n,n.next)}function Ws(t,e){return Js(t.prev,t,e.prev)<0&&Js(e.next,t,t.next)<0}function Qs(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ys(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Xs(t,e,n,r,i,a,o,s){return(i-o)*(e-s)>=(t-o)*(a-s)&&(t-o)*(r-s)>=(n-o)*(e-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function Zs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&$s(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(nA(t,e)&&nA(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(Js(t.prev,t,e.prev)||Js(t,e.prev,e))||Ks(t,e)&&Js(t.prev,t,t.next)>0&&Js(e.prev,e,e.next)>0)}function Js(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ks(t,e){return t.x===e.x&&t.y===e.y}function $s(t,e,n,r){var i=eA(Js(t,e,n)),a=eA(Js(t,e,r)),o=eA(Js(n,r,t)),s=eA(Js(n,r,e));return i!==a&&o!==s||(!(0!==i||!tA(t,n,e))||(!(0!==a||!tA(t,r,e))||(!(0!==o||!tA(n,t,r))||!(0!==s||!tA(n,e,r)))))}function tA(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function eA(t){return t>0?1:t<0?-1:0}function nA(t,e){return Js(t.prev,t,t.next)<0?Js(t,e,t.next)>=0&&Js(t,t.prev,e)>=0:Js(t,e,t.prev)<0||Js(t,t.next,e)<0}function rA(t,e){var n=new oA(t.i,t.x,t.y),r=new oA(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function iA(t,e,n,r){var i=new oA(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function aA(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function oA(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sA(t,e,n,r){for(var i=0,a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}function AA(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function lA(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function uA(t){let e,n,r;function i(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<0?i=e+1:a=e}while(i<a)}return i}return 2!==t.length?(e=AA,n=(e,n)=>AA(t(e),n),r=(e,n)=>t(e)-n):(e=t===AA||t===lA?t:cA,n=t,r=t),{left:i,center:function(t,e,n=0,a=t.length){const o=i(t,e,n,a-1);return o>n&&r(t[o-1],e)>-r(t[o],e)?o-1:o},right:function(t,r,i=0,a=t.length){if(i<a){if(0!==e(r,r))return a;do{const e=i+a>>>1;n(t[e],r)<=0?i=e+1:a=e}while(i<a)}return i}}}function cA(){return 0}Os.exports=Bs,Os.exports.default=Bs,Bs.deviation=function(t,e,n,r){var i=e&&e.length,a=i?e[0]*n:t.length,o=Math.abs(sA(t,0,a,n));if(i)for(var s=0,A=e.length;s<A;s++){var l=e[s]*n,u=s<A-1?e[s+1]*n:t.length;o-=Math.abs(sA(t,l,u,n))}var c=0;for(s=0;s<r.length;s+=3){var h=r[s]*n,f=r[s+1]*n,d=r[s+2]*n;c+=Math.abs((t[h]-t[d])*(t[f+1]-t[h+1])-(t[h]-t[f])*(t[d+1]-t[h+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},Bs.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var a=0;a<t[i].length;a++)for(var o=0;o<e;o++)n.vertices.push(t[i][a][o]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n};const hA=uA(AA).right;function fA(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(void 0===n?a>=a&&(n=r=a):(n>a&&(n=a),r<a&&(r=a)))}return[n,r]}uA((function(t){return null===t?NaN:+t})).center;class dA{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],a=t+i,o=Math.abs(t)<Math.abs(i)?t-(a-i):i-(a-t);o&&(e[n++]=o),t=a}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,a=0;if(i>0){for(a=t[--i];i>0&&(e=a,n=t[--i],a=e+n,r=n-(a-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=a+n,n==e-a&&(a=e))}return a}}var pA=Math.sqrt(50),mA=Math.sqrt(10),gA=Math.sqrt(2);function vA(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=pA?10:a>=mA?5:a>=gA?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=pA?10:a>=mA?5:a>=gA?2:1)}function xA(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n}function yA(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function _A(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r<i;)a[r]=t+r*n;return a}var bA=1e-6,wA=1e-12,MA=Math.PI,SA=MA/2,EA=MA/4,TA=2*MA,CA=180/MA,qA=MA/180,PA=Math.abs,DA=Math.atan,LA=Math.atan2,RA=Math.cos,IA=Math.ceil,OA=Math.hypot,BA=Math.sin,kA=Math.sign||function(t){return t>0?1:t<0?-1:0},UA=Math.sqrt;function zA(t){return t>1?SA:t<-1?-SA:Math.asin(t)}function NA(t){return(t=BA(t/2))*t}function FA(){}function GA(t,e){t&&jA.hasOwnProperty(t.type)&&jA[t.type](t,e)}var HA={Feature:function(t,e){GA(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)GA(n[r].geometry,e)}},jA={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){VA(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)VA(n[r],e,0)},Polygon:function(t,e){WA(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)WA(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)GA(n[r],e)}};function VA(t,e,n){var r,i=-1,a=t.length-n;for(e.lineStart();++i<a;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function WA(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)VA(t[n],e,1);e.polygonEnd()}function QA(t,e){t&&HA.hasOwnProperty(t.type)?HA[t.type](t,e):GA(t,e)}var YA,XA,ZA,JA,KA,$A,tl,el,nl,rl,il,al,ol,sl,Al,ll,ul=new dA,cl=new dA,hl={point:FA,lineStart:FA,lineEnd:FA,polygonStart:function(){ul=new dA,hl.lineStart=fl,hl.lineEnd=dl},polygonEnd:function(){var t=+ul;cl.add(t<0?TA+t:t),this.lineStart=this.lineEnd=this.point=FA},sphere:function(){cl.add(TA)}};function fl(){hl.point=pl}function dl(){ml(YA,XA)}function pl(t,e){hl.point=ml,YA=t,XA=e,ZA=t*=qA,JA=RA(e=(e*=qA)/2+EA),KA=BA(e)}function ml(t,e){var n=(t*=qA)-ZA,r=n>=0?1:-1,i=r*n,a=RA(e=(e*=qA)/2+EA),o=BA(e),s=KA*o,A=JA*a+s*RA(i),l=s*r*BA(i);ul.add(LA(l,A)),ZA=t,JA=a,KA=o}function gl(t){return[LA(t[1],t[0]),zA(t[2])]}function vl(t){var e=t[0],n=t[1],r=RA(n);return[r*RA(e),r*BA(e),BA(n)]}function xl(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function yl(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function _l(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function bl(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function wl(t){var e=UA(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Ml,Sl,El,Tl,Cl,ql,Pl,Dl,Ll,Rl,Il,Ol,Bl,kl,Ul,zl,Nl={point:Fl,lineStart:Hl,lineEnd:jl,polygonStart:function(){Nl.point=Vl,Nl.lineStart=Wl,Nl.lineEnd=Ql,sl=new dA,hl.polygonStart()},polygonEnd:function(){hl.polygonEnd(),Nl.point=Fl,Nl.lineStart=Hl,Nl.lineEnd=jl,ul<0?($A=-(el=180),tl=-(nl=90)):sl>bA?nl=90:sl<-1e-6&&(tl=-90),ll[0]=$A,ll[1]=el},sphere:function(){$A=-(el=180),tl=-(nl=90)}};function Fl(t,e){Al.push(ll=[$A=t,el=t]),e<tl&&(tl=e),e>nl&&(nl=e)}function Gl(t,e){var n=vl([t*qA,e*qA]);if(ol){var r=yl(ol,n),i=yl([r[1],-r[0],0],r);wl(i),i=gl(i);var a,o=t-rl,s=o>0?1:-1,A=i[0]*CA*s,l=PA(o)>180;l^(s*rl<A&&A<s*t)?(a=i[1]*CA)>nl&&(nl=a):l^(s*rl<(A=(A+360)%360-180)&&A<s*t)?(a=-i[1]*CA)<tl&&(tl=a):(e<tl&&(tl=e),e>nl&&(nl=e)),l?t<rl?Yl($A,t)>Yl($A,el)&&(el=t):Yl(t,el)>Yl($A,el)&&($A=t):el>=$A?(t<$A&&($A=t),t>el&&(el=t)):t>rl?Yl($A,t)>Yl($A,el)&&(el=t):Yl(t,el)>Yl($A,el)&&($A=t)}else Al.push(ll=[$A=t,el=t]);e<tl&&(tl=e),e>nl&&(nl=e),ol=n,rl=t}function Hl(){Nl.point=Gl}function jl(){ll[0]=$A,ll[1]=el,Nl.point=Fl,ol=null}function Vl(t,e){if(ol){var n=t-rl;sl.add(PA(n)>180?n+(n>0?360:-360):n)}else il=t,al=e;hl.point(t,e),Gl(t,e)}function Wl(){hl.lineStart()}function Ql(){Vl(il,al),hl.lineEnd(),PA(sl)>bA&&($A=-(el=180)),ll[0]=$A,ll[1]=el,ol=null}function Yl(t,e){return(e-=t)<0?e+360:e}function Xl(t,e){return t[0]-e[0]}function Zl(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}function Jl(t){var e,n,r,i,a,o,s;if(nl=el=-($A=tl=1/0),Al=[],QA(t,Nl),n=Al.length){for(Al.sort(Xl),e=1,a=[r=Al[0]];e<n;++e)Zl(r,(i=Al[e])[0])||Zl(r,i[1])?(Yl(r[0],i[1])>Yl(r[0],r[1])&&(r[1]=i[1]),Yl(i[0],r[1])>Yl(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,e=0,r=a[n=a.length-1];e<=n;r=i,++e)i=a[e],(s=Yl(r[1],i[0]))>o&&(o=s,$A=i[0],el=r[1])}return Al=ll=null,$A===1/0||tl===1/0?[[NaN,NaN],[NaN,NaN]]:[[$A,tl],[el,nl]]}var Kl={sphere:FA,point:$l,lineStart:eu,lineEnd:iu,polygonStart:function(){Kl.lineStart=au,Kl.lineEnd=ou},polygonEnd:function(){Kl.lineStart=eu,Kl.lineEnd=iu}};function $l(t,e){t*=qA;var n=RA(e*=qA);tu(n*RA(t),n*BA(t),BA(e))}function tu(t,e,n){++Ml,El+=(t-El)/Ml,Tl+=(e-Tl)/Ml,Cl+=(n-Cl)/Ml}function eu(){Kl.point=nu}function nu(t,e){t*=qA;var n=RA(e*=qA);kl=n*RA(t),Ul=n*BA(t),zl=BA(e),Kl.point=ru,tu(kl,Ul,zl)}function ru(t,e){t*=qA;var n=RA(e*=qA),r=n*RA(t),i=n*BA(t),a=BA(e),o=LA(UA((o=Ul*a-zl*i)*o+(o=zl*r-kl*a)*o+(o=kl*i-Ul*r)*o),kl*r+Ul*i+zl*a);Sl+=o,ql+=o*(kl+(kl=r)),Pl+=o*(Ul+(Ul=i)),Dl+=o*(zl+(zl=a)),tu(kl,Ul,zl)}function iu(){Kl.point=$l}function au(){Kl.point=su}function ou(){Au(Ol,Bl),Kl.point=$l}function su(t,e){Ol=t,Bl=e,t*=qA,e*=qA,Kl.point=Au;var n=RA(e);kl=n*RA(t),Ul=n*BA(t),zl=BA(e),tu(kl,Ul,zl)}function Au(t,e){t*=qA;var n=RA(e*=qA),r=n*RA(t),i=n*BA(t),a=BA(e),o=Ul*a-zl*i,s=zl*r-kl*a,A=kl*i-Ul*r,l=OA(o,s,A),u=zA(l),c=l&&-u/l;Ll.add(c*o),Rl.add(c*s),Il.add(c*A),Sl+=u,ql+=u*(kl+(kl=r)),Pl+=u*(Ul+(Ul=i)),Dl+=u*(zl+(zl=a)),tu(kl,Ul,zl)}function lu(t){Ml=Sl=El=Tl=Cl=ql=Pl=Dl=0,Ll=new dA,Rl=new dA,Il=new dA,QA(t,Kl);var e=+Ll,n=+Rl,r=+Il,i=OA(e,n,r);return i<wA&&(e=ql,n=Pl,r=Dl,Sl<bA&&(e=El,n=Tl,r=Cl),(i=OA(e,n,r))<wA)?[NaN,NaN]:[LA(n,e)*CA,zA(r/i)*CA]}function uu(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function cu(t,e){return[PA(t)>MA?t+Math.round(-t/TA)*TA:t,e]}function hu(t,e,n){return(t%=TA)?e||n?uu(du(t),pu(e,n)):du(t):e||n?pu(e,n):cu}function fu(t){return function(e,n){return[(e+=t)>MA?e-TA:e<-MA?e+TA:e,n]}}function du(t){var e=fu(t);return e.invert=fu(-t),e}function pu(t,e){var n=RA(t),r=BA(t),i=RA(e),a=BA(e);function o(t,e){var o=RA(e),s=RA(t)*o,A=BA(t)*o,l=BA(e),u=l*n+s*r;return[LA(A*i-u*a,s*n-l*r),zA(u*i+A*a)]}return o.invert=function(t,e){var o=RA(e),s=RA(t)*o,A=BA(t)*o,l=BA(e),u=l*i-A*a;return[LA(A*i+l*a,s*n+u*r),zA(u*n-s*r)]},o}function mu(t,e){(e=vl(e))[0]-=t,wl(e);var n,r=(n=-e[1])>1?0:n<-1?MA:Math.acos(n);return((-e[2]<0?-r:r)+TA-bA)%TA}function gu(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:FA,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function vu(t,e){return PA(t[0]-e[0])<bA&&PA(t[1]-e[1])<bA}function xu(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function yu(t,e,n,r,i){var a,o,s=[],A=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],o=t[e];if(vu(r,o)){if(!r[2]&&!o[2]){for(i.lineStart(),a=0;a<e;++a)i.point((r=t[a])[0],r[1]);return void i.lineEnd()}o[0]+=2e-6}s.push(n=new xu(r,t,null,!0)),A.push(n.o=new xu(r,null,n,!1)),s.push(n=new xu(o,t,null,!1)),A.push(n.o=new xu(o,null,n,!0))}})),s.length){for(A.sort(e),_u(s),_u(A),a=0,o=A.length;a<o;++a)A[a].e=n=!n;for(var l,u,c=s[0];;){for(var h=c,f=!0;h.v;)if((h=h.n)===c)return;l=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(f)for(a=0,o=l.length;a<o;++a)i.point((u=l[a])[0],u[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(f)for(l=h.p.z,a=l.length-1;a>=0;--a)i.point((u=l[a])[0],u[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,f=!f}while(!h.v);i.lineEnd()}}}function _u(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function bu(t){return PA(t[0])<=MA?t[0]:kA(t[0])*((PA(t[0])+MA)%TA-MA)}function wu(t,e){var n=bu(e),r=e[1],i=BA(r),a=[BA(n),-RA(n),0],o=0,s=0,A=new dA;1===i?r=SA+bA:-1===i&&(r=-SA-bA);for(var l=0,u=t.length;l<u;++l)if(h=(c=t[l]).length)for(var c,h,f=c[h-1],d=bu(f),p=f[1]/2+EA,m=BA(p),g=RA(p),v=0;v<h;++v,d=y,m=b,g=w,f=x){var x=c[v],y=bu(x),_=x[1]/2+EA,b=BA(_),w=RA(_),M=y-d,S=M>=0?1:-1,E=S*M,T=E>MA,C=m*b;if(A.add(LA(C*S*BA(E),g*w+C*RA(E))),o+=T?M+S*TA:M,T^d>=n^y>=n){var q=yl(vl(f),vl(x));wl(q);var P=yl(a,q);wl(P);var D=(T^M>=0?-1:1)*zA(P[2]);(r>D||r===D&&(q[0]||q[1]))&&(s+=T^M>=0?1:-1)}}return(o<-1e-6||o<bA&&A<-1e-12)^1&s}function Mu(t,e,n,r){return function(i){var a,o,s,A=e(i),l=gu(),u=e(l),c=!1,h={point:f,lineStart:p,lineEnd:m,polygonStart:function(){h.point=g,h.lineStart=v,h.lineEnd=x,o=[],a=[]},polygonEnd:function(){h.point=f,h.lineStart=p,h.lineEnd=m,o=yA(o);var t=wu(a,r);o.length?(c||(i.polygonStart(),c=!0),yu(o,Eu,t,n,i)):t&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),o=a=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function f(e,n){t(e,n)&&i.point(e,n)}function d(t,e){A.point(t,e)}function p(){h.point=d,A.lineStart()}function m(){h.point=f,A.lineEnd()}function g(t,e){s.push([t,e]),u.point(t,e)}function v(){u.lineStart(),s=[]}function x(){g(s[0][0],s[0][1]),u.lineEnd();var t,e,n,r,A=u.clean(),h=l.result(),f=h.length;if(s.pop(),a.push(s),s=null,f)if(1&A){if((e=(n=h[0]).length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else f>1&&2&A&&h.push(h.pop().concat(h.shift())),o.push(h.filter(Su))}return h}}function Su(t){return t.length>1}function Eu(t,e){return((t=t.x)[0]<0?t[1]-SA-bA:SA-t[1])-((e=e.x)[0]<0?e[1]-SA-bA:SA-e[1])}cu.invert=cu;var Tu=Mu((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?MA:-MA,A=PA(a-n);PA(A-MA)<bA?(t.point(n,r=(r+o)/2>0?SA:-SA),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(a,r),e=0):i!==s&&A>=MA&&(PA(n-i)<bA&&(n-=i*bA),PA(a-s)<bA&&(a-=s*bA),r=function(t,e,n,r){var i,a,o=BA(t-n);return PA(o)>bA?DA((BA(e)*(a=RA(r))*BA(n)-BA(r)*(i=RA(e))*BA(t))/(i*a*o)):(e+r)/2}(n,r,a,o),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=a,r=o),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*SA,r.point(-MA,i),r.point(0,i),r.point(MA,i),r.point(MA,0),r.point(MA,-i),r.point(0,-i),r.point(-MA,-i),r.point(-MA,0),r.point(-MA,i);else if(PA(t[0]-e[0])>bA){var a=t[0]<e[0]?MA:-MA;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(e[0],e[1])}),[-MA,-SA]);function Cu(t){var e=RA(t),n=6*qA,r=e>0,i=PA(e)>bA;function a(t,n){return RA(t)*RA(n)>e}function o(t,n,r){var i=[1,0,0],a=yl(vl(t),vl(n)),o=xl(a,a),s=a[0],A=o-s*s;if(!A)return!r&&t;var l=e*o/A,u=-e*s/A,c=yl(i,a),h=bl(i,l);_l(h,bl(a,u));var f=c,d=xl(h,f),p=xl(f,f),m=d*d-p*(xl(h,h)-1);if(!(m<0)){var g=UA(m),v=bl(f,(-d-g)/p);if(_l(v,h),v=gl(v),!r)return v;var x,y=t[0],_=n[0],b=t[1],w=n[1];_<y&&(x=y,y=_,_=x);var M=_-y,S=PA(M-MA)<bA;if(!S&&w<b&&(x=b,b=w,w=x),S||M<bA?S?b+w>0^v[1]<(PA(v[0]-y)<bA?b:w):b<=v[1]&&v[1]<=w:M>MA^(y<=v[0]&&v[0]<=_)){var E=bl(f,(-d+g)/p);return _l(E,h),[v,gl(E)]}}}function s(e,n){var i=r?t:MA-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return Mu(a,(function(t){var e,n,A,l,u;return{lineStart:function(){l=A=!1,u=1},point:function(c,h){var f,d=[c,h],p=a(c,h),m=r?p?0:s(c,h):p?s(c+(c<0?MA:-MA),h):0;if(!e&&(l=A=p)&&t.lineStart(),p!==A&&(!(f=o(e,d))||vu(e,f)||vu(d,f))&&(d[2]=1),p!==A)u=0,p?(t.lineStart(),f=o(d,e),t.point(f[0],f[1])):(f=o(e,d),t.point(f[0],f[1],2),t.lineEnd()),e=f;else if(i&&e&&r^p){var g;m&n||!(g=o(d,e,!0))||(u=0,r?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1],3)))}!p||e&&vu(e,d)||t.point(d[0],d[1]),e=d,A=p,n=m},lineEnd:function(){A&&t.lineEnd(),e=null},clean:function(){return u|(l&&A)<<1}}}),(function(e,r,i,a){!function(t,e,n,r,i,a){if(n){var o=RA(e),s=BA(e),A=r*n;null==i?(i=e+r*TA,a=e-A/2):(i=mu(o,i),a=mu(o,a),(r>0?i<a:i>a)&&(i+=r*TA));for(var l,u=i;r>0?u>a:u<a;u-=A)l=gl([o,-s*RA(u),-s*BA(u)]),t.point(l[0],l[1])}}(a,t,n,i,e,r)}),r?[0,-t]:[-MA,t-MA])}var qu,Pu,Du,Lu,Ru=1e9,Iu=-Ru;function Ou(t,e,n,r){function i(i,a){return t<=i&&i<=n&&e<=a&&a<=r}function a(i,a,s,l){var u=0,c=0;if(null==i||(u=o(i,s))!==(c=o(a,s))||A(i,a)<0^s>0)do{l.point(0===u||3===u?t:n,u>1?r:e)}while((u=(u+s+4)%4)!==c);else l.point(a[0],a[1])}function o(r,i){return PA(r[0]-t)<bA?i>0?0:3:PA(r[0]-n)<bA?i>0?2:1:PA(r[1]-e)<bA?i>0?1:0:i>0?3:2}function s(t,e){return A(t.x,e.x)}function A(t,e){var n=o(t,1),r=o(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(o){var A,l,u,c,h,f,d,p,m,g,v,x=o,y=gu(),_={point:b,lineStart:function(){_.point=w,l&&l.push(u=[]);g=!0,m=!1,d=p=NaN},lineEnd:function(){A&&(w(c,h),f&&m&&y.rejoin(),A.push(y.result()));_.point=b,m&&x.lineEnd()},polygonStart:function(){x=y,A=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;n<i;++n)for(var a,o,s=l[n],A=1,u=s.length,c=s[0],h=c[0],f=c[1];A<u;++A)a=h,o=f,h=(c=s[A])[0],f=c[1],o<=r?f>r&&(h-a)*(r-o)>(f-o)*(t-a)&&++e:f<=r&&(h-a)*(r-o)<(f-o)*(t-a)&&--e;return e}(),n=v&&e,i=(A=yA(A)).length;(n||i)&&(o.polygonStart(),n&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),i&&yu(A,s,e,a,o),o.polygonEnd());x=o,A=l=u=null}};function b(t,e){i(t,e)&&x.point(t,e)}function w(a,o){var s=i(a,o);if(l&&u.push([a,o]),g)c=a,h=o,f=s,g=!1,s&&(x.lineStart(),x.point(a,o));else if(s&&m)x.point(a,o);else{var A=[d=Math.max(Iu,Math.min(Ru,d)),p=Math.max(Iu,Math.min(Ru,p))],y=[a=Math.max(Iu,Math.min(Ru,a)),o=Math.max(Iu,Math.min(Ru,o))];!function(t,e,n,r,i,a){var o,s=t[0],A=t[1],l=0,u=1,c=e[0]-s,h=e[1]-A;if(o=n-s,c||!(o>0)){if(o/=c,c<0){if(o<l)return;o<u&&(u=o)}else if(c>0){if(o>u)return;o>l&&(l=o)}if(o=i-s,c||!(o<0)){if(o/=c,c<0){if(o>u)return;o>l&&(l=o)}else if(c>0){if(o<l)return;o<u&&(u=o)}if(o=r-A,h||!(o>0)){if(o/=h,h<0){if(o<l)return;o<u&&(u=o)}else if(h>0){if(o>u)return;o>l&&(l=o)}if(o=a-A,h||!(o<0)){if(o/=h,h<0){if(o>u)return;o>l&&(l=o)}else if(h>0){if(o<l)return;o<u&&(u=o)}return l>0&&(t[0]=s+l*c,t[1]=A+l*h),u<1&&(e[0]=s+u*c,e[1]=A+u*h),!0}}}}}(A,y,t,e,n,r)?s&&(x.lineStart(),x.point(a,o),v=!1):(m||(x.lineStart(),x.point(A[0],A[1])),x.point(y[0],y[1]),s||x.lineEnd(),v=!1)}d=a,p=o,m=s}return _}}var Bu={sphere:FA,point:FA,lineStart:function(){Bu.point=Uu,Bu.lineEnd=ku},lineEnd:FA,polygonStart:FA,polygonEnd:FA};function ku(){Bu.point=Bu.lineEnd=FA}function Uu(t,e){Pu=t*=qA,Du=BA(e*=qA),Lu=RA(e),Bu.point=zu}function zu(t,e){t*=qA;var n=BA(e*=qA),r=RA(e),i=PA(t-Pu),a=RA(i),o=r*BA(i),s=Lu*n-Du*r*a,A=Du*n+Lu*r*a;qu.add(LA(UA(o*o+s*s),A)),Pu=t,Du=n,Lu=r}var Nu=[null,null],Fu={type:"LineString",coordinates:Nu};function Gu(t,e){return Nu[0]=t,Nu[1]=e,function(t){return qu=new dA,QA(t,Bu),+qu}(Fu)}var Hu={Feature:function(t,e){return Vu(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)if(Vu(n[r].geometry,e))return!0;return!1}},ju={Sphere:function(){return!0},Point:function(t,e){return Wu(t.coordinates,e)},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Wu(n[r],e))return!0;return!1},LineString:function(t,e){return Qu(t.coordinates,e)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Qu(n[r],e))return!0;return!1},Polygon:function(t,e){return Yu(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Yu(n[r],e))return!0;return!1},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)if(Vu(n[r],e))return!0;return!1}};function Vu(t,e){return!(!t||!ju.hasOwnProperty(t.type))&&ju[t.type](t,e)}function Wu(t,e){return 0===Gu(t,e)}function Qu(t,e){for(var n,r,i,a=0,o=t.length;a<o;a++){if(0===(r=Gu(t[a],e)))return!0;if(a>0&&(i=Gu(t[a],t[a-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))<wA*i)return!0;n=r}return!1}function Yu(t,e){return!!wu(t.map(Xu),Zu(e))}function Xu(t){return(t=t.map(Zu)).pop(),t}function Zu(t){return[t[0]*qA,t[1]*qA]}function Ju(t,e){return(t&&Hu.hasOwnProperty(t.type)?Hu[t.type]:Vu)(t,e)}function Ku(t,e,n){var r=_A(t,e-bA,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function $u(t,e,n){var r=_A(t,e-bA,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}function tc(){return function(){var t,e,n,r,i,a,o,s,A,l,u,c,h=10,f=h,d=90,p=360,m=2.5;function g(){return{type:"MultiLineString",coordinates:v()}}function v(){return _A(IA(r/d)*d,n,d).map(u).concat(_A(IA(s/p)*p,o,p).map(c)).concat(_A(IA(e/h)*h,t,h).filter((function(t){return PA(t%d)>bA})).map(A)).concat(_A(IA(a/f)*f,i,f).filter((function(t){return PA(t%p)>bA})).map(l))}return g.lines=function(){return v().map((function(t){return{type:"LineString",coordinates:t}}))},g.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(c(o).slice(1),u(n).reverse().slice(1),c(s).reverse().slice(1))]}},g.extent=function(t){return arguments.length?g.extentMajor(t).extentMinor(t):g.extentMinor()},g.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],o=+t[1][1],r>n&&(t=r,r=n,n=t),s>o&&(t=s,s=o,o=t),g.precision(m)):[[r,s],[n,o]]},g.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],a=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),a>i&&(n=a,a=i,i=n),g.precision(m)):[[e,a],[t,i]]},g.step=function(t){return arguments.length?g.stepMajor(t).stepMinor(t):g.stepMinor()},g.stepMajor=function(t){return arguments.length?(d=+t[0],p=+t[1],g):[d,p]},g.stepMinor=function(t){return arguments.length?(h=+t[0],f=+t[1],g):[h,f]},g.precision=function(h){return arguments.length?(m=+h,A=Ku(a,i,90),l=$u(e,t,m),u=Ku(s,o,90),c=$u(r,n,m),g):m},g.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()()}function ec(t,e){var n=t[0]*qA,r=t[1]*qA,i=e[0]*qA,a=e[1]*qA,o=RA(r),s=BA(r),A=RA(a),l=BA(a),u=o*RA(n),c=o*BA(n),h=A*RA(i),f=A*BA(i),d=2*zA(UA(NA(a-r)+o*A*NA(i-n))),p=BA(d),m=d?function(t){var e=BA(t*=d)/p,n=BA(d-t)/p,r=n*u+e*h,i=n*c+e*f,a=n*s+e*l;return[LA(i,r)*CA,LA(a,UA(r*r+i*i))*CA]}:function(){return[n*CA,r*CA]};return m.distance=d,m}var nc=t=>t;new dA,new dA;var rc=1/0,ic=rc,ac=-rc,oc=ac,sc={point:function(t,e){t<rc&&(rc=t);t>ac&&(ac=t);e<ic&&(ic=e);e>oc&&(oc=e)},lineStart:FA,lineEnd:FA,polygonStart:FA,polygonEnd:FA,result:function(){var t=[[rc,ic],[ac,oc]];return ac=oc=-(ic=rc=1/0),t}};function Ac(t){return function(e){var n=new lc;for(var r in t)n[r]=t[r];return n.stream=e,n}}function lc(){}function uc(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),QA(n,t.stream(sc)),e(sc.result()),null!=r&&t.clipExtent(r),t}function cc(t,e,n){return uc(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+e[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-a*(n[1][1]+n[0][1]))/2;t.scale(150*a).translate([o,s])}),n)}new dA,lc.prototype={constructor:lc,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var hc=RA(30*qA);function fc(t,e){return+e?function(t,e){function n(r,i,a,o,s,A,l,u,c,h,f,d,p,m){var g=l-r,v=u-i,x=g*g+v*v;if(x>4*e&&p--){var y=o+h,_=s+f,b=A+d,w=UA(y*y+_*_+b*b),M=zA(b/=w),S=PA(PA(b)-1)<bA||PA(a-c)<bA?(a+c)/2:LA(_,y),E=t(S,M),T=E[0],C=E[1],q=T-r,P=C-i,D=v*q-g*P;(D*D/x>e||PA((g*q+v*P)/x-.5)>.3||o*h+s*f+A*d<hc)&&(n(r,i,a,o,s,A,T,C,S,y/=w,_/=w,b,p,m),m.point(T,C),n(T,C,S,y,_,b,l,u,c,h,f,d,p,m))}}return function(e){var r,i,a,o,s,A,l,u,c,h,f,d,p={point:m,lineStart:g,lineEnd:x,polygonStart:function(){e.polygonStart(),p.lineStart=y},polygonEnd:function(){e.polygonEnd(),p.lineStart=g}};function m(n,r){n=t(n,r),e.point(n[0],n[1])}function g(){u=NaN,p.point=v,e.lineStart()}function v(r,i){var a=vl([r,i]),o=t(r,i);n(u,c,l,h,f,d,u=o[0],c=o[1],l=r,h=a[0],f=a[1],d=a[2],16,e),e.point(u,c)}function x(){p.point=m,e.lineEnd()}function y(){g(),p.point=_,p.lineEnd=b}function _(t,e){v(r=t,e),i=u,a=c,o=h,s=f,A=d,p.point=v}function b(){n(u,c,l,h,f,d,i,a,r,o,s,A,16,e),p.lineEnd=x,x()}return p}}(t,e):function(t){return Ac({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var dc=Ac({point:function(t,e){this.stream.point(t*qA,e*qA)}});function pc(t,e,n,r,i,a){if(!a)return function(t,e,n,r,i){function a(a,o){return[e+t*(a*=r),n-t*(o*=i)]}return a.invert=function(a,o){return[(a-e)/t*r,(n-o)/t*i]},a}(t,e,n,r,i);var o=RA(a),s=BA(a),A=o*t,l=s*t,u=o/t,c=s/t,h=(s*n-o*e)/t,f=(s*e+o*n)/t;function d(t,a){return[A*(t*=r)-l*(a*=i)+e,n-l*t-A*a]}return d.invert=function(t,e){return[r*(u*t-c*e+h),i*(f-c*t-u*e)]},d}function mc(t){return function(t){var e,n,r,i,a,o,s,A,l,u,c=150,h=480,f=250,d=0,p=0,m=0,g=0,v=0,x=0,y=1,_=1,b=null,w=Tu,M=null,S=nc,E=.5;function T(t){return A(t[0]*qA,t[1]*qA)}function C(t){return(t=A.invert(t[0],t[1]))&&[t[0]*CA,t[1]*CA]}function q(){var t=pc(c,0,0,y,_,x).apply(null,e(d,p)),r=pc(c,h-t[0],f-t[1],y,_,x);return n=hu(m,g,v),s=uu(e,r),A=uu(n,s),o=fc(s,E),P()}function P(){return l=u=null,T}return T.stream=function(t){return l&&u===t?l:l=dc(function(t){return Ac({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(w(o(S(u=t)))))},T.preclip=function(t){return arguments.length?(w=t,b=void 0,P()):w},T.postclip=function(t){return arguments.length?(S=t,M=r=i=a=null,P()):S},T.clipAngle=function(t){return arguments.length?(w=+t?Cu(b=t*qA):(b=null,Tu),P()):b*CA},T.clipExtent=function(t){return arguments.length?(S=null==t?(M=r=i=a=null,nc):Ou(M=+t[0][0],r=+t[0][1],i=+t[1][0],a=+t[1][1]),P()):null==M?null:[[M,r],[i,a]]},T.scale=function(t){return arguments.length?(c=+t,q()):c},T.translate=function(t){return arguments.length?(h=+t[0],f=+t[1],q()):[h,f]},T.center=function(t){return arguments.length?(d=t[0]%360*qA,p=t[1]%360*qA,q()):[d*CA,p*CA]},T.rotate=function(t){return arguments.length?(m=t[0]%360*qA,g=t[1]%360*qA,v=t.length>2?t[2]%360*qA:0,q()):[m*CA,g*CA,v*CA]},T.angle=function(t){return arguments.length?(x=t%360*qA,q()):x*CA},T.reflectX=function(t){return arguments.length?(y=t?-1:1,q()):y<0},T.reflectY=function(t){return arguments.length?(_=t?-1:1,q()):_<0},T.precision=function(t){return arguments.length?(o=fc(s,E=t*t),P()):UA(E)},T.fitExtent=function(t,e){return cc(T,t,e)},T.fitSize=function(t,e){return function(t,e,n){return cc(t,[[0,0],e],n)}(T,t,e)},T.fitWidth=function(t,e){return function(t,e,n){return uc(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];t.scale(150*i).translate([a,o])}),n)}(T,t,e)},T.fitHeight=function(t,e){return function(t,e,n){return uc(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([a,o])}),n)}(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,q()}}((function(){return t}))()}function gc(t,e){return[t,e]}function vc(t,e){var n=RA(e),r=1+RA(t)*n;return[n*BA(t)/r,BA(e)/r]}function xc(){return mc(vc).scale(250).clipAngle(142)}function yc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _c(t){return _c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},_c(t)}function bc(t,e){return bc=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},bc(t,e)}function wc(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Mc(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=_c(t);if(e){var i=_c(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return wc(this,n)}}function Sc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(t,e)||Ec(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ec(t,e){if(t){if("string"==typeof t)return Tc(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tc(t,e):void 0}}function Tc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}gc.invert=gc,vc.invert=function(t){return function(e,n){var r=UA(e*e+n*n),i=t(r),a=BA(i),o=RA(i);return[LA(e*a,r*o),zA(r&&n*a/r)]}}((function(t){return 2*DA(t)}));var Cc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],r=null;return t.forEach((function(t){if(r){var i=180*Gu(t,r)/Math.PI;if(i>e)for(var a=ec(r,t),o=1/Math.ceil(i/e),s=o;s<1;)n.push(a(s)),s+=o}n.push(r=t)})),n},qc="undefined"!=typeof window&&window.THREE?window.THREE:{BufferGeometry:nn,Float32BufferAttribute:Ye},Pc=(new qc.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Dc=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&bc(t,e)}(n,t);var e=Mc(n);function n(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;yc(this,n),(r=e.call(this)).type="GeoJsonGeometry",r.parameters={geoJson:t,radius:i,resolution:a};var o=({Point:u,MultiPoint:c,LineString:h,MultiLineString:f,Polygon:d,MultiPolygon:p}[t.type]||function(){return[]})(t.coordinates,i),s=[],A=[],l=0;function u(t,e){return[{vertices:Ic(t[1],t[0],e),indices:[]}]}function c(t,e){var n={vertices:[],indices:[]};return t.map((function(t){return u(t,e)})).forEach((function(t){var e=Sc(t,1)[0];Lc(n,e)})),[n]}function h(t,e){for(var n=Cc(t,a).map((function(t){var n=Sc(t,2),r=n[0];return Ic(n[1],r,e)})),r=Os.exports.flatten([n]).vertices,i=Math.round(r.length/3),o=[],s=1;s<i;s++)o.push(s-1,s);return[{vertices:r,indices:o}]}function f(t,e){var n={vertices:[],indices:[]};return t.map((function(t){return h(t,e)})).forEach((function(t){var e=Sc(t,1)[0];Lc(n,e)})),[n]}function d(t,e){for(var n=t.map((function(t){return Cc(t,a).map((function(t){var n=Sc(t,2),r=n[0];return Ic(n[1],r,e)}))})),r=Os.exports.flatten(n),i=r.vertices,o=r.holes,s=o[0]||1/0,A=i.slice(0,3*s),l=i.slice(3*s),u=new Set(o),c=Math.round(i.length/3),h=[],f=[],d=1;d<c;d++)u.has(d)||(d<s?h.push(d-1,d):f.push(d-1-s,d-s));var p=[{indices:h,vertices:A}];return o.length&&p.push({indices:f,vertices:l}),p}function p(t,e){var n={vertices:[],indices:[]},r={vertices:[],indices:[]};t.map((function(t){return d(t,e)})).forEach((function(t){var e=Sc(t,2),i=e[0],a=e[1];Lc(n,i),a&&Lc(r,a)}));var i=[n];return r.vertices.length&&i.push(r),i}return o.forEach((function(t){var e=s.length;Lc({indices:s,vertices:A},t),r.addGroup(e,s.length-e,l++)})),s.length&&r.setIndex(s),A.length&&r[Pc]("position",new qc.Float32BufferAttribute(A,3)),r}return n}(qc.BufferGeometry);function Lc(t,e){var n=Math.round(t.vertices.length/3);Rc(t.vertices,e.vertices),Rc(t.indices,e.indices.map((function(t){return t+n})))}function Rc(t,e){var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ec(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.push(i)}}catch(t){r.e(t)}finally{r.f()}}function Ic(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-t)*Math.PI/180,i=(90-e)*Math.PI/180;return[n*Math.sin(r)*Math.cos(i),n*Math.cos(r),n*Math.sin(r)*Math.sin(i)]}function Oc(t){let e,n,r,i=0;for(let a=0;a<t.length;++a){const o=t[a];if(o.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===e&&(e=o.array.constructor),e!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=o.itemSize),n!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===r&&(r=o.normalized),r!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=o.array.length}const a=new e(i);let o=0;for(let e=0;e<t.length;++e)a.set(t[e].array,o),o+=t[e].array.length;return new Ve(a,n,r)}function Bc(t){const e=t.data.array.constructor,n=t.count,r=t.itemSize,i=t.normalized,a=new e(n*r);let o;o=t.isInstancedInterleavedBufferAttribute?new Sa(a,r,i,t.meshPerAttribute):new Ve(a,r,i);for(let e=0;e<n;e++)o.setX(e,t.getX(e)),r>=2&&o.setY(e,t.getY(e)),r>=3&&o.setZ(e,t.getZ(e)),r>=4&&o.setW(e,t.getW(e));return o}var kc=Object.freeze({__proto__:null,deinterleaveAttribute:Bc,deinterleaveGeometry:function(t){const e=t.attributes,n=t.morphTargets,r=new Map;for(const t in e){const n=e[t];n.isInterleavedBufferAttribute&&(r.has(n)||r.set(n,Bc(n)),e[t]=r.get(n))}for(const t in n){const e=n[t];e.isInterleavedBufferAttribute&&(r.has(e)||r.set(e,Bc(e)),n[t]=r.get(e))}},computeTangents:function(){throw new Error("BufferGeometryUtils: computeTangents renamed to computeMikkTSpaceTangents.")},computeMikkTSpaceTangents:function(t,e,n=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!t.hasAttribute("position")||!t.hasAttribute("normal")||!t.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function r(t){if(t.normalized||t.isInterleavedBufferAttribute){const e=t.isInterleavedBufferAttribute?t.data.array:t.array,n=new Float32Array(t.getCount()*t.itemSize);for(let r=0,i=0;r<t.getCount();r++)n[i++]=$.denormalize(t.getX(r),e),n[i++]=$.denormalize(t.getY(r),e),t.itemSize>2&&(n[i++]=$.denormalize(t.getZ(r),e));return n}return t.array instanceof Float32Array?t.array:new Float32Array(t.array)}const i=t.index?t.toNonIndexed():t,a=e.generateTangents(r(i.attributes.position),r(i.attributes.normal),r(i.attributes.uv));if(n)for(let t=3;t<a.length;t+=4)a[t]*=-1;return i.setAttribute("tangent",new Ve(a,4)),t!==i&&t.copy(i),t},mergeBufferGeometries:function(t,e=!1){const n=null!==t[0].index,r=new Set(Object.keys(t[0].attributes)),i=new Set(Object.keys(t[0].morphAttributes)),a={},o={},s=t[0].morphTargetsRelative,A=new nn;let l=0;for(let u=0;u<t.length;++u){const c=t[u];let h=0;if(n!==(null!==c.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const t in c.attributes){if(!r.has(t))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+t+'" attribute exists among all geometries, or in none of them.'),null;void 0===a[t]&&(a[t]=[]),a[t].push(c.attributes[t]),h++}if(h!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(s!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const t in c.morphAttributes){if(!i.has(t))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[t]&&(o[t]=[]),o[t].push(c.morphAttributes[t])}if(A.userData.mergedUserData=A.userData.mergedUserData||[],A.userData.mergedUserData.push(c.userData),e){let t;if(n)t=c.index.count;else{if(void 0===c.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;t=c.attributes.position.count}A.addGroup(l,t,u),l+=t}}if(n){let e=0;const n=[];for(let r=0;r<t.length;++r){const i=t[r].index;for(let t=0;t<i.count;++t)n.push(i.getX(t)+e);e+=t[r].attributes.position.count}A.setIndex(n)}for(const t in a){const e=Oc(a[t]);if(!e)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;A.setAttribute(t,e)}for(const t in o){const e=o[t][0].length;if(0===e)break;A.morphAttributes=A.morphAttributes||{},A.morphAttributes[t]=[];for(let n=0;n<e;++n){const e=[];for(let r=0;r<o[t].length;++r)e.push(o[t][r][n]);const r=Oc(e);if(!r)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" morphAttribute."),null;A.morphAttributes[t].push(r)}}return A},mergeBufferAttributes:Oc,interleaveAttributes:function(t){let e,n=0,r=0;for(let i=0,a=t.length;i<a;++i){const a=t[i];if(void 0===e&&(e=a.array.constructor),e!==a.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;n+=a.array.length,r+=a.itemSize}const i=new ba(new e(n),r);let a=0;const o=[],s=["getX","getY","getZ","getW"],A=["setX","setY","setZ","setW"];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.itemSize,l=n.count,u=new Ma(i,r,a,n.normalized);o.push(u),a+=r;for(let t=0;t<l;t++)for(let e=0;e<r;e++)u[A[e]](t,n[s[e]](t))}return o},estimateBytesUsed:function(t){let e=0;for(const n in t.attributes){const r=t.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}const n=t.getIndex();return e+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,e},mergeVertices:function(t,e=1e-4){e=Math.max(e,Number.EPSILON);const n={},r=t.getIndex(),i=t.getAttribute("position"),a=r?r.count:i.count;let o=0;const s=Object.keys(t.attributes),A={},l={},u=[],c=["getX","getY","getZ","getW"];for(let e=0,n=s.length;e<n;e++){const n=s[e];A[n]=[];const r=t.morphAttributes[n];r&&(l[n]=new Array(r.length).fill().map((()=>[])))}const h=Math.log10(1/e),f=Math.pow(10,h);for(let e=0;e<a;e++){const i=r?r.getX(e):e;let a="";for(let e=0,n=s.length;e<n;e++){const n=s[e],r=t.getAttribute(n),o=r.itemSize;for(let t=0;t<o;t++)a+=~~(r[c[t]](i)*f)+","}if(a in n)u.push(n[a]);else{for(let e=0,n=s.length;e<n;e++){const n=s[e],r=t.getAttribute(n),a=t.morphAttributes[n],o=r.itemSize,u=A[n],h=l[n];for(let t=0;t<o;t++){const e=c[t];if(u.push(r[e](i)),a)for(let t=0,n=a.length;t<n;t++)h[t].push(a[t][e](i))}}n[a]=o,u.push(o),o++}}const d=t.clone();for(let e=0,n=s.length;e<n;e++){const n=s[e],r=t.getAttribute(n),i=new r.array.constructor(A[n]),a=new Ve(i,r.itemSize,r.normalized);if(d.setAttribute(n,a),n in l)for(let e=0;e<l[n].length;e++){const r=t.morphAttributes[n][e],i=new r.array.constructor(l[n][e]),a=new Ve(i,r.itemSize,r.normalized);d.morphAttributes[n][e]=a}}return d.setIndex(u),d},toTrianglesDrawMode:function(t,e){if(0===e)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(2===e||1===e){let n=t.getIndex();if(null===n){const e=[],r=t.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<r.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const r=n.count-2,i=[];if(2===e)for(let t=1;t<=r;t++)i.push(n.getX(0)),i.push(n.getX(t)),i.push(n.getX(t+1));else for(let t=0;t<r;t++)t%2==0?(i.push(n.getX(t)),i.push(n.getX(t+1)),i.push(n.getX(t+2))):(i.push(n.getX(t+2)),i.push(n.getX(t+1)),i.push(n.getX(t)));i.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=t.clone();return a.setIndex(i),a.clearGroups(),a}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t},computeMorphedAttributes:function(t){if(!0!==t.geometry.isBufferGeometry)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;const e=new Et,n=new Et,r=new Et,i=new Et,a=new Et,o=new Et,s=new Et,A=new Et,l=new Et;function u(t,u,c,h,f,d,p,m){e.fromBufferAttribute(u,f),n.fromBufferAttribute(u,d),r.fromBufferAttribute(u,p);const g=t.morphTargetInfluences;if(c&&g){s.set(0,0,0),A.set(0,0,0),l.set(0,0,0);for(let t=0,u=c.length;t<u;t++){const u=g[t],m=c[t];0!==u&&(i.fromBufferAttribute(m,f),a.fromBufferAttribute(m,d),o.fromBufferAttribute(m,p),h?(s.addScaledVector(i,u),A.addScaledVector(a,u),l.addScaledVector(o,u)):(s.addScaledVector(i.sub(e),u),A.addScaledVector(a.sub(n),u),l.addScaledVector(o.sub(r),u)))}e.add(s),n.add(A),r.add(l)}t.isSkinnedMesh&&(t.boneTransform(f,e),t.boneTransform(d,n),t.boneTransform(p,r)),m[3*f+0]=e.x,m[3*f+1]=e.y,m[3*f+2]=e.z,m[3*d+0]=n.x,m[3*d+1]=n.y,m[3*d+2]=n.z,m[3*p+0]=r.x,m[3*p+1]=r.y,m[3*p+2]=r.z}const c=t.geometry,h=t.material;let f,d,p;const m=c.index,g=c.attributes.position,v=c.morphAttributes.position,x=c.morphTargetsRelative,y=c.attributes.normal,_=c.morphAttributes.position,b=c.groups,w=c.drawRange;let M,S,E,T,C,q,P;const D=new Float32Array(g.count*g.itemSize),L=new Float32Array(y.count*y.itemSize);if(null!==m)if(Array.isArray(h))for(M=0,E=b.length;M<E;M++)for(C=b[M],q=Math.max(C.start,w.start),P=Math.min(C.start+C.count,w.start+w.count),S=q,T=P;S<T;S+=3)f=m.getX(S),d=m.getX(S+1),p=m.getX(S+2),u(t,g,v,x,f,d,p,D),u(t,y,_,x,f,d,p,L);else for(q=Math.max(0,w.start),P=Math.min(m.count,w.start+w.count),M=q,E=P;M<E;M+=3)f=m.getX(M),d=m.getX(M+1),p=m.getX(M+2),u(t,g,v,x,f,d,p,D),u(t,y,_,x,f,d,p,L);else if(Array.isArray(h))for(M=0,E=b.length;M<E;M++)for(C=b[M],q=Math.max(C.start,w.start),P=Math.min(C.start+C.count,w.start+w.count),S=q,T=P;S<T;S+=3)f=S,d=S+1,p=S+2,u(t,g,v,x,f,d,p,D),u(t,y,_,x,f,d,p,L);else for(q=Math.max(0,w.start),P=Math.min(g.count,w.start+w.count),M=q,E=P;M<E;M+=3)f=M,d=M+1,p=M+2,u(t,g,v,x,f,d,p,D),u(t,y,_,x,f,d,p,L);return{positionAttribute:g,normalAttribute:y,morphedPositionAttribute:new Ye(D,3),morphedNormalAttribute:new Ye(L,3)}},mergeGroups:function(t){if(0===t.groups.length)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),t;let e=t.groups;if(e=e.sort(((t,e)=>t.materialIndex!==e.materialIndex?t.materialIndex-e.materialIndex:t.start-e.start)),null===t.getIndex()){const e=t.getAttribute("position"),n=[];for(let t=0;t<e.count;t+=3)n.push(t,t+1,t+2);t.setIndex(n)}const n=t.getIndex(),r=[];for(let t=0;t<e.length;t++){const i=e[t],a=i.start,o=a+i.count;for(let t=a;t<o;t++)r.push(n.getX(t))}t.dispose(),t.setIndex(r);let i=0;for(let t=0;t<e.length;t++){const n=e[t];n.start=i,i+=n.count}let a=e[0];t.groups=[a];for(let n=1;n<e.length;n++){const r=e[n];a.materialIndex===r.materialIndex?a.count+=r.count:(a=r,t.groups.push(a))}return t}}),Uc=function(t){return t instanceof Function?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}},zc={exports:{}};!function(t){!function(e){var n=/^\s+/,r=/\s+$/,i=0,a=e.round,o=e.min,s=e.max,A=e.random;function l(t,A){if(A=A||{},(t=t||"")instanceof l)return t;if(!(this instanceof l))return new l(t,A);var u=function(t){var i={r:0,g:0,b:0},a=1,A=null,l=null,u=null,c=!1,h=!1;"string"==typeof t&&(t=function(t){t=t.replace(n,"").replace(r,"").toLowerCase();var e,i=!1;if(T[t])t=T[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(e=N.rgb.exec(t))return{r:e[1],g:e[2],b:e[3]};if(e=N.rgba.exec(t))return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=N.hsl.exec(t))return{h:e[1],s:e[2],l:e[3]};if(e=N.hsla.exec(t))return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=N.hsv.exec(t))return{h:e[1],s:e[2],v:e[3]};if(e=N.hsva.exec(t))return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=N.hex8.exec(t))return{r:L(e[1]),g:L(e[2]),b:L(e[3]),a:B(e[4]),format:i?"name":"hex8"};if(e=N.hex6.exec(t))return{r:L(e[1]),g:L(e[2]),b:L(e[3]),format:i?"name":"hex"};if(e=N.hex4.exec(t))return{r:L(e[1]+""+e[1]),g:L(e[2]+""+e[2]),b:L(e[3]+""+e[3]),a:B(e[4]+""+e[4]),format:i?"name":"hex8"};if(e=N.hex3.exec(t))return{r:L(e[1]+""+e[1]),g:L(e[2]+""+e[2]),b:L(e[3]+""+e[3]),format:i?"name":"hex"};return!1}(t));"object"==typeof t&&(F(t.r)&&F(t.g)&&F(t.b)?(f=t.r,d=t.g,p=t.b,i={r:255*P(f,255),g:255*P(d,255),b:255*P(p,255)},c=!0,h="%"===String(t.r).substr(-1)?"prgb":"rgb"):F(t.h)&&F(t.s)&&F(t.v)?(A=I(t.s),l=I(t.v),i=function(t,n,r){t=6*P(t,360),n=P(n,100),r=P(r,100);var i=e.floor(t),a=t-i,o=r*(1-n),s=r*(1-a*n),A=r*(1-(1-a)*n),l=i%6;return{r:255*[r,s,o,o,A,r][l],g:255*[A,r,r,s,o,o][l],b:255*[o,o,A,r,r,s][l]}}(t.h,A,l),c=!0,h="hsv"):F(t.h)&&F(t.s)&&F(t.l)&&(A=I(t.s),u=I(t.l),i=function(t,e,n){var r,i,a;function o(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+(e-t)*(2/3-n)*6:t}if(t=P(t,360),e=P(e,100),n=P(n,100),0===e)r=i=a=n;else{var s=n<.5?n*(1+e):n+e-n*e,A=2*n-s;r=o(A,s,t+1/3),i=o(A,s,t),a=o(A,s,t-1/3)}return{r:255*r,g:255*i,b:255*a}}(t.h,A,u),c=!0,h="hsl"),t.hasOwnProperty("a")&&(a=t.a));var f,d,p;return a=q(a),{ok:c,format:t.format||h,r:o(255,s(i.r,0)),g:o(255,s(i.g,0)),b:o(255,s(i.b,0)),a:a}}(t);this._originalInput=t,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=a(100*this._a)/100,this._format=A.format||u.format,this._gradientType=A.gradientType,this._r<1&&(this._r=a(this._r)),this._g<1&&(this._g=a(this._g)),this._b<1&&(this._b=a(this._b)),this._ok=u.ok,this._tc_id=i++}function u(t,e,n){t=P(t,255),e=P(e,255),n=P(n,255);var r,i,a=s(t,e,n),A=o(t,e,n),l=(a+A)/2;if(a==A)r=i=0;else{var u=a-A;switch(i=l>.5?u/(2-a-A):u/(a+A),a){case t:r=(e-n)/u+(e<n?6:0);break;case e:r=(n-t)/u+2;break;case n:r=(t-e)/u+4}r/=6}return{h:r,s:i,l:l}}function c(t,e,n){t=P(t,255),e=P(e,255),n=P(n,255);var r,i,a=s(t,e,n),A=o(t,e,n),l=a,u=a-A;if(i=0===a?0:u/a,a==A)r=0;else{switch(a){case t:r=(e-n)/u+(e<n?6:0);break;case e:r=(n-t)/u+2;break;case n:r=(t-e)/u+4}r/=6}return{h:r,s:i,v:l}}function h(t,e,n,r){var i=[R(a(t).toString(16)),R(a(e).toString(16)),R(a(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function f(t,e,n,r){return[R(O(r)),R(a(t).toString(16)),R(a(e).toString(16)),R(a(n).toString(16))].join("")}function d(t,e){e=0===e?0:e||10;var n=l(t).toHsl();return n.s-=e/100,n.s=D(n.s),l(n)}function p(t,e){e=0===e?0:e||10;var n=l(t).toHsl();return n.s+=e/100,n.s=D(n.s),l(n)}function m(t){return l(t).desaturate(100)}function g(t,e){e=0===e?0:e||10;var n=l(t).toHsl();return n.l+=e/100,n.l=D(n.l),l(n)}function v(t,e){e=0===e?0:e||10;var n=l(t).toRgb();return n.r=s(0,o(255,n.r-a(-e/100*255))),n.g=s(0,o(255,n.g-a(-e/100*255))),n.b=s(0,o(255,n.b-a(-e/100*255))),l(n)}function x(t,e){e=0===e?0:e||10;var n=l(t).toHsl();return n.l-=e/100,n.l=D(n.l),l(n)}function y(t,e){var n=l(t).toHsl(),r=(n.h+e)%360;return n.h=r<0?360+r:r,l(n)}function _(t){var e=l(t).toHsl();return e.h=(e.h+180)%360,l(e)}function b(t){var e=l(t).toHsl(),n=e.h;return[l(t),l({h:(n+120)%360,s:e.s,l:e.l}),l({h:(n+240)%360,s:e.s,l:e.l})]}function w(t){var e=l(t).toHsl(),n=e.h;return[l(t),l({h:(n+90)%360,s:e.s,l:e.l}),l({h:(n+180)%360,s:e.s,l:e.l}),l({h:(n+270)%360,s:e.s,l:e.l})]}function M(t){var e=l(t).toHsl(),n=e.h;return[l(t),l({h:(n+72)%360,s:e.s,l:e.l}),l({h:(n+216)%360,s:e.s,l:e.l})]}function S(t,e,n){e=e||6,n=n||30;var r=l(t).toHsl(),i=360/n,a=[l(t)];for(r.h=(r.h-(i*e>>1)+720)%360;--e;)r.h=(r.h+i)%360,a.push(l(r));return a}function E(t,e){e=e||6;for(var n=l(t).toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/e;e--;)o.push(l({h:r,s:i,v:a})),a=(a+s)%1;return o}l.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,n,r,i=this.toRgb();return t=i.r/255,n=i.g/255,r=i.b/255,.2126*(t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:e.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=q(t),this._roundA=a(100*this._a)/100,this},toHsv:function(){var t=c(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=c(this._r,this._g,this._b),e=a(360*t.h),n=a(100*t.s),r=a(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+r+"%)":"hsva("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=u(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=u(this._r,this._g,this._b),e=a(360*t.h),n=a(100*t.s),r=a(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+r+"%)":"hsla("+e+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return h(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,n,r,i){var o=[R(a(t).toString(16)),R(a(e).toString(16)),R(a(n).toString(16)),R(O(r))];if(i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:a(this._r),g:a(this._g),b:a(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+a(this._r)+", "+a(this._g)+", "+a(this._b)+")":"rgba("+a(this._r)+", "+a(this._g)+", "+a(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:a(100*P(this._r,255))+"%",g:a(100*P(this._g,255))+"%",b:a(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*P(this._r,255))+"%, "+a(100*P(this._g,255))+"%, "+a(100*P(this._b,255))+"%)":"rgba("+a(100*P(this._r,255))+"%, "+a(100*P(this._g,255))+"%, "+a(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(C[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+f(this._r,this._g,this._b,this._a),n=e,r=this._gradientType?"GradientType = 1, ":"";if(t){var i=l(t);n="#"+f(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return l(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(g,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},l.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]="a"===r?t[r]:I(t[r]));t=n}return l(t,e)},l.equals=function(t,e){return!(!t||!e)&&l(t).toRgbString()==l(e).toRgbString()},l.random=function(){return l.fromRatio({r:A(),g:A(),b:A()})},l.mix=function(t,e,n){n=0===n?0:n||50;var r=l(t).toRgb(),i=l(e).toRgb(),a=n/100;return l({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},
3
3
  // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
4
4
  // Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
5
5
  l.readability=function(t,n){var r=l(t),i=l(n);return(e.max(r.getLuminance(),i.getLuminance())+.05)/(e.min(r.getLuminance(),i.getLuminance())+.05)},l.isReadable=function(t,e,n){var r,i,a=l.readability(t,e);switch(i=!1,(r=function(t){var e,n;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==n&&"large"!==n&&(n="small");return{level:e,size:n}}(n)).level+r.size){case"AAsmall":case"AAAlarge":i=a>=4.5;break;case"AAlarge":i=a>=3;break;case"AAAsmall":i=a>=7}return i},l.mostReadable=function(t,e,n){var r,i,a,o,s=null,A=0;i=(n=n||{}).includeFallbackColors,a=n.level,o=n.size;for(var u=0;u<e.length;u++)(r=l.readability(t,e[u]))>A&&(A=r,s=l(e[u]));return l.isReadable(t,s,{level:a,size:o})||!i?s:(n.includeFallbackColors=!1,l.mostReadable(t,["#fff","#000"],n))};var T=l.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},C=l.hexNames=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(T);function q(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function P(t,n){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=o(n,s(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function D(t){return o(1,s(0,t))}function L(t){return parseInt(t,16)}function R(t){return 1==t.length?"0"+t:""+t}function I(t){return t<=1&&(t=100*t+"%"),t}function O(t){return e.round(255*parseFloat(t)).toString(16)}function B(t){return L(t)/255}var k,U,z,N=(U="[\\s|\\(]+("+(k="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+k+")[,|\\s]+("+k+")\\s*\\)?",z="[\\s|\\(]+("+k+")[,|\\s]+("+k+")[,|\\s]+("+k+")[,|\\s]+("+k+")\\s*\\)?",{CSS_UNIT:new RegExp(k),rgb:new RegExp("rgb"+U),rgba:new RegExp("rgba"+z),hsl:new RegExp("hsl"+U),hsla:new RegExp("hsla"+z),hsv:new RegExp("hsv"+U),hsva:new RegExp("hsva"+z),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function F(t){return!!N.CSS_UNIT.exec(t)}t.exports?t.exports=l:window.tinycolor=l}(Math)}(zc);var Nc=zc.exports;function Fc(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Gc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(t,e)||jc(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hc(t){return function(t){if(Array.isArray(t))return Vc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||jc(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jc(t,e){if(t){if("string"==typeof t)return Vc(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vc(t,e):void 0}}function Vc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Wc(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var Qc=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=(e instanceof Array?e.length?e:[void 0]:[e]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),a=t.reduce((function(t,e){var r=t,a=e;return i.forEach((function(t,e){var o,s=t.keyAccessor;if(t.isProp){var A=a,l=A[s],u=Fc(A,[s].map(Wc));o=l,a=u}else o=s(a,e);e+1<i.length?(r.hasOwnProperty(o)||(r[o]={}),r=r[o]):n?(r.hasOwnProperty(o)||(r[o]=[]),r[o].push(a)):r[o]=a})),t}),{});n instanceof Function&&function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;r===i.length?Object.keys(e).forEach((function(t){return e[t]=n(e[t])})):Object.values(e).forEach((function(e){return t(e,r+1)}))}(a);var o=a;return r&&(o=[],function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];n.length===i.length?o.push({keys:n,vals:e}):Object.entries(e).forEach((function(e){var r=Gc(e,2),i=r[0],a=r[1];return t(a,[].concat(Hc(n),[i]))}))}(a),e instanceof Array&&0===e.length&&1===o.length&&(o[0].keys=[])),o};function Yc(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Xc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Zc(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Jc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(t,e)||$c(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kc(t){return function(t){if(Array.isArray(t))return th(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $c(t,e){if(t){if("string"==typeof t)return th(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?th(t,e):void 0}}function th(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var eh=["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"];function nh(t,e,n){var r=n.objBindAttr,i=void 0===r?"__obj":r,a=n.dataBindAttr,o=void 0===a?"__data":a,s=n.idAccessor,A=n.purge,l=void 0!==A&&A,u=function(t){return t.hasOwnProperty(o)},c=e.filter((function(t){return!u(t)})),h=e.filter(u).map((function(t){return t[o]})),f=l?{enter:t,exit:h,update:[]}:function(t,e,n){var r={enter:[],update:[],exit:[]};if(n){var i=Qc(t,n,!1),a=Qc(e,n,!1),o=Object.assign({},i,a);Object.entries(o).forEach((function(t){var e=Jc(t,2),n=e[0],o=e[1],s=i.hasOwnProperty(n)?a.hasOwnProperty(n)?"update":"exit":"enter";r[s].push("update"===s?[i[n],a[n]]:o)}))}else{var s=new Set(t),A=new Set(e);new Set([].concat(Kc(s),Kc(A))).forEach((function(t){var e=s.has(t)?A.has(t)?"update":"exit":"enter";r[e].push("update"===e?[t,t]:t)}))}return r}(h,t,s);return f.update=f.update.map((function(t){var e=Jc(t,2),n=e[0],r=e[1];return n!==r&&(r[i]=n[i],r[i][o]=r),r})),f.exit=f.exit.concat(c.map((function(t){return Xc({},i,t)}))),f}function rh(t,e,n,r,i){var a=i.createObj,o=void 0===a?function(t){return{}}:a,s=i.updateObj,A=void 0===s?function(t,e){}:s,l=i.exitObj,u=void 0===l?function(t){}:l,c=i.objBindAttr,h=void 0===c?"__obj":c,f=i.dataBindAttr,d=void 0===f?"__data":f,p=Zc(i,eh),m=nh(t,e,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Yc(Object(n),!0).forEach((function(e){Xc(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Yc(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({objBindAttr:h,dataBindAttr:d},p)),g=m.enter,v=m.update;m.exit.forEach((function(t){var e=t[h];delete t[h],u(e),r(e)}));var x=function(t){var e=[];return t.forEach((function(t){var n=o(t);n&&(n[d]=t,t[h]=n,e.push(n))})),e}(g);!function(t){t.forEach((function(t){var e=t[h];e&&(e[d]=t,A(e,t))}))}([].concat(Kc(g),Kc(v))),x.forEach(n)}var ih={exports:{}};!function(t,e){t.exports=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var r=n(1),i=function(){function t(t,e,n){void 0===t&&(t=NaN),void 0===e&&(e=NaN),void 0===n&&(n=!1),this._minFPS=e,this._maxFPS=t,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new r.default,this._onPause=new r.default,this._onTick=new r.default,this._onTickOncePerFrame=new r.default,n||this.resume()}return t.prototype.updateOnce=function(t){t(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},t.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},t.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},t.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(t.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"timeScale",{get:function(){return this._timeScale},set:function(t){this._timeScale!==t&&(this._timeScale=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),t.prototype.animateOnce=function(){var t=this;this._animationFrameHandle=window.requestAnimationFrame((function(){return t.onFrame()}))},t.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},t.prototype.update=function(t,e){void 0===e&&(e=!0),this._currentTick++,this._currentTime+=t,this._tickDeltaTime=t,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),e&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},t.prototype.getTimer=function(){return Date.now()},t}();Object.defineProperty(e,"__esModule",{value:!0}),e.default=i},function(t,e,n){!function(e,n){t.exports=n()}(0,(function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e){var n=function(){function t(){this.functions=[]}return t.prototype.add=function(t){return-1===this.functions.indexOf(t)&&(this.functions.push(t),!0)},t.prototype.remove=function(t){var e=this.functions.indexOf(t);return e>-1&&(this.functions.splice(e,1),!0)},t.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.functions.concat().forEach((function(e){e.apply(void 0,t)}))},Object.defineProperty(t.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),t}();Object.defineProperty(e,"__esModule",{value:!0}),e.default=n}])}))}])}(ih);var ah=us(ih.exports);function oh(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function sh(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ah(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function lh(){}var uh=.7,ch=1/uh,hh="\\s*([+-]?\\d+)\\s*",fh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",dh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ph=/^#([0-9a-f]{3,8})$/,mh=new RegExp(`^rgb\\(${hh},${hh},${hh}\\)$`),gh=new RegExp(`^rgb\\(${dh},${dh},${dh}\\)$`),vh=new RegExp(`^rgba\\(${hh},${hh},${hh},${fh}\\)$`),xh=new RegExp(`^rgba\\(${dh},${dh},${dh},${fh}\\)$`),yh=new RegExp(`^hsl\\(${fh},${dh},${dh}\\)$`),_h=new RegExp(`^hsla\\(${fh},${dh},${dh},${fh}\\)$`),bh={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};function wh(){return this.rgb().formatHex()}function Mh(){return this.rgb().formatRgb()}function Sh(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ph.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Eh(e):3===n?new Ph(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Th(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Th(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=mh.exec(t))?new Ph(e[1],e[2],e[3],1):(e=gh.exec(t))?new Ph(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=vh.exec(t))?Th(e[1],e[2],e[3],e[4]):(e=xh.exec(t))?Th(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=yh.exec(t))?Bh(e[1],e[2]/100,e[3]/100,1):(e=_h.exec(t))?Bh(e[1],e[2]/100,e[3]/100,e[4]):bh.hasOwnProperty(t)?Eh(bh[t]):"transparent"===t?new Ph(NaN,NaN,NaN,0):null}function Eh(t){return new Ph(t>>16&255,t>>8&255,255&t,1)}function Th(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ph(t,e,n,r)}function Ch(t){return t instanceof lh||(t=Sh(t)),t?new Ph((t=t.rgb()).r,t.g,t.b,t.opacity):new Ph}function qh(t,e,n,r){return 1===arguments.length?Ch(t):new Ph(t,e,n,null==r?1:r)}function Ph(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Dh(){return`#${Oh(this.r)}${Oh(this.g)}${Oh(this.b)}`}function Lh(){const t=Rh(this.opacity);return`${1===t?"rgb(":"rgba("}${Ih(this.r)}, ${Ih(this.g)}, ${Ih(this.b)}${1===t?")":`, ${t})`}`}function Rh(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ih(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Oh(t){return((t=Ih(t))<16?"0":"")+t.toString(16)}function Bh(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Uh(t,e,n,r)}function kh(t){if(t instanceof Uh)return new Uh(t.h,t.s,t.l,t.opacity);if(t instanceof lh||(t=Sh(t)),!t)return new Uh;if(t instanceof Uh)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,s=a-i,A=(a+i)/2;return s?(o=e===a?(n-r)/s+6*(n<r):n===a?(r-e)/s+2:(e-n)/s+4,s/=A<.5?a+i:2-a-i,o*=60):s=A>0&&A<1?0:o,new Uh(o,s,A,t.opacity)}function Uh(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function zh(t){return(t=(t||0)%360)<0?t+360:t}function Nh(t){return Math.max(0,Math.min(1,t||0))}function Fh(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}sh(lh,Sh,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:wh,formatHex:wh,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return kh(this).formatHsl()},formatRgb:Mh,toString:Mh}),sh(Ph,qh,Ah(lh,{brighter(t){return t=null==t?ch:Math.pow(ch,t),new Ph(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?uh:Math.pow(uh,t),new Ph(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ph(Ih(this.r),Ih(this.g),Ih(this.b),Rh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dh,formatHex:Dh,formatHex8:function(){return`#${Oh(this.r)}${Oh(this.g)}${Oh(this.b)}${Oh(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Lh,toString:Lh})),sh(Uh,(function(t,e,n,r){return 1===arguments.length?kh(t):new Uh(t,e,n,null==r?1:r)}),Ah(lh,{brighter(t){return t=null==t?ch:Math.pow(ch,t),new Uh(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?uh:Math.pow(uh,t),new Uh(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Ph(Fh(t>=240?t-240:t+120,i,r),Fh(t,i,r),Fh(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Uh(zh(this.h),Nh(this.s),Nh(this.l),Rh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Rh(this.opacity);return`${1===t?"hsl(":"hsla("}${zh(this.h)}, ${100*Nh(this.s)}%, ${100*Nh(this.l)}%${1===t?")":`, ${t})`}`}}));const Gh=Math.PI/180,Hh=180/Math.PI,jh=.96422,Vh=.82521,Wh=4/29,Qh=6/29,Yh=3*Qh*Qh;function Xh(t){if(t instanceof Zh)return new Zh(t.l,t.a,t.b,t.opacity);if(t instanceof nf)return rf(t);t instanceof Ph||(t=Ch(t));var e,n,r=tf(t.r),i=tf(t.g),a=tf(t.b),o=Jh((.2225045*r+.7168786*i+.0606169*a)/1);return r===i&&i===a?e=n=o:(e=Jh((.4360747*r+.3850649*i+.1430804*a)/jh),n=Jh((.0139322*r+.0971045*i+.7141733*a)/Vh)),new Zh(116*o-16,500*(e-o),200*(o-n),t.opacity)}function Zh(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Jh(t){return t>.008856451679035631?Math.pow(t,1/3):t/Yh+Wh}function Kh(t){return t>Qh?t*t*t:Yh*(t-Wh)}function $h(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function tf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ef(t){if(t instanceof nf)return new nf(t.h,t.c,t.l,t.opacity);if(t instanceof Zh||(t=Xh(t)),0===t.a&&0===t.b)return new nf(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Hh;return new nf(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function nf(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function rf(t){if(isNaN(t.h))return new Zh(t.l,0,0,t.opacity);var e=t.h*Gh;return new Zh(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}sh(Zh,(function(t,e,n,r){return 1===arguments.length?Xh(t):new Zh(t,e,n,null==r?1:r)}),Ah(lh,{brighter(t){return new Zh(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Zh(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Ph($h(3.1338561*(e=jh*Kh(e))-1.6168667*(t=1*Kh(t))-.4906146*(n=Vh*Kh(n))),$h(-.9787684*e+1.9161415*t+.033454*n),$h(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),sh(nf,(function(t,e,n,r){return 1===arguments.length?ef(t):new nf(t,e,n,null==r?1:r)}),Ah(lh,{brighter(t){return new nf(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new nf(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return rf(this).rgb()}}));var af=-.14861,of=1.78277,sf=-.29227,Af=-.90649,lf=1.97294,uf=lf*Af,cf=lf*of,hf=of*sf-Af*af;function ff(t){if(t instanceof pf)return new pf(t.h,t.s,t.l,t.opacity);t instanceof Ph||(t=Ch(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(hf*r+uf*e-cf*n)/(hf+uf-cf),a=r-i,o=(lf*(n-i)-sf*a)/Af,s=Math.sqrt(o*o+a*a)/(lf*i*(1-i)),A=s?Math.atan2(o,a)*Hh-120:NaN;return new pf(A<0?A+360:A,s,i,t.opacity)}function df(t,e,n,r){return 1===arguments.length?ff(t):new pf(t,e,n,null==r?1:r)}function pf(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}sh(pf,df,Ah(lh,{brighter(t){return t=null==t?ch:Math.pow(ch,t),new pf(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?uh:Math.pow(uh,t),new pf(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Gh,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Ph(255*(e+n*(af*r+of*i)),255*(e+n*(sf*r+Af*i)),255*(e+n*(lf*r)),this.opacity)}}));var mf=t=>()=>t;function gf(t,e){return function(n){return t+n*e}}function vf(t){return 1==(t=+t)?xf:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):mf(isNaN(e)?n:e)}}function xf(t,e){var n=e-t;return n?gf(t,n):mf(isNaN(t)?e:t)}var yf=function t(e){var n=vf(e);function r(t,e){var r=n((t=qh(t)).r,(e=qh(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),o=xf(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=o(e),t+""}}return r.gamma=t,r}(1);function _f(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(a){for(n=0;n<r;++n)i[n]=t[n]*(1-a)+e[n]*a;return i}}function bf(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function wf(t,e){return(bf(e)?_f:Mf)(t,e)}function Mf(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),o=new Array(r);for(n=0;n<i;++n)a[n]=Df(t[n],e[n]);for(;n<r;++n)o[n]=e[n];return function(t){for(n=0;n<i;++n)o[n]=a[n](t);return o}}function Sf(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Ef(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Tf(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Df(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var Cf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,qf=new RegExp(Cf.source,"g");function Pf(t,e){var n,r,i,a=Cf.lastIndex=qf.lastIndex=0,o=-1,s=[],A=[];for(t+="",e+="";(n=Cf.exec(t))&&(r=qf.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,A.push({i:o,x:Ef(n,r)})),a=qf.lastIndex;return a<e.length&&(i=e.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?A[0]?function(t){return function(e){return t(e)+""}}(A[0].x):function(t){return function(){return t}}(e):(e=A.length,function(t){for(var n,r=0;r<e;++r)s[(n=A[r]).i]=n.x(t);return s.join("")})}function Df(t,e){var n,r=typeof e;return null==e||"boolean"===r?mf(e):("number"===r?Ef:"string"===r?(n=Sh(e))?(e=n,yf):Pf:e instanceof Sh?yf:e instanceof Date?Sf:bf(e)?_f:Array.isArray(e)?Mf:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Tf:Ef)(t,e)}function Lf(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Rf(t){return((t=Math.exp(t))+1/t)/2}function If(t){return function e(n){function r(e,r){var i=t((e=df(e)).h,(r=df(r)).h),a=xf(e.s,r.s),o=xf(e.l,r.l),s=xf(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=a(t),e.l=o(Math.pow(t,n)),e.opacity=s(t),e+""}}return n=+n,r.gamma=e,r}(1)}function Of(t){return+t}!function t(e,n,r){function i(t,i){var a,o,s=t[0],A=t[1],l=t[2],u=i[0],c=i[1],h=i[2],f=u-s,d=c-A,p=f*f+d*d;if(p<1e-12)o=Math.log(h/l)/e,a=function(t){return[s+t*f,A+t*d,l*Math.exp(e*t*o)]};else{var m=Math.sqrt(p),g=(h*h-l*l+r*p)/(2*l*n*m),v=(h*h-l*l-r*p)/(2*h*n*m),x=Math.log(Math.sqrt(g*g+1)-g),y=Math.log(Math.sqrt(v*v+1)-v);o=(y-x)/e,a=function(t){var r,i=t*o,a=Rf(x),u=l/(n*m)*(a*(r=e*i+x,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(x));return[s+u*f,A+u*d,l*a/Rf(e*i+x)]}}return a.duration=1e3*o*e/Math.SQRT2,a}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4),If((function(t,e){var n=e-t;return n?gf(t,n>180||n<-180?n-360*Math.round(n/360):n):mf(isNaN(t)?e:t)})),If(xf);var Bf=[0,1];function kf(t){return t}function Uf(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function zf(t,e,n){var r=t[0],i=t[1],a=e[0],o=e[1];return i<r?(r=Uf(i,r),a=n(o,a)):(r=Uf(r,i),a=n(a,o)),function(t){return a(r(t))}}function Nf(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),a=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)i[o]=Uf(t[o],t[o+1]),a[o]=n(e[o],e[o+1]);return function(e){var n=hA(t,e,1,r)-1;return a[n](i[n](e))}}function Ff(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Gf(){var t,e,n,r,i,a,o=Bf,s=Bf,A=Df,l=kf;function u(){var t=Math.min(o.length,s.length);return l!==kf&&(l=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(o[0],o[t-1])),r=t>2?Nf:zf,i=a=null,c}function c(e){return null==e||isNaN(e=+e)?n:(i||(i=r(o.map(t),s,A)))(t(l(e)))}return c.invert=function(n){return l(e((a||(a=r(s,o.map(t),Ef)))(n)))},c.domain=function(t){return arguments.length?(o=Array.from(t,Of),u()):o.slice()},c.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},c.rangeRound=function(t){return s=Array.from(t),A=Lf,u()},c.clamp=function(t){return arguments.length?(l=!!t||kf,u()):l!==kf},c.interpolate=function(t){return arguments.length?(A=t,u()):A},c.unknown=function(t){return arguments.length?(n=t,c):n},function(n,r){return t=n,e=r,u()}}function Hf(){return Gf()(kf,kf)}function jf(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vf(t){return(t=jf(Math.abs(t)))?t[1]:NaN}var Wf,Qf=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Yf(t){if(!(e=Qf.exec(t)))throw new Error("invalid format: "+t);var e;return new Xf({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Xf(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Zf(t,e){var n=jf(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Yf.prototype=Xf.prototype,Xf.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Jf={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Zf(100*t,e),r:Zf,s:function(t,e){var n=jf(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(Wf=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+jf(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Kf(t){return t}var $f,td,ed,nd=Array.prototype.map,rd=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function id(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Kf:(e=nd.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,a=[],o=0,s=e[0],A=0;i>0&&s>0&&(A+s+1>r&&(s=Math.max(1,r-A)),a.push(t.substring(i-=s,i+s)),!((A+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Kf:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(nd.call(t.numerals,String)),A=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function c(t){var e=(t=Yf(t)).fill,n=t.align,c=t.sign,h=t.symbol,f=t.zero,d=t.width,p=t.comma,m=t.precision,g=t.trim,v=t.type;"n"===v?(p=!0,v="g"):Jf[v]||(void 0===m&&(m=12),g=!0,v="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var x="$"===h?i:"#"===h&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===h?a:/[%p]/.test(v)?A:"",_=Jf[v],b=/[defgprs%]/.test(v);function w(t){var i,a,A,h=x,w=y;if("c"===v)w=_(t)+w,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:_(Math.abs(t),m),g&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),M&&0==+t&&"+"!==c&&(M=!1),h=(M?"("===c?c:l:"-"===c||"("===c?"":c)+h,w=("s"===v?rd[8+Wf/3]:"")+w+(M&&"("===c?")":""),b)for(i=-1,a=t.length;++i<a;)if(48>(A=t.charCodeAt(i))||A>57){w=(46===A?o+t.slice(i+1):t.slice(i))+w,t=t.slice(0,i);break}}p&&!f&&(t=r(t,1/0));var S=h.length+t.length+w.length,E=S<d?new Array(d-S+1).join(e):"";switch(p&&f&&(t=r(E+t,E.length?d-w.length:1/0),E=""),n){case"<":t=h+t+w+E;break;case"=":t=h+E+t+w;break;case"^":t=E.slice(0,S=E.length>>1)+h+t+w+E.slice(S);break;default:t=E+h+t+w}return s(t)}return m=void 0===m?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),w.toString=function(){return t+""},w}return{format:c,formatPrefix:function(t,e){var n=c(((t=Yf(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Vf(e)/3))),i=Math.pow(10,-r),a=rd[8+r/3];return function(t){return n(i*t)+a}}}}function ad(t,e,n,r){var i,a=function(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=pA?i*=10:a>=mA?i*=5:a>=gA&&(i*=2),e<t?-i:i}(t,e,n);switch((r=Yf(null==r?",f":r)).type){case"s":var o=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Vf(e)/3)))-Vf(Math.abs(t)))}(a,o))||(r.precision=i),ed(r,o);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vf(e)-Vf(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Vf(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return td(r)}function od(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var r,i,a,o,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e<t)&&(i=t,t=e,e=i),0===(o=vA(t,e,n))||!isFinite(o))return[];if(o>0){let n=Math.round(t/o),r=Math.round(e/o);for(n*o<t&&++n,r*o>e&&--r,a=new Array(i=r-n+1);++s<i;)a[s]=(n+s)*o}else{o=-o;let n=Math.round(t*o),r=Math.round(e*o);for(n/o<t&&++n,r/o>e&&--r,a=new Array(i=r-n+1);++s<i;)a[s]=(n+s)/o}return r&&a.reverse(),a}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return ad(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,a=e(),o=0,s=a.length-1,A=a[o],l=a[s],u=10;for(l<A&&(i=A,A=l,l=i,i=o,o=s,s=i);u-- >0;){if((i=vA(A,l,n))===r)return a[o]=A,a[s]=l,e(a);if(i>0)A=Math.floor(A/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;A=Math.ceil(A*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function sd(){var t=Hf();return t.copy=function(){return Ff(t,sd())},oh.apply(t,arguments),od(t)}$f=id({thousands:",",grouping:[3],currency:["$",""]}),td=$f.format,ed=$f.formatPrefix;var Ad=new Date,ld=new Date;function ud(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},i.range=function(n,r,a){var o,s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r&&a>0))return s;do{s.push(o=new Date(+n)),e(n,a),t(n)}while(o<n&&n<r);return s},i.filter=function(n){return ud((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return Ad.setTime(+e),ld.setTime(+r),t(Ad),t(ld),Math.floor(n(Ad,ld))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var cd=ud((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));cd.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?ud((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):cd:null},cd.range;const hd=1e3,fd=6e4,dd=36e5,pd=864e5,md=6048e5;var gd=ud((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*hd)}),(function(t,e){return(e-t)/hd}),(function(t){return t.getUTCSeconds()}));gd.range;var vd=ud((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*hd)}),(function(t,e){t.setTime(+t+e*fd)}),(function(t,e){return(e-t)/fd}),(function(t){return t.getMinutes()}));vd.range;var xd=ud((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*hd-t.getMinutes()*fd)}),(function(t,e){t.setTime(+t+e*dd)}),(function(t,e){return(e-t)/dd}),(function(t){return t.getHours()}));xd.range;var yd=ud((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*fd)/pd),(t=>t.getDate()-1));function _d(t){return ud((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*fd)/md}))}yd.range;var bd=_d(0),wd=_d(1),Md=_d(2),Sd=_d(3),Ed=_d(4),Td=_d(5),Cd=_d(6);bd.range,wd.range,Md.range,Sd.range,Ed.range,Td.range,Cd.range;var qd=ud((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}));qd.range;var Pd=ud((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Pd.every=function(t){return isFinite(t=Math.floor(t))&&t>0?ud((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null},Pd.range;var Dd=ud((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*fd)}),(function(t,e){return(e-t)/fd}),(function(t){return t.getUTCMinutes()}));Dd.range;var Ld=ud((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*dd)}),(function(t,e){return(e-t)/dd}),(function(t){return t.getUTCHours()}));Ld.range;var Rd=ud((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/pd}),(function(t){return t.getUTCDate()-1}));function Id(t){return ud((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/md}))}Rd.range;var Od=Id(0),Bd=Id(1),kd=Id(2),Ud=Id(3),zd=Id(4),Nd=Id(5),Fd=Id(6);Od.range,Bd.range,kd.range,Ud.range,zd.range,Nd.range,Fd.range;var Gd=ud((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}));Gd.range;var Hd=ud((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));function jd(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Vd(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Wd(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}Hd.every=function(t){return isFinite(t=Math.floor(t))&&t>0?ud((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null},Hd.range;var Qd,Yd,Xd,Zd={"-":"",_:" ",0:"0"},Jd=/^\s*\d+/,Kd=/^%/,$d=/[\\^$*+?|[\]().{}]/g;function tp(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function ep(t){return t.replace($d,"\\$&")}function np(t){return new RegExp("^(?:"+t.map(ep).join("|")+")","i")}function rp(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function ip(t,e,n){var r=Jd.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function ap(t,e,n){var r=Jd.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function op(t,e,n){var r=Jd.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function sp(t,e,n){var r=Jd.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Ap(t,e,n){var r=Jd.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function lp(t,e,n){var r=Jd.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function up(t,e,n){var r=Jd.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function cp(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function hp(t,e,n){var r=Jd.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function fp(t,e,n){var r=Jd.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function dp(t,e,n){var r=Jd.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function pp(t,e,n){var r=Jd.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function mp(t,e,n){var r=Jd.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function gp(t,e,n){var r=Jd.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function vp(t,e,n){var r=Jd.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function xp(t,e,n){var r=Jd.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function yp(t,e,n){var r=Jd.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function _p(t,e,n){var r=Kd.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function bp(t,e,n){var r=Jd.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function wp(t,e,n){var r=Jd.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Mp(t,e){return tp(t.getDate(),e,2)}function Sp(t,e){return tp(t.getHours(),e,2)}function Ep(t,e){return tp(t.getHours()%12||12,e,2)}function Tp(t,e){return tp(1+yd.count(Pd(t),t),e,3)}function Cp(t,e){return tp(t.getMilliseconds(),e,3)}function qp(t,e){return Cp(t,e)+"000"}function Pp(t,e){return tp(t.getMonth()+1,e,2)}function Dp(t,e){return tp(t.getMinutes(),e,2)}function Lp(t,e){return tp(t.getSeconds(),e,2)}function Rp(t){var e=t.getDay();return 0===e?7:e}function Ip(t,e){return tp(bd.count(Pd(t)-1,t),e,2)}function Op(t){var e=t.getDay();return e>=4||0===e?Ed(t):Ed.ceil(t)}function Bp(t,e){return t=Op(t),tp(Ed.count(Pd(t),t)+(4===Pd(t).getDay()),e,2)}function kp(t){return t.getDay()}function Up(t,e){return tp(wd.count(Pd(t)-1,t),e,2)}function zp(t,e){return tp(t.getFullYear()%100,e,2)}function Np(t,e){return tp((t=Op(t)).getFullYear()%100,e,2)}function Fp(t,e){return tp(t.getFullYear()%1e4,e,4)}function Gp(t,e){var n=t.getDay();return tp((t=n>=4||0===n?Ed(t):Ed.ceil(t)).getFullYear()%1e4,e,4)}function Hp(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+tp(e/60|0,"0",2)+tp(e%60,"0",2)}function jp(t,e){return tp(t.getUTCDate(),e,2)}function Vp(t,e){return tp(t.getUTCHours(),e,2)}function Wp(t,e){return tp(t.getUTCHours()%12||12,e,2)}function Qp(t,e){return tp(1+Rd.count(Hd(t),t),e,3)}function Yp(t,e){return tp(t.getUTCMilliseconds(),e,3)}function Xp(t,e){return Yp(t,e)+"000"}function Zp(t,e){return tp(t.getUTCMonth()+1,e,2)}function Jp(t,e){return tp(t.getUTCMinutes(),e,2)}function Kp(t,e){return tp(t.getUTCSeconds(),e,2)}function $p(t){var e=t.getUTCDay();return 0===e?7:e}function tm(t,e){return tp(Od.count(Hd(t)-1,t),e,2)}function em(t){var e=t.getUTCDay();return e>=4||0===e?zd(t):zd.ceil(t)}function nm(t,e){return t=em(t),tp(zd.count(Hd(t),t)+(4===Hd(t).getUTCDay()),e,2)}function rm(t){return t.getUTCDay()}function im(t,e){return tp(Bd.count(Hd(t)-1,t),e,2)}function am(t,e){return tp(t.getUTCFullYear()%100,e,2)}function om(t,e){return tp((t=em(t)).getUTCFullYear()%100,e,2)}function sm(t,e){return tp(t.getUTCFullYear()%1e4,e,4)}function Am(t,e){var n=t.getUTCDay();return tp((t=n>=4||0===n?zd(t):zd.ceil(t)).getUTCFullYear()%1e4,e,4)}function lm(){return"+0000"}function um(){return"%"}function cm(t){return+t}function hm(t){return Math.floor(+t/1e3)}!function(t){Qd=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,o=t.shortDays,s=t.months,A=t.shortMonths,l=np(i),u=rp(i),c=np(a),h=rp(a),f=np(o),d=rp(o),p=np(s),m=rp(s),g=np(A),v=rp(A),x={a:function(t){return o[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return A[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Mp,e:Mp,f:qp,g:Np,G:Gp,H:Sp,I:Ep,j:Tp,L:Cp,m:Pp,M:Dp,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:cm,s:hm,S:Lp,u:Rp,U:Ip,V:Bp,w:kp,W:Up,x:null,X:null,y:zp,Y:Fp,Z:Hp,"%":um},y={a:function(t){return o[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return A[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:jp,e:jp,f:Xp,g:om,G:Am,H:Vp,I:Wp,j:Qp,L:Yp,m:Zp,M:Jp,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:cm,s:hm,S:Kp,u:$p,U:tm,V:nm,w:rm,W:im,x:null,X:null,y:am,Y:sm,Z:lm,"%":um},_={a:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=p.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return M(t,e,n,r)},d:dp,e:dp,f:yp,g:up,G:lp,H:mp,I:mp,j:pp,L:xp,m:fp,M:gp,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:hp,Q:bp,s:wp,S:vp,u:ap,U:op,V:sp,w:ip,W:Ap,x:function(t,e,r){return M(t,n,e,r)},X:function(t,e,n){return M(t,r,e,n)},y:up,Y:lp,Z:cp,"%":_p};function b(t,e){return function(n){var r,i,a,o=[],s=-1,A=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++s<l;)37===t.charCodeAt(s)&&(o.push(t.slice(A,s)),null!=(i=Zd[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(a=e[r])&&(r=a(n,i)),o.push(r),A=s+1);return o.push(t.slice(A,s)),o.join("")}}function w(t,e){return function(n){var r,i,a=Wd(1900,void 0,1);if(M(a,t,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(e&&!("Z"in a)&&(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=Vd(Wd(a.y,0,1))).getUTCDay(),r=i>4||0===i?Bd.ceil(r):Bd(r),r=Rd.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=jd(Wd(a.y,0,1))).getDay(),r=i>4||0===i?wd.ceil(r):wd(r),r=yd.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?Vd(Wd(a.y,0,1)).getUTCDay():jd(Wd(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,Vd(a)):jd(a)}}function M(t,e,n,r){for(var i,a,o=0,s=e.length,A=n.length;o<s;){if(r>=A)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=_[i in Zd?e.charAt(o++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return x.x=b(n,x),x.X=b(r,x),x.c=b(e,x),y.x=b(n,y),y.X=b(r,y),y.c=b(e,y),{format:function(t){var e=b(t+="",x);return e.toString=function(){return t},e},parse:function(t){var e=w(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=b(t+="",y);return e.toString=function(){return t},e},utcParse:function(t){var e=w(t+="",!0);return e.toString=function(){return t},e}}}(t),Qd.format,Qd.parse,Yd=Qd.utcFormat,Xd=Qd.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var fm="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString||Yd(fm),+new Date("2000-01-01T00:00:00.000Z")||Xd(fm);const dm=134217729;function pm(t,e,n,r,i){let a,o,s,A,l=e[0],u=r[0],c=0,h=0;u>l==u>-l?(a=l,l=e[++c]):(a=u,u=r[++h]);let f=0;if(c<t&&h<n)for(u>l==u>-l?(o=l+a,s=a-(o-l),l=e[++c]):(o=u+a,s=a-(o-u),u=r[++h]),a=o,0!==s&&(i[f++]=s);c<t&&h<n;)u>l==u>-l?(o=a+l,A=o-a,s=a-(o-A)+(l-A),l=e[++c]):(o=a+u,A=o-a,s=a-(o-A)+(u-A),u=r[++h]),a=o,0!==s&&(i[f++]=s);for(;c<t;)o=a+l,A=o-a,s=a-(o-A)+(l-A),l=e[++c],a=o,0!==s&&(i[f++]=s);for(;h<n;)o=a+u,A=o-a,s=a-(o-A)+(u-A),u=r[++h],a=o,0!==s&&(i[f++]=s);return 0===a&&0!==f||(i[f++]=a),f}function mm(t){return new Float64Array(t)}const gm=mm(4),vm=mm(8),xm=mm(12),ym=mm(16),_m=mm(4);function bm(t,e,n,r,i,a){const o=(e-a)*(n-i),s=(t-i)*(r-a),A=o-s;if(0===o||0===s||o>0!=s>0)return A;const l=Math.abs(o+s);return Math.abs(A)>=33306690738754716e-32*l?A:-function(t,e,n,r,i,a,o){let s,A,l,u,c,h,f,d,p,m,g,v,x,y,_,b,w,M;const S=t-i,E=n-i,T=e-a,C=r-a;y=S*C,h=dm*S,f=h-(h-S),d=S-f,h=dm*C,p=h-(h-C),m=C-p,_=d*m-(y-f*p-d*p-f*m),b=T*E,h=dm*T,f=h-(h-T),d=T-f,h=dm*E,p=h-(h-E),m=E-p,w=d*m-(b-f*p-d*p-f*m),g=_-w,c=_-g,gm[0]=_-(g+c)+(c-w),v=y+g,c=v-y,x=y-(v-c)+(g-c),g=x-b,c=x-g,gm[1]=x-(g+c)+(c-b),M=v+g,c=M-v,gm[2]=v-(M-c)+(g-c),gm[3]=M;let q=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,gm),P=22204460492503146e-32*o;if(q>=P||-q>=P)return q;if(c=t-S,s=t-(S+c)+(c-i),c=n-E,l=n-(E+c)+(c-i),c=e-T,A=e-(T+c)+(c-a),c=r-C,u=r-(C+c)+(c-a),0===s&&0===A&&0===l&&0===u)return q;if(P=11093356479670487e-47*o+33306690738754706e-32*Math.abs(q),q+=S*u+C*s-(T*l+E*A),q>=P||-q>=P)return q;y=s*C,h=dm*s,f=h-(h-s),d=s-f,h=dm*C,p=h-(h-C),m=C-p,_=d*m-(y-f*p-d*p-f*m),b=A*E,h=dm*A,f=h-(h-A),d=A-f,h=dm*E,p=h-(h-E),m=E-p,w=d*m-(b-f*p-d*p-f*m),g=_-w,c=_-g,_m[0]=_-(g+c)+(c-w),v=y+g,c=v-y,x=y-(v-c)+(g-c),g=x-b,c=x-g,_m[1]=x-(g+c)+(c-b),M=v+g,c=M-v,_m[2]=v-(M-c)+(g-c),_m[3]=M;const D=pm(4,gm,4,_m,vm);y=S*u,h=dm*S,f=h-(h-S),d=S-f,h=dm*u,p=h-(h-u),m=u-p,_=d*m-(y-f*p-d*p-f*m),b=T*l,h=dm*T,f=h-(h-T),d=T-f,h=dm*l,p=h-(h-l),m=l-p,w=d*m-(b-f*p-d*p-f*m),g=_-w,c=_-g,_m[0]=_-(g+c)+(c-w),v=y+g,c=v-y,x=y-(v-c)+(g-c),g=x-b,c=x-g,_m[1]=x-(g+c)+(c-b),M=v+g,c=M-v,_m[2]=v-(M-c)+(g-c),_m[3]=M;const L=pm(D,vm,4,_m,xm);y=s*u,h=dm*s,f=h-(h-s),d=s-f,h=dm*u,p=h-(h-u),m=u-p,_=d*m-(y-f*p-d*p-f*m),b=A*l,h=dm*A,f=h-(h-A),d=A-f,h=dm*l,p=h-(h-l),m=l-p,w=d*m-(b-f*p-d*p-f*m),g=_-w,c=_-g,_m[0]=_-(g+c)+(c-w),v=y+g,c=v-y,x=y-(v-c)+(g-c),g=x-b,c=x-g,_m[1]=x-(g+c)+(c-b),M=v+g,c=M-v,_m[2]=v-(M-c)+(g-c),_m[3]=M;const R=pm(L,xm,4,_m,ym);return ym[R-1]}(t,e,n,r,i,a,l)}const wm=Math.pow(2,-52),Mm=new Uint32Array(512);class Sm{static from(t,e=Dm,n=Lm){const r=t.length,i=new Float64Array(2*r);for(let a=0;a<r;a++){const r=t[a];i[2*a]=e(r),i[2*a+1]=n(r)}return new Sm(i)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=t.length>>1;let o=1/0,s=1/0,A=-1/0,l=-1/0;for(let e=0;e<a;e++){const n=t[2*e],r=t[2*e+1];n<o&&(o=n),r<s&&(s=r),n>A&&(A=n),r>l&&(l=r),this._ids[e]=e}const u=(o+A)/2,c=(s+l)/2;let h,f,d,p=1/0;for(let e=0;e<a;e++){const n=Em(u,c,t[2*e],t[2*e+1]);n<p&&(h=e,p=n)}const m=t[2*h],g=t[2*h+1];p=1/0;for(let e=0;e<a;e++){if(e===h)continue;const n=Em(m,g,t[2*e],t[2*e+1]);n<p&&n>0&&(f=e,p=n)}let v=t[2*f],x=t[2*f+1],y=1/0;for(let e=0;e<a;e++){if(e===h||e===f)continue;const n=Cm(m,g,v,x,t[2*e],t[2*e+1]);n<y&&(d=e,y=n)}let _=t[2*d],b=t[2*d+1];if(y===1/0){for(let e=0;e<a;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];qm(this._ids,this._dists,0,a-1);const e=new Uint32Array(a);let n=0;for(let t=0,r=-1/0;t<a;t++){const i=this._ids[t];this._dists[i]>r&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(bm(m,g,v,x,_,b)<0){const t=f,e=v,n=x;f=d,v=_,x=b,d=t,_=e,b=n}const w=function(t,e,n,r,i,a){const o=n-t,s=r-e,A=i-t,l=a-e,u=o*o+s*s,c=A*A+l*l,h=.5/(o*l-s*A);return{x:t+(l*u-s*c)*h,y:e+(o*c-A*u)*h}}(m,g,v,x,_,b);this._cx=w.x,this._cy=w.y;for(let e=0;e<a;e++)this._dists[e]=Em(t[2*e],t[2*e+1],w.x,w.y);qm(this._ids,this._dists,0,a-1),this._hullStart=h;let M=3;n[h]=e[d]=f,n[f]=e[h]=d,n[d]=e[f]=h,r[h]=0,r[f]=1,r[d]=2,i.fill(-1),i[this._hashKey(m,g)]=h,i[this._hashKey(v,x)]=f,i[this._hashKey(_,b)]=d,this.trianglesLen=0,this._addTriangle(h,f,d,-1,-1,-1);for(let a,o,s=0;s<this._ids.length;s++){const A=this._ids[s],l=t[2*A],u=t[2*A+1];if(s>0&&Math.abs(l-a)<=wm&&Math.abs(u-o)<=wm)continue;if(a=l,o=u,A===h||A===f||A===d)continue;let c=0;for(let t=0,e=this._hashKey(l,u);t<this._hashSize&&(c=i[(e+t)%this._hashSize],-1===c||c===n[c]);t++);c=e[c];let p,m=c;for(;p=n[m],bm(l,u,t[2*m],t[2*m+1],t[2*p],t[2*p+1])>=0;)if(m=p,m===c){m=-1;break}if(-1===m)continue;let g=this._addTriangle(m,A,n[m],-1,-1,r[m]);r[A]=this._legalize(g+2),r[m]=g,M++;let v=n[m];for(;p=n[v],bm(l,u,t[2*v],t[2*v+1],t[2*p],t[2*p+1])<0;)g=this._addTriangle(v,A,p,r[A],-1,r[v]),r[A]=this._legalize(g+2),n[v]=v,M--,v=p;if(m===c)for(;p=e[m],bm(l,u,t[2*p],t[2*p+1],t[2*m],t[2*m+1])<0;)g=this._addTriangle(p,A,m,-1,r[m],r[p]),this._legalize(g+2),r[p]=g,n[m]=m,M--,m=p;this._hullStart=e[A]=m,n[m]=e[v]=A,n[A]=v,i[this._hashKey(l,u)]=A,i[this._hashKey(t[2*m],t[2*m+1])]=m}this.hull=new Uint32Array(M);for(let t=0,e=this._hullStart;t<M;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,a=0;for(;;){const o=n[t],s=t-t%3;if(a=s+(t+2)%3,-1===o){if(0===i)break;t=Mm[--i];continue}const A=o-o%3,l=s+(t+1)%3,u=A+(o+2)%3,c=e[a],h=e[t],f=e[l],d=e[u];if(Tm(r[2*c],r[2*c+1],r[2*h],r[2*h+1],r[2*f],r[2*f+1],r[2*d],r[2*d+1])){e[t]=d,e[o]=c;const r=n[u];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===u){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(o,n[a]),this._link(a,u);const s=A+(o+1)%3;i<Mm.length&&(Mm[i++]=s)}else{if(0===i)break;t=Mm[--i]}}return a}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,r,i,a){const o=this.trianglesLen;return this._triangles[o]=t,this._triangles[o+1]=e,this._triangles[o+2]=n,this._link(o,r),this._link(o+1,i),this._link(o+2,a),this.trianglesLen+=3,o}}function Em(t,e,n,r){const i=t-n,a=e-r;return i*i+a*a}function Tm(t,e,n,r,i,a,o,s){const A=t-o,l=e-s,u=n-o,c=r-s,h=i-o,f=a-s,d=u*u+c*c,p=h*h+f*f;return A*(c*p-d*f)-l*(u*p-d*h)+(A*A+l*l)*(u*f-c*h)<0}function Cm(t,e,n,r,i,a){const o=n-t,s=r-e,A=i-t,l=a-e,u=o*o+s*s,c=A*A+l*l,h=.5/(o*l-s*A),f=(l*u-s*c)*h,d=(o*c-A*u)*h;return f*f+d*d}function qm(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],a=e[r];let o=i-1;for(;o>=n&&e[t[o]]>a;)t[o+1]=t[o--];t[o+1]=r}else{let i=n+1,a=r;Pm(t,n+r>>1,i),e[t[n]]>e[t[r]]&&Pm(t,n,r),e[t[i]]>e[t[r]]&&Pm(t,i,r),e[t[n]]>e[t[i]]&&Pm(t,n,i);const o=t[i],s=e[o];for(;;){do{i++}while(e[t[i]]<s);do{a--}while(e[t[a]]>s);if(a<i)break;Pm(t,i,a)}t[n+1]=t[a],t[a]=o,r-i+1>=a-n?(qm(t,e,i,r),qm(t,e,n,a-1)):(qm(t,e,n,a-1),qm(t,e,i,r))}}function Pm(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Dm(t){return t[0]}function Lm(t){return t[1]}function Rm(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r,i=function(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}(t),a="Feature"===(r=e).type?r.geometry:r,o=a.type,s=e.bbox,A=a.coordinates;if(s&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(i,s))return!1;"Polygon"===o&&(A=[A]);for(var l=!1,u=0;u<A.length&&!l;u++)if(Im(i,A[u][0],n.ignoreBoundary)){for(var c=!1,h=1;h<A[u].length&&!c;)Im(i,A[u][h],!n.ignoreBoundary)&&(c=!0),h++;c||(l=!0)}return l}function Im(t,e,n){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,a=e.length-1;i<e.length;a=i++){var o=e[i][0],s=e[i][1],A=e[a][0],l=e[a][1];if(t[1]*(o-A)+s*(A-t[0])+l*(t[0]-o)==0&&(o-t[0])*(A-t[0])<=0&&(s-t[1])*(l-t[1])<=0)return!n;s>t[1]!=l>t[1]&&t[0]<(A-o)*(t[1]-s)/(l-s)+o&&(r=!r)}return r}const Om=1e-6;class Bm{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>Om||Math.abs(this._y1-i)>Om)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class km{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class Um{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,a=0,o=0,s=n.length;a<s;a+=3,o+=2){const s=2*n[a],A=2*n[a+1],l=2*n[a+2],u=t[s],c=t[s+1],h=t[A],f=t[A+1],d=t[l],p=t[l+1],m=h-u,g=f-c,v=d-u,x=p-c,y=2*(m*x-g*v);if(Math.abs(y)<1e-9){let i=1e9;const a=2*n[0];i*=Math.sign((t[a]-u)*x-(t[a+1]-c)*v),e=(u+d)/2-i*x,r=(c+p)/2+i*v}else{const t=1/y,n=m*m+g*g,i=v*v+x*x;e=u+(x*n-g*i)*t,r=c+(m*i-v*n)*t}i[o]=e,i[o+1]=r}let a,o,s,A=e[e.length-1],l=4*A,u=t[2*A],c=t[2*A+1];r.fill(0);for(let n=0;n<e.length;++n)A=e[n],a=l,o=u,s=c,l=4*A,u=t[2*A],c=t[2*A+1],r[a+2]=r[l]=s-c,r[a+3]=r[l+1]=u-o}render(t){const e=null==t?t=new Bm:void 0,{delaunay:{halfedges:n,inedges:r,hull:i},circumcenters:a,vectors:o}=this;if(i.length<=1)return null;for(let e=0,r=n.length;e<r;++e){const r=n[e];if(r<e)continue;const i=2*Math.floor(e/3),o=2*Math.floor(r/3),s=a[i],A=a[i+1],l=a[o],u=a[o+1];this._renderSegment(s,A,l,u,t)}let s,A=i[i.length-1];for(let e=0;e<i.length;++e){s=A,A=i[e];const n=2*Math.floor(r[A]/3),l=a[n],u=a[n+1],c=4*s,h=this._project(l,u,o[c+2],o[c+3]);h&&this._renderSegment(l,u,h[0],h[1],t)}return e&&e.value()}renderBounds(t){const e=null==t?t=new Bm:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),e&&e.value()}renderCell(t,e){const n=null==e?e=new Bm:void 0,r=this._clip(t);if(null===r||!r.length)return;e.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||e.lineTo(r[t],r[t+1]);return e.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let e=0,n=t.length/2;e<n;++e){const t=this.cellPolygon(e);t&&(t.index=e,yield t)}}cellPolygon(t){const e=new km;return this.renderCell(t,e),e.value()}_renderSegment(t,e,n,r,i){let a;const o=this._regioncode(t,e),s=this._regioncode(n,r);0===o&&0===s?(i.moveTo(t,e),i.lineTo(n,r)):(a=this._clipSegment(t,e,n,r,o,s))&&(i.moveTo(a[0],a[1]),i.lineTo(a[2],a[3]))}contains(t,e,n){return(e=+e)==e&&(n=+n)==n&&this.delaunay._step(t,e,n)===t}*neighbors(t){const e=this._clip(t);if(e)for(const n of this.delaunay.neighbors(t)){const t=this._clip(n);if(t)t:for(let r=0,i=e.length;r<i;r+=2)for(let a=0,o=t.length;a<o;a+=2)if(e[r]==t[a]&&e[r+1]==t[a+1]&&e[(r+2)%i]==t[(a+o-2)%o]&&e[(r+3)%i]==t[(a+o-1)%o]){yield n;break t}}}_cell(t){const{circumcenters:e,delaunay:{inedges:n,halfedges:r,triangles:i}}=this,a=n[t];if(-1===a)return null;const o=[];let s=a;do{const n=Math.floor(s/3);if(o.push(e[2*n],e[2*n+1]),s=s%3==2?s-2:s+1,i[s]!==t)break;s=r[s]}while(s!==a&&-1!==s);return o}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const e=this._cell(t);if(null===e)return null;const{vectors:n}=this,r=4*t;return n[r]||n[r+1]?this._clipInfinite(t,e,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(t,e)}_clipFinite(t,e){const n=e.length;let r,i,a,o,s=null,A=e[n-2],l=e[n-1],u=this._regioncode(A,l),c=0;for(let h=0;h<n;h+=2)if(r=A,i=l,A=e[h],l=e[h+1],a=u,u=this._regioncode(A,l),0===a&&0===u)o=c,c=0,s?s.push(A,l):s=[A,l];else{let e,n,h,f,d;if(0===a){if(null===(e=this._clipSegment(r,i,A,l,a,u)))continue;[n,h,f,d]=e}else{if(null===(e=this._clipSegment(A,l,r,i,u,a)))continue;[f,d,n,h]=e,o=c,c=this._edgecode(n,h),o&&c&&this._edge(t,o,c,s,s.length),s?s.push(n,h):s=[n,h]}o=c,c=this._edgecode(f,d),o&&c&&this._edge(t,o,c,s,s.length),s?s.push(f,d):s=[f,d]}if(s)o=c,c=this._edgecode(s[0],s[1]),o&&c&&this._edge(t,o,c,s,s.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(t,e,n,r,i,a){for(;;){if(0===i&&0===a)return[t,e,n,r];if(i&a)return null;let o,s,A=i||a;8&A?(o=t+(n-t)*(this.ymax-e)/(r-e),s=this.ymax):4&A?(o=t+(n-t)*(this.ymin-e)/(r-e),s=this.ymin):2&A?(s=e+(r-e)*(this.xmax-t)/(n-t),o=this.xmax):(s=e+(r-e)*(this.xmin-t)/(n-t),o=this.xmin),i?(t=o,e=s,i=this._regioncode(t,e)):(n=o,r=s,a=this._regioncode(n,r))}}_clipInfinite(t,e,n,r,i,a){let o,s=Array.from(e);if((o=this._project(s[0],s[1],n,r))&&s.unshift(o[0],o[1]),(o=this._project(s[s.length-2],s[s.length-1],i,a))&&s.push(o[0],o[1]),s=this._clipFinite(t,s))for(let e,n=0,r=s.length,i=this._edgecode(s[r-2],s[r-1]);n<r;n+=2)e=i,i=this._edgecode(s[n],s[n+1]),e&&i&&(n=this._edge(t,e,i,s,n),r=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,e,n,r,i){for(;e!==n;){let n,a;switch(e){case 5:e=4;continue;case 4:e=6,n=this.xmax,a=this.ymin;break;case 6:e=2;continue;case 2:e=10,n=this.xmax,a=this.ymax;break;case 10:e=8;continue;case 8:e=9,n=this.xmin,a=this.ymax;break;case 9:e=1;continue;case 1:e=5,n=this.xmin,a=this.ymin}r[i]===n&&r[i+1]===a||!this.contains(t,n,a)||(r.splice(i,0,n,a),i+=2)}if(r.length>4)for(let t=0;t<r.length;t+=2){const e=(t+2)%r.length,n=(t+4)%r.length;(r[t]===r[e]&&r[e]===r[n]||r[t+1]===r[e+1]&&r[e+1]===r[n+1])&&(r.splice(e,2),t-=2)}return i}_project(t,e,n,r){let i,a,o,s=1/0;if(r<0){if(e<=this.ymin)return null;(i=(this.ymin-e)/r)<s&&(o=this.ymin,a=t+(s=i)*n)}else if(r>0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)<s&&(o=this.ymax,a=t+(s=i)*n)}if(n>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)<s&&(a=this.xmax,o=e+(s=i)*r)}else if(n<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/n)<s&&(a=this.xmin,o=e+(s=i)*r)}return[a,o]}_edgecode(t,e){return(t===this.xmin?1:t===this.xmax?2:0)|(e===this.ymin?4:e===this.ymax?8:0)}_regioncode(t,e){return(t<this.xmin?1:t>this.xmax?2:0)|(e<this.ymin?4:e>this.ymax?8:0)}}const zm=2*Math.PI,Nm=Math.pow;function Fm(t){return t[0]}function Gm(t){return t[1]}function Hm(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class jm{static from(t,e=Fm,n=Gm,r){return new jm("length"in t?function(t,e,n,r){const i=t.length,a=new Float64Array(2*i);for(let o=0;o<i;++o){const i=t[o];a[2*o]=e.call(r,i,o,t),a[2*o+1]=n.call(r,i,o,t)}return a}(t,e,n,r):Float64Array.from(function*(t,e,n,r){let i=0;for(const a of t)yield e.call(r,a,i,t),yield n.call(r,a,i,t),++i}(t,e,n,r)))}constructor(t){this._delaunator=new Sm(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,e=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t<e.length;t+=3){const r=2*e[t],i=2*e[t+1],a=2*e[t+2];if((n[a]-n[r])*(n[i+1]-n[r+1])-(n[i]-n[r])*(n[a+1]-n[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},((t,e)=>e)).sort(((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]));const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t<n;++t){const n=Hm(e[2*t],e[2*t+1],i);e[2*t]=n[0],e[2*t+1]=n[1]}this._delaunator=new Sm(e)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,a=this.inedges.fill(-1),o=this._hullIndex.fill(-1);for(let t=0,e=n.length;t<e;++t){const e=i[t%3==2?t-2:t+1];-1!==n[t]&&-1!==a[e]||(a[e]=t)}for(let t=0,e=r.length;t<e;++t)o[r[t]]=t;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],a[r[0]]=1,2===r.length&&(a[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new Um(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:o}=this;if(o){const e=o.indexOf(t);return e>0&&(yield o[e-1]),void(e<o.length-1&&(yield o[e+1]))}const s=e[t];if(-1===s)return;let A=s,l=-1;do{if(yield l=a[A],A=A%3==2?A-2:A+1,a[A]!==t)return;if(A=i[A],-1===A){const e=n[(r[t]+1)%n.length];return void(e!==l&&(yield e))}}while(A!==s)}find(t,e,n=0){if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:a,halfedges:o,triangles:s,points:A}=this;if(-1===r[t]||!A.length)return(t+1)%(A.length>>1);let l=t,u=Nm(e-A[2*t],2)+Nm(n-A[2*t+1],2);const c=r[t];let h=c;do{let r=s[h];const c=Nm(e-A[2*r],2)+Nm(n-A[2*r+1],2);if(c<u&&(u=c,l=r),h=h%3==2?h-2:h+1,s[h]!==t)break;if(h=o[h],-1===h){if(h=i[(a[t]+1)%i.length],h!==r&&Nm(e-A[2*h],2)+Nm(n-A[2*h+1],2)<u)return h;break}}while(h!==c);return l}render(t){const e=null==t?t=new Bm:void 0,{points:n,halfedges:r,triangles:i}=this;for(let e=0,a=r.length;e<a;++e){const a=r[e];if(a<e)continue;const o=2*i[e],s=2*i[a];t.moveTo(n[o],n[o+1]),t.lineTo(n[s],n[s+1])}return this.renderHull(t),e&&e.value()}renderPoints(t,e){void 0!==e||t&&"function"==typeof t.moveTo||(e=t,t=null),e=null==e?2:+e;const n=null==t?t=new Bm:void 0,{points:r}=this;for(let n=0,i=r.length;n<i;n+=2){const i=r[n],a=r[n+1];t.moveTo(i+e,a),t.arc(i,a,e,0,zm)}return n&&n.value()}renderHull(t){const e=null==t?t=new Bm:void 0,{hull:n,points:r}=this,i=2*n[0],a=n.length;t.moveTo(r[i],r[i+1]);for(let e=1;e<a;++e){const i=2*n[e];t.lineTo(r[i],r[i+1])}return t.closePath(),e&&e.value()}hullPolygon(){const t=new km;return this.renderHull(t),t.value()}renderTriangle(t,e){const n=null==e?e=new Bm:void 0,{points:r,triangles:i}=this,a=2*i[t*=3],o=2*i[t+1],s=2*i[t+2];return e.moveTo(r[a],r[a+1]),e.lineTo(r[o],r[o+1]),e.lineTo(r[s],r[s+1]),e.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:t}=this;for(let e=0,n=t.length/3;e<n;++e)yield this.trianglePolygon(e)}trianglePolygon(t){const e=new km;return this.renderTriangle(t,e),e.value()}}const Vm=Math.PI,Wm=Vm/2,Qm=180/Vm,Ym=Vm/180,Xm=Math.atan2,Zm=Math.cos,Jm=Math.max,Km=Math.min,$m=Math.sin,tg=Math.sign||function(t){return t>0?1:t<0?-1:0},eg=Math.sqrt;function ng(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function rg(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function ig(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]}function ag(t){var e=eg(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);return[t[0]/e,t[1]/e,t[2]/e]}function og(t){return[Xm(t[1],t[0])*Qm,(e=Jm(-1,Km(1,t[2])),(e>1?Wm:e<-1?-Wm:Math.asin(e))*Qm)];var e}function sg(t){const e=t[0]*Ym,n=t[1]*Ym,r=Zm(n);return[r*Zm(e),r*$m(e),$m(n)]}function Ag(t){return ng((t=t.map((t=>sg(t))))[0],rg(t[2],t[1]))}function lg(t){const e=function(t){if(t.length<2)return{};let e=0;for(;isNaN(t[e][0]+t[e][1])&&e++<t.length;);const n=function(t){function e(e){return(e=t(e[0]*qA,e[1]*qA))[0]*=CA,e[1]*=CA,e}return t=hu(t[0]*qA,t[1]*qA,t.length>2?t[2]*qA:0),e.invert=function(e){return(e=t.invert(e[0]*qA,e[1]*qA))[0]*=CA,e[1]*=CA,e},e}(t[e]),r=xc().translate([0,0]).scale(1).rotate(n.invert([180,0]));t=t.map(r);const i=[];let a=1;for(let e=0,n=t.length;e<n;e++){let n=t[e][0]**2+t[e][1]**2;!isFinite(n)||n>1e32?i.push(e):n>a&&(a=n)}const o=1e6*eg(a);i.forEach((e=>t[e]=[o,0])),t.push([0,o]),t.push([-o,0]),t.push([0,-o]);const s=jm.from(t);s.projection=r;const{triangles:A,halfedges:l,inedges:u}=s;for(let n=0,r=l.length;n<r;n++)if(l[n]<0){const t=n%3==2?n-2:n+1,r=n%3==0?n+2:n-1,i=l[t],a=l[r];l[i]=a,l[a]=i,l[t]=l[r]=-1,A[n]=A[t]=A[r]=e,u[A[i]]=i%3==0?i+2:i-1,u[A[a]]=a%3==0?a+2:a-1,n+=2-n%3}else A[n]>t.length-3-1&&(A[n]=e);return s}(t),n=function(t){const{triangles:e}=t;if(!e)return[];const n=[];for(let t=0,r=e.length/3;t<r;t++){const r=e[3*t],i=e[3*t+1],a=e[3*t+2];r!==i&&i!==a&&n.push([r,a,i])}return n}(e),r=function(t,e){const n=new Set;return 2===e.length?[[0,1]]:(t.forEach((t=>{if(t[0]!==t[1]&&!(Ag(t.map((t=>e[t])))<0))for(let e,r=0;r<3;r++)e=(r+1)%3,n.add(fA([t[r],t[e]]).join("-"))})),Array.from(n,(t=>t.split("-").map(Number))))}(n,t),i=function(t,e){const n=[];t.forEach((t=>{for(let e=0;e<3;e++){const r=t[e],i=t[(e+1)%3];n[r]=n[r]||[],n[r].push(i)}})),0===t.length&&(2===e?(n[0]=[1],n[1]=[0]):1===e&&(n[0]=[]));return n}(n,t.length),a=function(t,e){function n(t,e){let n=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2];return n*n+r*r+i*i}return function(r,i,a){void 0===a&&(a=0);let o,s,A=a;const l=sg([r,i]);do{o=a,a=null,s=n(l,sg(e[o])),t[o].forEach((t=>{let r=n(l,sg(e[t]));if(r<s)return s=r,a=t,void(A=t)}))}while(null!==a);return A}}(i,t),o=function(t,e){return t.map((t=>{const n=t.map((t=>e[t])).map(sg);return og(ag(ig(ig(rg(n[1],n[0]),rg(n[2],n[1])),rg(n[0],n[2]))))}))}(n,t),{polygons:s,centers:A}=function(t,e,n){const r=[],i=t.slice();if(0===e.length){if(n.length<2)return{polygons:r,centers:i};if(2===n.length){const t=sg(n[0]),e=sg(n[1]),o=ag(ig(t,e)),s=ag(rg(t,e)),A=rg(o,s),l=[o,rg(o,A),rg(rg(o,A),A),rg(rg(rg(o,A),A),A)].map(og).map(a);return r.push(l),r.push(l.slice().reverse()),{polygons:r,centers:i}}}e.forEach(((t,e)=>{for(let n=0;n<3;n++){const i=t[n],a=t[(n+1)%3],o=t[(n+2)%3];r[i]=r[i]||[],r[i].push([a,o,e,[i,a,o]])}}));function a(t){let n=-1;return i.slice(e.length,1/0).forEach(((r,i)=>{r[0]===t[0]&&r[1]===t[1]&&(n=i+e.length)})),n<0&&(n=i.length,i.push(t)),n}return{polygons:r.map((t=>{const e=[t[0][2]];let r=t[0][1];for(let n=1;n<t.length;n++)for(let n=0;n<t.length;n++)if(t[n][0]==r){r=t[n][1],e.push(t[n][2]);break}if(e.length>2)return e;if(2==e.length){const r=ug(n[t[0][3][0]],n[t[0][3][1]],i[e[0]]),o=ug(n[t[0][3][2]],n[t[0][3][0]],i[e[0]]),s=a(r),A=a(o);return[e[0],A,e[1],s]}})),centers:i}}(o,n,t),l=function(t){const e=[];return t.forEach((t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r})),e}(s),u=function(t,e){const n=new Set,r=[];t.map((t=>{if(!(Ag(t.map((t=>e[t>e.length?0:t])))>1e-12))for(let e=0;e<3;e++){let r=[t[e],t[(e+1)%3]],i=`${r[0]}-${r[1]}`;n.has(i)?n.delete(i):n.add(`${r[1]}-${r[0]}`)}}));const i=new Map;let a;if(n.forEach((t=>{t=t.split("-").map(Number),i.set(t[0],t[1]),a=t[0]})),void 0===a)return r;let o=a;do{r.push(o);let t=i.get(o);i.set(o,-1),o=t}while(o>-1&&o!==a);return r}(n,t),c=function(t,e){return function(n){const r=new Map,i=new Map;return t.forEach(((t,e)=>{const a=t.join("-");r.set(a,n[e]),i.set(a,!0)})),e.forEach((t=>{let e=0,n=-1;for(let i=0;i<3;i++){let a=fA([t[i],t[(i+1)%3]]).join("-");r.get(a)>e&&(e=r.get(a),n=a)}i.set(n,!1)})),t.map((t=>i.get(t.join("-"))))}}(r,n);return{delaunay:e,edges:r,triangles:n,centers:A,neighbors:i,polygons:s,mesh:l,hull:u,urquhart:c,find:a}}function ug(t,e,n){t=sg(t),e=sg(e),n=sg(n);const r=tg(ng(rg(e,t),n));return og(ag(ig(t,e)).map((t=>r*t)))}function cg(t){const e=function(t){if(e.delaunay=null,e._data=t,"object"==typeof e._data&&"FeatureCollection"===e._data.type&&(e._data=e._data.features),"object"==typeof e._data){const t=e._data.map((t=>[e._vx(t),e._vy(t),t])).filter((t=>isFinite(t[0]+t[1])));e.points=t.map((t=>[t[0],t[1]])),e.valid=t.map((t=>t[2])),e.delaunay=lg(e.points)}return e};return e._vx=function(t){return"object"==typeof t&&"type"in t?lu(t)[0]:0 in t?t[0]:void 0},e._vy=function(t){return"object"==typeof t&&"type"in t?lu(t)[1]:1 in t?t[1]:void 0},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(void 0!==t&&e(t),!e.delaunay)return!1;const n={type:"FeatureCollection",features:[]};return 0===e.valid.length||(e.delaunay.polygons.forEach(((t,r)=>n.features.push({type:"Feature",geometry:t?{type:"Polygon",coordinates:[[...t,t[0]].map((t=>e.delaunay.centers[t]))]}:null,properties:{site:e.valid[r],sitecoordinates:e.points[r],neighbours:e.delaunay.neighbors[r]}}))),1===e.valid.length&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return void 0!==t&&e(t),!!e.delaunay&&{type:"FeatureCollection",features:e.delaunay.triangles.map(((t,n)=>((t=t.map((t=>e.points[t]))).center=e.delaunay.centers[n],t))).filter((t=>Ag(t)>0)).map((t=>({type:"Feature",properties:{circumcenter:t.center},geometry:{type:"Polygon",coordinates:[[...t,t[0]]]}})))}},e.links=function(t){if(void 0!==t&&e(t),!e.delaunay)return!1;const n=e.delaunay.edges.map((t=>Gu(e.points[t[0]],e.points[t[1]]))),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map(((t,i)=>({type:"Feature",properties:{source:e.valid[t[0]],target:e.valid[t[1]],length:n[i],urquhart:!!r[i]},geometry:{type:"LineString",coordinates:[e.points[t[0]],e.points[t[1]]]}})))}},e.mesh=function(t){return void 0!==t&&e(t),!!e.delaunay&&{type:"MultiLineString",coordinates:e.delaunay.edges.map((t=>[e.points[t[0]],e.points[t[1]]]))}},e.cellMesh=function(t){if(void 0!==t&&e(t),!e.delaunay)return!1;const{centers:n,polygons:r}=e.delaunay,i=[];for(const t of r)if(t)for(let e=t.length,r=t[e-1],a=t[0],o=0;o<e;r=a,a=t[++o])a>r&&i.push([n[r],n[a]]);return{type:"MultiLineString",coordinates:i}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||Gu([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){void 0!==t&&e(t);const n=e.delaunay.hull,r=e.points;return 0===n.length?null:{type:"Polygon",coordinates:[[...n.map((t=>r[t])),r[n[0]]]]}},t?e(t):e}function hg(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function fg(t){return fg=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},fg(t)}function dg(t,e){return dg=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},dg(t,e)}function pg(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function mg(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=fg(t);if(e){var i=fg(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return pg(this,n)}}function gg(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(t,e)||xg(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vg(t){return function(t){if(Array.isArray(t))return yg(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||xg(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xg(t,e){if(t){if("string"==typeof t)return yg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yg(t,e):void 0}}function yg(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _g(t,e){return t.map((function(t){var n,r=[];return t.forEach((function(t){if(n){var i=180*Gu(t,n)/Math.PI;if(i>e)for(var a=ec(n,t),o=1/Math.ceil(i/e),s=o;s<1;)r.push(a(s)),s+=o}r.push(n=t)})),r}))}function bg(t,e){var n={type:"Polygon",coordinates:t},r=gg(Jl(n),2),i=gg(r[0],2),a=i[0],o=i[1],s=gg(r[1],2),A=s[0],l=s[1];if(Math.min(Math.abs(A-a),Math.abs(l-o))<e)return[];var u=a>A||l>=89||o<=-89;return function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.minLng,r=e.maxLng,i=e.minLat,a=e.maxLat,o=Math.round(Math.pow(360/t,2)/Math.PI),s=(1+Math.sqrt(5))/2,A=function(t){return t/s*360%360-180},l=function(t){return Math.acos(2*t/o-1)/Math.PI*180-90},u=function(t){return o*(Math.cos((t+90)*Math.PI/180)+1)/2},c=[void 0!==a?Math.ceil(u(a)):0,void 0!==i?Math.floor(u(i)):o-1],h=void 0===n&&void 0===r?function(){return!0}:void 0===n?function(t){return t<=r}:void 0===r?function(t){return t>=n}:r>=n?function(t){return t>=n&&t<=r}:function(t){return t>=n||t<=r},f=[],d=c[0];d<=c[1];d++){var p=A(d);h(p)&&f.push([p,l(d)])}return f}(e,{minLng:a,maxLng:A,minLat:o,maxLat:l}).filter((function(t){return wg(t,n,u)}))}function wg(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n?Ju(e,t):Rm(t,e)}var Mg=window.THREE?window.THREE:{BufferGeometry:nn,Float32BufferAttribute:Ye},Sg=(new Mg.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Eg=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&dg(t,e)}(a,t);var e,n,r,i=mg(a);function a(t,e,n,r,o,s,A){var l;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(l=i.call(this)).type="ConicPolygonBufferGeometry",l.parameters={polygonGeoJson:t,startHeight:e,endHeight:n,closedBottom:r,closedTop:o,includeSides:s,curvatureResolution:A},e=e||0,n=n||1,r=void 0===r||r,o=void 0===o||o,s=void 0===s||s;var u=function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).resolution,n=void 0===e?1/0:e,r=_g(t,n),i=yA(r),a=bg(t,n),o=[].concat(vg(i),vg(a)),s={type:"Polygon",coordinates:t},A=gg(Jl(s),2),l=gg(A[0],2),u=l[0],c=l[1],h=gg(A[1],2),f=h[0],d=h[1],p=u>f||d>=89||c<=-89,m=[];if(p){var g=cg(o).triangles(),v=new Map(o.map((function(t,e){var n=gg(t,2),r=n[0],i=n[1];return["".concat(r,"-").concat(i),e]})));g.features.forEach((function(t){var e,n=t.geometry.coordinates[0].slice(0,3).reverse(),r=[];if(n.forEach((function(t){var e=gg(t,2),n=e[0],i=e[1],a="".concat(n,"-").concat(i);v.has(a)&&r.push(v.get(a))})),3===r.length){if(r.some((function(t){return t<i.length}))&&!wg(t.properties.circumcenter,s,p))return;(e=m).push.apply(e,r)}}))}else if(a.length)!function(){for(var t=Sm.from(o),e=function(e,n){var r,a=[2,1,0].map((function(n){return t.triangles[e+n]})),A=a.map((function(t){return o[t]}));if(a.some((function(t){return t<i.length}))&&!wg([0,1].map((function(t){return xA(A,(function(e){return e[t]}))})),s,p))return"continue";(r=m).push.apply(r,vg(a))},n=0,r=t.triangles.length;n<r;n+=3)e(n)}();else{var x=Os.exports.flatten(r),y=x.vertices,_=x.holes,b=void 0===_?[]:_;m=Os.exports(y,b,2)}var w=sd(fA(o,(function(t){return t[0]})),[0,1]),M=sd(fA(o,(function(t){return t[1]})),[0,1]),S=o.map((function(t){var e=gg(t,2),n=e[0],r=e[1];return[w(n),M(r)]}));return{contour:r,triangles:{points:o,indices:m,uvs:S}}}(t,{resolution:A=A||5}),c=u.contour,h=u.triangles,f=yA(h.uvs),d=[],p=[],m=[],g=0,v=function(t){var e=Math.round(d.length/3),n=m.length;d=d.concat(t.vertices),p=p.concat(t.uvs),m=m.concat(e?t.indices.map((function(t){return t+e})):t.indices),l.addGroup(n,m.length-n,g++)};function x(t,e){var n=t.map((function(t){return t.map((function(t){var n=gg(t,2),r=n[0];return function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-t)*Math.PI/180,i=(90-e)*Math.PI/180;return[n*Math.sin(r)*Math.cos(i),n*Math.cos(r),n*Math.sin(r)*Math.sin(i)]}(n[1],r,e)}))}));return Os.exports.flatten(n)}function y(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return{indices:e?h.indices:h.indices.slice().reverse(),vertices:x([h.points],t).vertices,uvs:f}}return s&&v(function(){for(var t=x(c,e),r=t.vertices,i=t.holes,a=x(c,n).vertices,o=yA([a,r]),s=Math.round(a.length/3),A=new Set(i),l=0,u=[],h=0;h<s;h++){var f=h+1;if(f===s)f=l;else if(A.has(f)){var d=f;f=l,l=d}u.push(h,h+s,f+s),u.push(f+s,f,h)}for(var p=[],m=1;m>=0;m--)for(var g=0;g<s;g+=1)p.push(g/(s-1),m);return{indices:u,vertices:o,uvs:p}}()),r&&v(y(e,!1)),o&&v(y(n,!0)),l.setIndex(m),l[Sg]("position",new Mg.Float32BufferAttribute(d,3)),l[Sg]("uv",new Mg.Float32BufferAttribute(p,2)),l.computeVertexNormals(),l}return e=a,n&&hg(e.prototype,n),r&&hg(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(Mg.BufferGeometry);var Tg=function(t){var e,n=void 0!==(t=t||{})?t:{},r={};for(e in n)n.hasOwnProperty(e)&&(r[e]=n[e]);var i,a,o,s,A;i="object"==typeof window,a="function"==typeof importScripts,s="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,o=s&&!i&&!a,A=!i&&!o&&!a;var l,u,c,h,f,d="";o?(d=__dirname+"/",l=function(t,e){var n;return(n=it(t))||(h||(h=require("fs")),f||(f=require("path")),t=f.normalize(t),n=h.readFileSync(t)),e?n:n.toString()},c=function(t){var e=l(t,!0);return e.buffer||(e=new Uint8Array(e)),y(e.buffer),e},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),n.inspect=function(){return"[Emscripten Module object]"}):A?("undefined"!=typeof read&&(l=function(t){var e=it(t);return e?nt(e):read(t)}),c=function(t){var e;return(e=it(t))?e:"function"==typeof readbuffer?new Uint8Array(readbuffer(t)):(y("object"==typeof(e=read(t,"binary"))),e)},"undefined"!=typeof scriptArgs&&scriptArgs,"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(i||a)&&(a?d=self.location.href:document.currentScript&&(d=document.currentScript.src),d=0!==d.indexOf("blob:")?d.substr(0,d.lastIndexOf("/")+1):"",l=function(t){try{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText}catch(e){var n=it(t);if(n)return nt(n);throw e}},a&&(c=function(t){try{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}catch(e){var n=it(t);if(n)return n;throw e}}),u=function(t,e,n){var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)e(r.response);else{var i=it(t);i?e(i.buffer):n()}},r.onerror=n,r.send(null)});var p=n.print||console.log.bind(console),m=n.printErr||console.warn.bind(console);for(e in r)r.hasOwnProperty(e)&&(n[e]=r[e]);r=null,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram;var g=0,v=function(){return g};var x=!1;function y(t,e){t||vt("Assertion failed: "+e)}function _(t){var e=n["_"+t];return y(e,"Cannot call unknown function "+t+", make sure it is exported"),e}function b(t,e,n,r,i){var a={string:function(t){var e=0;if(null!=t&&0!==t){var n=1+(t.length<<2);(function(t,e,n){(function(t,e,n,r){if(!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<t.length;++o){var s=t.charCodeAt(o);if(s>=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&t.charCodeAt(++o);if(s<=127){if(n>=a)break;e[n++]=s}else if(s<=2047){if(n+1>=a)break;e[n++]=192|s>>6,e[n++]=128|63&s}else if(s<=65535){if(n+2>=a)break;e[n++]=224|s>>12,e[n++]=128|s>>6&63,e[n++]=128|63&s}else{if(n+3>=a)break;e[n++]=240|s>>18,e[n++]=128|s>>12&63,e[n++]=128|s>>6&63,e[n++]=128|63&s}}e[n]=0})(t,S,e,n)})(t,e=lt(n),n)}return e},array:function(t){var e=lt(t.length);return function(t,e){M.set(t,e)}(t,e),e}};var o=_(t),s=[],A=0;if(r)for(var l=0;l<r.length;l++){var u=a[n[l]];u?(0===A&&(A=ct()),s[l]=u(r[l])):s[l]=r[l]}var c=o.apply(null,s);return c=function(t){return"string"===e?D(t):"boolean"===e?Boolean(t):t}(c),0!==A&&ut(A),c}var w,M,S,E,T,C,q,P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function D(t,e){return t?function(t,e,n){for(var r=e+n,i=e;t[i]&&!(i>=r);)++i;if(i-e>16&&t.subarray&&P)return P.decode(t.subarray(e,i));for(var a="";e<i;){var o=t[e++];if(128&o){var s=63&t[e++];if(192!=(224&o)){var A=63&t[e++];if((o=224==(240&o)?(15&o)<<12|s<<6|A:(7&o)<<18|s<<12|A<<6|63&t[e++])<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}(S,t,e):""}function L(t,e){return t%e>0&&(t+=e-t%e),t}function R(t){w=t,n.HEAP8=M=new Int8Array(t),n.HEAP16=E=new Int16Array(t),n.HEAP32=T=new Int32Array(t),n.HEAPU8=S=new Uint8Array(t),n.HEAPU16=new Uint16Array(t),n.HEAPU32=new Uint32Array(t),n.HEAPF32=C=new Float32Array(t),n.HEAPF64=q=new Float64Array(t)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var I=n.TOTAL_MEMORY||33554432;function O(t){for(;t.length>0;){var e=t.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?n.dynCall_v(r):n.dynCall_vi(r,e.arg):r(void 0===e.arg?null:e.arg)}else e()}}I=(w=n.buffer?n.buffer:new ArrayBuffer(I)).byteLength,R(w),T[6004]=5266928;var B=[],k=[],U=[],z=[];var N=Math.abs,F=Math.ceil,G=Math.floor,H=Math.min,j=0,V=null;n.preloadedImages={},n.preloadedAudios={};var W,Q,Y=null,X="data:application/octet-stream;base64,";function Z(t){return String.prototype.startsWith?t.startsWith(X):0===t.indexOf(X)}Y="data:application/octet-stream;base64,AAAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAABAAAAAMAAAAGAAAABQAAAAIAAAAAAAAAAgAAAAMAAAABAAAABAAAAAYAAAAAAAAABQAAAAMAAAAGAAAABAAAAAUAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAABAAAABQAAAAIAAAAAAAAAAQAAAAMAAAAGAAAABAAAAAYAAAAAAAAABQAAAAIAAAABAAAABAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAgAAAAMAAAAAAAAAAAAAAAIAAAAAAAAAAQAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABgAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAABgAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAAAAAACAAAAAwAAAAQAAAAFAAAABgAAAAAAAAABAAAAAwAAAAQAAAAFAAAABgAAAAAAAAABAAAAAgAAAAQAAAAFAAAABgAAAAAAAAABAAAAAgAAAAMAAAAFAAAABgAAAAAAAAABAAAAAgAAAAMAAAAEAAAABgAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAAAAAAABgAAAAAAAAADAAAAAgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAUAAAAEAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAEAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAUAAAACAAAABAAAAAMAAAAIAAAAAQAAAAcAAAAGAAAACQAAAAAAAAADAAAAAgAAAAIAAAAGAAAACgAAAAsAAAAAAAAAAQAAAAUAAAADAAAADQAAAAEAAAAHAAAABAAAAAwAAAAAAAAABAAAAH8AAAAPAAAACAAAAAMAAAAAAAAADAAAAAUAAAACAAAAEgAAAAoAAAAIAAAAAAAAABAAAAAGAAAADgAAAAsAAAARAAAAAQAAAAkAAAACAAAABwAAABUAAAAJAAAAEwAAAAMAAAANAAAAAQAAAAgAAAAFAAAAFgAAABAAAAAEAAAAAAAAAA8AAAAJAAAAEwAAAA4AAAAUAAAAAQAAAAcAAAAGAAAACgAAAAsAAAAYAAAAFwAAAAUAAAACAAAAEgAAAAsAAAARAAAAFwAAABkAAAACAAAABgAAAAoAAAAMAAAAHAAAAA0AAAAaAAAABAAAAA8AAAADAAAADQAAABoAAAAVAAAAHQAAAAMAAAAMAAAABwAAAA4AAAB/AAAAEQAAABsAAAAJAAAAFAAAAAYAAAAPAAAAFgAAABwAAAAfAAAABAAAAAgAAAAMAAAAEAAAABIAAAAhAAAAHgAAAAgAAAAFAAAAFgAAABEAAAALAAAADgAAAAYAAAAjAAAAGQAAABsAAAASAAAAGAAAAB4AAAAgAAAABQAAAAoAAAAQAAAAEwAAACIAAAAUAAAAJAAAAAcAAAAVAAAACQAAABQAAAAOAAAAEwAAAAkAAAAoAAAAGwAAACQAAAAVAAAAJgAAABMAAAAiAAAADQAAAB0AAAAHAAAAFgAAABAAAAApAAAAIQAAAA8AAAAIAAAAHwAAABcAAAAYAAAACwAAAAoAAAAnAAAAJQAAABkAAAAYAAAAfwAAACAAAAAlAAAACgAAABcAAAASAAAAGQAAABcAAAARAAAACwAAAC0AAAAnAAAAIwAAABoAAAAqAAAAHQAAACsAAAAMAAAAHAAAAA0AAAAbAAAAKAAAACMAAAAuAAAADgAAABQAAAARAAAAHAAAAB8AAAAqAAAALAAAAAwAAAAPAAAAGgAAAB0AAAArAAAAJgAAAC8AAAANAAAAGgAAABUAAAAeAAAAIAAAADAAAAAyAAAAEAAAABIAAAAhAAAAHwAAACkAAAAsAAAANQAAAA8AAAAWAAAAHAAAACAAAAAeAAAAGAAAABIAAAA0AAAAMgAAACUAAAAhAAAAHgAAADEAAAAwAAAAFgAAABAAAAApAAAAIgAAABMAAAAmAAAAFQAAADYAAAAkAAAAMwAAACMAAAAuAAAALQAAADgAAAARAAAAGwAAABkAAAAkAAAAFAAAACIAAAATAAAANwAAACgAAAA2AAAAJQAAACcAAAA0AAAAOQAAABgAAAAXAAAAIAAAACYAAAB/AAAAIgAAADMAAAAdAAAALwAAABUAAAAnAAAAJQAAABkAAAAXAAAAOwAAADkAAAAtAAAAKAAAABsAAAAkAAAAFAAAADwAAAAuAAAANwAAACkAAAAxAAAANQAAAD0AAAAWAAAAIQAAAB8AAAAqAAAAOgAAACsAAAA+AAAAHAAAACwAAAAaAAAAKwAAAD4AAAAvAAAAQAAAABoAAAAqAAAAHQAAACwAAAA1AAAAOgAAAEEAAAAcAAAAHwAAACoAAAAtAAAAJwAAACMAAAAZAAAAPwAAADsAAAA4AAAALgAAADwAAAA4AAAARAAAABsAAAAoAAAAIwAAAC8AAAAmAAAAKwAAAB0AAABFAAAAMwAAAEAAAAAwAAAAMQAAAB4AAAAhAAAAQwAAAEIAAAAyAAAAMQAAAH8AAAA9AAAAQgAAACEAAAAwAAAAKQAAADIAAAAwAAAAIAAAAB4AAABGAAAAQwAAADQAAAAzAAAARQAAADYAAABHAAAAJgAAAC8AAAAiAAAANAAAADkAAABGAAAASgAAACAAAAAlAAAAMgAAADUAAAA9AAAAQQAAAEsAAAAfAAAAKQAAACwAAAA2AAAARwAAADcAAABJAAAAIgAAADMAAAAkAAAANwAAACgAAAA2AAAAJAAAAEgAAAA8AAAASQAAADgAAABEAAAAPwAAAE0AAAAjAAAALgAAAC0AAAA5AAAAOwAAAEoAAABOAAAAJQAAACcAAAA0AAAAOgAAAH8AAAA+AAAATAAAACwAAABBAAAAKgAAADsAAAA/AAAATgAAAE8AAAAnAAAALQAAADkAAAA8AAAASAAAAEQAAABQAAAAKAAAADcAAAAuAAAAPQAAADUAAAAxAAAAKQAAAFEAAABLAAAAQgAAAD4AAAArAAAAOgAAACoAAABSAAAAQAAAAEwAAAA/AAAAfwAAADgAAAAtAAAATwAAADsAAABNAAAAQAAAAC8AAAA+AAAAKwAAAFQAAABFAAAAUgAAAEEAAAA6AAAANQAAACwAAABWAAAATAAAAEsAAABCAAAAQwAAAFEAAABVAAAAMQAAADAAAAA9AAAAQwAAAEIAAAAyAAAAMAAAAFcAAABVAAAARgAAAEQAAAA4AAAAPAAAAC4AAABaAAAATQAAAFAAAABFAAAAMwAAAEAAAAAvAAAAWQAAAEcAAABUAAAARgAAAEMAAAA0AAAAMgAAAFMAAABXAAAASgAAAEcAAABZAAAASQAAAFsAAAAzAAAARQAAADYAAABIAAAAfwAAAEkAAAA3AAAAUAAAADwAAABYAAAASQAAAFsAAABIAAAAWAAAADYAAABHAAAANwAAAEoAAABOAAAAUwAAAFwAAAA0AAAAOQAAAEYAAABLAAAAQQAAAD0AAAA1AAAAXgAAAFYAAABRAAAATAAAAFYAAABSAAAAYAAAADoAAABBAAAAPgAAAE0AAAA/AAAARAAAADgAAABdAAAATwAAAFoAAABOAAAASgAAADsAAAA5AAAAXwAAAFwAAABPAAAATwAAAE4AAAA/AAAAOwAAAF0AAABfAAAATQAAAFAAAABEAAAASAAAADwAAABjAAAAWgAAAFgAAABRAAAAVQAAAF4AAABlAAAAPQAAAEIAAABLAAAAUgAAAGAAAABUAAAAYgAAAD4AAABMAAAAQAAAAFMAAAB/AAAASgAAAEYAAABkAAAAVwAAAFwAAABUAAAARQAAAFIAAABAAAAAYQAAAFkAAABiAAAAVQAAAFcAAABlAAAAZgAAAEIAAABDAAAAUQAAAFYAAABMAAAASwAAAEEAAABoAAAAYAAAAF4AAABXAAAAUwAAAGYAAABkAAAAQwAAAEYAAABVAAAAWAAAAEgAAABbAAAASQAAAGMAAABQAAAAaQAAAFkAAABhAAAAWwAAAGcAAABFAAAAVAAAAEcAAABaAAAATQAAAFAAAABEAAAAagAAAF0AAABjAAAAWwAAAEkAAABZAAAARwAAAGkAAABYAAAAZwAAAFwAAABTAAAATgAAAEoAAABsAAAAZAAAAF8AAABdAAAATwAAAFoAAABNAAAAbQAAAF8AAABqAAAAXgAAAFYAAABRAAAASwAAAGsAAABoAAAAZQAAAF8AAABcAAAATwAAAE4AAABtAAAAbAAAAF0AAABgAAAAaAAAAGIAAABuAAAATAAAAFYAAABSAAAAYQAAAH8AAABiAAAAVAAAAGcAAABZAAAAbwAAAGIAAABuAAAAYQAAAG8AAABSAAAAYAAAAFQAAABjAAAAUAAAAGkAAABYAAAAagAAAFoAAABxAAAAZAAAAGYAAABTAAAAVwAAAGwAAAByAAAAXAAAAGUAAABmAAAAawAAAHAAAABRAAAAVQAAAF4AAABmAAAAZQAAAFcAAABVAAAAcgAAAHAAAABkAAAAZwAAAFsAAABhAAAAWQAAAHQAAABpAAAAbwAAAGgAAABrAAAAbgAAAHMAAABWAAAAXgAAAGAAAABpAAAAWAAAAGcAAABbAAAAcQAAAGMAAAB0AAAAagAAAF0AAABjAAAAWgAAAHUAAABtAAAAcQAAAGsAAAB/AAAAZQAAAF4AAABzAAAAaAAAAHAAAABsAAAAZAAAAF8AAABcAAAAdgAAAHIAAABtAAAAbQAAAGwAAABdAAAAXwAAAHUAAAB2AAAAagAAAG4AAABiAAAAaAAAAGAAAAB3AAAAbwAAAHMAAABvAAAAYQAAAG4AAABiAAAAdAAAAGcAAAB3AAAAcAAAAGsAAABmAAAAZQAAAHgAAABzAAAAcgAAAHEAAABjAAAAdAAAAGkAAAB1AAAAagAAAHkAAAByAAAAcAAAAGQAAABmAAAAdgAAAHgAAABsAAAAcwAAAG4AAABrAAAAaAAAAHgAAAB3AAAAcAAAAHQAAABnAAAAdwAAAG8AAABxAAAAaQAAAHkAAAB1AAAAfwAAAG0AAAB2AAAAcQAAAHkAAABqAAAAdgAAAHgAAABsAAAAcgAAAHUAAAB5AAAAbQAAAHcAAABvAAAAcwAAAG4AAAB5AAAAdAAAAHgAAAB4AAAAcwAAAHIAAABwAAAAeQAAAHcAAAB2AAAAeQAAAHQAAAB4AAAAdwAAAHUAAABxAAAAdgAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAEAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAQAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAADAAAABQAAAAEAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAgAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAABQAAAAUAAAAAAAAAAAAAAP////8BAAAAAAAAAAMAAAAEAAAAAgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAQAAAP//////////AQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAIAAAAAAAAAAAAAAAEAAAACAAAABgAAAAQAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAoAAAACAAAAAAAAAAAAAAABAAAAAQAAAAUAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAAAAAAAAAAAAAEAAAADAAAABwAAAAYAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAHAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAAAAAAAAAAAAQAAAAAAAAAJAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAAAAAAAAAAAAQAAAAQAAAAIAAAACgAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAAAAAAAAAAABAAAACwAAAA8AAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA4AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAgAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAAAAAAAAAAABAAAADAAAABAAAAAMAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAEAAAAKAAAAEwAAAAgAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAJAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAgAAAAAAAAAAAAAAAQAAAA0AAAARAAAADQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABMAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAAAAAAAAAAAAAEAAAAOAAAAEgAAAA8AAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAAAAAABAAAA//////////8TAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABMAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABIAAAAAAAAAGAAAAAAAAAAhAAAAAAAAAB4AAAAAAAAAIAAAAAMAAAAxAAAAAQAAADAAAAADAAAAMgAAAAMAAAAIAAAAAAAAAAUAAAAFAAAACgAAAAUAAAAWAAAAAAAAABAAAAAAAAAAEgAAAAAAAAApAAAAAQAAACEAAAAAAAAAHgAAAAAAAAAEAAAAAAAAAAAAAAAFAAAAAgAAAAUAAAAPAAAAAQAAAAgAAAAAAAAABQAAAAUAAAAfAAAAAQAAABYAAAAAAAAAEAAAAAAAAAACAAAAAAAAAAYAAAAAAAAADgAAAAAAAAAKAAAAAAAAAAsAAAAAAAAAEQAAAAMAAAAYAAAAAQAAABcAAAADAAAAGQAAAAMAAAAAAAAAAAAAAAEAAAAFAAAACQAAAAUAAAAFAAAAAAAAAAIAAAAAAAAABgAAAAAAAAASAAAAAQAAAAoAAAAAAAAACwAAAAAAAAAEAAAAAQAAAAMAAAAFAAAABwAAAAUAAAAIAAAAAQAAAAAAAAAAAAAAAQAAAAUAAAAQAAAAAQAAAAUAAAAAAAAAAgAAAAAAAAAHAAAAAAAAABUAAAAAAAAAJgAAAAAAAAAJAAAAAAAAABMAAAAAAAAAIgAAAAMAAAAOAAAAAQAAABQAAAADAAAAJAAAAAMAAAADAAAAAAAAAA0AAAAFAAAAHQAAAAUAAAABAAAAAAAAAAcAAAAAAAAAFQAAAAAAAAAGAAAAAQAAAAkAAAAAAAAAEwAAAAAAAAAEAAAAAgAAAAwAAAAFAAAAGgAAAAUAAAAAAAAAAQAAAAMAAAAAAAAADQAAAAUAAAACAAAAAQAAAAEAAAAAAAAABwAAAAAAAAAaAAAAAAAAACoAAAAAAAAAOgAAAAAAAAAdAAAAAAAAACsAAAAAAAAAPgAAAAMAAAAmAAAAAQAAAC8AAAADAAAAQAAAAAMAAAAMAAAAAAAAABwAAAAFAAAALAAAAAUAAAANAAAAAAAAABoAAAAAAAAAKgAAAAAAAAAVAAAAAQAAAB0AAAAAAAAAKwAAAAAAAAAEAAAAAwAAAA8AAAAFAAAAHwAAAAUAAAADAAAAAQAAAAwAAAAAAAAAHAAAAAUAAAAHAAAAAQAAAA0AAAAAAAAAGgAAAAAAAAAfAAAAAAAAACkAAAAAAAAAMQAAAAAAAAAsAAAAAAAAADUAAAAAAAAAPQAAAAMAAAA6AAAAAQAAAEEAAAADAAAASwAAAAMAAAAPAAAAAAAAABYAAAAFAAAAIQAAAAUAAAAcAAAAAAAAAB8AAAAAAAAAKQAAAAAAAAAqAAAAAQAAACwAAAAAAAAANQAAAAAAAAAEAAAABAAAAAgAAAAFAAAAEAAAAAUAAAAMAAAAAQAAAA8AAAAAAAAAFgAAAAUAAAAaAAAAAQAAABwAAAAAAAAAHwAAAAAAAAAyAAAAAAAAADAAAAAAAAAAMQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAIQAAAAMAAAAYAAAAAwAAABIAAAADAAAAEAAAAAMAAABGAAAAAAAAAEMAAAAAAAAAQgAAAAMAAAA0AAAAAwAAADIAAAAAAAAAMAAAAAAAAAAlAAAAAwAAACAAAAAAAAAAHgAAAAMAAABTAAAAAAAAAFcAAAADAAAAVQAAAAMAAABKAAAAAwAAAEYAAAAAAAAAQwAAAAAAAAA5AAAAAQAAADQAAAADAAAAMgAAAAAAAAAZAAAAAAAAABcAAAAAAAAAGAAAAAMAAAARAAAAAAAAAAsAAAADAAAACgAAAAMAAAAOAAAAAwAAAAYAAAADAAAAAgAAAAMAAAAtAAAAAAAAACcAAAAAAAAAJQAAAAMAAAAjAAAAAwAAABkAAAAAAAAAFwAAAAAAAAAbAAAAAwAAABEAAAAAAAAACwAAAAMAAAA/AAAAAAAAADsAAAADAAAAOQAAAAMAAAA4AAAAAwAAAC0AAAAAAAAAJwAAAAAAAAAuAAAAAwAAACMAAAADAAAAGQAAAAAAAAAkAAAAAAAAABQAAAAAAAAADgAAAAMAAAAiAAAAAAAAABMAAAADAAAACQAAAAMAAAAmAAAAAwAAABUAAAADAAAABwAAAAMAAAA3AAAAAAAAACgAAAAAAAAAGwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAFAAAAAAAAAAzAAAAAwAAACIAAAAAAAAAEwAAAAMAAABIAAAAAAAAADwAAAADAAAALgAAAAMAAABJAAAAAwAAADcAAAAAAAAAKAAAAAAAAABHAAAAAwAAADYAAAADAAAAJAAAAAAAAABAAAAAAAAAAC8AAAAAAAAAJgAAAAMAAAA+AAAAAAAAACsAAAADAAAAHQAAAAMAAAA6AAAAAwAAACoAAAADAAAAGgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAMwAAAAMAAABSAAAAAwAAAEAAAAAAAAAALwAAAAAAAABMAAAAAwAAAD4AAAAAAAAAKwAAAAMAAABhAAAAAAAAAFkAAAADAAAARwAAAAMAAABiAAAAAwAAAFQAAAAAAAAARQAAAAAAAABgAAAAAwAAAFIAAAADAAAAQAAAAAAAAABLAAAAAAAAAEEAAAAAAAAAOgAAAAMAAAA9AAAAAAAAADUAAAADAAAALAAAAAMAAAAxAAAAAwAAACkAAAADAAAAHwAAAAMAAABeAAAAAAAAAFYAAAAAAAAATAAAAAMAAABRAAAAAwAAAEsAAAAAAAAAQQAAAAAAAABCAAAAAwAAAD0AAAAAAAAANQAAAAMAAABrAAAAAAAAAGgAAAADAAAAYAAAAAMAAABlAAAAAwAAAF4AAAAAAAAAVgAAAAAAAABVAAAAAwAAAFEAAAADAAAASwAAAAAAAAA5AAAAAAAAADsAAAAAAAAAPwAAAAMAAABKAAAAAAAAAE4AAAADAAAATwAAAAMAAABTAAAAAwAAAFwAAAADAAAAXwAAAAMAAAAlAAAAAAAAACcAAAADAAAALQAAAAMAAAA0AAAAAAAAADkAAAAAAAAAOwAAAAAAAABGAAAAAwAAAEoAAAAAAAAATgAAAAMAAAAYAAAAAAAAABcAAAADAAAAGQAAAAMAAAAgAAAAAwAAACUAAAAAAAAAJwAAAAMAAAAyAAAAAwAAADQAAAAAAAAAOQAAAAAAAAAuAAAAAAAAADwAAAAAAAAASAAAAAMAAAA4AAAAAAAAAEQAAAADAAAAUAAAAAMAAAA/AAAAAwAAAE0AAAADAAAAWgAAAAMAAAAbAAAAAAAAACgAAAADAAAANwAAAAMAAAAjAAAAAAAAAC4AAAAAAAAAPAAAAAAAAAAtAAAAAwAAADgAAAAAAAAARAAAAAMAAAAOAAAAAAAAABQAAAADAAAAJAAAAAMAAAARAAAAAwAAABsAAAAAAAAAKAAAAAMAAAAZAAAAAwAAACMAAAAAAAAALgAAAAAAAABHAAAAAAAAAFkAAAAAAAAAYQAAAAMAAABJAAAAAAAAAFsAAAADAAAAZwAAAAMAAABIAAAAAwAAAFgAAAADAAAAaQAAAAMAAAAzAAAAAAAAAEUAAAADAAAAVAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAWQAAAAAAAAA3AAAAAwAAAEkAAAAAAAAAWwAAAAMAAAAmAAAAAAAAAC8AAAADAAAAQAAAAAMAAAAiAAAAAwAAADMAAAAAAAAARQAAAAMAAAAkAAAAAwAAADYAAAAAAAAARwAAAAAAAABgAAAAAAAAAGgAAAAAAAAAawAAAAMAAABiAAAAAAAAAG4AAAADAAAAcwAAAAMAAABhAAAAAwAAAG8AAAADAAAAdwAAAAMAAABMAAAAAAAAAFYAAAADAAAAXgAAAAMAAABSAAAAAAAAAGAAAAAAAAAAaAAAAAAAAABUAAAAAwAAAGIAAAAAAAAAbgAAAAMAAAA6AAAAAAAAAEEAAAADAAAASwAAAAMAAAA+AAAAAwAAAEwAAAAAAAAAVgAAAAMAAABAAAAAAwAAAFIAAAAAAAAAYAAAAAAAAABVAAAAAAAAAFcAAAAAAAAAUwAAAAMAAABlAAAAAAAAAGYAAAADAAAAZAAAAAMAAABrAAAAAwAAAHAAAAADAAAAcgAAAAMAAABCAAAAAAAAAEMAAAADAAAARgAAAAMAAABRAAAAAAAAAFUAAAAAAAAAVwAAAAAAAABeAAAAAwAAAGUAAAAAAAAAZgAAAAMAAAAxAAAAAAAAADAAAAADAAAAMgAAAAMAAAA9AAAAAwAAAEIAAAAAAAAAQwAAAAMAAABLAAAAAwAAAFEAAAAAAAAAVQAAAAAAAABfAAAAAAAAAFwAAAAAAAAAUwAAAAAAAABPAAAAAAAAAE4AAAAAAAAASgAAAAMAAAA/AAAAAQAAADsAAAADAAAAOQAAAAMAAABtAAAAAAAAAGwAAAAAAAAAZAAAAAUAAABdAAAAAQAAAF8AAAAAAAAAXAAAAAAAAABNAAAAAQAAAE8AAAAAAAAATgAAAAAAAAB1AAAABAAAAHYAAAAFAAAAcgAAAAUAAABqAAAAAQAAAG0AAAAAAAAAbAAAAAAAAABaAAAAAQAAAF0AAAABAAAAXwAAAAAAAABaAAAAAAAAAE0AAAAAAAAAPwAAAAAAAABQAAAAAAAAAEQAAAAAAAAAOAAAAAMAAABIAAAAAQAAADwAAAADAAAALgAAAAMAAABqAAAAAAAAAF0AAAAAAAAATwAAAAUAAABjAAAAAQAAAFoAAAAAAAAATQAAAAAAAABYAAAAAQAAAFAAAAAAAAAARAAAAAAAAAB1AAAAAwAAAG0AAAAFAAAAXwAAAAUAAABxAAAAAQAAAGoAAAAAAAAAXQAAAAAAAABpAAAAAQAAAGMAAAABAAAAWgAAAAAAAABpAAAAAAAAAFgAAAAAAAAASAAAAAAAAABnAAAAAAAAAFsAAAAAAAAASQAAAAMAAABhAAAAAQAAAFkAAAADAAAARwAAAAMAAABxAAAAAAAAAGMAAAAAAAAAUAAAAAUAAAB0AAAAAQAAAGkAAAAAAAAAWAAAAAAAAABvAAAAAQAAAGcAAAAAAAAAWwAAAAAAAAB1AAAAAgAAAGoAAAAFAAAAWgAAAAUAAAB5AAAAAQAAAHEAAAAAAAAAYwAAAAAAAAB3AAAAAQAAAHQAAAABAAAAaQAAAAAAAAB3AAAAAAAAAG8AAAAAAAAAYQAAAAAAAABzAAAAAAAAAG4AAAAAAAAAYgAAAAMAAABrAAAAAQAAAGgAAAADAAAAYAAAAAMAAAB5AAAAAAAAAHQAAAAAAAAAZwAAAAUAAAB4AAAAAQAAAHcAAAAAAAAAbwAAAAAAAABwAAAAAQAAAHMAAAAAAAAAbgAAAAAAAAB1AAAAAQAAAHEAAAAFAAAAaQAAAAUAAAB2AAAAAQAAAHkAAAAAAAAAdAAAAAAAAAByAAAAAQAAAHgAAAABAAAAdwAAAAAAAAByAAAAAAAAAHAAAAAAAAAAawAAAAAAAABkAAAAAAAAAGYAAAAAAAAAZQAAAAMAAABTAAAAAQAAAFcAAAADAAAAVQAAAAMAAAB2AAAAAAAAAHgAAAAAAAAAcwAAAAUAAABsAAAAAQAAAHIAAAAAAAAAcAAAAAAAAABcAAAAAQAAAGQAAAAAAAAAZgAAAAAAAAB1AAAAAAAAAHkAAAAFAAAAdwAAAAUAAABtAAAAAQAAAHYAAAAAAAAAeAAAAAAAAABfAAAAAQAAAGwAAAABAAAAcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAB+ogX28rbpPxqumpJv+fM/165tC4ns9D+XaEnTqUsEQFrOtNlC4PA/3U+0XG6P9b9TdUUBxTTjP4PUp8ex1ty/B1rD/EN43z+lcDi6LLrZP/a45NWEHMY/oJ5ijLDZ+j/xw3rjxWPjP2B8A46ioQdAotff3wla2z+FMSpA1jj+v6b5Y1mtPbS/cIu8K0F457/2esiyJpDNv98k5Ts2NeA/pvljWa09tD88ClUJ60MDQPZ6yLImkM0/4ONKxa0UBcD2uOTVhBzGv5G7JRxGave/8cN648Vj47+HCwtkjAXIv6LX398JWtu/qyheaCAL9D9TdUUBxTTjv4gyTxslhwVAB1rD/EN4378EH/28teoFwH6iBfbytum/F6ztFYdK/r/Xrm0Liez0vwcS6wNGWeO/Ws602ULg8L9TCtRLiLT8P8pi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAMuhRbbsNlBBYqHW9OmHIkF9XBuqnS31QAK37uYhNMhAOSo3UUupm0DC+6pc6JxvQHV9eseEEEJAzURsCyqlFEB8BQ4NMJjnPyy3tBoS97o/xawXQznRjj89J2K2CZxhP6vX43RIIDQ/S8isgygEBz+LvFHQkmzaPjFFFO7wMq4+AADMLkTtjkIAAOgkJqxhQgAAU7B0MjRCAADwpBcVB0IAAACYP2HaQQAAAIn/Ja5BzczM4Eg6gUHNzMxMU7BTQTMzMzNfgCZBAAAAAEi3+UAAAAAAwGPNQDMzMzMzy6BAmpmZmZkxc0AzMzMzM/NFQDMzMzMzMxlAzczMzMzM7D+ygXSx2U6RQKimJOvQKnpA23hmONTHY0A/AGcxyudNQNb3K647mzZA+S56rrwWIUAm4kUQ+9UJQKre9hGzh/M/BLvoy9WG3T+LmqMf8VHGP2m3nYNV37A/gbFHcyeCmT+cBPWBckiDP61tZACjKW0/q2RbYVUYVj8uDypVyLNAP6jGS5cA5zBBwcqhBdCNGUEGEhQ/JVEDQT6WPnRbNO1AB/AWSJgT1kDfUWNCNLDAQNk+5C33OqlAchWL34QSk0DKvtDIrNV8QNF0G3kFzGVASSeWhBl6UED+/0mNGuk4QGjA/dm/1CJALPLPMql6DEDSHoDrwpP1P2jouzWST+A/egAAAAAAAABKAwAAAAAAAPoWAAAAAAAAyqAAAAAAAAB6ZQQAAAAAAErGHgAAAAAA+mvXAAAAAADK8+MFAAAAAHqqOykAAAAASqmhIAEAAAD6oGvkBwAAAMpm8T43AAAAes+ZuIIBAABKrDQMkwoAAPq1cFUFSgAAyvkUViUGAgAAAAAAAwAAAAYAAAACAAAABQAAAAEAAAAEAAAAAAAAAAAAAAAFAAAAAwAAAAEAAAAGAAAABAAAAAIAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAA/////wAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAP////8AAAAAAAAAAAEAAAABAAAAAAAAAAAAAAD/////AAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAAAAAAABAAEAAAEBAAAAAAABAAAAAQAAAAEAAQAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAAYWxnb3MuYwBfcG9seWZpbGxJbnRlcm5hbABhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0dlb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9HZW9Cb3VuZGFyeQBwb2x5Z29uLT5uZXh0ID09IE5VTEwAbGlua2VkR2VvLmMAYWRkTmV3TGlua2VkUG9seWdvbgBuZXh0ICE9IE5VTEwAbG9vcCAhPSBOVUxMAGFkZE5ld0xpbmtlZExvb3AAcG9seWdvbi0+Zmlyc3QgPT0gTlVMTABhZGRMaW5rZWRMb29wAGNvb3JkICE9IE5VTEwAYWRkTGlua2VkQ29vcmQAbG9vcC0+Zmlyc3QgPT0gTlVMTABpbm5lckxvb3BzICE9IE5VTEwAbm9ybWFsaXplTXVsdGlQb2x5Z29uAGJib3hlcyAhPSBOVUxMAGNhbmRpZGF0ZXMgIT0gTlVMTABmaW5kUG9seWdvbkZvckhvbGUAY2FuZGlkYXRlQkJveGVzICE9IE5VTEwAcmV2RGlyICE9IElOVkFMSURfRElHSVQAbG9jYWxpai5jAGgzVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAcGVudGFnb25Sb3RhdGlvbnMgPj0gMABkaXJlY3Rpb25Sb3RhdGlvbnMgPj0gMABiYXNlQ2VsbCA9PSBvcmlnaW5CYXNlQ2VsbABiYXNlQ2VsbCAhPSBJTlZBTElEX0JBU0VfQ0VMTABsb2NhbElqa1RvSDMAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAd2l0aGluUGVudGFnb25Sb3RhdGlvbnMgPj0gMABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";function J(t){return t}function K(t){return t.replace(/\b__Z[\w\d_]+/g,(function(t){return t===t?t:t+" ["+t+"]"}))}function $(){var t=new Error;if(!t.stack){try{throw new Error(0)}catch(e){t=e}if(!t.stack)return"(no stack trace available)"}return t.stack.toString()}function tt(){return M.length}function et(t){try{var e=new ArrayBuffer(t);if(e.byteLength!=t)return;return new Int8Array(e).set(M),ot(e),R(e),1}catch(t){}}function nt(t){for(var e=[],n=0;n<t.length;n++){var r=t[n];r>255&&(r&=255),e.push(String.fromCharCode(r))}return e.join("")}var rt="function"==typeof atob?atob:function(t){var e,n,r,i,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",A="",l=0;t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=s.indexOf(t.charAt(l++))<<2|(i=s.indexOf(t.charAt(l++)))>>4,n=(15&i)<<4|(a=s.indexOf(t.charAt(l++)))>>2,r=(3&a)<<6|(o=s.indexOf(t.charAt(l++))),A+=String.fromCharCode(e),64!==a&&(A+=String.fromCharCode(n)),64!==o&&(A+=String.fromCharCode(r))}while(l<t.length);return A};function it(t){if(Z(t))return function(t){if("boolean"==typeof o&&o){var e;try{e=Buffer.from(t,"base64")}catch(n){e=new Buffer(t,"base64")}return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}try{for(var n=rt(t),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}catch(t){throw new Error("Converting base64 string to bytes failed.")}}(t.slice(X.length))}var at=function(t,e,n){var r=new t.Int8Array(n),i=new t.Int32Array(n);new t.Uint8Array(n),new t.Float32Array(n);var a=new t.Float64Array(n),o=0|e.p,s=t.Math.floor,A=t.Math.abs,l=t.Math.sqrt,u=t.Math.pow,c=t.Math.cos,h=t.Math.sin,f=t.Math.tan,d=t.Math.acos,p=t.Math.asin,m=t.Math.atan,g=t.Math.atan2,v=t.Math.ceil,x=t.Math.imul,y=t.Math.min,_=t.Math.clz32,b=e.b,w=e.c,M=e.d,S=e.e,E=e.f,T=e.g,C=e.h,q=e.i,P=24048;function D(t,e,n,r){var i,a;0|L(t|=0,e|=0,n|=0,r|=0,0)&&(qe(0|r,0,(a=1+(0|x(3*n|0,n+1|0))|0)<<3|0),(i=0|xe(a,4))&&(R(t,e,n,r,i,a,0),ve(i)))}function L(t,e,n,r,a){t|=0,e|=0,n|=0,a|=0;var o,s=0,A=0,l=0,u=0,c=0,h=0,f=0,d=0;if(o=P,P=P+16|0,d=o,i[(s=r|=0)>>2]=t,i[s+4>>2]=e,(s=0!=(0|a))&&(i[a>>2]=0),0|It(t,e))return P=o,0|(d=1);i[d>>2]=0;t:do{if((0|n)>=1)if(s)for(c=0,h=1,f=1,A=0,s=t;;){if(!(A|c)){if(0==(0|(s=0|I(s,e,4,d)))&0==(0|(e=0|w()))){s=2;break t}if(0|It(s,e)){s=1;break t}}if(0==(0|(s=0|I(s,e,0|i[16+(c<<2)>>2],d)))&0==(0|(e=0|w()))){s=2;break t}if(i[(t=r+(f<<3)|0)>>2]=s,i[t+4>>2]=e,i[a+(f<<2)>>2]=h,t=(0|(A=A+1|0))==(0|h),u=6==(0|(l=c+1|0)),0|It(s,e)){s=1;break t}if((0|(h=h+(u&t&1)|0))>(0|n)){s=0;break}c=t?u?0:l:c,f=f+1|0,A=t?0:A}else for(c=0,h=1,f=1,A=0,s=t;;){if(!(A|c)){if(0==(0|(s=0|I(s,e,4,d)))&0==(0|(e=0|w()))){s=2;break t}if(0|It(s,e)){s=1;break t}}if(0==(0|(s=0|I(s,e,0|i[16+(c<<2)>>2],d)))&0==(0|(e=0|w()))){s=2;break t}if(i[(t=r+(f<<3)|0)>>2]=s,i[t+4>>2]=e,t=(0|(A=A+1|0))==(0|h),u=6==(0|(l=c+1|0)),0|It(s,e)){s=1;break t}if((0|(h=h+(u&t&1)|0))>(0|n)){s=0;break}c=t?u?0:l:c,f=f+1|0,A=t?0:A}else s=0}while(0);return P=o,0|(d=s)}function R(t,e,n,r,a,o,s){n|=0,r|=0,a|=0,o|=0,s|=0;var A,l,u=0,c=0,h=0,f=0,d=0;if(l=P,P=P+16|0,A=l,0==(0|(t|=0))&0==(0|(e|=0)))P=l;else{if(u=0|we(0|t,0|e,0|o,((0|o)<0)<<31>>31|0),w(),!(0==(0|(d=0|i[(f=c=r+(u<<3)|0)>>2]))&0==(0|(f=0|i[f+4>>2]))|(h=(0|d)==(0|t)&(0|f)==(0|e))))do{h=(0|(f=0|i[(d=c=r+((u=(u+1|0)%(0|o)|0)<<3)|0)>>2]))==(0|t)&(0|(d=0|i[d+4>>2]))==(0|e)}while(!(0==(0|f)&0==(0|d)|h));u=a+(u<<2)|0,h&&(0|i[u>>2])<=(0|s)||(i[(d=c)>>2]=t,i[d+4>>2]=e,i[u>>2]=s,(0|s)>=(0|n)||(d=s+1|0,i[A>>2]=0,R(f=0|I(t,e,2,A),0|w(),n,r,a,o,d),i[A>>2]=0,R(f=0|I(t,e,3,A),0|w(),n,r,a,o,d),i[A>>2]=0,R(f=0|I(t,e,1,A),0|w(),n,r,a,o,d),i[A>>2]=0,R(f=0|I(t,e,5,A),0|w(),n,r,a,o,d),i[A>>2]=0,R(f=0|I(t,e,4,A),0|w(),n,r,a,o,d),i[A>>2]=0,R(f=0|I(t,e,6,A),0|w(),n,r,a,o,d))),P=l}}function I(t,e,n,r){t|=0,e|=0,n|=0;var a,o,s=0,A=0,l=0,u=0,c=0,h=0,f=0;if((0|i[(r|=0)>>2])>0){s=0;do{n=0|At(n),s=s+1|0}while((0|s)<(0|i[r>>2]))}a=0|Me(0|t,0|e,45),w(),o=127&a,A=0|Ot(t,e),s=0|Me(0|t,0|e,52),w(),s&=15;t:do{if(s)for(;;){if(h=0|Me(0|t,0|e,0|(c=3*(15-s|0)|0)),w(),h&=7,f=0==(0|Nt(s)),s=s+-1|0,u=0|Se(7,0,0|c),e&=~(0|w()),t=(c=0|Se(0|i[(f?464:48)+(28*h|0)+(n<<2)>>2],0,0|c))|t&~u,e|=0|w(),!(n=0|i[(f?672:256)+(28*h|0)+(n<<2)>>2])){n=0;break t}if(!s){l=6;break}}else l=6}while(0);6==(0|l)&&(t|=h=0|Se(0|(f=0|i[880+(28*o|0)+(n<<2)>>2]),0,45),e=0|w()|-1040385&e,n=0|i[4304+(28*o|0)+(n<<2)>>2],127==(127&f|0)&&(f=0|Se(0|i[880+(28*o|0)+20>>2],0,45),e=0|w()|-1040385&e,n=0|i[4304+(28*o|0)+20>>2],t=0|kt(f|t,e),e=0|w(),i[r>>2]=1+(0|i[r>>2]))),l=0|Me(0|t,0|e,45),w(),l&=127;t:do{if(0|B(l)){e:do{if(1==(0|Ot(t,e))){if((0|o)!=(0|l)){if(0|N(l,0|i[7728+(28*o|0)>>2])){t=0|zt(t,e),A=1,e=0|w();break}t=0|kt(t,e),A=1,e=0|w();break}switch(0|A){case 5:t=0|zt(t,e),e=0|w(),i[r>>2]=5+(0|i[r>>2]),A=0;break e;case 3:t=0|kt(t,e),e=0|w(),i[r>>2]=1+(0|i[r>>2]),A=0;break e;default:return f=0,b(0|(h=0)),0|f}}else A=0}while(0);if((0|n)>0){s=0;do{t=0|Bt(t,e),e=0|w(),s=s+1|0}while((0|s)!=(0|n))}if((0|o)!=(0|l)){if(!(0|k(l))){if(0!=(0|A)|5!=(0|Ot(t,e)))break;i[r>>2]=1+(0|i[r>>2]);break}switch(127&a){case 8:case 118:break t}3!=(0|Ot(t,e))&&(i[r>>2]=1+(0|i[r>>2]))}}else if((0|n)>0){s=0;do{t=0|kt(t,e),e=0|w(),s=s+1|0}while((0|s)!=(0|n))}}while(0);return i[r>>2]=((0|i[r>>2])+n|0)%6|0,f=t,b(0|(h=e)),0|f}function O(t,e,n,r,o,s){e|=0,n|=0,r|=0,o|=0,s|=0;var A,l,u,c,h,f,d,p,m,g=0,v=0,x=0,y=0,_=0,b=0,M=0,S=0,E=0,T=0,C=0,q=0,D=0,L=0;if(m=P,P=P+48|0,f=m+32|0,d=m+16|0,p=m,(0|(g=0|i[(t|=0)>>2]))<=0)return P=m,0|(q=0);A=t+4|0,l=f+8|0,u=d+8|0,c=p+8|0,h=((0|e)<0)<<31>>31,C=0;t:for(;;){E=(v=0|i[A>>2])+(C<<4)|0,i[f>>2]=i[E>>2],i[f+4>>2]=i[E+4>>2],i[f+8>>2]=i[E+8>>2],i[f+12>>2]=i[E+12>>2],(0|C)==(g+-1|0)?(i[d>>2]=i[v>>2],i[d+4>>2]=i[v+4>>2],i[d+8>>2]=i[v+8>>2],i[d+12>>2]=i[v+12>>2]):(E=v+(C+1<<4)|0,i[d>>2]=i[E>>2],i[d+4>>2]=i[E+4>>2],i[d+8>>2]=i[E+8>>2],i[d+12>>2]=i[E+12>>2]),E=0|W(f,d,n);e:do{if((0|E)>0){T=+(0|E),S=0;n:for(;;){L=+(E-S|0),D=+(0|S),a[p>>3]=+a[f>>3]*L/T+ +a[d>>3]*D/T,a[c>>3]=+a[l>>3]*L/T+ +a[u>>3]*D/T,v=0|we(0|(b=0|Ft(p,n)),0|(M=0|w()),0|e,0|h),w(),y=0|i[(x=g=s+(v<<3)|0)>>2],x=0|i[x+4>>2];r:do{if(0==(0|y)&0==(0|x))q=14;else for(_=0;;){if((0|_)>(0|e)){g=1;break r}if((0|y)==(0|b)&(0|x)==(0|M)){g=7;break r}if(0==(0|(y=0|i[(x=g=s+((v=(v+1|0)%(0|e)|0)<<3)|0)>>2]))&0==(0|(x=0|i[x+4>>2]))){q=14;break}_=_+1|0}}while(0);switch(14==(0|q)&&(q=0,0==(0|b)&0==(0|M)?g=7:(i[g>>2]=b,i[g+4>>2]=M,g=0|i[r>>2],i[(_=o+(g<<3)|0)>>2]=b,i[_+4>>2]=M,i[r>>2]=g+1,g=0)),7&g){case 7:case 0:break;default:break n}if((0|E)<=(0|(S=S+1|0))){q=8;break e}}if(0|g){g=-1,q=20;break t}}else q=8}while(0);if(8==(0|q)&&(q=0),(0|(C=C+1|0))>=(0|(g=0|i[t>>2]))){g=0,q=20;break}}return 20==(0|q)?(P=m,0|g):0}function B(t){return 0|i[7728+(28*(t|=0)|0)+16>>2]}function k(t){return 4==(0|(t|=0))|117==(0|t)|0}function U(t){return 0|i[11152+(216*(0|i[(t|=0)>>2])|0)+(72*(0|i[t+4>>2])|0)+(24*(0|i[t+8>>2])|0)+(i[t+12>>2]<<3)>>2]}function z(t){return 0|i[11152+(216*(0|i[(t|=0)>>2])|0)+(72*(0|i[t+4>>2])|0)+(24*(0|i[t+8>>2])|0)+(i[t+12>>2]<<3)+4>>2]}function N(t,e){return e|=0,(0|i[7728+(28*(t|=0)|0)+20>>2])==(0|e)?0|(e=1):0|(e=(0|i[7728+(28*t|0)+24>>2])==(0|e))}function F(t,e){return 0|i[880+(28*(t|=0)|0)+((e|=0)<<2)>>2]}function G(t,e){return e|=0,(0|i[880+(28*(t|=0)|0)>>2])==(0|e)?0|(e=0):(0|i[880+(28*t|0)+4>>2])==(0|e)?0|(e=1):(0|i[880+(28*t|0)+8>>2])==(0|e)?0|(e=2):(0|i[880+(28*t|0)+12>>2])==(0|e)?0|(e=3):(0|i[880+(28*t|0)+16>>2])==(0|e)?0|(e=4):(0|i[880+(28*t|0)+20>>2])==(0|e)?0|(e=5):0|((0|i[880+(28*t|0)+24>>2])==(0|e)?6:7)}function H(t){return+a[(t|=0)+16>>3]<+a[t+24>>3]|0}function j(t,e){t|=0;var n,r,i=0;return(i=+a[(e|=0)>>3])>=+a[t+8>>3]&&i<=+a[t>>3]?(n=+a[t+16>>3],i=+a[t+24>>3],e=(r=+a[e+8>>3])>=i,t=r<=n&1,n<i?e&&(t=1):e||(t=0),0|(e=0!=(0|t))):0|(e=0)}function V(t,e){t|=0,e|=0;var n,r,o,s,l,u,c=0,h=0;s=P,P=P+288|0,n=s+264|0,r=s+96|0,h=(c=o=s)+96|0;do{i[c>>2]=0,c=c+4|0}while((0|c)<(0|h));return Wt(e,o),jt(h=0|i[(c=o)>>2],c=0|i[c+4>>2],n),Vt(h,c,r),l=+Ct(n,r+8|0),a[n>>3]=+a[t>>3],a[(c=n+8|0)>>3]=+a[t+16>>3],a[r>>3]=+a[t+8>>3],a[(h=r+8|0)>>3]=+a[t+24>>3],u=+Ct(n,r),h=~~+v(+u*u/+Ee(+ +A(+(+a[c>>3]-+a[h>>3])/(+a[n>>3]-+a[r>>3])),3)/(l*(2.59807621135*l)*.8)),P=s,0|(0==(0|h)?1:h)}function W(t,e,n){t|=0,e|=0,n|=0;var r,a,o,s,A,l=0,u=0;s=P,P=P+288|0,r=s+264|0,a=s+96|0,u=(l=o=s)+96|0;do{i[l>>2]=0,l=l+4|0}while((0|l)<(0|u));return Wt(n,o),jt(l=0|i[(u=o)>>2],u=0|i[u+4>>2],r),Vt(l,u,a),A=+Ct(r,a+8|0),u=~~+v(+ +Ct(t,e)/(2*A)),P=s,0|(0==(0|u)?1:u)}function Q(t,e,n,r){e|=0,n|=0,r|=0,i[(t|=0)>>2]=e,i[t+4>>2]=n,i[t+8>>2]=r}function Y(t,e){t|=0;var n,r,o,s,l=0,u=0,c=0,h=0,f=0,d=0,p=0;i[(s=(e|=0)+8|0)>>2]=0,r=+a[t>>3],h=+A(+r),o=+a[t+8>>3],h+=.5*(f=+A(+o)/.8660254037844386),h-=+(0|(l=~~h)),f-=+(0|(t=~~f));do{if(h<.5){if(h<.3333333333333333){if(i[e>>2]=l,f<.5*(h+1)){i[e+4>>2]=t;break}t=t+1|0,i[e+4>>2]=t;break}if(t=(1&!(f<(p=1-h)))+t|0,i[e+4>>2]=t,p<=f&f<2*h){l=l+1|0,i[e>>2]=l;break}i[e>>2]=l;break}if(!(h<.6666666666666666)){if(l=l+1|0,i[e>>2]=l,f<.5*h){i[e+4>>2]=t;break}t=t+1|0,i[e+4>>2]=t;break}if(f<1-h){if(i[e+4>>2]=t,2*h-1<f){i[e>>2]=l;break}}else t=t+1|0,i[e+4>>2]=t;l=l+1|0,i[e>>2]=l}while(0);do{if(r<0){if(1&t){l=~~(+(0|l)-(2*(+((d=0|ye(0|l,((0|l)<0)<<31>>31|0,0|(d=(t+1|0)/2|0),((0|d)<0)<<31>>31|0))>>>0)+4294967296*+(0|w()))+1)),i[e>>2]=l;break}l=~~(+(0|l)-2*(+((d=0|ye(0|l,((0|l)<0)<<31>>31|0,0|(d=(0|t)/2|0),((0|d)<0)<<31>>31|0))>>>0)+4294967296*+(0|w()))),i[e>>2]=l;break}}while(0);d=e+4|0,o<0&&(l=l-((1|t<<1)/2|0)|0,i[e>>2]=l,t=0-t|0,i[d>>2]=t),u=t-l|0,(0|l)<0?(c=0-l|0,i[d>>2]=u,i[s>>2]=c,i[e>>2]=0,t=u,l=0):c=0,(0|t)<0&&(l=l-t|0,i[e>>2]=l,c=c-t|0,i[s>>2]=c,i[d>>2]=0,t=0),n=l-c|0,u=t-c|0,(0|c)<0&&(i[e>>2]=n,i[d>>2]=u,i[s>>2]=0,t=u,l=n,c=0),(0|(u=(0|c)<(0|(u=(0|t)<(0|l)?t:l))?c:u))<=0||(i[e>>2]=l-u,i[d>>2]=t-u,i[s>>2]=c-u)}function X(t){var e,n=0,r=0,a=0,o=0,s=0;n=0|i[(t|=0)>>2],r=0|i[(e=t+4|0)>>2],(0|n)<0&&(r=r-n|0,i[e>>2]=r,i[(s=t+8|0)>>2]=(0|i[s>>2])-n,i[t>>2]=0,n=0),(0|r)<0?(n=n-r|0,i[t>>2]=n,o=(0|i[(s=t+8|0)>>2])-r|0,i[s>>2]=o,i[e>>2]=0,r=0):(s=o=t+8|0,o=0|i[o>>2]),(0|o)<0&&(n=n-o|0,i[t>>2]=n,r=r-o|0,i[e>>2]=r,i[s>>2]=0,o=0),(0|(a=(0|o)<(0|(a=(0|r)<(0|n)?r:n))?o:a))<=0||(i[t>>2]=n-a,i[e>>2]=r-a,i[s>>2]=o-a)}function Z(t,e){e|=0;var n,r;r=0|i[(t|=0)+8>>2],n=+((0|i[t+4>>2])-r|0),a[e>>3]=+((0|i[t>>2])-r|0)-.5*n,a[e+8>>3]=.8660254037844386*n}function J(t,e,n){t|=0,e|=0,i[(n|=0)>>2]=(0|i[e>>2])+(0|i[t>>2]),i[n+4>>2]=(0|i[e+4>>2])+(0|i[t+4>>2]),i[n+8>>2]=(0|i[e+8>>2])+(0|i[t+8>>2])}function K(t,e,n){t|=0,e|=0,i[(n|=0)>>2]=(0|i[t>>2])-(0|i[e>>2]),i[n+4>>2]=(0|i[t+4>>2])-(0|i[e+4>>2]),i[n+8>>2]=(0|i[t+8>>2])-(0|i[e+8>>2])}function $(t,e){e|=0;var n,r=0;r=0|x(0|i[(t|=0)>>2],e),i[t>>2]=r,n=0|x(0|i[(r=t+4|0)>>2],e),i[r>>2]=n,e=0|x(0|i[(t=t+8|0)>>2],e),i[t>>2]=e}function tt(t){var e,n,r=0,a=0,o=0,s=0,A=0;A=(0|(n=0|i[(t|=0)>>2]))<0,t=(t=(a=(0|(s=((e=(0|(o=(0|i[t+4>>2])-(A?n:0)|0))<0)?0-o|0:0)+((0|i[t+8>>2])-(A?n:0))|0))<0)?0:s)-((o=(0|(a=(0|t)<(0|(a=(0|(r=(e?0:o)-(a?s:0)|0))<(0|(s=(A?0:n)-(e?o:0)-(a?s:0)|0))?r:s))?t:a))>0)?a:0)|0,r=r-(o?a:0)|0;t:do{switch(s-(o?a:0)|0){case 0:switch(0|r){case 0:return 0|(A=0==(0|t)?0:1==(0|t)?1:7);case 1:return 0|(A=0==(0|t)?2:1==(0|t)?3:7);default:break t}case 1:switch(0|r){case 0:return 0|(A=0==(0|t)?4:1==(0|t)?5:7);case 1:if(t)break t;return 0|(t=6);default:break t}}}while(0);return 0|(A=7)}function et(t){var e,n,r=0,a=0,o=0,s=0,A=0;a=0|i[(e=(t|=0)+8|0)>>2],o=0|me(+((3*(r=(0|i[t>>2])-a|0)|0)-(a=(0|i[(n=t+4|0)>>2])-a|0)|0)/7),i[t>>2]=o,r=0|me(+((a<<1)+r|0)/7),i[n>>2]=r,i[e>>2]=0,a=r-o|0,(0|o)<0?(A=0-o|0,i[n>>2]=a,i[e>>2]=A,i[t>>2]=0,r=a,o=0,a=A):a=0,(0|r)<0&&(o=o-r|0,i[t>>2]=o,a=a-r|0,i[e>>2]=a,i[n>>2]=0,r=0),A=o-a|0,s=r-a|0,(0|a)<0?(i[t>>2]=A,i[n>>2]=s,i[e>>2]=0,r=s,s=A,a=0):s=o,(0|(o=(0|a)<(0|(o=(0|r)<(0|s)?r:s))?a:o))<=0||(i[t>>2]=s-o,i[n>>2]=r-o,i[e>>2]=a-o)}function nt(t){var e,n,r=0,a=0,o=0,s=0,A=0;a=0|i[(e=(t|=0)+8|0)>>2],o=0|me(+(((r=(0|i[t>>2])-a|0)<<1)+(a=(0|i[(n=t+4|0)>>2])-a|0)|0)/7),i[t>>2]=o,r=0|me(+((3*a|0)-r|0)/7),i[n>>2]=r,i[e>>2]=0,a=r-o|0,(0|o)<0?(A=0-o|0,i[n>>2]=a,i[e>>2]=A,i[t>>2]=0,r=a,o=0,a=A):a=0,(0|r)<0&&(o=o-r|0,i[t>>2]=o,a=a-r|0,i[e>>2]=a,i[n>>2]=0,r=0),A=o-a|0,s=r-a|0,(0|a)<0?(i[t>>2]=A,i[n>>2]=s,i[e>>2]=0,r=s,s=A,a=0):s=o,(0|(o=(0|a)<(0|(o=(0|r)<(0|s)?r:s))?a:o))<=0||(i[t>>2]=s-o,i[n>>2]=r-o,i[e>>2]=a-o)}function rt(t){var e,n,r,a=0,o=0,s=0,A=0;a=0|i[(t|=0)>>2],o=0|i[(n=t+4|0)>>2],s=0|i[(r=t+8|0)>>2],A=o+(3*a|0)|0,i[t>>2]=A,o=s+(3*o|0)|0,i[n>>2]=o,a=(3*s|0)+a|0,i[r>>2]=a,s=o-A|0,(0|A)<0?(a=a-A|0,i[n>>2]=s,i[r>>2]=a,i[t>>2]=0,o=s,s=0):s=A,(0|o)<0&&(s=s-o|0,i[t>>2]=s,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),e=s-a|0,A=o-a|0,(0|a)<0?(i[t>>2]=e,i[n>>2]=A,i[r>>2]=0,s=e,a=0):A=o,(0|(o=(0|a)<(0|(o=(0|A)<(0|s)?A:s))?a:o))<=0||(i[t>>2]=s-o,i[n>>2]=A-o,i[r>>2]=a-o)}function it(t){var e,n,r,a=0,o=0,s=0,A=0;A=0|i[(t|=0)>>2],s=(3*(a=0|i[(n=t+4|0)>>2])|0)+A|0,A=(o=0|i[(r=t+8|0)>>2])+(3*A|0)|0,i[t>>2]=A,i[n>>2]=s,a=(3*o|0)+a|0,i[r>>2]=a,o=s-A|0,(0|A)<0?(a=a-A|0,i[n>>2]=o,i[r>>2]=a,i[t>>2]=0,A=0):o=s,(0|o)<0&&(A=A-o|0,i[t>>2]=A,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),e=A-a|0,s=o-a|0,(0|a)<0?(i[t>>2]=e,i[n>>2]=s,i[r>>2]=0,A=e,a=0):s=o,(0|(o=(0|a)<(0|(o=(0|s)<(0|A)?s:A))?a:o))<=0||(i[t>>2]=A-o,i[n>>2]=s-o,i[r>>2]=a-o)}function at(t,e){t|=0;var n,r,a,o=0,s=0,A=0;((e|=0)+-1|0)>>>0>=6||(A=(0|i[15472+(12*e|0)>>2])+(0|i[t>>2])|0,i[t>>2]=A,a=t+4|0,s=(0|i[15472+(12*e|0)+4>>2])+(0|i[a>>2])|0,i[a>>2]=s,r=t+8|0,e=(0|i[15472+(12*e|0)+8>>2])+(0|i[r>>2])|0,i[r>>2]=e,o=s-A|0,(0|A)<0?(e=e-A|0,i[a>>2]=o,i[r>>2]=e,i[t>>2]=0,s=0):(o=s,s=A),(0|o)<0&&(s=s-o|0,i[t>>2]=s,e=e-o|0,i[r>>2]=e,i[a>>2]=0,o=0),n=s-e|0,A=o-e|0,(0|e)<0?(i[t>>2]=n,i[a>>2]=A,i[r>>2]=0,s=n,e=0):A=o,(0|(o=(0|e)<(0|(o=(0|A)<(0|s)?A:s))?e:o))<=0||(i[t>>2]=s-o,i[a>>2]=A-o,i[r>>2]=e-o))}function ot(t){var e,n,r,a=0,o=0,s=0,A=0;A=0|i[(t|=0)>>2],s=(a=0|i[(n=t+4|0)>>2])+A|0,A=(o=0|i[(r=t+8|0)>>2])+A|0,i[t>>2]=A,i[n>>2]=s,a=o+a|0,i[r>>2]=a,o=s-A|0,(0|A)<0?(a=a-A|0,i[n>>2]=o,i[r>>2]=a,i[t>>2]=0,s=0):(o=s,s=A),(0|o)<0&&(s=s-o|0,i[t>>2]=s,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),e=s-a|0,A=o-a|0,(0|a)<0?(i[t>>2]=e,i[n>>2]=A,i[r>>2]=0,s=e,a=0):A=o,(0|(o=(0|a)<(0|(o=(0|A)<(0|s)?A:s))?a:o))<=0||(i[t>>2]=s-o,i[n>>2]=A-o,i[r>>2]=a-o)}function st(t){var e,n,r,a=0,o=0,s=0,A=0;a=0|i[(t|=0)>>2],s=0|i[(n=t+4|0)>>2],o=0|i[(r=t+8|0)>>2],A=s+a|0,i[t>>2]=A,s=o+s|0,i[n>>2]=s,a=o+a|0,i[r>>2]=a,o=s-A|0,(0|A)<0?(a=a-A|0,i[n>>2]=o,i[r>>2]=a,i[t>>2]=0,s=0):(o=s,s=A),(0|o)<0&&(s=s-o|0,i[t>>2]=s,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),e=s-a|0,A=o-a|0,(0|a)<0?(i[t>>2]=e,i[n>>2]=A,i[r>>2]=0,s=e,a=0):A=o,(0|(o=(0|a)<(0|(o=(0|A)<(0|s)?A:s))?a:o))<=0||(i[t>>2]=s-o,i[n>>2]=A-o,i[r>>2]=a-o)}function At(t){switch(0|(t|=0)){case 1:t=5;break;case 5:t=4;break;case 4:t=6;break;case 6:t=2;break;case 2:t=3;break;case 3:t=1}return 0|t}function lt(t){switch(0|(t|=0)){case 1:t=3;break;case 3:t=2;break;case 2:t=6;break;case 6:t=4;break;case 4:t=5;break;case 5:t=1}return 0|t}function ut(t){var e,n,r,a=0,o=0,s=0,A=0;a=0|i[(t|=0)>>2],o=0|i[(n=t+4|0)>>2],s=0|i[(r=t+8|0)>>2],A=o+(a<<1)|0,i[t>>2]=A,o=s+(o<<1)|0,i[n>>2]=o,a=(s<<1)+a|0,i[r>>2]=a,s=o-A|0,(0|A)<0?(a=a-A|0,i[n>>2]=s,i[r>>2]=a,i[t>>2]=0,o=s,s=0):s=A,(0|o)<0&&(s=s-o|0,i[t>>2]=s,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),e=s-a|0,A=o-a|0,(0|a)<0?(i[t>>2]=e,i[n>>2]=A,i[r>>2]=0,s=e,a=0):A=o,(0|(o=(0|a)<(0|(o=(0|A)<(0|s)?A:s))?a:o))<=0||(i[t>>2]=s-o,i[n>>2]=A-o,i[r>>2]=a-o)}function ct(t){var e,n,r,a=0,o=0,s=0,A=0;A=0|i[(t|=0)>>2],s=((a=0|i[(n=t+4|0)>>2])<<1)+A|0,A=(o=0|i[(r=t+8|0)>>2])+(A<<1)|0,i[t>>2]=A,i[n>>2]=s,a=(o<<1)+a|0,i[r>>2]=a,o=s-A|0,(0|A)<0?(a=a-A|0,i[n>>2]=o,i[r>>2]=a,i[t>>2]=0,A=0):o=s,(0|o)<0&&(A=A-o|0,i[t>>2]=A,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),e=A-a|0,s=o-a|0,(0|a)<0?(i[t>>2]=e,i[n>>2]=s,i[r>>2]=0,A=e,a=0):s=o,(0|(o=(0|a)<(0|(o=(0|s)<(0|A)?s:A))?a:o))<=0||(i[t>>2]=A-o,i[n>>2]=s-o,i[r>>2]=a-o)}function ht(t,e){e|=0;var n,r,a,o=0,s=0,A=0;return a=(0|(r=(0|i[(t|=0)>>2])-(0|i[e>>2])|0))<0,n=(0|(s=(0|i[t+4>>2])-(0|i[e+4>>2])-(a?r:0)|0))<0,e=(e=(t=(0|(A=(a?0-r|0:0)+(0|i[t+8>>2])-(0|i[e+8>>2])+(n?0-s|0:0)|0))<0)?0:A)-((s=(0|(t=(0|e)<(0|(t=(0|(o=(n?0:s)-(t?A:0)|0))<(0|(A=(a?0:r)-(n?s:0)-(t?A:0)|0))?o:A))?e:t))>0)?t:0)|0,o=o-(s?t:0)|0,0|((0|(t=(0|(t=A-(s?t:0)|0))>-1?t:0-t|0))>(0|(e=(0|(o=(0|o)>-1?o:0-o|0))>(0|(e=(0|e)>-1?e:0-e|0))?o:e))?t:e)}function ft(t,e){e|=0;var n;n=0|i[(t|=0)+8>>2],i[e>>2]=(0|i[t>>2])-n,i[e+4>>2]=(0|i[t+4>>2])-n}function dt(t,e){e|=0;var n,r,a,o=0,s=0,A=0;s=0|i[(t|=0)>>2],i[e>>2]=s,t=0|i[t+4>>2],i[(r=e+4|0)>>2]=t,i[(a=e+8|0)>>2]=0,o=t-s|0,(0|s)<0?(t=0-s|0,i[r>>2]=o,i[a>>2]=t,i[e>>2]=0,s=0):(o=t,t=0),(0|o)<0&&(s=s-o|0,i[e>>2]=s,t=t-o|0,i[a>>2]=t,i[r>>2]=0,o=0),n=s-t|0,A=o-t|0,(0|t)<0?(i[e>>2]=n,i[r>>2]=A,i[a>>2]=0,o=A,A=n,t=0):A=s,(0|(s=(0|t)<(0|(s=(0|o)<(0|A)?o:A))?t:s))<=0||(i[e>>2]=A-s,i[r>>2]=o-s,i[a>>2]=t-s)}function pt(t){var e,n,r,a;n=(a=0|i[(e=(t|=0)+8|0)>>2])-(0|i[t>>2])|0,i[t>>2]=n,t=(0|i[(r=t+4|0)>>2])-a|0,i[r>>2]=t,i[e>>2]=0-(t+n)}function mt(t){var e,n,r=0,a=0,o=0,s=0,A=0;r=0-(a=0|i[(t|=0)>>2])|0,i[t>>2]=r,i[(e=t+8|0)>>2]=0,s=(o=0|i[(n=t+4|0)>>2])+a|0,(0|a)>0?(i[n>>2]=s,i[e>>2]=a,i[t>>2]=0,r=0,o=s):a=0,(0|o)<0?(A=r-o|0,i[t>>2]=A,a=a-o|0,i[e>>2]=a,i[n>>2]=0,s=A-a|0,r=0-a|0,(0|a)<0?(i[t>>2]=s,i[n>>2]=r,i[e>>2]=0,o=r,a=0):(o=0,s=A)):s=r,(0|(r=(0|a)<(0|(r=(0|o)<(0|s)?o:s))?a:r))<=0||(i[t>>2]=s-r,i[n>>2]=o-r,i[e>>2]=a-r)}function gt(t,e,n,r){e|=0,n|=0,r|=0;var o,s=0,A=0,l=0,u=0;if(o=P,P=P+32|0,function(t,e){e|=0;var n=0,r=0,i=0;n=+a[(t=t|0)>>3],r=+c(+n),n=+h(+n),a[e+16>>3]=n,n=+a[t+8>>3],i=r*+c(+n),a[e>>3]=i,n=r*+h(+n),a[e+8>>3]=n}(t|=0,A=o),i[n>>2]=0,s=+Ae(15888,A),(l=+Ae(15912,A))<s&&(i[n>>2]=1,s=l),(l=+Ae(15936,A))<s&&(i[n>>2]=2,s=l),(l=+Ae(15960,A))<s&&(i[n>>2]=3,s=l),(l=+Ae(15984,A))<s&&(i[n>>2]=4,s=l),(l=+Ae(16008,A))<s&&(i[n>>2]=5,s=l),(l=+Ae(16032,A))<s&&(i[n>>2]=6,s=l),(l=+Ae(16056,A))<s&&(i[n>>2]=7,s=l),(l=+Ae(16080,A))<s&&(i[n>>2]=8,s=l),(l=+Ae(16104,A))<s&&(i[n>>2]=9,s=l),(l=+Ae(16128,A))<s&&(i[n>>2]=10,s=l),(l=+Ae(16152,A))<s&&(i[n>>2]=11,s=l),(l=+Ae(16176,A))<s&&(i[n>>2]=12,s=l),(l=+Ae(16200,A))<s&&(i[n>>2]=13,s=l),(l=+Ae(16224,A))<s&&(i[n>>2]=14,s=l),(l=+Ae(16248,A))<s&&(i[n>>2]=15,s=l),(l=+Ae(16272,A))<s&&(i[n>>2]=16,s=l),(l=+Ae(16296,A))<s&&(i[n>>2]=17,s=l),(l=+Ae(16320,A))<s&&(i[n>>2]=18,s=l),(l=+Ae(16344,A))<s&&(i[n>>2]=19,s=l),(l=+d(+(1-.5*s)))<1e-16)return i[r>>2]=0,i[r+4>>2]=0,i[r+8>>2]=0,i[r+12>>2]=0,void(P=o);if(n=0|i[n>>2],s=+Et((s=+a[16368+(24*n|0)>>3])-+Et(+function(t,e){t|=0;var n=0,r=0,i=0,o=0,s=0;return o=+a[(e=e|0)>>3],r=+c(+o),i=+a[e+8>>3]-+a[t+8>>3],s=r*+h(+i),n=+a[t>>3],+ +g(+s,+(+h(+o)*+c(+n)-+c(+i)*(r*+h(+n))))}(15568+(n<<4)|0,t))),u=0|Nt(e)?+Et(s+-.3334731722518321):s,s=+f(+l)/.381966011250105,(0|e)>0){A=0;do{s*=2.6457513110645907,A=A+1|0}while((0|A)!=(0|e))}l=+c(+u)*s,a[r>>3]=l,u=+h(+u)*s,a[r+8>>3]=u,P=o}function vt(t,e,n,r,o){e|=0,n|=0,r|=0,o|=0;var s=0,u=0;if(s=+function(t){var e=0,n=0;return n=+a[(t=t|0)>>3],e=+a[t+8>>3],+ +l(+(n*n+e*e))}(t|=0),s<1e-16)return e=15568+(e<<4)|0,i[o>>2]=i[e>>2],i[o+4>>2]=i[e+4>>2],i[o+8>>2]=i[e+8>>2],void(i[o+12>>2]=i[e+12>>2]);if(u=+g(+ +a[t+8>>3],+ +a[t>>3]),(0|n)>0){t=0;do{s/=2.6457513110645907,t=t+1|0}while((0|t)!=(0|n))}r?(s/=3,n=0==(0|Nt(n)),s=+m(.381966011250105*(n?s:s/2.6457513110645907))):(s=+m(.381966011250105*s),0|Nt(n)&&(u=+Et(u+.3334731722518321))),function(t,e,n,r){t|=0,e=+e,r|=0;var o=0,s=0,l=0,u=0;if((n=+n)<1e-16)return i[r>>2]=i[t>>2],i[r+4>>2]=i[t+4>>2],i[r+8>>2]=i[t+8>>2],void(i[r+12>>2]=i[t+12>>2]);s=e<0?e+6.283185307179586:e,s=e>=6.283185307179586?s+-6.283185307179586:s;do{if(!(s<1e-16)){if(o=+A(+(s+-3.141592653589793))<1e-16,e=+a[t>>3],o){e-=n,a[r>>3]=e,o=r;break}if(l=+c(+n),n=+h(+n),e=l*+h(+e)+ +c(+s)*(n*+c(+e)),e=+p(+((e=e>1?1:e)<-1?-1:e)),a[r>>3]=e,+A(+(e+-1.5707963267948966))<1e-16)return a[r>>3]=1.5707963267948966,void(a[r+8>>3]=0);if(+A(+(e+1.5707963267948966))<1e-16)return a[r>>3]=-1.5707963267948966,void(a[r+8>>3]=0);if(u=+c(+e),s=n*+h(+s)/u,n=+a[t>>3],e=(l-+h(+e)*+h(+n))/+c(+n)/u,l=s>1?1:s,e=e>1?1:e,(e=+a[t+8>>3]+ +g(+(l<-1?-1:l),+(e<-1?-1:e)))>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);return void(a[r+8>>3]=e)}e=+a[t>>3]+n,a[r>>3]=e,o=r}while(0);if(+A(+(e+-1.5707963267948966))<1e-16)return a[o>>3]=1.5707963267948966,void(a[r+8>>3]=0);if(+A(+(e+1.5707963267948966))<1e-16)return a[o>>3]=-1.5707963267948966,void(a[r+8>>3]=0);if((e=+a[t+8>>3])>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);a[r+8>>3]=e}(15568+(e<<4)|0,+Et(+a[16368+(24*e|0)>>3]-u),s,o)}function xt(t,e,n){e|=0,n|=0;var r,a;r=P,P=P+16|0,Z((t|=0)+4|0,a=r),vt(a,0|i[t>>2],e,0,n),P=r}function yt(t,e,n,r,o){t|=0,e|=0,n|=0,r|=0,o|=0;var s,A,l,u,c,h,f,d,p,m,g,v,x,y,_,b,w,S,E,T,C,q,D=0,L=0,R=0,I=0,O=0,B=0;if(q=P,P=P+272|0,I=q+240|0,E=q,T=q+224|0,C=q+208|0,g=q+176|0,v=q+160|0,x=q+192|0,y=q+144|0,_=q+128|0,b=q+112|0,w=q+96|0,S=q+80|0,i[(D=q+256|0)>>2]=e,i[I>>2]=i[t>>2],i[I+4>>2]=i[t+4>>2],i[I+8>>2]=i[t+8>>2],i[I+12>>2]=i[t+12>>2],_t(I,D,E),i[o>>2]=0,(0|(I=r+n+(5==(0|r)&1)|0))<=(0|n))P=q;else{A=T+4|0,l=g+4|0,u=n+5|0,c=16848+((s=0|i[D>>2])<<2)|0,h=16928+(s<<2)|0,f=_+8|0,d=b+8|0,p=w+8|0,m=C+4|0,R=n;t:for(;;){L=E+(((0|R)%5|0)<<4)|0,i[C>>2]=i[L>>2],i[C+4>>2]=i[L+4>>2],i[C+8>>2]=i[L+8>>2],i[C+12>>2]=i[L+12>>2];do{}while(2==(0|bt(C,s,0,1)));if((0|R)>(0|n)&0!=(0|Nt(e))){if(i[g>>2]=i[C>>2],i[g+4>>2]=i[C+4>>2],i[g+8>>2]=i[C+8>>2],i[g+12>>2]=i[C+12>>2],Z(A,v),r=0|i[g>>2],D=0|i[17008+(80*r|0)+(i[T>>2]<<2)>>2],i[g>>2]=i[18608+(80*r|0)+(20*D|0)>>2],(0|(L=0|i[18608+(80*r|0)+(20*D|0)+16>>2]))>0){t=0;do{ot(l),t=t+1|0}while((0|t)<(0|L))}switch(L=18608+(80*r|0)+(20*D|0)+4|0,i[x>>2]=i[L>>2],i[x+4>>2]=i[L+4>>2],i[x+8>>2]=i[L+8>>2],$(x,3*(0|i[c>>2])|0),J(l,x,l),X(l),Z(l,y),O=+(0|i[h>>2]),a[_>>3]=3*O,a[f>>3]=0,B=-1.5*O,a[b>>3]=B,a[d>>3]=2.598076211353316*O,a[w>>3]=B,a[p>>3]=-2.598076211353316*O,0|i[17008+(80*(0|i[g>>2])|0)+(i[C>>2]<<2)>>2]){case 1:t=b,r=_;break;case 3:t=w,r=b;break;case 2:t=_,r=w;break;default:t=12;break t}oe(v,y,r,t,S),vt(S,0|i[g>>2],s,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2])}if((0|R)<(0|u)&&(Z(m,g),vt(g,0|i[C>>2],s,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2])),i[T>>2]=i[C>>2],i[T+4>>2]=i[C+4>>2],i[T+8>>2]=i[C+8>>2],i[T+12>>2]=i[C+12>>2],(0|(R=R+1|0))>=(0|I)){t=3;break}}3!=(0|t)?12==(0|t)&&M(22474,22521,581,22531):P=q}}function _t(t,e,n){t|=0,e|=0,n|=0;var r,a=0,o=0,s=0,A=0,l=0;r=P,P=P+128|0,o=r,A=20208,l=(s=a=r+64|0)+60|0;do{i[s>>2]=i[A>>2],s=s+4|0,A=A+4|0}while((0|s)<(0|l));A=20272,l=(s=o)+60|0;do{i[s>>2]=i[A>>2],s=s+4|0,A=A+4|0}while((0|s)<(0|l));a=(l=0==(0|Nt(0|i[e>>2])))?a:o,ut(o=t+4|0),ct(o),0|Nt(0|i[e>>2])&&(it(o),i[e>>2]=1+(0|i[e>>2])),i[n>>2]=i[t>>2],J(o,a,e=n+4|0),X(e),i[n+16>>2]=i[t>>2],J(o,a+12|0,e=n+20|0),X(e),i[n+32>>2]=i[t>>2],J(o,a+24|0,e=n+36|0),X(e),i[n+48>>2]=i[t>>2],J(o,a+36|0,e=n+52|0),X(e),i[n+64>>2]=i[t>>2],J(o,a+48|0,n=n+68|0),X(n),P=r}function bt(t,e,n,r){n|=0,r|=0;var a,o,s,A,l,u,c=0,h=0,f=0,d=0,p=0;if(u=P,P=P+32|0,l=u+12|0,o=u,p=(t|=0)+4|0,d=0|i[16928+((e|=0)<<2)>>2],d=(A=0!=(0|r))?3*d|0:d,c=0|i[p>>2],a=0|i[(s=t+8|0)>>2],A){if((0|(c=a+c+(r=0|i[(h=t+12|0)>>2])|0))==(0|d))return P=u,0|(p=1);f=h}else c=a+c+(r=0|i[(f=t+12|0)>>2])|0;if((0|c)<=(0|d))return P=u,0|(p=0);do{if((0|r)>0){if(r=0|i[t>>2],(0|a)>0){h=18608+(80*r|0)+60|0,r=t;break}r=18608+(80*r|0)+40|0,n?(Q(l,d,0,0),K(p,l,o),st(o),J(o,l,p),h=r,r=t):(h=r,r=t)}else h=18608+(80*(0|i[t>>2])|0)+20|0,r=t}while(0);if(i[r>>2]=i[h>>2],(0|i[(c=h+16|0)>>2])>0){r=0;do{ot(p),r=r+1|0}while((0|r)<(0|i[c>>2]))}return t=h+4|0,i[l>>2]=i[t>>2],i[l+4>>2]=i[t+4>>2],i[l+8>>2]=i[t+8>>2],e=0|i[16848+(e<<2)>>2],$(l,A?3*e|0:e),J(p,l,p),X(p),r=A&&((0|i[s>>2])+(0|i[p>>2])+(0|i[f>>2])|0)==(0|d)?1:2,P=u,0|(p=r)}function wt(t,e){t|=0,e|=0;var n=0;do{n=0|bt(t,e,0,1)}while(2==(0|n));return 0|n}function Mt(t,e,n,r,o){t|=0,e|=0,n|=0,r|=0,o|=0;var s,A,l,u,c,h,f,d,p,m,g,v,x,y,_,b,w,S,E=0,T=0,C=0,q=0,D=0;if(S=P,P=P+240|0,y=S+208|0,_=S,b=S+192|0,w=S+176|0,p=S+160|0,m=S+144|0,g=S+128|0,v=S+112|0,x=S+96|0,i[(E=S+224|0)>>2]=e,i[y>>2]=i[t>>2],i[y+4>>2]=i[t+4>>2],i[y+8>>2]=i[t+8>>2],i[y+12>>2]=i[t+12>>2],St(y,E,_),i[o>>2]=0,(0|(d=r+n+(6==(0|r)&1)|0))<=(0|n))P=S;else{A=n+6|0,l=16928+((s=0|i[E>>2])<<2)|0,u=m+8|0,c=g+8|0,h=v+8|0,f=b+4|0,T=0,C=n,r=-1;t:for(;;){if(t=_+((E=(0|C)%6|0)<<4)|0,i[b>>2]=i[t>>2],i[b+4>>2]=i[t+4>>2],i[b+8>>2]=i[t+8>>2],i[b+12>>2]=i[t+12>>2],t=T,T=0|bt(b,s,0,1),(0|C)>(0|n)&0!=(0|Nt(e))&&(1!=(0|t)&&(0|i[b>>2])!=(0|r))){switch(Z(_+(((E+5|0)%6|0)<<4)+4|0,w),Z(_+(E<<4)+4|0,p),q=+(0|i[l>>2]),a[m>>3]=3*q,a[u>>3]=0,D=-1.5*q,a[g>>3]=D,a[c>>3]=2.598076211353316*q,a[v>>3]=D,a[h>>3]=-2.598076211353316*q,E=0|i[y>>2],0|i[17008+(80*E|0)+(((0|r)==(0|E)?0|i[b>>2]:r)<<2)>>2]){case 1:t=g,r=m;break;case 3:t=v,r=g;break;case 2:t=m,r=v;break;default:t=8;break t}oe(w,p,r,t,x),0|se(w,x)||0|se(p,x)||(vt(x,0|i[y>>2],s,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2]))}if((0|C)<(0|A)&&(Z(f,w),vt(w,0|i[b>>2],s,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2])),(0|(C=C+1|0))>=(0|d)){t=3;break}r=0|i[b>>2]}3!=(0|t)?8==(0|t)&&M(22557,22521,746,22602):P=S}}function St(t,e,n){t|=0,e|=0,n|=0;var r,a=0,o=0,s=0,A=0,l=0;r=P,P=P+160|0,o=r,A=20336,l=(s=a=r+80|0)+72|0;do{i[s>>2]=i[A>>2],s=s+4|0,A=A+4|0}while((0|s)<(0|l));A=20416,l=(s=o)+72|0;do{i[s>>2]=i[A>>2],s=s+4|0,A=A+4|0}while((0|s)<(0|l));a=(l=0==(0|Nt(0|i[e>>2])))?a:o,ut(o=t+4|0),ct(o),0|Nt(0|i[e>>2])&&(it(o),i[e>>2]=1+(0|i[e>>2])),i[n>>2]=i[t>>2],J(o,a,e=n+4|0),X(e),i[n+16>>2]=i[t>>2],J(o,a+12|0,e=n+20|0),X(e),i[n+32>>2]=i[t>>2],J(o,a+24|0,e=n+36|0),X(e),i[n+48>>2]=i[t>>2],J(o,a+36|0,e=n+52|0),X(e),i[n+64>>2]=i[t>>2],J(o,a+48|0,e=n+68|0),X(e),i[n+80>>2]=i[t>>2],J(o,a+60|0,n=n+84|0),X(n),P=r}function Et(t){var e;return e=(t=+t)<0?t+6.283185307179586:t,+(t>=6.283185307179586?e+-6.283185307179586:e)}function Tt(t,e){return e|=0,+A(+(+a[(t|=0)>>3]-+a[e>>3]))<17453292519943298e-27?0|(e=+A(+(+a[t+8>>3]-+a[e+8>>3]))<17453292519943298e-27):0|(e=0)}function Ct(t,e){t|=0;var n,r,i,o=0;return r=+a[(e|=0)>>3],n=+a[t>>3],o=(i=+h(.5*(r-n)))*i+(o=+h(.5*(+a[e+8>>3]-+a[t+8>>3])))*(+c(+r)*+c(+n)*o),2*+g(+ +l(+o),+ +l(+(1-o)))*6371.007180918475}function qt(t,e,n){t|=0,n|=0;var r,i,o,s,A=0,u=0,d=0,p=0,v=0,x=0;return x=+a[(e|=0)>>3],o=+a[t>>3],v=+h(.5*(x-o)),d=+a[e+8>>3],i=+a[t+8>>3],p=+h(.5*(d-i)),r=+c(+o),s=+c(+x),p=2*+g(+ +l(+(p=v*v+p*(s*r*p))),+ +l(+(1-p))),v=+a[n>>3],x=+h(.5*(v-x)),A=+a[n+8>>3],d=+h(.5*(A-d)),u=+c(+v),d=2*+g(+ +l(+(d=x*x+d*(s*u*d))),+ +l(+(1-d))),v=+h(.5*(o-v)),A=+h(.5*(i-A)),A=2*+g(+ +l(+(A=v*v+A*(r*u*A))),+ +l(+(1-A))),4*+m(+ +l(+ +f(.5*(u=.5*(p+d+A)))*+f(.5*(u-p))*+f(.5*(u-d))*+f(.5*(u-A))))}function Pt(t,e){return e=0|Me(0|(t|=0),0|(e|=0),45),w(),127&e|0}function Dt(t,e){var n=0,r=0,i=0,a=0,o=0,s=0;if(!(!0&134217728==(-16777216&(e|=0)|0)))return 0|(e=0);if(o=0|Me(0|(t|=0),0|e,45),w(),(o&=127)>>>0>121)return 0|(e=0);n=0|Me(0|t,0|e,52),w(),n&=15;do{if(0|n){for(i=1,r=0;;){if(a=0|Me(0|t,0|e,3*(15-i|0)|0),w(),0!=(0|(a&=7))&(1^r)){if(1==(0|a)&0!=(0|B(o))){s=0,r=13;break}r=1}if(7==(0|a)){s=0,r=13;break}if(!(i>>>0<n>>>0)){r=9;break}i=i+1|0}if(9==(0|r)){if(15!=(0|n))break;return 0|(s=1)}if(13==(0|r))return 0|s}}while(0);for(;;){if(s=0|Me(0|t,0|e,3*(14-n|0)|0),w(),!(7==(7&s|0)&!0)){s=0,r=13;break}if(!(n>>>0<14)){s=1,r=13;break}n=n+1|0}return 13==(0|r)?0|s:0}function Lt(t,e,n){n|=0;var r=0,i=0;if(r=0|Me(0|(t|=0),0|(e|=0),52),w(),(0|(r&=15))>=(0|n)){if((0|r)!=(0|n))if(n>>>0<=15){if(t|=i=0|Se(0|n,0,52),e=0|w()|-15728641&e,(0|r)>(0|n))do{i=0|Se(7,0,3*(14-n|0)|0),n=n+1|0,t|=i,e=0|w()|e}while((0|n)<(0|r))}else e=0,t=0}else e=0,t=0;return b(0|e),0|t}function Rt(t,e,n,r){n|=0,r|=0;var a,o=0,s=0,A=0,l=0,u=0,c=0;if(A=0|Me(0|(t|=0),0|(e|=0),52),w(),(0|n)<16&(0|(A&=15))<=(0|n)){if((0|A)==(0|n))return i[(n=r)>>2]=t,void(i[n+4>>2]=e);if(a=(0|(u=0|ee(7,n-A|0)))/7|0,l=0|Me(0|t,0|e,45),w(),0|B(127&l)){t:do{if(A)for(s=1;;){if(o=0|Me(0|t,0|e,3*(15-s|0)|0),w(),0|(o&=7))break t;if(!(s>>>0<A>>>0)){o=0;break}s=s+1|0}else o=0}while(0);s=0==(0|o)}else s=0;if(c=0|Se(A+1|0,0,52),o=0|w()|-15728641&e,Rt(e=(c|t)&~(e=0|Se(7,0,0|(l=3*(14-A|0)|0))),A=o&~(0|w()),n,r),o=r+(a<<3)|0,!s)return Rt((c=0|Se(1,0,0|l))|e,0|w()|A,n,o),c=o+(a<<3)|0,Rt((u=0|Se(2,0,0|l))|e,0|w()|A,n,c),c=c+(a<<3)|0,Rt((u=0|Se(3,0,0|l))|e,0|w()|A,n,c),c=c+(a<<3)|0,Rt((u=0|Se(4,0,0|l))|e,0|w()|A,n,c),c=c+(a<<3)|0,Rt((u=0|Se(5,0,0|l))|e,0|w()|A,n,c),void Rt((u=0|Se(6,0,0|l))|e,0|w()|A,n,c+(a<<3)|0);s=o+(a<<3)|0,(0|u)>6&&(qe(0|o,0,(c=(s>>>0>(u=o+8|0)>>>0?s:u)+-1+(0-o)|0)+8&-8|0),o=u+(c>>>3<<3)|0),Rt((c=0|Se(2,0,0|l))|e,0|w()|A,n,o),c=o+(a<<3)|0,Rt((u=0|Se(3,0,0|l))|e,0|w()|A,n,c),c=c+(a<<3)|0,Rt((u=0|Se(4,0,0|l))|e,0|w()|A,n,c),c=c+(a<<3)|0,Rt((u=0|Se(5,0,0|l))|e,0|w()|A,n,c),Rt((u=0|Se(6,0,0|l))|e,0|w()|A,n,c+(a<<3)|0)}}function It(t,e){var n=0,r=0,i=0;if(i=0|Me(0|(t|=0),0|(e|=0),45),w(),!(0|B(127&i)))return 0|(i=0);i=0|Me(0|t,0|e,52),w(),i&=15;t:do{if(i)for(r=1;;){if(n=0|Me(0|t,0|e,3*(15-r|0)|0),w(),0|(n&=7))break t;if(!(r>>>0<i>>>0)){n=0;break}r=r+1|0}else n=0}while(0);return 0|(i=0==(0|n)&1)}function Ot(t,e){var n=0,r=0,i=0;if(i=0|Me(0|(t|=0),0|(e|=0),52),w(),!(i&=15))return 0|(i=0);for(r=1;;){if(n=0|Me(0|t,0|e,3*(15-r|0)|0),w(),0|(n&=7)){r=5;break}if(!(r>>>0<i>>>0)){n=0,r=5;break}r=r+1|0}return 5==(0|r)?0|n:0}function Bt(t,e){var n=0,r=0,i=0,a=0,o=0,s=0,A=0;if(A=0|Me(0|(t|=0),0|(e|=0),52),w(),!(A&=15))return A=t,b(0|(s=e)),0|A;for(s=1,n=0;;){r=0|Se(7,0,0|(a=3*(15-s|0)|0)),i=0|w(),o=0|Me(0|t,0|e,0|a),w(),t=(a=0|Se(0|At(7&o),0,0|a))|t&~r,e=(o=0|w())|e&~i;t:do{if(!n)if(0==(a&r|0)&0==(o&i|0))n=0;else if(r=0|Me(0|t,0|e,52),w(),r&=15){n=1;e:for(;;){switch(o=0|Me(0|t,0|e,3*(15-n|0)|0),w(),7&o){case 1:break e;case 0:break;default:n=1;break t}if(!(n>>>0<r>>>0)){n=1;break t}n=n+1|0}for(n=1;;){if(i=0|Me(0|t,0|e,0|(o=3*(15-n|0)|0)),w(),a=0|Se(7,0,0|o),e&=~(0|w()),t=t&~a|(o=0|Se(0|At(7&i),0,0|o)),e=0|e|w(),!(n>>>0<r>>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(s>>>0<A>>>0))break;s=s+1|0}return b(0|e),0|t}function kt(t,e){var n=0,r=0,i=0,a=0,o=0;if(r=0|Me(0|(t|=0),0|(e|=0),52),w(),!(r&=15))return r=t,b(0|(n=e)),0|r;for(n=1;o=0|Me(0|t,0|e,0|(a=3*(15-n|0)|0)),w(),i=0|Se(7,0,0|a),e&=~(0|w()),t=(a=0|Se(0|At(7&o),0,0|a))|t&~i,e=0|w()|e,n>>>0<r>>>0;)n=n+1|0;return b(0|e),0|t}function Ut(t,e){var n=0,r=0,i=0,a=0,o=0,s=0,A=0;if(A=0|Me(0|(t|=0),0|(e|=0),52),w(),!(A&=15))return A=t,b(0|(s=e)),0|A;for(s=1,n=0;;){r=0|Se(7,0,0|(a=3*(15-s|0)|0)),i=0|w(),o=0|Me(0|t,0|e,0|a),w(),t=(a=0|Se(0|lt(7&o),0,0|a))|t&~r,e=(o=0|w())|e&~i;t:do{if(!n)if(0==(a&r|0)&0==(o&i|0))n=0;else if(r=0|Me(0|t,0|e,52),w(),r&=15){n=1;e:for(;;){switch(o=0|Me(0|t,0|e,3*(15-n|0)|0),w(),7&o){case 1:break e;case 0:break;default:n=1;break t}if(!(n>>>0<r>>>0)){n=1;break t}n=n+1|0}for(n=1;;){if(a=0|Se(7,0,0|(i=3*(15-n|0)|0)),o=e&~(0|w()),e=0|Me(0|t,0|e,0|i),w(),t=t&~a|(e=0|Se(0|lt(7&e),0,0|i)),e=0|o|w(),!(n>>>0<r>>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(s>>>0<A>>>0))break;s=s+1|0}return b(0|e),0|t}function zt(t,e){var n=0,r=0,i=0,a=0,o=0;if(r=0|Me(0|(t|=0),0|(e|=0),52),w(),!(r&=15))return r=t,b(0|(n=e)),0|r;for(n=1;a=0|Se(7,0,0|(o=3*(15-n|0)|0)),i=e&~(0|w()),e=0|Me(0|t,0|e,0|o),w(),t=(e=0|Se(0|lt(7&e),0,0|o))|t&~a,e=0|w()|i,n>>>0<r>>>0;)n=n+1|0;return b(0|e),0|t}function Nt(t){return 0|(0|(t|=0))%2}function Ft(t,e){t|=0;var n,r;return r=P,P=P+16|0,n=r,(e|=0)>>>0<=15&&2146435072!=(2146435072&i[t+4>>2]|0)&&2146435072!=(2146435072&i[t+8+4>>2]|0)?(!function(t,e,n){var r,i;r=P,P=P+16|0,gt(t|=0,e|=0,n|=0,i=r),Y(i,n+4|0),P=r}(t,e,n),e=0|function(t,e){t|=0;var n,r=0,a=0,o=0,s=0,A=0,l=0,u=0,c=0;if(n=P,P=P+64|0,l=n+40|0,a=n+24|0,o=n+12|0,s=n,Se(0|(e|=0),0,52),r=134225919|w(),!e)return(0|i[t+4>>2])>2||(0|i[t+8>>2])>2||(0|i[t+12>>2])>2?(l=0,b(0|(A=0)),P=n,0|l):(Se(0|U(t),0,45),A=0|w()|r,l=-1,b(0|A),P=n,0|l);if(i[l>>2]=i[t>>2],i[l+4>>2]=i[t+4>>2],i[l+8>>2]=i[t+8>>2],i[l+12>>2]=i[t+12>>2],A=l+4|0,(0|e)>0)for(t=-1;i[a>>2]=i[A>>2],i[a+4>>2]=i[A+4>>2],i[a+8>>2]=i[A+8>>2],1&e?(et(A),i[o>>2]=i[A>>2],i[o+4>>2]=i[A+4>>2],i[o+8>>2]=i[A+8>>2],rt(o)):(nt(A),i[o>>2]=i[A>>2],i[o+4>>2]=i[A+4>>2],i[o+8>>2]=i[A+8>>2],it(o)),K(a,o,s),X(s),u=0|Se(7,0,0|(c=3*(15-e|0)|0)),r&=~(0|w()),t=(c=0|Se(0|tt(s),0,0|c))|t&~u,r=0|w()|r,(0|e)>1;)e=e+-1|0;else t=-1;t:do{if((0|i[A>>2])<=2&&(0|i[l+8>>2])<=2&&(0|i[l+12>>2])<=2){if(e=0|Se(0|(a=0|U(l)),0,45),e|=t,t=0|w()|-1040385&r,s=0|z(l),!(0|B(a))){if((0|s)<=0)break;for(o=0;;){if(a=0|Me(0|e,0|t,52),w(),a&=15)for(r=1;l=0|Me(0|e,0|t,0|(c=3*(15-r|0)|0)),w(),u=0|Se(7,0,0|c),t&=~(0|w()),e=e&~u|(c=0|Se(0|At(7&l),0,0|c)),t=0|t|w(),r>>>0<a>>>0;)r=r+1|0;if((0|(o=o+1|0))==(0|s))break t}}o=0|Me(0|e,0|t,52),w(),o&=15;e:do{if(o){r=1;n:for(;;){switch(c=0|Me(0|e,0|t,3*(15-r|0)|0),w(),7&c){case 1:break n;case 0:break;default:break e}if(!(r>>>0<o>>>0))break e;r=r+1|0}if(0|N(a,0|i[l>>2]))for(r=1;u=0|Se(7,0,0|(l=3*(15-r|0)|0)),c=t&~(0|w()),t=0|Me(0|e,0|t,0|l),w(),e=e&~u|(t=0|Se(0|lt(7&t),0,0|l)),t=0|c|w(),r>>>0<o>>>0;)r=r+1|0;else for(r=1;l=0|Me(0|e,0|t,0|(c=3*(15-r|0)|0)),w(),u=0|Se(7,0,0|c),t&=~(0|w()),e=e&~u|(c=0|Se(0|At(7&l),0,0|c)),t=0|t|w(),r>>>0<o>>>0;)r=r+1|0}}while(0);if((0|s)>0){r=0;do{e=0|Bt(e,t),t=0|w(),r=r+1|0}while((0|r)!=(0|s))}}else e=0,t=0}while(0);return c=e,b(0|(u=t)),P=n,0|c}(n,e),t=0|w()):(t=0,e=0),b(0|t),P=r,0|e}function Gt(t,e,n){var r,a=0,o=0,s=0;if(r=(n|=0)+4|0,o=0|Me(0|(t|=0),0|(e|=0),52),w(),o&=15,s=0|Me(0|t,0|e,45),w(),a=0==(0|o),0|B(127&s)){if(a)return 0|(s=1);a=1}else{if(a)return 0|(s=0);a=0==(0|i[r>>2])&&0==(0|i[n+8>>2])?0!=(0|i[n+12>>2])&1:1}for(n=1;1&n?rt(r):it(r),s=0|Me(0|t,0|e,3*(15-n|0)|0),w(),at(r,7&s),n>>>0<o>>>0;)n=n+1|0;return 0|a}function Ht(t,e,n){n|=0;var r,a,o=0,s=0,A=0,l=0,u=0,c=0;a=P,P=P+16|0,r=a,c=0|Me(0|(t|=0),0|(e|=0),45),w(),c&=127;t:do{if(0!=(0|B(c))&&(A=0|Me(0|t,0|e,52),w(),0!=(0|(A&=15)))){o=1;e:for(;;){switch(u=0|Me(0|t,0|e,3*(15-o|0)|0),w(),7&u){case 5:break e;case 0:break;default:o=e;break t}if(!(o>>>0<A>>>0)){o=e;break t}o=o+1|0}for(s=1,o=e;l=0|Se(7,0,0|(e=3*(15-s|0)|0)),u=o&~(0|w()),o=0|Me(0|t,0|o,0|e),w(),t=t&~l|(o=0|Se(0|lt(7&o),0,0|e)),o=0|u|w(),s>>>0<A>>>0;)s=s+1|0}else o=e}while(0);if(u=7728+(28*c|0)|0,i[n>>2]=i[u>>2],i[n+4>>2]=i[u+4>>2],i[n+8>>2]=i[u+8>>2],i[n+12>>2]=i[u+12>>2],0|Gt(t,o,n)){if(l=n+4|0,i[r>>2]=i[l>>2],i[r+4>>2]=i[l+4>>2],i[r+8>>2]=i[l+8>>2],A=0|Me(0|t,0|o,52),w(),u=15&A,1&A?(it(l),A=u+1|0):A=u,0|B(c)){t:do{if(u)for(e=1;;){if(s=0|Me(0|t,0|o,3*(15-e|0)|0),w(),0|(s&=7)){o=s;break t}if(!(e>>>0<u>>>0)){o=0;break}e=e+1|0}else o=0}while(0);o=4==(0|o)&1}else o=0;if(0|bt(n,A,o,0)){if(0|B(c))do{}while(0!=(0|bt(n,A,0,0)));(0|A)!=(0|u)&&nt(l)}else(0|A)!=(0|u)&&(i[l>>2]=i[r>>2],i[l+4>>2]=i[r+4>>2],i[l+8>>2]=i[r+8>>2]);P=a}else P=a}function jt(t,e,n){n|=0;var r,i;r=P,P=P+16|0,Ht(t|=0,e|=0,i=r),e=0|Me(0|t,0|e,52),w(),xt(i,15&e,n),P=r}function Vt(t,e,n){n|=0;var r,i,a=0,o=0;i=P,P=P+16|0,Ht(t|=0,e|=0,r=i),a=0|Me(0|t,0|e,45),w(),a=0==(0|B(127&a)),o=0|Me(0|t,0|e,52),w(),o&=15;t:do{if(!a){if(0|o)for(a=1;;){if(!(0==((0|Se(7,0,3*(15-a|0)|0))&t|0)&0==((0|w())&e|0)))break t;if(!(a>>>0<o>>>0))break;a=a+1|0}return yt(r,o,0,5,n),void(P=i)}}while(0);Mt(r,o,0,6,n),P=i}function Wt(t,e){e|=0;var n,r=0,a=0,o=0,s=0,A=0,l=0;if(Se(0|(t|=0),0,52),n=134225919|w(),(0|t)<1){a=0,r=0;do{0|B(a)&&(Se(0|a,0,45),A=0|n|w(),i[(t=e+(r<<3)|0)>>2]=-1,i[t+4>>2]=A,r=r+1|0),a=a+1|0}while(122!=(0|a))}else{A=0,r=0;do{if(0|B(A)){for(Se(0|A,0,45),a=1,o=-1,s=0|n|w();o&=~(l=0|Se(7,0,3*(15-a|0)|0)),s&=~(0|w()),(0|a)!=(0|t);)a=a+1|0;i[(l=e+(r<<3)|0)>>2]=o,i[l+4>>2]=s,r=r+1|0}A=A+1|0}while(122!=(0|A))}}function Qt(t,e,n,r){var a,o=0,s=0,A=0,l=0,u=0;if(a=P,P=P+64|0,A=a,(0|(t|=0))==(0|(n|=0))&(0|(e|=0))==(0|(r|=0))|!1|134217728!=(2013265920&e|0)|!1|134217728!=(2013265920&r|0))return P=a,0|(A=0);if(o=0|Me(0|t,0|e,52),w(),o&=15,s=0|Me(0|n,0|r,52),w(),(0|o)!=(15&s|0))return P=a,0|(A=0);if(s=o+-1|0,o>>>0>1&&(u=0|Lt(t,e,s),l=0|w(),(0|u)==(0|(s=0|Lt(n,r,s)))&(0|l)==(0|w()))){if(o=0|Me(0|t,0|e,0|(s=3*(15^o)|0)),w(),o&=7,s=0|Me(0|n,0|r,0|s),w(),0==(0|o)|0==(0|(s&=7)))return P=a,0|(u=1);if((0|i[21136+(o<<2)>>2])==(0|s))return P=a,0|(u=1);if((0|i[21168+(o<<2)>>2])==(0|s))return P=a,0|(u=1)}s=(o=A)+56|0;do{i[o>>2]=0,o=o+4|0}while((0|o)<(0|s));return D(t,e,1,A),o=(0|i[(u=A)>>2])==(0|n)&&(0|i[u+4>>2])==(0|r)||(0|i[(u=A+8|0)>>2])==(0|n)&&(0|i[u+4>>2])==(0|r)||(0|i[(u=A+16|0)>>2])==(0|n)&&(0|i[u+4>>2])==(0|r)||(0|i[(u=A+24|0)>>2])==(0|n)&&(0|i[u+4>>2])==(0|r)||(0|i[(u=A+32|0)>>2])==(0|n)&&(0|i[u+4>>2])==(0|r)||(0|i[(u=A+40|0)>>2])==(0|n)&&(0|i[u+4>>2])==(0|r)?1:1&((0|i[(o=A+48|0)>>2])==(0|n)?(0|i[o+4>>2])==(0|r):0),P=a,0|(u=o)}function Yt(t,e,n){n|=0;var r,a,o,s,A=0;if(o=P,P=P+16|0,a=o,A=0|Me(0|(t|=0),0|(e|=0),56),w(),e=0|function(t,e,n){n|=0;var r=0,a=0;if(r=0|It(t=t|0,e=e|0),(n+-1|0)>>>0>5)return 0|(n=-1);if(1==(0|n)&(a=0!=(0|r)))return 0|(n=-1);return r=0|function(t,e){var n=0,r=0,a=0,o=0,s=0,A=0,l=0,u=0;if(u=P,P=P+32|0,o=u,Ht(t=t|0,e=e|0,a=u+16|0),s=0|Pt(t,e),l=0|Ot(t,e),function(t,e){t=7728+(28*(t|=0)|0)|0,i[(e|=0)>>2]=i[t>>2],i[e+4>>2]=i[t+4>>2],i[e+8>>2]=i[t+8>>2],i[e+12>>2]=i[t+12>>2]}(s,o),e=0|function(t,e){t|=0;var n=0,r=0;if((e|=0)>>>0>20)return-1;do{if((0|i[11152+(216*e|0)>>2])!=(0|t))if((0|i[11152+(216*e|0)+8>>2])!=(0|t))if((0|i[11152+(216*e|0)+16>>2])!=(0|t))if((0|i[11152+(216*e|0)+24>>2])!=(0|t))if((0|i[11152+(216*e|0)+32>>2])!=(0|t))if((0|i[11152+(216*e|0)+40>>2])!=(0|t))if((0|i[11152+(216*e|0)+48>>2])!=(0|t))if((0|i[11152+(216*e|0)+56>>2])!=(0|t))if((0|i[11152+(216*e|0)+64>>2])!=(0|t))if((0|i[11152+(216*e|0)+72>>2])!=(0|t))if((0|i[11152+(216*e|0)+80>>2])!=(0|t))if((0|i[11152+(216*e|0)+88>>2])!=(0|t))if((0|i[11152+(216*e|0)+96>>2])!=(0|t))if((0|i[11152+(216*e|0)+104>>2])!=(0|t))if((0|i[11152+(216*e|0)+112>>2])!=(0|t))if((0|i[11152+(216*e|0)+120>>2])!=(0|t))if((0|i[11152+(216*e|0)+128>>2])!=(0|t)){if((0|i[11152+(216*e|0)+136>>2])!=(0|t)){if((0|i[11152+(216*e|0)+144>>2])==(0|t)){t=0,n=2,r=0;break}if((0|i[11152+(216*e|0)+152>>2])==(0|t)){t=0,n=2,r=1;break}if((0|i[11152+(216*e|0)+160>>2])==(0|t)){t=0,n=2,r=2;break}if((0|i[11152+(216*e|0)+168>>2])==(0|t)){t=1,n=2,r=0;break}if((0|i[11152+(216*e|0)+176>>2])==(0|t)){t=1,n=2,r=1;break}if((0|i[11152+(216*e|0)+184>>2])==(0|t)){t=1,n=2,r=2;break}if((0|i[11152+(216*e|0)+192>>2])==(0|t)){t=2,n=2,r=0;break}if((0|i[11152+(216*e|0)+200>>2])==(0|t)){t=2,n=2,r=1;break}if((0|i[11152+(216*e|0)+208>>2])==(0|t)){t=2,n=2,r=2;break}return-1}t=2,n=1,r=2}else t=2,n=1,r=1;else t=2,n=1,r=0;else t=1,n=1,r=2;else t=1,n=1,r=1;else t=1,n=1,r=0;else t=0,n=1,r=2;else t=0,n=1,r=1;else t=0,n=1,r=0;else t=2,n=0,r=2;else t=2,n=0,r=1;else t=2,n=0,r=0;else t=1,n=0,r=2;else t=1,n=0,r=1;else t=1,n=0,r=0;else t=0,n=0,r=2;else t=0,n=0,r=1;else t=0,n=0,r=0}while(0);return 0|i[11152+(216*e|0)+(72*n|0)+(24*t|0)+(r<<3)+4>>2]}(s,0|i[a>>2]),!(0|B(s)))return P=u,0|(l=e);switch(0|s){case 4:t=0,n=14;break;case 14:t=1,n=14;break;case 24:t=2,n=14;break;case 38:t=3,n=14;break;case 49:t=4,n=14;break;case 58:t=5,n=14;break;case 63:t=6,n=14;break;case 72:t=7,n=14;break;case 83:t=8,n=14;break;case 97:t=9,n=14;break;case 107:t=10,n=14;break;case 117:t=11,n=14;break;default:A=0,r=0}14==(0|n)&&(A=0|i[22096+(24*t|0)+8>>2],r=0|i[22096+(24*t|0)+16>>2]);(0|(t=0|i[a>>2]))!=(0|i[o>>2])&&(s=0|k(s))|(0|(t=0|i[a>>2]))==(0|r)&&(e=(e+1|0)%6|0);if(3==(0|l)&(0|t)==(0|r))return P=u,0|(l=(e+5|0)%6|0);if(!(5==(0|l)&(0|t)==(0|A)))return P=u,0|(l=e);return P=u,0|(l=(e+1|0)%6|0)}(t,e),a?0|(n=(5-r+(0|i[22384+(n<<2)>>2])|0)%5|0):0|(n=(6-r+(0|i[22416+(n<<2)>>2])|0)%6|0)}(r=(s=!0&268435456==(2013265920&e|0))?t:0,t=s?-2130706433&e|134217728:0,7&A),-1==(0|e))return i[n>>2]=0,void(P=o);Ht(r,t,a),A=0|Me(0|r,0|t,52),w(),A&=15,0|It(r,t)?yt(a,A,e,2,n):Mt(a,A,e,2,n),P=o}function Xt(t){t|=0;var e,n,r=0;return(e=0|xe(1,12))||M(22691,22646,49,22704),0|(r=0|i[(n=t+4|0)>>2])?(i[(r=r+8|0)>>2]=e,i[n>>2]=e,0|e):(0|i[t>>2]&&M(22721,22646,61,22744),i[(r=t)>>2]=e,i[n>>2]=e,0|e)}function Zt(t,e){t|=0,e|=0;var n,r;return(r=0|ge(24))||M(22758,22646,78,22772),i[r>>2]=i[e>>2],i[r+4>>2]=i[e+4>>2],i[r+8>>2]=i[e+8>>2],i[r+12>>2]=i[e+12>>2],i[r+16>>2]=0,0|(n=0|i[(e=t+4|0)>>2])?(i[n+16>>2]=r,i[e>>2]=r,0|r):(0|i[t>>2]&&M(22787,22646,82,22772),i[t>>2]=r,i[e>>2]=r,0|r)}function Jt(t){var e,n,r=0,o=0,s=0,l=0,u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0,v=0,x=0,y=0,_=0,b=0,w=0,S=0,E=0,T=0,C=0,q=0,P=0,D=0,L=0,R=0,I=0,O=0,B=0;if(0|i[(l=(t|=0)+8|0)>>2])return 0|(B=1);if(!(s=0|i[t>>2]))return 0|(B=0);r=s,o=0;do{o=o+1|0,r=0|i[r+8>>2]}while(0!=(0|r));if(o>>>0<2)return 0|(B=0);(n=0|ge(o<<2))||M(22807,22646,317,22826),(e=0|ge(o<<5))||M(22848,22646,321,22826),i[t>>2]=0,i[(C=t+4|0)>>2]=0,i[l>>2]=0,o=0,I=0,T=0,m=0;t:for(;;){if(p=0|i[s>>2]){u=0,c=p;do{if(f=+a[c+8>>3],r=c,c=0|i[c+16>>2],h=+a[(l=(d=0==(0|c))?p:c)+8>>3],+A(+(f-h))>3.141592653589793){B=14;break}u+=(h-f)*(+a[r>>3]+ +a[l>>3])}while(!d);if(14==(0|B)){B=0,u=0,r=p;do{E=+a[r+8>>3],L=0|i[(R=r+16|0)>>2],S=+a[(L=0==(0|L)?p:L)+8>>3],u+=(+a[r>>3]+ +a[L>>3])*((S<0?S+6.283185307179586:S)-(E<0?E+6.283185307179586:E)),r=0|i[(0==(0|r)?s:R)>>2]}while(0!=(0|r))}u>0?(i[n+(I<<2)>>2]=s,I=I+1|0,l=T,r=m):B=19}else B=19;if(19==(0|B)){B=0;do{if(!o){if(m){l=C,c=m+8|0,r=s,o=t;break}if(0|i[t>>2]){B=27;break t}l=C,c=t,r=s,o=t;break}if(0|i[(r=o+8|0)>>2]){B=21;break t}if(!(o=0|xe(1,12))){B=23;break t}i[r>>2]=o,l=o+4|0,c=o,r=m}while(0);if(i[c>>2]=s,i[l>>2]=s,c=e+(T<<5)|0,d=0|i[s>>2]){for(a[(p=e+(T<<5)+8|0)>>3]=17976931348623157e292,a[(m=e+(T<<5)+24|0)>>3]=17976931348623157e292,a[c>>3]=-17976931348623157e292,a[(g=e+(T<<5)+16|0)>>3]=-17976931348623157e292,b=17976931348623157e292,w=-17976931348623157e292,l=0,v=d,f=17976931348623157e292,y=17976931348623157e292,_=-17976931348623157e292,h=-17976931348623157e292;u=+a[v>>3],E=+a[v+8>>3],v=0|i[v+16>>2],S=+a[((x=0==(0|v))?d:v)+8>>3],u<f&&(a[p>>3]=u,f=u),E<y&&(a[m>>3]=E,y=E),u>_?a[c>>3]=u:u=_,E>h&&(a[g>>3]=E,h=E),b=E>0&E<b?E:b,w=E<0&E>w?E:w,l|=+A(+(E-S))>3.141592653589793,!x;)_=u;l&&(a[g>>3]=w,a[m>>3]=b)}else i[c>>2]=0,i[c+4>>2]=0,i[c+8>>2]=0,i[c+12>>2]=0,i[c+16>>2]=0,i[c+20>>2]=0,i[c+24>>2]=0,i[c+28>>2]=0;l=T+1|0}if(s=0|i[(R=s+8|0)>>2],i[R>>2]=0,!s){B=45;break}T=l,m=r}if(21==(0|B))M(22624,22646,35,22658);else if(23==(0|B))M(22678,22646,37,22658);else if(27==(0|B))M(22721,22646,61,22744);else if(45==(0|B)){t:do{if((0|I)>0){for(R=0==(0|l),D=l<<2,L=0==(0|t),P=0,r=0;;){if(q=0|i[n+(P<<2)>>2],R)B=73;else{if(!(T=0|ge(D))){B=50;break}if(!(C=0|ge(D))){B=52;break}e:do{if(L)o=0;else{for(l=0,o=0,c=t;s=e+(l<<5)|0,0|Kt(0|i[c>>2],s,0|i[q>>2])?(i[T+(o<<2)>>2]=c,i[C+(o<<2)>>2]=s,x=o+1|0):x=o,c=0|i[c+8>>2];)l=l+1|0,o=x;if((0|x)>0)if(s=0|i[T>>2],1==(0|x))o=s;else for(g=0,v=-1,o=s,m=s;;){for(d=0|i[m>>2],s=0,c=0;p=(0|(l=0|i[i[T+(c<<2)>>2]>>2]))==(0|d)?s:s+(1&(0|Kt(l,0|i[C+(c<<2)>>2],0|i[d>>2])))|0,(0|(c=c+1|0))!=(0|x);)s=p;if(o=(l=(0|p)>(0|v))?m:o,(0|(s=g+1|0))==(0|x))break e;g=s,v=l?p:v,m=0|i[T+(s<<2)>>2]}else o=0}}while(0);if(ve(T),ve(C),o){if(s=0|i[(l=o+4|0)>>2])o=s+8|0;else if(0|i[o>>2]){B=70;break}i[o>>2]=q,i[l>>2]=q}else B=73}if(73==(0|B)){if(B=0,0|(r=0|i[q>>2]))do{C=r,r=0|i[r+16>>2],ve(C)}while(0!=(0|r));ve(q),r=2}if((0|(P=P+1|0))>=(0|I)){O=r;break t}}50==(0|B)?M(22863,22646,249,22882):52==(0|B)?M(22901,22646,252,22882):70==(0|B)&&M(22721,22646,61,22744)}else O=0}while(0);return ve(n),ve(e),0|(B=O)}return 0}function Kt(t,e,n){t|=0;var r,o=0,s=0,A=0,l=0,u=0,c=0,h=0;if(!(0|j(e|=0,n|=0)))return 0|(t=0);if(e=0|H(e),r=+a[n>>3],o=e&(o=+a[n+8>>3])<0?o+6.283185307179586:o,!(t=0|i[t>>2]))return 0|(t=0);if(e){e=0,n=t;t:for(;;){for(;l=+a[n>>3],c=+a[n+8>>3],h=0|i[(n=n+16|0)>>2],A=+a[(h=0==(0|h)?t:h)>>3],s=+a[h+8>>3],l>A?(u=l,l=c):(u=A,A=l,l=s,s=c),r<A|r>u;)if(!(n=0|i[n>>2])){n=22;break t}if(o=(l=l<0?l+6.283185307179586:l)==o|(c=s<0?s+6.283185307179586:s)==o?o+-2220446049250313e-31:o,((c+=(r-A)/(u-A)*(l-c))<0?c+6.283185307179586:c)>o&&(e^=1),!(n=0|i[n>>2])){n=22;break}}if(22==(0|n))return 0|e}else{e=0,n=t;t:for(;;){for(;l=+a[n>>3],c=+a[n+8>>3],h=0|i[(n=n+16|0)>>2],A=+a[(h=0==(0|h)?t:h)>>3],s=+a[h+8>>3],l>A?(u=l,l=c):(u=A,A=l,l=s,s=c),r<A|r>u;)if(!(n=0|i[n>>2])){n=22;break t}if(s+(r-A)/(u-A)*(l-s)>(o=l==o|s==o?o+-2220446049250313e-31:o)&&(e^=1),!(n=0|i[n>>2])){n=22;break}}if(22==(0|n))return 0|e}return 0}function $t(t,e,n,a,o){n|=0,a|=0,o|=0;var s,A,l,u,c=0,h=0,f=0,d=0,p=0,m=0,g=0,v=0,x=0,y=0;if(u=P,P=P+32|0,y=u+16|0,l=u,c=0|Me(0|(t|=0),0|(e|=0),52),w(),c&=15,g=0|Me(0|n,0|a,52),w(),(0|c)!=(15&g|0))return P=u,0|(y=1);if(p=0|Me(0|t,0|e,45),w(),p&=127,m=0|Me(0|n,0|a,45),w(),g=(0|p)!=(0|(m&=127))){if(7==(0|(f=0|G(p,m))))return P=u,0|(y=2);7==(0|(d=0|G(m,p)))?M(22925,22949,151,22959):(v=f,h=d)}else v=0,h=0;s=0|B(p),A=0|B(m),i[y>>2]=0,i[y+4>>2]=0,i[y+8>>2]=0,i[y+12>>2]=0;do{if(v){if(f=(0|(m=0|i[4304+(28*p|0)+(v<<2)>>2]))>0,A)if(f){p=0,d=n,f=a;do{d=0|Ut(d,f),f=0|w(),1==(0|(h=0|lt(h)))&&(h=0|lt(1)),p=p+1|0}while((0|p)!=(0|m));m=h,p=d,d=f}else m=h,p=n,d=a;else if(f){p=0,d=n,f=a;do{d=0|zt(d,f),f=0|w(),h=0|lt(h),p=p+1|0}while((0|p)!=(0|m));m=h,p=d,d=f}else m=h,p=n,d=a;if(Gt(p,d,y),g||M(22972,22949,181,22959),(f=0!=(0|s))&(h=0!=(0|A))&&M(22999,22949,182,22959),f){if(h=0|Ot(t,e),0|r[22032+(7*h|0)+v>>0]){c=3;break}p=d=0|i[21200+(28*h|0)+(v<<2)>>2],x=26}else if(h){if(h=0|Ot(p,d),0|r[22032+(7*h|0)+m>>0]){c=4;break}p=0,d=0|i[21200+(28*m|0)+(h<<2)>>2],x=26}else h=0;if(26==(0|x))if((0|d)<=-1&&M(23030,22949,212,22959),(0|p)<=-1&&M(23053,22949,213,22959),(0|d)>0){f=y+4|0,h=0;do{st(f),h=h+1|0}while((0|h)!=(0|d));h=p}else h=p;if(i[l>>2]=0,i[l+4>>2]=0,i[l+8>>2]=0,at(l,v),0|c)for(;0|Nt(c)?rt(l):it(l),(0|c)>1;)c=c+-1|0;if((0|h)>0){c=0;do{st(l),c=c+1|0}while((0|c)!=(0|h))}J(x=y+4|0,l,x),X(x),x=50}else if(Gt(n,a,y),0!=(0|s)&0!=(0|A))if((0|m)!=(0|p)&&M(23077,22949,243,22959),h=0|Ot(t,e),c=0|Ot(n,a),0|r[22032+(7*h|0)+c>>0])c=5;else if((0|(h=0|i[21200+(28*h|0)+(c<<2)>>2]))>0){f=y+4|0,c=0;do{st(f),c=c+1|0}while((0|c)!=(0|h));x=50}else x=50;else x=50}while(0);return 50==(0|x)&&(c=y+4|0,i[o>>2]=i[c>>2],i[o+4>>2]=i[c+4>>2],i[o+8>>2]=i[c+8>>2],c=0),P=u,0|(y=c)}function te(t,e,n,r){n|=0,r|=0;var a,o,s=0,A=0,l=0,u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0,v=0,x=0;if(o=P,P=P+48|0,l=o+36|0,u=o+24|0,c=o+12|0,h=o,A=0|Me(0|(t|=0),0|(e|=0),52),w(),A&=15,d=0|Me(0|t,0|e,45),w(),a=0|B(d&=127),Se(0|A,0,52),g=134225919|w(),i[(m=r)>>2]=-1,i[m+4>>2]=g,!A)return(0|i[n>>2])>1||(0|i[n+4>>2])>1||(0|i[n+8>>2])>1||127==(0|(s=0|F(d,0|tt(n))))?(P=o,0|(g=1)):(p=0|Se(0|s,0,45),m=0|w(),m=-1040385&i[(d=r)+4>>2]|m,i[(g=r)>>2]=i[d>>2]|p,i[g+4>>2]=m,P=o,0|(g=0));for(i[l>>2]=i[n>>2],i[l+4>>2]=i[n+4>>2],i[l+8>>2]=i[n+8>>2];i[u>>2]=i[l>>2],i[u+4>>2]=i[l+4>>2],i[u+8>>2]=i[l+8>>2],0|Nt(A)?(et(l),i[c>>2]=i[l>>2],i[c+4>>2]=i[l+4>>2],i[c+8>>2]=i[l+8>>2],rt(c)):(nt(l),i[c>>2]=i[l>>2],i[c+4>>2]=i[l+4>>2],i[c+8>>2]=i[l+8>>2],it(c)),K(u,c,h),X(h),v=0|i[(m=r)>>2],m=0|i[m+4>>2],n=0|Se(7,0,0|(x=3*(15-A|0)|0)),m&=~(0|w()),x=0|Se(0|tt(h),0,0|x),m=0|w()|m,i[(g=r)>>2]=x|v&~n,i[g+4>>2]=m,(0|A)>1;)A=A+-1|0;t:do{if((0|i[l>>2])<=1&&(0|i[l+4>>2])<=1&&(0|i[l+8>>2])<=1){h=127==(0|(u=0|F(d,A=0|tt(l))))?0:0|B(u);e:do{if(A){if(a){if(l=21408+(28*(0|Ot(t,e))|0)+(A<<2)|0,(0|(l=0|i[l>>2]))>0){n=0;do{A=0|At(A),n=n+1|0}while((0|n)!=(0|l))}if(1==(0|A)){s=3;break t}127==(0|(n=0|F(d,A)))&&M(23104,22949,376,23134),0|B(n)?M(23147,22949,377,23134):(p=l,f=A,s=n)}else p=0,f=A,s=u;if((0|(c=0|i[4304+(28*d|0)+(f<<2)>>2]))<=-1&&M(23178,22949,384,23134),!h){if((0|p)<=-1&&M(23030,22949,417,23134),0|p){A=0,n=0|i[(l=r)>>2],l=0|i[l+4>>2];do{n=0|kt(n,l),l=0|w(),i[(x=r)>>2]=n,i[x+4>>2]=l,A=A+1|0}while((0|A)<(0|p))}if((0|c)<=0){A=54;break}for(A=0,n=0|i[(l=r)>>2],l=0|i[l+4>>2];;)if(n=0|kt(n,l),l=0|w(),i[(x=r)>>2]=n,i[x+4>>2]=l,(0|(A=A+1|0))==(0|c)){A=54;break e}}if(7==(0|(u=0|G(s,d)))&&M(22925,22949,393,23134),n=0|i[(A=r)>>2],A=0|i[A+4>>2],(0|c)>0){l=0;do{n=0|kt(n,A),A=0|w(),i[(x=r)>>2]=n,i[x+4>>2]=A,l=l+1|0}while((0|l)!=(0|c))}if(n=0|Ot(n,A),x=0|k(s),(0|(n=0|i[(x?21824:21616)+(28*u|0)+(n<<2)>>2]))<=-1&&M(23030,22949,412,23134),n){A=0,l=0|i[(u=r)>>2],u=0|i[u+4>>2];do{l=0|Bt(l,u),u=0|w(),i[(x=r)>>2]=l,i[x+4>>2]=u,A=A+1|0}while((0|A)<(0|n));A=54}else A=54}else if(0!=(0|a)&0!=(0|h))if(A=21408+(28*(x=0|Ot(t,e))|0)+((0|Ot(0|i[(A=r)>>2],0|i[A+4>>2]))<<2)|0,(0|(A=0|i[A>>2]))<=-1&&M(23201,22949,433,23134),A){s=0,n=0|i[(l=r)>>2],l=0|i[l+4>>2];do{n=0|kt(n,l),l=0|w(),i[(x=r)>>2]=n,i[x+4>>2]=l,s=s+1|0}while((0|s)<(0|A));s=u,A=54}else s=u,A=55;else s=u,A=54}while(0);if(54==(0|A)&&h&&(A=55),55==(0|A)&&1==(0|Ot(0|i[(x=r)>>2],0|i[x+4>>2]))){s=4;break}g=0|i[(x=r)>>2],x=-1040385&i[x+4>>2],v=0|Se(0|s,0,45),x=0|x|w(),i[(s=r)>>2]=g|v,i[s+4>>2]=x,s=0}else s=2}while(0);return P=o,0|(x=s)}function ee(t,e){var n=0;if(!(e|=0))return 0|(n=1);n=t|=0,t=1;do{t=0|x(0==(1&e|0)?1:n,t),e>>=1,n=0|x(n,n)}while(0!=(0|e));return 0|t}function ne(t,e,n){t|=0;var r,o,s=0,A=0,l=0,u=0,c=0,h=0,f=0,d=0;if(!(0|j(e|=0,n|=0)))return 0|(d=0);if(e=0|H(e),o=+a[n>>3],s=e&(s=+a[n+8>>3])<0?s+6.283185307179586:s,(0|(d=0|i[t>>2]))<=0)return 0|(d=0);if(r=0|i[t+4>>2],e){e=0,n=-1,t=0;t:for(;;){for(f=t;u=+a[r+(f<<4)>>3],h=+a[r+(f<<4)+8>>3],l=+a[r+((t=(n+2|0)%(0|d)|0)<<4)>>3],A=+a[r+(t<<4)+8>>3],u>l?(c=u,u=h):(c=l,l=u,u=A,A=h),o<l|o>c;){if(!((0|(n=f+1|0))<(0|d))){n=22;break t}t=f,f=n,n=t}if(s=(u=u<0?u+6.283185307179586:u)==s|(h=A<0?A+6.283185307179586:A)==s?s+-2220446049250313e-31:s,((h+=(o-l)/(c-l)*(u-h))<0?h+6.283185307179586:h)>s&&(e^=1),(0|(t=f+1|0))>=(0|d)){n=22;break}n=f}if(22==(0|n))return 0|e}else{e=0,n=-1,t=0;t:for(;;){for(f=t;u=+a[r+(f<<4)>>3],h=+a[r+(f<<4)+8>>3],l=+a[r+((t=(n+2|0)%(0|d)|0)<<4)>>3],A=+a[r+(t<<4)+8>>3],u>l?(c=u,u=h):(c=l,l=u,u=A,A=h),o<l|o>c;){if(!((0|(n=f+1|0))<(0|d))){n=22;break t}t=f,f=n,n=t}if(A+(o-l)/(c-l)*(u-A)>(s=u==s|A==s?s+-2220446049250313e-31:s)&&(e^=1),(0|(t=f+1|0))>=(0|d)){n=22;break}n=f}if(22==(0|n))return 0|e}return 0}function re(t,e){e|=0;var n,r,o,s,l,u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0,v=0,x=0,y=0,_=0;if(!(r=0|i[(t|=0)>>2]))return i[e>>2]=0,i[e+4>>2]=0,i[e+8>>2]=0,i[e+12>>2]=0,i[e+16>>2]=0,i[e+20>>2]=0,i[e+24>>2]=0,void(i[e+28>>2]=0);if(a[(o=e+8|0)>>3]=17976931348623157e292,a[(s=e+24|0)>>3]=17976931348623157e292,a[e>>3]=-17976931348623157e292,a[(l=e+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(n=0|i[t+4>>2],g=17976931348623157e292,v=-17976931348623157e292,x=0,t=-1,f=17976931348623157e292,d=17976931348623157e292,m=-17976931348623157e292,c=-17976931348623157e292,y=0;u=+a[n+(y<<4)>>3],p=+a[n+(y<<4)+8>>3],h=+a[n+(((0|(t=t+2|0))==(0|r)?0:t)<<4)+8>>3],u<f&&(a[o>>3]=u,f=u),p<d&&(a[s>>3]=p,d=p),u>m?a[e>>3]=u:u=m,p>c&&(a[l>>3]=p,c=p),g=p>0&p<g?p:g,v=p<0&p>v?p:v,x|=+A(+(p-h))>3.141592653589793,(0|(t=y+1|0))!=(0|r);)_=y,m=u,y=t,t=_;x&&(a[l>>3]=v,a[s>>3]=g)}}function ie(t,e){e|=0;var n,r=0,o=0,s=0,l=0,u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0,v=0,x=0,y=0,_=0,b=0,w=0,M=0,S=0,E=0;if(v=0|i[(t|=0)>>2]){if(a[(x=e+8|0)>>3]=17976931348623157e292,a[(y=e+24|0)>>3]=17976931348623157e292,a[e>>3]=-17976931348623157e292,a[(_=e+16|0)>>3]=-17976931348623157e292,(0|v)>0){for(s=0|i[t+4>>2],m=17976931348623157e292,g=-17976931348623157e292,o=0,r=-1,h=17976931348623157e292,f=17976931348623157e292,p=-17976931348623157e292,u=-17976931348623157e292,b=0;l=+a[s+(b<<4)>>3],d=+a[s+(b<<4)+8>>3],c=+a[s+(((0|(S=r+2|0))==(0|v)?0:S)<<4)+8>>3],l<h&&(a[x>>3]=l,h=l),d<f&&(a[y>>3]=d,f=d),l>p?a[e>>3]=l:l=p,d>u&&(a[_>>3]=d,u=d),m=d>0&d<m?d:m,g=d<0&d>g?d:g,o|=+A(+(d-c))>3.141592653589793,(0|(r=b+1|0))!=(0|v);)S=b,p=l,b=r,r=S;o&&(a[_>>3]=g,a[y>>3]=m)}}else i[e>>2]=0,i[e+4>>2]=0,i[e+8>>2]=0,i[e+12>>2]=0,i[e+16>>2]=0,i[e+20>>2]=0,i[e+24>>2]=0,i[e+28>>2]=0;if(!((0|(r=0|i[(S=t+8|0)>>2]))<=0)){n=t+12|0,M=0;do{if(s=0|i[n>>2],o=M,y=e+((M=M+1|0)<<5)|0,_=0|i[s+(o<<3)>>2]){if(a[(b=e+(M<<5)+8|0)>>3]=17976931348623157e292,a[(t=e+(M<<5)+24|0)>>3]=17976931348623157e292,a[y>>3]=-17976931348623157e292,a[(w=e+(M<<5)+16|0)>>3]=-17976931348623157e292,(0|_)>0){for(v=0|i[s+(o<<3)+4>>2],m=17976931348623157e292,g=-17976931348623157e292,s=0,o=-1,x=0,h=17976931348623157e292,f=17976931348623157e292,d=-17976931348623157e292,u=-17976931348623157e292;l=+a[v+(x<<4)>>3],p=+a[v+(x<<4)+8>>3],c=+a[v+(((0|(o=o+2|0))==(0|_)?0:o)<<4)+8>>3],l<h&&(a[b>>3]=l,h=l),p<f&&(a[t>>3]=p,f=p),l>d?a[y>>3]=l:l=d,p>u&&(a[w>>3]=p,u=p),m=p>0&p<m?p:m,g=p<0&p>g?p:g,s|=+A(+(p-c))>3.141592653589793,(0|(o=x+1|0))!=(0|_);)E=x,x=o,d=l,o=E;s&&(a[w>>3]=g,a[t>>3]=m)}}else i[y>>2]=0,i[y+4>>2]=0,i[y+8>>2]=0,i[y+12>>2]=0,i[y+16>>2]=0,i[y+20>>2]=0,i[y+24>>2]=0,i[y+28>>2]=0,r=0|i[S>>2]}while((0|M)<(0|r))}}function ae(t,e,n){var r=0,a=0,o=0;if(!(0|ne(t|=0,e|=0,n|=0)))return 0|(a=0);if((0|i[(a=t+8|0)>>2])<=0)return 0|(a=1);for(r=t+12|0,t=0;;){if(o=t,t=t+1|0,0|ne((0|i[r>>2])+(o<<3)|0,e+(t<<5)|0,n)){t=0,r=6;break}if((0|t)>=(0|i[a>>2])){t=1,r=6;break}}return 6==(0|r)?0|t:0}function oe(t,e,n,r,i){e|=0,n|=0,r|=0,i|=0;var o,s,A,l,u,c,h,f=0;l=+a[(t|=0)>>3],A=+a[e>>3]-l,s=+a[t+8>>3],o=+a[e+8>>3]-s,c=+a[n>>3],f=((f=+a[r>>3]-c)*(s-(h=+a[n+8>>3]))-(l-c)*(u=+a[r+8>>3]-h))/(A*u-o*f),a[i>>3]=l+A*f,a[i+8>>3]=s+o*f}function se(t,e){return e|=0,+a[(t|=0)>>3]!=+a[e>>3]?0|(e=0):0|(e=+a[t+8>>3]==+a[e+8>>3])}function Ae(t,e){e|=0;var n,r,i;return+((i=+a[(t|=0)>>3]-+a[e>>3])*i+(r=+a[t+8>>3]-+a[e+8>>3])*r+(n=+a[t+16>>3]-+a[e+16>>3])*n)}function le(t,e,n){t|=0,n|=0;var r=0;(0|(e|=0))>0?(r=0|xe(e,4),i[t>>2]=r,r||M(23230,23253,40,23267)):i[t>>2]=0,i[t+4>>2]=e,i[t+8>>2]=0,i[t+12>>2]=n}function ue(t){var e,n,r,o=0,s=0,l=0,c=0;e=(t|=0)+4|0,n=t+12|0,r=t+8|0;t:for(;;){for(s=0|i[e>>2],o=0;;){if((0|o)>=(0|s))break t;if(l=0|i[t>>2],c=0|i[l+(o<<2)>>2])break;o=o+1|0}o=l+(~~(+A(+ +u(10,+ +(15-(0|i[n>>2])|0))*(+a[c>>3]+ +a[c+8>>3]))%+(0|s))>>>0<<2)|0,s=0|i[o>>2];e:do{if(0|s){if(l=c+32|0,(0|s)==(0|c))i[o>>2]=i[l>>2];else{if(!(o=0|i[(s=s+32|0)>>2]))break;for(;(0|o)!=(0|c);)if(!(o=0|i[(s=o+32|0)>>2]))break e;i[s>>2]=i[l>>2]}ve(c),i[r>>2]=(0|i[r>>2])-1}}while(0)}ve(0|i[t>>2])}function ce(t){var e,n=0,r=0;for(e=0|i[(t|=0)+4>>2],r=0;;){if((0|r)>=(0|e)){n=0,r=4;break}if(n=0|i[(0|i[t>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|n:0}function he(t,e){e|=0;var n=0,r=0,o=0,s=0;if(n=~~(+A(+ +u(10,+ +(15-(0|i[(t|=0)+12>>2])|0))*(+a[e>>3]+ +a[e+8>>3]))%+(0|i[t+4>>2]))>>>0,n=(0|i[t>>2])+(n<<2)|0,!(r=0|i[n>>2]))return 0|(s=1);s=e+32|0;do{if((0|r)!=(0|e)){if(!(n=0|i[r+32>>2]))return 0|(s=1);for(o=n;;){if((0|o)==(0|e)){o=8;break}if(!(n=0|i[o+32>>2])){n=1,o=10;break}r=o,o=n}if(8==(0|o)){i[r+32>>2]=i[s>>2];break}if(10==(0|o))return 0|n}else i[n>>2]=i[s>>2]}while(0);return ve(e),i[(s=t+8|0)>>2]=(0|i[s>>2])-1,0|(s=0)}function fe(t,e,n){t|=0,e|=0,n|=0;var r,o=0,s=0,l=0;(r=0|ge(40))||M(23283,23253,98,23296),i[r>>2]=i[e>>2],i[r+4>>2]=i[e+4>>2],i[r+8>>2]=i[e+8>>2],i[r+12>>2]=i[e+12>>2],i[(s=r+16|0)>>2]=i[n>>2],i[s+4>>2]=i[n+4>>2],i[s+8>>2]=i[n+8>>2],i[s+12>>2]=i[n+12>>2],i[r+32>>2]=0,s=~~(+A(+ +u(10,+ +(15-(0|i[t+12>>2])|0))*(+a[e>>3]+ +a[e+8>>3]))%+(0|i[t+4>>2]))>>>0,s=(0|i[t>>2])+(s<<2)|0,o=0|i[s>>2];do{if(o){for(;!(0|Tt(o,e)&&0|Tt(o+16|0,n));)if(s=0|i[o+32>>2],!(0|i[(o=0==(0|s)?o:s)+32>>2])){l=10;break}if(10==(0|l)){i[o+32>>2]=r;break}return ve(r),0|(l=o)}i[s>>2]=r}while(0);return i[(l=t+8|0)>>2]=1+(0|i[l>>2]),0|(l=r)}function de(t,e,n){e|=0,n|=0;var r=0,o=0;if(o=~~(+A(+ +u(10,+ +(15-(0|i[(t|=0)+12>>2])|0))*(+a[e>>3]+ +a[e+8>>3]))%+(0|i[t+4>>2]))>>>0,!(o=0|i[(0|i[t>>2])+(o<<2)>>2]))return 0|(n=0);if(!n){for(t=o;;){if(0|Tt(t,e)){r=10;break}if(!(t=0|i[t+32>>2])){t=0,r=10;break}}if(10==(0|r))return 0|t}for(t=o;;){if(0|Tt(t,e)&&0|Tt(t+16|0,n)){r=10;break}if(!(t=0|i[t+32>>2])){t=0,r=10;break}}return 10==(0|r)?0|t:0}function pe(t,e){e|=0;var n=0;if(n=~~(+A(+ +u(10,+ +(15-(0|i[(t|=0)+12>>2])|0))*(+a[e>>3]+ +a[e+8>>3]))%+(0|i[t+4>>2]))>>>0,!(t=0|i[(0|i[t>>2])+(n<<2)>>2]))return 0|(n=0);for(;;){if(0|Tt(t,e)){e=5;break}if(!(t=0|i[t+32>>2])){t=0,e=5;break}}return 5==(0|e)?0|t:0}function me(t){return 0|~~+function(t){return+ +Pe(+(t=+t))}(t=+t)}function ge(t){t|=0;var e,n=0,r=0,a=0,o=0,s=0,A=0,l=0,u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0,v=0,x=0,y=0,_=0,b=0;e=P,P=P+16|0,d=e;do{if(t>>>0<245){if(t=(c=t>>>0<11?16:t+11&-8)>>>3,3&(r=(f=0|i[5829])>>>t)|0)return a=0|i[(r=(t=23356+((n=(1&r^1)+t|0)<<1<<2)|0)+8|0)>>2],(0|(s=0|i[(o=a+8|0)>>2]))==(0|t)?i[5829]=f&~(1<<n):(i[s+12>>2]=t,i[r>>2]=s),b=n<<3,i[a+4>>2]=3|b,i[(b=a+b+4|0)>>2]=1|i[b>>2],P=e,0|(b=o);if(c>>>0>(h=0|i[5831])>>>0){if(0|r)return n=((n=r<<t&((n=2<<t)|0-n))&0-n)-1|0,s=0|i[(t=(n=23356+((a=((r=(n>>>=l=n>>>12&16)>>>5&8)|l|(s=(n>>>=r)>>>2&4)|(t=(n>>>=s)>>>1&2)|(a=(n>>>=t)>>>1&1))+(n>>>a)|0)<<1<<2)|0)+8|0)>>2],(0|(r=0|i[(l=s+8|0)>>2]))==(0|n)?(t=f&~(1<<a),i[5829]=t):(i[r+12>>2]=n,i[t>>2]=r,t=f),A=(b=a<<3)-c|0,i[s+4>>2]=3|c,i[(o=s+c|0)+4>>2]=1|A,i[s+b>>2]=A,0|h&&(a=0|i[5834],r=23356+((n=h>>>3)<<1<<2)|0,t&(n=1<<n)?n=0|i[(t=r+8|0)>>2]:(i[5829]=t|n,n=r,t=r+8|0),i[t>>2]=a,i[n+12>>2]=a,i[a+8>>2]=n,i[a+12>>2]=r),i[5831]=A,i[5834]=o,P=e,0|(b=l);if(s=0|i[5830]){for(r=(s&0-s)-1|0,r=u=0|i[23620+(((a=(r>>>=o=r>>>12&16)>>>5&8)|o|(A=(r>>>=a)>>>2&4)|(l=(r>>>=A)>>>1&2)|(u=(r>>>=l)>>>1&1))+(r>>>u)<<2)>>2],l=u,u=(-8&i[u+4>>2])-c|0;(t=0|i[r+16>>2])||(t=0|i[r+20>>2]);)r=t,l=(o=(A=(-8&i[t+4>>2])-c|0)>>>0<u>>>0)?t:l,u=o?A:u;if((A=l+c|0)>>>0>l>>>0){o=0|i[l+24>>2],n=0|i[l+12>>2];do{if((0|n)==(0|l)){if(!(n=0|i[(t=l+20|0)>>2])&&!(n=0|i[(t=l+16|0)>>2])){r=0;break}for(;;)if(r=0|i[(a=n+20|0)>>2])n=r,t=a;else{if(!(r=0|i[(a=n+16|0)>>2]))break;n=r,t=a}i[t>>2]=0,r=n}else r=0|i[l+8>>2],i[r+12>>2]=n,i[n+8>>2]=r,r=n}while(0);do{if(0|o){if(n=0|i[l+28>>2],(0|l)==(0|i[(t=23620+(n<<2)|0)>>2])){if(i[t>>2]=r,!r){i[5830]=s&~(1<<n);break}}else if(i[((0|i[(b=o+16|0)>>2])==(0|l)?b:o+20|0)>>2]=r,!r)break;i[r+24>>2]=o,0|(n=0|i[l+16>>2])&&(i[r+16>>2]=n,i[n+24>>2]=r),0|(n=0|i[l+20>>2])&&(i[r+20>>2]=n,i[n+24>>2]=r)}}while(0);return u>>>0<16?(b=u+c|0,i[l+4>>2]=3|b,i[(b=l+b+4|0)>>2]=1|i[b>>2]):(i[l+4>>2]=3|c,i[A+4>>2]=1|u,i[A+u>>2]=u,0|h&&(a=0|i[5834],r=23356+((n=h>>>3)<<1<<2)|0,(n=1<<n)&f?n=0|i[(t=r+8|0)>>2]:(i[5829]=n|f,n=r,t=r+8|0),i[t>>2]=a,i[n+12>>2]=a,i[a+8>>2]=n,i[a+12>>2]=r),i[5831]=u,i[5834]=A),P=e,0|(b=l+8|0)}f=c}else f=c}else f=c}else if(t>>>0<=4294967231)if(c=-8&(t=t+11|0),a=0|i[5830]){o=0-c|0,u=(t>>>=8)?c>>>0>16777215?31:c>>>((u=14-((l=((g=t<<(f=(t+1048320|0)>>>16&8))+520192|0)>>>16&4)|f|(u=((g<<=l)+245760|0)>>>16&2))+(g<<u>>>15)|0)+7|0)&1|u<<1:0,r=0|i[23620+(u<<2)>>2];t:do{if(r)for(t=0,l=c<<(31==(0|u)?0:25-(u>>>1)|0),s=0;;){if((A=(-8&i[r+4>>2])-c|0)>>>0<o>>>0){if(!A){t=r,o=0,g=65;break t}t=r,o=A}if(s=0==(0|(g=0|i[r+20>>2]))|(0|g)==(0|(r=0|i[r+16+(l>>>31<<2)>>2]))?s:g,!r){r=s,g=61;break}l<<=1}else r=0,t=0,g=61}while(0);if(61==(0|g)){if(0==(0|r)&0==(0|t)){if(!(t=((t=2<<u)|0-t)&a)){f=c;break}f=(t&0-t)-1|0,t=0,r=0|i[23620+(((s=(f>>>=A=f>>>12&16)>>>5&8)|A|(l=(f>>>=s)>>>2&4)|(u=(f>>>=l)>>>1&2)|(r=(f>>>=u)>>>1&1))+(f>>>r)<<2)>>2]}r?g=65:(l=t,A=o)}if(65==(0|g))for(s=r;;){if(o=(r=(f=(-8&i[s+4>>2])-c|0)>>>0<o>>>0)?f:o,t=r?s:t,(r=0|i[s+16>>2])||(r=0|i[s+20>>2]),!r){l=t,A=o;break}s=r}if(0!=(0|l)&&A>>>0<((0|i[5831])-c|0)>>>0&&(h=l+c|0)>>>0>l>>>0){s=0|i[l+24>>2],n=0|i[l+12>>2];do{if((0|n)==(0|l)){if(!(n=0|i[(t=l+20|0)>>2])&&!(n=0|i[(t=l+16|0)>>2])){n=0;break}for(;;)if(r=0|i[(o=n+20|0)>>2])n=r,t=o;else{if(!(r=0|i[(o=n+16|0)>>2]))break;n=r,t=o}i[t>>2]=0}else b=0|i[l+8>>2],i[b+12>>2]=n,i[n+8>>2]=b}while(0);do{if(s){if(t=0|i[l+28>>2],(0|l)==(0|i[(r=23620+(t<<2)|0)>>2])){if(i[r>>2]=n,!n){a&=~(1<<t),i[5830]=a;break}}else if(i[((0|i[(b=s+16|0)>>2])==(0|l)?b:s+20|0)>>2]=n,!n)break;i[n+24>>2]=s,0|(t=0|i[l+16>>2])&&(i[n+16>>2]=t,i[t+24>>2]=n),(t=0|i[l+20>>2])&&(i[n+20>>2]=t,i[t+24>>2]=n)}}while(0);t:do{if(A>>>0<16)b=A+c|0,i[l+4>>2]=3|b,i[(b=l+b+4|0)>>2]=1|i[b>>2];else{if(i[l+4>>2]=3|c,i[h+4>>2]=1|A,i[h+A>>2]=A,n=A>>>3,A>>>0<256){r=23356+(n<<1<<2)|0,(t=0|i[5829])&(n=1<<n)?n=0|i[(t=r+8|0)>>2]:(i[5829]=t|n,n=r,t=r+8|0),i[t>>2]=h,i[n+12>>2]=h,i[h+8>>2]=n,i[h+12>>2]=r;break}if(n=23620+((r=(n=A>>>8)?A>>>0>16777215?31:A>>>((r=14-((y=((b=n<<(_=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|_|(r=((b<<=y)+245760|0)>>>16&2))+(b<<r>>>15)|0)+7|0)&1|r<<1:0)<<2)|0,i[h+28>>2]=r,i[(t=h+16|0)+4>>2]=0,i[t>>2]=0,!(a&(t=1<<r))){i[5830]=a|t,i[n>>2]=h,i[h+24>>2]=n,i[h+12>>2]=h,i[h+8>>2]=h;break}n=0|i[n>>2];e:do{if((-8&i[n+4>>2]|0)!=(0|A)){for(a=A<<(31==(0|r)?0:25-(r>>>1)|0);t=0|i[(r=n+16+(a>>>31<<2)|0)>>2];){if((-8&i[t+4>>2]|0)==(0|A)){n=t;break e}a<<=1,n=t}i[r>>2]=h,i[h+24>>2]=n,i[h+12>>2]=h,i[h+8>>2]=h;break t}}while(0);b=0|i[(_=n+8|0)>>2],i[b+12>>2]=h,i[_>>2]=h,i[h+8>>2]=b,i[h+12>>2]=n,i[h+24>>2]=0}}while(0);return P=e,0|(b=l+8|0)}f=c}else f=c;else f=-1}while(0);if((r=0|i[5831])>>>0>=f>>>0)return n=r-f|0,t=0|i[5834],n>>>0>15?(b=t+f|0,i[5834]=b,i[5831]=n,i[b+4>>2]=1|n,i[t+r>>2]=n,i[t+4>>2]=3|f):(i[5831]=0,i[5834]=0,i[t+4>>2]=3|r,i[(b=t+r+4|0)>>2]=1|i[b>>2]),P=e,0|(b=t+8|0);if((A=0|i[5832])>>>0>f>>>0)return y=A-f|0,i[5832]=y,_=(b=0|i[5835])+f|0,i[5835]=_,i[_+4>>2]=1|y,i[b+4>>2]=3|f,P=e,0|(b=b+8|0);if(0|i[5947]?t=0|i[5949]:(i[5949]=4096,i[5948]=4096,i[5950]=-1,i[5951]=-1,i[5952]=0,i[5940]=0,i[5947]=-16&d^1431655768,t=4096),l=f+48|0,(c=(s=t+(u=f+47|0)|0)&(o=0-t|0))>>>0<=f>>>0)return P=e,0|(b=0);if(0|(t=0|i[5939])&&(d=(h=0|i[5937])+c|0)>>>0<=h>>>0|d>>>0>t>>>0)return P=e,0|(b=0);t:do{if(4&i[5940])n=0,g=143;else{r=0|i[5835];e:do{if(r){for(a=23764;!((d=0|i[a>>2])>>>0<=r>>>0&&(d+(0|i[a+4>>2])|0)>>>0>r>>>0);){if(!(t=0|i[a+8>>2])){g=128;break e}a=t}if((n=s-A&o)>>>0<2147483647)if((0|(t=0|De(0|n)))==((0|i[a>>2])+(0|i[a+4>>2])|0)){if(-1!=(0|t)){A=n,s=t,g=145;break t}}else a=t,g=136;else n=0}else g=128}while(0);do{if(128==(0|g))if(-1!=(0|(r=0|De(0)))&&(n=r,m=(n=(0==((m=(p=0|i[5948])+-1|0)&n|0)?0:(m+n&0-p)-n|0)+c|0)+(p=0|i[5937])|0,n>>>0>f>>>0&n>>>0<2147483647)){if(0|(d=0|i[5939])&&m>>>0<=p>>>0|m>>>0>d>>>0){n=0;break}if((0|(t=0|De(0|n)))==(0|r)){A=n,s=r,g=145;break t}a=t,g=136}else n=0}while(0);do{if(136==(0|g)){if(r=0-n|0,!(l>>>0>n>>>0&n>>>0<2147483647&-1!=(0|a))){if(-1==(0|a)){n=0;break}A=n,s=a,g=145;break t}if((t=u-n+(t=0|i[5949])&0-t)>>>0>=2147483647){A=n,s=a,g=145;break t}if(-1==(0|De(0|t))){De(0|r),n=0;break}A=t+n|0,s=a,g=145;break t}}while(0);i[5940]=4|i[5940],g=143}}while(0);if(143==(0|g)&&c>>>0<2147483647&&!(-1==(0|(y=0|De(0|c)))|1^(x=(v=(m=0|De(0))-y|0)>>>0>(f+40|0)>>>0)|y>>>0<m>>>0&-1!=(0|y)&-1!=(0|m)^1)&&(A=x?v:n,s=y,g=145),145==(0|g)){n=(0|i[5937])+A|0,i[5937]=n,n>>>0>(0|i[5938])>>>0&&(i[5938]=n),u=0|i[5835];t:do{if(u){for(n=23764;;){if((0|s)==((t=0|i[n>>2])+(r=0|i[n+4>>2])|0)){g=154;break}if(!(a=0|i[n+8>>2]))break;n=a}if(154==(0|g)&&(_=n+4|0,0==(8&i[n+12>>2]|0))&&s>>>0>u>>>0&t>>>0<=u>>>0){i[_>>2]=r+A,_=u+(y=0==(7&(y=u+8|0)|0)?0:0-y&7)|0,y=(b=(0|i[5832])+A|0)-y|0,i[5835]=_,i[5832]=y,i[_+4>>2]=1|y,i[u+b+4>>2]=40,i[5836]=i[5951];break}for(s>>>0<(0|i[5833])>>>0&&(i[5833]=s),r=s+A|0,n=23764;;){if((0|i[n>>2])==(0|r)){g=162;break}if(!(t=0|i[n+8>>2]))break;n=t}if(162==(0|g)&&0==(8&i[n+12>>2]|0)){i[n>>2]=s,i[(h=n+4|0)>>2]=(0|i[h>>2])+A,c=(h=s+(0==(7&(h=s+8|0)|0)?0:0-h&7)|0)+f|0,l=(n=r+(0==(7&(n=r+8|0)|0)?0:0-n&7)|0)-h-f|0,i[h+4>>2]=3|f;e:do{if((0|u)==(0|n))b=(0|i[5832])+l|0,i[5832]=b,i[5835]=c,i[c+4>>2]=1|b;else{if((0|i[5834])==(0|n)){b=(0|i[5831])+l|0,i[5831]=b,i[5834]=c,i[c+4>>2]=1|b,i[c+b>>2]=b;break}if(1==(3&(t=0|i[n+4>>2])|0)){A=-8&t,a=t>>>3;n:do{if(t>>>0<256){if(t=0|i[n+8>>2],(0|(r=0|i[n+12>>2]))==(0|t)){i[5829]=i[5829]&~(1<<a);break}i[t+12>>2]=r,i[r+8>>2]=t;break}s=0|i[n+24>>2],t=0|i[n+12>>2];do{if((0|t)==(0|n)){if(t=0|i[(a=(r=n+16|0)+4|0)>>2])r=a;else if(!(t=0|i[r>>2])){t=0;break}for(;;)if(a=0|i[(o=t+20|0)>>2])t=a,r=o;else{if(!(a=0|i[(o=t+16|0)>>2]))break;t=a,r=o}i[r>>2]=0}else b=0|i[n+8>>2],i[b+12>>2]=t,i[t+8>>2]=b}while(0);if(!s)break;a=23620+((r=0|i[n+28>>2])<<2)|0;do{if((0|i[a>>2])==(0|n)){if(i[a>>2]=t,0|t)break;i[5830]=i[5830]&~(1<<r);break n}if(i[((0|i[(b=s+16|0)>>2])==(0|n)?b:s+20|0)>>2]=t,!t)break n}while(0);if(i[t+24>>2]=s,0|(a=0|i[(r=n+16|0)>>2])&&(i[t+16>>2]=a,i[a+24>>2]=t),!(r=0|i[r+4>>2]))break;i[t+20>>2]=r,i[r+24>>2]=t}while(0);n=n+A|0,o=A+l|0}else o=l;if(i[(n=n+4|0)>>2]=-2&i[n>>2],i[c+4>>2]=1|o,i[c+o>>2]=o,n=o>>>3,o>>>0<256){r=23356+(n<<1<<2)|0,(t=0|i[5829])&(n=1<<n)?n=0|i[(t=r+8|0)>>2]:(i[5829]=t|n,n=r,t=r+8|0),i[t>>2]=c,i[n+12>>2]=c,i[c+8>>2]=n,i[c+12>>2]=r;break}n=o>>>8;do{if(n){if(o>>>0>16777215){a=31;break}a=o>>>((a=14-((y=((b=n<<(_=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|_|(a=((b<<=y)+245760|0)>>>16&2))+(b<<a>>>15)|0)+7|0)&1|a<<1}else a=0}while(0);if(n=23620+(a<<2)|0,i[c+28>>2]=a,i[(t=c+16|0)+4>>2]=0,i[t>>2]=0,!((t=0|i[5830])&(r=1<<a))){i[5830]=t|r,i[n>>2]=c,i[c+24>>2]=n,i[c+12>>2]=c,i[c+8>>2]=c;break}n=0|i[n>>2];n:do{if((-8&i[n+4>>2]|0)!=(0|o)){for(a=o<<(31==(0|a)?0:25-(a>>>1)|0);t=0|i[(r=n+16+(a>>>31<<2)|0)>>2];){if((-8&i[t+4>>2]|0)==(0|o)){n=t;break n}a<<=1,n=t}i[r>>2]=c,i[c+24>>2]=n,i[c+12>>2]=c,i[c+8>>2]=c;break e}}while(0);b=0|i[(_=n+8|0)>>2],i[b+12>>2]=c,i[_>>2]=c,i[c+8>>2]=b,i[c+12>>2]=n,i[c+24>>2]=0}}while(0);return P=e,0|(b=h+8|0)}for(n=23764;!((t=0|i[n>>2])>>>0<=u>>>0&&(b=t+(0|i[n+4>>2])|0)>>>0>u>>>0);)n=0|i[n+8>>2];n=(t=(t=(o=b+-47|0)+(0==(7&(t=o+8|0)|0)?0:0-t&7)|0)>>>0<(o=u+16|0)>>>0?u:t)+8|0,_=s+(y=0==(7&(y=s+8|0)|0)?0:0-y&7)|0,y=(r=A+-40|0)-y|0,i[5835]=_,i[5832]=y,i[_+4>>2]=1|y,i[s+r+4>>2]=40,i[5836]=i[5951],i[(r=t+4|0)>>2]=27,i[n>>2]=i[5941],i[n+4>>2]=i[5942],i[n+8>>2]=i[5943],i[n+12>>2]=i[5944],i[5941]=s,i[5942]=A,i[5944]=0,i[5943]=n,n=t+24|0;do{_=n,i[(n=n+4|0)>>2]=7}while((_+8|0)>>>0<b>>>0);if((0|t)!=(0|u)){if(s=t-u|0,i[r>>2]=-2&i[r>>2],i[u+4>>2]=1|s,i[t>>2]=s,n=s>>>3,s>>>0<256){r=23356+(n<<1<<2)|0,(t=0|i[5829])&(n=1<<n)?n=0|i[(t=r+8|0)>>2]:(i[5829]=t|n,n=r,t=r+8|0),i[t>>2]=u,i[n+12>>2]=u,i[u+8>>2]=n,i[u+12>>2]=r;break}if(r=23620+((a=(n=s>>>8)?s>>>0>16777215?31:s>>>((a=14-((y=((b=n<<(_=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|_|(a=((b<<=y)+245760|0)>>>16&2))+(b<<a>>>15)|0)+7|0)&1|a<<1:0)<<2)|0,i[u+28>>2]=a,i[u+20>>2]=0,i[o>>2]=0,!((n=0|i[5830])&(t=1<<a))){i[5830]=n|t,i[r>>2]=u,i[u+24>>2]=r,i[u+12>>2]=u,i[u+8>>2]=u;break}n=0|i[r>>2];e:do{if((-8&i[n+4>>2]|0)!=(0|s)){for(a=s<<(31==(0|a)?0:25-(a>>>1)|0);t=0|i[(r=n+16+(a>>>31<<2)|0)>>2];){if((-8&i[t+4>>2]|0)==(0|s)){n=t;break e}a<<=1,n=t}i[r>>2]=u,i[u+24>>2]=n,i[u+12>>2]=u,i[u+8>>2]=u;break t}}while(0);b=0|i[(_=n+8|0)>>2],i[b+12>>2]=u,i[_>>2]=u,i[u+8>>2]=b,i[u+12>>2]=n,i[u+24>>2]=0}}else 0==(0|(b=0|i[5833]))|s>>>0<b>>>0&&(i[5833]=s),i[5941]=s,i[5942]=A,i[5944]=0,i[5838]=i[5947],i[5837]=-1,i[5842]=23356,i[5841]=23356,i[5844]=23364,i[5843]=23364,i[5846]=23372,i[5845]=23372,i[5848]=23380,i[5847]=23380,i[5850]=23388,i[5849]=23388,i[5852]=23396,i[5851]=23396,i[5854]=23404,i[5853]=23404,i[5856]=23412,i[5855]=23412,i[5858]=23420,i[5857]=23420,i[5860]=23428,i[5859]=23428,i[5862]=23436,i[5861]=23436,i[5864]=23444,i[5863]=23444,i[5866]=23452,i[5865]=23452,i[5868]=23460,i[5867]=23460,i[5870]=23468,i[5869]=23468,i[5872]=23476,i[5871]=23476,i[5874]=23484,i[5873]=23484,i[5876]=23492,i[5875]=23492,i[5878]=23500,i[5877]=23500,i[5880]=23508,i[5879]=23508,i[5882]=23516,i[5881]=23516,i[5884]=23524,i[5883]=23524,i[5886]=23532,i[5885]=23532,i[5888]=23540,i[5887]=23540,i[5890]=23548,i[5889]=23548,i[5892]=23556,i[5891]=23556,i[5894]=23564,i[5893]=23564,i[5896]=23572,i[5895]=23572,i[5898]=23580,i[5897]=23580,i[5900]=23588,i[5899]=23588,i[5902]=23596,i[5901]=23596,i[5904]=23604,i[5903]=23604,_=s+(y=0==(7&(y=s+8|0)|0)?0:0-y&7)|0,y=(b=A+-40|0)-y|0,i[5835]=_,i[5832]=y,i[_+4>>2]=1|y,i[s+b+4>>2]=40,i[5836]=i[5951]}while(0);if((n=0|i[5832])>>>0>f>>>0)return y=n-f|0,i[5832]=y,_=(b=0|i[5835])+f|0,i[5835]=_,i[_+4>>2]=1|y,i[b+4>>2]=3|f,P=e,0|(b=b+8|0)}return i[(b=23312)>>2]=12,P=e,0|(b=0)}function ve(t){var e=0,n=0,r=0,a=0,o=0,s=0,A=0,l=0;if(t|=0){n=t+-8|0,a=0|i[5833],l=n+(e=-8&(t=0|i[t+-4>>2]))|0;do{if(1&t)A=n,s=n;else{if(r=0|i[n>>2],!(3&t))return;if(o=r+e|0,(s=n+(0-r)|0)>>>0<a>>>0)return;if((0|i[5834])==(0|s)){if(3!=(3&(e=0|i[(t=l+4|0)>>2])|0)){A=s,e=o;break}return i[5831]=o,i[t>>2]=-2&e,i[s+4>>2]=1|o,void(i[s+o>>2]=o)}if(n=r>>>3,r>>>0<256){if(t=0|i[s+8>>2],(0|(e=0|i[s+12>>2]))==(0|t)){i[5829]=i[5829]&~(1<<n),A=s,e=o;break}i[t+12>>2]=e,i[e+8>>2]=t,A=s,e=o;break}a=0|i[s+24>>2],t=0|i[s+12>>2];do{if((0|t)==(0|s)){if(t=0|i[(n=(e=s+16|0)+4|0)>>2])e=n;else if(!(t=0|i[e>>2])){t=0;break}for(;;)if(n=0|i[(r=t+20|0)>>2])t=n,e=r;else{if(!(n=0|i[(r=t+16|0)>>2]))break;t=n,e=r}i[e>>2]=0}else A=0|i[s+8>>2],i[A+12>>2]=t,i[t+8>>2]=A}while(0);if(a){if(e=0|i[s+28>>2],(0|i[(n=23620+(e<<2)|0)>>2])==(0|s)){if(i[n>>2]=t,!t){i[5830]=i[5830]&~(1<<e),A=s,e=o;break}}else if(i[((0|i[(A=a+16|0)>>2])==(0|s)?A:a+20|0)>>2]=t,!t){A=s,e=o;break}i[t+24>>2]=a,0|(n=0|i[(e=s+16|0)>>2])&&(i[t+16>>2]=n,i[n+24>>2]=t),(e=0|i[e+4>>2])?(i[t+20>>2]=e,i[e+24>>2]=t,A=s,e=o):(A=s,e=o)}else A=s,e=o}}while(0);if(!(s>>>0>=l>>>0)&&1&(r=0|i[(t=l+4|0)>>2])){if(2&r)i[t>>2]=-2&r,i[A+4>>2]=1|e,i[s+e>>2]=e,a=e;else{if((0|i[5835])==(0|l)){if(l=(0|i[5832])+e|0,i[5832]=l,i[5835]=A,i[A+4>>2]=1|l,(0|A)!=(0|i[5834]))return;return i[5834]=0,void(i[5831]=0)}if((0|i[5834])==(0|l))return l=(0|i[5831])+e|0,i[5831]=l,i[5834]=s,i[A+4>>2]=1|l,void(i[s+l>>2]=l);a=(-8&r)+e|0,n=r>>>3;do{if(r>>>0<256){if(e=0|i[l+8>>2],(0|(t=0|i[l+12>>2]))==(0|e)){i[5829]=i[5829]&~(1<<n);break}i[e+12>>2]=t,i[t+8>>2]=e;break}o=0|i[l+24>>2],t=0|i[l+12>>2];do{if((0|t)==(0|l)){if(t=0|i[(n=(e=l+16|0)+4|0)>>2])e=n;else if(!(t=0|i[e>>2])){n=0;break}for(;;)if(n=0|i[(r=t+20|0)>>2])t=n,e=r;else{if(!(n=0|i[(r=t+16|0)>>2]))break;t=n,e=r}i[e>>2]=0,n=t}else n=0|i[l+8>>2],i[n+12>>2]=t,i[t+8>>2]=n,n=t}while(0);if(0|o){if(t=0|i[l+28>>2],(0|i[(e=23620+(t<<2)|0)>>2])==(0|l)){if(i[e>>2]=n,!n){i[5830]=i[5830]&~(1<<t);break}}else if(i[((0|i[(r=o+16|0)>>2])==(0|l)?r:o+20|0)>>2]=n,!n)break;i[n+24>>2]=o,0|(e=0|i[(t=l+16|0)>>2])&&(i[n+16>>2]=e,i[e+24>>2]=n),0|(t=0|i[t+4>>2])&&(i[n+20>>2]=t,i[t+24>>2]=n)}}while(0);if(i[A+4>>2]=1|a,i[s+a>>2]=a,(0|A)==(0|i[5834]))return void(i[5831]=a)}if(t=a>>>3,a>>>0<256)return n=23356+(t<<1<<2)|0,(e=0|i[5829])&(t=1<<t)?t=0|i[(e=n+8|0)>>2]:(i[5829]=e|t,t=n,e=n+8|0),i[e>>2]=A,i[t+12>>2]=A,i[A+8>>2]=t,void(i[A+12>>2]=n);t=23620+((r=(t=a>>>8)?a>>>0>16777215?31:a>>>((r=14-((o=((l=t<<(s=(t+1048320|0)>>>16&8))+520192|0)>>>16&4)|s|(r=((l<<=o)+245760|0)>>>16&2))+(l<<r>>>15)|0)+7|0)&1|r<<1:0)<<2)|0,i[A+28>>2]=r,i[A+20>>2]=0,i[A+16>>2]=0,e=0|i[5830],n=1<<r;t:do{if(e&n){t=0|i[t>>2];e:do{if((-8&i[t+4>>2]|0)!=(0|a)){for(r=a<<(31==(0|r)?0:25-(r>>>1)|0);e=0|i[(n=t+16+(r>>>31<<2)|0)>>2];){if((-8&i[e+4>>2]|0)==(0|a)){t=e;break e}r<<=1,t=e}i[n>>2]=A,i[A+24>>2]=t,i[A+12>>2]=A,i[A+8>>2]=A;break t}}while(0);l=0|i[(s=t+8|0)>>2],i[l+12>>2]=A,i[s>>2]=A,i[A+8>>2]=l,i[A+12>>2]=t,i[A+24>>2]=0}else i[5830]=e|n,i[t>>2]=A,i[A+24>>2]=t,i[A+12>>2]=A,i[A+8>>2]=A}while(0);if(l=(0|i[5837])-1|0,i[5837]=l,!(0|l)){for(t=23772;t=0|i[t>>2];)t=t+8|0;i[5837]=-1}}}}function xe(t,e){e|=0;var n=0;return(t|=0)?(n=0|x(e,t),(e|t)>>>0>65535&&(n=(0|(n>>>0)/(t>>>0))==(0|e)?n:-1)):n=0,(t=0|ge(n))&&3&i[t+-4>>2]?(qe(0|t,0,0|n),0|t):0|t}function ye(t,e,n,r){return 0|(b(0|(r=(e|=0)-(r|=0)-((n|=0)>>>0>(t|=0)>>>0|0)>>>0)),t-n>>>0|0)}function _e(t){return 0|((t|=0)?31-(0|_(t^t-1))|0:32)}function be(t,e,n,r,a){a|=0;var o=0,s=0,A=0,l=0,u=0,c=0,h=0,f=0,d=0,p=0;if(c=t|=0,s=n|=0,A=f=r|=0,!(u=l=e|=0))return o=0!=(0|a),A?o?(i[a>>2]=0|t,i[a+4>>2]=0&e,a=0,0|(b(0|(f=0)),a)):(a=0,0|(b(0|(f=0)),a)):(o&&(i[a>>2]=(c>>>0)%(s>>>0),i[a+4>>2]=0),a=(c>>>0)/(s>>>0)>>>0,0|(b(0|(f=0)),a));o=0==(0|A);do{if(s){if(!o){if((o=(0|_(0|A))-(0|_(0|u))|0)>>>0<=31){s=h=o+1|0,t=c>>>(h>>>0)&(e=o-31>>31)|u<<(A=31-o|0),e&=u>>>(h>>>0),o=0,A=c<<A;break}return a?(i[a>>2]=0|t,i[a+4>>2]=l|0&e,a=0,0|(b(0|(f=0)),a)):(a=0,0|(b(0|(f=0)),a))}if((o=s-1|0)&s|0){s=A=33+(0|_(0|s))-(0|_(0|u))|0,t=(h=32-A|0)-1>>31&u>>>((d=A-32|0)>>>0)|(u<<h|c>>>(A>>>0))&(e=d>>31),e&=u>>>(A>>>0),o=c<<(p=64-A|0)&(l=h>>31),A=(u<<p|c>>>(d>>>0))&l|c<<h&A-33>>31;break}return 0|a&&(i[a>>2]=o&c,i[a+4>>2]=0),1==(0|s)?(p=0|t,0|(b(0|(d=l|0&e)),p)):(d=u>>>((p=0|_e(0|s))>>>0)|0,p=u<<32-p|c>>>(p>>>0)|0,0|(b(0|d),p))}if(o)return 0|a&&(i[a>>2]=(u>>>0)%(s>>>0),i[a+4>>2]=0),p=(u>>>0)/(s>>>0)>>>0,0|(b(0|(d=0)),p);if(!c)return 0|a&&(i[a>>2]=0,i[a+4>>2]=(u>>>0)%(A>>>0)),p=(u>>>0)/(A>>>0)>>>0,0|(b(0|(d=0)),p);if(!((o=A-1|0)&A))return 0|a&&(i[a>>2]=0|t,i[a+4>>2]=o&u|0&e),d=0,p=u>>>((0|_e(0|A))>>>0),0|(b(0|d),p);if((o=(0|_(0|A))-(0|_(0|u))|0)>>>0<=30){s=e=o+1|0,t=u<<(A=31-o|0)|c>>>(e>>>0),e=u>>>(e>>>0),o=0,A=c<<A;break}return a?(i[a>>2]=0|t,i[a+4>>2]=l|0&e,p=0,0|(b(0|(d=0)),p)):(p=0,0|(b(0|(d=0)),p))}while(0);if(s){u=0|function(t,e,n,r){return 0|(b((e|=0)+(r|=0)+((n=(t|=0)+(n|=0)>>>0)>>>0<t>>>0|0)>>>0|0),0|n)}(0|(h=0|n),0|(c=f|0&r),-1,-1),n=0|w(),l=A,A=0;do{r=l,l=o>>>31|l<<1,o=A|o<<1,ye(0|u,0|n,0|(r=t<<1|r>>>31|0),0|(f=t>>>31|e<<1|0)),A=1&(d=(p=0|w())>>31|((0|p)<0?-1:0)<<1),t=0|ye(0|r,0|f,d&h|0,(((0|p)<0?-1:0)>>31|((0|p)<0?-1:0)<<1)&c|0),e=0|w(),s=s-1|0}while(0!=(0|s));u=l,l=0}else u=A,l=0,A=0;return s=0,0|a&&(i[a>>2]=t,i[a+4>>2]=e),p=-2&(o<<1|0)|A,0|(b(0|(d=(0|o)>>>31|(u|s)<<1|0&(s<<1|o>>>31)|l)),p)}function we(t,e,n,r){var a,o;return o=P,P=P+16|0,be(t|=0,e|=0,n|=0,r|=0,a=0|o),P=o,0|(b(0|i[a+4>>2]),0|i[a>>2])}function Me(t,e,n){return t|=0,e|=0,(0|(n|=0))<32?(b(e>>>n|0),t>>>n|(e&(1<<n)-1)<<32-n):(b(0),e>>>n-32|0)}function Se(t,e,n){return t|=0,e|=0,(0|(n|=0))<32?(b(e<<n|(t&(1<<n)-1<<32-n)>>>32-n|0),t<<n):(b(t<<n-32|0),0)}function Ee(t,e){return e=+e,(t=+t)!=t?+e:e!=e?+t:+y(+t,+e)}function Te(t){return(t=+t)>=0?+s(t+.5):+v(t-.5)}function Ce(t,e,n){t|=0,e|=0;var a,o,s=0;if((0|(n|=0))>=8192)return T(0|t,0|e,0|n),0|t;if(o=0|t,a=t+n|0,(3&t)==(3&e)){for(;3&t;){if(!n)return 0|o;r[t>>0]=0|r[e>>0],t=t+1|0,e=e+1|0,n=n-1|0}for(s=(n=-4&a|0)-64|0;(0|t)<=(0|s);)i[t>>2]=i[e>>2],i[t+4>>2]=i[e+4>>2],i[t+8>>2]=i[e+8>>2],i[t+12>>2]=i[e+12>>2],i[t+16>>2]=i[e+16>>2],i[t+20>>2]=i[e+20>>2],i[t+24>>2]=i[e+24>>2],i[t+28>>2]=i[e+28>>2],i[t+32>>2]=i[e+32>>2],i[t+36>>2]=i[e+36>>2],i[t+40>>2]=i[e+40>>2],i[t+44>>2]=i[e+44>>2],i[t+48>>2]=i[e+48>>2],i[t+52>>2]=i[e+52>>2],i[t+56>>2]=i[e+56>>2],i[t+60>>2]=i[e+60>>2],t=t+64|0,e=e+64|0;for(;(0|t)<(0|n);)i[t>>2]=i[e>>2],t=t+4|0,e=e+4|0}else for(n=a-4|0;(0|t)<(0|n);)r[t>>0]=0|r[e>>0],r[t+1>>0]=0|r[e+1>>0],r[t+2>>0]=0|r[e+2>>0],r[t+3>>0]=0|r[e+3>>0],t=t+4|0,e=e+4|0;for(;(0|t)<(0|a);)r[t>>0]=0|r[e>>0],t=t+1|0,e=e+1|0;return 0|o}function qe(t,e,n){e|=0;var a,o=0,s=0,A=0;if(a=(t|=0)+(n|=0)|0,e&=255,(0|n)>=67){for(;3&t;)r[t>>0]=e,t=t+1|0;for(A=e|e<<8|e<<16|e<<24,s=(o=-4&a|0)-64|0;(0|t)<=(0|s);)i[t>>2]=A,i[t+4>>2]=A,i[t+8>>2]=A,i[t+12>>2]=A,i[t+16>>2]=A,i[t+20>>2]=A,i[t+24>>2]=A,i[t+28>>2]=A,i[t+32>>2]=A,i[t+36>>2]=A,i[t+40>>2]=A,i[t+44>>2]=A,i[t+48>>2]=A,i[t+52>>2]=A,i[t+56>>2]=A,i[t+60>>2]=A,t=t+64|0;for(;(0|t)<(0|o);)i[t>>2]=A,t=t+4|0}for(;(0|t)<(0|a);)r[t>>0]=e,t=t+1|0;return a-n|0}function Pe(t){return(t=+t)>=0?+s(t+.5):+v(t-.5)}function De(t){t|=0;var e,n,r;return r=0|E(),(0|t)>0&(0|(e=(n=0|i[o>>2])+t|0))<(0|n)|(0|e)<0?(q(0|e),S(12),-1):(0|e)>(0|r)&&!(0|C(0|e))?(S(12),-1):(i[o>>2]=e,0|n)}return{___uremdi3:we,_bitshift64Lshr:Me,_bitshift64Shl:Se,_calloc:xe,_cellAreaKm2:function(t,e){var n,r,a,o=0;if(a=P,P=P+192|0,r=a,jt(t|=0,e|=0,n=a+168|0),Vt(t,e,r),(0|(e=0|i[r>>2]))>0){if(o=+qt(r+8|0,r+8+((1!=(0|e)&1)<<4)|0,n)+0,1!=(0|e)){t=1;do{o+=+qt(r+8+(t<<4)|0,r+8+(((0|(t=t+1|0))%(0|e)|0)<<4)|0,n)}while((0|t)<(0|e))}}else o=0;return P=a,6371.007180918475*o*6371.007180918475},_cellAreaM2:function(t,e){var n,r,a,o=0;if(a=P,P=P+192|0,r=a,jt(t|=0,e|=0,n=a+168|0),Vt(t,e,r),(0|(e=0|i[r>>2]))>0){if(o=+qt(r+8|0,r+8+((1!=(0|e)&1)<<4)|0,n)+0,1!=(0|e)){t=1;do{o+=+qt(r+8+(t<<4)|0,r+8+(((0|(t=t+1|0))%(0|e)|0)<<4)|0,n)}while((0|t)<(0|e))}}else o=0;return P=a,6371.007180918475*o*6371.007180918475*1e3*1e3},_cellAreaRads2:function(t,e){var n,r,a,o=0;if(a=P,P=P+192|0,r=a,jt(t|=0,e|=0,n=a+168|0),Vt(t,e,r),(0|(e=0|i[r>>2]))<=0)return P=a,+(o=0);if(o=+qt(r+8|0,r+8+((1!=(0|e)&1)<<4)|0,n)+0,1==(0|e))return P=a,+o;t=1;do{o+=+qt(r+8+(t<<4)|0,r+8+(((0|(t=t+1|0))%(0|e)|0)<<4)|0,n)}while((0|t)<(0|e));return P=a,+o},_compact:function(t,e,n){e|=0;var r,a=0,o=0,s=0,A=0,l=0,u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0,v=0,x=0,y=0,_=0,b=0,M=0,S=0,E=0;if(!(n|=0))return 0|(S=0);if(a=0|i[(o=t|=0)>>2],!0&0==(15728640&(o=0|i[o+4>>2])|0)){if((0|n)<=0)return 0|(S=0);if(i[(S=e)>>2]=a,i[S+4>>2]=o,1==(0|n))return 0|(S=0);a=1;do{M=0|i[(b=t+(a<<3)|0)+4>>2],i[(S=e+(a<<3)|0)>>2]=i[b>>2],i[S+4>>2]=M,a=a+1|0}while((0|a)!=(0|n));return 0|(a=0)}if(!(M=0|ge(b=n<<3)))return 0|(S=-3);if(Ce(0|M,0|t,0|b),!(r=0|xe(n,8)))return ve(M),0|(S=-3);a=n;t:for(;;){y=0|Me(0|(h=0|i[(A=M)>>2]),0|(A=0|i[A+4>>2]),52),w(),_=(y&=15)+-1|0,x=(0|a)>0;e:do{if(x){if(v=((0|a)<0)<<31>>31,m=0|Se(0|_,0,52),g=0|w(),_>>>0>15)for(o=0,t=h,n=A;;){if(!(0==(0|t)&0==(0|n))){if(s=0|Me(0|t,0|n,52),w(),l=(0|(s&=15))<(0|_),s=(0|s)==(0|_),n=0|we(0|(c=l?0:s?t:0),0|(t=l?0:s?n:0),0|a,0|v),w(),0==(0|(u=0|i[(l=s=r+(n<<3)|0)>>2]))&0==(0|(l=0|i[l+4>>2])))n=c;else for(m=0,p=n,d=l,n=c;;){if((0|m)>(0|a)){S=41;break t}if((0|u)==(0|n)&(-117440513&d|0)==(0|t)){c=0|Me(0|u,0|d,56),w(),f=(c&=7)+1|0,g=0|Me(0|u,0|d,45),w();n:do{if(0|B(127&g)){if(u=0|Me(0|u,0|d,52),w(),!(u&=15)){l=6;break}for(l=1;;){if(!(0==((g=0|Se(7,0,3*(15-l|0)|0))&n|0)&0==((0|w())&t|0))){l=7;break n}if(!(l>>>0<u>>>0)){l=6;break}l=l+1|0}}else l=7}while(0);if((c+2|0)>>>0>l>>>0){S=51;break t}g=0|Se(0|f,0,56),t=0|w()|-117440513&t,i[(l=s)>>2]=0,i[l+4>>2]=0,l=p,n|=g}else l=(p+1|0)%(0|a)|0;if(0==(0|(u=0|i[(d=s=r+(l<<3)|0)>>2]))&0==(0|(d=0|i[d+4>>2])))break;m=m+1|0,p=l}i[(g=s)>>2]=n,i[g+4>>2]=t}if((0|(o=o+1|0))>=(0|a))break e;t=0|i[(n=M+(o<<3)|0)>>2],n=0|i[n+4>>2]}for(o=0,t=h,n=A;;){if(!(0==(0|t)&0==(0|n))){if(l=0|Me(0|t,0|n,52),w(),(0|(l&=15))>=(0|_)){if((0|l)!=(0|_)&&(t|=m,n=-15728641&n|g,l>>>0>=y>>>0)){s=_;do{p=0|Se(7,0,3*(14-s|0)|0),s=s+1|0,t|=p,n=0|w()|n}while(s>>>0<l>>>0)}}else t=0,n=0;if(l=0|we(0|t,0|n,0|a,0|v),w(),!(0==(0|(c=0|i[(u=s=r+(l<<3)|0)>>2]))&0==(0|(u=0|i[u+4>>2]))))for(p=0;;){if((0|p)>(0|a)){S=41;break t}if((0|c)==(0|t)&(-117440513&u|0)==(0|n)){f=0|Me(0|c,0|u,56),w(),d=(f&=7)+1|0,E=0|Me(0|c,0|u,45),w();n:do{if(0|B(127&E)){if(c=0|Me(0|c,0|u,52),w(),!(c&=15)){u=6;break}for(u=1;;){if(!(0==((E=0|Se(7,0,3*(15-u|0)|0))&t|0)&0==((0|w())&n|0))){u=7;break n}if(!(u>>>0<c>>>0)){u=6;break}u=u+1|0}}else u=7}while(0);if((f+2|0)>>>0>u>>>0){S=51;break t}E=0|Se(0|d,0,56),n=0|w()|-117440513&n,i[(d=s)>>2]=0,i[d+4>>2]=0,t|=E}else l=(l+1|0)%(0|a)|0;if(0==(0|(c=0|i[(u=s=r+(l<<3)|0)>>2]))&0==(0|(u=0|i[u+4>>2])))break;p=p+1|0}i[(E=s)>>2]=t,i[E+4>>2]=n}if((0|(o=o+1|0))>=(0|a))break e;t=0|i[(n=M+(o<<3)|0)>>2],n=0|i[n+4>>2]}}}while(0);if((a+5|0)>>>0<11){S=99;break}if(!(g=0|xe((0|a)/6|0,8))){S=58;break}e:do{if(x){p=0,d=0;do{if(!(0==(0|(o=0|i[(t=l=r+(p<<3)|0)>>2]))&0==(0|(t=0|i[t+4>>2])))){u=0|Me(0|o,0|t,56),w(),n=(u&=7)+1|0,c=-117440513&t,E=0|Me(0|o,0|t,45),w();n:do{if(0|B(127&E)){if(f=0|Me(0|o,0|t,52),w(),0|(f&=15))for(s=1;;){if(!(0==(o&(E=0|Se(7,0,3*(15-s|0)|0))|0)&0==(c&(0|w())|0)))break n;if(!(s>>>0<f>>>0))break;s=s+1|0}o|=t=0|Se(0|n,0,56),t=0|w()|c,i[(n=l)>>2]=o,i[n+4>>2]=t,n=u+2|0}}while(0);7==(0|n)&&(i[(E=g+(d<<3)|0)>>2]=o,i[E+4>>2]=-117440513&t,d=d+1|0)}p=p+1|0}while((0|p)!=(0|a));if(x){if(m=((0|a)<0)<<31>>31,f=0|Se(0|_,0,52),p=0|w(),_>>>0>15)for(t=0,o=0;;){do{if(!(0==(0|h)&0==(0|A))){for(u=0|Me(0|h,0|A,52),w(),s=(0|(u&=15))<(0|_),u=(0|u)==(0|_),s=0|we(0|(l=s?0:u?h:0),0|(u=s?0:u?A:0),0|a,0|m),w(),n=0;;){if((0|n)>(0|a)){S=98;break t}if((-117440513&(c=0|i[(E=r+(s<<3)|0)+4>>2])|0)==(0|u)&&(0|i[E>>2])==(0|l)){S=70;break}if((0|i[(E=r+((s=(s+1|0)%(0|a)|0)<<3)|0)>>2])==(0|l)&&(0|i[E+4>>2])==(0|u))break;n=n+1|0}if(70==(0|S)&&(S=0,!0&100663296==(117440512&c|0)))break;i[(E=e+(o<<3)|0)>>2]=h,i[E+4>>2]=A,o=o+1|0}}while(0);if((0|(t=t+1|0))>=(0|a)){a=d;break e}h=0|i[(A=M+(t<<3)|0)>>2],A=0|i[A+4>>2]}for(t=0,o=0;;){do{if(!(0==(0|h)&0==(0|A))){if(u=0|Me(0|h,0|A,52),w(),(0|(u&=15))>=(0|_))if((0|u)!=(0|_))if(n=h|f,s=-15728641&A|p,u>>>0<y>>>0)u=s;else{l=_;do{E=0|Se(7,0,3*(14-l|0)|0),l=l+1|0,n|=E,s=0|w()|s}while(l>>>0<u>>>0);u=s}else n=h,u=A;else n=0,u=0;for(l=0|we(0|n,0|u,0|a,0|m),w(),s=0;;){if((0|s)>(0|a)){S=98;break t}if((-117440513&(c=0|i[(E=r+(l<<3)|0)+4>>2])|0)==(0|u)&&(0|i[E>>2])==(0|n)){S=93;break}if((0|i[(E=r+((l=(l+1|0)%(0|a)|0)<<3)|0)>>2])==(0|n)&&(0|i[E+4>>2])==(0|u))break;s=s+1|0}if(93==(0|S)&&(S=0,!0&100663296==(117440512&c|0)))break;i[(E=e+(o<<3)|0)>>2]=h,i[E+4>>2]=A,o=o+1|0}}while(0);if((0|(t=t+1|0))>=(0|a)){a=d;break e}h=0|i[(A=M+(t<<3)|0)>>2],A=0|i[A+4>>2]}}else o=0,a=d}else o=0,a=0}while(0);if(qe(0|r,0,0|b),Ce(0|M,0|g,a<<3|0),ve(g),!a)break;e=e+(o<<3)|0}return 41==(0|S)?(ve(M),ve(r),0|(E=-1)):51==(0|S)?(ve(M),ve(r),0|(E=-2)):58==(0|S)?(ve(M),ve(r),0|(E=-3)):98==(0|S)?(ve(g),ve(M),ve(r),0|(E=-1)):(99==(0|S)&&Ce(0|e,0|M,a<<3|0),ve(M),ve(r),0|(E=0))},_destroyLinkedPolygon:function(t){var e=0,n=0,r=0,a=0;if(t|=0)for(r=1;;){if(0|(e=0|i[t>>2]))do{if(0|(n=0|i[e>>2]))do{a=n,n=0|i[n+16>>2],ve(a)}while(0!=(0|n));a=e,e=0|i[e+8>>2],ve(a)}while(0!=(0|e));if(e=t,t=0|i[t+8>>2],r||ve(e),!t)break;r=0}},_edgeLengthKm:function(t){return+ +a[20752+((t|=0)<<3)>>3]},_edgeLengthM:function(t){return+ +a[20880+((t|=0)<<3)>>3]},_emscripten_replace_memory:function(t){return r=new Int8Array(t),i=new Int32Array(t),a=new Float64Array(t),n=t,!0},_exactEdgeLengthKm:function(t,e){var n,r,o=0,s=0,A=0,u=0,f=0,d=0;if(r=P,P=P+176|0,Yt(t|=0,e|=0,n=r),(0|(t=0|i[n>>2]))<=1)return P=r,+(A=0);e=t+-1|0,t=0,o=0,s=+a[n+8>>3],A=+a[n+16>>3];do{f=s,s=+a[n+8+((t=t+1|0)<<4)>>3],d=+h(.5*(s-f)),u=A,A=+a[n+8+(t<<4)+8>>3],u=d*d+(u=+h(.5*(A-u)))*(+c(+f)*+c(+s)*u),o+=2*+g(+ +l(+u),+ +l(+(1-u)))}while((0|t)!=(0|e));return P=r,+(d=6371.007180918475*o)},_exactEdgeLengthM:function(t,e){var n,r,o=0,s=0,A=0,u=0,f=0,d=0;if(r=P,P=P+176|0,Yt(t|=0,e|=0,n=r),(0|(t=0|i[n>>2]))<=1)return P=r,+(A=0);e=t+-1|0,t=0,o=0,s=+a[n+8>>3],A=+a[n+16>>3];do{f=s,s=+a[n+8+((t=t+1|0)<<4)>>3],d=+h(.5*(s-f)),u=A,A=+a[n+8+(t<<4)+8>>3],u=d*d+(u=+h(.5*(A-u)))*(+c(+f)*+c(+s)*u),o+=2*+g(+ +l(+u),+ +l(+(1-u)))}while((0|t)!=(0|e));return P=r,+(d=6371.007180918475*o*1e3)},_exactEdgeLengthRads:function(t,e){var n,r,o=0,s=0,A=0,u=0,f=0,d=0;if(r=P,P=P+176|0,Yt(t|=0,e|=0,n=r),(0|(t=0|i[n>>2]))<=1)return P=r,+(A=0);e=t+-1|0,t=0,o=0,s=+a[n+8>>3],A=+a[n+16>>3];do{f=s,s=+a[n+8+((t=t+1|0)<<4)>>3],d=+h(.5*(s-f)),u=A,A=+a[n+8+(t<<4)+8>>3],u=d*d+(u=+h(.5*(A-u)))*(+c(+s)*+c(+f)*u),o+=2*+g(+ +l(+u),+ +l(+(1-u)))}while((0|t)<(0|e));return P=r,+o},_experimentalH3ToLocalIj:function(t,e,n,r,i){var a,o;return i|=0,o=P,P=P+16|0,(t=0|$t(t|=0,e|=0,n|=0,r|=0,a=o))||(ft(a,i),t=0),P=o,0|t},_experimentalLocalIjToH3:function(t,e,n,r){var i,a;return t|=0,e|=0,r|=0,i=P,P=P+16|0,dt(n|=0,a=i),r=0|te(t,e,a,r),P=i,0|r},_free:ve,_geoToH3:Ft,_getDestinationH3IndexFromUnidirectionalEdge:function(t,e){t|=0;var n,r,a=0;return n=P,P=P+16|0,a=n,!0&268435456==(2013265920&(e|=0)|0)?(r=0|Me(0|t,0|e,56),w(),i[a>>2]=0,a=0|I(t,-2130706433&e|134217728,7&r,a),e=0|w(),b(0|e),P=n,0|a):(a=0,b(0|(e=0)),P=n,0|a)},_getH3IndexesFromUnidirectionalEdge:function(t,e,n){t|=0;var r,a,o,s,A=0;o=P,P=P+16|0,r=o,s=!0&268435456==(2013265920&(e|=0)|0),a=-2130706433&e|134217728,i[(A=n|=0)>>2]=s?t:0,i[A+4>>2]=s?a:0,s?(e=0|Me(0|t,0|e,56),w(),i[r>>2]=0,t=0|I(t,a,7&e,r),e=0|w()):(t=0,e=0),i[(A=n+8|0)>>2]=t,i[A+4>>2]=e,P=o},_getH3UnidirectionalEdge:function(t,e,n,r){var a,o,s=0,A=0,l=0,u=0,c=0;if(o=P,P=P+16|0,a=o,!(0|Qt(t|=0,e|=0,n|=0,r|=0)))return u=0,b(0|(l=0)),P=o,0|u;for(l=-2130706433&e,s=(s=0==(0|It(t,e)))?1:2;i[a>>2]=0,A=s+1|0,!((0|(c=0|I(t,e,s,a)))==(0|n)&(0|w())==(0|r));){if(!(A>>>0<7)){s=0,t=0,u=6;break}s=A}return 6==(0|u)?(b(0|s),P=o,0|t):(c=0|Se(0|s,0,56),u=0|l|w()|268435456,c|=t,b(0|u),P=o,0|c)},_getH3UnidirectionalEdgeBoundary:Yt,_getH3UnidirectionalEdgesFromHexagon:function(t,e,n){n|=0;var r,a=0;r=0==(0|It(t|=0,e|=0)),e&=-2130706433,i[(a=n)>>2]=r?t:0,i[a+4>>2]=r?285212672|e:0,i[(a=n+8|0)>>2]=t,i[a+4>>2]=301989888|e,i[(a=n+16|0)>>2]=t,i[a+4>>2]=318767104|e,i[(a=n+24|0)>>2]=t,i[a+4>>2]=335544320|e,i[(a=n+32|0)>>2]=t,i[a+4>>2]=352321536|e,i[(n=n+40|0)>>2]=t,i[n+4>>2]=369098752|e},_getOriginH3IndexFromUnidirectionalEdge:function(t,e){var n;return t|=0,b(0|((n=!0&268435456==(2013265920&(e|=0)|0))?-2130706433&e|134217728:0)),0|(n?t:0)},_getPentagonIndexes:Wt,_getRes0Indexes:function(t){t|=0;var e=0,n=0,r=0;e=0;do{Se(0|e,0,45),r=134225919|w(),i[(n=t+(e<<3)|0)>>2]=-1,i[n+4>>2]=r,e=e+1|0}while(122!=(0|e))},_h3Distance:function(t,e,n,r){var i,a,o;return n|=0,r|=0,o=P,P=P+32|0,a=o,t=0==(0|$t(t|=0,e|=0,t,e,i=o+12|0))&&0==(0|$t(t,e,n,r,a))?0|ht(i,a):-1,P=o,0|t},_h3GetBaseCell:Pt,_h3GetFaces:function t(e,n,r){r|=0;var a,o=0,s=0,A=0,l=0,u=0,c=0,h=0,f=0;a=P,P=P+128|0,h=a+112|0,A=a+96|0,f=a,s=0|Me(0|(e|=0),0|(n|=0),52),w(),u=15&s,i[h>>2]=u,l=0|Me(0|e,0|n,45),w(),l&=127;t:do{if(0|B(l)){if(0|u)for(o=1;;){if(!(0==((c=0|Se(7,0,3*(15-o|0)|0))&e|0)&0==((0|w())&n|0))){s=0;break t}if(!(o>>>0<u>>>0))break;o=o+1|0}if(!(1&s))return c=0|Se(u+1|0,0,52),f=0|w()|-15728641&n,t((c|e)&~(h=0|Se(7,0,3*(14-u|0)|0)),f&~(0|w()),r),void(P=a);s=1}else s=0}while(0);Ht(e,n,A),s?(_t(A,h,f),c=5):(St(A,h,f),c=6);t:do{if(0|B(l))if(u)for(o=1;;){if(!(0==((l=0|Se(7,0,3*(15-o|0)|0))&e|0)&0==((0|w())&n|0))){o=8;break t}if(!(o>>>0<u>>>0)){o=20;break}o=o+1|0}else o=20;else o=8}while(0);if(qe(0|r,-1,0|o),s){s=0;do{for(wt(A=f+(s<<4)|0,0|i[h>>2]),A=0|i[A>>2],o=0;!(-1==(0|(u=0|i[(l=r+(o<<2)|0)>>2]))|(0|u)==(0|A));)o=o+1|0;i[l>>2]=A,s=s+1|0}while((0|s)!=(0|c))}else{s=0;do{for(bt(A=f+(s<<4)|0,0|i[h>>2],0,1),A=0|i[A>>2],o=0;!(-1==(0|(u=0|i[(l=r+(o<<2)|0)>>2]))|(0|u)==(0|A));)o=o+1|0;i[l>>2]=A,s=s+1|0}while((0|s)!=(0|c))}P=a},_h3GetResolution:function(t,e){return e=0|Me(0|(t|=0),0|(e|=0),52),w(),15&e|0},_h3IndexesAreNeighbors:Qt,_h3IsPentagon:It,_h3IsResClassIII:function(t,e){return e=0|Me(0|(t|=0),0|(e|=0),52),w(),1&e|0},_h3IsValid:Dt,_h3Line:function(t,e,n,r,a){n|=0,r|=0,a|=0;var o,s=0,l=0,u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0,v=0,x=0,y=0,_=0,b=0,w=0,M=0;if(o=P,P=P+48|0,l=o+12|0,w=o,0==(0|$t(t|=0,e|=0,t,e,s=o+24|0))&&0==(0|$t(t,e,n,r,l))){if((0|(b=0|ht(s,l)))<0)return P=o,0|(w=b);for(i[s>>2]=0,i[s+4>>2]=0,i[s+8>>2]=0,i[l>>2]=0,i[l+4>>2]=0,i[l+8>>2]=0,$t(t,e,t,e,s),$t(t,e,n,r,l),pt(s),pt(l),b?(m=+(0|b),_=s,n=f=0|i[s>>2],r=d=0|i[(x=s+4|0)>>2],s=p=0|i[(y=s+8|0)>>2],g=+((0|i[l>>2])-f|0)/m,v=+((0|i[l+4>>2])-d|0)/m,m=+((0|i[l+8>>2])-p|0)/m):(x=r=s+4|0,y=p=s+8|0,_=s,n=0|i[s>>2],r=0|i[r>>2],s=0|i[p>>2],g=0,v=0,m=0),i[w>>2]=n,i[(p=w+4|0)>>2]=r,i[(d=w+8|0)>>2]=s,f=0;;){M=g*(c=+(0|f))+ +(0|n),u=v*c+ +(0|i[x>>2]),c=m*c+ +(0|i[y>>2]),r=~~+Te(+M),l=~~+Te(+u),n=~~+Te(+c),M=+A(+(+(0|r)-M)),u=+A(+(+(0|l)-u)),c=+A(+(+(0|n)-c));do{if(!(M>u&M>c)){if(h=0-r|0,u>c){s=h-n|0;break}s=l,n=h-l|0;break}r=0-(l+n)|0,s=l}while(0);if(i[w>>2]=r,i[p>>2]=s,i[d>>2]=n,mt(w),te(t,e,w,a+(f<<3)|0),(0|f)==(0|b))break;f=f+1|0,n=0|i[_>>2]}return P=o,0|(w=0)}return P=o,0|(w=-1)},_h3LineSize:function(t,e,n,r){var i,a,o;return n|=0,r|=0,o=P,P=P+32|0,a=o,t=0==(0|$t(t|=0,e|=0,t,e,i=o+12|0))&&0==(0|$t(t,e,n,r,a))?0|ht(i,a):-1,P=o,(t>>>31^1)+t|0},_h3SetToLinkedGeo:function(t,e,n){n|=0;var r,a,o,s=0;if(o=P,P=P+32|0,r=o,function(t,e,n){t|=0,n|=0;var r,a,o=0,s=0,A=0,l=0,u=0;if(a=P,P=P+176|0,r=a,(0|(e|=0))<1)return le(n,0,0),void(P=a);l=0|Me(0|i[(l=t)>>2],0|i[l+4>>2],52),w(),le(n,(0|e)>6?e:6,15&l),l=0;do{if(Vt(0|i[(o=t+(l<<3)|0)>>2],0|i[o+4>>2],r),(0|(o=0|i[r>>2]))>0){u=0;do{A=r+8+(u<<4)|0,(s=0|de(n,o=r+8+(((0|(u=u+1|0))%(0|o)|0)<<4)|0,A))?he(n,s):fe(n,A,o),o=0|i[r>>2]}while((0|u)<(0|o))}l=l+1|0}while((0|l)!=(0|e));P=a}(t|=0,e|=0,a=o+16|0),i[n>>2]=0,i[n+4>>2]=0,i[n+8>>2]=0,!(t=0|ce(a)))return Jt(n),ue(a),void(P=o);do{e=0|Xt(n);do{Zt(e,t),s=t+16|0,i[r>>2]=i[s>>2],i[r+4>>2]=i[s+4>>2],i[r+8>>2]=i[s+8>>2],i[r+12>>2]=i[s+12>>2],he(a,t),t=0|pe(a,r)}while(0!=(0|t));t=0|ce(a)}while(0!=(0|t));Jt(n),ue(a),P=o},_h3ToCenterChild:function(t,e,n){n|=0;var r=0,i=0;if(r=0|Me(0|(t|=0),0|(e|=0),52),w(),(0|n)<16&(0|(r&=15))<=(0|n)){if((0|r)!=(0|n)&&(t|=i=0|Se(0|n,0,52),e=0|w()|-15728641&e,(0|r)<(0|n)))do{i=0|Se(7,0,3*(14-r|0)|0),r=r+1|0,t&=~i,e&=~(0|w())}while((0|r)<(0|n))}else e=0,t=0;return b(0|e),0|t},_h3ToChildren:Rt,_h3ToGeo:jt,_h3ToGeoBoundary:Vt,_h3ToParent:Lt,_h3UnidirectionalEdgeIsValid:function(t,e){var n=0;if(!(!0&268435456==(2013265920&(e|=0)|0)))return 0|(n=0);switch(n=0|Me(0|(t|=0),0|e,56),w(),7&n){case 0:case 7:return 0|(n=0)}return!0&16777216==(117440512&e|0)&0!=(0|It(t,n=-2130706433&e|134217728))?0|(n=0):0|(n=0|Dt(t,n))},_hexAreaKm2:function(t){return+ +a[20496+((t|=0)<<3)>>3]},_hexAreaM2:function(t){return+ +a[20624+((t|=0)<<3)>>3]},_hexRing:function(t,e,n,r){t|=0,e|=0,r|=0;var a,o=0,s=0,A=0,l=0,u=0,c=0,h=0;if(a=P,P=P+16|0,h=a,!(n|=0))return i[(h=r)>>2]=t,i[h+4>>2]=e,P=a,0|(h=0);i[h>>2]=0;t:do{if(0|It(t,e))t=1;else{if(s=(0|n)>0){o=0,c=t;do{if(0==(0|(c=0|I(c,e,4,h)))&0==(0|(e=0|w()))){t=2;break t}if(o=o+1|0,0|It(c,e)){t=1;break t}}while((0|o)<(0|n));if(i[(u=r)>>2]=c,i[u+4>>2]=e,u=n+-1|0,s){s=0,A=1,o=c,t=e;do{if(0==(0|(o=0|I(o,t,2,h)))&0==(0|(t=0|w()))){t=2;break t}if(i[(l=r+(A<<3)|0)>>2]=o,i[l+4>>2]=t,A=A+1|0,0|It(o,t)){t=1;break t}s=s+1|0}while((0|s)<(0|n));l=0,s=A;do{if(0==(0|(o=0|I(o,t,3,h)))&0==(0|(t=0|w()))){t=2;break t}if(i[(A=r+(s<<3)|0)>>2]=o,i[A+4>>2]=t,s=s+1|0,0|It(o,t)){t=1;break t}l=l+1|0}while((0|l)<(0|n));A=0;do{if(0==(0|(o=0|I(o,t,1,h)))&0==(0|(t=0|w()))){t=2;break t}if(i[(l=r+(s<<3)|0)>>2]=o,i[l+4>>2]=t,s=s+1|0,0|It(o,t)){t=1;break t}A=A+1|0}while((0|A)<(0|n));A=0;do{if(0==(0|(o=0|I(o,t,5,h)))&0==(0|(t=0|w()))){t=2;break t}if(i[(l=r+(s<<3)|0)>>2]=o,i[l+4>>2]=t,s=s+1|0,0|It(o,t)){t=1;break t}A=A+1|0}while((0|A)<(0|n));A=0;do{if(0==(0|(o=0|I(o,t,4,h)))&0==(0|(t=0|w()))){t=2;break t}if(i[(l=r+(s<<3)|0)>>2]=o,i[l+4>>2]=t,s=s+1|0,0|It(o,t)){t=1;break t}A=A+1|0}while((0|A)<(0|n));for(A=0;;){if(0==(0|(o=0|I(o,t,6,h)))&0==(0|(t=0|w()))){t=2;break t}if((0|A)!=(0|u)){if(i[(l=r+(s<<3)|0)>>2]=o,i[l+4>>2]=t,0|It(o,t)){t=1;break t}s=s+1|0}if((0|(A=A+1|0))>=(0|n)){A=c,s=e;break}}}else A=c,o=c,s=e,t=e}else i[(A=r)>>2]=t,i[A+4>>2]=e,A=t,o=t,s=e,t=e;t=1&((0|A)!=(0|o)|(0|s)!=(0|t))}}while(0);return P=a,0|(h=t)},_i64Subtract:ye,_kRing:D,_kRingDistances:function(t,e,n,r,i){var a;if(0|L(t|=0,e|=0,n|=0,r|=0,i|=0)){if(qe(0|r,0,(a=1+(0|x(3*n|0,n+1|0))|0)<<3|0),0|i)return qe(0|i,0,a<<2|0),void R(t,e,n,r,i,a,0);(i=0|xe(a,4))&&(R(t,e,n,r,i,a,0),ve(i))}},_llvm_minnum_f64:Ee,_llvm_round_f64:Te,_malloc:ge,_maxFaceCount:function(t,e){var n=0,r=0;if(r=0|Me(0|(t|=0),0|(e|=0),45),w(),!(0|B(127&r)))return 0|(r=2);if(r=0|Me(0|t,0|e,52),w(),!(r&=15))return 0|(r=5);for(n=1;;){if(!(0==((0|Se(7,0,3*(15-n|0)|0))&t|0)&0==((0|w())&e|0))){n=2,t=6;break}if(!(n>>>0<r>>>0)){n=5,t=6;break}n=n+1|0}return 6==(0|t)?0|n:0},_maxH3ToChildrenSize:function(t,e,n){return n|=0,t=0|Me(0|(t|=0),0|(e|=0),52),w(),(0|n)<16&(0|(t&=15))<=(0|n)?0|(n=0|ee(7,n-t|0)):0|(n=0)},_maxKringSize:function(t){return 1+(0|x(3*(t|=0)|0,t+1|0))|0},_maxPolyfillSize:function(t,e){e|=0;var n,r=0,a=0,o=0,s=0,A=0;if(n=P,P=P+48|0,o=n+8|0,a=n,s=0|i[(A=t|=0)+4>>2],i[(r=a)>>2]=i[A>>2],i[r+4>>2]=s,re(a,o),o=0|V(o,e),e=0|i[a>>2],(0|(a=0|i[t+8>>2]))<=0)return P=n,0|(A=(A=(s=(0|o)<(0|(A=e)))?A:o)+12|0);r=0|i[t+12>>2],t=0;do{e=(0|i[r+(t<<3)>>2])+e|0,t=t+1|0}while((0|t)<(0|a));return P=n,0|(A=(A=(A=(0|o)<(0|e))?e:o)+12|0)},_maxUncompactSize:function(t,e,n){t|=0,n|=0;var r=0,a=0,o=0,s=0;if((0|(e|=0))<=0)return 0|(n=0);if((0|n)>=16){for(r=0;;){if(!(0==(0|i[(s=t+(r<<3)|0)>>2])&0==(0|i[s+4>>2]))){r=-1,a=13;break}if((0|(r=r+1|0))>=(0|e)){r=0,a=13;break}}if(13==(0|a))return 0|r}r=0,s=0;t:for(;;){o=0|i[(a=t+(s<<3)|0)>>2],a=0|i[a+4>>2];do{if(!(0==(0|o)&0==(0|a))){if(a=0|Me(0|o,0|a,52),w(),(0|(a&=15))>(0|n)){r=-1,a=13;break t}if((0|a)==(0|n)){r=r+1|0;break}r=(0|ee(7,n-a|0))+r|0;break}}while(0);if((0|(s=s+1|0))>=(0|e)){a=13;break}}return 13==(0|a)?0|r:0},_memcpy:Ce,_memset:qe,_numHexagons:function(t){var e;return t=0|i[(e=21008+((t|=0)<<3)|0)>>2],b(0|i[e+4>>2]),0|t},_pentagonIndexCount:function(){return 12},_pointDistKm:Ct,_pointDistM:function(t,e){t|=0;var n,r,i,o=0;return r=+a[(e|=0)>>3],n=+a[t>>3],o=(i=+h(.5*(r-n)))*i+(o=+h(.5*(+a[e+8>>3]-+a[t+8>>3])))*(+c(+r)*+c(+n)*o),2*+g(+ +l(+o),+ +l(+(1-o)))*6371.007180918475*1e3},_pointDistRads:function(t,e){t|=0;var n,r,i,o=0;return r=+a[(e|=0)>>3],n=+a[t>>3],o=(i=+h(.5*(r-n)))*i+(o=+h(.5*(+a[e+8>>3]-+a[t+8>>3])))*(+c(+r)*+c(+n)*o),2*+g(+ +l(+o),+ +l(+(1-o)))},_polyfill:function(t,e,n){var r,a=0,o=0,s=0,A=0,l=0;if(r=P,P=P+48|0,a=r+8|0,o=r,0|function(t,e,n){e|=0,n|=0;var r=0,a=0,o=0,s=0,A=0,l=0,u=0,c=0,h=0,f=0,d=0,p=0,m=0,g=0,v=0,x=0,y=0,_=0,b=0,S=0,E=0,T=0,C=0,q=0,D=0,I=0,B=0,k=0,U=0,z=0;z=P,P=P+112|0,I=z+80|0,l=z+72|0,B=z,k=z+56|0,(U=0|ge(32+(i[(u=(t=t|0)+8|0)>>2]<<5)|0))||M(22848,22448,800,22456);if(ie(t,U),r=0|i[(o=t)+4>>2],i[(A=l)>>2]=i[o>>2],i[A+4>>2]=r,re(l,I),A=0|V(I,e),r=0|i[l>>2],(0|(o=0|i[u>>2]))>0){s=0|i[t+12>>2],a=0;do{r=(0|i[s+(a<<3)>>2])+r|0,a=a+1|0}while((0|a)!=(0|o))}if(a=0|xe(D=(A=(0|A)<(0|r)?r:A)+12|0,8),c=0|xe(D,8),i[I>>2]=0,q=0|i[(C=t)+4>>2],i[(r=l)>>2]=i[C>>2],i[r+4>>2]=q,0|(r=0|O(l,D,e,I,a,c)))return ve(a),ve(c),ve(U),P=z,0|(U=r);t:do{if((0|i[u>>2])>0){for(o=t+12|0,r=0;s=0|O((0|i[o>>2])+(r<<3)|0,D,e,I,a,c),r=r+1|0,!(0|s);)if((0|r)>=(0|i[u>>2]))break t;return ve(a),ve(c),ve(U),P=z,0|(U=s)}}while(0);(0|A)>-12&&qe(0|c,0,((0|D)>1?D:1)<<3|0);t:do{if((0|i[I>>2])>0){q=((0|D)<0)<<31>>31,_=a,b=c,S=a,E=a,T=c,C=a,r=a,g=a,v=c,x=c,y=c,a=c;e:for(;;){for(m=0|i[I>>2],d=0,p=0,o=0;;){A=(s=B)+56|0;do{i[s>>2]=0,s=s+4|0}while((0|s)<(0|A));if(0|L(l=0|i[(e=_+(d<<3)|0)>>2],e=0|i[e+4>>2],1,B,0)){A=(s=B)+56|0;do{i[s>>2]=0,s=s+4|0}while((0|s)<(0|A));0|(s=0|xe(7,4))&&(R(l,e,1,B,s,7,0),ve(s))}f=0;do{c=0|i[(h=B+(f<<3)|0)>>2],h=0|i[h+4>>2];n:do{if(!(0==(0|c)&0==(0|h))){if(l=0|we(0|c,0|h,0|D,0|q),w(),!(0==(0|(e=0|i[(A=s=n+(l<<3)|0)>>2]))&0==(0|(A=0|i[A+4>>2]))))for(u=0;;){if((0|u)>(0|D))break e;if((0|e)==(0|c)&(0|A)==(0|h))break n;if(0==(0|(e=0|i[(A=s=n+((l=(l+1|0)%(0|D)|0)<<3)|0)>>2]))&0==(0|(A=0|i[A+4>>2])))break;u=u+1|0}0==(0|c)&0==(0|h)||(jt(c,h,k),0|ae(t,U,k)&&(i[(u=s)>>2]=c,i[u+4>>2]=h,i[(u=b+(o<<3)|0)>>2]=c,i[u+4>>2]=h,o=o+1|0))}}while(0);f=f+1|0}while(f>>>0<7);if((0|(p=p+1|0))>=(0|m))break;d=d+1|0}if((0|m)>0&&qe(0|S,0,m<<3|0),i[I>>2]=o,!((0|o)>0))break t;c=a,h=y,f=C,d=x,p=v,m=b,a=g,y=r,x=E,v=S,g=c,r=h,C=T,T=f,E=d,S=p,b=_,_=m}return ve(E),ve(T),ve(U),P=z,0|(U=-1)}r=c}while(0);return ve(U),ve(a),ve(r),P=z,0|(U=0)}(t|=0,e|=0,n|=0)){if(s=0|i[(l=t)+4>>2],i[(A=o)>>2]=i[l>>2],i[A+4>>2]=s,re(o,a),A=0|V(a,e),e=0|i[o>>2],(0|(s=0|i[t+8>>2]))>0){o=0|i[t+12>>2],a=0;do{e=(0|i[o+(a<<3)>>2])+e|0,a=a+1|0}while((0|a)!=(0|s))}(0|(e=(0|A)<(0|e)?e:A))<=-12||qe(0|n,0,8+(((0|(l=e+11|0))>0?l:0)<<3)|0),P=r}else P=r},_res0IndexCount:function(){return 122},_round:Pe,_sbrk:De,_sizeOfCoordIJ:function(){return 8},_sizeOfGeoBoundary:function(){return 168},_sizeOfGeoCoord:function(){return 16},_sizeOfGeoPolygon:function(){return 16},_sizeOfGeofence:function(){return 8},_sizeOfH3Index:function(){return 8},_sizeOfLinkedGeoPolygon:function(){return 12},_uncompact:function(t,e,n,r,a){t|=0,n|=0,r|=0,a|=0;var o=0,s=0,A=0,l=0,u=0,c=0;if((0|(e|=0))<=0)return 0|(a=0);if((0|a)>=16){for(o=0;;){if(!(0==(0|i[(c=t+(o<<3)|0)>>2])&0==(0|i[c+4>>2]))){o=14;break}if((0|(o=o+1|0))>=(0|e)){s=0,o=16;break}}if(14==(0|o))return 0|((0|r)>0?-2:-1);if(16==(0|o))return 0|s}o=0,c=0;t:for(;;){s=0|i[(A=u=t+(c<<3)|0)>>2],A=0|i[A+4>>2];do{if(!(0==(0|s)&0==(0|A))){if((0|o)>=(0|r)){s=-1,o=16;break t}if(l=0|Me(0|s,0|A,52),w(),(0|(l&=15))>(0|a)){s=-2,o=16;break t}if((0|l)==(0|a)){i[(u=n+(o<<3)|0)>>2]=s,i[u+4>>2]=A,o=o+1|0;break}if((0|(s=(0|ee(7,a-l|0))+o|0))>(0|r)){s=-1,o=16;break t}Rt(0|i[u>>2],0|i[u+4>>2],a,n+(o<<3)|0),o=s}}while(0);if((0|(c=c+1|0))>=(0|e)){s=0,o=16;break}}return 16==(0|o)?0|s:0},establishStackSpace:function(t,e){P=t|=0},stackAlloc:function(t){var e;return e=P,P=(P=P+(t|=0)|0)+15&-16,0|e},stackRestore:function(t){P=t|=0},stackSave:function(){return 0|P}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{a:vt,b:function(t){g=t},c:v,d:function(t,e,n,r){vt("Assertion failed: "+D(t)+", at: "+[e?D(e):"unknown filename",n,r?D(r):"unknown function"])},e:function(t){return n.___errno_location&&(T[n.___errno_location()>>2]=t),t},f:tt,g:function(t,e,n){S.set(S.subarray(e,e+n),t)},h:function(t){var e=tt(),n=16777216,r=2130706432;if(t>r)return!1;for(var i=Math.max(e,16777216);i<t;)i=i<=536870912?L(2*i,n):Math.min(L((3*i+2147483648)/4,n),r);return!!et(i)},i:function(t){vt("OOM")},j:J,k:K,l:et,m:$,n:function(){var t=$();return n.extraStackTrace&&(t+="\n"+n.extraStackTrace()),K(t)},o:24032,p:24016},w);n.___uremdi3=at.___uremdi3,n._bitshift64Lshr=at._bitshift64Lshr,n._bitshift64Shl=at._bitshift64Shl,n._calloc=at._calloc,n._cellAreaKm2=at._cellAreaKm2,n._cellAreaM2=at._cellAreaM2,n._cellAreaRads2=at._cellAreaRads2,n._compact=at._compact,n._destroyLinkedPolygon=at._destroyLinkedPolygon,n._edgeLengthKm=at._edgeLengthKm,n._edgeLengthM=at._edgeLengthM;var ot=n._emscripten_replace_memory=at._emscripten_replace_memory;n._exactEdgeLengthKm=at._exactEdgeLengthKm,n._exactEdgeLengthM=at._exactEdgeLengthM,n._exactEdgeLengthRads=at._exactEdgeLengthRads,n._experimentalH3ToLocalIj=at._experimentalH3ToLocalIj,n._experimentalLocalIjToH3=at._experimentalLocalIjToH3,n._free=at._free,n._geoToH3=at._geoToH3,n._getDestinationH3IndexFromUnidirectionalEdge=at._getDestinationH3IndexFromUnidirectionalEdge,n._getH3IndexesFromUnidirectionalEdge=at._getH3IndexesFromUnidirectionalEdge,n._getH3UnidirectionalEdge=at._getH3UnidirectionalEdge,n._getH3UnidirectionalEdgeBoundary=at._getH3UnidirectionalEdgeBoundary,n._getH3UnidirectionalEdgesFromHexagon=at._getH3UnidirectionalEdgesFromHexagon,n._getOriginH3IndexFromUnidirectionalEdge=at._getOriginH3IndexFromUnidirectionalEdge,n._getPentagonIndexes=at._getPentagonIndexes,n._getRes0Indexes=at._getRes0Indexes,n._h3Distance=at._h3Distance,n._h3GetBaseCell=at._h3GetBaseCell,n._h3GetFaces=at._h3GetFaces,n._h3GetResolution=at._h3GetResolution,n._h3IndexesAreNeighbors=at._h3IndexesAreNeighbors,n._h3IsPentagon=at._h3IsPentagon,n._h3IsResClassIII=at._h3IsResClassIII,n._h3IsValid=at._h3IsValid,n._h3Line=at._h3Line,n._h3LineSize=at._h3LineSize,n._h3SetToLinkedGeo=at._h3SetToLinkedGeo,n._h3ToCenterChild=at._h3ToCenterChild,n._h3ToChildren=at._h3ToChildren,n._h3ToGeo=at._h3ToGeo,n._h3ToGeoBoundary=at._h3ToGeoBoundary,n._h3ToParent=at._h3ToParent,n._h3UnidirectionalEdgeIsValid=at._h3UnidirectionalEdgeIsValid,n._hexAreaKm2=at._hexAreaKm2,n._hexAreaM2=at._hexAreaM2,n._hexRing=at._hexRing,n._i64Subtract=at._i64Subtract,n._kRing=at._kRing,n._kRingDistances=at._kRingDistances,n._llvm_minnum_f64=at._llvm_minnum_f64,n._llvm_round_f64=at._llvm_round_f64,n._malloc=at._malloc,n._maxFaceCount=at._maxFaceCount,n._maxH3ToChildrenSize=at._maxH3ToChildrenSize,n._maxKringSize=at._maxKringSize,n._maxPolyfillSize=at._maxPolyfillSize,n._maxUncompactSize=at._maxUncompactSize,n._memcpy=at._memcpy,n._memset=at._memset,n._numHexagons=at._numHexagons,n._pentagonIndexCount=at._pentagonIndexCount,n._pointDistKm=at._pointDistKm,n._pointDistM=at._pointDistM,n._pointDistRads=at._pointDistRads,n._polyfill=at._polyfill,n._res0IndexCount=at._res0IndexCount,n._round=at._round,n._sbrk=at._sbrk,n._sizeOfCoordIJ=at._sizeOfCoordIJ,n._sizeOfGeoBoundary=at._sizeOfGeoBoundary,n._sizeOfGeoCoord=at._sizeOfGeoCoord,n._sizeOfGeoPolygon=at._sizeOfGeoPolygon,n._sizeOfGeofence=at._sizeOfGeofence,n._sizeOfH3Index=at._sizeOfH3Index,n._sizeOfLinkedGeoPolygon=at._sizeOfLinkedGeoPolygon,n._uncompact=at._uncompact,n.establishStackSpace=at.establishStackSpace;var st,At,lt=n.stackAlloc=at.stackAlloc,ut=n.stackRestore=at.stackRestore,ct=n.stackSave=at.stackSave;if(n.asm=at,n.cwrap=function(t,e,n,r){var i=(n=n||[]).every((function(t){return"number"===t}));return"string"!==e&&i&&!r?_(t):function(){return b(t,e,n,arguments)}},n.setValue=function(t,e,n,r){switch("*"===(n=n||"i8").charAt(n.length-1)&&(n="i32"),n){case"i1":case"i8":M[t>>0]=e;break;case"i16":E[t>>1]=e;break;case"i32":T[t>>2]=e;break;case"i64":Q=[e>>>0,(W=e,+N(W)>=1?W>0?(0|H(+G(W/4294967296),4294967295))>>>0:~~+F((W-+(~~W>>>0))/4294967296)>>>0:0)],T[t>>2]=Q[0],T[t+4>>2]=Q[1];break;case"float":C[t>>2]=e;break;case"double":q[t>>3]=e;break;default:vt("invalid type for setValue: "+n)}},n.getValue=function(t,e,n){switch("*"===(e=e||"i8").charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":return M[t>>0];case"i16":return E[t>>1];case"i32":case"i64":return T[t>>2];case"float":return C[t>>2];case"double":return q[t>>3];default:vt("invalid type for getValue: "+e)}return null},n.getTempRet0=v,Y)if(Z(Y)||(st=Y,Y=n.locateFile?n.locateFile(st,d):d+st),o||A){var ht=c(Y);S.set(ht,8)}else{j++,n.monitorRunDependencies&&n.monitorRunDependencies(j);var ft=function(t){t.byteLength&&(t=new Uint8Array(t)),S.set(t,8),n.memoryInitializerRequest&&delete n.memoryInitializerRequest.response,function(t){if(j--,n.monitorRunDependencies&&n.monitorRunDependencies(j),0==j&&V){var e=V;V=null,e()}}()},dt=function(){u(Y,ft,(function(){throw"could not load memory initializer "+Y}))},pt=it(Y);if(pt)ft(pt.buffer);else if(n.memoryInitializerRequest){var mt=function(){var t=n.memoryInitializerRequest,e=t.response;if(200!==t.status&&0!==t.status){var r=it(n.memoryInitializerRequestURL);if(!r)return console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+t.status+", retrying "+Y),void dt();e=r.buffer}ft(e)};n.memoryInitializerRequest.response?setTimeout(mt,0):n.memoryInitializerRequest.addEventListener("load",mt)}else dt()}function gt(t){function e(){At||(At=!0,x||(O(k),O(U),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)t=n.postRun.shift(),z.unshift(t);var t;O(z)}()))}j>0||(!function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)t=n.preRun.shift(),B.unshift(t);var t;O(B)}(),j>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}function vt(t){throw n.onAbort&&n.onAbort(t),p(t+=""),m(t),x=!0,"abort("+t+"). Build with -s ASSERTIONS=1 for more info."}if(V=function t(){At||gt(),At||(V=t)},n.run=gt,n.abort=vt,n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return gt(),t}("object"==typeof Tg?Tg:{}),Cg="number",qg={};