// Version 2.22.3 globe.gl - https://github.com/vasturiano/globe.gl !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Globe=t()}(this,(function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e)||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(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n>8&255]+U[e>>16&255]+U[e>>24&255]+"-"+U[255&t]+U[t>>8&255]+"-"+U[t>>16&15|64]+U[t>>24&255]+"-"+U[63&n|128]+U[n>>8&255]+"-"+U[n>>16&255]+U[n>>24&255]+U[255&r]+U[r>>8&255]+U[r>>16&255]+U[r>>24&255]).toUpperCase()}function W(e,t,n){return Math.max(t,Math.min(n,e))}function Q(e,t){return(e%t+t)%t}function Y(e,t,n){return(1-n)*e+n*t}function X(e){return 0==(e&e-1)&&0!==e}function Z(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var J=Object.freeze({__proto__:null,DEG2RAD:G,RAD2DEG:V,generateUUID:j,clamp:W,euclideanModulo:Q,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Y,damp:function(e,t,n,r){return Y(e,t,1-Math.exp(-n*r))},pingpong:function(e,t=1){return t-Math.abs(Q(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){return void 0!==e&&(H=e%2147483647),H=16807*H%2147483647,(H-1)/2147483646},degToRad:function(e){return e*G},radToDeg:function(e){return e*V},isPowerOfTwo:X,ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:Z,setQuaternionFromProperEuler:function(e,t,n,r,i){const a=Math.cos,o=Math.sin,s=a(n/2),A=o(n/2),l=a((t+r)/2),c=o((t+r)/2),u=a((t-r)/2),h=o((t-r)/2),d=a((r-t)/2),f=o((r-t)/2);switch(i){case"XYX":e.set(s*c,A*u,A*h,s*l);break;case"YZY":e.set(A*h,s*c,A*u,s*l);break;case"ZXZ":e.set(A*u,A*h,s*c,s*l);break;case"XZX":e.set(s*c,A*f,A*d,s*l);break;case"YXY":e.set(A*d,s*c,A*f,s*l);break;case"ZYZ":e.set(A*f,A*d,s*c,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}});class K{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}K.prototype.isVector2=!0;class ${constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,r,i,a,o,s,A){const l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,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(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],A=n[1],l=n[4],c=n[7],u=n[2],h=n[5],d=n[8],f=r[0],p=r[3],m=r[6],g=r[1],v=r[4],y=r[7],x=r[2],b=r[5],_=r[8];return i[0]=a*f+o*g+s*x,i[3]=a*p+o*v+s*b,i[6]=a*m+o*y+s*_,i[1]=A*f+l*g+c*x,i[4]=A*p+l*v+c*b,i[7]=A*m+l*y+c*_,i[2]=u*f+h*g+d*x,i[5]=u*p+h*v+d*b,i[8]=u*m+h*y+d*_,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],A=e[7],l=e[8];return t*a*l-t*o*A-n*i*l+n*o*s+r*i*A-r*a*s}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],A=e[7],l=e[8],c=l*a-o*A,u=o*s-l*i,h=A*i-a*s,d=t*c+n*u+r*h;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const f=1/d;return e[0]=c*f,e[1]=(r*A-l*n)*f,e[2]=(o*n-r*a)*f,e[3]=u*f,e[4]=(l*t-r*s)*f,e[5]=(r*i-o*t)*f,e[6]=h*f,e[7]=(n*s-A*t)*f,e[8]=(a*t-n*i)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,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+e,-r*A,r*s,-r*(-A*a+s*o)+o+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],A=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*A,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*A,r[7]=-n*o+t*l,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}let ee;$.prototype.isMatrix3=!0;class te{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===ee&&(ee=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),ee.width=e.width,ee.height=e.height;const n=ee.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ee}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}}let ne=0;class re extends F{constructor(e=re.DEFAULT_IMAGE,t=re.DEFAULT_MAPPING,n=1001,r=1001,i=1006,a=1008,o=1023,s=1009,A=1,l=3e3){super(),Object.defineProperty(this,"id",{value:ne++}),this.uuid=j(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,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 K(0,0),this.repeat=new K(1,1),this.center=new K(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new $,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=j()),!t&&void 0===e.images[r.uuid]){let t;if(Array.isArray(r)){t=[];for(let e=0,n=r.length;e1)switch(this.wrapS){case h:e.x=e.x-Math.floor(e.x);break;case d:e.x=e.x<0?0:1;break;case f:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case h:e.y=e.y-Math.floor(e.y);break;case d:e.y=e.y<0?0:1;break;case f:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&this.version++}}function ie(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?te.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}re.DEFAULT_IMAGE=void 0,re.DEFAULT_MAPPING=300,re.prototype.isTexture=!0;class ae{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i;const a=.01,o=.1,s=e.elements,A=s[0],l=s[4],c=s[8],u=s[1],h=s[5],d=s[9],f=s[2],p=s[6],m=s[10];if(Math.abs(l-u)s&&e>g?eg?s=0?1:-1,r=1-t*t;if(r>Number.EPSILON){const i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,o=Math.sin(o*a)/i}const i=o*n;if(s=s*e+u*i,A=A*e+h*i,l=l*e+d*i,c=c*e+f*i,e===1-o){const e=1/Math.sqrt(s*s+A*A+l*l+c*c);s*=e,A*=e,l*=e,c*=e}}e[t]=s,e[t+1]=A,e[t+2]=l,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,r,i,a){const o=n[r],s=n[r+1],A=n[r+2],l=n[r+3],c=i[a],u=i[a+1],h=i[a+2],d=i[a+3];return e[t]=o*d+l*c+s*h-A*u,e[t+1]=s*d+l*u+A*c-o*h,e[t+2]=A*d+l*h+o*u-s*c,e[t+3]=l*d-o*c-s*u-A*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,A=o(n/2),l=o(r/2),c=o(i/2),u=s(n/2),h=s(r/2),d=s(i/2);switch(a){case"XYZ":this._x=u*l*c+A*h*d,this._y=A*h*c-u*l*d,this._z=A*l*d+u*h*c,this._w=A*l*c-u*h*d;break;case"YXZ":this._x=u*l*c+A*h*d,this._y=A*h*c-u*l*d,this._z=A*l*d-u*h*c,this._w=A*l*c+u*h*d;break;case"ZXY":this._x=u*l*c-A*h*d,this._y=A*h*c+u*l*d,this._z=A*l*d+u*h*c,this._w=A*l*c-u*h*d;break;case"ZYX":this._x=u*l*c-A*h*d,this._y=A*h*c+u*l*d,this._z=A*l*d-u*h*c,this._w=A*l*c+u*h*d;break;case"YZX":this._x=u*l*c+A*h*d,this._y=A*h*c+u*l*d,this._z=A*l*d-u*h*c,this._w=A*l*c-u*h*d;break;case"XZY":this._x=u*l*c-A*h*d,this._y=A*h*c-u*l*d,this._z=A*l*d+u*h*c,this._w=A*l*c+u*h*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],A=t[2],l=t[6],c=t[10],u=n+o+c;if(u>0){const e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-A)*e,this._z=(a-r)*e}else if(n>o&&n>c){const e=2*Math.sqrt(1+n-o-c);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+A)/e}else if(o>c){const e=2*Math.sqrt(1+o-n-c);this._w=(i-A)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{const e=2*Math.sqrt(1+c-n-o);this._w=(a-r)/e,this._x=(i+A)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(W(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,A=t._z,l=t._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(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,r=this._y,i=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;const s=1-o*o;if(s<=Number.EPSILON){const e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this._onChangeCallback(),this}const A=Math.sqrt(s),l=Math.atan2(A,o),c=Math.sin((1-t)*l)/A,u=Math.sin(t*l)/A;return this._w=a*c+this._w*u,this._x=n*c+this._x*u,this._y=r*c+this._y*u,this._z=i*c+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}se.prototype.isQuaternion=!0;class Ae{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(ce.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ce.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,A=s*t+a*r-o*n,l=s*n+o*t-i*r,c=s*r+i*n-a*t,u=-i*t-a*n-o*r;return this.x=A*s+u*-i+l*-o-c*-a,this.y=l*s+u*-a+c*-i-A*-o,this.z=c*s+u*-o+A*-a-l*-i,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return le.copy(this).projectOnVector(e),this.sub(le)}reflect(e){return this.sub(le.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(W(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}Ae.prototype.isVector3=!0;const le=new Ae,ce=new se;class ue{constructor(e=new Ae(1/0,1/0,1/0),t=new Ae(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(let s=0,A=e.length;si&&(i=A),l>a&&(a=l),c>o&&(o=c)}return this.min.set(t,n,r),this.max.set(i,a,o),this}setFromBufferAttribute(e){let t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(let s=0,A=e.count;si&&(i=A),l>a&&(a=l),c>o&&(o=c)}return this.min.set(t,n,r),this.max.set(i,a,o),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Ae),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,de),de.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(be),_e.subVectors(this.max,be),pe.subVectors(e.a,be),me.subVectors(e.b,be),ge.subVectors(e.c,be),ve.subVectors(me,pe),ye.subVectors(ge,me),xe.subVectors(pe,ge);let t=[0,-ve.z,ve.y,0,-ye.z,ye.y,0,-xe.z,xe.y,ve.z,0,-ve.x,ye.z,0,-ye.x,xe.z,0,-xe.x,-ve.y,ve.x,0,-ye.y,ye.x,0,-xe.y,xe.x,0];return!!Se(t,pe,me,ge,_e)&&(t=[1,0,0,0,1,0,0,0,1],!!Se(t,pe,me,ge,_e)&&(we.crossVectors(ve,ye),t=[we.x,we.y,we.z],Se(t,pe,me,ge,_e)))}clampPoint(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Ae),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return de.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(de).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(he[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),he[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),he[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),he[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),he[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),he[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),he[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),he[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(he)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}ue.prototype.isBox3=!0;const he=[new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae],de=new Ae,fe=new ue,pe=new Ae,me=new Ae,ge=new Ae,ve=new Ae,ye=new Ae,xe=new Ae,be=new Ae,_e=new Ae,we=new Ae,Me=new Ae;function Se(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){Me.fromArray(e,a);const o=i.x*Math.abs(Me.x)+i.y*Math.abs(Me.y)+i.z*Math.abs(Me.z),s=t.dot(Me),A=n.dot(Me),l=r.dot(Me);if(Math.max(-Math.max(s,A,l),Math.min(s,A,l))>o)return!1}return!0}const Ee=new ue,Te=new Ae,Le=new Ae,Ce=new Ae;class Pe{constructor(e=new Ae,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Ee.setFromPoints(e).getCenter(n);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new ue),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Ce.subVectors(e,this.center);const t=Ce.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(Ce.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return Le.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Te.copy(e.center).add(Le)),this.expandByPoint(Te.copy(e.center).sub(Le)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Re=new Ae,qe=new Ae,De=new Ae,Ie=new Ae,Be=new Ae,ke=new Ae,Oe=new Ae;class Ne{constructor(e=new Ae,t=new Ae(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new Ae),t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Re)),this}closestPointToPoint(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Ae),t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Re.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Re.copy(this.direction).multiplyScalar(t).add(this.origin),Re.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){qe.copy(e).add(t).multiplyScalar(.5),De.copy(t).sub(e).normalize(),Ie.copy(this.origin).sub(qe);const i=.5*e.distanceTo(t),a=-this.direction.dot(De),o=Ie.dot(this.direction),s=-Ie.dot(De),A=Ie.lengthSq(),l=Math.abs(1-a*a);let c,u,h,d;if(l>0)if(c=a*s-o,u=a*o-s,d=i*l,c>=0)if(u>=-d)if(u<=d){const e=1/l;c*=e,u*=e,h=c*(c+a*u+2*o)+u*(a*c+u+2*s)+A}else u=i,c=Math.max(0,-(a*u+o)),h=-c*c+u*(u+2*s)+A;else u=-i,c=Math.max(0,-(a*u+o)),h=-c*c+u*(u+2*s)+A;else u<=-d?(c=Math.max(0,-(-a*i+o)),u=c>0?-i:Math.min(Math.max(-i,-s),i),h=-c*c+u*(u+2*s)+A):u<=d?(c=0,u=Math.min(Math.max(-i,-s),i),h=u*(u+2*s)+A):(c=Math.max(0,-(a*i+o)),u=c>0?i:Math.min(Math.max(-i,-s),i),h=-c*c+u*(u+2*s)+A);else u=a>0?-i:i,c=Math.max(0,-(a*u+o)),h=-c*c+u*(u+2*s)+A;return n&&n.copy(this.direction).multiplyScalar(c).add(this.origin),r&&r.copy(De).multiplyScalar(u).add(qe),h}intersectSphere(e,t){Re.subVectors(e.center,this.origin);const n=Re.dot(this.direction),r=Re.dot(Re)-n*n,i=e.radius*e.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,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s;const A=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return A>=0?(n=(e.min.x-u.x)*A,r=(e.max.x-u.x)*A):(n=(e.max.x-u.x)*A,r=(e.min.x-u.x)*A),l>=0?(i=(e.min.y-u.y)*l,a=(e.max.y-u.y)*l):(i=(e.max.y-u.y)*l,a=(e.min.y-u.y)*l),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a=0?(o=(e.min.z-u.z)*c,s=(e.max.z-u.z)*c):(o=(e.max.z-u.z)*c,s=(e.min.z-u.z)*c),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s=0?n:r,t)))}intersectsBox(e){return null!==this.intersectBox(e,Re)}intersectTriangle(e,t,n,r,i){Be.subVectors(t,e),ke.subVectors(n,e),Oe.crossVectors(Be,ke);let a,o=this.direction.dot(Oe);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Ie.subVectors(this.origin,e);const s=a*this.direction.dot(ke.crossVectors(Ie,ke));if(s<0)return null;const A=a*this.direction.dot(Be.cross(Ie));if(A<0)return null;if(s+A>o)return null;const l=-a*Ie.dot(Oe);return l<0?null:this.at(l/o,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class ze{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,r,i,a,o,s,A,l,c,u,h,d,f,p){const m=this.elements;return m[0]=e,m[4]=t,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]=c,m[14]=u,m[3]=h,m[7]=d,m[11]=f,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 ze).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/Fe.setFromMatrixColumn(e,0).length(),i=1/Fe.setFromMatrixColumn(e,1).length(),a=1/Fe.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),A=Math.sin(r),l=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){const e=a*l,n=a*c,r=o*l,i=o*c;t[0]=s*l,t[4]=-s*c,t[8]=A,t[1]=n+r*A,t[5]=e-i*A,t[9]=-o*s,t[2]=i-e*A,t[6]=r+n*A,t[10]=a*s}else if("YXZ"===e.order){const e=s*l,n=s*c,r=A*l,i=A*c;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*A,t[1]=a*c,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if("ZXY"===e.order){const e=s*l,n=s*c,r=A*l,i=A*c;t[0]=e-i*o,t[4]=-a*c,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*A,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){const e=a*l,n=a*c,r=o*l,i=o*c;t[0]=s*l,t[4]=r*A-n,t[8]=e*A+i,t[1]=s*c,t[5]=i*A+e,t[9]=n*A-r,t[2]=-A,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){const e=a*s,n=a*A,r=o*s,i=o*A;t[0]=s*l,t[4]=i-e*c,t[8]=r*c+n,t[1]=c,t[5]=a*l,t[9]=-o*l,t[2]=-A*l,t[6]=n*c+r,t[10]=e-i*c}else if("XZY"===e.order){const e=a*s,n=a*A,r=o*s,i=o*A;t[0]=s*l,t[4]=-c,t[8]=A*l,t[1]=e*c+i,t[5]=a*l,t[9]=n*c-r,t[2]=r*c-n,t[6]=o*l,t[10]=i*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(He,e,Ge)}lookAt(e,t,n){const r=this.elements;return We.subVectors(e,t),0===We.lengthSq()&&(We.z=1),We.normalize(),Ve.crossVectors(n,We),0===Ve.lengthSq()&&(1===Math.abs(n.z)?We.x+=1e-4:We.z+=1e-4,We.normalize(),Ve.crossVectors(n,We)),Ve.normalize(),je.crossVectors(We,Ve),r[0]=Ve.x,r[4]=je.x,r[8]=We.x,r[1]=Ve.y,r[5]=je.y,r[9]=We.y,r[2]=Ve.z,r[6]=je.z,r[10]=We.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],A=n[12],l=n[1],c=n[5],u=n[9],h=n[13],d=n[2],f=n[6],p=n[10],m=n[14],g=n[3],v=n[7],y=n[11],x=n[15],b=r[0],_=r[4],w=r[8],M=r[12],S=r[1],E=r[5],T=r[9],L=r[13],C=r[2],P=r[6],R=r[10],q=r[14],D=r[3],I=r[7],B=r[11],k=r[15];return i[0]=a*b+o*S+s*C+A*D,i[4]=a*_+o*E+s*P+A*I,i[8]=a*w+o*T+s*R+A*B,i[12]=a*M+o*L+s*q+A*k,i[1]=l*b+c*S+u*C+h*D,i[5]=l*_+c*E+u*P+h*I,i[9]=l*w+c*T+u*R+h*B,i[13]=l*M+c*L+u*q+h*k,i[2]=d*b+f*S+p*C+m*D,i[6]=d*_+f*E+p*P+m*I,i[10]=d*w+f*T+p*R+m*B,i[14]=d*M+f*L+p*q+m*k,i[3]=g*b+v*S+y*C+x*D,i[7]=g*_+v*E+y*P+x*I,i[11]=g*w+v*T+y*R+x*B,i[15]=g*M+v*L+y*q+x*k,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],A=e[13],l=e[2],c=e[6],u=e[10],h=e[14];return e[3]*(+i*s*c-r*A*c-i*o*u+n*A*u+r*o*h-n*s*h)+e[7]*(+t*s*h-t*A*u+i*a*u-r*a*h+r*A*l-i*s*l)+e[11]*(+t*A*c-t*o*h-i*a*c+n*a*h+i*o*l-n*A*l)+e[15]*(-r*o*l-t*s*c+t*o*u+r*a*c-n*a*u+n*s*l)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],A=e[7],l=e[8],c=e[9],u=e[10],h=e[11],d=e[12],f=e[13],p=e[14],m=e[15],g=c*p*A-f*u*A+f*s*h-o*p*h-c*s*m+o*u*m,v=d*u*A-l*p*A-d*s*h+a*p*h+l*s*m-a*u*m,y=l*f*A-d*c*A+d*o*h-a*f*h-l*o*m+a*c*m,x=d*c*s-l*f*s-d*o*u+a*f*u+l*o*p-a*c*p,b=t*g+n*v+r*y+i*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/b;return e[0]=g*_,e[1]=(f*u*i-c*p*i-f*r*h+n*p*h+c*r*m-n*u*m)*_,e[2]=(o*p*i-f*s*i+f*r*A-n*p*A-o*r*m+n*s*m)*_,e[3]=(c*s*i-o*u*i-c*r*A+n*u*A+o*r*h-n*s*h)*_,e[4]=v*_,e[5]=(l*p*i-d*u*i+d*r*h-t*p*h-l*r*m+t*u*m)*_,e[6]=(d*s*i-a*p*i-d*r*A+t*p*A+a*r*m-t*s*m)*_,e[7]=(a*u*i-l*s*i+l*r*A-t*u*A-a*r*h+t*s*h)*_,e[8]=y*_,e[9]=(d*c*i-l*f*i-d*n*h+t*f*h+l*n*m-t*c*m)*_,e[10]=(a*f*i-d*o*i+d*n*A-t*f*A-a*n*m+t*o*m)*_,e[11]=(l*o*i-a*c*i-l*n*A+t*c*A+a*n*h-t*o*h)*_,e[12]=x*_,e[13]=(l*f*r-d*c*r+d*n*u-t*f*u-l*n*p+t*c*p)*_,e[14]=(d*o*r-a*f*r-d*n*s+t*f*s+a*n*p-t*o*p)*_,e[15]=(a*c*r-l*o*r+l*n*s-t*c*s-a*n*u+t*o*u)*_,this}scale(e){const t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.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(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,A=i+i,l=a+a,c=o+o,u=i*A,h=i*l,d=i*c,f=a*l,p=a*c,m=o*c,g=s*A,v=s*l,y=s*c,x=n.x,b=n.y,_=n.z;return r[0]=(1-(f+m))*x,r[1]=(h+y)*x,r[2]=(d-v)*x,r[3]=0,r[4]=(h-y)*b,r[5]=(1-(u+m))*b,r[6]=(p+g)*b,r[7]=0,r[8]=(d+v)*_,r[9]=(p-g)*_,r[10]=(1-(u+f))*_,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let i=Fe.set(r[0],r[1],r[2]).length();const a=Fe.set(r[4],r[5],r[6]).length(),o=Fe.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Ue.copy(this);const s=1/i,A=1/a,l=1/o;return Ue.elements[0]*=s,Ue.elements[1]*=s,Ue.elements[2]*=s,Ue.elements[4]*=A,Ue.elements[5]*=A,Ue.elements[6]*=A,Ue.elements[8]*=l,Ue.elements[9]*=l,Ue.elements[10]*=l,t.setFromRotationMatrix(Ue),n.x=i,n.y=a,n.z=o,this}makePerspective(e,t,n,r,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,s=2*i/(t-e),A=2*i/(n-r),l=(t+e)/(t-e),c=(n+r)/(n-r),u=-(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]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=h,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,r,i,a){const o=this.elements,s=1/(t-e),A=1/(n-r),l=1/(a-i),c=(t+e)*s,u=(n+r)*A,h=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*A,o[9]=0,o[13]=-u,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(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}ze.prototype.isMatrix4=!0;const Fe=new Ae,Ue=new ze,He=new Ae(0,0,0),Ge=new Ae(1,1,1),Ve=new Ae,je=new Ae,We=new Ae,Qe=new ze,Ye=new se;class Xe{constructor(e=0,t=0,n=0,r=Xe.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t,n){const r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],A=r[5],l=r[9],c=r[2],u=r[6],h=r[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(W(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(u,A),this._z=0);break;case"YXZ":this._x=Math.asin(-W(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,h),this._z=Math.atan2(s,A)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(W(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-c,h),this._z=Math.atan2(-a,A)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-W(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(u,h),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,A));break;case"YZX":this._z=Math.asin(W(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,A),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(o,h));break;case"XZY":this._z=Math.asin(-W(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,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: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Qe.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Qe,t,n)}setFromVector3(e,t){return this.set(e.x,e.y,e.z,t||this._order)}reorder(e){return Ye.setFromEuler(this),this.setFromQuaternion(Ye,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new Ae(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Xe.prototype.isEuler=!0,Xe.DefaultOrder="XYZ",Xe.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ze{constructor(){this.mask=1}set(e){this.mask=1<1){for(let e=0;e1){for(let e=0;e0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),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)}return n.object=r,n;function a(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t1?null:t.copy(n).multiplyScalar(i).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new Ae),e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||dt.getNormalMatrix(e),r=this.coplanarPoint(ut).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}ft.prototype.isPlane=!0;const pt=new Ae,mt=new Ae,gt=new Ae,vt=new Ae,yt=new Ae,xt=new Ae,bt=new Ae,_t=new Ae,wt=new Ae,Mt=new Ae;class St{constructor(e=new Ae,t=new Ae,n=new Ae){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Ae),r.subVectors(n,t),pt.subVectors(e,t),r.cross(pt);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){pt.subVectors(r,t),mt.subVectors(n,t),gt.subVectors(e,t);const a=pt.dot(pt),o=pt.dot(mt),s=pt.dot(gt),A=mt.dot(mt),l=mt.dot(gt),c=a*A-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Ae),0===c)return i.set(-2,-1,-1);const u=1/c,h=(A*s-o*l)*u,d=(a*l-o*s)*u;return i.set(1-h-d,d,h)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,vt),vt.x>=0&&vt.y>=0&&vt.x+vt.y<=1}static getUV(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,vt),s.set(0,0),s.addScaledVector(i,vt.x),s.addScaledVector(a,vt.y),s.addScaledVector(o,vt.z),s}static isFrontFacing(e,t,n,r){return pt.subVectors(n,t),mt.subVectors(e,t),pt.cross(mt).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return pt.subVectors(this.c,this.b),mt.subVectors(this.a,this.b),.5*pt.cross(mt).length()}getMidpoint(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new Ae),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return St.getNormal(this.a,this.b,this.c,e)}getPlane(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new ft),e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return St.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,r,i){return St.getUV(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return St.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return St.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new Ae);const n=this.a,r=this.b,i=this.c;let a,o;yt.subVectors(r,n),xt.subVectors(i,n),_t.subVectors(e,n);const s=yt.dot(_t),A=xt.dot(_t);if(s<=0&&A<=0)return t.copy(n);wt.subVectors(e,r);const l=yt.dot(wt),c=xt.dot(wt);if(l>=0&&c<=l)return t.copy(r);const u=s*c-l*A;if(u<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(yt,a);Mt.subVectors(e,i);const h=yt.dot(Mt),d=xt.dot(Mt);if(d>=0&&h<=d)return t.copy(i);const f=h*A-s*d;if(f<=0&&A>=0&&d<=0)return o=A/(A-d),t.copy(n).addScaledVector(xt,o);const p=l*d-h*c;if(p<=0&&c-l>=0&&h-d>=0)return bt.subVectors(i,r),o=(c-l)/(c-l+(h-d)),t.copy(r).addScaledVector(bt,o);const m=1/(p+f+u);return a=f*m,o=u*m,t.copy(n).addScaledVector(yt,a).addScaledVector(xt,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Et=0;class Tt extends F{constructor(){super(),Object.defineProperty(this,"id",{value:Et++}),this.uuid=j(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=u,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=k,this.stencilZFail=k,this.stencilZPass=k,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,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(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(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,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}Tt.prototype.isMaterial=!0;const Lt={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},Ct={h:0,s:0,l:0},Pt={h:0,s:0,l:0};function Rt(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function qt(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Dt(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class It{constructor(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=Q(e,1),t=W(t,0,1),n=W(n,0,1),0===t)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Rt(i,r,e+1/3),this.g=Rt(i,r,e),this.b=Rt(i,r,e-1/3)}return this}setStyle(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,t(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,t(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(e[1])/360,r=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100;return t(e[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=n[1],t=e.length;if(3===t)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,this;if(6===t)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=Lt[e.toLowerCase()];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e,t=2){return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e,t=2){const n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=qt(e.r),this.g=qt(e.g),this.b=qt(e.b),this}copyLinearToSRGB(e){return this.r=Dt(e.r),this.g=Dt(e.g),this.b=Dt(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});const t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),a=Math.min(t,n,r);let o,s;const A=(a+i)/2;if(a===i)o=0,s=0;else{const e=i-a;switch(s=A<=.5?e/(i+a):e/(2-i-a),i){case t:o=(n-r)/e+(nt&&(t=e[n]);return t}let Gt=0;const Vt=new ze,jt=new ct,Wt=new Ae,Qt=new ue,Yt=new ue,Xt=new Ae;class Zt extends F{constructor(){super(),Object.defineProperty(this,"id",{value:Gt++}),this.uuid=j(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ht(e)>65535?Ft:zt)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new $).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return Vt.makeRotationFromQuaternion(e),this.applyMatrix4(Vt),this}rotateX(e){return Vt.makeRotationX(e),this.applyMatrix4(Vt),this}rotateY(e){return Vt.makeRotationY(e),this.applyMatrix4(Vt),this}rotateZ(e){return Vt.makeRotationZ(e),this.applyMatrix4(Vt),this}translate(e,t,n){return Vt.makeTranslation(e,t,n),this.applyMatrix4(Vt),this}scale(e,t,n){return Vt.makeScale(e,t,n),this.applyMatrix4(Vt),this}lookAt(e){return jt.lookAt(e),jt.updateMatrix(),this.applyMatrix4(jt.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Wt).negate(),this.translate(Wt.x,Wt.y,Wt.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const r=n[t];e.data.attributes[t]=r.toJSON(e.data)}const r={};let i=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new Zt).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const r=e.attributes;for(const e in r){const n=r[e];this.setAttribute(e,n.clone(t))}const i=e.morphAttributes;for(const e in i){const n=[],r=i[e];for(let e=0,i=r.length;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),$t.copy(n.boundingSphere),$t.applyMatrix4(i),!1===e.ray.intersectsSphere($t))return;if(Jt.copy(i).invert(),Kt.copy(e.ray).applyMatrix4(Jt),null!==n.boundingBox&&!1===Kt.intersectsBox(n.boundingBox))return;let a;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position,s=n.morphAttributes.position,A=n.morphTargetsRelative,l=n.attributes.uv,c=n.attributes.uv2,u=n.groups,h=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,d=u.length;nn.far?null:{distance:l,point:fn.clone(),object:e}}(e,t,n,r,en,tn,nn,dn);if(d){s&&(cn.fromBufferAttribute(s,l),un.fromBufferAttribute(s,c),hn.fromBufferAttribute(s,u),d.uv=St.getUV(dn,en,tn,nn,cn,un,hn,new K)),A&&(cn.fromBufferAttribute(A,l),un.fromBufferAttribute(A,c),hn.fromBufferAttribute(A,u),d.uv2=St.getUV(dn,en,tn,nn,cn,un,hn,new K));const e={a:l,b:c,c:u,normal:new Ae,materialIndex:0};St.getNormal(en,tn,nn,e.normal),d.face=e}return d}pn.prototype.isMesh=!0;class gn extends Zt{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,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=[],c=[];let u=0,h=0;function d(e,t,n,r,i,a,d,f,p,m,g){const v=a/p,y=d/m,x=a/2,b=d/2,_=f/2,w=p+1,M=m+1;let S=0,E=0;const T=new Ae;for(let a=0;a0?1:-1,l.push(T.x,T.y,T.z),c.push(s/p),c.push(1-a/m),S+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}bn.prototype.isShaderMaterial=!0;class _n extends ct{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new ze,this.projectionMatrix=new ze,this.projectionMatrixInverse=new ze}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new Ae),this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}_n.prototype.isCamera=!0;class wn extends _n{constructor(e=50,t=1,n=.1,r=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*V*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*G*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*V*Math.atan(Math.tan(.5*G*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=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 e=this.near;let t=e*Math.tan(.5*G*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}const o=this.filmOffset;0!==o&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}wn.prototype.isPerspectiveCamera=!0;const Mn=90;class Sn extends ct{constructor(e,t,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new wn(Mn,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Ae(1,0,0)),this.add(r);const i=new wn(Mn,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Ae(-1,0,0)),this.add(i);const a=new wn(Mn,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new Ae(0,1,0)),this.add(a);const o=new wn(Mn,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Ae(0,-1,0)),this.add(o);const s=new wn(Mn,1,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Ae(0,0,1)),this.add(s);const A=new wn(Mn,1,e,t);A.layers=this.layers,A.up.set(0,-1,0),A.lookAt(new Ae(0,0,-1)),this.add(A)}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,a,o,s,A]=this.children,l=e.xr.enabled,c=e.getRenderTarget();e.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=u,e.setRenderTarget(n,5),e.render(t,A),e.setRenderTarget(c),e.xr.enabled=l}}class En extends re{constructor(e,t,n,r,i,a,o,s,A,l){super(e=void 0!==e?e:[],t=void 0!==t?t:301,n,r,i,a,o=void 0!==o?o:M,s,A,l),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}En.prototype.isCubeTexture=!0;class Tn extends oe{constructor(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),super(e,e,t),t=t||{},this.texture=new En(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:m,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=S,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.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 \n\t\t\t\t\t#include \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 \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 gn(5,5,5),i=new bn({name:"CubemapFromEquirect",uniforms:vn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;const a=new pn(r,i),o=t.minFilter;t.minFilter===g&&(t.minFilter=m);return new Sn(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}}Tn.prototype.isWebGLCubeRenderTarget=!0;const Ln=new Pe,Cn=new Ae;class Pn{constructor(e=new ft,t=new ft,n=new ft,r=new ft,i=new ft,a=new ft){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],A=n[5],l=n[6],c=n[7],u=n[8],h=n[9],d=n[10],f=n[11],p=n[12],m=n[13],g=n[14],v=n[15];return t[0].setComponents(o-r,c-s,f-u,v-p).normalize(),t[1].setComponents(o+r,c+s,f+u,v+p).normalize(),t[2].setComponents(o+i,c+A,f+h,v+m).normalize(),t[3].setComponents(o-i,c-A,f-h,v-m).normalize(),t[4].setComponents(o-a,c-l,f-d,v-g).normalize(),t[5].setComponents(o+a,c+l,f+d,v+g).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ln.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ln)}intersectsSprite(e){return Ln.center.set(0,0,0),Ln.radius=.7071067811865476,Ln.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ln)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Cn.y=r.normal.y>0?e.max.y:e.min.y,Cn.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Cn)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Rn(){let e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function qn(e,t){const n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){const e=r.get(t);return void((!e||e.version 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), rawDiffuseColor, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), rawDiffuseColor, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 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#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t 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\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 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\t#ifdef USE_TRANSMISSIONMAP\n\t\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSNMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 f0 = vec3( pow( ior - 1.0, 2.0 ) / pow( ior + 1.0, 2.0 ) );\n\tvec3 f90 = vec3( 1.0 );\n\tvec3 f_transmission = totalTransmission * getIBLVolumeRefraction(\n\t\tnormal, v, viewDir, roughnessFactor, diffuseColor.rgb, f0, f90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance);\n\tdiffuseColor.rgb = mix( diffuseColor.rgb, f_transmission, totalTransmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\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 vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, 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(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, 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\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, vec3 viewDir, float perceptualRoughness, vec3 baseColor, vec3 f0, vec3 f90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec3 attenuationColor, 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\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\tfloat NdotV = saturate(dot(n, viewDir));\n\t\tvec2 brdf = integrateSpecularBRDF(NdotV, perceptualRoughness);\n\t\tvec3 specularColor = f0 * brdf.x + f90 * brdf.y;\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\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_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform vec3 attenuationColor;\n\tuniform float attenuationDistance;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef USE_TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t\tfloat thicknessFactor = thickness;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 rawDiffuseColor = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#ifdef USE_TRANSMISSION\n\tvarying vec4 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition;\n#endif\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},Bn={common:{diffuse:{value:new It(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new $},uv2Transform:{value:new $},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new K(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new It(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 It(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new $}},sprite:{diffuse:{value:new It(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new $}}},kn={basic:{uniforms:yn([Bn.common,Bn.specularmap,Bn.envmap,Bn.aomap,Bn.lightmap,Bn.fog]),vertexShader:In.meshbasic_vert,fragmentShader:In.meshbasic_frag},lambert:{uniforms:yn([Bn.common,Bn.specularmap,Bn.envmap,Bn.aomap,Bn.lightmap,Bn.emissivemap,Bn.fog,Bn.lights,{emissive:{value:new It(0)}}]),vertexShader:In.meshlambert_vert,fragmentShader:In.meshlambert_frag},phong:{uniforms:yn([Bn.common,Bn.specularmap,Bn.envmap,Bn.aomap,Bn.lightmap,Bn.emissivemap,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,Bn.fog,Bn.lights,{emissive:{value:new It(0)},specular:{value:new It(1118481)},shininess:{value:30}}]),vertexShader:In.meshphong_vert,fragmentShader:In.meshphong_frag},standard:{uniforms:yn([Bn.common,Bn.envmap,Bn.aomap,Bn.lightmap,Bn.emissivemap,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,Bn.roughnessmap,Bn.metalnessmap,Bn.fog,Bn.lights,{emissive:{value:new It(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:In.meshphysical_vert,fragmentShader:In.meshphysical_frag},toon:{uniforms:yn([Bn.common,Bn.aomap,Bn.lightmap,Bn.emissivemap,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,Bn.gradientmap,Bn.fog,Bn.lights,{emissive:{value:new It(0)}}]),vertexShader:In.meshtoon_vert,fragmentShader:In.meshtoon_frag},matcap:{uniforms:yn([Bn.common,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,Bn.fog,{matcap:{value:null}}]),vertexShader:In.meshmatcap_vert,fragmentShader:In.meshmatcap_frag},points:{uniforms:yn([Bn.points,Bn.fog]),vertexShader:In.points_vert,fragmentShader:In.points_frag},dashed:{uniforms:yn([Bn.common,Bn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:In.linedashed_vert,fragmentShader:In.linedashed_frag},depth:{uniforms:yn([Bn.common,Bn.displacementmap]),vertexShader:In.depth_vert,fragmentShader:In.depth_frag},normal:{uniforms:yn([Bn.common,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,{opacity:{value:1}}]),vertexShader:In.normal_vert,fragmentShader:In.normal_frag},sprite:{uniforms:yn([Bn.sprite,Bn.fog]),vertexShader:In.sprite_vert,fragmentShader:In.sprite_frag},background:{uniforms:{uvTransform:{value:new $},t2D:{value:null}},vertexShader:In.background_vert,fragmentShader:In.background_frag},cube:{uniforms:yn([Bn.envmap,{opacity:{value:1}}]),vertexShader:In.cube_vert,fragmentShader:In.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:In.equirect_vert,fragmentShader:In.equirect_frag},distanceRGBA:{uniforms:yn([Bn.common,Bn.displacementmap,{referencePosition:{value:new Ae},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:In.distanceRGBA_vert,fragmentShader:In.distanceRGBA_frag},shadow:{uniforms:yn([Bn.lights,Bn.fog,{color:{value:new It(0)},opacity:{value:1}}]),vertexShader:In.shadow_vert,fragmentShader:In.shadow_frag}};function On(e,t,n,r,i){const a=new It(0);let o,s,A=0,l=null,c=0,u=null;function h(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,i)}return{getClearColor:function(){return a},setClearColor:function(e,t=1){a.set(e),A=t,h(a,A)},getClearAlpha:function(){return A},setClearAlpha:function(e){A=e,h(a,A)},render:function(n,i){let d=!1,f=!0===i.isScene?i.background:null;f&&f.isTexture&&(f=t.get(f));const p=e.xr,m=p.getSession&&p.getSession();m&&"additive"===m.environmentBlendMode&&(f=null),null===f?h(a,A):f&&f.isColor&&(h(f,1),d=!0),(e.autoClear||d)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||306===f.mapping)?(void 0===s&&(s=new pn(new gn(1,1,1),new bn({name:"BackgroundCubeMaterial",uniforms:vn(kn.cube.uniforms),vertexShader:kn.cube.vertexShader,fragmentShader:kn.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(s)),s.material.uniforms.envMap.value=f,s.material.uniforms.flipEnvMap.value=f.isCubeTexture&&f._needsFlipEnvMap?-1:1,l===f&&c===f.version&&u===e.toneMapping||(s.material.needsUpdate=!0,l=f,c=f.version,u=e.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null)):f&&f.isTexture&&(void 0===o&&(o=new pn(new Dn(2,2),new bn({name:"BackgroundMaterial",uniforms:vn(kn.background.uniforms),vertexShader:kn.background.vertexShader,fragmentShader:kn.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),l===f&&c===f.version&&u===e.toneMapping||(o.material.needsUpdate=!0,l=f,c=f.version,u=e.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null))}}}function Nn(e,t,n,r){const i=e.getParameter(34921),a=r.isWebGL2?null:t.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},A=h(null);let l=A;function c(t){return r.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function u(t){return r.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function h(e){const t=[],n=[],r=[];for(let e=0;e=0){const a=A[t];if(void 0!==a){const t=a.normalized,i=a.itemSize,o=n.get(a);if(void 0===o)continue;const A=o.buffer,l=o.type,c=o.bytesPerElement;if(a.isInterleavedBufferAttribute){const n=a.data,o=n.stride,u=a.offset;n&&n.isInstancedInterleavedBuffer?(p(r,n.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=n.meshPerAttribute*n.count)):f(r),e.bindBuffer(34962,A),g(r,i,l,t,o*c,u*c)}else a.isInstancedBufferAttribute?(p(r,a.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)):f(r),e.bindBuffer(34962,A),g(r,i,l,t,0,0)}else if("instanceMatrix"===t){const t=n.get(i.instanceMatrix);if(void 0===t)continue;const a=t.buffer,o=t.type;p(r+0,1),p(r+1,1),p(r+2,1),p(r+3,1),e.bindBuffer(34962,a),e.vertexAttribPointer(r+0,4,o,!1,64,0),e.vertexAttribPointer(r+1,4,o,!1,64,16),e.vertexAttribPointer(r+2,4,o,!1,64,32),e.vertexAttribPointer(r+3,4,o,!1,64,48)}else if("instanceColor"===t){const t=n.get(i.instanceColor);if(void 0===t)continue;const a=t.buffer,o=t.type;p(r,1),e.bindBuffer(34962,a),e.vertexAttribPointer(r,3,o,!1,12,0)}else if(void 0!==c){const n=c[t];if(void 0!==n)switch(n.length){case 2:e.vertexAttrib2fv(r,n);break;case 3:e.vertexAttrib3fv(r,n);break;case 4:e.vertexAttrib4fv(r,n);break;default:e.vertexAttrib1fv(r,n)}}}}m()}(i,A,u,v),null!==y&&e.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const e in s){const t=s[e];for(const e in t){const n=t[e];for(const e in n)u(n[e].object),delete n[e];delete t[e]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0===s[e.id])return;const t=s[e.id];for(const e in t){const n=t[e];for(const e in n)u(n[e].object),delete n[e];delete t[e]}delete s[e.id]},releaseStatesOfProgram:function(e){for(const t in s){const n=s[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)u(r[e].object),delete r[e];delete n[e.id]}},initAttributes:d,enableAttribute:f,disableUnusedAttributes:m}}function zn(e,t,n,r){const i=r.isWebGL2;let a;this.setMode=function(e){a=e},this.render=function(t,r){e.drawArrays(a,t,r),n.update(r,a,1)},this.renderInstances=function(r,o,s){if(0===s)return;let A,l;if(i)A=e,l="drawArraysInstanced";else if(A=t.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 Fn(e,t,n){let r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const A=a||t.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),u=e.getParameter(35660),h=e.getParameter(3379),d=e.getParameter(34076),f=e.getParameter(34921),p=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=u>0,y=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:A,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?e.getParameter(36183):0}}function Un(e){const t=this;let n=null,r=0,i=!1,a=!1;const o=new ft,s=new $,A={value:null,needsUpdate:!1};function l(){A.value!==n&&(A.value=n,A.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function c(e,n,r,i){const a=null!==e?e.length:0;let l=null;if(0!==a){if(l=A.value,!0!==i||null===l){const t=r+4*a,i=n.matrixWorldInverse;s.getNormalMatrix(i),(null===l||l.length0){const o=e.getRenderTarget(),s=new Tn(a.height/2);return s.fromEquirectangularTexture(e,i),t.set(i,s),e.setRenderTarget(o),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}}return i},dispose:function(){t=new WeakMap}}}function Gn(e){const t={};function n(n){if(void 0!==t[n])return t[n];let r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Vn(e,t,n,r){const i={},a=new WeakMap;function o(e){const s=e.target;null!==s.index&&t.remove(s.index);for(const e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener("dispose",o),delete i[s.id];const A=a.get(s);A&&(t.remove(A),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){const n=[],r=e.index,i=e.attributes.position;let o=0;if(null!==r){const e=r.array;o=r.version;for(let t=0,r=e.length;t65535?Ft:zt)(n,1);s.version=o;const A=a.get(e);A&&t.remove(A),a.set(e,s)}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",o),i[t.id]=!0,n.memory.geometries++),t},update:function(e){const n=e.attributes;for(const e in n)t.update(n[e],34962);const r=e.morphAttributes;for(const e in r){const n=r[e];for(let e=0,r=n.length;e0)return e;const i=t*n;let a=rr[i];if(void 0===a&&(a=new Float32Array(i),rr[i]=a),0!==t){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function lr(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n/gm;function hi(e){return e.replace(ui,di)}function di(e,t){const n=In[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return hi(n)}const fi=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,pi=/#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 mi(e){return e.replace(pi,vi).replace(fi,gi)}function gi(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),vi(e,t,n,r)}function vi(e,t,n,r){let i="";for(let e=parseInt(t);e0?e.gammaFactor:1,d=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission>0)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ai).join("\n")}(n),f=function(e){const t=[];for(const n in e){const r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(a),p=i.createProgram();let m,g,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(m=[f].filter(Ai).join("\n"),m.length>0&&(m+="\n"),g=[d,f].filter(Ai).join("\n"),g.length>0&&(g+="\n")):(m=[yi(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+h,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+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","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Ai).join("\n"),g=[d,yi(n),"#define SHADER_NAME "+n.shaderName,f,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+h,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 "+c:"",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.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",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":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?In.tonemapping_pars_fragment:"",0!==n.toneMapping?si("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",In.encodings_pars_fragment,n.map?ai("mapTexelToLinear",n.mapEncoding):"",n.matcap?ai("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?ai("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?ai("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?ai("lightMapTexelToLinear",n.lightMapEncoding):"",oi("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ai).join("\n")),o=hi(o),o=li(o,n),o=ci(o,n),s=hi(s),s=li(s,n),s=ci(s,n),o=mi(o),s=mi(s),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",m=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,g=["#define varying in",n.glslVersion===z?"":"out highp vec4 pc_fragColor;",n.glslVersion===z?"":"#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"+g);const y=v+g+s,x=ti(i,35633,v+m+o),b=ti(i,35632,y);if(i.attachShader(p,x),i.attachShader(p,b),void 0!==n.index0AttributeName?i.bindAttribLocation(p,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(p,0,"position"),i.linkProgram(p),e.debug.checkShaderErrors){const e=i.getProgramInfoLog(p).trim(),t=i.getShaderInfoLog(x).trim(),n=i.getShaderInfoLog(b).trim();let r=!0,a=!0;if(!1===i.getProgramParameter(p,35714)){r=!1;const t=ii(i,x,"vertex"),n=ii(i,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(p,35715),"gl.getProgramInfoLog",e,t,n)}else""!==e?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",e):""!==t&&""!==n||(a=!1);a&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:t,prefix:m},fragmentShader:{log:n,prefix:g}})}let _,w;return i.deleteShader(x),i.deleteShader(b),this.getUniforms=function(){return void 0===_&&(_=new ei(i,p)),_},this.getAttributes=function(){return void 0===w&&(w=function(e,t){const n={},r=e.getProgramParameter(t,35721);for(let i=0;i0,maxBones:_,useVertexTexture:l,morphTargets:i.morphTargets,morphNormals:i.morphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&f.length>0,shadowMapType:e.shadowMap.type,toneMapping:i.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:2===i.side,flipSided:1===i.side,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:s||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:s||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:s||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);if(!1===t.isRawShaderMaterial){for(let e=0;e0?i.push(c):!0===n.transparent?a.push(c):r.push(c)},unshift:function(e,t,n,o,A,l){const c=s(e,t,n,o,A,l);n.transmission>0?i.unshift(c):!0===n.transparent?a.unshift(c):r.unshift(c)},finish:function(){for(let e=n,r=t.length;e1&&r.sort(e||wi),i.length>1&&i.sort(t||Mi),a.length>1&&a.sort(t||Mi)}}}function Ei(e){let t=new WeakMap;return{get:function(n,r){let i;return!1===t.has(n)?(i=new Si(e),t.set(n,[i])):r>=t.get(n).length?(i=new Si(e),t.get(n).push(i)):i=t.get(n)[r],i},dispose:function(){t=new WeakMap}}}function Ti(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Ae,color:new It};break;case"SpotLight":n={position:new Ae,direction:new Ae,color:new It,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ae,color:new It,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ae,skyColor:new It,groundColor:new It};break;case"RectAreaLight":n={color:new It,position:new Ae,halfWidth:new Ae,halfHeight:new Ae}}return e[t.id]=n,n}}}let Li=0;function Ci(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Pi(e,t){const n=new Ti,r=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},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 e=0;e<9;e++)i.probe.push(new Ae);const a=new Ae,o=new ze,s=new ze;return{setup:function(a){let o=0,s=0,A=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0;a.sort(Ci);for(let e=0,t=a.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=Bn.LTC_FLOAT_1,i.rectAreaLTC2=Bn.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=Bn.LTC_HALF_1,i.rectAreaLTC2=Bn.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=o,i.ambient[1]=s,i.ambient[2]=A;const g=i.hash;g.directionalLength===l&&g.pointLength===c&&g.spotLength===u&&g.rectAreaLength===h&&g.hemiLength===d&&g.numDirectionalShadows===f&&g.numPointShadows===p&&g.numSpotShadows===m||(i.directional.length=l,i.spot.length=u,i.rectArea.length=h,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=f,i.directionalShadowMap.length=f,i.pointShadow.length=p,i.pointShadowMap.length=p,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=f,i.pointShadowMatrix.length=p,i.spotShadowMatrix.length=m,g.directionalLength=l,g.pointLength=c,g.spotLength=u,g.rectAreaLength=h,g.hemiLength=d,g.numDirectionalShadows=f,g.numPointShadows=p,g.numSpotShadows=m,i.version=Li++)},setupView:function(e,t){let n=0,r=0,A=0,l=0,c=0;const u=t.matrixWorldInverse;for(let t=0,h=e.length;t=n.get(r).length?(a=new Ri(e,t),n.get(r).push(a)):a=n.get(r)[i],a},dispose:function(){n=new WeakMap}}}class Di extends Tt{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}Di.prototype.isMeshDepthMaterial=!0;class Ii extends Tt{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Ae,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}Ii.prototype.isMeshDistanceMaterial=!0;function Bi(e,t,n){let r=new Pn;const i=new K,a=new K,o=new ae,s=[],A=[],l={},c=n.maxTextureSize,u={0:1,1:0,2:2},h=new bn({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=h.clone();d.defines.HORIZONTAL_PASS=1;const f=new Zt;f.setAttribute("position",new Nt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new pn(f,h),v=this;function y(n,r){const i=t.update(g);h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,h,g,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,d,g,null)}function x(e){const t=e<<0;let n=s[t];return void 0===n&&(n=new Di({depthPacking:3201,morphTargets:e}),s[t]=n),n}function b(e){const t=e<<0;let n=A[t];return void 0===n&&(n=new Ii({morphTargets:e}),A[t]=n),n}function _(t,n,r,i,a,o,s){let A=null,c=x,h=t.customDepthMaterial;if(!0===i.isPointLight&&(c=b,h=t.customDistanceMaterial),void 0===h){let e=!1;!0===r.morphTargets&&(e=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0),A=c(e)}else A=h;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const e=A.uuid,t=r.uuid;let n=l[e];void 0===n&&(n={},l[e]=n);let i=n[t];void 0===i&&(i=A.clone(),n[t]=i),A=i}return A.visible=r.visible,A.wireframe=r.wireframe,A.side=3===s?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:u[r.side],A.clipShadows=r.clipShadows,A.clippingPlanes=r.clippingPlanes,A.clipIntersection=r.clipIntersection,A.wireframeLinewidth=r.wireframeLinewidth,A.linewidth=r.linewidth,!0===i.isPointLight&&!0===A.isMeshDistanceMaterial&&(A.referencePosition.setFromMatrixPosition(i.matrixWorld),A.nearDistance=a,A.farDistance=o),A}function w(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=t.update(n),i=n.material;if(Array.isArray(i)){const t=r.groups;for(let A=0,l=t.length;Ac||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/d.x),i.x=a.x*d.x,u.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/d.y),i.y=a.y*d.y,u.mapSize.y=a.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const e={minFilter:m,magFilter:m,format:S};u.map=new oe(i.x,i.y,e),u.map.texture.name=l.name+".shadowMap",u.mapPass=new oe(i.x,i.y,e),u.camera.updateProjectionMatrix()}if(null===u.map){const e={minFilter:p,magFilter:p,format:S};u.map=new oe(i.x,i.y,e),u.map.texture.name=l.name+".shadowMap",u.camera.updateProjectionMatrix()}e.setRenderTarget(u.map),e.clear();const f=u.getViewportCount();for(let e=0;e=1):-1!==C.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL ES (\d)/.exec(C)[1]),T=L>=2);let P=null,R={};const q=e.getParameter(3088),D=e.getParameter(2978),I=(new ae).fromArray(q),B=(new ae).fromArray(D);function k(t,n,r){const i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;tr||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=t?Z:Math.floor,a=r(i*e.width),o=r(i*e.height);void 0===L&&(L=P(a,o));const s=n?P(a,o):L;s.width=a,s.height=o;return s.getContext("2d").drawImage(e,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+o+")."),s}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function q(e){return X(e.width)&&X(e.height)}function D(e,t){return e.generateMipmaps&&t&&e.minFilter!==p&&e.minFilter!==m}function I(t,n,i,a){e.generateMipmap(t);r.get(n).__maxMipLevel=Math.log2(Math.max(i,a))}function B(n,r,i){if(!1===s)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let a=r;return 6403===r&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===r&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===r&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function k(e){return e===p||1004===e||1005===e?9728:9729}function O(t){const n=t.target;n.removeEventListener("dispose",O),function(t){const n=r.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),r.remove(t)}(n),n.isVideoTexture&&v.delete(n),o.memory.textures--}function N(t){const n=t.target;n.removeEventListener("dispose",N),function(t){const n=t.texture,i=r.get(t),a=r.get(n);if(!t)return;void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t]);else e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&e.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,i=n.length;t0&&i.__version!==e.version){const n=e.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void W(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function U(t,i){const o=r.get(t);t.version>0&&o.__version!==t.version?function(t,r,i){if(6!==r.image.length)return;j(t,r),n.activeTexture(33984+i),n.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),A=r.image[0]&&r.image[0].isDataTexture,c=[];for(let e=0;e<6;e++)c[e]=o||A?A?r.image[e].image:r.image[e]:R(r.image[e],!1,!0,l);const u=c[0],h=q(u)||s,d=a.convert(r.format),f=a.convert(r.type),p=B(r.internalFormat,d,f);let m;if(V(34067,r,h),o){for(let e=0;e<6;e++){m=c[e].mipmaps;for(let t=0;t1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function j(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",O),t.__webglTexture=e.createTexture(),o.memory.textures++)}function W(t,r,i){let o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),j(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);const A=function(e){return!s&&(e.wrapS!==d||e.wrapT!==d||e.minFilter!==p&&e.minFilter!==m)}(r)&&!1===q(r.image),l=R(r.image,A,!1,c),u=q(l)||s,h=a.convert(r.format);let f,g=a.convert(r.type),v=B(r.internalFormat,h,g);V(o,r,u);const _=r.mipmaps;if(r.isDepthTexture)v=6402,s?v=r.type===b?36012:r.type===x?33190:r.type===w?35056:33189:r.type===b&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===E&&6402===v&&r.type!==y&&r.type!==x&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=y,g=a.convert(r.type)),r.format===T&&6402===v&&(v=34041,r.type!==w&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=w,g=a.convert(r.type))),n.texImage2D(3553,0,v,l.width,l.height,0,h,g,null);else if(r.isDataTexture)if(_.length>0&&u){for(let e=0,t=_.length;e0&&u){for(let e=0,t=_.length;e=A&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+A),z+=1,e},this.resetTextureUnits=function(){z=0},this.setTexture2D=F,this.setTexture2DArray=function(e,t){const i=r.get(e);e.version>0&&i.__version!==e.version?W(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){const i=r.get(e);e.version>0&&i.__version!==e.version?W(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=U,this.setupRenderTarget=function(t){const A=t.texture,l=r.get(t),c=r.get(A);t.addEventListener("dispose",N),!0!==t.isWebGLMultipleRenderTargets&&(c.__webglTexture=e.createTexture(),c.__version=A.version,o.memory.textures++);const u=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultipleRenderTargets,d=!0===t.isWebGLMultisampleRenderTarget,f=A.isDataTexture3D||A.isDataTexture2DArray,p=q(t)||s;if(!s||A.format!==M||A.type!==b&&A.type!==_||(A.format=S,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),u){l.__webglFramebuffer=[];for(let t=0;t<6;t++)l.__webglFramebuffer[t]=e.createFramebuffer()}else if(l.__webglFramebuffer=e.createFramebuffer(),h)if(i.drawBuffers){const n=t.texture;for(let t=0,i=n.length;ts+l?(A.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!A.inputState.pinching&&o<=s-l&&(A.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&(i=t.getPose(e.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));return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==A&&(A.visible=null!==a),this}}class Gi extends F{constructor(e,t){super();const n=this,r=e.state;let i=null,a=1,o=null,s="local-floor",A=null;const l=[],c=new Map,u=new wn;u.layers.enable(1),u.viewport=new ae;const h=new wn;h.layers.enable(2),h.viewport=new ae;const d=[u,h],f=new zi;f.layers.enable(1),f.layers.enable(2);let p=null,m=null;function g(e){const t=c.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function v(){c.forEach((function(e,t){e.disconnect(t)})),c.clear(),p=null,m=null,r.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(e){const t=i.inputSources;for(let e=0;e0&&(e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height));e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap);e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)}(e,r,o):n(e,r)):r.isMeshMatcapMaterial?(t(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDepthMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDistanceMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?(t(e,r),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);let i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,i,a):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);let n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function ji(e){const t=void 0!==(e=e||{}).canvas?e.canvas:function(){const e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,r=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,A=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",c=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let u=null,h=null;const f=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=B,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const y=this;let x=!1,w=0,M=0,E=null,T=-1,L=null;const C=new ae,P=new ae;let R=null,q=t.width,D=t.height,I=1,k=null,O=null;const N=new ae(0,0,q,D),z=new ae(0,0,q,D);let F=!1;const U=[],H=new Pn;let G=!1,V=!1,j=null;const W=new ze,Q=new Ae,Y={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function X(){return null===E?I:1}let Z,J,$,ee,te,ne,re,ie,se,le,ce,ue,he,de,fe,pe,me,ge,ve,ye,xe,be,_e=n;function we(e,n){for(let r=0;r0&&Ie(r,e,t),i.length>0&&function(e,t,n,r){null===j&&(j=new oe(1024,1024,{generateMipmaps:!0,minFilter:g,magFilter:p,wrapS:d,wrapT:d}));const i=y.getRenderTarget();y.setRenderTarget(j),y.clear(),Ie(e,n,r),ne.updateRenderTargetMipmap(j),y.setRenderTarget(i),Ie(t,n,r)}(r,i,e,t),a.length>0&&Ie(a,e,t),null!==E&&(ne.updateRenderTargetMipmap(E),ne.updateMultisampleRenderTarget(E)),!0===e.isScene&&e.onAfterRender(y,e,t),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1),be.resetDefaultState(),T=-1,L=null,m.pop(),h=m.length>0?m[m.length-1]:null,f.pop(),u=f.length>0?f[f.length-1]:null},this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return E},this.setRenderTarget=function(e,t=0,n=0){E=e,w=t,M=n,e&&void 0===te.get(e).__webglFramebuffer&&ne.setupRenderTarget(e);let r=null,i=!1,a=!1;if(e){const n=e.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(a=!0);const o=te.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=o[t],i=!0):r=e.isWebGLMultisampleRenderTarget?te.get(e).__webglMultisampledFramebuffer:o,C.copy(e.viewport),P.copy(e.scissor),R=e.scissorTest}else C.copy(N).multiplyScalar(I).floor(),P.copy(z).multiplyScalar(I).floor(),R=F;if($.bindFramebuffer(36160,r)&&J.drawBuffers){let t=!1;if(e)if(e.isWebGLMultipleRenderTargets){const n=e.texture;if(U.length!==n.length||36064!==U[0]){for(let e=0,t=n.length;e=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&_e.readPixels(t,n,r,i,xe.convert(s),xe.convert(A),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const e=null!==E?te.get(E).__webglFramebuffer:null;$.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){const r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r);let o=xe.convert(t.format);J.isWebGL2&&(6407===o&&(o=32849),6408===o&&(o=32856)),ne.setTexture2D(t,0),_e.copyTexImage2D(3553,n,o,e.x,e.y,i,a,0),$.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r=0){const i=t.image.width,a=t.image.height,o=xe.convert(n.format),s=xe.convert(n.type);ne.setTexture2D(n,0),_e.pixelStorei(37440,n.flipY),_e.pixelStorei(37441,n.premultiplyAlpha),_e.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?_e.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?_e.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):_e.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&_e.generateMipmap(3553),$.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,r,i=0){if(y.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:a,height:o,data:s}=n.image,A=xe.convert(r.format),l=xe.convert(r.type);let c;if(r.isDataTexture3D)ne.setTexture3D(r,0),c=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");ne.setTexture2DArray(r,0),c=35866}_e.pixelStorei(37440,r.flipY),_e.pixelStorei(37441,r.premultiplyAlpha),_e.pixelStorei(3317,r.unpackAlignment);const u=_e.getParameter(3314),h=_e.getParameter(32878),d=_e.getParameter(3316),f=_e.getParameter(3315),p=_e.getParameter(32877);_e.pixelStorei(3314,a),_e.pixelStorei(32878,o),_e.pixelStorei(3316,e.min.x),_e.pixelStorei(3315,e.min.y),_e.pixelStorei(32877,e.min.z),_e.texSubImage3D(c,i,t.x,t.y,t.z,e.max.x-e.min.x+1,e.max.y-e.min.y+1,e.max.z-e.min.z+1,A,l,s),_e.pixelStorei(3314,u),_e.pixelStorei(32878,h),_e.pixelStorei(3316,d),_e.pixelStorei(3315,f),_e.pixelStorei(32877,p),0===i&&r.generateMipmaps&&_e.generateMipmap(c),$.unbindTexture()},this.initTexture=function(e){ne.setTexture2D(e,0),$.unbindTexture()},this.resetState=function(){w=0,M=0,E=null,$.reset(),be.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends ji{}).prototype.isWebGL1Renderer=!0;class Wi extends ct{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}Wi.prototype.isScene=!0;class Qi{constructor(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=O,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=j()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;re.far||t.push({distance:s,point:Ki.clone(),uv:St.getUV(Ki,ia,aa,oa,sa,Aa,la,new K),face:null,object:this})}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}).prototype.isSprite=!0;const ua=new Ae,ha=new ae,da=new ae,fa=new Ae,pa=new ze;class ma extends pn{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ze,this.bindMatrixInverse=new ze}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ae,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;ns)continue;u.applyMatrix4(this.matrixWorld);const h=e.ray.origin.distanceTo(u);he.far||t.push({distance:h,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,a.start),r=Math.min(i.count,a.start+a.count)-1;ns)continue;u.applyMatrix4(this.matrixWorld);const r=e.ray.origin.distanceTo(u);re.far||t.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Ta.prototype.isLine=!0;const La=new Ae,Ca=new Ae;class Pa extends Ta{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,r=t.count;ei.far)return;a.push({distance:A,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,object:o})}}(class extends ct{constructor(e=new Zt,t=new Ra){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ia.copy(n.boundingSphere),Ia.applyMatrix4(r),Ia.radius+=i,!1===e.ray.intersectsSphere(Ia))return;qa.copy(r).invert(),Da.copy(e.ray).applyMatrix4(qa);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position;if(null!==i){for(let n=Math.max(0,a.start),A=Math.min(i.count,a.start+a.count);n0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}).prototype.isPoints=!0;(class extends re{constructor(e,t,n,r,i,a,o,s,A){super(e,t,n,r,i,a,o,s,A),this.format=void 0!==o?o:M,this.minFilter=void 0!==a?a:m,this.magFilter=void 0!==i?i:m,this.generateMipmaps=!1;const l=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){l.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}).prototype.isVideoTexture=!0;(class extends re{constructor(e,t,n,r,i,a,o,s,A,l,c,u){super(null,a,o,s,A,l,r,i,c,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isCompressedTexture=!0;(class extends re{constructor(e,t,n,r,i,a,o,s,A){super(e,t,n,r,i,a,o,s,A),this.needsUpdate=!0}}).prototype.isCanvasTexture=!0;(class extends re{constructor(e,t,n,r,i,a,o,s,A,l){if((l=void 0!==l?l:E)!==E&&l!==T)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===E&&(n=y),void 0===n&&l===T&&(n=w),super(null,r,i,a,o,s,l,n,A),this.image={width:e,height:t},this.magFilter=void 0!==o?o:p,this.minFilter=void 0!==s?s:p,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isDepthTexture=!0;new Ae,new Ae,new Ae,new St;const Oa=function(e,t,n){n=n||2;const r=t&&t.length,i=r?t[0]*n:e.length;let a=Na(e,0,i,n,!0);const o=[];if(!a||a.next===a.prev)return o;let s,A,l,c,u,h,d;if(r&&(a=function(e,t,n,r){const i=[];let a,o,s,A,l;for(a=0,o=t.length;a80*n){s=l=e[0],A=c=e[1];for(let t=n;tl&&(l=u),h>c&&(c=h);d=Math.max(l-s,c-A),d=0!==d?1/d:0}return Fa(a,o,n,s,A,d),o};function Na(e,t,n,r,i){let a,o;if(i===function(e,t,n,r){let i=0;for(let a=t,o=n-r;a0)for(a=t;a=t;a-=r)o=ao(a,e[a],e[a+1],o);return o&&$a(o,o.next)&&(oo(o),o=o.next),o}function za(e,t){if(!e)return e;t||(t=e);let n,r=e;do{if(n=!1,r.steiner||!$a(r,r.next)&&0!==Ka(r.prev,r,r.next))r=r.next;else{if(oo(r),r=t=r.prev,r===r.next)break;n=!0}}while(n||r!==t);return t}function Fa(e,t,n,r,i,a,o){if(!e)return;!o&&a&&function(e,t,n,r){let i=e;do{null===i.z&&(i.z=Ya(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n,r,i,a,o,s,A,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t0||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:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(e,r,i,a);let s,A,l=e;for(;e.prev!==e.next;)if(s=e.prev,A=e.next,a?Ha(e,r,i,a):Ua(e))t.push(s.i/n),t.push(e.i/n),t.push(A.i/n),oo(e),e=A.next,l=A.next;else if((e=A)===l){o?1===o?Fa(e=Ga(za(e),t,n),t,n,r,i,a,2):2===o&&Va(e,t,n,r,i,a):Fa(za(e),t,n,r,i,a,1);break}}function Ua(e){const t=e.prev,n=e,r=e.next;if(Ka(t,n,r)>=0)return!1;let i=e.next.next;for(;i!==e.prev;){if(Za(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Ka(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Ha(e,t,n,r){const i=e.prev,a=e,o=e.next;if(Ka(i,a,o)>=0)return!1;const s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,u=Ya(s,A,t,n,r),h=Ya(l,c,t,n,r);let d=e.prevZ,f=e.nextZ;for(;d&&d.z>=u&&f&&f.z<=h;){if(d!==e.prev&&d!==e.next&&Za(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Ka(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&Za(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ka(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&Za(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Ka(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=h;){if(f!==e.prev&&f!==e.next&&Za(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ka(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Ga(e,t,n){let r=e;do{const i=r.prev,a=r.next.next;!$a(i,a)&&eo(i,r,r.next,a)&&ro(i,a)&&ro(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),oo(r),oo(r.next),r=e=a),r=r.next}while(r!==e);return za(r)}function Va(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Ja(o,e)){let s=io(o,e);return o=za(o,o.next),s=za(s,s.next),Fa(o,t,n,r,i,a),void Fa(s,t,n,r,i,a)}e=e.next}o=o.next}while(o!==e)}function ja(e,t){return e.x-t.x}function Wa(e,t){if(t=function(e,t){let n=t;const r=e.x,i=e.y;let a,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>o){if(o=e,e===r){if(i===n.y)return n;if(i===n.next.y)return n.next}a=n.x=n.x&&n.x>=A&&r!==n.x&&Za(ia.x||n.x===a.x&&Qa(a,n)))&&(a=n,u=c)),n=n.next}while(n!==s);return a}(e,t)){const n=io(t,e);za(t,t.next),za(n,n.next)}}function Qa(e,t){return Ka(e.prev,e,t.prev)<0&&Ka(t.next,e,e.next)<0}function Ya(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Xa(e){let t=e,n=e;do{(t.x=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Ja(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&eo(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(ro(e,t)&&ro(t,e)&&function(e,t){let n=e,r=!1;const i=(e.x+t.x)/2,a=(e.y+t.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!==e);return r}(e,t)&&(Ka(e.prev,e,t.prev)||Ka(e,t.prev,t))||$a(e,t)&&Ka(e.prev,e,e.next)>0&&Ka(t.prev,t,t.next)>0)}function Ka(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function $a(e,t){return e.x===t.x&&e.y===t.y}function eo(e,t,n,r){const i=no(Ka(e,t,n)),a=no(Ka(e,t,r)),o=no(Ka(n,r,e)),s=no(Ka(n,r,t));return i!==a&&o!==s||(!(0!==i||!to(e,n,t))||(!(0!==a||!to(e,r,t))||(!(0!==o||!to(n,e,r))||!(0!==s||!to(n,t,r)))))}function to(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function no(e){return e>0?1:e<0?-1:0}function ro(e,t){return Ka(e.prev,e,e.next)<0?Ka(e,t,e.next)>=0&&Ka(e,e.prev,t)>=0:Ka(e,t,e.prev)<0||Ka(e,e.next,t)<0}function io(e,t){const n=new so(e.i,e.x,e.y),r=new so(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function ao(e,t,n,r){const i=new so(e,t,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 oo(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function so(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Ao{static area(e){const t=e.length;let n=0;for(let r=t-1,i=0;i2&&e[t-1].equals(e[0])&&e.pop()}function co(e,t){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(c),h=Math.sqrt(A*A+l*l),d=t.x-s/u,f=t.y+o/u,p=((n.x-l/h-d)*l-(n.y+A/h-f)*A)/(o*l-s*A);r=d+o*p-e.x,i=f+s*p-e.y;const m=r*r+i*i;if(m<=2)return new K(r,i);a=Math.sqrt(m/2)}else{let e=!1;o>Number.EPSILON?A>Number.EPSILON&&(e=!0):o<-Number.EPSILON?A<-Number.EPSILON&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(c)):(r=o,i=s,a=Math.sqrt(c/2))}return new K(r/a,i/a)}const R=[];for(let e=0,t=E.length,n=t-1,r=e+1;e=0;e--){const t=e/d,n=c*Math.cos(t*Math.PI/2),r=u*Math.sin(t*Math.PI/2)+h;for(let e=0,t=E.length;e=0;){const r=n;let i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+2*d;e0)&&h.push(t,i,A),(e!==n-1||s=r)){A.push(t.times[e]);for(let n=0;na.tracks[e].times[0]&&(s=a.tracks[e].times[0]);for(let e=0;e=r.times[u]){const e=u*A+s,t=e+A-s;h=yo.arraySlice(r.values,e,t)}else{const e=r.createInterpolant(),t=s,n=A-s;e.evaluate(a),h=yo.arraySlice(e.resultBuffer,t,n)}if("quaternion"===i){(new se).fromArray(h).normalize().conjugate().toArray(h)}const d=o.times.length;for(let e=0;e=i)break e;{const o=t[1];e=i)break t}a=n,n=0}}for(;n>>1;et;)--a;if(++a,0!==i||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);const e=this.getValueSize();this.times=yo.arraySlice(n,i,a),this.values=yo.arraySlice(this.values,i*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==i;t++){const r=n[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==a&&a>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,a),e=!1;break}a=r}if(void 0!==r&&yo.isTypedArray(r))for(let t=0,n=r.length;t!==n;++t){const n=r[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=yo.arraySlice(this.times),t=yo.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===P,i=e.length-1;let a=1;for(let o=1;o0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a!==e.length?(this.times=yo.arraySlice(e,0,a),this.values=yo.arraySlice(t,0,a*n)):(this.times=e,this.values=t),this}clone(){const e=yo.arraySlice(this.times,0),t=yo.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}Mo.prototype.TimeBufferType=Float32Array,Mo.prototype.ValueBufferType=Float32Array,Mo.prototype.DefaultInterpolation=C;class So extends Mo{}So.prototype.ValueTypeName="bool",So.prototype.ValueBufferType=Array,So.prototype.DefaultInterpolation=L,So.prototype.InterpolantFactoryMethodLinear=void 0,So.prototype.InterpolantFactoryMethodSmooth=void 0;class Eo extends Mo{}Eo.prototype.ValueTypeName="color";class To extends Mo{}To.prototype.ValueTypeName="number";class Lo extends xo{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t);let A=e*o;for(let e=A+o;A!==e;A+=4)se.slerpFlat(i,0,a,A-o,a,A,s);return i}}class Co extends Mo{InterpolantFactoryMethodLinear(e){return new Lo(this.times,this.values,this.getValueSize(),e)}}Co.prototype.ValueTypeName="quaternion",Co.prototype.DefaultInterpolation=C,Co.prototype.InterpolantFactoryMethodSmooth=void 0;class Po extends Mo{}Po.prototype.ValueTypeName="string",Po.prototype.ValueBufferType=Array,Po.prototype.DefaultInterpolation=L,Po.prototype.InterpolantFactoryMethodLinear=void 0,Po.prototype.InterpolantFactoryMethodSmooth=void 0;class Ro extends Mo{}Ro.prototype.ValueTypeName="vector";class qo{constructor(e,t=-1,n,r=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=j(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(Do(n[e]).scale(r));const i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push(Mo.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const i=t.length,a=[];for(let e=0;e1){const e=a[1];let t=r[e];t||(r[e]=t=[]),t.push(n)}}const a=[];for(const e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,r,i){if(0!==n.length){const a=[],o=[];yo.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.fps||30,o=e.blendMode;let s=e.length||-1;const A=e.hierarchy||[];for(let e=0;e0||0===e.search(/^data\:image\/jpeg/);i.format=r?M:S,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}class Ho{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const i=n.length;let a;a=t||e*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(e,t){const n=1e-4;let r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);const a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new K:new Ae);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Ae,r=[],i=[],a=[],o=new Ae,s=new ze;for(let t=0;t<=e;t++){const n=t/e;r[t]=this.getTangentAt(n,new Ae),r[t].normalize()}i[0]=new Ae,a[0]=new Ae;let A=Number.MAX_VALUE;const l=Math.abs(r[0].x),c=Math.abs(r[0].y),u=Math.abs(r[0].z);l<=A&&(A=l,n.set(1,0,0)),c<=A&&(A=c,n.set(0,1,0)),u<=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 t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(W(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(!0===t){let t=Math.acos(W(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Go extends Ho{constructor(e=0,t=0,n=1,r=1,i=0,a=2*Math.PI,o=!1,s=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t){const n=t||new K,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const a=Math.abs(i)r;)i-=r;i0?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]:(Wo.subVectors(r[0],r[1]).add(r[0]),o=Wo);const c=r[A%i],u=r[(A+1)%i];if(this.closed||A+2r.length-2?r.length-1:a+1],c=r[a>r.length-3?r.length-1:a+2];return n.set(Jo(o,s.x,A.x,l.x,c.x),Jo(o,s.y,A.y,l.y,c.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=t){const e=n[r]-t,i=this.curves[r],a=i.getLength(),o=0===a?0:1-e/a;return i.getPointAt(o)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=A.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(A);const l=A.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class ls extends As{constructor(e){super(e),this.uuid=j(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;nNumber.EPSILON){if(A<0&&(n=t[a],s=-s,o=t[i],A=-A),e.yo.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=A*(e.x-n.x)-s*(e.y-n.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return r}const i=Ao.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);let o,s,A;const l=[];if(1===a.length)return s=a[0],A=new ls,A.curves=s.curves,l.push(A),l;let c=!i(a[0].getPoints());c=e?!c:c;const u=[],h=[];let d,f,p=[],m=0;h[m]=void 0,p[m]=[];for(let t=0,n=a.length;t1){let e=!1;const t=[];for(let e=0,t=h.length;e0&&(e||(p=u))}for(let e=0,t=h.length;e0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let e=t,i=t+t;e!==i;++e)if(n[e]!==n[e+t]){o.setValue(n,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let e=n,i=r;e!==i;++e)t[e]=t[r+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let r=0;r!==i;++r)e[t+r]=e[n+r]}_slerp(e,t,n,r){se.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,i){const a=this._workIndex*i;se.multiplyQuaternionsFlat(e,a,e,t,e,n),se.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,n,r,i){const a=1-r;for(let o=0;o!==i;++o){const i=t+o;e[i]=e[i]*a+e[n+o]*r}}_lerpAdditive(e,t,n,r,i){for(let a=0;a!==i;++a){const i=t+a;e[i]=e[i]+e[n+a]*r}}}const ks="\\[\\]\\.:\\/",Os=new RegExp("[\\[\\]\\.:\\/]","g"),Ns="[^\\[\\]\\.:\\/]",zs="[^"+ks.replace("\\.","")+"]",Fs=/((?:WC+[\/:])*)/.source.replace("WC",Ns),Us=/(WCOD+)?/.source.replace("WCOD",zs),Hs=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ns),Gs=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ns),Vs=new RegExp("^"+Fs+Us+Hs+Gs+"$"),js=["material","materials","bones"];class Ws{constructor(e,t,n){this.path=t,this.parsedPath=n||Ws.parseTrackName(t),this.node=Ws.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ws.Composite(e,t,n):new Ws(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Os,"")}static parseTrackName(e){const t=Vs.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const e=n.nodeName.substring(r+1);-1!==js.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let r=0;r0){const e=this._interpolants,t=this._propertyBindings;switch(this.blendMode){case 2501:for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulateAdditive(o);break;case I:default:for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulate(r,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,i=this._loopCount;const a=2202===n;if(0===e)return-1===i?r:a&&1==(1&i)?t-r:r;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){const n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);const o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){const t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(a&&1==(1&i))return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=q,r.endingEnd=q):(r.endingStart=e?this.zeroSlopeAtStart?q:R:D,r.endingEnd=t?this.zeroSlopeAtEnd?q:R:D)}_scheduleFading(e,t,n){const r=this._mixer,i=r.time;let a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}(class extends F{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,A=this._bindingsByRootAndName;let l=A[s];void 0===l&&(l={},A[s]=l);for(let e=0;e!==i;++e){const i=r[e],A=i.name;let c=l[A];if(void 0!==c)a[e]=c;else{if(c=a[e],void 0!==c){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,s,A));continue}const r=t&&t._propertyBindings[e].binding.parsedPath;c=new Bs(Ws.create(n,A,r),i.ValueTypeName,i.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,s,A),a[e]=c}o[e].resultBuffer=c.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let o=0;o!==n;++o){t[o]._update(r,e,i,a)}const o=this._bindings,s=this._nActiveBindings;for(let e=0;e!==s;++e)o[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e=0?r=setTimeout(A,t-l):(r=null,n||(s=e.apply(a,i),a=i=null))}null==t&&(t=100);var l=function(){a=this,i=arguments,o=Date.now();var l=n&&!r;return r||(r=setTimeout(A,t)),l&&(s=e.apply(a,i),a=i=null),s};return l.clear=function(){r&&(clearTimeout(r),r=null)},l.flush=function(){r&&(s=e.apply(a,i),a=i=null,clearTimeout(r),r=null)},l}AA.debounce=AA;var lA=AA;function cA(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return uA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uA(e,t)}(e,t)||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 uA(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},n instanceof Function?n(e):n,{initialised:!1}),r={};function i(t){return a(t,e),s(),i}var a=function(e,n){c.call(i,e,t,n),t.initialised=!0},s=lA((function(){t.initialised&&(h.call(i,t,r),r={})}),1);return d.forEach((function(e){i[e.name]=function(e){var n=e.name,a=e.triggerUpdate,o=void 0!==a&&a,A=e.onChange,l=void 0===A?function(e,t){}:A,c=e.defaultVal,u=void 0===c?null:c;return function(e){var a=t[n];if(!arguments.length)return a;var A=void 0===e?u:e;return t[n]=A,l.call(i,A,t,a),!r.hasOwnProperty(n)&&(r[n]=a),o&&s(),i}}(e)})),Object.keys(o).forEach((function(e){i[e]=function(){for(var n,r=arguments.length,a=new Array(r),s=0;s0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?a(e[n],e[n-1],n-r):a(e[i],e[i+1>n?n:i+1],r-i)},Bezier:function(e,t){for(var n=0,r=e.length-1,i=Math.pow,a=vA.Utils.Bernstein,o=0;o<=r;o++)n+=i(1-t,r-o)*i(t,o)*e[o]*a(r,o);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),a=vA.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(i=Math.floor(r=n*(1+t))),a(e[(i-1+n)%n],e[i],e[(i+1)%n],e[(i+2)%n],r-i)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(a(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):a(e[i?i-1:0],e[i],e[n1;n--)t*=n;return fA[e]=t,t}),CatmullRom:function(e,t,n,r,i){var a=.5*(n-e),o=.5*(r-t),s=i*i;return(2*t-2*n+a+o)*(i*s)+(-3*t+3*n-2*a-o)*s+a*i+t}}},yA=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),xA=new gA,bA=function(){function e(e,t){void 0===t&&(t=xA),this._object=e,this._group=t,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=pA.Linear.None,this._interpolationFunction=vA.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=yA.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?mA()+parseFloat(e):e:mA(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,r){for(var i in n){var a=e[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===t[i]&&(t[i]=a),o||(t[i]*=1),r[i]=A?n[i].slice().reverse():t[i]||0;else{for(var c in t[i]=o?[]:{},a)t[i][c]=a[c];r[i]=o?[]:{},this._setupProperties(a,t[i],n[i],r[i])}}}},e.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},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=mA()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=mA()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;ei)return!1;t&&this.start(e)}if(this._goToEnd=!1,e1?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=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,s=this._chainedTweens.length;o80*n){r=a=e[0],i=o=e[1];for(var f=n;fa&&(a=s),A>o&&(o=A);l=0!==(l=Math.max(a-r,o-i))?1/l:0}return IA(h,d,n,r,i,l),d}function qA(e,t,n,r,i){var a,o;if(i===nl(e,t,n,r)>0)for(a=t;a=t;a-=r)o=$A(a,e[a],e[a+1],o);return o&&QA(o,o.next)&&(el(o),o=o.next),o}function DA(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!QA(r,r.next)&&0!==WA(r.prev,r,r.next))r=r.next;else{if(el(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function IA(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=HA(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,A,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t0||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:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(e,r,i,a);for(var s,A,l=e;e.prev!==e.next;)if(s=e.prev,A=e.next,a?kA(e,r,i,a):BA(e))t.push(s.i/n),t.push(e.i/n),t.push(A.i/n),el(e),e=A.next,l=A.next;else if((e=A)===l){o?1===o?IA(e=OA(DA(e),t,n),t,n,r,i,a,2):2===o&&NA(e,t,n,r,i,a):IA(DA(e),t,n,r,i,a,1);break}}}function BA(e){var t=e.prev,n=e,r=e.next;if(WA(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(VA(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&WA(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function kA(e,t,n,r){var i=e.prev,a=e,o=e.next;if(WA(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,u=HA(s,A,t,n,r),h=HA(l,c,t,n,r),d=e.prevZ,f=e.nextZ;d&&d.z>=u&&f&&f.z<=h;){if(d!==e.prev&&d!==e.next&&VA(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&WA(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&VA(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&WA(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&VA(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&WA(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=h;){if(f!==e.prev&&f!==e.next&&VA(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&WA(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function OA(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!QA(i,a)&&YA(i,r,r.next,a)&&JA(i,a)&&JA(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),el(r),el(r.next),r=e=a),r=r.next}while(r!==e);return DA(r)}function NA(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&jA(o,s)){var A=KA(o,s);return o=DA(o,o.next),A=DA(A,A.next),IA(o,t,n,r,i,a),void IA(A,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function zA(e,t){return e.x-t.x}function FA(e,t){if(t=function(e,t){var n,r=t,i=e.x,a=e.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){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x=r.x&&r.x>=c&&i!==r.x&&VA(an.x||r.x===n.x&&UA(n,r)))&&(n=r,h=A)),r=r.next}while(r!==l);return n}(e,t)){var n=KA(t,e);DA(t,t.next),DA(n,n.next)}}function UA(e,t){return WA(e.prev,e,t.prev)<0&&WA(t.next,e,e.next)<0}function HA(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function GA(e){var t=e,n=e;do{(t.x=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function jA(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&YA(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(JA(e,t)&&JA(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.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!==e);return r}(e,t)&&(WA(e.prev,e,t.prev)||WA(e,t.prev,t))||QA(e,t)&&WA(e.prev,e,e.next)>0&&WA(t.prev,t,t.next)>0)}function WA(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function QA(e,t){return e.x===t.x&&e.y===t.y}function YA(e,t,n,r){var i=ZA(WA(e,t,n)),a=ZA(WA(e,t,r)),o=ZA(WA(n,r,e)),s=ZA(WA(n,r,t));return i!==a&&o!==s||(!(0!==i||!XA(e,n,t))||(!(0!==a||!XA(e,r,t))||(!(0!==o||!XA(n,e,r))||!(0!==s||!XA(n,t,r)))))}function XA(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ZA(e){return e>0?1:e<0?-1:0}function JA(e,t){return WA(e.prev,e,e.next)<0?WA(e,t,e.next)>=0&&WA(e,e.prev,t)>=0:WA(e,t,e.prev)<0||WA(e,e.next,t)<0}function KA(e,t){var n=new tl(e.i,e.x,e.y),r=new tl(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function $A(e,t,n,r){var i=new tl(e,t,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 el(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function tl(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function nl(e,t,n,r){for(var i=0,a=t,o=n-r;a0&&(r+=e[i-1].length,n.holes.push(r))}return n};var rl=PA.exports;function il(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function al(e){let t=e,n=e;function r(e,t,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;n(e[a],t)<0?r=a+1:i=a}return r}return 1===e.length&&(t=(t,n)=>e(t)-n,n=function(e){return(t,n)=>il(e(t),n)}(e)),{left:r,center:function(e,n,i,a){null==i&&(i=0),null==a&&(a=e.length);const o=r(e,n,i,a-1);return o>i&&t(e[o-1],n)>-t(e[o],n)?o-1:o},right:function(e,t,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;n(e[a],t)>0?i=a:r=a+1}return r}}}const ol=al(il).right;al((function(e){return null===e?NaN:+e})).center;class sl{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let r=0;r0){for(a=e[--i];i>0&&(t=a,n=e[--i],a=t+n,r=n-(a-t),!r););i>0&&(r<0&&e[i-1]<0||r>0&&e[i-1]>0)&&(n=2*r,t=a+n,n==t-a&&(a=t))}return a}}var Al=Math.sqrt(50),ll=Math.sqrt(10),cl=Math.sqrt(2);function ul(e,t,n){var r=(t-e)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=Al?10:a>=ll?5:a>=cl?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=Al?10:a>=ll?5:a>=cl?2:1)}function hl(e,t){let n=0,r=0;if(void 0===t)for(let t of e)null!=t&&(t=+t)>=t&&(++n,r+=t);else{let i=-1;for(let a of e)null!=(a=t(a,++i,e))&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n}function dl(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function fl(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=new Array(i);++r0?1:e<0?-1:0},Ll=Math.sqrt;function Cl(e){return e>1?gl:e<-1?-gl:Math.asin(e)}function Pl(e){return(e=El(e/2))*e}function Rl(){}function ql(e,t){e&&Il.hasOwnProperty(e.type)&&Il[e.type](e,t)}var Dl={Feature:function(e,t){ql(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,a=Ml(t=(t*=bl)/2+vl),o=El(t),s=Hl*o,A=Ul*a+s*Ml(i),l=s*r*El(i);ec.add(wl(l,A)),Fl=e,Ul=a,Hl=o}function sc(e){var t=e[0],n=e[1],r=Ml(n);return[r*Ml(t),r*El(t),El(n)]}function Ac(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function lc(e){var t=Ll(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var cc,uc,hc,dc,fc={point:pc,lineStart:gc,lineEnd:vc,polygonStart:function(){fc.point=yc,fc.lineStart=xc,fc.lineEnd=bc,Jl=new sl,nc.polygonStart()},polygonEnd:function(){nc.polygonEnd(),fc.point=pc,fc.lineStart=gc,fc.lineEnd=vc,ec<0?(Gl=-(jl=180),Vl=-(Wl=90)):Jl>pl?Wl=90:Jl<-1e-6&&(Vl=-90),$l[0]=Gl,$l[1]=jl},sphere:function(){Gl=-(jl=180),Vl=-(Wl=90)}};function pc(e,t){Kl.push($l=[Gl=e,jl=e]),tWl&&(Wl=t)}function mc(e,t){var n=sc([e*bl,t*bl]);if(Zl){var r=Ac(Zl,n),i=Ac([r[1],-r[0],0],r);lc(i),i=function(e){return[wl(e[1],e[0]),Cl(e[2])]}(i);var a,o=e-Ql,s=o>0?1:-1,A=i[0]*xl*s,l=_l(o)>180;l^(s*QlWl&&(Wl=a):l^(s*Ql<(A=(A+360)%360-180)&&AWl&&(Wl=t)),l?e_c(Gl,jl)&&(jl=e):_c(e,jl)>_c(Gl,jl)&&(Gl=e):jl>=Gl?(ejl&&(jl=e)):e>Ql?_c(Gl,e)>_c(Gl,jl)&&(jl=e):_c(e,jl)>_c(Gl,jl)&&(Gl=e)}else Kl.push($l=[Gl=e,jl=e]);tWl&&(Wl=t),Zl=n,Ql=e}function gc(){fc.point=mc}function vc(){$l[0]=Gl,$l[1]=jl,fc.point=pc,Zl=null}function yc(e,t){if(Zl){var n=e-Ql;Jl.add(_l(n)>180?n+(n>0?360:-360):n)}else Yl=e,Xl=t;nc.point(e,t),mc(e,t)}function xc(){nc.lineStart()}function bc(){yc(Yl,Xl),nc.lineEnd(),_l(Jl)>pl&&(Gl=-(jl=180)),$l[0]=Gl,$l[1]=jl,Zl=null}function _c(e,t){return(t-=e)<0?t+360:t}function wc(e,t){return e[0]-t[0]}function Mc(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_c(r[0],r[1])&&(r[1]=i[1]),_c(i[0],r[1])>_c(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,t=0,r=a[n=a.length-1];t<=n;r=i,++t)i=a[t],(s=_c(r[1],i[0]))>o&&(o=s,Gl=i[0],jl=r[1])}return Kl=$l=null,Gl===1/0||Vl===1/0?[[NaN,NaN],[NaN,NaN]]:[[Gl,Vl],[jl,Wl]]}function Ec(e){return _l(e[0])<=ml?e[0]:Tl(e[0])*((_l(e[0])+ml)%yl-ml)}var Tc={sphere:Rl,point:Rl,lineStart:function(){Tc.point=Cc,Tc.lineEnd=Lc},lineEnd:Rl,polygonStart:Rl,polygonEnd:Rl};function Lc(){Tc.point=Tc.lineEnd=Rl}function Cc(e,t){uc=e*=bl,hc=El(t*=bl),dc=Ml(t),Tc.point=Pc}function Pc(e,t){e*=bl;var n=El(t*=bl),r=Ml(t),i=_l(e-uc),a=Ml(i),o=r*El(i),s=dc*n-hc*r*a,A=hc*n+dc*r*a;cc.add(wl(Ll(o*o+s*s),A)),uc=e,hc=n,dc=r}var Rc=[null,null],qc={type:"LineString",coordinates:Rc};function Dc(e,t){return Rc[0]=e,Rc[1]=t,function(e){return cc=new sl,Ol(e,Tc),+cc}(qc)}var Ic={Feature:function(e,t){return kc(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r0&&(i=Dc(e[a],e[a-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))<1e-12*i)return!0;n=r}return!1}function zc(e,t){return!!function(e,t){var n=Ec(t),r=t[1],i=El(r),a=[El(n),-Ml(n),0],o=0,s=0,A=new sl;1===i?r=gl+pl:-1===i&&(r=-gl-pl);for(var l=0,c=e.length;l=0?1:-1,E=S*M,T=E>ml,L=m*_;if(A.add(wl(L*S*El(E),g*w+L*Ml(E))),o+=T?M+S*yl:M,T^f>=n^x>=n){var C=Ac(sc(d),sc(y));lc(C);var P=Ac(a,C);lc(P);var R=(T^M>=0?-1:1)*Cl(P[2]);(r>R||r===R&&(C[0]||C[1]))&&(s+=T^M>=0?1:-1)}}return(o<-1e-6||opl})).map(A)).concat(fl(Sl(a/d)*d,i,d).filter((function(e){return _l(e%p)>pl})).map(l))}return g.lines=function(){return v().map((function(e){return{type:"LineString",coordinates:e}}))},g.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(u(o).slice(1),c(n).reverse().slice(1),u(s).reverse().slice(1))]}},g.extent=function(e){return arguments.length?g.extentMajor(e).extentMinor(e):g.extentMinor()},g.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),g.precision(m)):[[r,s],[n,o]]},g.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),g.precision(m)):[[t,a],[e,i]]},g.step=function(e){return arguments.length?g.stepMajor(e).stepMinor(e):g.stepMinor()},g.stepMajor=function(e){return arguments.length?(f=+e[0],p=+e[1],g):[f,p]},g.stepMinor=function(e){return arguments.length?(h=+e[0],d=+e[1],g):[h,d]},g.precision=function(h){return arguments.length?(m=+h,A=Gc(a,i,90),l=Vc(t,e,m),c=Gc(s,o,90),u=Vc(r,n,m),g):m},g.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()()}function Wc(e,t){var n=e[0]*bl,r=e[1]*bl,i=t[0]*bl,a=t[1]*bl,o=Ml(r),s=El(r),A=Ml(a),l=El(a),c=o*Ml(n),u=o*El(n),h=A*Ml(i),d=A*El(i),f=2*Cl(Ll(Pl(a-r)+o*A*Pl(i-n))),p=El(f),m=f?function(e){var t=El(e*=f)/p,n=El(f-e)/p,r=n*c+t*h,i=n*u+t*d,a=n*s+t*l;return[wl(i,r)*xl,wl(a,Ll(r*r+i*i))*xl]}:function(){return[n*xl,r*xl]};return m.distance=f,m}function Qc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yc(e){return(Yc=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Xc(e,t){return(Xc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zc(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Jc(e){var t=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(e){return!1}}();return function(){var n,r=Yc(e);if(t){var i=Yc(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Zc(this,n)}}function Kc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||$c(e,t)||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 $c(e,t){if(e){if("string"==typeof e)return eu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?eu(e,t):void 0}}function eu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],r=null;return e.forEach((function(e){if(r){var i=180*Dc(e,r)/Math.PI;if(i>t)for(var a=Wc(r,e),o=1/Math.ceil(i/t),s=o;s<1;)n.push(a(s)),s+=o}n.push(r=e)})),n},nu=window.THREE?window.THREE:{BufferGeometry:Zt,Float32BufferAttribute:Ut},ru=(new nu.BufferGeometry).setAttribute?"setAttribute":"addAttribute",iu=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xc(e,t)}(n,e);var t=Jc(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;Qc(this,n),(r=t.call(this)).type="GeoJsonGeometry",r.parameters={geoJson:e,radius:i,resolution:a};var o=({Point:c,MultiPoint:u,LineString:h,MultiLineString:d,Polygon:f,MultiPolygon:p}[e.type]||function(){return[]})(e.coordinates,i),s=[],A=[],l=0;function c(e,t){return[{vertices:su(e[1],e[0],t),indices:[]}]}function u(e,t){var n={vertices:[],indices:[]};return e.map((function(e){return c(e,t)})).forEach((function(e){var t=Kc(e,1)[0];au(n,t)})),[n]}function h(e,t){for(var n=tu(e,a).map((function(e){var n=Kc(e,2),r=n[0];return su(n[1],r,t)})),r=rl.flatten([n]).vertices,i=Math.round(r.length/3),o=[],s=1;s=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;e.push(i)}}catch(e){r.e(e)}finally{r.f()}}function su(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-e)*Math.PI/180,i=(90-t)*Math.PI/180;return[n*Math.sin(r)*Math.cos(i),n*Math.cos(r),n*Math.sin(r)*Math.sin(i)]}class Au{static computeTangents(e){e.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}static mergeBufferGeometries(e,t=!1){const n=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),i=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=e[0].morphTargetsRelative,A=new Zt;let l=0;for(let c=0;c[])))}const h=Math.log10(1/t),d=Math.pow(10,h);for(let t=0;t1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(e=P(e,360),t=P(t,100),n=P(n,100),0===t)r=i=a=n;else{var s=n<.5?n*(1+t):n+t-n*t,A=2*n-s;r=o(A,s,e+1/3),i=o(A,s,e),a=o(A,s,e-1/3)}return{r:255*r,g:255*i,b:255*a}}(e.h,A,c),u=!0,h="hsl"),e.hasOwnProperty("a")&&(a=e.a));var d,f,p;return a=C(a),{ok:u,format:e.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}}(e);this._originalInput=e,this._r=c.r,this._g=c.g,this._b=c.b,this._a=c.a,this._roundA=a(100*this._a)/100,this._format=A.format||c.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=c.ok,this._tc_id=i++}function c(e,t,n){e=P(e,255),t=P(t,255),n=P(n,255);var r,i,a=s(e,t,n),A=o(e,t,n),l=(a+A)/2;if(a==A)r=i=0;else{var c=a-A;switch(i=l>.5?c/(2-a-A):c/(a+A),a){case e:r=(t-n)/c+(t>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(l(r));return a}function E(e,t){t=t||6;for(var n=l(e).toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)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 e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,n,r,i=this.toRgb();return e=i.r/255,n=i.g/255,r=i.b/255,.2126*(e<=.03928?e/12.92:t.pow((e+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:t.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:t.pow((r+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=a(100*this._a)/100,this},toHsv:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=u(this._r,this._g,this._b),t=a(360*e.h),n=a(100*e.s),r=a(100*e.v);return 1==this._a?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=c(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=c(this._r,this._g,this._b),t=a(360*e.h),n=a(100*e.s),r=a(100*e.l);return 1==this._a?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return h(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,n,r,i){var o=[D(a(e).toString(16)),D(a(t).toString(16)),D(a(n).toString(16)),D(B(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,e)},toHex8String:function(e){return"#"+this.toHex8(e)},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)&&(L[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+d(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var i=l(e);n="#"+d(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0;return t||!r||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return l(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));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(y,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},l.fromRatio=function(e,t){if("object"==typeof e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]="a"===r?e[r]:I(e[r]));e=n}return l(e,t)},l.equals=function(e,t){return!(!e||!t)&&l(e).toRgbString()==l(t).toRgbString()},l.random=function(){return l.fromRatio({r:A(),g:A(),b:A()})},l.mix=function(e,t,n){n=0===n?0:n||50;var r=l(e).toRgb(),i=l(t).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})}, // =4.5;break;case"AAlarge":i=a>=3;break;case"AAAsmall":i=a>=7}return i},l.mostReadable=function(e,t,n){var r,i,a,o,s=null,A=0;i=(n=n||{}).includeFallbackColors,a=n.level,o=n.size;for(var c=0;cA&&(A=r,s=l(t[c]));return l.isReadable(e,s,{level:a,size:o})||!i?s:(n.includeFallbackColors=!1,l.mostReadable(e,["#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"},L=l.hexNames=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}(T);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function P(e,n){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var r=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=o(n,s(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),t.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function R(e){return o(1,s(0,e))}function q(e){return parseInt(e,16)}function D(e){return 1==e.length?"0"+e:""+e}function I(e){return e<=1&&(e=100*e+"%"),e}function B(e){return t.round(255*parseFloat(e)).toString(16)}function k(e){return q(e)/255}var O,N,z,F=(N="[\\s|\\(]+("+(O="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+O+")[,|\\s]+("+O+")\\s*\\)?",z="[\\s|\\(]+("+O+")[,|\\s]+("+O+")[,|\\s]+("+O+")[,|\\s]+("+O+")\\s*\\)?",{CSS_UNIT:new RegExp(O),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+z),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+z),hsv:new RegExp("hsv"+N),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 U(e){return!!F.CSS_UNIT.exec(e)}e.exports?e.exports=l:window.tinycolor=l}(Math)}(cu);var uu=cu.exports;function hu(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function du(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||pu(e,t)||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 fu(e){return function(e){if(Array.isArray(e))return mu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||pu(e)||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 pu(e,t){if(e){if("string"==typeof e)return mu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mu(e,t):void 0}}function mu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=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=(t instanceof Array?t.length?t:[void 0]:[t]).map((function(e){return{keyAccessor:e,isProp:!(e instanceof Function)}})),a=e.reduce((function(e,t){var r=e,a=t;return i.forEach((function(e,t){var o,s=e.keyAccessor;if(e.isProp){var A=a,l=A[s],c=hu(A,[s].map(gu));o=l,a=c}else o=s(a,t);t+11&&void 0!==arguments[1]?arguments[1]:1;r===i.length?Object.keys(t).forEach((function(e){return t[e]=n(t[e])})):Object.values(t).forEach((function(t){return e(t,r+1)}))}(a);var o=a;return r&&(o=[],function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];n.length===i.length?o.push({keys:n,vals:t}):Object.entries(t).forEach((function(t){var r=du(t,2),i=r[0],a=r[1];return e(a,[].concat(fu(n),[i]))}))}(a),t instanceof Array&&0===t.length&&1===o.length&&(o[0].keys=[])),o};function yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bu(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function _u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||Mu(e,t)||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 wu(e){return function(e){if(Array.isArray(e))return Su(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Mu(e)||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 Mu(e,t){if(e){if("string"==typeof e)return Su(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Su(e,t):void 0}}function Su(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=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()},e.prototype.update=function(e,t){void 0===t&&(t=!0),this._currentTick++,this._currentTime+=e,this._tickDeltaTime=e,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),t&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},e.prototype.getTimer=function(){return Date.now()},e}();Object.defineProperty(t,"__esModule",{value:!0}),t.default=i},function(e,t,n){!function(t,n){e.exports=n()}(0,(function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){var n=function(){function e(){this.functions=[]}return e.prototype.add=function(e){return-1===this.functions.indexOf(e)&&(this.functions.push(e),!0)},e.prototype.remove=function(e){var t=this.functions.indexOf(e);return t>-1&&(this.functions.splice(t,1),!0)},e.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},e.prototype.dispatch=function(){for(var e=[],t=0;t>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Ju(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Ju(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Fu.exec(e))?new eh(t[1],t[2],t[3],1):(t=Uu.exec(e))?new eh(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Hu.exec(e))?Ju(t[1],t[2],t[3],t[4]):(t=Gu.exec(e))?Ju(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Vu.exec(e))?ih(t[1],t[2]/100,t[3]/100,1):(t=ju.exec(e))?ih(t[1],t[2]/100,t[3]/100,t[4]):Wu.hasOwnProperty(e)?Zu(Wu[e]):"transparent"===e?new eh(NaN,NaN,NaN,0):null}function Zu(e){return new eh(e>>16&255,e>>8&255,255&e,1)}function Ju(e,t,n,r){return r<=0&&(e=t=n=NaN),new eh(e,t,n,r)}function Ku(e){return e instanceof Du||(e=Xu(e)),e?new eh((e=e.rgb()).r,e.g,e.b,e.opacity):new eh}function $u(e,t,n,r){return 1===arguments.length?Ku(e):new eh(e,t,n,null==r?1:r)}function eh(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function th(){return"#"+rh(this.r)+rh(this.g)+rh(this.b)}function nh(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function rh(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function ih(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new oh(e,t,n,r)}function ah(e){if(e instanceof oh)return new oh(e.h,e.s,e.l,e.opacity);if(e instanceof Du||(e=Xu(e)),!e)return new oh;if(e instanceof oh)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,A=(a+i)/2;return s?(o=t===a?(n-r)/s+6*(n0&&A<1?0:o,new oh(o,s,A,e.opacity)}function oh(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function sh(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Ru(Du,Xu,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:Qu,formatHex:Qu,formatHsl:function(){return ah(this).formatHsl()},formatRgb:Yu,toString:Yu}),Ru(eh,$u,qu(Du,{brighter:function(e){return e=null==e?Bu:Math.pow(Bu,e),new eh(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?Iu:Math.pow(Iu,e),new eh(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){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:th,formatHex:th,formatRgb:nh,toString:nh})),Ru(oh,(function(e,t,n,r){return 1===arguments.length?ah(e):new oh(e,t,n,null==r?1:r)}),qu(Du,{brighter:function(e){return e=null==e?Bu:Math.pow(Bu,e),new oh(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?Iu:Math.pow(Iu,e),new oh(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new eh(sh(e>=240?e-240:e+120,i,r),sh(e,i,r),sh(e<120?e+240:e-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var Ah=e=>()=>e;function lh(e){return 1==(e=+e)?ch:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Ah(isNaN(t)?n:t)}}function ch(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Ah(isNaN(e)?t:e)}var uh=function e(t){var n=lh(t);function r(e,t){var r=n((e=$u(e)).r,(t=$u(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=ch(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function hh(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;na&&(i=t.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:gh(n,r)})),a=xh.lastIndex;return at&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(o[0],o[e-1])),r=e>2?Ch:Lh,i=a=null,u}function u(t){return null==t||isNaN(t=+t)?n:(i||(i=r(o.map(e),s,A)))(e(l(t)))}return u.invert=function(n){return l(t((a||(a=r(s,o.map(e),gh)))(n)))},u.domain=function(e){return arguments.length?(o=Array.from(e,Mh),c()):o.slice()},u.range=function(e){return arguments.length?(s=Array.from(e),c()):s.slice()},u.rangeRound=function(e){return s=Array.from(e),A=wh,c()},u.clamp=function(e){return arguments.length?(l=!!e||Eh,c()):l!==Eh},u.interpolate=function(e){return arguments.length?(A=e,c()):A},u.unknown=function(e){return arguments.length?(n=e,u):n},function(n,r){return e=n,t=r,c()}}function qh(){return Rh()(Eh,Eh)}function Dh(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Ih(e){return(e=Dh(Math.abs(e)))?e[1]:NaN}var Bh,kh=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Oh(e){if(!(t=kh.exec(e)))throw new Error("invalid format: "+e);var t;return new Nh({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function Nh(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function zh(e,t){var n=Dh(e,t);if(!n)return e+"";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")}Oh.prototype=Nh.prototype,Nh.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 Fh={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>zh(100*e,t),r:zh,s:function(e,t){var n=Dh(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(Bh=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")+Dh(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Uh(e){return e}var Hh,Gh,Vh,jh=Array.prototype.map,Wh=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Qh(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?Uh:(t=jh.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,s=t[0],A=0;i>0&&s>0&&(A+s+1>r&&(s=Math.max(1,r-A)),a.push(e.substring(i-=s,i+s)),!((A+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(n)}),i=void 0===e.currency?"":e.currency[0]+"",a=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?Uh:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(jh.call(e.numerals,String)),A=void 0===e.percent?"%":e.percent+"",l=void 0===e.minus?"−":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function u(e){var t=(e=Oh(e)).fill,n=e.align,u=e.sign,h=e.symbol,d=e.zero,f=e.width,p=e.comma,m=e.precision,g=e.trim,v=e.type;"n"===v?(p=!0,v="g"):Fh[v]||(void 0===m&&(m=12),g=!0,v="g"),(d||"0"===t&&"="===n)&&(d=!0,t="0",n="=");var y="$"===h?i:"#"===h&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===h?a:/[%p]/.test(v)?A:"",b=Fh[v],_=/[defgprs%]/.test(v);function w(e){var i,a,A,h=y,w=x;if("c"===v)w=b(e)+w,e="";else{var M=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:b(Math.abs(e),m),g&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),M&&0==+e&&"+"!==u&&(M=!1),h=(M?"("===u?u:l:"-"===u||"("===u?"":u)+h,w=("s"===v?Wh[8+Bh/3]:"")+w+(M&&"("===u?")":""),_)for(i=-1,a=e.length;++i(A=e.charCodeAt(i))||A>57){w=(46===A?o+e.slice(i+1):e.slice(i))+w,e=e.slice(0,i);break}}p&&!d&&(e=r(e,1/0));var S=h.length+e.length+w.length,E=S>1)+h+e+w+E.slice(S);break;default:e=E+h+e+w}return s(e)}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 e+""},w}return{format:u,formatPrefix:function(e,t){var n=u(((e=Oh(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(Ih(t)/3))),i=Math.pow(10,-r),a=Wh[8+r/3];return function(e){return n(i*e)+a}}}}function Yh(e,t,n,r){var i,a=function(e,t,n){var r=Math.abs(t-e)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=Al?i*=10:a>=ll?i*=5:a>=cl&&(i*=2),t0)return[e];if((r=t0){let n=Math.round(e/o),r=Math.round(t/o);for(n*ot&&--r,a=new Array(i=r-n+1);++st&&--r,a=new Array(i=r-n+1);++s0;){if((i=ul(A,l,n))===r)return a[o]=A,a[s]=l,t(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 e},e}function Zh(){var e=qh();return e.copy=function(){return Ph(e,Zh())},Pu.apply(e,arguments),Xh(e)}Hh=Qh({thousands:",",grouping:[3],currency:["$",""]}),Gh=Hh.format,Vh=Hh.formatPrefix;const Jh=134217729;function Kh(e,t,n,r,i){let a,o,s,A,l=t[0],c=r[0],u=0,h=0;c>l==c>-l?(a=l,l=t[++u]):(a=c,c=r[++h]);let d=0;if(ul==c>-l?(o=l+a,s=a-(o-l),l=t[++u]):(o=c+a,s=a-(o-c),c=r[++h]),a=o,0!==s&&(i[d++]=s);ul==c>-l?(o=a+l,A=o-a,s=a-(o-A)+(l-A),l=t[++u]):(o=a+c,A=o-a,s=a-(o-A)+(c-A),c=r[++h]),a=o,0!==s&&(i[d++]=s);for(;u0!=s>0)return A;const l=Math.abs(o+s);return Math.abs(A)>=33306690738754716e-32*l?A:-function(e,t,n,r,i,a,o){let s,A,l,c,u,h,d,f,p,m,g,v,y,x,b,_,w,M;const S=e-i,E=n-i,T=t-a,L=r-a;x=S*L,h=Jh*S,d=h-(h-S),f=S-d,h=Jh*L,p=h-(h-L),m=L-p,b=f*m-(x-d*p-f*p-d*m),_=T*E,h=Jh*T,d=h-(h-T),f=T-d,h=Jh*E,p=h-(h-E),m=E-p,w=f*m-(_-d*p-f*p-d*m),g=b-w,u=b-g,ed[0]=b-(g+u)+(u-w),v=x+g,u=v-x,y=x-(v-u)+(g-u),g=y-_,u=y-g,ed[1]=y-(g+u)+(u-_),M=v+g,u=M-v,ed[2]=v-(M-u)+(g-u),ed[3]=M;let C=function(e,t){let n=t[0];for(let r=1;r=P||-C>=P)return C;if(u=e-S,s=e-(S+u)+(u-i),u=n-E,l=n-(E+u)+(u-i),u=t-T,A=t-(T+u)+(u-a),u=r-L,c=r-(L+u)+(u-a),0===s&&0===A&&0===l&&0===c)return C;if(P=11093356479670487e-47*o+33306690738754706e-32*Math.abs(C),C+=S*c+L*s-(T*l+E*A),C>=P||-C>=P)return C;x=s*L,h=Jh*s,d=h-(h-s),f=s-d,h=Jh*L,p=h-(h-L),m=L-p,b=f*m-(x-d*p-f*p-d*m),_=A*E,h=Jh*A,d=h-(h-A),f=A-d,h=Jh*E,p=h-(h-E),m=E-p,w=f*m-(_-d*p-f*p-d*m),g=b-w,u=b-g,id[0]=b-(g+u)+(u-w),v=x+g,u=v-x,y=x-(v-u)+(g-u),g=y-_,u=y-g,id[1]=y-(g+u)+(u-_),M=v+g,u=M-v,id[2]=v-(M-u)+(g-u),id[3]=M;const R=Kh(4,ed,4,id,td);x=S*c,h=Jh*S,d=h-(h-S),f=S-d,h=Jh*c,p=h-(h-c),m=c-p,b=f*m-(x-d*p-f*p-d*m),_=T*l,h=Jh*T,d=h-(h-T),f=T-d,h=Jh*l,p=h-(h-l),m=l-p,w=f*m-(_-d*p-f*p-d*m),g=b-w,u=b-g,id[0]=b-(g+u)+(u-w),v=x+g,u=v-x,y=x-(v-u)+(g-u),g=y-_,u=y-g,id[1]=y-(g+u)+(u-_),M=v+g,u=M-v,id[2]=v-(M-u)+(g-u),id[3]=M;const q=Kh(R,td,4,id,nd);x=s*c,h=Jh*s,d=h-(h-s),f=s-d,h=Jh*c,p=h-(h-c),m=c-p,b=f*m-(x-d*p-f*p-d*m),_=A*l,h=Jh*A,d=h-(h-A),f=A-d,h=Jh*l,p=h-(h-l),m=l-p,w=f*m-(_-d*p-f*p-d*m),g=b-w,u=b-g,id[0]=b-(g+u)+(u-w),v=x+g,u=v-x,y=x-(v-u)+(g-u),g=y-_,u=y-g,id[1]=y-(g+u)+(u-_),M=v+g,u=M-v,id[2]=v-(M-u)+(g-u),id[3]=M;const D=Kh(q,nd,4,id,rd);return rd[D-1]}(e,t,n,r,i,a,l)}const od=Math.pow(2,-52),sd=new Uint32Array(512);class Ad{static from(e,t=fd,n=pd){const r=e.length,i=new Float64Array(2*r);for(let a=0;a>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=e.length>>1;let o=1/0,s=1/0,A=-1/0,l=-1/0;for(let t=0;tA&&(A=n),r>l&&(l=r),this._ids[t]=t}const c=(o+A)/2,u=(s+l)/2;let h,d,f,p=1/0;for(let t=0;t0&&(d=t,p=n)}let v=e[2*d],y=e[2*d+1],x=1/0;for(let t=0;tr&&(t[n++]=i,r=this._dists[i])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(ad(m,g,v,y,b,_)<0){const e=d,t=v,n=y;d=f,v=b,y=_,f=e,b=t,_=n}const w=function(e,t,n,r,i,a){const o=n-e,s=r-t,A=i-e,l=a-t,c=o*o+s*s,u=A*A+l*l,h=.5/(o*l-s*A);return{x:e+(l*c-s*u)*h,y:t+(o*u-A*c)*h}}(m,g,v,y,b,_);this._cx=w.x,this._cy=w.y;for(let t=0;t0&&Math.abs(l-a)<=od&&Math.abs(c-o)<=od)continue;if(a=l,o=c,A===h||A===d||A===f)continue;let u=0;for(let e=0,t=this._hashKey(l,c);e=0;)if(m=p,m===u){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],ad(l,c,e[2*v],e[2*v+1],e[2*p],e[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===u)for(;p=t[m],ad(l,c,e[2*p],e[2*p+1],e[2*m],e[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=t[A]=m,n[m]=t[v]=A,n[A]=v,i[this._hashKey(l,c)]=A,i[this._hashKey(e[2*m],e[2*m+1])]=m}this.hull=new Uint32Array(M);for(let e=0,t=this._hullStart;e0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let i=0,a=0;for(;;){const o=n[e],s=e-e%3;if(a=s+(e+2)%3,-1===o){if(0===i)break;e=sd[--i];continue}const A=o-o%3,l=s+(e+1)%3,c=A+(o+2)%3,u=t[a],h=t[e],d=t[l],f=t[c];if(cd(r[2*u],r[2*u+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*f],r[2*f+1])){t[e]=f,t[o]=u;const r=n[c];if(-1===r){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,r),this._link(o,n[a]),this._link(a,c);const s=A+(o+1)%3;i=n&&t[e[o]]>a;)e[o+1]=e[o--];e[o+1]=r}else{let i=n+1,a=r;dd(e,n+r>>1,i),t[e[n]]>t[e[r]]&&dd(e,n,r),t[e[i]]>t[e[r]]&&dd(e,i,r),t[e[n]]>t[e[i]]&&dd(e,n,i);const o=e[i],s=t[o];for(;;){do{i++}while(t[e[i]]s);if(a=a-n?(hd(e,t,i,r),hd(e,t,n,a-1)):(hd(e,t,n,a-1),hd(e,t,i,r))}}function dd(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function fd(e){return e[0]}function pd(e){return e[1]}function md(e,t,n){if(void 0===n&&(n={}),!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");var r,i=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}(e),a="Feature"===(r=t).type?r.geometry:r,o=a.type,s=t.bbox,A=a.coordinates;if(s&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(i,s))return!1;"Polygon"===o&&(A=[A]);for(var l=!1,c=0;ce[1]!=l>e[1]&&e[0]<(A-o)*(e[1]-s)/(l-s)+o&&(r=!r)}return r}const vd=Math.pow(2,-52),yd=new Uint32Array(512);class xd{static from(e,t=Ld,n=Cd){const r=e.length,i=new Float64Array(2*r);for(let a=0;a>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=e.length>>1;let o=1/0,s=1/0,A=-1/0,l=-1/0;for(let t=0;tA&&(A=n),r>l&&(l=r),this._ids[t]=t}const c=(o+A)/2,u=(s+l)/2;let h,d,f,p=1/0;for(let t=0;t0&&(d=t,p=n)}let v=e[2*d],y=e[2*d+1],x=1/0;for(let t=0;tr&&(t[n++]=i,r=this._dists[i])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(wd(m,g,v,y,b,_)){const e=d,t=v,n=y;d=f,v=b,y=_,f=e,b=t,_=n}const w=function(e,t,n,r,i,a){const o=n-e,s=r-t,A=i-e,l=a-t,c=o*o+s*s,u=A*A+l*l,h=.5/(o*l-s*A);return{x:e+(l*c-s*u)*h,y:t+(o*u-A*c)*h}}(m,g,v,y,b,_);this._cx=w.x,this._cy=w.y;for(let t=0;t0&&Math.abs(l-a)<=vd&&Math.abs(c-o)<=vd)continue;if(a=l,o=c,A===h||A===d||A===f)continue;let u=0;for(let e=0,t=this._hashKey(l,c);e0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let i=0,a=0;for(;;){const o=n[e],s=e-e%3;if(a=s+(e+2)%3,-1===o){if(0===i)break;e=yd[--i];continue}const A=o-o%3,l=s+(e+1)%3,c=A+(o+2)%3,u=t[a],h=t[e],d=t[l],f=t[c];if(Md(r[2*u],r[2*u+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*f],r[2*f+1])){t[e]=f,t[o]=u;const r=n[c];if(-1===r){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,r),this._link(o,n[a]),this._link(a,c);const s=A+(o+1)%3;i=33306690738754716e-32*Math.abs(o+s)?o-s:0}function wd(e,t,n,r,i,a){return(_d(i,a,e,t,n,r)||_d(e,t,n,r,i,a)||_d(n,r,i,a,e,t))<0}function Md(e,t,n,r,i,a,o,s){const A=e-o,l=t-s,c=n-o,u=r-s,h=i-o,d=a-s,f=c*c+u*u,p=h*h+d*d;return A*(u*p-f*d)-l*(c*p-f*h)+(A*A+l*l)*(c*d-u*h)<0}function Sd(e,t,n,r,i,a){const o=n-e,s=r-t,A=i-e,l=a-t,c=o*o+s*s,u=A*A+l*l,h=.5/(o*l-s*A),d=(l*c-s*u)*h,f=(o*u-A*c)*h;return d*d+f*f}function Ed(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=e[i],a=t[r];let o=i-1;for(;o>=n&&t[e[o]]>a;)e[o+1]=e[o--];e[o+1]=r}else{let i=n+1,a=r;Td(e,n+r>>1,i),t[e[n]]>t[e[r]]&&Td(e,n,r),t[e[i]]>t[e[r]]&&Td(e,i,r),t[e[n]]>t[e[i]]&&Td(e,n,i);const o=e[i],s=t[o];for(;;){do{i++}while(t[e[i]]s);if(a=a-n?(Ed(e,t,i,r),Ed(e,t,n,a-1)):(Ed(e,t,n,a-1),Ed(e,t,i,r))}}function Td(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Ld(e){return e[0]}function Cd(e){return e[1]}const Pd=1e-6;class Rd{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){const r=(e=+e)+(n=+n),i=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>Pd||Math.abs(this._y1-i)>Pd)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class qd{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class Dd{constructor(e,[t,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(t=+t)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=r,this.xmin=t,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let t,r,a=0,o=0,s=n.length;a1;)i-=2;for(let e=2;e4)for(let e=0;e0){if(t>=this.ymax)return null;(i=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(i=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}}const Id=2*Math.PI,Bd=Math.pow;function kd(e){return e[0]}function Od(e){return e[1]}function Nd(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class zd{static from(e,t=kd,n=Od,r){return new zd("length"in e?function(e,t,n,r){const i=e.length,a=new Float64Array(2*i);for(let o=0;o2&&function(e){const{triangles:t,coords:n}=e;for(let e=0;e1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},((e,t)=>t)).sort(((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]));const e=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],a[r[0]]=1,2===r.length&&(a[r[1]]=0))}voronoi(e){return new Dd(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:o}=this;if(o){const t=o.indexOf(e);return t>0&&(yield o[t-1]),void(t=0&&i!==n&&i!==r;)n=i;return i}_step(e,t,n){const{inedges:r,hull:i,_hullIndex:a,halfedges:o,triangles:s,points:A}=this;if(-1===r[e]||!A.length)return(e+1)%(A.length>>1);let l=e,c=Bd(t-A[2*e],2)+Bd(n-A[2*e+1],2);const u=r[e];let h=u;do{let r=s[h];const u=Bd(t-A[2*r],2)+Bd(n-A[2*r+1],2);if(u0?1:e<0?-1:0},rf=Math.sqrt;function af(e){return e>1?Wd:e<-1?-Wd:Math.asin(e)}function of(){}function sf(e,t){e&&Sf.hasOwnProperty(e.type)&&Sf[e.type](e,t)}var Af,lf,cf,uf,hf,df,ff,pf,mf,gf,vf,yf,xf,bf,_f,wf,Mf={Feature:function(e,t){sf(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++rjd?e+Math.round(-e/Yd)*Yd:e,t]}function Zf(e,t,n){return(e%=Yd)?t||n?Yf(Kf(e),$f(t,n)):Kf(e):t||n?$f(t,n):Xf}function Jf(e){return function(t,n){return[(t+=e)>jd?t-Yd:t<-jd?t+Yd:t,n]}}function Kf(e){var t=Jf(e);return t.invert=Jf(-e),t}function $f(e,t){var n=ef(e),r=tf(e),i=ef(t),a=tf(t);function o(e,t){var o=ef(t),s=ef(e)*o,A=tf(e)*o,l=tf(t),c=l*n+s*r;return[$d(A*i-c*a,s*n-l*r),af(c*i+A*a)]}return o.invert=function(e,t){var o=ef(t),s=ef(e)*o,A=tf(e)*o,l=tf(t),c=l*i-A*a;return[$d(A*i+l*a,s*n+c*r),af(c*n-s*r)]},o}function ep(e,t){(t=Pf(t))[0]-=e,Bf(t);var n,r=(n=-t[1])>1?0:n<-1?jd:Math.acos(n);return((-t[2]<0?-r:r)+Yd-Vd)%Yd}function tp(){var e,t=[];return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){t.push(e=[])},lineEnd:of,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function np(e,t){return Jd(e[0]-t[0])=0;--a)i.point((c=l[a])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function ap(e){if(t=e.length){for(var t,n,r=0,i=e[0];++rt?1:e>=t?0:NaN}function up(e){for(var t,n,r,i=e.length,a=-1,o=0;++a=0;)for(t=(r=e[i]).length;--t>=0;)n[--o]=r[t];return n}function hp(e,t,n,r){return function(i){var a,o,s,A=t(i),l=tp(),c=t(l),u=!1,h={point:d,lineStart:p,lineEnd:m,polygonStart:function(){h.point=g,h.lineStart=v,h.lineEnd=y,o=[],a=[]},polygonEnd:function(){h.point=d,h.lineStart=p,h.lineEnd=m,o=up(o);var e=function(e,t){var n=lp(t),r=t[1],i=tf(r),a=[tf(n),-ef(n),0],o=0,s=0;Ap.reset(),1===i?r=Wd+Vd:-1===i&&(r=-Wd-Vd);for(var A=0,l=e.length;A=0?1:-1,S=M*w,E=S>jd,T=p*b;if(Ap.add($d(T*M*tf(S),m*_+T*ef(S))),o+=E?w+M*Yd:w,E^d>=n^y>=n){var L=qf(Pf(h),Pf(v));Bf(L);var C=qf(a,L);Bf(C);var P=(E^w>=0?-1:1)*af(C[2]);(r>P||r===P&&(L[0]||L[1]))&&(s+=E^w>=0?1:-1)}}return(o<-Vd||o0){for(u||(i.polygonStart(),u=!0),i.lineStart(),e=0;e1&&2&A&&h.push(h.pop().concat(h.shift())),o.push(h.filter(dp))}return h}}function dp(e){return e.length>1}function fp(e,t){return((e=e.x)[0]<0?e[1]-Wd-Vd:Wd-e[1])-((t=t.x)[0]<0?t[1]-Wd-Vd:Wd-t[1])}1===(op=cp).length&&(sp=op,op=function(e,t){return cp(sp(e),t)});var pp=hp((function(){return!0}),(function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(a,o){var s=a>0?jd:-jd,A=Jd(a-n);Jd(A-jd)0?Wd:-Wd),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(a,r),t=0):i!==s&&A>=jd&&(Jd(n-i)Vd?Kd((tf(t)*(a=ef(r))*tf(n)-tf(r)*(i=ef(t))*tf(e))/(i*a*o)):(t+r)/2}(n,r,a,o),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=a,r=o),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}),(function(e,t,n,r){var i;if(null==e)i=n*Wd,r.point(-jd,i),r.point(0,i),r.point(jd,i),r.point(jd,0),r.point(jd,-i),r.point(0,-i),r.point(-jd,-i),r.point(-jd,0),r.point(-jd,i);else if(Jd(e[0]-t[0])>Vd){var a=e[0]0,i=Jd(t)>Vd;function a(e,n){return ef(e)*ef(n)>t}function o(e,n,r){var i=[1,0,0],a=qf(Pf(e),Pf(n)),o=Rf(a,a),s=a[0],A=o-s*s;if(!A)return!r&&e;var l=t*o/A,c=-t*s/A,u=qf(i,a),h=If(i,l);Df(h,If(a,c));var d=u,f=Rf(h,d),p=Rf(d,d),m=f*f-p*(Rf(h,h)-1);if(!(m<0)){var g=rf(m),v=If(d,(-f-g)/p);if(Df(v,h),v=Cf(v),!r)return v;var y,x=e[0],b=n[0],_=e[1],w=n[1];b0^v[1]<(Jd(v[0]-x)jd^(x<=v[0]&&v[0]<=b)){var E=If(d,(-f+g)/p);return Df(E,h),[v,Cf(E)]}}}function s(t,n){var i=r?e:jd-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return hp(a,(function(e){var t,n,A,l,c;return{lineStart:function(){l=A=!1,c=1},point:function(u,h){var d,f=[u,h],p=a(u,h),m=r?p?0:s(u,h):p?s(u+(u<0?jd:-jd),h):0;if(!t&&(l=A=p)&&e.lineStart(),p!==A&&(!(d=o(t,f))||np(t,d)||np(f,d))&&(f[2]=1),p!==A)c=0,p?(e.lineStart(),d=o(f,t),e.point(d[0],d[1])):(d=o(t,f),e.point(d[0],d[1],2),e.lineEnd()),t=d;else if(i&&t&&r^p){var g;m&n||!(g=o(f,t,!0))||(c=0,r?(e.lineStart(),e.point(g[0][0],g[0][1]),e.point(g[1][0],g[1][1]),e.lineEnd()):(e.point(g[1][0],g[1][1]),e.lineEnd(),e.lineStart(),e.point(g[0][0],g[0][1],3)))}!p||t&&np(t,f)||e.point(f[0],f[1]),t=f,A=p,n=m},lineEnd:function(){A&&e.lineEnd(),t=null},clean:function(){return c|(l&&A)<<1}}}),(function(t,r,i,a){!function(e,t,n,r,i,a){if(n){var o=ef(t),s=tf(t),A=r*n;null==i?(i=t+r*Yd,a=t-A/2):(i=ep(o,i),a=ep(o,a),(r>0?ia)&&(i+=r*Yd));for(var l,c=i;r>0?c>a:c0)do{l.point(0===c||3===c?e:n,c>1?r:t)}while((c=(c+s+4)%4)!==u);else l.point(a[0],a[1])}function o(r,i){return Jd(r[0]-e)0?0:3:Jd(r[0]-n)0?2:1:Jd(r[1]-t)0?1:0:i>0?3:2}function s(e,t){return A(e.x,t.x)}function A(e,t){var n=o(e,1),r=o(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(o){var A,l,c,u,h,d,f,p,m,g,v,y=o,x=tp(),b={point:_,lineStart:function(){b.point=w,l&&l.push(c=[]);g=!0,m=!1,f=p=NaN},lineEnd:function(){A&&(w(u,h),d&&m&&x.rejoin(),A.push(x.result()));b.point=_,m&&y.lineEnd()},polygonStart:function(){y=x,A=[],l=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,i=l.length;nr&&(h-a)*(r-o)>(d-o)*(e-a)&&++t:d<=r&&(h-a)*(r-o)<(d-o)*(e-a)&&--t;return t}(),n=v&&t,i=(A=up(A)).length;(n||i)&&(o.polygonStart(),n&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),i&&ip(A,s,t,a,o),o.polygonEnd());y=o,A=l=c=null}};function _(e,t){i(e,t)&&y.point(e,t)}function w(a,o){var s=i(a,o);if(l&&c.push([a,o]),g)u=a,h=o,d=s,g=!1,s&&(y.lineStart(),y.point(a,o));else if(s&&m)y.point(a,o);else{var A=[f=Math.max(vp,Math.min(gp,f)),p=Math.max(vp,Math.min(gp,p))],x=[a=Math.max(vp,Math.min(gp,a)),o=Math.max(vp,Math.min(gp,o))];!function(e,t,n,r,i,a){var o,s=e[0],A=e[1],l=0,c=1,u=t[0]-s,h=t[1]-A;if(o=n-s,u||!(o>0)){if(o/=u,u<0){if(o0){if(o>c)return;o>l&&(l=o)}if(o=i-s,u||!(o<0)){if(o/=u,u<0){if(o>c)return;o>l&&(l=o)}else if(u>0){if(o0)){if(o/=h,h<0){if(o0){if(o>c)return;o>l&&(l=o)}if(o=a-A,h||!(o<0)){if(o/=h,h<0){if(o>c)return;o>l&&(l=o)}else if(h>0){if(o0&&(e[0]=s+l*u,e[1]=A+l*h),c<1&&(t[0]=s+c*u,t[1]=A+c*h),!0}}}}}(A,x,e,t,n,r)?s&&(y.lineStart(),y.point(a,o),v=!1):(m||(y.lineStart(),y.point(A[0],A[1])),y.point(x[0],x[1]),s||y.lineEnd(),v=!1)}f=a,p=o,m=s}return b}}var xp,bp,_p,wp=Fd(),Mp={sphere:of,point:of,lineStart:function(){Mp.point=Ep,Mp.lineEnd=Sp},lineEnd:of,polygonStart:of,polygonEnd:of};function Sp(){Mp.point=Mp.lineEnd=of}function Ep(e,t){xp=e*=Zd,bp=tf(t*=Zd),_p=ef(t),Mp.point=Tp}function Tp(e,t){e*=Zd;var n=tf(t*=Zd),r=ef(t),i=Jd(e-xp),a=ef(i),o=r*tf(i),s=_p*n-bp*r*a,A=bp*n+_p*r*a;wp.add($d(rf(o*o+s*s),A)),xp=e,bp=n,_p=r}var Lp=[null,null],Cp={type:"LineString",coordinates:Lp};function Pp(e,t){return Lp[0]=e,Lp[1]=t,function(e){return wp.reset(),Lf(e,Mp),+wp}(Cp)}function Rp(e){return e}var qp=1/0,Dp=qp,Ip=-qp,Bp=Ip,kp={point:function(e,t){eIp&&(Ip=e);tBp&&(Bp=t)},lineStart:of,lineEnd:of,polygonStart:of,polygonEnd:of,result:function(){var e=[[qp,Dp],[Ip,Bp]];return Ip=Bp=-(Dp=qp=1/0),e}};function Op(e){return function(t){var n=new Np;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Np(){}function zp(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),Lf(n,e.stream(kp)),t(kp.result()),null!=r&&e.clipExtent(r),e}function Fp(e,t,n){return zp(e,(function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])}),n)}Np.prototype={constructor:Np,point:function(e,t){this.stream.point(e,t)},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 Up=ef(30*Zd);function Hp(e,t){return+t?function(e,t){function n(r,i,a,o,s,A,l,c,u,h,d,f,p,m){var g=l-r,v=c-i,y=g*g+v*v;if(y>4*t&&p--){var x=o+h,b=s+d,_=A+f,w=rf(x*x+b*b+_*_),M=af(_/=w),S=Jd(Jd(_)-1)t||Jd((g*C+v*P)/y-.5)>.3||o*h+s*d+A*f2?e[2]%360*Zd:0,C()):[m*Xd,g*Xd,v*Xd]},T.angle=function(e){return arguments.length?(y=e%360*Zd,C()):y*Xd},T.reflectX=function(e){return arguments.length?(x=e?-1:1,C()):x<0},T.reflectY=function(e){return arguments.length?(b=e?-1:1,C()):b<0},T.precision=function(e){return arguments.length?(o=Hp(s,E=e*e),P()):rf(E)},T.fitExtent=function(e,t){return Fp(T,e,t)},T.fitSize=function(e,t){return function(e,t,n){return Fp(e,[[0,0],t],n)}(T,e,t)},T.fitWidth=function(e,t){return function(e,t,n){return zp(e,(function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])}),n)}(T,e,t)},T.fitHeight=function(e,t){return function(e,t,n){return zp(e,(function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])}),n)}(T,e,t)},function(){return t=e.apply(this,arguments),T.invert=t.invert&&L,C()}}((function(){return e}))()}function Qp(e,t){var n=ef(t),r=1+ef(e)*n;return[n*tf(e)/r,tf(t)/r]}function Yp(){return Wp(Qp).scale(250).clipAngle(142)}function Xp(e,t){let n,r;if(void 0===t)for(const t of e)null!=t&&(void 0===n?t>=t&&(n=r=t):(n>t&&(n=t),r=a&&(n=r=a):(n>a&&(n=a),r0?1:e<0?-1:0},om=Math.sqrt;function sm(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Am(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function lm(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function cm(e){var t=om(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return[e[0]/t,e[1]/t,e[2]/t]}function um(e){return[em(e[1],e[0])*Kp,(t=nm(-1,rm(1,e[2])),(t>1?Jp:t<-1?-Jp:Math.asin(t))*Kp)];var t}function hm(e){var t=e[0]*$p,n=e[1]*$p,r=tm(n);return[r*tm(t),r*im(t),im(n)]}function dm(e){return sm((e=e.map((e=>hm(e))))[0],Am(e[2],e[1]))}function fm(e){const t=function(e){if(e.length<2)return{};let t=0;for(;isNaN(e[t][0]+e[t][1])&&t++2?e[2]*Zd:0),t.invert=function(t){return(t=e.invert(t[0]*Zd,t[1]*Zd))[0]*=Xd,t[1]*=Xd,t},t}(e[t]),r=Yp().translate([0,0]).scale(1).rotate(n.invert([180,0]));e=e.map(r);const i=[];let a=1;for(let t=0,n=e.length;t1e32?i.push(t):n>a&&(a=n)}const o=1e6*om(a);i.forEach((t=>e[t]=[o,0])),e.push([0,o]),e.push([-o,0]),e.push([0,-o]);const s=zd.from(e);s.projection=r;const{triangles:A,halfedges:l,inedges:c}=s;for(let n=0,r=l.length;ne.length-3-1&&(A[n]=t);return s}(e),n=function(e){const{triangles:t}=e;if(!t)return[];const n=[];for(let e=0,r=t.length/3;e{if(e[0]!==e[1]&&!(dm(e.map((e=>t[e])))<0))for(let t,r=0;r<3;r++)t=(r+1)%3,n[Xp([e[r],e[t]]).join("-")]=!0})),Object.keys(n).map((e=>e.split("-").map(Number))))}(n,e),i=function(e,t){const n=[];e.forEach(((e,t)=>{for(let t=0;t<3;t++){const r=e[t],i=e[(t+1)%3];e[(t+2)%3],n[r]=n[r]||[],n[r].push(i)}})),0===e.length&&(2===t?(n[0]=[1],n[1]=[0]):1===t&&(n[0]=[]));return n}(n,e.length),a=function(e,t){function n(e,t){let n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[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=hm([r,i]);do{o=a,a=null,s=n(l,hm(t[o])),e[o].forEach((e=>{let r=n(l,hm(t[e]));if(r{const n=e.map((e=>t[e])).map(hm);return um(cm(lm(lm(Am(n[1],n[0]),Am(n[2],n[1])),Am(n[0],n[2]))))}))}(n,e),{polygons:s,centers:A}=function(e,t,n){const r=[],i=e.slice();if(0===t.length){if(n.length<2)return{polygons:r,centers:i};if(2===n.length){const e=hm(n[0]),t=hm(n[1]),o=cm(lm(e,t)),s=cm(Am(e,t)),A=Am(o,s),l=[o,Am(o,A),Am(Am(o,A),A),Am(Am(Am(o,A),A),A)].map(um).map(a);return r.push(l),r.push(l.slice().reverse()),{polygons:r,centers:i}}}t.forEach(((e,t)=>{for(let n=0;n<3;n++){const i=e[n],a=e[(n+1)%3],o=e[(n+2)%3];r[i]=r[i]||[],r[i].push([a,o,t,[i,a,o]])}}));function a(e){let n=-1;return i.slice(t.length,1/0).forEach(((r,i)=>{r[0]===e[0]&&r[1]===e[1]&&(n=i+t.length)})),n<0&&(n=i.length,i.push(e)),n}return{polygons:r.map((e=>{const t=[e[0][2]];let r=e[0][1];for(let n=1;n2)return t;if(2==t.length){const r=pm(n[e[0][3][0]],n[e[0][3][1]],i[t[0]]),o=pm(n[e[0][3][2]],n[e[0][3][0]],i[t[0]]),s=a(r),A=a(o);return[t[0],A,t[1],s]}})),centers:i}}(o,n,e),l=function(e){const t=[];return e.forEach((e=>{if(!e)return;let n=e[e.length-1];for(let r of e)r>n&&t.push([n,r]),n=r})),t}(s),c=function(e,t){const n={},r=[];e.map((e=>{if(!(dm(e.map((e=>t[e>t.length?0:e])))<0))for(let t=0;t<3;t++){let r=[e[t],e[(t+1)%3]],i=`${r[1]}-${r[0]}`;n[i]?delete n[i]:n[r.join("-")]=!0}}));const i={};let a;if(Object.keys(n).forEach((e=>{e=e.split("-").map(Number),i[e[0]]=e[1],a=e[0]})),void 0===a)return r;let o=a;do{r.push(o);let e=i[o];i[o]=-1,o=e}while(o>-1&&o!==a);return r}(n,e),u=function(e,t){return function(n){const r={},i={};return e.forEach(((e,t)=>{const a=e.join("-");r[a]=n[t],i[a]=!0})),t.forEach((e=>{let t=0,n=-1;for(var a=0;a<3;a++){let i=Xp([e[a],e[(a+1)%3]]).join("-");r[i]>t&&(t=r[i],n=i)}i[n]=!1})),e.map((e=>i[e.join("-")]))}}(r,n);return{delaunay:t,edges:r,triangles:n,centers:A,neighbors:i,polygons:s,mesh:l,hull:c,urquhart:u,find:a}}function pm(e,t,n){e=hm(e),t=hm(t),n=hm(n);const r=am(sm(Am(t,e),n));return um(cm(lm(e,t)).map((e=>r*e)))}function mm(e){const t=function(e){if(t.delaunay=null,t._data=e,"object"==typeof t._data&&"FeatureCollection"===t._data.type&&(t._data=t._data.features),"object"==typeof t._data){const e=t._data.map((e=>[t._vx(e),t._vy(e),e])).filter((e=>isFinite(e[0]+e[1])));t.points=e.map((e=>[e[0],e[1]])),t.valid=e.map((e=>e[2])),t.delaunay=fm(t.points)}return t};return t._vx=function(e){return"object"==typeof e&&"type"in e?Qf(e)[0]:0 in e?e[0]:void 0},t._vy=function(e){return"object"==typeof e&&"type"in e?Qf(e)[1]:1 in e?e[1]:void 0},t.x=function(e){return e?(t._vx=e,t):t._vx},t.y=function(e){return e?(t._vy=e,t):t._vy},t.polygons=function(e){if(void 0!==e&&t(e),!t.delaunay)return!1;const n={type:"FeatureCollection",features:[]};return 0===t.valid.length||(t.delaunay.polygons.forEach(((e,r)=>n.features.push({type:"Feature",geometry:e?{type:"Polygon",coordinates:[[...e,e[0]].map((e=>t.delaunay.centers[e]))]}:null,properties:{site:t.valid[r],sitecoordinates:t.points[r],neighbours:t.delaunay.neighbors[r]}}))),1===t.valid.length&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:t.valid[0],sitecoordinates:t.points[0],neighbours:[]}})),n},t.triangles=function(e){return void 0!==e&&t(e),!!t.delaunay&&{type:"FeatureCollection",features:t.delaunay.triangles.map(((e,n)=>((e=e.map((e=>t.points[e]))).center=t.delaunay.centers[n],e))).filter((e=>dm(e)>0)).map((e=>({type:"Feature",properties:{circumcenter:e.center},geometry:{type:"Polygon",coordinates:[[...e,e[0]]]}})))}},t.links=function(e){if(void 0!==e&&t(e),!t.delaunay)return!1;const n=t.delaunay.edges.map((e=>Pp(t.points[e[0]],t.points[e[1]]))),r=t.delaunay.urquhart(n);return{type:"FeatureCollection",features:t.delaunay.edges.map(((e,i)=>({type:"Feature",properties:{source:t.valid[e[0]],target:t.valid[e[1]],length:n[i],urquhart:!!r[i]},geometry:{type:"LineString",coordinates:[t.points[e[0]],t.points[e[1]]]}})))}},t.mesh=function(e){return void 0!==e&&t(e),!!t.delaunay&&{type:"MultiLineString",coordinates:t.delaunay.edges.map((e=>[t.points[e[0]],t.points[e[1]]]))}},t.cellMesh=function(e){if(void 0!==e&&t(e),!t.delaunay)return!1;const{centers:n,polygons:r}=t.delaunay,i=[];for(const e of r)if(e)for(let t=e.length,r=e[t-1],a=e[0],o=0;or&&i.push([n[r],n[a]]);return{type:"MultiLineString",coordinates:i}},t._found=void 0,t.find=function(e,n,r){if(t._found=t.delaunay.find(e,n,t._found),!r||Pp([e,n],t.points[t._found])r[e])),r[n[0]]]]}},e?t(e):t}function gm(e,t){return et?1:e>=t?0:NaN}!function(e){1===e.length&&(e=function(e){return function(t,n){return gm(e(t),n)}}(e))}(gm);var vm="$";function ym(){}function xm(e,t){var n=new ym;if(e instanceof ym)e.each((function(e,t){n.set(t,e)}));else if(Array.isArray(e)){var r,i=-1,a=e.length;if(null==t)for(;++i>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Gm(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Gm(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=qm.exec(e))?new jm(t[1],t[2],t[3],1):(t=Dm.exec(e))?new jm(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Im.exec(e))?Gm(t[1],t[2],t[3],t[4]):(t=Bm.exec(e))?Gm(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=km.exec(e))?Xm(t[1],t[2]/100,t[3]/100,1):(t=Om.exec(e))?Xm(t[1],t[2]/100,t[3]/100,t[4]):Nm.hasOwnProperty(e)?Hm(Nm[e]):"transparent"===e?new jm(NaN,NaN,NaN,0):null}function Hm(e){return new jm(e>>16&255,e>>8&255,255&e,1)}function Gm(e,t,n,r){return r<=0&&(e=t=n=NaN),new jm(e,t,n,r)}function Vm(e){return e instanceof Sm||(e=Um(e)),e?new jm((e=e.rgb()).r,e.g,e.b,e.opacity):new jm}function jm(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Wm(){return"#"+Ym(this.r)+Ym(this.g)+Ym(this.b)}function Qm(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function Ym(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Xm(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Jm(e,t,n,r)}function Zm(e){if(e instanceof Jm)return new Jm(e.h,e.s,e.l,e.opacity);if(e instanceof Sm||(e=Um(e)),!e)return new Jm;if(e instanceof Jm)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,A=(a+i)/2;return s?(o=t===a?(n-r)/s+6*(n0&&A<1?0:o,new Jm(o,s,A,e.opacity)}function Jm(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Km(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}wm(Sm,Um,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:zm,formatHex:zm,formatHsl:function(){return Zm(this).formatHsl()},formatRgb:Fm,toString:Fm}),wm(jm,(function(e,t,n,r){return 1===arguments.length?Vm(e):new jm(e,t,n,null==r?1:r)}),Mm(Sm,{brighter:function(e){return e=null==e?Tm:Math.pow(Tm,e),new jm(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?Em:Math.pow(Em,e),new jm(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){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:Wm,formatHex:Wm,formatRgb:Qm,toString:Qm})),wm(Jm,(function(e,t,n,r){return 1===arguments.length?Zm(e):new Jm(e,t,n,null==r?1:r)}),Mm(Sm,{brighter:function(e){return e=null==e?Tm:Math.pow(Tm,e),new Jm(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?Em:Math.pow(Em,e),new Jm(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new jm(Km(e>=240?e-240:e+120,i,r),Km(e,i,r),Km(e<120?e+240:e-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var $m=Math.PI/180,eg=180/Math.PI,tg=-.14861,ng=1.78277,rg=-.29227,ig=-.90649,ag=1.97294,og=ag*ig,sg=ag*ng,Ag=ng*rg-ig*tg;function lg(e){if(e instanceof ug)return new ug(e.h,e.s,e.l,e.opacity);e instanceof jm||(e=Vm(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(Ag*r+og*t-sg*n)/(Ag+og-sg),a=r-i,o=(ag*(n-i)-rg*a)/ig,s=Math.sqrt(o*o+a*a)/(ag*i*(1-i)),A=s?Math.atan2(o,a)*eg-120:NaN;return new ug(A<0?A+360:A,s,i,e.opacity)}function cg(e,t,n,r){return 1===arguments.length?lg(e):new ug(e,t,n,null==r?1:r)}function ug(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function hg(e){return function(){return e}}function dg(e,t){return function(n){return e+n*t}}function fg(e,t){var n=t-e;return n?dg(e,n):hg(isNaN(e)?t:e)}function pg(e){return function t(n){function r(t,r){var i=e((t=cg(t)).h,(r=cg(r)).h),a=fg(t.s,r.s),o=fg(t.l,r.l),s=fg(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(Math.pow(e,n)),t.opacity=s(e),t+""}}return n=+n,r.gamma=t,r}(1)}wm(ug,cg,Mm(Sm,{brighter:function(e){return e=null==e?Tm:Math.pow(Tm,e),new ug(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?Em:Math.pow(Em,e),new ug(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*$m,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new jm(255*(t+n*(tg*r+ng*i)),255*(t+n*(rg*r+ig*i)),255*(t+n*(ag*r)),this.opacity)}})),pg((function(e,t){var n=t-e;return n?dg(e,n>180||n<-180?n-360*Math.round(n/360):n):hg(isNaN(e)?t:e)}));var mg=pg(fg);function gg(e){return e.match(/.{6}/g).map((function(e){return"#"+e}))}function vg(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}function yg(e){return(yg=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xg(e,t){return(xg=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function bg(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _g(e){var t=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(e){return!1}}();return function(){var n,r=yg(e);if(t){var i=yg(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return bg(this,n)}}function wg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||Sg(e,t)||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 Mg(e){return function(e){if(Array.isArray(e))return Eg(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Sg(e)||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 Sg(e,t){if(e){if("string"==typeof e)return Eg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Eg(e,t):void 0}}function Eg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nt)for(var a=Wc(n,e),o=1/Math.ceil(i/t),s=o;s<1;)r.push(a(s)),s+=o}r.push(n=e)})),r}))}function Lg(e,t){var n={type:"Polygon",coordinates:e},r=wg(Sc(n),2),i=wg(r[0],2),a=i[0],o=i[1],s=wg(r[1],2),A=s[0],l=s[1];if(Math.min(Math.abs(A-a),Math.abs(l-o))A||l>=89||o<=-89;return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minLng,r=t.maxLng,i=t.minLat,a=t.maxLat,o=Math.round(Math.pow(360/e,2)/Math.PI),s=(1+Math.sqrt(5))/2,A=function(e){return e/s*360%360-180},l=function(e){return Math.acos(2*e/o-1)/Math.PI*180-90},c=function(e){return o*(Math.cos((e+90)*Math.PI/180)+1)/2},u=[void 0!==a?Math.ceil(c(a)):0,void 0!==i?Math.floor(c(i)):o-1],h=void 0===n&&void 0===r?function(){return!0}:void 0===n?function(e){return e<=r}:void 0===r?function(e){return e>=n}:r>=n?function(e){return e>=n&&e<=r}:function(e){return e>=n||e<=r},d=[],f=u[0];f<=u[1];f++){var p=A(f);h(p)&&d.push([p,l(f)])}return d}(t,{minLng:a,maxLng:A,minLat:o,maxLat:l}).filter((function(e){return Cg(e,n,c)}))}function Cg(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n?Hc(t,e):md(e,t)}gg("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),gg("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),gg("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),gg("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),mg(cg(300,.5,0),cg(-240,.5,1)),mg(cg(-100,.75,.35),cg(80,1.5,.8)),mg(cg(260,.75,.35),cg(80,1.5,.8)),cg(),vg(gg("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),vg(gg("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),vg(gg("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),vg(gg("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));var Pg=window.THREE?window.THREE:{BufferGeometry:Zt,Float32BufferAttribute:Ut},Rg=(new Pg.BufferGeometry).setAttribute?"setAttribute":"addAttribute",qg=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xg(e,t)}(n,e);var t=_g(n);function n(e,r,i,a,o,s,A){var l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(l=t.call(this)).type="ConicPolygonBufferGeometry",l.parameters={polygonGeoJson:e,startHeight:r,endHeight:i,closedBottom:a,closedTop:o,includeSides:s,curvatureResolution:A},r=r||0,i=i||1,a=void 0===a||a,o=void 0===o||o,s=void 0===s||s;var c=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).resolution,n=void 0===t?1/0:t,r=Tg(e,n),i=dl(r),a=Lg(e,n),o=[].concat(Mg(i),Mg(a)),s={type:"Polygon",coordinates:e},A=wg(Sc(s),2),l=wg(A[0],2),c=l[0],u=l[1],h=wg(A[1],2),d=h[0],f=h[1],p=c>d||f>=89||u<=-89,m=[];if(p){var g=mm(o).triangles(),v=new Map(o.map((function(e,t){var n=wg(e,2),r=n[0],i=n[1];return["".concat(r,"-").concat(i),t]})));g.features.forEach((function(e){var t,n=e.geometry.coordinates[0].slice(0,3).reverse(),r=[];if(n.forEach((function(e){var t=wg(e,2),n=t[0],i=t[1],a="".concat(n,"-").concat(i);v.has(a)&&r.push(v.get(a))})),3===r.length){if(r.some((function(e){return e2&&void 0!==arguments[2]?arguments[2]:0,r=(90-e)*Math.PI/180,i=(90-t)*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,t)}))}));return rl.flatten(n)}function v(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return{indices:t?h.indices:h.indices.slice().reverse(),vertices:g([h.points],e).vertices}}return s&&m(function(){for(var e=g(u,r),t=e.vertices,n=e.holes,a=g(u,i).vertices,o=dl([a,t]),s=Math.round(a.length/3),A=new Set(n),l=0,c=[],h=0;h1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),n.inspect=function(){return"[Emscripten Module object]"}):A?("undefined"!=typeof read&&(l=function(e){var t=ie(e);return t?ne(t):read(e)}),u=function(e){var t;return(t=ie(e))?t:"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(x("object"==typeof(t=read(e,"binary"))),t)},"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?f=self.location.href:document.currentScript&&(f=document.currentScript.src),f=0!==f.indexOf("blob:")?f.substr(0,f.lastIndexOf("/")+1):"",l=function(e){try{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText}catch(t){var n=ie(e);if(n)return ne(n);throw t}},a&&(u=function(e){try{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}catch(t){var n=ie(e);if(n)return n;throw t}}),c=function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)t(r.response);else{var i=ie(e);i?t(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(t in r)r.hasOwnProperty(t)&&(n[t]=r[t]);r=null,n.arguments,n.thisProgram;var g=0,v=function(){return g};var y=!1;function x(e,t){e||ve("Assertion failed: "+t)}function b(e){var t=n["_"+e];return x(t,"Cannot call unknown function "+e+", make sure it is exported"),t}function _(e,t,n,r,i){var a={string:function(e){var t=0;if(null!=e&&0!==e){var n=1+(e.length<<2);(function(e,t,n){(function(e,t,n,r){if(!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o);if(s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=a)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}t[n]=0})(e,S,t,n)})(e,t=le(n),n)}return t},array:function(e){var t=le(e.length);return function(e,t){M.set(e,t)}(e,t),t}};var o=b(e),s=[],A=0;if(r)for(var l=0;l=r);)++i;if(i-t>16&&e.subarray&&P)return P.decode(e.subarray(t,i));for(var a="";t>10,56320|1023&l)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}(S,e,t):""}function q(e,t){return e%t>0&&(e+=t-e%t),e}function D(e){w=e,n.HEAP8=M=new Int8Array(e),n.HEAP16=E=new Int16Array(e),n.HEAP32=T=new Int32Array(e),n.HEAPU8=S=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=L=new Float32Array(e),n.HEAPF64=C=new Float64Array(e)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var I=n.TOTAL_MEMORY||33554432;function B(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?n.dynCall_v(r):n.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}I=(w=n.buffer?n.buffer:new ArrayBuffer(I)).byteLength,D(w),T[6004]=5266928;var k=[],O=[],N=[],z=[];var F=Math.abs,U=Math.ceil,H=Math.floor,G=Math.min,V=0,j=null;n.preloadedImages={},n.preloadedAudios={};var W,Q,Y=null,X="data:application/octet-stream;base64,";function Z(e){return String.prototype.startsWith?e.startsWith(X):0===e.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(e){return e}function K(e){return e.replace(/\b__Z[\w\d_]+/g,(function(e){return e===e?e:e+" ["+e+"]"}))}function $(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(t){e=t}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}function ee(){return M.length}function te(e){try{var t=new ArrayBuffer(e);if(t.byteLength!=e)return;return new Int8Array(t).set(M),oe(t),D(t),1}catch(e){}}function ne(e){for(var t=[],n=0;n255&&(r&=255),t.push(String.fromCharCode(r))}return t.join("")}var re="function"==typeof atob?atob:function(e){var t,n,r,i,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",A="",l=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=s.indexOf(e.charAt(l++))<<2|(i=s.indexOf(e.charAt(l++)))>>4,n=(15&i)<<4|(a=s.indexOf(e.charAt(l++)))>>2,r=(3&a)<<6|(o=s.indexOf(e.charAt(l++))),A+=String.fromCharCode(t),64!==a&&(A+=String.fromCharCode(n)),64!==o&&(A+=String.fromCharCode(r))}while(l>2]=e,i[s+4>>2]=t,(s=0!=(0|a))&&(i[a>>2]=0),0|Ie(e,t))return P=o,0|(f=1);i[f>>2]=0;e:do{if((0|n)>=1)if(s)for(u=0,h=1,d=1,A=0,s=e;;){if(!(A|u)){if(0==(0|(s=0|I(s,t,4,f)))&0==(0|(t=0|w()))){s=2;break e}if(0|Ie(s,t)){s=1;break e}}if(0==(0|(s=0|I(s,t,0|i[16+(u<<2)>>2],f)))&0==(0|(t=0|w()))){s=2;break e}if(i[(e=r+(d<<3)|0)>>2]=s,i[e+4>>2]=t,i[a+(d<<2)>>2]=h,e=(0|(A=A+1|0))==(0|h),c=6==(0|(l=u+1|0)),0|Ie(s,t)){s=1;break e}if((0|(h=h+(c&e&1)|0))>(0|n)){s=0;break}u=e?c?0:l:u,d=d+1|0,A=e?0:A}else for(u=0,h=1,d=1,A=0,s=e;;){if(!(A|u)){if(0==(0|(s=0|I(s,t,4,f)))&0==(0|(t=0|w()))){s=2;break e}if(0|Ie(s,t)){s=1;break e}}if(0==(0|(s=0|I(s,t,0|i[16+(u<<2)>>2],f)))&0==(0|(t=0|w()))){s=2;break e}if(i[(e=r+(d<<3)|0)>>2]=s,i[e+4>>2]=t,e=(0|(A=A+1|0))==(0|h),c=6==(0|(l=u+1|0)),0|Ie(s,t)){s=1;break e}if((0|(h=h+(c&e&1)|0))>(0|n)){s=0;break}u=e?c?0:l:u,d=d+1|0,A=e?0:A}else s=0}while(0);return P=o,0|(f=s)}function D(e,t,n,r,a,o,s){n|=0,r|=0,a|=0,o|=0,s|=0;var A,l,c=0,u=0,h=0,d=0,f=0;if(l=P,P=P+16|0,A=l,0==(0|(e|=0))&0==(0|(t|=0)))P=l;else{if(c=0|wt(0|e,0|t,0|o,((0|o)<0)<<31>>31|0),w(),!(0==(0|(f=0|i[(d=u=r+(c<<3)|0)>>2]))&0==(0|(d=0|i[d+4>>2]))|(h=(0|f)==(0|e)&(0|d)==(0|t))))do{h=(0|(d=0|i[(f=u=r+((c=(c+1|0)%(0|o)|0)<<3)|0)>>2]))==(0|e)&(0|(f=0|i[f+4>>2]))==(0|t)}while(!(0==(0|d)&0==(0|f)|h));c=a+(c<<2)|0,h&&(0|i[c>>2])<=(0|s)||(i[(f=u)>>2]=e,i[f+4>>2]=t,i[c>>2]=s,(0|s)>=(0|n)||(f=s+1|0,i[A>>2]=0,D(d=0|I(e,t,2,A),0|w(),n,r,a,o,f),i[A>>2]=0,D(d=0|I(e,t,3,A),0|w(),n,r,a,o,f),i[A>>2]=0,D(d=0|I(e,t,1,A),0|w(),n,r,a,o,f),i[A>>2]=0,D(d=0|I(e,t,5,A),0|w(),n,r,a,o,f),i[A>>2]=0,D(d=0|I(e,t,4,A),0|w(),n,r,a,o,f),i[A>>2]=0,D(d=0|I(e,t,6,A),0|w(),n,r,a,o,f))),P=l}}function I(e,t,n,r){e|=0,t|=0,n|=0;var a,o,s=0,A=0,l=0,c=0,u=0,h=0,d=0;if((0|i[(r|=0)>>2])>0){s=0;do{n=0|Ae(n),s=s+1|0}while((0|s)<(0|i[r>>2]))}a=0|Mt(0|e,0|t,45),w(),o=127&a,A=0|Be(e,t),s=0|Mt(0|e,0|t,52),w(),s&=15;e:do{if(s)for(;;){if(h=0|Mt(0|e,0|t,0|(u=3*(15-s|0)|0)),w(),h&=7,d=0==(0|Fe(s)),s=s+-1|0,c=0|St(7,0,0|u),t&=~(0|w()),e=(u=0|St(0|i[(d?464:48)+(28*h|0)+(n<<2)>>2],0,0|u))|e&~c,t|=0|w(),!(n=0|i[(d?672:256)+(28*h|0)+(n<<2)>>2])){n=0;break e}if(!s){l=6;break}}else l=6}while(0);6==(0|l)&&(e|=h=0|St(0|(d=0|i[880+(28*o|0)+(n<<2)>>2]),0,45),t=0|w()|-1040385&t,n=0|i[4304+(28*o|0)+(n<<2)>>2],127==(127&d|0)&&(d=0|St(0|i[880+(28*o|0)+20>>2],0,45),t=0|w()|-1040385&t,n=0|i[4304+(28*o|0)+20>>2],e=0|Oe(d|e,t),t=0|w(),i[r>>2]=1+(0|i[r>>2]))),l=0|Mt(0|e,0|t,45),w(),l&=127;e:do{if(0|k(l)){t:do{if(1==(0|Be(e,t))){if((0|o)!=(0|l)){if(0|F(l,0|i[7728+(28*o|0)>>2])){e=0|ze(e,t),A=1,t=0|w();break}e=0|Oe(e,t),A=1,t=0|w();break}switch(0|A){case 5:e=0|ze(e,t),t=0|w(),i[r>>2]=5+(0|i[r>>2]),A=0;break t;case 3:e=0|Oe(e,t),t=0|w(),i[r>>2]=1+(0|i[r>>2]),A=0;break t;default:return d=0,_(0|(h=0)),0|d}}else A=0}while(0);if((0|n)>0){s=0;do{e=0|ke(e,t),t=0|w(),s=s+1|0}while((0|s)!=(0|n))}if((0|o)!=(0|l)){if(!(0|O(l))){if(0!=(0|A)|5!=(0|Be(e,t)))break;i[r>>2]=1+(0|i[r>>2]);break}switch(127&a){case 8:case 118:break e}3!=(0|Be(e,t))&&(i[r>>2]=1+(0|i[r>>2]))}}else if((0|n)>0){s=0;do{e=0|Oe(e,t),t=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,d=e,_(0|(h=t)),0|d}function B(e,t,n,r,o,s){t|=0,n|=0,r|=0,o|=0,s|=0;var A,l,c,u,h,d,f,p,m,g=0,v=0,y=0,x=0,b=0,_=0,M=0,S=0,E=0,T=0,L=0,C=0,R=0,q=0;if(m=P,P=P+48|0,d=m+32|0,f=m+16|0,p=m,(0|(g=0|i[(e|=0)>>2]))<=0)return P=m,0|(C=0);A=e+4|0,l=d+8|0,c=f+8|0,u=p+8|0,h=((0|t)<0)<<31>>31,L=0;e:for(;;){E=(v=0|i[A>>2])+(L<<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],(0|L)==(g+-1|0)?(i[f>>2]=i[v>>2],i[f+4>>2]=i[v+4>>2],i[f+8>>2]=i[v+8>>2],i[f+12>>2]=i[v+12>>2]):(E=v+(L+1<<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]),E=0|W(d,f,n);t:do{if((0|E)>0){T=+(0|E),S=0;n:for(;;){q=+(E-S|0),R=+(0|S),a[p>>3]=+a[d>>3]*q/T+ +a[f>>3]*R/T,a[u>>3]=+a[l>>3]*q/T+ +a[c>>3]*R/T,v=0|wt(0|(_=0|Ue(p,n)),0|(M=0|w()),0|t,0|h),w(),x=0|i[(y=g=s+(v<<3)|0)>>2],y=0|i[y+4>>2];r:do{if(0==(0|x)&0==(0|y))C=14;else for(b=0;;){if((0|b)>(0|t)){g=1;break r}if((0|x)==(0|_)&(0|y)==(0|M)){g=7;break r}if(0==(0|(x=0|i[(y=g=s+((v=(v+1|0)%(0|t)|0)<<3)|0)>>2]))&0==(0|(y=0|i[y+4>>2]))){C=14;break}b=b+1|0}}while(0);switch(14==(0|C)&&(C=0,0==(0|_)&0==(0|M)?g=7:(i[g>>2]=_,i[g+4>>2]=M,g=0|i[r>>2],i[(b=o+(g<<3)|0)>>2]=_,i[b+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))){C=8;break t}}if(0|g){g=-1,C=20;break e}}else C=8}while(0);if(8==(0|C)&&(C=0),(0|(L=L+1|0))>=(0|(g=0|i[e>>2]))){g=0,C=20;break}}return 20==(0|C)?(P=m,0|g):0}function k(e){return 0|i[7728+(28*(e|=0)|0)+16>>2]}function O(e){return 4==(0|(e|=0))|117==(0|e)|0}function N(e){return 0|i[11152+(216*(0|i[(e|=0)>>2])|0)+(72*(0|i[e+4>>2])|0)+(24*(0|i[e+8>>2])|0)+(i[e+12>>2]<<3)>>2]}function z(e){return 0|i[11152+(216*(0|i[(e|=0)>>2])|0)+(72*(0|i[e+4>>2])|0)+(24*(0|i[e+8>>2])|0)+(i[e+12>>2]<<3)+4>>2]}function F(e,t){return t|=0,(0|i[7728+(28*(e|=0)|0)+20>>2])==(0|t)?0|(t=1):0|(t=(0|i[7728+(28*e|0)+24>>2])==(0|t))}function U(e,t){return 0|i[880+(28*(e|=0)|0)+((t|=0)<<2)>>2]}function H(e,t){return t|=0,(0|i[880+(28*(e|=0)|0)>>2])==(0|t)?0|(t=0):(0|i[880+(28*e|0)+4>>2])==(0|t)?0|(t=1):(0|i[880+(28*e|0)+8>>2])==(0|t)?0|(t=2):(0|i[880+(28*e|0)+12>>2])==(0|t)?0|(t=3):(0|i[880+(28*e|0)+16>>2])==(0|t)?0|(t=4):(0|i[880+(28*e|0)+20>>2])==(0|t)?0|(t=5):0|((0|i[880+(28*e|0)+24>>2])==(0|t)?6:7)}function G(e){return+a[(e|=0)+16>>3]<+a[e+24>>3]|0}function V(e,t){e|=0;var n,r,i=0;return(i=+a[(t|=0)>>3])>=+a[e+8>>3]&&i<=+a[e>>3]?(n=+a[e+16>>3],i=+a[e+24>>3],t=(r=+a[t+8>>3])>=i,e=r<=n&1,n>2]=0,u=u+4|0}while((0|u)<(0|h));return We(t,o),Ve(h=0|i[(u=o)>>2],u=0|i[u+4>>2],n),je(h,u,r),l=+Le(n,r+8|0),a[n>>3]=+a[e>>3],a[(u=n+8|0)>>3]=+a[e+16>>3],a[r>>3]=+a[e+8>>3],a[(h=r+8|0)>>3]=+a[e+24>>3],c=+Le(n,r),h=~~+v(+c*c/+Et(+ +A(+(+a[u>>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(e,t,n){e|=0,t|=0,n|=0;var r,a,o,s,A,l=0,c=0;s=P,P=P+288|0,r=s+264|0,a=s+96|0,c=(l=o=s)+96|0;do{i[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return We(n,o),Ve(l=0|i[(c=o)>>2],c=0|i[c+4>>2],r),je(l,c,a),A=+Le(r,a+8|0),c=~~+v(+ +Le(e,t)/(2*A)),P=s,0|(0==(0|c)?1:c)}function Q(e,t,n,r){t|=0,n|=0,r|=0,i[(e|=0)>>2]=t,i[e+4>>2]=n,i[e+8>>2]=r}function Y(e,t){e|=0;var n,r,o,s,l=0,c=0,u=0,h=0,d=0,f=0,p=0;i[(s=(t|=0)+8|0)>>2]=0,r=+a[e>>3],h=+A(+r),o=+a[e+8>>3],h+=.5*(d=+A(+o)/.8660254037844386),h-=+(0|(l=~~h)),d-=+(0|(e=~~d));do{if(h<.5){if(h<.3333333333333333){if(i[t>>2]=l,d<.5*(h+1)){i[t+4>>2]=e;break}e=e+1|0,i[t+4>>2]=e;break}if(e=(1&!(d<(p=1-h)))+e|0,i[t+4>>2]=e,p<=d&d<2*h){l=l+1|0,i[t>>2]=l;break}i[t>>2]=l;break}if(!(h<.6666666666666666)){if(l=l+1|0,i[t>>2]=l,d<.5*h){i[t+4>>2]=e;break}e=e+1|0,i[t+4>>2]=e;break}if(d<1-h){if(i[t+4>>2]=e,2*h-1>2]=l;break}}else e=e+1|0,i[t+4>>2]=e;l=l+1|0,i[t>>2]=l}while(0);do{if(r<0){if(1&e){l=~~(+(0|l)-(2*(+((f=0|xt(0|l,((0|l)<0)<<31>>31|0,0|(f=(e+1|0)/2|0),((0|f)<0)<<31>>31|0))>>>0)+4294967296*+(0|w()))+1)),i[t>>2]=l;break}l=~~(+(0|l)-2*(+((f=0|xt(0|l,((0|l)<0)<<31>>31|0,0|(f=(0|e)/2|0),((0|f)<0)<<31>>31|0))>>>0)+4294967296*+(0|w()))),i[t>>2]=l;break}}while(0);f=t+4|0,o<0&&(l=l-((1|e<<1)/2|0)|0,i[t>>2]=l,e=0-e|0,i[f>>2]=e),c=e-l|0,(0|l)<0?(u=0-l|0,i[f>>2]=c,i[s>>2]=u,i[t>>2]=0,e=c,l=0):u=0,(0|e)<0&&(l=l-e|0,i[t>>2]=l,u=u-e|0,i[s>>2]=u,i[f>>2]=0,e=0),n=l-u|0,c=e-u|0,(0|u)<0&&(i[t>>2]=n,i[f>>2]=c,i[s>>2]=0,e=c,l=n,u=0),(0|(c=(0|u)<(0|(c=(0|e)<(0|l)?e:l))?u:c))<=0||(i[t>>2]=l-c,i[f>>2]=e-c,i[s>>2]=u-c)}function X(e){var t,n=0,r=0,a=0,o=0,s=0;n=0|i[(e|=0)>>2],r=0|i[(t=e+4|0)>>2],(0|n)<0&&(r=r-n|0,i[t>>2]=r,i[(s=e+8|0)>>2]=(0|i[s>>2])-n,i[e>>2]=0,n=0),(0|r)<0?(n=n-r|0,i[e>>2]=n,o=(0|i[(s=e+8|0)>>2])-r|0,i[s>>2]=o,i[t>>2]=0,r=0):(s=o=e+8|0,o=0|i[o>>2]),(0|o)<0&&(n=n-o|0,i[e>>2]=n,r=r-o|0,i[t>>2]=r,i[s>>2]=0,o=0),(0|(a=(0|o)<(0|(a=(0|r)<(0|n)?r:n))?o:a))<=0||(i[e>>2]=n-a,i[t>>2]=r-a,i[s>>2]=o-a)}function Z(e,t){t|=0;var n,r;r=0|i[(e|=0)+8>>2],n=+((0|i[e+4>>2])-r|0),a[t>>3]=+((0|i[e>>2])-r|0)-.5*n,a[t+8>>3]=.8660254037844386*n}function J(e,t,n){e|=0,t|=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 K(e,t,n){e|=0,t|=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 $(e,t){t|=0;var n,r=0;r=0|y(0|i[(e|=0)>>2],t),i[e>>2]=r,n=0|y(0|i[(r=e+4|0)>>2],t),i[r>>2]=n,t=0|y(0|i[(e=e+8|0)>>2],t),i[e>>2]=t}function ee(e){var t,n,r=0,a=0,o=0,s=0,A=0;A=(0|(n=0|i[(e|=0)>>2]))<0,e=(e=(a=(0|(s=((t=(0|(o=(0|i[e+4>>2])-(A?n:0)|0))<0)?0-o|0:0)+((0|i[e+8>>2])-(A?n:0))|0))<0)?0:s)-((o=(0|(a=(0|e)<(0|(a=(0|(r=(t?0:o)-(a?s:0)|0))<(0|(s=(A?0:n)-(t?o:0)-(a?s:0)|0))?r:s))?e:a))>0)?a:0)|0,r=r-(o?a:0)|0;e:do{switch(s-(o?a:0)|0){case 0:switch(0|r){case 0:return 0|(A=0==(0|e)?0:1==(0|e)?1:7);case 1:return 0|(A=0==(0|e)?2:1==(0|e)?3:7);default:break e}case 1:switch(0|r){case 0:return 0|(A=0==(0|e)?4:1==(0|e)?5:7);case 1:if(e)break e;return 0|(e=6);default:break e}}}while(0);return 0|(A=7)}function te(e){var t,n,r=0,a=0,o=0,s=0,A=0;a=0|i[(t=(e|=0)+8|0)>>2],o=0|mt(+((3*(r=(0|i[e>>2])-a|0)|0)-(a=(0|i[(n=e+4|0)>>2])-a|0)|0)/7),i[e>>2]=o,r=0|mt(+((a<<1)+r|0)/7),i[n>>2]=r,i[t>>2]=0,a=r-o|0,(0|o)<0?(A=0-o|0,i[n>>2]=a,i[t>>2]=A,i[e>>2]=0,r=a,o=0,a=A):a=0,(0|r)<0&&(o=o-r|0,i[e>>2]=o,a=a-r|0,i[t>>2]=a,i[n>>2]=0,r=0),A=o-a|0,s=r-a|0,(0|a)<0?(i[e>>2]=A,i[n>>2]=s,i[t>>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[e>>2]=s-o,i[n>>2]=r-o,i[t>>2]=a-o)}function ne(e){var t,n,r=0,a=0,o=0,s=0,A=0;a=0|i[(t=(e|=0)+8|0)>>2],o=0|mt(+(((r=(0|i[e>>2])-a|0)<<1)+(a=(0|i[(n=e+4|0)>>2])-a|0)|0)/7),i[e>>2]=o,r=0|mt(+((3*a|0)-r|0)/7),i[n>>2]=r,i[t>>2]=0,a=r-o|0,(0|o)<0?(A=0-o|0,i[n>>2]=a,i[t>>2]=A,i[e>>2]=0,r=a,o=0,a=A):a=0,(0|r)<0&&(o=o-r|0,i[e>>2]=o,a=a-r|0,i[t>>2]=a,i[n>>2]=0,r=0),A=o-a|0,s=r-a|0,(0|a)<0?(i[e>>2]=A,i[n>>2]=s,i[t>>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[e>>2]=s-o,i[n>>2]=r-o,i[t>>2]=a-o)}function re(e){var t,n,r,a=0,o=0,s=0,A=0;a=0|i[(e|=0)>>2],o=0|i[(n=e+4|0)>>2],s=0|i[(r=e+8|0)>>2],A=o+(3*a|0)|0,i[e>>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[e>>2]=0,o=s,s=0):s=A,(0|o)<0&&(s=s-o|0,i[e>>2]=s,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),t=s-a|0,A=o-a|0,(0|a)<0?(i[e>>2]=t,i[n>>2]=A,i[r>>2]=0,s=t,a=0):A=o,(0|(o=(0|a)<(0|(o=(0|A)<(0|s)?A:s))?a:o))<=0||(i[e>>2]=s-o,i[n>>2]=A-o,i[r>>2]=a-o)}function ie(e){var t,n,r,a=0,o=0,s=0,A=0;A=0|i[(e|=0)>>2],s=(3*(a=0|i[(n=e+4|0)>>2])|0)+A|0,A=(o=0|i[(r=e+8|0)>>2])+(3*A|0)|0,i[e>>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[e>>2]=0,A=0):o=s,(0|o)<0&&(A=A-o|0,i[e>>2]=A,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),t=A-a|0,s=o-a|0,(0|a)<0?(i[e>>2]=t,i[n>>2]=s,i[r>>2]=0,A=t,a=0):s=o,(0|(o=(0|a)<(0|(o=(0|s)<(0|A)?s:A))?a:o))<=0||(i[e>>2]=A-o,i[n>>2]=s-o,i[r>>2]=a-o)}function ae(e,t){e|=0;var n,r,a,o=0,s=0,A=0;((t|=0)+-1|0)>>>0>=6||(A=(0|i[15472+(12*t|0)>>2])+(0|i[e>>2])|0,i[e>>2]=A,a=e+4|0,s=(0|i[15472+(12*t|0)+4>>2])+(0|i[a>>2])|0,i[a>>2]=s,r=e+8|0,t=(0|i[15472+(12*t|0)+8>>2])+(0|i[r>>2])|0,i[r>>2]=t,o=s-A|0,(0|A)<0?(t=t-A|0,i[a>>2]=o,i[r>>2]=t,i[e>>2]=0,s=0):(o=s,s=A),(0|o)<0&&(s=s-o|0,i[e>>2]=s,t=t-o|0,i[r>>2]=t,i[a>>2]=0,o=0),n=s-t|0,A=o-t|0,(0|t)<0?(i[e>>2]=n,i[a>>2]=A,i[r>>2]=0,s=n,t=0):A=o,(0|(o=(0|t)<(0|(o=(0|A)<(0|s)?A:s))?t:o))<=0||(i[e>>2]=s-o,i[a>>2]=A-o,i[r>>2]=t-o))}function oe(e){var t,n,r,a=0,o=0,s=0,A=0;A=0|i[(e|=0)>>2],s=(a=0|i[(n=e+4|0)>>2])+A|0,A=(o=0|i[(r=e+8|0)>>2])+A|0,i[e>>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[e>>2]=0,s=0):(o=s,s=A),(0|o)<0&&(s=s-o|0,i[e>>2]=s,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),t=s-a|0,A=o-a|0,(0|a)<0?(i[e>>2]=t,i[n>>2]=A,i[r>>2]=0,s=t,a=0):A=o,(0|(o=(0|a)<(0|(o=(0|A)<(0|s)?A:s))?a:o))<=0||(i[e>>2]=s-o,i[n>>2]=A-o,i[r>>2]=a-o)}function se(e){var t,n,r,a=0,o=0,s=0,A=0;a=0|i[(e|=0)>>2],s=0|i[(n=e+4|0)>>2],o=0|i[(r=e+8|0)>>2],A=s+a|0,i[e>>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[e>>2]=0,s=0):(o=s,s=A),(0|o)<0&&(s=s-o|0,i[e>>2]=s,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),t=s-a|0,A=o-a|0,(0|a)<0?(i[e>>2]=t,i[n>>2]=A,i[r>>2]=0,s=t,a=0):A=o,(0|(o=(0|a)<(0|(o=(0|A)<(0|s)?A:s))?a:o))<=0||(i[e>>2]=s-o,i[n>>2]=A-o,i[r>>2]=a-o)}function Ae(e){switch(0|(e|=0)){case 1:e=5;break;case 5:e=4;break;case 4:e=6;break;case 6:e=2;break;case 2:e=3;break;case 3:e=1}return 0|e}function le(e){switch(0|(e|=0)){case 1:e=3;break;case 3:e=2;break;case 2:e=6;break;case 6:e=4;break;case 4:e=5;break;case 5:e=1}return 0|e}function ce(e){var t,n,r,a=0,o=0,s=0,A=0;a=0|i[(e|=0)>>2],o=0|i[(n=e+4|0)>>2],s=0|i[(r=e+8|0)>>2],A=o+(a<<1)|0,i[e>>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[e>>2]=0,o=s,s=0):s=A,(0|o)<0&&(s=s-o|0,i[e>>2]=s,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),t=s-a|0,A=o-a|0,(0|a)<0?(i[e>>2]=t,i[n>>2]=A,i[r>>2]=0,s=t,a=0):A=o,(0|(o=(0|a)<(0|(o=(0|A)<(0|s)?A:s))?a:o))<=0||(i[e>>2]=s-o,i[n>>2]=A-o,i[r>>2]=a-o)}function ue(e){var t,n,r,a=0,o=0,s=0,A=0;A=0|i[(e|=0)>>2],s=((a=0|i[(n=e+4|0)>>2])<<1)+A|0,A=(o=0|i[(r=e+8|0)>>2])+(A<<1)|0,i[e>>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[e>>2]=0,A=0):o=s,(0|o)<0&&(A=A-o|0,i[e>>2]=A,a=a-o|0,i[r>>2]=a,i[n>>2]=0,o=0),t=A-a|0,s=o-a|0,(0|a)<0?(i[e>>2]=t,i[n>>2]=s,i[r>>2]=0,A=t,a=0):s=o,(0|(o=(0|a)<(0|(o=(0|s)<(0|A)?s:A))?a:o))<=0||(i[e>>2]=A-o,i[n>>2]=s-o,i[r>>2]=a-o)}function he(e,t){t|=0;var n,r,a,o=0,s=0,A=0;return a=(0|(r=(0|i[(e|=0)>>2])-(0|i[t>>2])|0))<0,n=(0|(s=(0|i[e+4>>2])-(0|i[t+4>>2])-(a?r:0)|0))<0,t=(t=(e=(0|(A=(a?0-r|0:0)+(0|i[e+8>>2])-(0|i[t+8>>2])+(n?0-s|0:0)|0))<0)?0:A)-((s=(0|(e=(0|t)<(0|(e=(0|(o=(n?0:s)-(e?A:0)|0))<(0|(A=(a?0:r)-(n?s:0)-(e?A:0)|0))?o:A))?t:e))>0)?e:0)|0,o=o-(s?e:0)|0,0|((0|(e=(0|(e=A-(s?e:0)|0))>-1?e:0-e|0))>(0|(t=(0|(o=(0|o)>-1?o:0-o|0))>(0|(t=(0|t)>-1?t:0-t|0))?o:t))?e:t)}function de(e,t){t|=0;var n;n=0|i[(e|=0)+8>>2],i[t>>2]=(0|i[e>>2])-n,i[t+4>>2]=(0|i[e+4>>2])-n}function fe(e,t){t|=0;var n,r,a,o=0,s=0,A=0;s=0|i[(e|=0)>>2],i[t>>2]=s,e=0|i[e+4>>2],i[(r=t+4|0)>>2]=e,i[(a=t+8|0)>>2]=0,o=e-s|0,(0|s)<0?(e=0-s|0,i[r>>2]=o,i[a>>2]=e,i[t>>2]=0,s=0):(o=e,e=0),(0|o)<0&&(s=s-o|0,i[t>>2]=s,e=e-o|0,i[a>>2]=e,i[r>>2]=0,o=0),n=s-e|0,A=o-e|0,(0|e)<0?(i[t>>2]=n,i[r>>2]=A,i[a>>2]=0,o=A,A=n,e=0):A=s,(0|(s=(0|e)<(0|(s=(0|o)<(0|A)?o:A))?e:s))<=0||(i[t>>2]=A-s,i[r>>2]=o-s,i[a>>2]=e-s)}function pe(e){var t,n,r,a;n=(a=0|i[(t=(e|=0)+8|0)>>2])-(0|i[e>>2])|0,i[e>>2]=n,e=(0|i[(r=e+4|0)>>2])-a|0,i[r>>2]=e,i[t>>2]=0-(e+n)}function me(e){var t,n,r=0,a=0,o=0,s=0,A=0;r=0-(a=0|i[(e|=0)>>2])|0,i[e>>2]=r,i[(t=e+8|0)>>2]=0,s=(o=0|i[(n=e+4|0)>>2])+a|0,(0|a)>0?(i[n>>2]=s,i[t>>2]=a,i[e>>2]=0,r=0,o=s):a=0,(0|o)<0?(A=r-o|0,i[e>>2]=A,a=a-o|0,i[t>>2]=a,i[n>>2]=0,s=A-a|0,r=0-a|0,(0|a)<0?(i[e>>2]=s,i[n>>2]=r,i[t>>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[e>>2]=s-r,i[n>>2]=o-r,i[t>>2]=a-r)}function ge(e,t,n,r){t|=0,n|=0,r|=0;var o,s=0,A=0,l=0,c=0;if(o=P,P=P+32|0,function(e,t){t|=0;var n=0,r=0,i=0;n=+a[(e=e|0)>>3],r=+u(+n),n=+h(+n),a[t+16>>3]=n,n=+a[e+8>>3],i=r*+u(+n),a[t>>3]=i,n=r*+h(+n),a[t+8>>3]=n}(e|=0,A=o),i[n>>2]=0,s=+At(15888,A),(l=+At(15912,A))>2]=1,s=l),(l=+At(15936,A))>2]=2,s=l),(l=+At(15960,A))>2]=3,s=l),(l=+At(15984,A))>2]=4,s=l),(l=+At(16008,A))>2]=5,s=l),(l=+At(16032,A))>2]=6,s=l),(l=+At(16056,A))>2]=7,s=l),(l=+At(16080,A))>2]=8,s=l),(l=+At(16104,A))>2]=9,s=l),(l=+At(16128,A))>2]=10,s=l),(l=+At(16152,A))>2]=11,s=l),(l=+At(16176,A))>2]=12,s=l),(l=+At(16200,A))>2]=13,s=l),(l=+At(16224,A))>2]=14,s=l),(l=+At(16248,A))>2]=15,s=l),(l=+At(16272,A))>2]=16,s=l),(l=+At(16296,A))>2]=17,s=l),(l=+At(16320,A))>2]=18,s=l),(l=+At(16344,A))>2]=19,s=l),(l=+f(+(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=+Ee((s=+a[16368+(24*n|0)>>3])-+Ee(+function(e,t){e|=0;var n=0,r=0,i=0,o=0,s=0;return o=+a[(t=t|0)>>3],r=+u(+o),i=+a[t+8>>3]-+a[e+8>>3],s=r*+h(+i),n=+a[e>>3],+ +g(+s,+(+h(+o)*+u(+n)-+u(+i)*(r*+h(+n))))}(15568+(n<<4)|0,e))),c=0|Fe(t)?+Ee(s+-.3334731722518321):s,s=+d(+l)/.381966011250105,(0|t)>0){A=0;do{s*=2.6457513110645907,A=A+1|0}while((0|A)!=(0|t))}l=+u(+c)*s,a[r>>3]=l,c=+h(+c)*s,a[r+8>>3]=c,P=o}function ve(e,t,n,r,o){t|=0,n|=0,r|=0,o|=0;var s=0,c=0;if((s=+function(e){var t=0,n=0;return n=+a[(e=e|0)>>3],t=+a[e+8>>3],+ +l(+(n*n+t*t))}(e|=0))<1e-16)return t=15568+(t<<4)|0,i[o>>2]=i[t>>2],i[o+4>>2]=i[t+4>>2],i[o+8>>2]=i[t+8>>2],void(i[o+12>>2]=i[t+12>>2]);if(c=+g(+ +a[e+8>>3],+ +a[e>>3]),(0|n)>0){e=0;do{s/=2.6457513110645907,e=e+1|0}while((0|e)!=(0|n))}r?(s/=3,n=0==(0|Fe(n)),s=+m(.381966011250105*(n?s:s/2.6457513110645907))):(s=+m(.381966011250105*s),0|Fe(n)&&(c=+Ee(c+.3334731722518321))),function(e,t,n,r){e|=0,t=+t,r|=0;var o=0,s=0,l=0,c=0;if((n=+n)<1e-16)return i[r>>2]=i[e>>2],i[r+4>>2]=i[e+4>>2],i[r+8>>2]=i[e+8>>2],void(i[r+12>>2]=i[e+12>>2]);s=t<0?t+6.283185307179586:t,s=t>=6.283185307179586?s+-6.283185307179586:s;do{if(!(s<1e-16)){if(o=+A(+(s+-3.141592653589793))<1e-16,t=+a[e>>3],o){t-=n,a[r>>3]=t,o=r;break}if(l=+u(+n),n=+h(+n),t=l*+h(+t)+ +u(+s)*(n*+u(+t)),t=+p(+((t=t>1?1:t)<-1?-1:t)),a[r>>3]=t,+A(+(t+-1.5707963267948966))<1e-16)return a[r>>3]=1.5707963267948966,void(a[r+8>>3]=0);if(+A(+(t+1.5707963267948966))<1e-16)return a[r>>3]=-1.5707963267948966,void(a[r+8>>3]=0);if(c=+u(+t),s=n*+h(+s)/c,n=+a[e>>3],t=(l-+h(+t)*+h(+n))/+u(+n)/c,l=s>1?1:s,t=t>1?1:t,(t=+a[e+8>>3]+ +g(+(l<-1?-1:l),+(t<-1?-1:t)))>3.141592653589793)do{t+=-6.283185307179586}while(t>3.141592653589793);if(t<-3.141592653589793)do{t+=6.283185307179586}while(t<-3.141592653589793);return void(a[r+8>>3]=t)}t=+a[e>>3]+n,a[r>>3]=t,o=r}while(0);if(+A(+(t+-1.5707963267948966))<1e-16)return a[o>>3]=1.5707963267948966,void(a[r+8>>3]=0);if(+A(+(t+1.5707963267948966))<1e-16)return a[o>>3]=-1.5707963267948966,void(a[r+8>>3]=0);if((t=+a[e+8>>3])>3.141592653589793)do{t+=-6.283185307179586}while(t>3.141592653589793);if(t<-3.141592653589793)do{t+=6.283185307179586}while(t<-3.141592653589793);a[r+8>>3]=t}(15568+(t<<4)|0,+Ee(+a[16368+(24*t|0)>>3]-c),s,o)}function ye(e,t,n){t|=0,n|=0;var r,a;r=P,P=P+16|0,Z((e|=0)+4|0,a=r),ve(a,0|i[e>>2],t,0,n),P=r}function xe(e,t,n,r,o){e|=0,t|=0,n|=0,r|=0,o|=0;var s,A,l,c,u,h,d,f,p,m,g,v,y,x,b,_,w,S,E,T,L,C,R=0,q=0,D=0,I=0,B=0,k=0;if(C=P,P=P+272|0,I=C+240|0,E=C,T=C+224|0,L=C+208|0,g=C+176|0,v=C+160|0,y=C+192|0,x=C+144|0,b=C+128|0,_=C+112|0,w=C+96|0,S=C+80|0,i[(R=C+256|0)>>2]=t,i[I>>2]=i[e>>2],i[I+4>>2]=i[e+4>>2],i[I+8>>2]=i[e+8>>2],i[I+12>>2]=i[e+12>>2],be(I,R,E),i[o>>2]=0,(0|(I=r+n+(5==(0|r)&1)|0))<=(0|n))P=C;else{A=T+4|0,l=g+4|0,c=n+5|0,u=16848+((s=0|i[R>>2])<<2)|0,h=16928+(s<<2)|0,d=b+8|0,f=_+8|0,p=w+8|0,m=L+4|0,D=n;e:for(;;){q=E+(((0|D)%5|0)<<4)|0,i[L>>2]=i[q>>2],i[L+4>>2]=i[q+4>>2],i[L+8>>2]=i[q+8>>2],i[L+12>>2]=i[q+12>>2];do{}while(2==(0|_e(L,s,0,1)));if((0|D)>(0|n)&0!=(0|Fe(t))){if(i[g>>2]=i[L>>2],i[g+4>>2]=i[L+4>>2],i[g+8>>2]=i[L+8>>2],i[g+12>>2]=i[L+12>>2],Z(A,v),r=0|i[g>>2],R=0|i[17008+(80*r|0)+(i[T>>2]<<2)>>2],i[g>>2]=i[18608+(80*r|0)+(20*R|0)>>2],(0|(q=0|i[18608+(80*r|0)+(20*R|0)+16>>2]))>0){e=0;do{oe(l),e=e+1|0}while((0|e)<(0|q))}switch(q=18608+(80*r|0)+(20*R|0)+4|0,i[y>>2]=i[q>>2],i[y+4>>2]=i[q+4>>2],i[y+8>>2]=i[q+8>>2],$(y,3*(0|i[u>>2])|0),J(l,y,l),X(l),Z(l,x),B=+(0|i[h>>2]),a[b>>3]=3*B,a[d>>3]=0,k=-1.5*B,a[_>>3]=k,a[f>>3]=2.598076211353316*B,a[w>>3]=k,a[p>>3]=-2.598076211353316*B,0|i[17008+(80*(0|i[g>>2])|0)+(i[L>>2]<<2)>>2]){case 1:e=_,r=b;break;case 3:e=w,r=_;break;case 2:e=b,r=w;break;default:e=12;break e}ot(v,x,r,e,S),ve(S,0|i[g>>2],s,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2])}if((0|D)<(0|c)&&(Z(m,g),ve(g,0|i[L>>2],s,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2])),i[T>>2]=i[L>>2],i[T+4>>2]=i[L+4>>2],i[T+8>>2]=i[L+8>>2],i[T+12>>2]=i[L+12>>2],(0|(D=D+1|0))>=(0|I)){e=3;break}}3!=(0|e)?12==(0|e)&&M(22474,22521,581,22531):P=C}}function be(e,t,n){e|=0,t|=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|Fe(0|i[t>>2])))?a:o,ce(o=e+4|0),ue(o),0|Fe(0|i[t>>2])&&(ie(o),i[t>>2]=1+(0|i[t>>2])),i[n>>2]=i[e>>2],J(o,a,t=n+4|0),X(t),i[n+16>>2]=i[e>>2],J(o,a+12|0,t=n+20|0),X(t),i[n+32>>2]=i[e>>2],J(o,a+24|0,t=n+36|0),X(t),i[n+48>>2]=i[e>>2],J(o,a+36|0,t=n+52|0),X(t),i[n+64>>2]=i[e>>2],J(o,a+48|0,n=n+68|0),X(n),P=r}function _e(e,t,n,r){n|=0,r|=0;var a,o,s,A,l,c,u=0,h=0,d=0,f=0,p=0;if(c=P,P=P+32|0,l=c+12|0,o=c,p=(e|=0)+4|0,f=0|i[16928+((t|=0)<<2)>>2],f=(A=0!=(0|r))?3*f|0:f,u=0|i[p>>2],a=0|i[(s=e+8|0)>>2],A){if((0|(u=a+u+(r=0|i[(h=e+12|0)>>2])|0))==(0|f))return P=c,0|(p=1);d=h}else u=a+u+(r=0|i[(d=e+12|0)>>2])|0;if((0|u)<=(0|f))return P=c,0|(p=0);do{if((0|r)>0){if(r=0|i[e>>2],(0|a)>0){h=18608+(80*r|0)+60|0,r=e;break}r=18608+(80*r|0)+40|0,n?(Q(l,f,0,0),K(p,l,o),se(o),J(o,l,p),h=r,r=e):(h=r,r=e)}else h=18608+(80*(0|i[e>>2])|0)+20|0,r=e}while(0);if(i[r>>2]=i[h>>2],(0|i[(u=h+16|0)>>2])>0){r=0;do{oe(p),r=r+1|0}while((0|r)<(0|i[u>>2]))}return e=h+4|0,i[l>>2]=i[e>>2],i[l+4>>2]=i[e+4>>2],i[l+8>>2]=i[e+8>>2],t=0|i[16848+(t<<2)>>2],$(l,A?3*t|0:t),J(p,l,p),X(p),r=A&&((0|i[s>>2])+(0|i[p>>2])+(0|i[d>>2])|0)==(0|f)?1:2,P=c,0|(p=r)}function we(e,t){e|=0,t|=0;var n=0;do{n=0|_e(e,t,0,1)}while(2==(0|n));return 0|n}function Me(e,t,n,r,o){e|=0,t|=0,n|=0,r|=0,o|=0;var s,A,l,c,u,h,d,f,p,m,g,v,y,x,b,_,w,S,E=0,T=0,L=0,C=0,R=0;if(S=P,P=P+240|0,x=S+208|0,b=S,_=S+192|0,w=S+176|0,p=S+160|0,m=S+144|0,g=S+128|0,v=S+112|0,y=S+96|0,i[(E=S+224|0)>>2]=t,i[x>>2]=i[e>>2],i[x+4>>2]=i[e+4>>2],i[x+8>>2]=i[e+8>>2],i[x+12>>2]=i[e+12>>2],Se(x,E,b),i[o>>2]=0,(0|(f=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,c=m+8|0,u=g+8|0,h=v+8|0,d=_+4|0,T=0,L=n,r=-1;e:for(;;){if(e=b+((E=(0|L)%6|0)<<4)|0,i[_>>2]=i[e>>2],i[_+4>>2]=i[e+4>>2],i[_+8>>2]=i[e+8>>2],i[_+12>>2]=i[e+12>>2],e=T,T=0|_e(_,s,0,1),(0|L)>(0|n)&0!=(0|Fe(t))&&(1!=(0|e)&&(0|i[_>>2])!=(0|r))){switch(Z(b+(((E+5|0)%6|0)<<4)+4|0,w),Z(b+(E<<4)+4|0,p),C=+(0|i[l>>2]),a[m>>3]=3*C,a[c>>3]=0,R=-1.5*C,a[g>>3]=R,a[u>>3]=2.598076211353316*C,a[v>>3]=R,a[h>>3]=-2.598076211353316*C,E=0|i[x>>2],0|i[17008+(80*E|0)+(((0|r)==(0|E)?0|i[_>>2]:r)<<2)>>2]){case 1:e=g,r=m;break;case 3:e=v,r=g;break;case 2:e=m,r=v;break;default:e=8;break e}ot(w,p,r,e,y),0|st(w,y)||0|st(p,y)||(ve(y,0|i[x>>2],s,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2]))}if((0|L)<(0|A)&&(Z(d,w),ve(w,0|i[_>>2],s,1,o+8+(i[o>>2]<<4)|0),i[o>>2]=1+(0|i[o>>2])),(0|(L=L+1|0))>=(0|f)){e=3;break}r=0|i[_>>2]}3!=(0|e)?8==(0|e)&&M(22557,22521,746,22602):P=S}}function Se(e,t,n){e|=0,t|=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|Fe(0|i[t>>2])))?a:o,ce(o=e+4|0),ue(o),0|Fe(0|i[t>>2])&&(ie(o),i[t>>2]=1+(0|i[t>>2])),i[n>>2]=i[e>>2],J(o,a,t=n+4|0),X(t),i[n+16>>2]=i[e>>2],J(o,a+12|0,t=n+20|0),X(t),i[n+32>>2]=i[e>>2],J(o,a+24|0,t=n+36|0),X(t),i[n+48>>2]=i[e>>2],J(o,a+36|0,t=n+52|0),X(t),i[n+64>>2]=i[e>>2],J(o,a+48|0,t=n+68|0),X(t),i[n+80>>2]=i[e>>2],J(o,a+60|0,n=n+84|0),X(n),P=r}function Ee(e){var t;return t=(e=+e)<0?e+6.283185307179586:e,+(e>=6.283185307179586?t+-6.283185307179586:t)}function Te(e,t){return t|=0,+A(+(+a[(e|=0)>>3]-+a[t>>3]))<17453292519943298e-27?0|(t=+A(+(+a[e+8>>3]-+a[t+8>>3]))<17453292519943298e-27):0|(t=0)}function Le(e,t){e|=0;var n,r,i,o=0;return r=+a[(t|=0)>>3],n=+a[e>>3],o=(i=+h(.5*(r-n)))*i+(o=+h(.5*(+a[t+8>>3]-+a[e+8>>3])))*(+u(+r)*+u(+n)*o),2*+g(+ +l(+o),+ +l(+(1-o)))*6371.007180918475}function Ce(e,t,n){e|=0,n|=0;var r,i,o,s,A=0,c=0,f=0,p=0,v=0,y=0;return y=+a[(t|=0)>>3],o=+a[e>>3],v=+h(.5*(y-o)),f=+a[t+8>>3],i=+a[e+8>>3],p=+h(.5*(f-i)),r=+u(+o),s=+u(+y),p=2*+g(+ +l(+(p=v*v+p*(s*r*p))),+ +l(+(1-p))),v=+a[n>>3],y=+h(.5*(v-y)),A=+a[n+8>>3],f=+h(.5*(A-f)),c=+u(+v),f=2*+g(+ +l(+(f=y*y+f*(s*c*f))),+ +l(+(1-f))),v=+h(.5*(o-v)),A=+h(.5*(i-A)),A=2*+g(+ +l(+(A=v*v+A*(r*c*A))),+ +l(+(1-A))),4*+m(+ +l(+ +d(.5*(c=.5*(p+f+A)))*+d(.5*(c-p))*+d(.5*(c-f))*+d(.5*(c-A))))}function Pe(e,t){return t=0|Mt(0|(e|=0),0|(t|=0),45),w(),127&t|0}function Re(e,t){var n=0,r=0,i=0,a=0,o=0,s=0;if(!(!0&134217728==(-16777216&(t|=0)|0)))return 0|(t=0);if(o=0|Mt(0|(e|=0),0|t,45),w(),(o&=127)>>>0>121)return 0|(t=0);n=0|Mt(0|e,0|t,52),w(),n&=15;do{if(0|n){for(i=1,r=0;;){if(a=0|Mt(0|e,0|t,3*(15-i|0)|0),w(),0!=(0|(a&=7))&(1^r)){if(1==(0|a)&0!=(0|k(o))){s=0,r=13;break}r=1}if(7==(0|a)){s=0,r=13;break}if(!(i>>>0>>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|Mt(0|e,0|t,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 qe(e,t,n){n|=0;var r=0,i=0;if(r=0|Mt(0|(e|=0),0|(t|=0),52),w(),(0|(r&=15))>=(0|n)){if((0|r)!=(0|n))if(n>>>0<=15){if(e|=i=0|St(0|n,0,52),t=0|w()|-15728641&t,(0|r)>(0|n))do{i=0|St(7,0,3*(14-n|0)|0),n=n+1|0,e|=i,t=0|w()|t}while((0|n)<(0|r))}else t=0,e=0}else t=0,e=0;return _(0|t),0|e}function De(e,t,n,r){n|=0,r|=0;var a,o=0,s=0,A=0,l=0,c=0,u=0;if(A=0|Mt(0|(e|=0),0|(t|=0),52),w(),(0|n)<16&(0|(A&=15))<=(0|n)){if((0|A)==(0|n))return i[(n=r)>>2]=e,void(i[n+4>>2]=t);if(a=(0|(c=0|tt(7,n-A|0)))/7|0,l=0|Mt(0|e,0|t,45),w(),0|k(127&l)){e:do{if(A)for(s=1;;){if(o=0|Mt(0|e,0|t,3*(15-s|0)|0),w(),0|(o&=7))break e;if(!(s>>>0>>0)){o=0;break}s=s+1|0}else o=0}while(0);s=0==(0|o)}else s=0;if(u=0|St(A+1|0,0,52),o=0|w()|-15728641&t,De(t=(u|e)&~(t=0|St(7,0,0|(l=3*(14-A|0)|0))),A=o&~(0|w()),n,r),o=r+(a<<3)|0,!s)return De((u=0|St(1,0,0|l))|t,0|w()|A,n,o),u=o+(a<<3)|0,De((c=0|St(2,0,0|l))|t,0|w()|A,n,u),u=u+(a<<3)|0,De((c=0|St(3,0,0|l))|t,0|w()|A,n,u),u=u+(a<<3)|0,De((c=0|St(4,0,0|l))|t,0|w()|A,n,u),u=u+(a<<3)|0,De((c=0|St(5,0,0|l))|t,0|w()|A,n,u),void De((c=0|St(6,0,0|l))|t,0|w()|A,n,u+(a<<3)|0);s=o+(a<<3)|0,(0|c)>6&&(Ct(0|o,0,(u=(s>>>0>(c=o+8|0)>>>0?s:c)+-1+(0-o)|0)+8&-8|0),o=c+(u>>>3<<3)|0),De((u=0|St(2,0,0|l))|t,0|w()|A,n,o),u=o+(a<<3)|0,De((c=0|St(3,0,0|l))|t,0|w()|A,n,u),u=u+(a<<3)|0,De((c=0|St(4,0,0|l))|t,0|w()|A,n,u),u=u+(a<<3)|0,De((c=0|St(5,0,0|l))|t,0|w()|A,n,u),De((c=0|St(6,0,0|l))|t,0|w()|A,n,u+(a<<3)|0)}}function Ie(e,t){var n=0,r=0,i=0;if(i=0|Mt(0|(e|=0),0|(t|=0),45),w(),!(0|k(127&i)))return 0|(i=0);i=0|Mt(0|e,0|t,52),w(),i&=15;e:do{if(i)for(r=1;;){if(n=0|Mt(0|e,0|t,3*(15-r|0)|0),w(),0|(n&=7))break e;if(!(r>>>0>>0)){n=0;break}r=r+1|0}else n=0}while(0);return 0|(i=0==(0|n)&1)}function Be(e,t){var n=0,r=0,i=0;if(i=0|Mt(0|(e|=0),0|(t|=0),52),w(),!(i&=15))return 0|(i=0);for(r=1;;){if(n=0|Mt(0|e,0|t,3*(15-r|0)|0),w(),0|(n&=7)){r=5;break}if(!(r>>>0>>0)){n=0,r=5;break}r=r+1|0}return 5==(0|r)?0|n:0}function ke(e,t){var n=0,r=0,i=0,a=0,o=0,s=0,A=0;if(A=0|Mt(0|(e|=0),0|(t|=0),52),w(),!(A&=15))return A=e,_(0|(s=t)),0|A;for(s=1,n=0;;){r=0|St(7,0,0|(a=3*(15-s|0)|0)),i=0|w(),o=0|Mt(0|e,0|t,0|a),w(),e=(a=0|St(0|Ae(7&o),0,0|a))|e&~r,t=(o=0|w())|t&~i;e:do{if(!n)if(0==(a&r|0)&0==(o&i|0))n=0;else if(r=0|Mt(0|e,0|t,52),w(),r&=15){n=1;t:for(;;){switch(o=0|Mt(0|e,0|t,3*(15-n|0)|0),w(),7&o){case 1:break t;case 0:break;default:n=1;break e}if(!(n>>>0>>0)){n=1;break e}n=n+1|0}for(n=1;;){if(i=0|Mt(0|e,0|t,0|(o=3*(15-n|0)|0)),w(),a=0|St(7,0,0|o),t&=~(0|w()),e=e&~a|(o=0|St(0|Ae(7&i),0,0|o)),t=0|t|w(),!(n>>>0>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(s>>>0>>0))break;s=s+1|0}return _(0|t),0|e}function Oe(e,t){var n=0,r=0,i=0,a=0,o=0;if(r=0|Mt(0|(e|=0),0|(t|=0),52),w(),!(r&=15))return r=e,_(0|(n=t)),0|r;for(n=1;o=0|Mt(0|e,0|t,0|(a=3*(15-n|0)|0)),w(),i=0|St(7,0,0|a),t&=~(0|w()),e=(a=0|St(0|Ae(7&o),0,0|a))|e&~i,t=0|w()|t,n>>>0>>0;)n=n+1|0;return _(0|t),0|e}function Ne(e,t){var n=0,r=0,i=0,a=0,o=0,s=0,A=0;if(A=0|Mt(0|(e|=0),0|(t|=0),52),w(),!(A&=15))return A=e,_(0|(s=t)),0|A;for(s=1,n=0;;){r=0|St(7,0,0|(a=3*(15-s|0)|0)),i=0|w(),o=0|Mt(0|e,0|t,0|a),w(),e=(a=0|St(0|le(7&o),0,0|a))|e&~r,t=(o=0|w())|t&~i;e:do{if(!n)if(0==(a&r|0)&0==(o&i|0))n=0;else if(r=0|Mt(0|e,0|t,52),w(),r&=15){n=1;t:for(;;){switch(o=0|Mt(0|e,0|t,3*(15-n|0)|0),w(),7&o){case 1:break t;case 0:break;default:n=1;break e}if(!(n>>>0>>0)){n=1;break e}n=n+1|0}for(n=1;;){if(a=0|St(7,0,0|(i=3*(15-n|0)|0)),o=t&~(0|w()),t=0|Mt(0|e,0|t,0|i),w(),e=e&~a|(t=0|St(0|le(7&t),0,0|i)),t=0|o|w(),!(n>>>0>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(s>>>0>>0))break;s=s+1|0}return _(0|t),0|e}function ze(e,t){var n=0,r=0,i=0,a=0,o=0;if(r=0|Mt(0|(e|=0),0|(t|=0),52),w(),!(r&=15))return r=e,_(0|(n=t)),0|r;for(n=1;a=0|St(7,0,0|(o=3*(15-n|0)|0)),i=t&~(0|w()),t=0|Mt(0|e,0|t,0|o),w(),e=(t=0|St(0|le(7&t),0,0|o))|e&~a,t=0|w()|i,n>>>0>>0;)n=n+1|0;return _(0|t),0|e}function Fe(e){return 0|(0|(e|=0))%2}function Ue(e,t){e|=0;var n,r;return r=P,P=P+16|0,n=r,(t|=0)>>>0<=15&&2146435072!=(2146435072&i[e+4>>2]|0)&&2146435072!=(2146435072&i[e+8+4>>2]|0)?(!function(e,t,n){var r,i;r=P,P=P+16|0,ge(e|=0,t|=0,n|=0,i=r),Y(i,n+4|0),P=r}(e,t,n),t=0|function(e,t){e|=0;var n,r=0,a=0,o=0,s=0,A=0,l=0,c=0,u=0;if(n=P,P=P+64|0,l=n+40|0,a=n+24|0,o=n+12|0,s=n,St(0|(t|=0),0,52),r=134225919|w(),!t)return(0|i[e+4>>2])>2||(0|i[e+8>>2])>2||(0|i[e+12>>2])>2?(l=0,_(0|(A=0)),P=n,0|l):(St(0|N(e),0,45),A=0|w()|r,l=-1,_(0|A),P=n,0|l);if(i[l>>2]=i[e>>2],i[l+4>>2]=i[e+4>>2],i[l+8>>2]=i[e+8>>2],i[l+12>>2]=i[e+12>>2],A=l+4|0,(0|t)>0)for(e=-1;i[a>>2]=i[A>>2],i[a+4>>2]=i[A+4>>2],i[a+8>>2]=i[A+8>>2],1&t?(te(A),i[o>>2]=i[A>>2],i[o+4>>2]=i[A+4>>2],i[o+8>>2]=i[A+8>>2],re(o)):(ne(A),i[o>>2]=i[A>>2],i[o+4>>2]=i[A+4>>2],i[o+8>>2]=i[A+8>>2],ie(o)),K(a,o,s),X(s),c=0|St(7,0,0|(u=3*(15-t|0)|0)),r&=~(0|w()),e=(u=0|St(0|ee(s),0,0|u))|e&~c,r=0|w()|r,(0|t)>1;)t=t+-1|0;else e=-1;e:do{if((0|i[A>>2])<=2&&(0|i[l+8>>2])<=2&&(0|i[l+12>>2])<=2){if(t=0|St(0|(a=0|N(l)),0,45),t|=e,e=0|w()|-1040385&r,s=0|z(l),!(0|k(a))){if((0|s)<=0)break;for(o=0;;){if(a=0|Mt(0|t,0|e,52),w(),a&=15)for(r=1;l=0|Mt(0|t,0|e,0|(u=3*(15-r|0)|0)),w(),c=0|St(7,0,0|u),e&=~(0|w()),t=t&~c|(u=0|St(0|Ae(7&l),0,0|u)),e=0|e|w(),r>>>0>>0;)r=r+1|0;if((0|(o=o+1|0))==(0|s))break e}}o=0|Mt(0|t,0|e,52),w(),o&=15;t:do{if(o){r=1;n:for(;;){switch(u=0|Mt(0|t,0|e,3*(15-r|0)|0),w(),7&u){case 1:break n;case 0:break;default:break t}if(!(r>>>0>>0))break t;r=r+1|0}if(0|F(a,0|i[l>>2]))for(r=1;c=0|St(7,0,0|(l=3*(15-r|0)|0)),u=e&~(0|w()),e=0|Mt(0|t,0|e,0|l),w(),t=t&~c|(e=0|St(0|le(7&e),0,0|l)),e=0|u|w(),r>>>0>>0;)r=r+1|0;else for(r=1;l=0|Mt(0|t,0|e,0|(u=3*(15-r|0)|0)),w(),c=0|St(7,0,0|u),e&=~(0|w()),t=t&~c|(u=0|St(0|Ae(7&l),0,0|u)),e=0|e|w(),r>>>0>>0;)r=r+1|0}}while(0);if((0|s)>0){r=0;do{t=0|ke(t,e),e=0|w(),r=r+1|0}while((0|r)!=(0|s))}}else t=0,e=0}while(0);return u=t,_(0|(c=e)),P=n,0|u}(n,t),e=0|w()):(e=0,t=0),_(0|e),P=r,0|t}function He(e,t,n){var r,a=0,o=0,s=0;if(r=(n|=0)+4|0,o=0|Mt(0|(e|=0),0|(t|=0),52),w(),o&=15,s=0|Mt(0|e,0|t,45),w(),a=0==(0|o),0|k(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?re(r):ie(r),s=0|Mt(0|e,0|t,3*(15-n|0)|0),w(),ae(r,7&s),n>>>0>>0;)n=n+1|0;return 0|a}function Ge(e,t,n){n|=0;var r,a,o=0,s=0,A=0,l=0,c=0,u=0;a=P,P=P+16|0,r=a,u=0|Mt(0|(e|=0),0|(t|=0),45),w(),u&=127;e:do{if(0!=(0|k(u))&&(A=0|Mt(0|e,0|t,52),w(),0!=(0|(A&=15)))){o=1;t:for(;;){switch(c=0|Mt(0|e,0|t,3*(15-o|0)|0),w(),7&c){case 5:break t;case 0:break;default:o=t;break e}if(!(o>>>0>>0)){o=t;break e}o=o+1|0}for(s=1,o=t;l=0|St(7,0,0|(t=3*(15-s|0)|0)),c=o&~(0|w()),o=0|Mt(0|e,0|o,0|t),w(),e=e&~l|(o=0|St(0|le(7&o),0,0|t)),o=0|c|w(),s>>>0>>0;)s=s+1|0}else o=t}while(0);if(c=7728+(28*u|0)|0,i[n>>2]=i[c>>2],i[n+4>>2]=i[c+4>>2],i[n+8>>2]=i[c+8>>2],i[n+12>>2]=i[c+12>>2],0|He(e,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|Mt(0|e,0|o,52),w(),c=15&A,1&A?(ie(l),A=c+1|0):A=c,0|k(u)){e:do{if(c)for(t=1;;){if(s=0|Mt(0|e,0|o,3*(15-t|0)|0),w(),0|(s&=7)){o=s;break e}if(!(t>>>0>>0)){o=0;break}t=t+1|0}else o=0}while(0);o=4==(0|o)&1}else o=0;if(0|_e(n,A,o,0)){if(0|k(u))do{}while(0!=(0|_e(n,A,0,0)));(0|A)!=(0|c)&&ne(l)}else(0|A)!=(0|c)&&(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 Ve(e,t,n){n|=0;var r,i;r=P,P=P+16|0,Ge(e|=0,t|=0,i=r),t=0|Mt(0|e,0|t,52),w(),ye(i,15&t,n),P=r}function je(e,t,n){n|=0;var r,i,a=0,o=0;i=P,P=P+16|0,Ge(e|=0,t|=0,r=i),a=0|Mt(0|e,0|t,45),w(),a=0==(0|k(127&a)),o=0|Mt(0|e,0|t,52),w(),o&=15;e:do{if(!a){if(0|o)for(a=1;;){if(!(0==((0|St(7,0,3*(15-a|0)|0))&e|0)&0==((0|w())&t|0)))break e;if(!(a>>>0>>0))break;a=a+1|0}return xe(r,o,0,5,n),void(P=i)}}while(0);Me(r,o,0,6,n),P=i}function We(e,t){t|=0;var n,r=0,a=0,o=0,s=0,A=0,l=0;if(St(0|(e|=0),0,52),n=134225919|w(),(0|e)<1){a=0,r=0;do{0|k(a)&&(St(0|a,0,45),A=0|n|w(),i[(e=t+(r<<3)|0)>>2]=-1,i[e+4>>2]=A,r=r+1|0),a=a+1|0}while(122!=(0|a))}else{A=0,r=0;do{if(0|k(A)){for(St(0|A,0,45),a=1,o=-1,s=0|n|w();o&=~(l=0|St(7,0,3*(15-a|0)|0)),s&=~(0|w()),(0|a)!=(0|e);)a=a+1|0;i[(l=t+(r<<3)|0)>>2]=o,i[l+4>>2]=s,r=r+1|0}A=A+1|0}while(122!=(0|A))}}function Qe(e,t,n,r){var a,o=0,s=0,A=0,l=0,c=0;if(a=P,P=P+64|0,A=a,(0|(e|=0))==(0|(n|=0))&(0|(t|=0))==(0|(r|=0))|!1|134217728!=(2013265920&t|0)|!1|134217728!=(2013265920&r|0))return P=a,0|(A=0);if(o=0|Mt(0|e,0|t,52),w(),o&=15,s=0|Mt(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&&(c=0|qe(e,t,s),l=0|w(),(0|c)==(0|(s=0|qe(n,r,s)))&(0|l)==(0|w()))){if(o=0|Mt(0|e,0|t,0|(s=3*(15^o)|0)),w(),o&=7,s=0|Mt(0|n,0|r,0|s),w(),0==(0|o)|0==(0|(s&=7)))return P=a,0|(c=1);if((0|i[21136+(o<<2)>>2])==(0|s))return P=a,0|(c=1);if((0|i[21168+(o<<2)>>2])==(0|s))return P=a,0|(c=1)}s=(o=A)+56|0;do{i[o>>2]=0,o=o+4|0}while((0|o)<(0|s));return R(e,t,1,A),o=(0|i[(c=A)>>2])==(0|n)&&(0|i[c+4>>2])==(0|r)||(0|i[(c=A+8|0)>>2])==(0|n)&&(0|i[c+4>>2])==(0|r)||(0|i[(c=A+16|0)>>2])==(0|n)&&(0|i[c+4>>2])==(0|r)||(0|i[(c=A+24|0)>>2])==(0|n)&&(0|i[c+4>>2])==(0|r)||(0|i[(c=A+32|0)>>2])==(0|n)&&(0|i[c+4>>2])==(0|r)||(0|i[(c=A+40|0)>>2])==(0|n)&&(0|i[c+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|(c=o)}function Ye(e,t,n){n|=0;var r,a,o,s,A=0;if(o=P,P=P+16|0,a=o,A=0|Mt(0|(e|=0),0|(t|=0),56),w(),-1==(0|(t=0|function(e,t,n){n|=0;var r=0,a=0;if(r=0|Ie(e=e|0,t=t|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(e,t){var n=0,r=0,a=0,o=0,s=0,A=0,l=0,c=0;if(c=P,P=P+32|0,o=c,Ge(e=e|0,t=t|0,a=c+16|0),s=0|Pe(e,t),l=0|Be(e,t),function(e,t){e=7728+(28*(e|=0)|0)|0,i[(t|=0)>>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]}(s,o),t=0|function(e,t){e|=0;var n=0,r=0;if((t|=0)>>>0>20)return-1;do{if((0|i[11152+(216*t|0)>>2])!=(0|e))if((0|i[11152+(216*t|0)+8>>2])!=(0|e))if((0|i[11152+(216*t|0)+16>>2])!=(0|e))if((0|i[11152+(216*t|0)+24>>2])!=(0|e))if((0|i[11152+(216*t|0)+32>>2])!=(0|e))if((0|i[11152+(216*t|0)+40>>2])!=(0|e))if((0|i[11152+(216*t|0)+48>>2])!=(0|e))if((0|i[11152+(216*t|0)+56>>2])!=(0|e))if((0|i[11152+(216*t|0)+64>>2])!=(0|e))if((0|i[11152+(216*t|0)+72>>2])!=(0|e))if((0|i[11152+(216*t|0)+80>>2])!=(0|e))if((0|i[11152+(216*t|0)+88>>2])!=(0|e))if((0|i[11152+(216*t|0)+96>>2])!=(0|e))if((0|i[11152+(216*t|0)+104>>2])!=(0|e))if((0|i[11152+(216*t|0)+112>>2])!=(0|e))if((0|i[11152+(216*t|0)+120>>2])!=(0|e))if((0|i[11152+(216*t|0)+128>>2])!=(0|e)){if((0|i[11152+(216*t|0)+136>>2])!=(0|e)){if((0|i[11152+(216*t|0)+144>>2])==(0|e)){e=0,n=2,r=0;break}if((0|i[11152+(216*t|0)+152>>2])==(0|e)){e=0,n=2,r=1;break}if((0|i[11152+(216*t|0)+160>>2])==(0|e)){e=0,n=2,r=2;break}if((0|i[11152+(216*t|0)+168>>2])==(0|e)){e=1,n=2,r=0;break}if((0|i[11152+(216*t|0)+176>>2])==(0|e)){e=1,n=2,r=1;break}if((0|i[11152+(216*t|0)+184>>2])==(0|e)){e=1,n=2,r=2;break}if((0|i[11152+(216*t|0)+192>>2])==(0|e)){e=2,n=2,r=0;break}if((0|i[11152+(216*t|0)+200>>2])==(0|e)){e=2,n=2,r=1;break}if((0|i[11152+(216*t|0)+208>>2])==(0|e)){e=2,n=2,r=2;break}return-1}e=2,n=1,r=2}else e=2,n=1,r=1;else e=2,n=1,r=0;else e=1,n=1,r=2;else e=1,n=1,r=1;else e=1,n=1,r=0;else e=0,n=1,r=2;else e=0,n=1,r=1;else e=0,n=1,r=0;else e=2,n=0,r=2;else e=2,n=0,r=1;else e=2,n=0,r=0;else e=1,n=0,r=2;else e=1,n=0,r=1;else e=1,n=0,r=0;else e=0,n=0,r=2;else e=0,n=0,r=1;else e=0,n=0,r=0}while(0);return 0|i[11152+(216*t|0)+(72*n|0)+(24*e|0)+(r<<3)+4>>2]}(s,0|i[a>>2]),!(0|k(s)))return P=c,0|(l=t);switch(0|s){case 4:e=0,n=14;break;case 14:e=1,n=14;break;case 24:e=2,n=14;break;case 38:e=3,n=14;break;case 49:e=4,n=14;break;case 58:e=5,n=14;break;case 63:e=6,n=14;break;case 72:e=7,n=14;break;case 83:e=8,n=14;break;case 97:e=9,n=14;break;case 107:e=10,n=14;break;case 117:e=11,n=14;break;default:A=0,r=0}14==(0|n)&&(A=0|i[22096+(24*e|0)+8>>2],r=0|i[22096+(24*e|0)+16>>2]);(0|(e=0|i[a>>2]))!=(0|i[o>>2])&&(s=0|O(s))|(0|(e=0|i[a>>2]))==(0|r)&&(t=(t+1|0)%6|0);if(3==(0|l)&(0|e)==(0|r))return P=c,0|(l=(t+5|0)%6|0);if(!(5==(0|l)&(0|e)==(0|A)))return P=c,0|(l=t);return P=c,0|(l=(t+1|0)%6|0)}(e,t),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&t|0))?e:0,e=s?-2130706433&t|134217728:0,7&A))))return i[n>>2]=0,void(P=o);Ge(r,e,a),A=0|Mt(0|r,0|e,52),w(),A&=15,0|Ie(r,e)?xe(a,A,t,2,n):Me(a,A,t,2,n),P=o}function Xe(e){e|=0;var t,n,r=0;return(t=0|yt(1,12))||M(22691,22646,49,22704),0|(r=0|i[(n=e+4|0)>>2])?(i[(r=r+8|0)>>2]=t,i[n>>2]=t,0|t):(0|i[e>>2]&&M(22721,22646,61,22744),i[(r=e)>>2]=t,i[n>>2]=t,0|t)}function Ze(e,t){e|=0,t|=0;var n,r;return(r=0|gt(24))||M(22758,22646,78,22772),i[r>>2]=i[t>>2],i[r+4>>2]=i[t+4>>2],i[r+8>>2]=i[t+8>>2],i[r+12>>2]=i[t+12>>2],i[r+16>>2]=0,0|(n=0|i[(t=e+4|0)>>2])?(i[n+16>>2]=r,i[t>>2]=r,0|r):(0|i[e>>2]&&M(22787,22646,82,22772),i[e>>2]=r,i[t>>2]=r,0|r)}function Je(e){var t,n,r=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,x=0,b=0,_=0,w=0,S=0,E=0,T=0,L=0,C=0,P=0,R=0,q=0,D=0,I=0,B=0,k=0;if(0|i[(l=(e|=0)+8|0)>>2])return 0|(k=1);if(!(s=0|i[e>>2]))return 0|(k=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|(k=0);(n=0|gt(o<<2))||M(22807,22646,317,22826),(t=0|gt(o<<5))||M(22848,22646,321,22826),i[e>>2]=0,i[(L=e+4|0)>>2]=0,i[l>>2]=0,o=0,I=0,T=0,m=0;e:for(;;){if(p=0|i[s>>2]){c=0,u=p;do{if(d=+a[u+8>>3],r=u,u=0|i[u+16>>2],h=+a[(l=(f=0==(0|u))?p:u)+8>>3],+A(+(d-h))>3.141592653589793){k=14;break}c+=(h-d)*(+a[r>>3]+ +a[l>>3])}while(!f);if(14==(0|k)){k=0,c=0,r=p;do{E=+a[r+8>>3],q=0|i[(D=r+16|0)>>2],S=+a[(q=0==(0|q)?p:q)+8>>3],c+=(+a[r>>3]+ +a[q>>3])*((S<0?S+6.283185307179586:S)-(E<0?E+6.283185307179586:E)),r=0|i[(0==(0|r)?s:D)>>2]}while(0!=(0|r))}c>0?(i[n+(I<<2)>>2]=s,I=I+1|0,l=T,r=m):k=19}else k=19;if(19==(0|k)){k=0;do{if(!o){if(m){l=L,u=m+8|0,r=s,o=e;break}if(0|i[e>>2]){k=27;break e}l=L,u=e,r=s,o=e;break}if(0|i[(r=o+8|0)>>2]){k=21;break e}if(!(o=0|yt(1,12))){k=23;break e}i[r>>2]=o,l=o+4|0,u=o,r=m}while(0);if(i[u>>2]=s,i[l>>2]=s,u=t+(T<<5)|0,f=0|i[s>>2]){for(a[(p=t+(T<<5)+8|0)>>3]=17976931348623157e292,a[(m=t+(T<<5)+24|0)>>3]=17976931348623157e292,a[u>>3]=-17976931348623157e292,a[(g=t+(T<<5)+16|0)>>3]=-17976931348623157e292,_=17976931348623157e292,w=-17976931348623157e292,l=0,v=f,d=17976931348623157e292,x=17976931348623157e292,b=-17976931348623157e292,h=-17976931348623157e292;c=+a[v>>3],E=+a[v+8>>3],v=0|i[v+16>>2],S=+a[((y=0==(0|v))?f:v)+8>>3],c>3]=c,d=c),E>3]=E,x=E),c>b?a[u>>3]=c:c=b,E>h&&(a[g>>3]=E,h=E),_=E>0&E<_?E:_,w=E<0&E>w?E:w,l|=+A(+(E-S))>3.141592653589793,!y;)b=c;l&&(a[g>>3]=w,a[m>>3]=_)}else i[u>>2]=0,i[u+4>>2]=0,i[u+8>>2]=0,i[u+12>>2]=0,i[u+16>>2]=0,i[u+20>>2]=0,i[u+24>>2]=0,i[u+28>>2]=0;l=T+1|0}if(s=0|i[(D=s+8|0)>>2],i[D>>2]=0,!s){k=45;break}T=l,m=r}if(21==(0|k))M(22624,22646,35,22658);else if(23==(0|k))M(22678,22646,37,22658);else if(27==(0|k))M(22721,22646,61,22744);else if(45==(0|k)){e:do{if((0|I)>0){for(D=0==(0|l),R=l<<2,q=0==(0|e),P=0,r=0;;){if(C=0|i[n+(P<<2)>>2],D)k=73;else{if(!(T=0|gt(R))){k=50;break}if(!(L=0|gt(R))){k=52;break}t:do{if(q)o=0;else{for(l=0,o=0,u=e;s=t+(l<<5)|0,0|Ke(0|i[u>>2],s,0|i[C>>2])?(i[T+(o<<2)>>2]=u,i[L+(o<<2)>>2]=s,y=o+1|0):y=o,u=0|i[u+8>>2];)l=l+1|0,o=y;if((0|y)>0)if(s=0|i[T>>2],1==(0|y))o=s;else for(g=0,v=-1,o=s,m=s;;){for(f=0|i[m>>2],s=0,u=0;p=(0|(l=0|i[i[T+(u<<2)>>2]>>2]))==(0|f)?s:s+(1&(0|Ke(l,0|i[L+(u<<2)>>2],0|i[f>>2])))|0,(0|(u=u+1|0))!=(0|y);)s=p;if(o=(l=(0|p)>(0|v))?m:o,(0|(s=g+1|0))==(0|y))break t;g=s,v=l?p:v,m=0|i[T+(s<<2)>>2]}else o=0}}while(0);if(vt(T),vt(L),o){if(s=0|i[(l=o+4|0)>>2])o=s+8|0;else if(0|i[o>>2]){k=70;break}i[o>>2]=C,i[l>>2]=C}else k=73}if(73==(0|k)){if(k=0,0|(r=0|i[C>>2]))do{L=r,r=0|i[r+16>>2],vt(L)}while(0!=(0|r));vt(C),r=2}if((0|(P=P+1|0))>=(0|I)){B=r;break e}}50==(0|k)?M(22863,22646,249,22882):52==(0|k)?M(22901,22646,252,22882):70==(0|k)&&M(22721,22646,61,22744)}else B=0}while(0);return vt(n),vt(t),0|(k=B)}return 0}function Ke(e,t,n){e|=0;var r,o=0,s=0,A=0,l=0,c=0,u=0,h=0;if(!(0|V(t|=0,n|=0)))return 0|(e=0);if(t=0|G(t),r=+a[n>>3],o=t&(o=+a[n+8>>3])<0?o+6.283185307179586:o,!(e=0|i[e>>2]))return 0|(e=0);if(t){t=0,n=e;e:for(;;){for(;l=+a[n>>3],u=+a[n+8>>3],h=0|i[(n=n+16|0)>>2],A=+a[(h=0==(0|h)?e:h)>>3],s=+a[h+8>>3],l>A?(c=l,l=u):(c=A,A=l,l=s,s=u),rc;)if(!(n=0|i[n>>2])){n=22;break e}if(o=(l=l<0?l+6.283185307179586:l)==o|(u=s<0?s+6.283185307179586:s)==o?o+-2220446049250313e-31:o,((u+=(r-A)/(c-A)*(l-u))<0?u+6.283185307179586:u)>o&&(t^=1),!(n=0|i[n>>2])){n=22;break}}if(22==(0|n))return 0|t}else{t=0,n=e;e:for(;;){for(;l=+a[n>>3],u=+a[n+8>>3],h=0|i[(n=n+16|0)>>2],A=+a[(h=0==(0|h)?e:h)>>3],s=+a[h+8>>3],l>A?(c=l,l=u):(c=A,A=l,l=s,s=u),rc;)if(!(n=0|i[n>>2])){n=22;break e}if(s+(r-A)/(c-A)*(l-s)>(o=l==o|s==o?o+-2220446049250313e-31:o)&&(t^=1),!(n=0|i[n>>2])){n=22;break}}if(22==(0|n))return 0|t}return 0}function $e(e,t,n,a,o){n|=0,a|=0,o|=0;var s,A,l,c,u=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,x=0;if(c=P,P=P+32|0,x=c+16|0,l=c,u=0|Mt(0|(e|=0),0|(t|=0),52),w(),u&=15,g=0|Mt(0|n,0|a,52),w(),(0|u)!=(15&g|0))return P=c,0|(x=1);if(p=0|Mt(0|e,0|t,45),w(),p&=127,m=0|Mt(0|n,0|a,45),w(),g=(0|p)!=(0|(m&=127))){if(7==(0|(d=0|H(p,m))))return P=c,0|(x=2);7==(0|(f=0|H(m,p)))?M(22925,22949,151,22959):(v=d,h=f)}else v=0,h=0;s=0|k(p),A=0|k(m),i[x>>2]=0,i[x+4>>2]=0,i[x+8>>2]=0,i[x+12>>2]=0;do{if(v){if(d=(0|(m=0|i[4304+(28*p|0)+(v<<2)>>2]))>0,A)if(d){p=0,f=n,d=a;do{f=0|Ne(f,d),d=0|w(),1==(0|(h=0|le(h)))&&(h=0|le(1)),p=p+1|0}while((0|p)!=(0|m));m=h,p=f,f=d}else m=h,p=n,f=a;else if(d){p=0,f=n,d=a;do{f=0|ze(f,d),d=0|w(),h=0|le(h),p=p+1|0}while((0|p)!=(0|m));m=h,p=f,f=d}else m=h,p=n,f=a;if(He(p,f,x),g||M(22972,22949,181,22959),(d=0!=(0|s))&(h=0!=(0|A))&&M(22999,22949,182,22959),d){if(h=0|Be(e,t),0|r[22032+(7*h|0)+v>>0]){u=3;break}p=f=0|i[21200+(28*h|0)+(v<<2)>>2],y=26}else if(h){if(h=0|Be(p,f),0|r[22032+(7*h|0)+m>>0]){u=4;break}p=0,f=0|i[21200+(28*m|0)+(h<<2)>>2],y=26}else h=0;if(26==(0|y))if((0|f)<=-1&&M(23030,22949,212,22959),(0|p)<=-1&&M(23053,22949,213,22959),(0|f)>0){d=x+4|0,h=0;do{se(d),h=h+1|0}while((0|h)!=(0|f));h=p}else h=p;if(i[l>>2]=0,i[l+4>>2]=0,i[l+8>>2]=0,ae(l,v),0|u)for(;0|Fe(u)?re(l):ie(l),(0|u)>1;)u=u+-1|0;if((0|h)>0){u=0;do{se(l),u=u+1|0}while((0|u)!=(0|h))}J(y=x+4|0,l,y),X(y),y=50}else if(He(n,a,x),0!=(0|s)&0!=(0|A))if((0|m)!=(0|p)&&M(23077,22949,243,22959),h=0|Be(e,t),u=0|Be(n,a),0|r[22032+(7*h|0)+u>>0])u=5;else if((0|(h=0|i[21200+(28*h|0)+(u<<2)>>2]))>0){d=x+4|0,u=0;do{se(d),u=u+1|0}while((0|u)!=(0|h));y=50}else y=50;else y=50}while(0);return 50==(0|y)&&(u=x+4|0,i[o>>2]=i[u>>2],i[o+4>>2]=i[u+4>>2],i[o+8>>2]=i[u+8>>2],u=0),P=c,0|(x=u)}function et(e,t,n,r){n|=0,r|=0;var a,o,s=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0;if(o=P,P=P+48|0,l=o+36|0,c=o+24|0,u=o+12|0,h=o,A=0|Mt(0|(e|=0),0|(t|=0),52),w(),A&=15,f=0|Mt(0|e,0|t,45),w(),a=0|k(f&=127),St(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|U(f,0|ee(n))))?(P=o,0|(g=1)):(p=0|St(0|s,0,45),m=0|w(),m=-1040385&i[(f=r)+4>>2]|m,i[(g=r)>>2]=i[f>>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[c>>2]=i[l>>2],i[c+4>>2]=i[l+4>>2],i[c+8>>2]=i[l+8>>2],0|Fe(A)?(te(l),i[u>>2]=i[l>>2],i[u+4>>2]=i[l+4>>2],i[u+8>>2]=i[l+8>>2],re(u)):(ne(l),i[u>>2]=i[l>>2],i[u+4>>2]=i[l+4>>2],i[u+8>>2]=i[l+8>>2],ie(u)),K(c,u,h),X(h),v=0|i[(m=r)>>2],m=0|i[m+4>>2],n=0|St(7,0,0|(y=3*(15-A|0)|0)),m&=~(0|w()),y=0|St(0|ee(h),0,0|y),m=0|w()|m,i[(g=r)>>2]=y|v&~n,i[g+4>>2]=m,(0|A)>1;)A=A+-1|0;e:do{if((0|i[l>>2])<=1&&(0|i[l+4>>2])<=1&&(0|i[l+8>>2])<=1){h=127==(0|(c=0|U(f,A=0|ee(l))))?0:0|k(c);t:do{if(A){if(a){if(l=21408+(28*(0|Be(e,t))|0)+(A<<2)|0,(0|(l=0|i[l>>2]))>0){n=0;do{A=0|Ae(A),n=n+1|0}while((0|n)!=(0|l))}if(1==(0|A)){s=3;break e}127==(0|(n=0|U(f,A)))&&M(23104,22949,376,23134),0|k(n)?M(23147,22949,377,23134):(p=l,d=A,s=n)}else p=0,d=A,s=c;if((0|(u=0|i[4304+(28*f|0)+(d<<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|Oe(n,l),l=0|w(),i[(y=r)>>2]=n,i[y+4>>2]=l,A=A+1|0}while((0|A)<(0|p))}if((0|u)<=0){A=54;break}for(A=0,n=0|i[(l=r)>>2],l=0|i[l+4>>2];;)if(n=0|Oe(n,l),l=0|w(),i[(y=r)>>2]=n,i[y+4>>2]=l,(0|(A=A+1|0))==(0|u)){A=54;break t}}if(7==(0|(c=0|H(s,f)))&&M(22925,22949,393,23134),n=0|i[(A=r)>>2],A=0|i[A+4>>2],(0|u)>0){l=0;do{n=0|Oe(n,A),A=0|w(),i[(y=r)>>2]=n,i[y+4>>2]=A,l=l+1|0}while((0|l)!=(0|u))}if(n=0|Be(n,A),y=0|O(s),(0|(n=0|i[(y?21824:21616)+(28*c|0)+(n<<2)>>2]))<=-1&&M(23030,22949,412,23134),n){A=0,l=0|i[(c=r)>>2],c=0|i[c+4>>2];do{l=0|ke(l,c),c=0|w(),i[(y=r)>>2]=l,i[y+4>>2]=c,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*(y=0|Be(e,t))|0)+((0|Be(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|Oe(n,l),l=0|w(),i[(y=r)>>2]=n,i[y+4>>2]=l,s=s+1|0}while((0|s)<(0|A));s=c,A=54}else s=c,A=55;else s=c,A=54}while(0);if(54==(0|A)&&h&&(A=55),55==(0|A)&&1==(0|Be(0|i[(y=r)>>2],0|i[y+4>>2]))){s=4;break}g=0|i[(y=r)>>2],y=-1040385&i[y+4>>2],v=0|St(0|s,0,45),y=0|y|w(),i[(s=r)>>2]=g|v,i[s+4>>2]=y,s=0}else s=2}while(0);return P=o,0|(y=s)}function tt(e,t){var n=0;if(!(t|=0))return 0|(n=1);n=e|=0,e=1;do{e=0|y(0==(1&t|0)?1:n,e),t>>=1,n=0|y(n,n)}while(0!=(0|t));return 0|e}function nt(e,t,n){e|=0;var r,o,s=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0;if(!(0|V(t|=0,n|=0)))return 0|(f=0);if(t=0|G(t),o=+a[n>>3],s=t&(s=+a[n+8>>3])<0?s+6.283185307179586:s,(0|(f=0|i[e>>2]))<=0)return 0|(f=0);if(r=0|i[e+4>>2],t){t=0,n=-1,e=0;e:for(;;){for(d=e;c=+a[r+(d<<4)>>3],h=+a[r+(d<<4)+8>>3],l=+a[r+((e=(n+2|0)%(0|f)|0)<<4)>>3],A=+a[r+(e<<4)+8>>3],c>l?(u=c,c=h):(u=l,l=c,c=A,A=h),ou;){if(!((0|(n=d+1|0))<(0|f))){n=22;break e}e=d,d=n,n=e}if(s=(c=c<0?c+6.283185307179586:c)==s|(h=A<0?A+6.283185307179586:A)==s?s+-2220446049250313e-31:s,((h+=(o-l)/(u-l)*(c-h))<0?h+6.283185307179586:h)>s&&(t^=1),(0|(e=d+1|0))>=(0|f)){n=22;break}n=d}if(22==(0|n))return 0|t}else{t=0,n=-1,e=0;e:for(;;){for(d=e;c=+a[r+(d<<4)>>3],h=+a[r+(d<<4)+8>>3],l=+a[r+((e=(n+2|0)%(0|f)|0)<<4)>>3],A=+a[r+(e<<4)+8>>3],c>l?(u=c,c=h):(u=l,l=c,c=A,A=h),ou;){if(!((0|(n=d+1|0))<(0|f))){n=22;break e}e=d,d=n,n=e}if(A+(o-l)/(u-l)*(c-A)>(s=c==s|A==s?s+-2220446049250313e-31:s)&&(t^=1),(0|(e=d+1|0))>=(0|f)){n=22;break}n=d}if(22==(0|n))return 0|t}return 0}function rt(e,t){t|=0;var n,r,o,s,l,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,x=0,b=0;if(!(r=0|i[(e|=0)>>2]))return i[t>>2]=0,i[t+4>>2]=0,i[t+8>>2]=0,i[t+12>>2]=0,i[t+16>>2]=0,i[t+20>>2]=0,i[t+24>>2]=0,void(i[t+28>>2]=0);if(a[(o=t+8|0)>>3]=17976931348623157e292,a[(s=t+24|0)>>3]=17976931348623157e292,a[t>>3]=-17976931348623157e292,a[(l=t+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(n=0|i[e+4>>2],g=17976931348623157e292,v=-17976931348623157e292,y=0,e=-1,d=17976931348623157e292,f=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,x=0;c=+a[n+(x<<4)>>3],p=+a[n+(x<<4)+8>>3],h=+a[n+(((0|(e=e+2|0))==(0|r)?0:e)<<4)+8>>3],c>3]=c,d=c),p>3]=p,f=p),c>m?a[t>>3]=c:c=m,p>u&&(a[l>>3]=p,u=p),g=p>0&pv?p:v,y|=+A(+(p-h))>3.141592653589793,(0|(e=x+1|0))!=(0|r);)b=x,m=c,x=e,e=b;y&&(a[l>>3]=v,a[s>>3]=g)}}function it(e,t){t|=0;var n,r=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,x=0,b=0,_=0,w=0,M=0,S=0,E=0;if(v=0|i[(e|=0)>>2]){if(a[(y=t+8|0)>>3]=17976931348623157e292,a[(x=t+24|0)>>3]=17976931348623157e292,a[t>>3]=-17976931348623157e292,a[(b=t+16|0)>>3]=-17976931348623157e292,(0|v)>0){for(s=0|i[e+4>>2],m=17976931348623157e292,g=-17976931348623157e292,o=0,r=-1,h=17976931348623157e292,d=17976931348623157e292,p=-17976931348623157e292,c=-17976931348623157e292,_=0;l=+a[s+(_<<4)>>3],f=+a[s+(_<<4)+8>>3],u=+a[s+(((0|(S=r+2|0))==(0|v)?0:S)<<4)+8>>3],l>3]=l,h=l),f>3]=f,d=f),l>p?a[t>>3]=l:l=p,f>c&&(a[b>>3]=f,c=f),m=f>0&fg?f:g,o|=+A(+(f-u))>3.141592653589793,(0|(r=_+1|0))!=(0|v);)S=_,p=l,_=r,r=S;o&&(a[b>>3]=g,a[x>>3]=m)}}else i[t>>2]=0,i[t+4>>2]=0,i[t+8>>2]=0,i[t+12>>2]=0,i[t+16>>2]=0,i[t+20>>2]=0,i[t+24>>2]=0,i[t+28>>2]=0;if(!((0|(r=0|i[(S=e+8|0)>>2]))<=0)){n=e+12|0,M=0;do{if(s=0|i[n>>2],o=M,x=t+((M=M+1|0)<<5)|0,b=0|i[s+(o<<3)>>2]){if(a[(_=t+(M<<5)+8|0)>>3]=17976931348623157e292,a[(e=t+(M<<5)+24|0)>>3]=17976931348623157e292,a[x>>3]=-17976931348623157e292,a[(w=t+(M<<5)+16|0)>>3]=-17976931348623157e292,(0|b)>0){for(v=0|i[s+(o<<3)+4>>2],m=17976931348623157e292,g=-17976931348623157e292,s=0,o=-1,y=0,h=17976931348623157e292,d=17976931348623157e292,f=-17976931348623157e292,c=-17976931348623157e292;l=+a[v+(y<<4)>>3],p=+a[v+(y<<4)+8>>3],u=+a[v+(((0|(o=o+2|0))==(0|b)?0:o)<<4)+8>>3],l>3]=l,h=l),p>3]=p,d=p),l>f?a[x>>3]=l:l=f,p>c&&(a[w>>3]=p,c=p),m=p>0&pg?p:g,s|=+A(+(p-u))>3.141592653589793,(0|(o=y+1|0))!=(0|b);)E=y,y=o,f=l,o=E;s&&(a[w>>3]=g,a[e>>3]=m)}}else i[x>>2]=0,i[x+4>>2]=0,i[x+8>>2]=0,i[x+12>>2]=0,i[x+16>>2]=0,i[x+20>>2]=0,i[x+24>>2]=0,i[x+28>>2]=0,r=0|i[S>>2]}while((0|M)<(0|r))}}function at(e,t,n){var r=0,a=0,o=0;if(!(0|nt(e|=0,t|=0,n|=0)))return 0|(a=0);if((0|i[(a=e+8|0)>>2])<=0)return 0|(a=1);for(r=e+12|0,e=0;;){if(o=e,e=e+1|0,0|nt((0|i[r>>2])+(o<<3)|0,t+(e<<5)|0,n)){e=0,r=6;break}if((0|e)>=(0|i[a>>2])){e=1,r=6;break}}return 6==(0|r)?0|e:0}function ot(e,t,n,r,i){t|=0,n|=0,r|=0,i|=0;var o,s,A,l,c,u,h,d=0;l=+a[(e|=0)>>3],A=+a[t>>3]-l,s=+a[e+8>>3],o=+a[t+8>>3]-s,u=+a[n>>3],d=((d=+a[r>>3]-u)*(s-(h=+a[n+8>>3]))-(l-u)*(c=+a[r+8>>3]-h))/(A*c-o*d),a[i>>3]=l+A*d,a[i+8>>3]=s+o*d}function st(e,t){return t|=0,+a[(e|=0)>>3]!=+a[t>>3]?0|(t=0):0|(t=+a[e+8>>3]==+a[t+8>>3])}function At(e,t){t|=0;var n,r,i;return+((i=+a[(e|=0)>>3]-+a[t>>3])*i+(r=+a[e+8>>3]-+a[t+8>>3])*r+(n=+a[e+16>>3]-+a[t+16>>3])*n)}function lt(e,t,n){e|=0,n|=0;var r=0;(0|(t|=0))>0?(r=0|yt(t,4),i[e>>2]=r,r||M(23230,23253,40,23267)):i[e>>2]=0,i[e+4>>2]=t,i[e+8>>2]=0,i[e+12>>2]=n}function ct(e){var t,n,r,o=0,s=0,l=0,u=0;t=(e|=0)+4|0,n=e+12|0,r=e+8|0;e:for(;;){for(s=0|i[t>>2],o=0;;){if((0|o)>=(0|s))break e;if(l=0|i[e>>2],u=0|i[l+(o<<2)>>2])break;o=o+1|0}o=l+(~~(+A(+ +c(10,+ +(15-(0|i[n>>2])|0))*(+a[u>>3]+ +a[u+8>>3]))%+(0|s))>>>0<<2)|0,s=0|i[o>>2];t:do{if(0|s){if(l=u+32|0,(0|s)==(0|u))i[o>>2]=i[l>>2];else{if(!(o=0|i[(s=s+32|0)>>2]))break;for(;(0|o)!=(0|u);)if(!(o=0|i[(s=o+32|0)>>2]))break t;i[s>>2]=i[l>>2]}vt(u),i[r>>2]=(0|i[r>>2])-1}}while(0)}vt(0|i[e>>2])}function ut(e){var t,n=0,r=0;for(t=0|i[(e|=0)+4>>2],r=0;;){if((0|r)>=(0|t)){n=0,r=4;break}if(n=0|i[(0|i[e>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|n:0}function ht(e,t){t|=0;var n=0,r=0,o=0,s=0;if(n=~~(+A(+ +c(10,+ +(15-(0|i[(e|=0)+12>>2])|0))*(+a[t>>3]+ +a[t+8>>3]))%+(0|i[e+4>>2]))>>>0,n=(0|i[e>>2])+(n<<2)|0,!(r=0|i[n>>2]))return 0|(s=1);s=t+32|0;do{if((0|r)!=(0|t)){if(!(n=0|i[r+32>>2]))return 0|(s=1);for(o=n;;){if((0|o)==(0|t)){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 vt(t),i[(s=e+8|0)>>2]=(0|i[s>>2])-1,0|(s=0)}function dt(e,t,n){e|=0,t|=0,n|=0;var r,o=0,s=0,l=0;(r=0|gt(40))||M(23283,23253,98,23296),i[r>>2]=i[t>>2],i[r+4>>2]=i[t+4>>2],i[r+8>>2]=i[t+8>>2],i[r+12>>2]=i[t+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(+ +c(10,+ +(15-(0|i[e+12>>2])|0))*(+a[t>>3]+ +a[t+8>>3]))%+(0|i[e+4>>2]))>>>0,s=(0|i[e>>2])+(s<<2)|0,o=0|i[s>>2];do{if(o){for(;!(0|Te(o,t)&&0|Te(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 vt(r),0|(l=o)}i[s>>2]=r}while(0);return i[(l=e+8|0)>>2]=1+(0|i[l>>2]),0|(l=r)}function ft(e,t,n){t|=0,n|=0;var r=0,o=0;if(o=~~(+A(+ +c(10,+ +(15-(0|i[(e|=0)+12>>2])|0))*(+a[t>>3]+ +a[t+8>>3]))%+(0|i[e+4>>2]))>>>0,!(o=0|i[(0|i[e>>2])+(o<<2)>>2]))return 0|(n=0);if(!n){for(e=o;;){if(0|Te(e,t)){r=10;break}if(!(e=0|i[e+32>>2])){e=0,r=10;break}}if(10==(0|r))return 0|e}for(e=o;;){if(0|Te(e,t)&&0|Te(e+16|0,n)){r=10;break}if(!(e=0|i[e+32>>2])){e=0,r=10;break}}return 10==(0|r)?0|e:0}function pt(e,t){t|=0;var n=0;if(n=~~(+A(+ +c(10,+ +(15-(0|i[(e|=0)+12>>2])|0))*(+a[t>>3]+ +a[t+8>>3]))%+(0|i[e+4>>2]))>>>0,!(e=0|i[(0|i[e>>2])+(n<<2)>>2]))return 0|(n=0);for(;;){if(0|Te(e,t)){t=5;break}if(!(e=0|i[e+32>>2])){e=0,t=5;break}}return 5==(0|t)?0|e:0}function mt(e){return 0|~~+function(e){return+ +Pt(+(e=+e))}(e=+e)}function gt(e){e|=0;var t,n=0,r=0,a=0,o=0,s=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,x=0,b=0,_=0;t=P,P=P+16|0,f=t;do{if(e>>>0<245){if(e=(u=e>>>0<11?16:e+11&-8)>>>3,3&(r=(d=0|i[5829])>>>e)|0)return a=0|i[(r=(e=23356+((n=(1&r^1)+e|0)<<1<<2)|0)+8|0)>>2],(0|(s=0|i[(o=a+8|0)>>2]))==(0|e)?i[5829]=d&~(1<>2]=e,i[r>>2]=s),_=n<<3,i[a+4>>2]=3|_,i[(_=a+_+4|0)>>2]=1|i[_>>2],P=t,0|(_=o);if(u>>>0>(h=0|i[5831])>>>0){if(0|r)return n=((n=r<>>=l=n>>>12&16)>>>5&8)|l|(s=(n>>>=r)>>>2&4)|(e=(n>>>=s)>>>1&2)|(a=(n>>>=e)>>>1&1))+(n>>>a)|0)<<1<<2)|0)+8|0)>>2],(0|(r=0|i[(l=s+8|0)>>2]))==(0|n)?(e=d&~(1<>2]=n,i[e>>2]=r,e=d),A=(_=a<<3)-u|0,i[s+4>>2]=3|u,i[(o=s+u|0)+4>>2]=1|A,i[s+_>>2]=A,0|h&&(a=0|i[5834],r=23356+((n=h>>>3)<<1<<2)|0,e&(n=1<>2]:(i[5829]=e|n,n=r,e=r+8|0),i[e>>2]=a,i[n+12>>2]=a,i[a+8>>2]=n,i[a+12>>2]=r),i[5831]=A,i[5834]=o,P=t,0|(_=l);if(s=0|i[5830]){for(r=(s&0-s)-1|0,r=c=0|i[23620+(((a=(r>>>=o=r>>>12&16)>>>5&8)|o|(A=(r>>>=a)>>>2&4)|(l=(r>>>=A)>>>1&2)|(c=(r>>>=l)>>>1&1))+(r>>>c)<<2)>>2],l=c,c=(-8&i[c+4>>2])-u|0;(e=0|i[r+16>>2])||(e=0|i[r+20>>2]);)r=e,l=(o=(A=(-8&i[e+4>>2])-u|0)>>>0>>0)?e:l,c=o?A:c;if((A=l+u|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[(e=l+20|0)>>2])&&!(n=0|i[(e=l+16|0)>>2])){r=0;break}for(;;)if(r=0|i[(a=n+20|0)>>2])n=r,e=a;else{if(!(r=0|i[(a=n+16|0)>>2]))break;n=r,e=a}i[e>>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[(e=23620+(n<<2)|0)>>2])){if(i[e>>2]=r,!r){i[5830]=s&~(1<>2])==(0|l)?_: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 c>>>0<16?(_=c+u|0,i[l+4>>2]=3|_,i[(_=l+_+4|0)>>2]=1|i[_>>2]):(i[l+4>>2]=3|u,i[A+4>>2]=1|c,i[A+c>>2]=c,0|h&&(a=0|i[5834],r=23356+((n=h>>>3)<<1<<2)|0,(n=1<>2]:(i[5829]=n|d,n=r,e=r+8|0),i[e>>2]=a,i[n+12>>2]=a,i[a+8>>2]=n,i[a+12>>2]=r),i[5831]=c,i[5834]=A),P=t,0|(_=l+8|0)}d=u}else d=u}else d=u}else if(e>>>0<=4294967231)if(u=-8&(e=e+11|0),a=0|i[5830]){o=0-u|0,c=(e>>>=8)?u>>>0>16777215?31:u>>>((c=14-((l=((g=e<<(d=(e+1048320|0)>>>16&8))+520192|0)>>>16&4)|d|(c=((g<<=l)+245760|0)>>>16&2))+(g<>>15)|0)+7|0)&1|c<<1:0,r=0|i[23620+(c<<2)>>2];e:do{if(r)for(e=0,l=u<<(31==(0|c)?0:25-(c>>>1)|0),s=0;;){if((A=(-8&i[r+4>>2])-u|0)>>>0>>0){if(!A){e=r,o=0,g=65;break e}e=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,e=0,g=61}while(0);if(61==(0|g)){if(0==(0|r)&0==(0|e)){if(!(e=((e=2<>>=A=d>>>12&16)>>>5&8)|A|(l=(d>>>=s)>>>2&4)|(c=(d>>>=l)>>>1&2)|(r=(d>>>=c)>>>1&1))+(d>>>r)<<2)>>2]}r?g=65:(l=e,A=o)}if(65==(0|g))for(s=r;;){if(o=(r=(d=(-8&i[s+4>>2])-u|0)>>>0>>0)?d:o,e=r?s:e,(r=0|i[s+16>>2])||(r=0|i[s+20>>2]),!r){l=e,A=o;break}s=r}if(0!=(0|l)&&A>>>0<((0|i[5831])-u|0)>>>0&&(h=l+u|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[(e=l+20|0)>>2])&&!(n=0|i[(e=l+16|0)>>2])){n=0;break}for(;;)if(r=0|i[(o=n+20|0)>>2])n=r,e=o;else{if(!(r=0|i[(o=n+16|0)>>2]))break;n=r,e=o}i[e>>2]=0}else _=0|i[l+8>>2],i[_+12>>2]=n,i[n+8>>2]=_}while(0);do{if(s){if(e=0|i[l+28>>2],(0|l)==(0|i[(r=23620+(e<<2)|0)>>2])){if(i[r>>2]=n,!n){a&=~(1<>2])==(0|l)?_:s+20|0)>>2]=n,!n)break;i[n+24>>2]=s,0|(e=0|i[l+16>>2])&&(i[n+16>>2]=e,i[e+24>>2]=n),(e=0|i[l+20>>2])&&(i[n+20>>2]=e,i[e+24>>2]=n)}}while(0);e:do{if(A>>>0<16)_=A+u|0,i[l+4>>2]=3|_,i[(_=l+_+4|0)>>2]=1|i[_>>2];else{if(i[l+4>>2]=3|u,i[h+4>>2]=1|A,i[h+A>>2]=A,n=A>>>3,A>>>0<256){r=23356+(n<<1<<2)|0,(e=0|i[5829])&(n=1<>2]:(i[5829]=e|n,n=r,e=r+8|0),i[e>>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-((x=((_=n<<(b=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|b|(r=((_<<=x)+245760|0)>>>16&2))+(_<>>15)|0)+7|0)&1|r<<1:0)<<2)|0,i[h+28>>2]=r,i[(e=h+16|0)+4>>2]=0,i[e>>2]=0,!(a&(e=1<>2]=h,i[h+24>>2]=n,i[h+12>>2]=h,i[h+8>>2]=h;break}n=0|i[n>>2];t:do{if((-8&i[n+4>>2]|0)!=(0|A)){for(a=A<<(31==(0|r)?0:25-(r>>>1)|0);e=0|i[(r=n+16+(a>>>31<<2)|0)>>2];){if((-8&i[e+4>>2]|0)==(0|A)){n=e;break t}a<<=1,n=e}i[r>>2]=h,i[h+24>>2]=n,i[h+12>>2]=h,i[h+8>>2]=h;break e}}while(0);_=0|i[(b=n+8|0)>>2],i[_+12>>2]=h,i[b>>2]=h,i[h+8>>2]=_,i[h+12>>2]=n,i[h+24>>2]=0}}while(0);return P=t,0|(_=l+8|0)}d=u}else d=u;else d=-1}while(0);if((r=0|i[5831])>>>0>=d>>>0)return n=r-d|0,e=0|i[5834],n>>>0>15?(_=e+d|0,i[5834]=_,i[5831]=n,i[_+4>>2]=1|n,i[e+r>>2]=n,i[e+4>>2]=3|d):(i[5831]=0,i[5834]=0,i[e+4>>2]=3|r,i[(_=e+r+4|0)>>2]=1|i[_>>2]),P=t,0|(_=e+8|0);if((A=0|i[5832])>>>0>d>>>0)return x=A-d|0,i[5832]=x,b=(_=0|i[5835])+d|0,i[5835]=b,i[b+4>>2]=1|x,i[_+4>>2]=3|d,P=t,0|(_=_+8|0);if(0|i[5947]?e=0|i[5949]:(i[5949]=4096,i[5948]=4096,i[5950]=-1,i[5951]=-1,i[5952]=0,i[5940]=0,i[5947]=-16&f^1431655768,e=4096),l=d+48|0,(u=(s=e+(c=d+47|0)|0)&(o=0-e|0))>>>0<=d>>>0)return P=t,0|(_=0);if(0|(e=0|i[5939])&&(f=(h=0|i[5937])+u|0)>>>0<=h>>>0|f>>>0>e>>>0)return P=t,0|(_=0);e:do{if(4&i[5940])n=0,g=143;else{r=0|i[5835];t:do{if(r){for(a=23764;!((f=0|i[a>>2])>>>0<=r>>>0&&(f+(0|i[a+4>>2])|0)>>>0>r>>>0);){if(!(e=0|i[a+8>>2])){g=128;break t}a=e}if((n=s-A&o)>>>0<2147483647)if((0|(e=0|Rt(0|n)))==((0|i[a>>2])+(0|i[a+4>>2])|0)){if(-1!=(0|e)){A=n,s=e,g=145;break e}}else a=e,g=136;else n=0}else g=128}while(0);do{if(128==(0|g))if(-1!=(0|(r=0|Rt(0)))&&(n=r,m=(n=(0==((m=(p=0|i[5948])+-1|0)&n|0)?0:(m+n&0-p)-n|0)+u|0)+(p=0|i[5937])|0,n>>>0>d>>>0&n>>>0<2147483647)){if(0|(f=0|i[5939])&&m>>>0<=p>>>0|m>>>0>f>>>0){n=0;break}if((0|(e=0|Rt(0|n)))==(0|r)){A=n,s=r,g=145;break e}a=e,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 e}if((e=c-n+(e=0|i[5949])&0-e)>>>0>=2147483647){A=n,s=a,g=145;break e}if(-1==(0|Rt(0|e))){Rt(0|r),n=0;break}A=e+n|0,s=a,g=145;break e}}while(0);i[5940]=4|i[5940],g=143}}while(0);if(143==(0|g)&&u>>>0<2147483647&&!(-1==(0|(x=0|Rt(0|u)))|1^(y=(v=(m=0|Rt(0))-x|0)>>>0>(d+40|0)>>>0)|x>>>0>>0&-1!=(0|x)&-1!=(0|m)^1)&&(A=y?v:n,s=x,g=145),145==(0|g)){n=(0|i[5937])+A|0,i[5937]=n,n>>>0>(0|i[5938])>>>0&&(i[5938]=n),c=0|i[5835];e:do{if(c){for(n=23764;;){if((0|s)==((e=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)&&(b=n+4|0,0==(8&i[n+12>>2]|0))&&s>>>0>c>>>0&e>>>0<=c>>>0){i[b>>2]=r+A,b=c+(x=0==(7&(x=c+8|0)|0)?0:0-x&7)|0,x=(_=(0|i[5832])+A|0)-x|0,i[5835]=b,i[5832]=x,i[b+4>>2]=1|x,i[c+_+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(!(e=0|i[n+8>>2]))break;n=e}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,u=(h=s+(0==(7&(h=s+8|0)|0)?0:0-h&7)|0)+d|0,l=(n=r+(0==(7&(n=r+8|0)|0)?0:0-n&7)|0)-h-d|0,i[h+4>>2]=3|d;t:do{if((0|c)==(0|n))_=(0|i[5832])+l|0,i[5832]=_,i[5835]=u,i[u+4>>2]=1|_;else{if((0|i[5834])==(0|n)){_=(0|i[5831])+l|0,i[5831]=_,i[5834]=u,i[u+4>>2]=1|_,i[u+_>>2]=_;break}if(1==(3&(e=0|i[n+4>>2])|0)){A=-8&e,a=e>>>3;n:do{if(e>>>0<256){if(e=0|i[n+8>>2],(0|(r=0|i[n+12>>2]))==(0|e)){i[5829]=i[5829]&~(1<>2]=r,i[r+8>>2]=e;break}s=0|i[n+24>>2],e=0|i[n+12>>2];do{if((0|e)==(0|n)){if(e=0|i[(a=(r=n+16|0)+4|0)>>2])r=a;else if(!(e=0|i[r>>2])){e=0;break}for(;;)if(a=0|i[(o=e+20|0)>>2])e=a,r=o;else{if(!(a=0|i[(o=e+16|0)>>2]))break;e=a,r=o}i[r>>2]=0}else _=0|i[n+8>>2],i[_+12>>2]=e,i[e+8>>2]=_}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]=e,0|e)break;i[5830]=i[5830]&~(1<>2])==(0|n)?_:s+20|0)>>2]=e,!e)break n}while(0);if(i[e+24>>2]=s,0|(a=0|i[(r=n+16|0)>>2])&&(i[e+16>>2]=a,i[a+24>>2]=e),!(r=0|i[r+4>>2]))break;i[e+20>>2]=r,i[r+24>>2]=e}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[u+4>>2]=1|o,i[u+o>>2]=o,n=o>>>3,o>>>0<256){r=23356+(n<<1<<2)|0,(e=0|i[5829])&(n=1<>2]:(i[5829]=e|n,n=r,e=r+8|0),i[e>>2]=u,i[n+12>>2]=u,i[u+8>>2]=n,i[u+12>>2]=r;break}n=o>>>8;do{if(n){if(o>>>0>16777215){a=31;break}a=o>>>((a=14-((x=((_=n<<(b=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|b|(a=((_<<=x)+245760|0)>>>16&2))+(_<>>15)|0)+7|0)&1|a<<1}else a=0}while(0);if(n=23620+(a<<2)|0,i[u+28>>2]=a,i[(e=u+16|0)+4>>2]=0,i[e>>2]=0,!((e=0|i[5830])&(r=1<>2]=u,i[u+24>>2]=n,i[u+12>>2]=u,i[u+8>>2]=u;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);e=0|i[(r=n+16+(a>>>31<<2)|0)>>2];){if((-8&i[e+4>>2]|0)==(0|o)){n=e;break n}a<<=1,n=e}i[r>>2]=u,i[u+24>>2]=n,i[u+12>>2]=u,i[u+8>>2]=u;break t}}while(0);_=0|i[(b=n+8|0)>>2],i[_+12>>2]=u,i[b>>2]=u,i[u+8>>2]=_,i[u+12>>2]=n,i[u+24>>2]=0}}while(0);return P=t,0|(_=h+8|0)}for(n=23764;!((e=0|i[n>>2])>>>0<=c>>>0&&(_=e+(0|i[n+4>>2])|0)>>>0>c>>>0);)n=0|i[n+8>>2];n=(e=(e=(o=_+-47|0)+(0==(7&(e=o+8|0)|0)?0:0-e&7)|0)>>>0<(o=c+16|0)>>>0?c:e)+8|0,b=s+(x=0==(7&(x=s+8|0)|0)?0:0-x&7)|0,x=(r=A+-40|0)-x|0,i[5835]=b,i[5832]=x,i[b+4>>2]=1|x,i[s+r+4>>2]=40,i[5836]=i[5951],i[(r=e+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=e+24|0;do{b=n,i[(n=n+4|0)>>2]=7}while((b+8|0)>>>0<_>>>0);if((0|e)!=(0|c)){if(s=e-c|0,i[r>>2]=-2&i[r>>2],i[c+4>>2]=1|s,i[e>>2]=s,n=s>>>3,s>>>0<256){r=23356+(n<<1<<2)|0,(e=0|i[5829])&(n=1<>2]:(i[5829]=e|n,n=r,e=r+8|0),i[e>>2]=c,i[n+12>>2]=c,i[c+8>>2]=n,i[c+12>>2]=r;break}if(r=23620+((a=(n=s>>>8)?s>>>0>16777215?31:s>>>((a=14-((x=((_=n<<(b=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|b|(a=((_<<=x)+245760|0)>>>16&2))+(_<>>15)|0)+7|0)&1|a<<1:0)<<2)|0,i[c+28>>2]=a,i[c+20>>2]=0,i[o>>2]=0,!((n=0|i[5830])&(e=1<>2]=c,i[c+24>>2]=r,i[c+12>>2]=c,i[c+8>>2]=c;break}n=0|i[r>>2];t:do{if((-8&i[n+4>>2]|0)!=(0|s)){for(a=s<<(31==(0|a)?0:25-(a>>>1)|0);e=0|i[(r=n+16+(a>>>31<<2)|0)>>2];){if((-8&i[e+4>>2]|0)==(0|s)){n=e;break t}a<<=1,n=e}i[r>>2]=c,i[c+24>>2]=n,i[c+12>>2]=c,i[c+8>>2]=c;break e}}while(0);_=0|i[(b=n+8|0)>>2],i[_+12>>2]=c,i[b>>2]=c,i[c+8>>2]=_,i[c+12>>2]=n,i[c+24>>2]=0}}else 0==(0|(_=0|i[5833]))|s>>>0<_>>>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,b=s+(x=0==(7&(x=s+8|0)|0)?0:0-x&7)|0,x=(_=A+-40|0)-x|0,i[5835]=b,i[5832]=x,i[b+4>>2]=1|x,i[s+_+4>>2]=40,i[5836]=i[5951]}while(0);if((n=0|i[5832])>>>0>d>>>0)return x=n-d|0,i[5832]=x,b=(_=0|i[5835])+d|0,i[5835]=b,i[b+4>>2]=1|x,i[_+4>>2]=3|d,P=t,0|(_=_+8|0)}return i[(_=23312)>>2]=12,P=t,0|(_=0)}function vt(e){var t=0,n=0,r=0,a=0,o=0,s=0,A=0,l=0;if(e|=0){n=e+-8|0,a=0|i[5833],l=n+(t=-8&(e=0|i[e+-4>>2]))|0;do{if(1&e)A=n,s=n;else{if(r=0|i[n>>2],!(3&e))return;if(o=r+t|0,(s=n+(0-r)|0)>>>0>>0)return;if((0|i[5834])==(0|s)){if(3!=(3&(t=0|i[(e=l+4|0)>>2])|0)){A=s,t=o;break}return i[5831]=o,i[e>>2]=-2&t,i[s+4>>2]=1|o,void(i[s+o>>2]=o)}if(n=r>>>3,r>>>0<256){if(e=0|i[s+8>>2],(0|(t=0|i[s+12>>2]))==(0|e)){i[5829]=i[5829]&~(1<>2]=t,i[t+8>>2]=e,A=s,t=o;break}a=0|i[s+24>>2],e=0|i[s+12>>2];do{if((0|e)==(0|s)){if(e=0|i[(n=(t=s+16|0)+4|0)>>2])t=n;else if(!(e=0|i[t>>2])){e=0;break}for(;;)if(n=0|i[(r=e+20|0)>>2])e=n,t=r;else{if(!(n=0|i[(r=e+16|0)>>2]))break;e=n,t=r}i[t>>2]=0}else A=0|i[s+8>>2],i[A+12>>2]=e,i[e+8>>2]=A}while(0);if(a){if(t=0|i[s+28>>2],(0|i[(n=23620+(t<<2)|0)>>2])==(0|s)){if(i[n>>2]=e,!e){i[5830]=i[5830]&~(1<>2])==(0|s)?A:a+20|0)>>2]=e,!e){A=s,t=o;break}i[e+24>>2]=a,0|(n=0|i[(t=s+16|0)>>2])&&(i[e+16>>2]=n,i[n+24>>2]=e),(t=0|i[t+4>>2])?(i[e+20>>2]=t,i[t+24>>2]=e,A=s,t=o):(A=s,t=o)}else A=s,t=o}}while(0);if(!(s>>>0>=l>>>0)&&1&(r=0|i[(e=l+4|0)>>2])){if(2&r)i[e>>2]=-2&r,i[A+4>>2]=1|t,i[s+t>>2]=t,a=t;else{if((0|i[5835])==(0|l)){if(l=(0|i[5832])+t|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])+t|0,i[5831]=l,i[5834]=s,i[A+4>>2]=1|l,void(i[s+l>>2]=l);a=(-8&r)+t|0,n=r>>>3;do{if(r>>>0<256){if(t=0|i[l+8>>2],(0|(e=0|i[l+12>>2]))==(0|t)){i[5829]=i[5829]&~(1<>2]=e,i[e+8>>2]=t;break}o=0|i[l+24>>2],e=0|i[l+12>>2];do{if((0|e)==(0|l)){if(e=0|i[(n=(t=l+16|0)+4|0)>>2])t=n;else if(!(e=0|i[t>>2])){n=0;break}for(;;)if(n=0|i[(r=e+20|0)>>2])e=n,t=r;else{if(!(n=0|i[(r=e+16|0)>>2]))break;e=n,t=r}i[t>>2]=0,n=e}else n=0|i[l+8>>2],i[n+12>>2]=e,i[e+8>>2]=n,n=e}while(0);if(0|o){if(e=0|i[l+28>>2],(0|i[(t=23620+(e<<2)|0)>>2])==(0|l)){if(i[t>>2]=n,!n){i[5830]=i[5830]&~(1<>2])==(0|l)?r:o+20|0)>>2]=n,!n)break;i[n+24>>2]=o,0|(t=0|i[(e=l+16|0)>>2])&&(i[n+16>>2]=t,i[t+24>>2]=n),0|(e=0|i[e+4>>2])&&(i[n+20>>2]=e,i[e+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(e=a>>>3,a>>>0<256)return n=23356+(e<<1<<2)|0,(t=0|i[5829])&(e=1<>2]:(i[5829]=t|e,e=n,t=n+8|0),i[t>>2]=A,i[e+12>>2]=A,i[A+8>>2]=e,void(i[A+12>>2]=n);e=23620+((r=(e=a>>>8)?a>>>0>16777215?31:a>>>((r=14-((o=((l=e<<(s=(e+1048320|0)>>>16&8))+520192|0)>>>16&4)|s|(r=((l<<=o)+245760|0)>>>16&2))+(l<>>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,t=0|i[5830],n=1<>2];t:do{if((-8&i[e+4>>2]|0)!=(0|a)){for(r=a<<(31==(0|r)?0:25-(r>>>1)|0);t=0|i[(n=e+16+(r>>>31<<2)|0)>>2];){if((-8&i[t+4>>2]|0)==(0|a)){e=t;break t}r<<=1,e=t}i[n>>2]=A,i[A+24>>2]=e,i[A+12>>2]=A,i[A+8>>2]=A;break e}}while(0);l=0|i[(s=e+8|0)>>2],i[l+12>>2]=A,i[s>>2]=A,i[A+8>>2]=l,i[A+12>>2]=e,i[A+24>>2]=0}else i[5830]=t|n,i[e>>2]=A,i[A+24>>2]=e,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(e=23772;e=0|i[e>>2];)e=e+8|0;i[5837]=-1}}}}function yt(e,t){t|=0;var n=0;return(e|=0)?(n=0|y(t,e),(t|e)>>>0>65535&&(n=(0|(n>>>0)/(e>>>0))==(0|t)?n:-1)):n=0,(e=0|gt(n))&&3&i[e+-4>>2]?(Ct(0|e,0,0|n),0|e):0|e}function xt(e,t,n,r){return 0|(_(0|(r=(t|=0)-(r|=0)-((n|=0)>>>0>(e|=0)>>>0|0)>>>0)),e-n>>>0|0)}function bt(e){return 0|((e|=0)?31-(0|b(e^e-1))|0:32)}function _t(e,t,n,r,a){a|=0;var o=0,s=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0;if(u=e|=0,s=n|=0,A=d=r|=0,!(c=l=t|=0))return o=0!=(0|a),A?o?(i[a>>2]=0|e,i[a+4>>2]=0&t,a=0,0|(_(0|(d=0)),a)):(a=0,0|(_(0|(d=0)),a)):(o&&(i[a>>2]=(u>>>0)%(s>>>0),i[a+4>>2]=0),a=(u>>>0)/(s>>>0)>>>0,0|(_(0|(d=0)),a));o=0==(0|A);do{if(s){if(!o){if((o=(0|b(0|A))-(0|b(0|c))|0)>>>0<=31){s=h=o+1|0,e=u>>>(h>>>0)&(t=o-31>>31)|c<<(A=31-o|0),t&=c>>>(h>>>0),o=0,A=u<>2]=0|e,i[a+4>>2]=l|0&t,a=0,0|(_(0|(d=0)),a)):(a=0,0|(_(0|(d=0)),a))}if((o=s-1|0)&s|0){s=A=33+(0|b(0|s))-(0|b(0|c))|0,e=(h=32-A|0)-1>>31&c>>>((f=A-32|0)>>>0)|(c<>>(A>>>0))&(t=f>>31),t&=c>>>(A>>>0),o=u<<(p=64-A|0)&(l=h>>31),A=(c<>>(f>>>0))&l|u<>31;break}return 0|a&&(i[a>>2]=o&u,i[a+4>>2]=0),1==(0|s)?(p=0|e,0|(_(0|(f=l|0&t)),p)):(f=c>>>((p=0|bt(0|s))>>>0)|0,p=c<<32-p|u>>>(p>>>0)|0,0|(_(0|f),p))}if(o)return 0|a&&(i[a>>2]=(c>>>0)%(s>>>0),i[a+4>>2]=0),p=(c>>>0)/(s>>>0)>>>0,0|(_(0|(f=0)),p);if(!u)return 0|a&&(i[a>>2]=0,i[a+4>>2]=(c>>>0)%(A>>>0)),p=(c>>>0)/(A>>>0)>>>0,0|(_(0|(f=0)),p);if(!((o=A-1|0)&A))return 0|a&&(i[a>>2]=0|e,i[a+4>>2]=o&c|0&t),f=0,p=c>>>((0|bt(0|A))>>>0),0|(_(0|f),p);if((o=(0|b(0|A))-(0|b(0|c))|0)>>>0<=30){s=t=o+1|0,e=c<<(A=31-o|0)|u>>>(t>>>0),t=c>>>(t>>>0),o=0,A=u<>2]=0|e,i[a+4>>2]=l|0&t,p=0,0|(_(0|(f=0)),p)):(p=0,0|(_(0|(f=0)),p))}while(0);if(s){c=0|function(e,t,n,r){return 0|(_((t|=0)+(r|=0)+((n=(e|=0)+(n|=0)>>>0)>>>0>>0|0)>>>0|0),0|n)}(0|(h=0|n),0|(u=d|0&r),-1,-1),n=0|w(),l=A,A=0;do{r=l,l=o>>>31|l<<1,o=A|o<<1,xt(0|c,0|n,0|(r=e<<1|r>>>31|0),0|(d=e>>>31|t<<1|0)),A=1&(f=(p=0|w())>>31|((0|p)<0?-1:0)<<1),e=0|xt(0|r,0|d,f&h|0,(((0|p)<0?-1:0)>>31|((0|p)<0?-1:0)<<1)&u|0),t=0|w(),s=s-1|0}while(0!=(0|s));c=l,l=0}else c=A,l=0,A=0;return s=0,0|a&&(i[a>>2]=e,i[a+4>>2]=t),p=-2&(o<<1|0)|A,0|(_(0|(f=(0|o)>>>31|(c|s)<<1|0&(s<<1|o>>>31)|l)),p)}function wt(e,t,n,r){var a,o;return o=P,P=P+16|0,_t(e|=0,t|=0,n|=0,r|=0,a=0|o),P=o,0|(_(0|i[a+4>>2]),0|i[a>>2])}function Mt(e,t,n){return e|=0,t|=0,(0|(n|=0))<32?(_(t>>>n|0),e>>>n|(t&(1<>>n-32|0)}function St(e,t,n){return e|=0,t|=0,(0|(n|=0))<32?(_(t<>>32-n|0),e<=0?+s(e+.5):+v(e-.5)}function Lt(e,t,n){e|=0,t|=0;var a,o,s=0;if((0|(n|=0))>=8192)return T(0|e,0|t,0|n),0|e;if(o=0|e,a=e+n|0,(3&e)==(3&t)){for(;3&e;){if(!n)return 0|o;r[e>>0]=0|r[t>>0],e=e+1|0,t=t+1|0,n=n-1|0}for(s=(n=-4&a|0)-64|0;(0|e)<=(0|s);)i[e>>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],i[e+16>>2]=i[t+16>>2],i[e+20>>2]=i[t+20>>2],i[e+24>>2]=i[t+24>>2],i[e+28>>2]=i[t+28>>2],i[e+32>>2]=i[t+32>>2],i[e+36>>2]=i[t+36>>2],i[e+40>>2]=i[t+40>>2],i[e+44>>2]=i[t+44>>2],i[e+48>>2]=i[t+48>>2],i[e+52>>2]=i[t+52>>2],i[e+56>>2]=i[t+56>>2],i[e+60>>2]=i[t+60>>2],e=e+64|0,t=t+64|0;for(;(0|e)<(0|n);)i[e>>2]=i[t>>2],e=e+4|0,t=t+4|0}else for(n=a-4|0;(0|e)<(0|n);)r[e>>0]=0|r[t>>0],r[e+1>>0]=0|r[t+1>>0],r[e+2>>0]=0|r[t+2>>0],r[e+3>>0]=0|r[t+3>>0],e=e+4|0,t=t+4|0;for(;(0|e)<(0|a);)r[e>>0]=0|r[t>>0],e=e+1|0,t=t+1|0;return 0|o}function Ct(e,t,n){t|=0;var a,o=0,s=0,A=0;if(a=(e|=0)+(n|=0)|0,t&=255,(0|n)>=67){for(;3&e;)r[e>>0]=t,e=e+1|0;for(A=t|t<<8|t<<16|t<<24,s=(o=-4&a|0)-64|0;(0|e)<=(0|s);)i[e>>2]=A,i[e+4>>2]=A,i[e+8>>2]=A,i[e+12>>2]=A,i[e+16>>2]=A,i[e+20>>2]=A,i[e+24>>2]=A,i[e+28>>2]=A,i[e+32>>2]=A,i[e+36>>2]=A,i[e+40>>2]=A,i[e+44>>2]=A,i[e+48>>2]=A,i[e+52>>2]=A,i[e+56>>2]=A,i[e+60>>2]=A,e=e+64|0;for(;(0|e)<(0|o);)i[e>>2]=A,e=e+4|0}for(;(0|e)<(0|a);)r[e>>0]=t,e=e+1|0;return a-n|0}function Pt(e){return(e=+e)>=0?+s(e+.5):+v(e-.5)}function Rt(e){e|=0;var t,n,r;return r=0|E(),(0|e)>0&(0|(t=(n=0|i[o>>2])+e|0))<(0|n)|(0|t)<0?(C(0|t),S(12),-1):(0|t)>(0|r)&&!(0|L(0|t))?(S(12),-1):(i[o>>2]=t,0|n)}return{___uremdi3:wt,_bitshift64Lshr:Mt,_bitshift64Shl:St,_calloc:yt,_cellAreaKm2:function(e,t){var n,r,a,o=0;if(a=P,P=P+192|0,r=a,Ve(e|=0,t|=0,n=a+168|0),je(e,t,r),(0|(t=0|i[r>>2]))>0){if(o=+Ce(r+8|0,r+8+((1!=(0|t)&1)<<4)|0,n)+0,1!=(0|t)){e=1;do{o+=+Ce(r+8+(e<<4)|0,r+8+(((0|(e=e+1|0))%(0|t)|0)<<4)|0,n)}while((0|e)<(0|t))}}else o=0;return P=a,6371.007180918475*o*6371.007180918475},_cellAreaM2:function(e,t){var n,r,a,o=0;if(a=P,P=P+192|0,r=a,Ve(e|=0,t|=0,n=a+168|0),je(e,t,r),(0|(t=0|i[r>>2]))>0){if(o=+Ce(r+8|0,r+8+((1!=(0|t)&1)<<4)|0,n)+0,1!=(0|t)){e=1;do{o+=+Ce(r+8+(e<<4)|0,r+8+(((0|(e=e+1|0))%(0|t)|0)<<4)|0,n)}while((0|e)<(0|t))}}else o=0;return P=a,6371.007180918475*o*6371.007180918475*1e3*1e3},_cellAreaRads2:function(e,t){var n,r,a,o=0;if(a=P,P=P+192|0,r=a,Ve(e|=0,t|=0,n=a+168|0),je(e,t,r),(0|(t=0|i[r>>2]))<=0)return P=a,+(o=0);if(o=+Ce(r+8|0,r+8+((1!=(0|t)&1)<<4)|0,n)+0,1==(0|t))return P=a,+o;e=1;do{o+=+Ce(r+8+(e<<4)|0,r+8+(((0|(e=e+1|0))%(0|t)|0)<<4)|0,n)}while((0|e)<(0|t));return P=a,+o},_compact:function(e,t,n){t|=0;var r,a=0,o=0,s=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,x=0,b=0,_=0,M=0,S=0,E=0;if(!(n|=0))return 0|(S=0);if(a=0|i[(o=e|=0)>>2],!0&0==(15728640&(o=0|i[o+4>>2])|0)){if((0|n)<=0)return 0|(S=0);if(i[(S=t)>>2]=a,i[S+4>>2]=o,1==(0|n))return 0|(S=0);a=1;do{M=0|i[(_=e+(a<<3)|0)+4>>2],i[(S=t+(a<<3)|0)>>2]=i[_>>2],i[S+4>>2]=M,a=a+1|0}while((0|a)!=(0|n));return 0|(a=0)}if(!(M=0|gt(_=n<<3)))return 0|(S=-3);if(Lt(0|M,0|e,0|_),!(r=0|yt(n,8)))return vt(M),0|(S=-3);a=n;e:for(;;){x=0|Mt(0|(h=0|i[(A=M)>>2]),0|(A=0|i[A+4>>2]),52),w(),b=(x&=15)+-1|0,y=(0|a)>0;t:do{if(y){if(v=((0|a)<0)<<31>>31,m=0|St(0|b,0,52),g=0|w(),b>>>0>15)for(o=0,e=h,n=A;;){if(!(0==(0|e)&0==(0|n))){if(s=0|Mt(0|e,0|n,52),w(),l=(0|(s&=15))<(0|b),s=(0|s)==(0|b),n=0|wt(0|(u=l?0:s?e:0),0|(e=l?0:s?n:0),0|a,0|v),w(),0==(0|(c=0|i[(l=s=r+(n<<3)|0)>>2]))&0==(0|(l=0|i[l+4>>2])))n=u;else for(m=0,p=n,f=l,n=u;;){if((0|m)>(0|a)){S=41;break e}if((0|c)==(0|n)&(-117440513&f|0)==(0|e)){u=0|Mt(0|c,0|f,56),w(),d=(u&=7)+1|0,g=0|Mt(0|c,0|f,45),w();n:do{if(0|k(127&g)){if(c=0|Mt(0|c,0|f,52),w(),!(c&=15)){l=6;break}for(l=1;;){if(!(0==((g=0|St(7,0,3*(15-l|0)|0))&n|0)&0==((0|w())&e|0))){l=7;break n}if(!(l>>>0>>0)){l=6;break}l=l+1|0}}else l=7}while(0);if((u+2|0)>>>0>l>>>0){S=51;break e}g=0|St(0|d,0,56),e=0|w()|-117440513&e,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|(c=0|i[(f=s=r+(l<<3)|0)>>2]))&0==(0|(f=0|i[f+4>>2])))break;m=m+1|0,p=l}i[(g=s)>>2]=n,i[g+4>>2]=e}if((0|(o=o+1|0))>=(0|a))break t;e=0|i[(n=M+(o<<3)|0)>>2],n=0|i[n+4>>2]}for(o=0,e=h,n=A;;){if(!(0==(0|e)&0==(0|n))){if(l=0|Mt(0|e,0|n,52),w(),(0|(l&=15))>=(0|b)){if((0|l)!=(0|b)&&(e|=m,n=-15728641&n|g,l>>>0>=x>>>0)){s=b;do{p=0|St(7,0,3*(14-s|0)|0),s=s+1|0,e|=p,n=0|w()|n}while(s>>>0>>0)}}else e=0,n=0;if(l=0|wt(0|e,0|n,0|a,0|v),w(),!(0==(0|(u=0|i[(c=s=r+(l<<3)|0)>>2]))&0==(0|(c=0|i[c+4>>2]))))for(p=0;;){if((0|p)>(0|a)){S=41;break e}if((0|u)==(0|e)&(-117440513&c|0)==(0|n)){d=0|Mt(0|u,0|c,56),w(),f=(d&=7)+1|0,E=0|Mt(0|u,0|c,45),w();n:do{if(0|k(127&E)){if(u=0|Mt(0|u,0|c,52),w(),!(u&=15)){c=6;break}for(c=1;;){if(!(0==((E=0|St(7,0,3*(15-c|0)|0))&e|0)&0==((0|w())&n|0))){c=7;break n}if(!(c>>>0>>0)){c=6;break}c=c+1|0}}else c=7}while(0);if((d+2|0)>>>0>c>>>0){S=51;break e}E=0|St(0|f,0,56),n=0|w()|-117440513&n,i[(f=s)>>2]=0,i[f+4>>2]=0,e|=E}else l=(l+1|0)%(0|a)|0;if(0==(0|(u=0|i[(c=s=r+(l<<3)|0)>>2]))&0==(0|(c=0|i[c+4>>2])))break;p=p+1|0}i[(E=s)>>2]=e,i[E+4>>2]=n}if((0|(o=o+1|0))>=(0|a))break t;e=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|yt((0|a)/6|0,8))){S=58;break}t:do{if(y){p=0,f=0;do{if(!(0==(0|(o=0|i[(e=l=r+(p<<3)|0)>>2]))&0==(0|(e=0|i[e+4>>2])))){c=0|Mt(0|o,0|e,56),w(),n=(c&=7)+1|0,u=-117440513&e,E=0|Mt(0|o,0|e,45),w();n:do{if(0|k(127&E)){if(d=0|Mt(0|o,0|e,52),w(),0|(d&=15))for(s=1;;){if(!(0==(o&(E=0|St(7,0,3*(15-s|0)|0))|0)&0==(u&(0|w())|0)))break n;if(!(s>>>0>>0))break;s=s+1|0}o|=e=0|St(0|n,0,56),e=0|w()|u,i[(n=l)>>2]=o,i[n+4>>2]=e,n=c+2|0}}while(0);7==(0|n)&&(i[(E=g+(f<<3)|0)>>2]=o,i[E+4>>2]=-117440513&e,f=f+1|0)}p=p+1|0}while((0|p)!=(0|a));if(y){if(m=((0|a)<0)<<31>>31,d=0|St(0|b,0,52),p=0|w(),b>>>0>15)for(e=0,o=0;;){do{if(!(0==(0|h)&0==(0|A))){for(c=0|Mt(0|h,0|A,52),w(),s=(0|(c&=15))<(0|b),c=(0|c)==(0|b),s=0|wt(0|(l=s?0:c?h:0),0|(c=s?0:c?A:0),0|a,0|m),w(),n=0;;){if((0|n)>(0|a)){S=98;break e}if((-117440513&(u=0|i[(E=r+(s<<3)|0)+4>>2])|0)==(0|c)&&(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|c))break;n=n+1|0}if(70==(0|S)&&(S=0,!0&100663296==(117440512&u|0)))break;i[(E=t+(o<<3)|0)>>2]=h,i[E+4>>2]=A,o=o+1|0}}while(0);if((0|(e=e+1|0))>=(0|a)){a=f;break t}h=0|i[(A=M+(e<<3)|0)>>2],A=0|i[A+4>>2]}for(e=0,o=0;;){do{if(!(0==(0|h)&0==(0|A))){if(c=0|Mt(0|h,0|A,52),w(),(0|(c&=15))>=(0|b))if((0|c)!=(0|b))if(n=h|d,s=-15728641&A|p,c>>>0>>0)c=s;else{l=b;do{E=0|St(7,0,3*(14-l|0)|0),l=l+1|0,n|=E,s=0|w()|s}while(l>>>0>>0);c=s}else n=h,c=A;else n=0,c=0;for(l=0|wt(0|n,0|c,0|a,0|m),w(),s=0;;){if((0|s)>(0|a)){S=98;break e}if((-117440513&(u=0|i[(E=r+(l<<3)|0)+4>>2])|0)==(0|c)&&(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|c))break;s=s+1|0}if(93==(0|S)&&(S=0,!0&100663296==(117440512&u|0)))break;i[(E=t+(o<<3)|0)>>2]=h,i[E+4>>2]=A,o=o+1|0}}while(0);if((0|(e=e+1|0))>=(0|a)){a=f;break t}h=0|i[(A=M+(e<<3)|0)>>2],A=0|i[A+4>>2]}}else o=0,a=f}else o=0,a=0}while(0);if(Ct(0|r,0,0|_),Lt(0|M,0|g,a<<3|0),vt(g),!a)break;t=t+(o<<3)|0}return 41==(0|S)?(vt(M),vt(r),0|(E=-1)):51==(0|S)?(vt(M),vt(r),0|(E=-2)):58==(0|S)?(vt(M),vt(r),0|(E=-3)):98==(0|S)?(vt(g),vt(M),vt(r),0|(E=-1)):(99==(0|S)&&Lt(0|t,0|M,a<<3|0),vt(M),vt(r),0|(E=0))},_destroyLinkedPolygon:function(e){var t=0,n=0,r=0,a=0;if(e|=0)for(r=1;;){if(0|(t=0|i[e>>2]))do{if(0|(n=0|i[t>>2]))do{a=n,n=0|i[n+16>>2],vt(a)}while(0!=(0|n));a=t,t=0|i[t+8>>2],vt(a)}while(0!=(0|t));if(t=e,e=0|i[e+8>>2],r||vt(t),!e)break;r=0}},_edgeLengthKm:function(e){return+ +a[20752+((e|=0)<<3)>>3]},_edgeLengthM:function(e){return+ +a[20880+((e|=0)<<3)>>3]},_emscripten_replace_memory:function(e){return r=new Int8Array(e),i=new Int32Array(e),a=new Float64Array(e),n=e,!0},_exactEdgeLengthKm:function(e,t){var n,r,o=0,s=0,A=0,c=0,d=0,f=0;if(r=P,P=P+176|0,Ye(e|=0,t|=0,n=r),(0|(e=0|i[n>>2]))<=1)return P=r,+(A=0);t=e+-1|0,e=0,o=0,s=+a[n+8>>3],A=+a[n+16>>3];do{d=s,s=+a[n+8+((e=e+1|0)<<4)>>3],f=+h(.5*(s-d)),c=A,A=+a[n+8+(e<<4)+8>>3],c=f*f+(c=+h(.5*(A-c)))*(+u(+d)*+u(+s)*c),o+=2*+g(+ +l(+c),+ +l(+(1-c)))}while((0|e)!=(0|t));return P=r,+(f=6371.007180918475*o)},_exactEdgeLengthM:function(e,t){var n,r,o=0,s=0,A=0,c=0,d=0,f=0;if(r=P,P=P+176|0,Ye(e|=0,t|=0,n=r),(0|(e=0|i[n>>2]))<=1)return P=r,+(A=0);t=e+-1|0,e=0,o=0,s=+a[n+8>>3],A=+a[n+16>>3];do{d=s,s=+a[n+8+((e=e+1|0)<<4)>>3],f=+h(.5*(s-d)),c=A,A=+a[n+8+(e<<4)+8>>3],c=f*f+(c=+h(.5*(A-c)))*(+u(+d)*+u(+s)*c),o+=2*+g(+ +l(+c),+ +l(+(1-c)))}while((0|e)!=(0|t));return P=r,+(f=6371.007180918475*o*1e3)},_exactEdgeLengthRads:function(e,t){var n,r,o=0,s=0,A=0,c=0,d=0,f=0;if(r=P,P=P+176|0,Ye(e|=0,t|=0,n=r),(0|(e=0|i[n>>2]))<=1)return P=r,+(A=0);t=e+-1|0,e=0,o=0,s=+a[n+8>>3],A=+a[n+16>>3];do{d=s,s=+a[n+8+((e=e+1|0)<<4)>>3],f=+h(.5*(s-d)),c=A,A=+a[n+8+(e<<4)+8>>3],c=f*f+(c=+h(.5*(A-c)))*(+u(+s)*+u(+d)*c),o+=2*+g(+ +l(+c),+ +l(+(1-c)))}while((0|e)<(0|t));return P=r,+o},_experimentalH3ToLocalIj:function(e,t,n,r,i){var a,o;return i|=0,o=P,P=P+16|0,(e=0|$e(e|=0,t|=0,n|=0,r|=0,a=o))||(de(a,i),e=0),P=o,0|e},_experimentalLocalIjToH3:function(e,t,n,r){var i,a;return e|=0,t|=0,r|=0,i=P,P=P+16|0,fe(n|=0,a=i),r=0|et(e,t,a,r),P=i,0|r},_free:vt,_geoToH3:Ue,_getDestinationH3IndexFromUnidirectionalEdge:function(e,t){e|=0;var n,r,a=0;return n=P,P=P+16|0,a=n,!0&268435456==(2013265920&(t|=0)|0)?(r=0|Mt(0|e,0|t,56),w(),i[a>>2]=0,a=0|I(e,-2130706433&t|134217728,7&r,a),t=0|w(),_(0|t),P=n,0|a):(a=0,_(0|(t=0)),P=n,0|a)},_getH3IndexesFromUnidirectionalEdge:function(e,t,n){e|=0;var r,a,o,s,A=0;o=P,P=P+16|0,r=o,s=!0&268435456==(2013265920&(t|=0)|0),a=-2130706433&t|134217728,i[(A=n|=0)>>2]=s?e:0,i[A+4>>2]=s?a:0,s?(t=0|Mt(0|e,0|t,56),w(),i[r>>2]=0,e=0|I(e,a,7&t,r),t=0|w()):(e=0,t=0),i[(A=n+8|0)>>2]=e,i[A+4>>2]=t,P=o},_getH3UnidirectionalEdge:function(e,t,n,r){var a,o,s=0,A=0,l=0,c=0,u=0;if(o=P,P=P+16|0,a=o,!(0|Qe(e|=0,t|=0,n|=0,r|=0)))return c=0,_(0|(l=0)),P=o,0|c;for(l=-2130706433&t,s=(s=0==(0|Ie(e,t)))?1:2;i[a>>2]=0,A=s+1|0,!((0|(u=0|I(e,t,s,a)))==(0|n)&(0|w())==(0|r));){if(!(A>>>0<7)){s=0,e=0,c=6;break}s=A}return 6==(0|c)?(_(0|s),P=o,0|e):(u=0|St(0|s,0,56),c=0|l|w()|268435456,u|=e,_(0|c),P=o,0|u)},_getH3UnidirectionalEdgeBoundary:Ye,_getH3UnidirectionalEdgesFromHexagon:function(e,t,n){n|=0;var r,a=0;r=0==(0|Ie(e|=0,t|=0)),t&=-2130706433,i[(a=n)>>2]=r?e:0,i[a+4>>2]=r?285212672|t:0,i[(a=n+8|0)>>2]=e,i[a+4>>2]=301989888|t,i[(a=n+16|0)>>2]=e,i[a+4>>2]=318767104|t,i[(a=n+24|0)>>2]=e,i[a+4>>2]=335544320|t,i[(a=n+32|0)>>2]=e,i[a+4>>2]=352321536|t,i[(n=n+40|0)>>2]=e,i[n+4>>2]=369098752|t},_getOriginH3IndexFromUnidirectionalEdge:function(e,t){var n;return e|=0,_(0|((n=!0&268435456==(2013265920&(t|=0)|0))?-2130706433&t|134217728:0)),0|(n?e:0)},_getPentagonIndexes:We,_getRes0Indexes:function(e){e|=0;var t=0,n=0,r=0;t=0;do{St(0|t,0,45),r=134225919|w(),i[(n=e+(t<<3)|0)>>2]=-1,i[n+4>>2]=r,t=t+1|0}while(122!=(0|t))},_h3Distance:function(e,t,n,r){var i,a,o;return n|=0,r|=0,o=P,P=P+32|0,a=o,e=0==(0|$e(e|=0,t|=0,e,t,i=o+12|0))&&0==(0|$e(e,t,n,r,a))?0|he(i,a):-1,P=o,0|e},_h3GetBaseCell:Pe,_h3GetFaces:function e(t,n,r){r|=0;var a,o=0,s=0,A=0,l=0,c=0,u=0,h=0,d=0;a=P,P=P+128|0,h=a+112|0,A=a+96|0,d=a,s=0|Mt(0|(t|=0),0|(n|=0),52),w(),c=15&s,i[h>>2]=c,l=0|Mt(0|t,0|n,45),w(),l&=127;e:do{if(0|k(l)){if(0|c)for(o=1;;){if(!(0==((u=0|St(7,0,3*(15-o|0)|0))&t|0)&0==((0|w())&n|0))){s=0;break e}if(!(o>>>0>>0))break;o=o+1|0}if(!(1&s))return u=0|St(c+1|0,0,52),d=0|w()|-15728641&n,e((u|t)&~(h=0|St(7,0,3*(14-c|0)|0)),d&~(0|w()),r),void(P=a);s=1}else s=0}while(0);Ge(t,n,A),s?(be(A,h,d),u=5):(Se(A,h,d),u=6);e:do{if(0|k(l))if(c)for(o=1;;){if(!(0==((l=0|St(7,0,3*(15-o|0)|0))&t|0)&0==((0|w())&n|0))){o=8;break e}if(!(o>>>0>>0)){o=20;break}o=o+1|0}else o=20;else o=8}while(0);if(Ct(0|r,-1,0|o),s){s=0;do{for(we(A=d+(s<<4)|0,0|i[h>>2]),A=0|i[A>>2],o=0;!(-1==(0|(c=0|i[(l=r+(o<<2)|0)>>2]))|(0|c)==(0|A));)o=o+1|0;i[l>>2]=A,s=s+1|0}while((0|s)!=(0|u))}else{s=0;do{for(_e(A=d+(s<<4)|0,0|i[h>>2],0,1),A=0|i[A>>2],o=0;!(-1==(0|(c=0|i[(l=r+(o<<2)|0)>>2]))|(0|c)==(0|A));)o=o+1|0;i[l>>2]=A,s=s+1|0}while((0|s)!=(0|u))}P=a},_h3GetResolution:function(e,t){return t=0|Mt(0|(e|=0),0|(t|=0),52),w(),15&t|0},_h3IndexesAreNeighbors:Qe,_h3IsPentagon:Ie,_h3IsResClassIII:function(e,t){return t=0|Mt(0|(e|=0),0|(t|=0),52),w(),1&t|0},_h3IsValid:Re,_h3Line:function(e,t,n,r,a){n|=0,r|=0,a|=0;var o,s=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,x=0,b=0,_=0,w=0,M=0;if(o=P,P=P+48|0,l=o+12|0,w=o,0==(0|$e(e|=0,t|=0,e,t,s=o+24|0))&&0==(0|$e(e,t,n,r,l))){if((0|(_=0|he(s,l)))<0)return P=o,0|(w=_);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,$e(e,t,e,t,s),$e(e,t,n,r,l),pe(s),pe(l),_?(m=+(0|_),b=s,n=d=0|i[s>>2],r=f=0|i[(y=s+4|0)>>2],s=p=0|i[(x=s+8|0)>>2],g=+((0|i[l>>2])-d|0)/m,v=+((0|i[l+4>>2])-f|0)/m,m=+((0|i[l+8>>2])-p|0)/m):(y=r=s+4|0,x=p=s+8|0,b=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[(f=w+8|0)>>2]=s,d=0;;){M=g*(u=+(0|d))+ +(0|n),c=v*u+ +(0|i[y>>2]),u=m*u+ +(0|i[x>>2]),r=~~+Tt(+M),l=~~+Tt(+c),n=~~+Tt(+u),M=+A(+(+(0|r)-M)),c=+A(+(+(0|l)-c)),u=+A(+(+(0|n)-u));do{if(!(M>c&M>u)){if(h=0-r|0,c>u){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[f>>2]=n,me(w),et(e,t,w,a+(d<<3)|0),(0|d)==(0|_))break;d=d+1|0,n=0|i[b>>2]}return P=o,0|(w=0)}return P=o,0|(w=-1)},_h3LineSize:function(e,t,n,r){var i,a,o;return n|=0,r|=0,o=P,P=P+32|0,a=o,e=0==(0|$e(e|=0,t|=0,e,t,i=o+12|0))&&0==(0|$e(e,t,n,r,a))?0|he(i,a):-1,P=o,(e>>>31^1)+e|0},_h3SetToLinkedGeo:function(e,t,n){n|=0;var r,a,o,s=0;if(o=P,P=P+32|0,r=o,function(e,t,n){e|=0,n|=0;var r,a,o=0,s=0,A=0,l=0,c=0;if(a=P,P=P+176|0,r=a,(0|(t|=0))<1)return lt(n,0,0),void(P=a);l=0|Mt(0|i[(l=e)>>2],0|i[l+4>>2],52),w(),lt(n,(0|t)>6?t:6,15&l),l=0;do{if(je(0|i[(o=e+(l<<3)|0)>>2],0|i[o+4>>2],r),(0|(o=0|i[r>>2]))>0){c=0;do{A=r+8+(c<<4)|0,(s=0|ft(n,o=r+8+(((0|(c=c+1|0))%(0|o)|0)<<4)|0,A))?ht(n,s):dt(n,A,o),o=0|i[r>>2]}while((0|c)<(0|o))}l=l+1|0}while((0|l)!=(0|t));P=a}(e|=0,t|=0,a=o+16|0),i[n>>2]=0,i[n+4>>2]=0,i[n+8>>2]=0,!(e=0|ut(a)))return Je(n),ct(a),void(P=o);do{t=0|Xe(n);do{Ze(t,e),s=e+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],ht(a,e),e=0|pt(a,r)}while(0!=(0|e));e=0|ut(a)}while(0!=(0|e));Je(n),ct(a),P=o},_h3ToCenterChild:function(e,t,n){n|=0;var r=0,i=0;if(r=0|Mt(0|(e|=0),0|(t|=0),52),w(),(0|n)<16&(0|(r&=15))<=(0|n)){if((0|r)!=(0|n)&&(e|=i=0|St(0|n,0,52),t=0|w()|-15728641&t,(0|r)<(0|n)))do{i=0|St(7,0,3*(14-r|0)|0),r=r+1|0,e&=~i,t&=~(0|w())}while((0|r)<(0|n))}else t=0,e=0;return _(0|t),0|e},_h3ToChildren:De,_h3ToGeo:Ve,_h3ToGeoBoundary:je,_h3ToParent:qe,_h3UnidirectionalEdgeIsValid:function(e,t){var n=0;if(!(!0&268435456==(2013265920&(t|=0)|0)))return 0|(n=0);switch(n=0|Mt(0|(e|=0),0|t,56),w(),7&n){case 0:case 7:return 0|(n=0)}return!0&16777216==(117440512&t|0)&0!=(0|Ie(e,n=-2130706433&t|134217728))?0|(n=0):0|(n=0|Re(e,n))},_hexAreaKm2:function(e){return+ +a[20496+((e|=0)<<3)>>3]},_hexAreaM2:function(e){return+ +a[20624+((e|=0)<<3)>>3]},_hexRing:function(e,t,n,r){e|=0,t|=0,r|=0;var a,o=0,s=0,A=0,l=0,c=0,u=0,h=0;if(a=P,P=P+16|0,h=a,!(n|=0))return i[(h=r)>>2]=e,i[h+4>>2]=t,P=a,0|(h=0);i[h>>2]=0;e:do{if(0|Ie(e,t))e=1;else{if(s=(0|n)>0){o=0,u=e;do{if(0==(0|(u=0|I(u,t,4,h)))&0==(0|(t=0|w()))){e=2;break e}if(o=o+1|0,0|Ie(u,t)){e=1;break e}}while((0|o)<(0|n));if(i[(c=r)>>2]=u,i[c+4>>2]=t,c=n+-1|0,s){s=0,A=1,o=u,e=t;do{if(0==(0|(o=0|I(o,e,2,h)))&0==(0|(e=0|w()))){e=2;break e}if(i[(l=r+(A<<3)|0)>>2]=o,i[l+4>>2]=e,A=A+1|0,0|Ie(o,e)){e=1;break e}s=s+1|0}while((0|s)<(0|n));l=0,s=A;do{if(0==(0|(o=0|I(o,e,3,h)))&0==(0|(e=0|w()))){e=2;break e}if(i[(A=r+(s<<3)|0)>>2]=o,i[A+4>>2]=e,s=s+1|0,0|Ie(o,e)){e=1;break e}l=l+1|0}while((0|l)<(0|n));A=0;do{if(0==(0|(o=0|I(o,e,1,h)))&0==(0|(e=0|w()))){e=2;break e}if(i[(l=r+(s<<3)|0)>>2]=o,i[l+4>>2]=e,s=s+1|0,0|Ie(o,e)){e=1;break e}A=A+1|0}while((0|A)<(0|n));A=0;do{if(0==(0|(o=0|I(o,e,5,h)))&0==(0|(e=0|w()))){e=2;break e}if(i[(l=r+(s<<3)|0)>>2]=o,i[l+4>>2]=e,s=s+1|0,0|Ie(o,e)){e=1;break e}A=A+1|0}while((0|A)<(0|n));A=0;do{if(0==(0|(o=0|I(o,e,4,h)))&0==(0|(e=0|w()))){e=2;break e}if(i[(l=r+(s<<3)|0)>>2]=o,i[l+4>>2]=e,s=s+1|0,0|Ie(o,e)){e=1;break e}A=A+1|0}while((0|A)<(0|n));for(A=0;;){if(0==(0|(o=0|I(o,e,6,h)))&0==(0|(e=0|w()))){e=2;break e}if((0|A)!=(0|c)){if(i[(l=r+(s<<3)|0)>>2]=o,i[l+4>>2]=e,0|Ie(o,e)){e=1;break e}s=s+1|0}if((0|(A=A+1|0))>=(0|n)){A=u,s=t;break}}}else A=u,o=u,s=t,e=t}else i[(A=r)>>2]=e,i[A+4>>2]=t,A=e,o=e,s=t,e=t;e=1&((0|A)!=(0|o)|(0|s)!=(0|e))}}while(0);return P=a,0|(h=e)},_i64Subtract:xt,_kRing:R,_kRingDistances:function(e,t,n,r,i){var a;if(0|q(e|=0,t|=0,n|=0,r|=0,i|=0)){if(Ct(0|r,0,(a=1+(0|y(3*n|0,n+1|0))|0)<<3|0),0|i)return Ct(0|i,0,a<<2|0),void D(e,t,n,r,i,a,0);(i=0|yt(a,4))&&(D(e,t,n,r,i,a,0),vt(i))}},_llvm_minnum_f64:Et,_llvm_round_f64:Tt,_malloc:gt,_maxFaceCount:function(e,t){var n=0,r=0;if(r=0|Mt(0|(e|=0),0|(t|=0),45),w(),!(0|k(127&r)))return 0|(r=2);if(r=0|Mt(0|e,0|t,52),w(),!(r&=15))return 0|(r=5);for(n=1;;){if(!(0==((0|St(7,0,3*(15-n|0)|0))&e|0)&0==((0|w())&t|0))){n=2,e=6;break}if(!(n>>>0>>0)){n=5,e=6;break}n=n+1|0}return 6==(0|e)?0|n:0},_maxH3ToChildrenSize:function(e,t,n){return n|=0,e=0|Mt(0|(e|=0),0|(t|=0),52),w(),(0|n)<16&(0|(e&=15))<=(0|n)?0|(n=0|tt(7,n-e|0)):0|(n=0)},_maxKringSize:function(e){return 1+(0|y(3*(e|=0)|0,e+1|0))|0},_maxPolyfillSize:function(e,t){t|=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=e|=0)+4>>2],i[(r=a)>>2]=i[A>>2],i[r+4>>2]=s,rt(a,o),o=0|j(o,t),t=0|i[a>>2],(0|(a=0|i[e+8>>2]))<=0)return P=n,0|(A=(A=(s=(0|o)<(0|(A=t)))?A:o)+12|0);r=0|i[e+12>>2],e=0;do{t=(0|i[r+(e<<3)>>2])+t|0,e=e+1|0}while((0|e)<(0|a));return P=n,0|(A=(A=(A=(0|o)<(0|t))?t:o)+12|0)},_maxUncompactSize:function(e,t,n){e|=0,n|=0;var r=0,a=0,o=0,s=0;if((0|(t|=0))<=0)return 0|(n=0);if((0|n)>=16){for(r=0;;){if(!(0==(0|i[(s=e+(r<<3)|0)>>2])&0==(0|i[s+4>>2]))){r=-1,a=13;break}if((0|(r=r+1|0))>=(0|t)){r=0,a=13;break}}if(13==(0|a))return 0|r}r=0,s=0;e:for(;;){o=0|i[(a=e+(s<<3)|0)>>2],a=0|i[a+4>>2];do{if(!(0==(0|o)&0==(0|a))){if(a=0|Mt(0|o,0|a,52),w(),(0|(a&=15))>(0|n)){r=-1,a=13;break e}if((0|a)==(0|n)){r=r+1|0;break}r=(0|tt(7,n-a|0))+r|0;break}}while(0);if((0|(s=s+1|0))>=(0|t)){a=13;break}}return 13==(0|a)?0|r:0},_memcpy:Lt,_memset:Ct,_numHexagons:function(e){var t;return e=0|i[(t=21008+((e|=0)<<3)|0)>>2],_(0|i[t+4>>2]),0|e},_pentagonIndexCount:function(){return 12},_pointDistKm:Le,_pointDistM:function(e,t){e|=0;var n,r,i,o=0;return r=+a[(t|=0)>>3],n=+a[e>>3],o=(i=+h(.5*(r-n)))*i+(o=+h(.5*(+a[t+8>>3]-+a[e+8>>3])))*(+u(+r)*+u(+n)*o),2*+g(+ +l(+o),+ +l(+(1-o)))*6371.007180918475*1e3},_pointDistRads:function(e,t){e|=0;var n,r,i,o=0;return r=+a[(t|=0)>>3],n=+a[e>>3],o=(i=+h(.5*(r-n)))*i+(o=+h(.5*(+a[t+8>>3]-+a[e+8>>3])))*(+u(+r)*+u(+n)*o),2*+g(+ +l(+o),+ +l(+(1-o)))},_polyfill:function(e,t,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(e,t,n){t|=0,n|=0;var r=0,a=0,o=0,s=0,A=0,l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,x=0,b=0,_=0,S=0,E=0,T=0,L=0,C=0,R=0,I=0,k=0,O=0,N=0,z=0;z=P,P=P+112|0,I=z+80|0,l=z+72|0,k=z,O=z+56|0,(N=0|gt(32+(i[(c=(e=e|0)+8|0)>>2]<<5)|0))||M(22848,22448,800,22456);if(it(e,N),r=0|i[(o=e)+4>>2],i[(A=l)>>2]=i[o>>2],i[A+4>>2]=r,rt(l,I),A=0|j(I,t),r=0|i[l>>2],(0|(o=0|i[c>>2]))>0){s=0|i[e+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|yt(R=(A=(0|A)<(0|r)?r:A)+12|0,8),u=0|yt(R,8),i[I>>2]=0,C=0|i[(L=e)+4>>2],i[(r=l)>>2]=i[L>>2],i[r+4>>2]=C,0|(r=0|B(l,R,t,I,a,u)))return vt(a),vt(u),vt(N),P=z,0|(N=r);e:do{if((0|i[c>>2])>0){for(o=e+12|0,r=0;s=0|B((0|i[o>>2])+(r<<3)|0,R,t,I,a,u),r=r+1|0,!(0|s);)if((0|r)>=(0|i[c>>2]))break e;return vt(a),vt(u),vt(N),P=z,0|(N=s)}}while(0);(0|A)>-12&&Ct(0|u,0,((0|R)>1?R:1)<<3|0);e:do{if((0|i[I>>2])>0){C=((0|R)<0)<<31>>31,b=a,_=u,S=a,E=a,T=u,L=a,r=a,g=a,v=u,y=u,x=u,a=u;t:for(;;){for(m=0|i[I>>2],f=0,p=0,o=0;;){A=(s=k)+56|0;do{i[s>>2]=0,s=s+4|0}while((0|s)<(0|A));if(0|q(l=0|i[(t=b+(f<<3)|0)>>2],t=0|i[t+4>>2],1,k,0)){A=(s=k)+56|0;do{i[s>>2]=0,s=s+4|0}while((0|s)<(0|A));0|(s=0|yt(7,4))&&(D(l,t,1,k,s,7,0),vt(s))}d=0;do{u=0|i[(h=k+(d<<3)|0)>>2],h=0|i[h+4>>2];n:do{if(!(0==(0|u)&0==(0|h))){if(l=0|wt(0|u,0|h,0|R,0|C),w(),!(0==(0|(t=0|i[(A=s=n+(l<<3)|0)>>2]))&0==(0|(A=0|i[A+4>>2]))))for(c=0;;){if((0|c)>(0|R))break t;if((0|t)==(0|u)&(0|A)==(0|h))break n;if(0==(0|(t=0|i[(A=s=n+((l=(l+1|0)%(0|R)|0)<<3)|0)>>2]))&0==(0|(A=0|i[A+4>>2])))break;c=c+1|0}0==(0|u)&0==(0|h)||(Ve(u,h,O),0|at(e,N,O)&&(i[(c=s)>>2]=u,i[c+4>>2]=h,i[(c=_+(o<<3)|0)>>2]=u,i[c+4>>2]=h,o=o+1|0))}}while(0);d=d+1|0}while(d>>>0<7);if((0|(p=p+1|0))>=(0|m))break;f=f+1|0}if((0|m)>0&&Ct(0|S,0,m<<3|0),i[I>>2]=o,!((0|o)>0))break e;u=a,h=x,d=L,f=y,p=v,m=_,a=g,x=r,y=E,v=S,g=u,r=h,L=T,T=d,E=f,S=p,_=b,b=m}return vt(E),vt(T),vt(N),P=z,0|(N=-1)}r=u}while(0);return vt(N),vt(a),vt(r),P=z,0|(N=0)}(e|=0,t|=0,n|=0)){if(s=0|i[(l=e)+4>>2],i[(A=o)>>2]=i[l>>2],i[A+4>>2]=s,rt(o,a),A=0|j(a,t),t=0|i[o>>2],(0|(s=0|i[e+8>>2]))>0){o=0|i[e+12>>2],a=0;do{t=(0|i[o+(a<<3)>>2])+t|0,a=a+1|0}while((0|a)!=(0|s))}(0|(t=(0|A)<(0|t)?t:A))<=-12||Ct(0|n,0,8+(((0|(l=t+11|0))>0?l:0)<<3)|0),P=r}else P=r},_res0IndexCount:function(){return 122},_round:Pt,_sbrk:Rt,_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(e,t,n,r,a){e|=0,n|=0,r|=0,a|=0;var o=0,s=0,A=0,l=0,c=0,u=0;if((0|(t|=0))<=0)return 0|(a=0);if((0|a)>=16){for(o=0;;){if(!(0==(0|i[(u=e+(o<<3)|0)>>2])&0==(0|i[u+4>>2]))){o=14;break}if((0|(o=o+1|0))>=(0|t)){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,u=0;e:for(;;){s=0|i[(A=c=e+(u<<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 e}if(l=0|Mt(0|s,0|A,52),w(),(0|(l&=15))>(0|a)){s=-2,o=16;break e}if((0|l)==(0|a)){i[(c=n+(o<<3)|0)>>2]=s,i[c+4>>2]=A,o=o+1|0;break}if((0|(s=(0|tt(7,a-l|0))+o|0))>(0|r)){s=-1,o=16;break e}De(0|i[c>>2],0|i[c+4>>2],a,n+(o<<3)|0),o=s}}while(0);if((0|(u=u+1|0))>=(0|t)){s=0,o=16;break}}return 16==(0|o)?0|s:0},establishStackSpace:function(e,t){P=e|=0},stackAlloc:function(e){var t;return t=P,P=(P=P+(e|=0)|0)+15&-16,0|t},stackRestore:function(e){P=e|=0},stackSave:function(){return 0|P}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{a:ve,b:function(e){g=e},c:v,d:function(e,t,n,r){ve("Assertion failed: "+R(e)+", at: "+[t?R(t):"unknown filename",n,r?R(r):"unknown function"])},e:function(e){return n.___errno_location&&(T[n.___errno_location()>>2]=e),e},f:ee,g:function(e,t,n){S.set(S.subarray(t,t+n),e)},h:function(e){var t=ee(),n=16777216,r=2130706432;if(e>r)return!1;for(var i=Math.max(t,16777216);i>0]=t;break;case"i16":E[e>>1]=t;break;case"i32":T[e>>2]=t;break;case"i64":Q=[t>>>0,(W=t,+F(W)>=1?W>0?(0|G(+H(W/4294967296),4294967295))>>>0:~~+U((W-+(~~W>>>0))/4294967296)>>>0:0)],T[e>>2]=Q[0],T[e+4>>2]=Q[1];break;case"float":L[e>>2]=t;break;case"double":C[e>>3]=t;break;default:ve("invalid type for setValue: "+n)}},n.getValue=function(e,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return M[e>>0];case"i16":return E[e>>1];case"i32":case"i64":return T[e>>2];case"float":return L[e>>2];case"double":return C[e>>3];default:ve("invalid type for getValue: "+t)}return null},n.getTempRet0=v,Y)if(Z(Y)||(se=Y,Y=n.locateFile?n.locateFile(se,f):f+se),o||A){var he=u(Y);S.set(he,8)}else{V++,n.monitorRunDependencies&&n.monitorRunDependencies(V);var de=function(e){e.byteLength&&(e=new Uint8Array(e)),S.set(e,8),n.memoryInitializerRequest&&delete n.memoryInitializerRequest.response,function(e){if(V--,n.monitorRunDependencies&&n.monitorRunDependencies(V),0==V&&j){var t=j;j=null,t()}}()},fe=function(){c(Y,de,(function(){throw"could not load memory initializer "+Y}))},pe=ie(Y);if(pe)de(pe.buffer);else if(n.memoryInitializerRequest){var me=function(){var e=n.memoryInitializerRequest,t=e.response;if(200!==e.status&&0!==e.status){var r=ie(n.memoryInitializerRequestURL);if(!r)return console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+e.status+", retrying "+Y),void fe();t=r.buffer}de(t)};n.memoryInitializerRequest.response?setTimeout(me,0):n.memoryInitializerRequest.addEventListener("load",me)}else fe()}function ge(e){function t(){Ae||(Ae=!0,y||(B(O),B(N),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),z.unshift(e);var e;B(z)}()))}V>0||(!function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),k.unshift(e);var e;B(k)}(),V>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),t()}),1)):t()))}function ve(e){throw n.onAbort&&n.onAbort(e),p(e+=""),m(e),y=!0,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if(j=function e(){Ae||ge(),Ae||(j=e)},n.run=ge,n.abort=ve,n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return ge(),e}("object"==typeof Dg?Dg:{}),Ig="number",Bg={}; /* * Copyright 2018-2019 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */[["sizeOfH3Index",Ig],["sizeOfGeoCoord",Ig],["sizeOfGeoBoundary",Ig],["sizeOfGeoPolygon",Ig],["sizeOfGeofence",Ig],["sizeOfLinkedGeoPolygon",Ig],["sizeOfCoordIJ",Ig],["h3IsValid",Ig,[Ig,Ig]],["geoToH3",Ig,[Ig,Ig,Ig]],["h3ToGeo",null,[Ig,Ig,Ig]],["h3ToGeoBoundary",null,[Ig,Ig,Ig]],["maxKringSize",Ig,[Ig]],["kRing",null,[Ig,Ig,Ig,Ig]],["kRingDistances",null,[Ig,Ig,Ig,Ig,Ig]],["hexRing",null,[Ig,Ig,Ig,Ig]],["maxPolyfillSize",Ig,[Ig,Ig]],["polyfill",null,[Ig,Ig,Ig]],["h3SetToLinkedGeo",null,[Ig,Ig,Ig]],["destroyLinkedPolygon",null,[Ig]],["compact",Ig,[Ig,Ig,Ig]],["uncompact",Ig,[Ig,Ig,Ig,Ig,Ig]],["maxUncompactSize",Ig,[Ig,Ig,Ig]],["h3IsPentagon",Ig,[Ig,Ig]],["h3IsResClassIII",Ig,[Ig,Ig]],["h3GetBaseCell",Ig,[Ig,Ig]],["h3GetResolution",Ig,[Ig,Ig]],["maxFaceCount",Ig,[Ig,Ig]],["h3GetFaces",null,[Ig,Ig,Ig]],["h3ToParent",Ig,[Ig,Ig,Ig]],["h3ToChildren",null,[Ig,Ig,Ig,Ig]],["h3ToCenterChild",Ig,[Ig,Ig,Ig]],["maxH3ToChildrenSize",Ig,[Ig,Ig,Ig]],["h3IndexesAreNeighbors",Ig,[Ig,Ig,Ig,Ig]],["getH3UnidirectionalEdge",Ig,[Ig,Ig,Ig,Ig]],["getOriginH3IndexFromUnidirectionalEdge",Ig,[Ig,Ig]],["getDestinationH3IndexFromUnidirectionalEdge",Ig,[Ig,Ig]],["h3UnidirectionalEdgeIsValid",Ig,[Ig,Ig]],["getH3IndexesFromUnidirectionalEdge",null,[Ig,Ig,Ig]],["getH3UnidirectionalEdgesFromHexagon",null,[Ig,Ig,Ig]],["getH3UnidirectionalEdgeBoundary",null,[Ig,Ig,Ig]],["h3Distance",Ig,[Ig,Ig,Ig,Ig]],["h3Line",Ig,[Ig,Ig,Ig,Ig,Ig]],["h3LineSize",Ig,[Ig,Ig,Ig,Ig]],["experimentalH3ToLocalIj",Ig,[Ig,Ig,Ig,Ig,Ig]],["experimentalLocalIjToH3",Ig,[Ig,Ig,Ig,Ig]],["hexAreaM2",Ig,[Ig]],["hexAreaKm2",Ig,[Ig]],["edgeLengthM",Ig,[Ig]],["edgeLengthKm",Ig,[Ig]],["pointDistM",Ig,[Ig,Ig]],["pointDistKm",Ig,[Ig,Ig]],["pointDistRads",Ig,[Ig,Ig]],["cellAreaM2",Ig,[Ig,Ig]],["cellAreaKm2",Ig,[Ig,Ig]],["cellAreaRads2",Ig,[Ig,Ig]],["exactEdgeLengthM",Ig,[Ig,Ig]],["exactEdgeLengthKm",Ig,[Ig,Ig]],["exactEdgeLengthRads",Ig,[Ig,Ig]],["numHexagons",Ig,[Ig]],["getRes0Indexes",null,[Ig]],["res0IndexCount",Ig],["getPentagonIndexes",null,[Ig,Ig]],["pentagonIndexCount",Ig]].forEach((function(e){Bg[e[0]]=Dg.cwrap.apply(Dg,e)}));var kg=16,Og=Bg.sizeOfH3Index(),Ng=Bg.sizeOfGeoCoord(),zg=Bg.sizeOfGeoBoundary(),Fg=Bg.sizeOfGeoPolygon(),Ug=Bg.sizeOfGeofence();Bg.sizeOfLinkedGeoPolygon(),Bg.sizeOfCoordIJ();var Hg=/[^0-9a-fA-F]/;function Gg(e){if(Array.isArray(e)&&2===e.length&&Number.isInteger(e[0])&&Number.isInteger(e[1]))return e;if("string"!=typeof e||Hg.test(e))return[0,0];var t=parseInt(e.substring(0,e.length-8),kg);return[parseInt(e.substring(e.length-8),kg),t]}function Vg(e){if(e>=0)return e.toString(kg);var t=Wg(8,(e&=2147483647).toString(kg));return t=(parseInt(t[0],kg)+8).toString(kg)+t.substring(1)}function jg(e,t){return Vg(t)+Wg(8,Vg(e))}function Wg(e,t){for(var n=e-t.length,r="",i=0;i15||Math.floor(e)!==e)throw new Error("Invalid resolution: "+e)}(t),n=Boolean(n),0===e.length||0===e[0].length)return[];"number"==typeof e[0][0]&&(e=[e]);var r=function(e,t){var n,r=e.length-1,i=Dg._calloc(Fg),a=0+Ug,o=a+4;if(Qg(e[0],i+0,t),r>0){n=Dg._calloc(r,Ug);for(var s=0;s0){for(var i=Dg.getValue(e+n,"i32"),a=0;a\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t"};class cv extends lv.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:lv.UniformsUtils.clone(lv.ShaderLib.line.uniforms),vertexShader:lv.ShaderLib.line.vertexShader,fragmentShader:lv.ShaderLib.line.fragmentShader,clipping:!0}),this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),e?(this.defines.ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}cv.prototype.isLineMaterial=!0;const uv=window.THREE?window.THREE:{Box3:ue,BufferGeometry:Zt,InstancedInterleavedBuffer:Ys,InterleavedBufferAttribute:Xi,Line3:eA,MathUtils:J,Matrix4:ze,Mesh:pn,Sphere:Pe,Vector3:Ae,Vector4:ae};var hv=(new uv.BufferGeometry).setAttribute?"setAttribute":"addAttribute";const dv=new uv.Vector3,fv=new uv.Vector3,pv=new uv.Vector4,mv=new uv.Vector4,gv=new uv.Vector4,vv=new uv.Vector3,yv=new uv.Matrix4,xv=new uv.Line3,bv=new uv.Vector3,_v=new uv.Box3,wv=new uv.Sphere,Mv=new uv.Vector4;class Sv extends uv.Mesh{constructor(e=new Av,t=new cv({color:16777215*Math.random()})){super(e,t),this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let e=0,i=0,a=t.count;ed&&mv.z>d)continue;if(pv.z>d){const e=pv.z-mv.z,t=(pv.z-d)/e;pv.lerp(mv,t)}else if(mv.z>d){const e=mv.z-pv.z,t=(mv.z-d)/e;mv.lerp(pv,t)}pv.applyMatrix4(a),mv.applyMatrix4(a),pv.multiplyScalar(1/pv.w),mv.multiplyScalar(1/mv.w),pv.x*=l.x/2,pv.y*=l.y/2,mv.x*=l.x/2,mv.y*=l.y/2,xv.start.copy(pv),xv.start.z=0,xv.end.copy(mv),xv.end.z=0;const n=xv.closestPointToPointParameter(vv,!0);xv.at(n,bv);const i=uv.MathUtils.lerp(pv.z,mv.z,n),s=i>=-1&&i<=1,A=vv.distanceTo(bv)<.5*c;if(s&&A){xv.start.fromBufferAttribute(u,e),xv.end.fromBufferAttribute(h,e),xv.start.applyMatrix4(o),xv.end.applyMatrix4(o);const n=new uv.Vector3,i=new uv.Vector3;r.distanceSqToSegment(xv.start,xv.end,i,n),t.push({point:i,pointOnLine:n,distance:r.origin.distanceTo(i),object:this,face:null,faceIndex:e,uv:null,uv2:null})}}}}}Sv.prototype.LineSegments2=!0;class Ev extends Av{constructor(){super(),this.type="LineGeometry"}setPositions(e){for(var t=e.length-3,n=new Float32Array(2*t),r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Nv(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zv(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Nv(e):t}function Fv(e){var t=Bv();return function(){var n,r=Dv(e);if(t){var i=Dv(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return zv(this,n)}}function Uv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||Gv(e,t)||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 Hv(e){return function(e){if(Array.isArray(e))return Vv(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Gv(e)||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 Gv(e,t){if(e){if("string"==typeof e)return Vv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vv(e,t):void 0}}function Vv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?i-1:0),o=1;o2&&void 0!==arguments[2]?arguments[2]:0,r=(90-e)*Math.PI/180,i=(90-t)*Math.PI/180,a=Xv*(1+n);return{x:a*Math.sin(r)*Math.cos(i),y:a*Math.cos(r),z:a*Math.sin(r)*Math.sin(i)}}function Jv(e){var t=e.x,n=e.y,r=e.z,i=Math.sqrt(t*t+n*n+r*r),a=Math.acos(n/i),o=Math.atan2(r,t);return{lat:90-180*a/Math.PI,lng:90-180*o/Math.PI-(o<-Math.PI/2?360:0),altitude:i/Xv-1}}var Kv=window.THREE?window.THREE:{BackSide:1,BufferAttribute:Nt,Color:It,Mesh:pn,ShaderMaterial:bn},$v={backside:!0,coefficient:.5,color:"gold",size:2,power:1};function ey(e,t,n){return new Kv.ShaderMaterial({depthWrite:!1,fragmentShader:"\nuniform vec3 color;\nuniform float coefficient;\nuniform float power;\nvarying vec3 vVertexNormal;\nvarying vec3 vVertexWorldPosition;\nvoid main() {\n vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition;\n vec3 viewCameraToVertex\t= (viewMatrix * vec4(worldCameraToVertex, 0.0)).xyz;\n viewCameraToVertex = normalize(viewCameraToVertex);\n float intensity\t= pow(\n coefficient + dot(vVertexNormal, viewCameraToVertex),\n power\n );\n gl_FragColor = vec4(color, intensity);\n}",transparent:!0,uniforms:{coefficient:{value:e},color:{value:new Kv.Color(t)},power:{value:n}},vertexShader:"\nvarying vec3 vVertexWorldPosition;\nvarying vec3 vVertexNormal;\nvoid main() {\n vVertexNormal\t= normalize(normalMatrix * normal);\n vVertexWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;\n gl_Position\t= projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n"})}function ty(e,t){for(var n=e.clone(),r=new Float32Array(3*e.attributes.position.count),i=0,a=r.length;i1&&void 0!==arguments[1]?arguments[1]:$v,n=t.backside,r=t.coefficient,i=t.color,a=t.size,o=t.power,s=ty(e,a),A=ey(r,i,o);return n&&(A.side=Kv.BackSide),new Kv.Mesh(s,A)}(e.globeObj.geometry,{backside:!0,color:e.atmosphereColor,size:Xv*e.atmosphereAltitude,power:3.5,coefficient:.1});r.visible=!!e.showAtmosphere,r.__globeObjType="atmosphere",e.scene.add(r)}e.ready||e.globeImageUrl||(e.ready=!0,e.onReady())}}),iy=function(e){return isNaN(e)?parseInt(uu(e).toHex(),16):e},ay=function(e){return isNaN(e)?uu(e).getAlpha():1},oy=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=uu(e).toRgb(),r=["r","g","b"].map((function(e){return n[e]/255}));return t?[].concat(Hv(r),[n.a]):r};function sy(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Tu(e,t.children,(function(e){return t.add(e)}),(function(e){t.remove(e),Qv(e),e.hasOwnProperty("__data")&&delete e.__data.__currentTargetD}),Cv({objBindAttr:"__threeObj"},n))}var Ay=window.THREE?window.THREE:{BufferAttribute:Nt,BufferGeometry:Zt,Color:It,CylinderBufferGeometry:class extends Zt{constructor(e=1,t=1,n=1,r=8,i=1,a=!1,o=0,s=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,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=[],c=[],u=[],h=[];let d=0;const f=[],p=n/2;let m=0;function g(n){const i=d,a=new K,f=new Ae;let g=0;const v=!0===n?e:t,y=!0===n?1:-1;for(let e=1;e<=r;e++)c.push(0,p*y,0),u.push(0,y,0),h.push(.5,.5),d++;const x=d;for(let e=0;e<=r;e++){const t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);f.x=v*i,f.y=p*y,f.z=v*n,c.push(f.x,f.y,f.z),u.push(0,y,0),a.x=.5*n+.5,a.y=.5*i*y+.5,h.push(a.x,a.y),d++}for(let e=0;e0&&g(!0),t>0&&g(!1)),this.setIndex(l),this.setAttribute("position",new Ut(c,3)),this.setAttribute("normal",new Ut(u,3)),this.setAttribute("uv",new Ut(h,2))}},Matrix4:ze,Mesh:pn,MeshBasicMaterial:Bt,MeshLambertMaterial:vo,Object3D:ct,Vector3:Ae},ly=(new Ay.BufferGeometry).applyMatrix4?"applyMatrix4":"applyMatrix",cy=dA({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t){Qv(e),t.scene=e},update:function(e){var t=lu(e.pointLat),n=lu(e.pointLng),r=lu(e.pointAltitude),i=lu(e.pointRadius),a=lu(e.pointColor),o=new Ay.CylinderBufferGeometry(1,1,1,e.pointResolution);o[ly]((new Ay.Matrix4).makeRotationX(Math.PI/2)),o[ly]((new Ay.Matrix4).makeTranslation(0,0,-.5));var s=2*Math.PI*Xv/360,A={},l=e.pointsMerge?new Ay.Object3D:e.scene;if(sy(e.pointsData,l,{createObj:function(){var e=new Ay.Mesh(o);return e.__globeObjType="point",e},updateObj:function(o,l){var c=function(t){var n=o.__currentTargetD=t,r=n.r,i=n.alt,a=n.lat,A=n.lng;Object.assign(o.position,Zv(a,A));var l=e.pointsMerge?new Ay.Vector3(0,0,0):e.scene.localToWorld(new Ay.Vector3(0,0,0));o.lookAt(l),o.scale.x=o.scale.y=Math.min(30,r)*s,o.scale.z=Math.max(i*Xv,.1)},u={alt:+r(l),r:+i(l),lat:+t(l),lng:+n(l)},h=o.__currentTargetD||Object.assign({},u,{alt:-.001});Object.keys(u).some((function(e){return h[e]!==u[e]}))&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?c(u):new CA.Tween(h).to(u,e.pointsTransitionDuration).easing(CA.Easing.Quadratic.InOut).onUpdate(c).start());if(!e.pointsMerge){var d=a(l),f=ay(d);A.hasOwnProperty(d)||(A[d]=new Ay.MeshLambertMaterial({color:iy(d),transparent:f<1,opacity:f})),o.material=A[d]}}}),e.pointsMerge){var c=e.pointsData.length?Au.mergeBufferGeometries(e.pointsData.map((function(e){var t=e.__threeObj;e.__threeObj=void 0;var n=t.geometry.clone();t.updateMatrix(),n[ly](t.matrix);for(var r=new Ay.Color(a(e)),i=n.attributes.position.count,o=new Float32Array(3*i),s=0,A=i;s dashSize) discard;\n \n // set px color: [r, g, b, a], interpolated between vertices \n gl_FragColor = vColor; \n }\n "},py=dA({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t){Qv(e),t.scene=e,(new Cu).onTick.add((function(e,n){t.arcsData.filter((function(e){return e.__threeObj&&e.__threeObj.children.length&&e.__threeObj.children[0].material&&e.__threeObj.children[0].__dashAnimateStep})).forEach((function(e){var t=e.__threeObj.children[0],r=t.__dashAnimateStep*n,i=t.material.uniforms.dashTranslate.value%1e9;t.material.uniforms.dashTranslate.value=i+r}))}))},update:function(e){var t=lu(e.arcStartLat),n=lu(e.arcStartLng),r=lu(e.arcEndLat),i=lu(e.arcEndLng),a=lu(e.arcAltitude),o=lu(e.arcAltitudeAutoScale),s=lu(e.arcStroke),A=lu(e.arcColor),l=lu(e.arcDashLength),c=lu(e.arcDashGap),u=lu(e.arcDashInitialGap),h=lu(e.arcDashAnimateTime),d=new hy.ShaderMaterial(Cv(Cv({},fy),{},{transparent:!0,blending:hy.NormalBlending}));sy(e.arcsData,e.scene,{createObj:function(){var e=new hy.Group;return e.__globeObjType="arc",e},updateObj:function(f,p){var m=s(p),g=null!=m;if(!f.children.length||g!==("Mesh"===f.children[0].type)){Qv(f);var v=g?new hy.Mesh:new hy.Line(new hy.BufferGeometry);v.material=d.clone(),f.add(v)}var y=f.children[0];Object.assign(y.material.uniforms,{dashSize:{value:l(p)},gapSize:{value:c(p)},dashOffset:{value:u(p)}});var x=h(p);y.__dashAnimateStep=x>0?1e3/x:0;var b=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=t+1;if(e instanceof Array){var a=Zh().domain(e.map((function(t,n){return n/(e.length-1)}))).range(e);n=function(e){return oy(a(e))}}else{var o=oy(e);n=function(){return o}}for(var s=new hy.Float32BufferAttribute(4*i*r,4),A=0,l=i;A1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e+1,i=r*t,a=new hy.Float32BufferAttribute(i,1),o=0,s=r;o170&&(e[0]+=n>t?360:-360)})),t.__globeObjType="hexbin",t},updateObj:function(t,n){var r=Math.max(0,Math.min(1,+s(n))),A=Uv(t.__hexCenter,2),l=A[0],u=A[1],h=0===r?t.__hexGeoJson:t.__hexGeoJson.map((function(e){var t=Uv(e,2),n=t[0],i=t[1];return[[n,u],[i,l]].map((function(e){var t=Uv(e,2);return function(e,t,n){return e-(e-t)*n}(t[0],t[1],r)}))})),d=e.hexTopCurvatureResolution;t.geometry=new qg([h],0,Xv,!1,!0,!0,d);var f={alt:+i(n)},p=function(e){var n=(t.__currentTargetD=e).alt;t.scale.x=t.scale.y=t.scale.z=1+n},m=t.__currentTargetD||Object.assign({},f,{alt:-.001});Object.keys(f).some((function(e){return m[e]!==f[e]}))&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?p(f):new CA.Tween(m).to(f,e.hexTransitionDuration).easing(CA.Easing.Quadratic.InOut).onUpdate(p).start());if(!e.hexBinMerge){var g=o(n),v=a(n);[g,v].forEach((function(e){if(!c.hasOwnProperty(e)){var t=ay(e);c[e]=new my.MeshLambertMaterial({color:iy(e),transparent:t<1,opacity:t,side:my.DoubleSide})}})),t.material=[g,v].map((function(e){return c[e]}))}},idAccessor:function(e){return e.h3Idx}}),e.hexBinMerge){var u=l.length?Au.mergeBufferGeometries(l.map((function(e){var t=e.__threeObj;e.__threeObj=void 0;var n=t.geometry.toNonIndexed();t.updateMatrix(),n[gy](t.matrix);for(var r=new my.Color(a(e)),i=new my.Color(o(e)),s=n.attributes.position.count,A=n.groups[0].count,l=new Float32Array(3*s),c=0,u=s;c=A?r:i;l[h]=d.r,l[h+1]=d.g,l[h+2]=d.b}return n.setAttribute("color",new my.BufferAttribute(l,3)),n}))):new my.BufferGeometry,h=new my.Mesh(u,new my.MeshBasicMaterial({color:16777215,vertexColors:!0,morphTargets:!1,side:my.DoubleSide}));h.__globeObjType="hexBinPoints",h.__data=l,Qv(e.scene),e.scene.add(h)}}}),yy=window.THREE?window.THREE:{DoubleSide:2,Group:Fi,Line:Ta,LineBasicMaterial:ba,Mesh:pn,MeshBasicMaterial:Bt},xy=dA({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t){Qv(e),t.scene=e},update:function(e){var t=lu(e.polygonGeoJsonGeometry),n=lu(e.polygonAltitude),r=lu(e.polygonCapCurvatureResolution),i=lu(e.polygonCapColor),a=lu(e.polygonCapMaterial),o=lu(e.polygonSideColor),s=lu(e.polygonSideMaterial),A=lu(e.polygonStrokeColor),l=[];e.polygonsData.forEach((function(e){var c={data:e,capColor:i(e),capMaterial:a(e),sideColor:o(e),sideMaterial:s(e),strokeColor:A(e),altitude:+n(e),capCurvatureResolution:+r(e)},u=t(e),h=e.__id||"".concat(Math.round(1e9*Math.random()));e.__id=h,"Polygon"===u.type?l.push(Cv({id:"".concat(h,"_0"),coords:u.coordinates},c)):"MultiPolygon"===u.type?l.push.apply(l,Hv(u.coordinates.map((function(e,t){return Cv({id:"".concat(h,"_").concat(t),coords:e},c)})))):console.warn("Unsupported GeoJson geometry type: ".concat(u.type,". Skipping geometry..."))})),sy(l,e.scene,{idAccessor:function(e){return e.id},createObj:function(){var e=new yy.Group;return e.__defaultSideMaterial=new yy.MeshBasicMaterial({side:yy.DoubleSide,depthWrite:!0}),e.__defaultCapMaterial=new yy.MeshBasicMaterial({side:yy.DoubleSide,depthWrite:!0}),e.add(new yy.Mesh(void 0,[e.__defaultSideMaterial,e.__defaultCapMaterial])),e.add(new yy.Line(void 0,new yy.LineBasicMaterial)),e.__globeObjType="polygon",e},updateObj:function(t,n){var r=n.coords,i=n.capColor,a=n.capMaterial,o=n.sideColor,s=n.sideMaterial,A=n.strokeColor,l=n.altitude,c=n.capCurvatureResolution,u=Uv(t.children,2),h=u[0],d=u[1],f=!!A;if(d.visible=f,!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return function(e,t){return e===t}};return Object.entries(t).every((function(t){var r=Uv(t,2),i=r[0],a=r[1];return e.hasOwnProperty(i)&&n(i)(e[i],a)}))}(h.geometry.parameters||{},{polygonGeoJson:r,curvatureResolution:c})&&(h.geometry=new qg(r,0,Xv,!1,!0,!0,c)),f&&(!d.geometry.parameters||d.geometry.parameters.geoJson.coordinates!==r||d.geometry.parameters.resolution!==c)&&(d.geometry=new iu({type:"Polygon",coordinates:r},Xv,c)),h.material[0]=s||t.__defaultSideMaterial,h.material[1]=a||t.__defaultCapMaterial,[!s&&o,!a&&i].forEach((function(e,t){if(e){var n=h.material[t],r=ay(e);n.color.set(iy(e)),n.transparent=r<1,n.opacity=r}})),f){var p=d.material,m=ay(A);p.color.set(iy(A)),p.transparent=m<1,p.opacity=m}var g={alt:l},v=function(e){var n=(t.__currentTargetD=e).alt;h.scale.x=h.scale.y=h.scale.z=1+n,f&&(d.scale.x=d.scale.y=d.scale.z=1+n+1e-4)},y=t.__currentTargetD||Object.assign({},g,{alt:-.001});Object.keys(g).some((function(e){return y[e]!==g[e]}))&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||y.alt===g.alt?v(g):new CA.Tween(y).to(g,e.polygonsTransitionDuration).easing(CA.Easing.Quadratic.InOut).onUpdate(v).start())}})}});var by=window.THREE?window.THREE:{BufferGeometry:Zt,DoubleSide:2,Mesh:pn,MeshLambertMaterial:vo},_y=dA({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonCurvatureResolution:{default:5},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t){Qv(e),t.scene=e},update:function(e){var t=lu(e.hexPolygonGeoJsonGeometry),n=lu(e.hexPolygonColor),r=lu(e.hexPolygonAltitude),i=lu(e.hexPolygonResolution),a=lu(e.hexPolygonMargin),o=lu(e.hexPolygonCurvatureResolution);sy(e.hexPolygonsData,e.scene,{createObj:function(e){var t=new by.Mesh(void 0,new by.MeshLambertMaterial({side:by.DoubleSide}));return t.__globeObjType="hexPolygon",t},updateObj:function(s,A){var l=t(A),c=i(A),u=r(A),h=Math.max(0,Math.min(1,+a(A))),d=o(A),f=n(A),p=ay(f);s.material.color.set(iy(f)),s.material.transparent=p<1,s.material.opacity=p;var m=[];"Polygon"===l.type?m.push.apply(m,Hv(nv(l.coordinates,c,!0))):"MultiPolygon"===l.type?l.coordinates.forEach((function(e){return m.push.apply(m,Hv(nv(e,c,!0)))})):console.warn("Unsupported GeoJson geometry type: ".concat(l.type,". Skipping geometry..."));var g=m.map((function(e){var t=ev(e),n=tv(e,!0).reverse(),r=t[1];return n.forEach((function(e){var t=e[0];Math.abs(r-t)>170&&(e[0]+=r>t?360:-360)})),{h3Idx:e,hexCenter:t,hexGeoJson:n}})),v={alt:u,margin:h,curvatureResolution:d},y=function(e){var t=s.__currentTargetD=e,n=t.alt,r=t.margin,i=t.curvatureResolution;s.geometry=g.length?Au.mergeBufferGeometries(g.map((function(e){var t=Uv(e.hexCenter,2),a=t[0],o=t[1],s=0===r?e.hexGeoJson:e.hexGeoJson.map((function(e){var t=Uv(e,2),n=t[0],i=t[1];return[[n,o],[i,a]].map((function(e){var t=Uv(e,2);return function(e,t,n){return e-(e-t)*n}(t[0],t[1],r)}))}));return new qg([s],Xv,Xv*(1+n),!1,!0,!1,i)}))):new by.BufferGeometry},x=s.__currentTargetD||Object.assign({},v,{alt:-.001});Object.keys(v).some((function(e){return x[e]!==v[e]}))&&(!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?y(v):new CA.Tween(x).to(v,e.hexPolygonsTransitionDuration).easing(CA.Easing.Quadratic.InOut).onUpdate(y).start())}})}}),wy=window.THREE?window.THREE:{Vector3:Ae};function My(e,t){var n=Math.max(e.length,t.length),r=fh.apply(void 0,Hv([e,t].map((function(e){return e.map((function(e){return[e.x,e.y,e.z]}))})).map((function(e){return function(e,t){var n=e[e.length-1];return[].concat(Hv(e),Hv(Hv(new Array(t-e.length)).map((function(){return n}))))}(e,n)}))));return function(n){return 0===n?e:1===n?t:r(n).map((function(e){var t=Uv(e,3),n=t[0],r=t[1],i=t[2];return new wy.Vector3(n,r,i)}))}}var Sy=window.THREE?window.THREE:{BufferGeometry:Zt,Color:It,Float32BufferAttribute:Ut,Group:Fi,Line:Ta,NoColors:0,NormalBlending:1,ShaderMaterial:bn,Vector3:Ae,VertexColors:2},Ey=(new Sy.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Ty={uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:"\n uniform float dashTranslate;\n\n attribute vec4 vertexColor;\n varying vec4 vColor;\n\n attribute float vertexRelDistance;\n varying float vRelDistance;\n\n void main() {\n // pass through colors and distances\n vColor = vertexColor;\n vRelDistance = vertexRelDistance + dashTranslate;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float dashOffset;\n uniform float dashSize;\n uniform float gapSize;\n\n varying vec4 vColor;\n varying float vRelDistance;\n\n void main() {\n // ignore pixels in the gap\n if (vRelDistance < dashOffset) discard;\n if (mod(vRelDistance - dashOffset, dashSize + gapSize) > dashSize) discard;\n\n // set px color: [r, g, b, a], interpolated between vertices\n gl_FragColor = vColor;\n }\n "},Ly=dA({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},init:function(e,t){Qv(e),t.scene=e,(new Cu).onTick.add((function(e,n){t.pathsData.filter((function(e){return e.__threeObj&&e.__threeObj.children.length&&e.__threeObj.children[0].material&&e.__threeObj.children[0].__dashAnimateStep})).forEach((function(e){var t=e.__threeObj.children[0],r=t.__dashAnimateStep*n;if("Line"===t.type){var i=t.material.uniforms.dashTranslate.value%1e9;t.material.uniforms.dashTranslate.value=i+r}else if("Line2"===t.type){for(var a=t.material.dashOffset-r,o=t.material.dashSize+t.material.gapSize;a<=-o;)a+=o;t.material.dashOffset=a}}))}))},update:function(e){var t=lu(e.pathPoints),n=lu(e.pathPointLat),r=lu(e.pathPointLng),i=lu(e.pathPointAlt),a=lu(e.pathStroke),o=lu(e.pathColor),s=lu(e.pathDashLength),A=lu(e.pathDashGap),l=lu(e.pathDashInitialGap),c=lu(e.pathDashAnimateTime),u=new Sy.ShaderMaterial(Cv(Cv({},Ty),{},{transparent:!0,blending:Sy.NormalBlending}));function h(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=t+1;if(e instanceof Array){var o=Zh().domain(e.map((function(t,n){return n/(e.length-1)}))).range(e);n=function(e){return oy(o(e),i)}}else{var s=oy(e,i);n=function(){return s}}for(var A=i?4:3,l=new Sy.Float32BufferAttribute(a*A*r,A),c=0,u=a;c1&&void 0!==arguments[1]?arguments[1]:1,t=[],n=null;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((function(r){if(n){for(;Math.abs(n[1]-r[1])>180;)n[1]+=360*(n[1]e)for(var o=Math.floor(i/e),s=a(n[0],r[0],o),A=a(n[1],r[1],o),l=a(n[2],r[2],o),c=0,u=s.length;c0?1e3/_:0,m){x.material.resolution=e.rendererSize;var w=s(f),M=A(f),S=l(f);x.material.dashed=M>0,x.material.dashed?x.material.defines.USE_DASH="":delete x.material.defines.USE_DASH,x.material.dashed&&(x.material.dashScale=1/(y=0,b.forEach((function(e){v&&(y+=v.distanceTo(e)),v=e})),y),x.material.dashSize=w,x.material.gapSize=M,x.material.dashOffset=-S);var E=o(f);if(E instanceof Array){var T=h(o(f),b.length-1,1,!1);x.geometry.setColors(T.array),x.material.vertexColors=Sy.VertexColors}else{var L=E,C=ay(L);x.material.color=new Sy.Color(iy(L)),x.material.transparent=C<1,x.material.opacity=C,x.material.vertexColors=Sy.NoColors}x.material.needsUpdate=!0}else{Object.assign(x.material.uniforms,{dashSize:{value:s(f)},gapSize:{value:A(f)},dashOffset:{value:l(f)}});var P=h(o(f),b.length),R=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e+1,i=r*t,a=new Sy.Float32BufferAttribute(i,1),o=0,s=r;o":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},"τ":{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},"ξ":{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},"Λ":{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},"ΰ":{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"Υ":{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},"μ":{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"φ":{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"‘":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},"ϊ":{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},"π":{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},"ά":{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},"κ":{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},"ψ":{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},"η":{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},cssFontWeight:"normal",ascender:1189,underlinePosition:-100,cssFontStyle:"normal",boundingBox:{yMin:-334,xMin:-111,yMax:1189,xMax:1672},resolution:1e3,original_font_information:{postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) Μagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"Μagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:'Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r\n\r\nThe above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r\n\r\nThe Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word "MgOpen", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r\n\r\nThis License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "MgOpen" name.\r\n\r\nThe Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r\n\r\nTHE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.',manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50},Dy=window.THREE?window.THREE:{CircleBufferGeometry:class extends Zt{constructor(e=1,t=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const i=[],a=[],o=[],s=[],A=new Ae,l=new K;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,c=3;i<=t;i++,c+=3){const u=n+i/t*r;A.x=e*Math.cos(u),A.y=e*Math.sin(u),a.push(A.x,A.y,A.z),o.push(0,0,1),l.x=(a[c]/e+1)/2,l.y=(a[c+1]/e+1)/2,s.push(l.x,l.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute("position",new Ut(a,3)),this.setAttribute("normal",new Ut(o,3)),this.setAttribute("uv",new Ut(s,2))}},Font:Ls,Group:Fi,Mesh:pn,MeshLambertMaterial:vo,TextBufferGeometry:class extends uo{constructor(e,t={}){const n=t.font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Zt;const r=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),super(r,t),this.type="TextGeometry"}},Vector3:Ae},Iy=dA({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:0},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:qy,onChange:function(e,t){t.font=new Dy.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t){Qv(e),t.scene=e},update:function(e){var t=lu(e.labelLat),n=lu(e.labelLng),r=lu(e.labelAltitude),i=lu(e.labelText),a=lu(e.labelSize),o=lu(e.labelRotation),s=lu(e.labelColor),A=lu(e.labelIncludeDot),l=lu(e.labelDotRadius),c=lu(e.labelDotOrientation),u=new Set(["right","top","bottom"]),h=2*Math.PI*Xv/360,d=new Dy.CircleBufferGeometry(1,16);sy(e.labelsData,e.scene,{createObj:function(){var e=new Dy.MeshLambertMaterial,t=new Dy.Group;return t.add(new Dy.Mesh(d,e)),t.add(new Dy.Mesh(void 0,e)),t.__globeObjType="label",t},updateObj:function(d,f){var p=Uv(d.children,2),m=p[0],g=p[1],v=s(f),y=ay(v);g.material.color.set(iy(v)),g.material.transparent=y<1,g.material.opacity=y;var x=A(f),b=c(f);!x||!u.has(b)&&(b="bottom");var _=x?+l(f)*h:1e-12;m.scale.x=m.scale.y=_;var w=+a(f)*h;if(g.geometry=new Dy.TextBufferGeometry(i(f),{font:e.font,size:w,height:0,curveSegments:e.labelResolution}),"right"!==b&&g.geometry.center(),x){var M=_+w/2;"right"===b&&(g.position.x=M),g.position.y={right:-w/2,top:M+w/2,bottom:-M-w/2}[b]}var S=function(t){var n=d.__currentTargetD=t,r=n.lat,i=n.lng,a=n.alt,o=n.rot,s=n.scale;Object.assign(d.position,Zv(r,i,a)),d.lookAt(e.scene.localToWorld(new Dy.Vector3(0,0,0))),d.rotateY(Math.PI),d.rotateZ(-o*Math.PI/180),d.scale.x=d.scale.y=d.scale.z=s},E={lat:+t(f),lng:+n(f),alt:+r(f),rot:+o(f),scale:1},T=d.__currentTargetD||Object.assign({},E,{scale:1e-12});Object.keys(E).some((function(e){return T[e]!==E[e]}))&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?S(E):new CA.Tween(T).to(E,e.labelsTransitionDuration).easing(CA.Easing.Quadratic.InOut).onUpdate(S).start())}})}}),By=dA({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){Qv(e),t.scene=e},update:function(e){e.customThreeObjectUpdate||Qv(e.scene);var t=lu(e.customThreeObject),n=lu(e.customThreeObjectUpdate);sy(e.customLayerData,e.scene,{createObj:function(n){var r=t(n,Xv);return r&&(e.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r},updateObj:function(e,t){return n(e,t,Xv)}})}}),ky=window.THREE?window.THREE:{Group:Fi,Vector2:K,Vector3:Ae},Oy=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","labelsLayer","customLayer"],Ny=Yv("globeLayer",ry),zy=Object.assign.apply(Object,Hv(["globeImageUrl","bumpImageUrl","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map((function(e){return Rv({},e,Ny.linkProp(e))})))),Fy=Object.assign.apply(Object,Hv(["globeMaterial"].map((function(e){return Rv({},e,Ny.linkMethod(e))})))),Uy=Yv("pointsLayer",cy),Hy=Object.assign.apply(Object,Hv(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map((function(e){return Rv({},e,Uy.linkProp(e))})))),Gy=Yv("arcsLayer",py),Vy=Object.assign.apply(Object,Hv(["arcsData","arcStartLat","arcStartLng","arcEndLat","arcEndLng","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map((function(e){return Rv({},e,Gy.linkProp(e))})))),jy=Yv("hexBinLayer",vy),Wy=Object.assign.apply(Object,Hv(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map((function(e){return Rv({},e,jy.linkProp(e))})))),Qy=Yv("hexedPolygonsLayer",_y),Yy=Object.assign.apply(Object,Hv(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonCurvatureResolution","hexPolygonsTransitionDuration"].map((function(e){return Rv({},e,Qy.linkProp(e))})))),Xy=Yv("polygonsLayer",xy),Zy=Object.assign.apply(Object,Hv(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map((function(e){return Rv({},e,Xy.linkProp(e))})))),Jy=Yv("pathsLayer",Ly),Ky=Object.assign.apply(Object,Hv(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map((function(e){return Rv({},e,Jy.linkProp(e))})))),$y=Yv("tilesLayer",Py),ex=Object.assign.apply(Object,Hv(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map((function(e){return Rv({},e,$y.linkProp(e))})))),tx=Yv("labelsLayer",Iy),nx=Object.assign.apply(Object,Hv(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map((function(e){return Rv({},e,tx.linkProp(e))})))),rx=Yv("customLayer",By),ix=Object.assign.apply(Object,Hv(["customLayerData","customThreeObject","customThreeObjectUpdate"].map((function(e){return Rv({},e,rx.linkProp(e))}))));var ax=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=function(t){qv(i,t);var r=Fv(i);function i(){var t;Pv(this,i);for(var a=arguments.length,o=new Array(a),s=0;s1?t-1:0),r=1;r1?t-1:0),r=1;r0&&(n.object.isPerspectiveCamera?v.multiplyScalar(e):n.object.isOrthographicCamera?(n.object.zoom/=e,n.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),n.staticMoving?_.copy(w):_.y+=(w.y-_.y)*this.dynamicDampingFactor)},this.panCamera=function(){const e=new K,t=new Ae,r=new Ae;return function(){if(e.copy(S).sub(M),e.lengthSq()){if(n.object.isOrthographicCamera){const t=(n.object.right-n.object.left)/n.object.zoom/n.domElement.clientWidth,r=(n.object.top-n.object.bottom)/n.object.zoom/n.domElement.clientWidth;e.x*=t,e.y*=r}e.multiplyScalar(v.length()*n.panSpeed),r.copy(v).cross(n.object.up).setLength(e.x),r.add(t.copy(n.object.up).setLength(e.y)),n.object.position.add(r),n.target.add(r),n.staticMoving?M.copy(S):M.add(e.subVectors(S,M).multiplyScalar(n.dynamicDampingFactor))}}}(),this.checkDistances=function(){n.noZoom&&n.noPan||(v.lengthSq()>n.maxDistance*n.maxDistance&&(n.object.position.addVectors(n.target,v.setLength(n.maxDistance)),_.copy(w)),v.lengthSq()c&&(n.dispatchEvent(ox),u.copy(n.object.position))):n.object.isOrthographicCamera?(n.object.lookAt(n.target),(u.distanceToSquared(n.object.position)>c||h!==n.object.zoom)&&(n.dispatchEvent(ox),u.copy(n.object.position),h=n.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type")},this.reset=function(){d=r,f=r,n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.up.copy(n.up0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),v.subVectors(n.object.position,n.target),n.object.lookAt(n.target),n.dispatchEvent(ox),u.copy(n.object.position),h=n.object.zoom},this.dispose=function(){n.domElement.removeEventListener("contextmenu",O),n.domElement.removeEventListener("pointerdown",L),n.domElement.removeEventListener("wheel",D),n.domElement.removeEventListener("touchstart",I),n.domElement.removeEventListener("touchend",k),n.domElement.removeEventListener("touchmove",B),n.domElement.ownerDocument.removeEventListener("pointermove",C),n.domElement.ownerDocument.removeEventListener("pointerup",P),window.removeEventListener("keydown",R),window.removeEventListener("keyup",q)},this.domElement.addEventListener("contextmenu",O),this.domElement.addEventListener("pointerdown",L),this.domElement.addEventListener("wheel",D,{passive:!1}),this.domElement.addEventListener("touchstart",I,{passive:!1}),this.domElement.addEventListener("touchend",k),this.domElement.addEventListener("touchmove",B,{passive:!1}),this.domElement.ownerDocument.addEventListener("pointermove",C),this.domElement.ownerDocument.addEventListener("pointerup",P),window.addEventListener("keydown",R),window.addEventListener("keyup",q),this.handleResize(),this.update()}}const cx={type:"change"},ux={type:"start"},hx={type:"end"};class dx extends F{constructor(e,t){super(),void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.enabled=!0,this.target=new Ae,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:o.ROTATE,MIDDLE:o.DOLLY,RIGHT:o.PAN},this.touches={ONE:s,TWO:l},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return u.phi},this.getAzimuthalAngle=function(){return u.theta},this.listenToKeyEvents=function(e){e.addEventListener("keydown",j),this._domElementKeyEvents=e},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(cx),n.update(),i=r.NONE},this.update=function(){const t=new Ae,o=(new se).setFromUnitVectors(e.up,new Ae(0,1,0)),s=o.clone().invert(),A=new Ae,l=new se,c=2*Math.PI;return function(){const e=n.object.position;t.copy(e).sub(n.target),t.applyQuaternion(o),u.setFromVector3(t),n.autoRotate&&i===r.NONE&&E(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(u.theta+=h.theta*n.dampingFactor,u.phi+=h.phi*n.dampingFactor):(u.theta+=h.theta,u.phi+=h.phi);let m=n.minAzimuthAngle,g=n.maxAzimuthAngle;return isFinite(m)&&isFinite(g)&&(m<-Math.PI?m+=c:m>Math.PI&&(m-=c),g<-Math.PI?g+=c:g>Math.PI&&(g-=c),u.theta=m<=g?Math.max(m,Math.min(g,u.theta)):u.theta>(m+g)/2?Math.max(m,u.theta):Math.min(g,u.theta)),u.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,u.phi)),u.makeSafe(),u.radius*=d,u.radius=Math.max(n.minDistance,Math.min(n.maxDistance,u.radius)),!0===n.enableDamping?n.target.addScaledVector(f,n.dampingFactor):n.target.add(f),t.setFromSpherical(u),t.applyQuaternion(s),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(h.theta*=1-n.dampingFactor,h.phi*=1-n.dampingFactor,f.multiplyScalar(1-n.dampingFactor)):(h.set(0,0,0),f.set(0,0,0)),d=1,!!(p||A.distanceToSquared(n.object.position)>a||8*(1-l.dot(n.object.quaternion))>a)&&(n.dispatchEvent(cx),A.copy(n.object.position),l.copy(n.object.quaternion),p=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",X),n.domElement.removeEventListener("pointerdown",U),n.domElement.removeEventListener("wheel",V),n.domElement.removeEventListener("touchstart",W),n.domElement.removeEventListener("touchend",Y),n.domElement.removeEventListener("touchmove",Q),n.domElement.ownerDocument.removeEventListener("pointermove",H),n.domElement.ownerDocument.removeEventListener("pointerup",G),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",j)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=r.NONE;const a=1e-6,u=new Js,h=new Js;let d=1;const f=new Ae;let p=!1;const m=new K,g=new K,v=new K,y=new K,x=new K,b=new K,_=new K,w=new K,M=new K;function S(){return Math.pow(.95,n.zoomSpeed)}function E(e){h.theta-=e}function T(e){h.phi-=e}const L=function(){const e=new Ae;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),f.add(e)}}(),C=function(){const e=new Ae;return function(t,r){!0===n.screenSpacePanning?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),f.add(e)}}(),P=function(){const e=new Ae;return function(t,r){const i=n.domElement;if(n.object.isPerspectiveCamera){const a=n.object.position;e.copy(a).sub(n.target);let o=e.length();o*=Math.tan(n.object.fov/2*Math.PI/180),L(2*t*o/i.clientHeight,n.object.matrix),C(2*r*o/i.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(L(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),C(r*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function R(e){n.object.isPerspectiveCamera?d/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),p=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function q(e){n.object.isPerspectiveCamera?d*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),p=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function D(e){m.set(e.clientX,e.clientY)}function I(e){y.set(e.clientX,e.clientY)}function B(e){if(1==e.touches.length)m.set(e.touches[0].pageX,e.touches[0].pageY);else{const t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);m.set(t,n)}}function k(e){if(1==e.touches.length)y.set(e.touches[0].pageX,e.touches[0].pageY);else{const t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,n)}}function O(e){const t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+n*n);_.set(0,r)}function N(e){if(1==e.touches.length)g.set(e.touches[0].pageX,e.touches[0].pageY);else{const t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);g.set(t,n)}v.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;E(2*Math.PI*v.x/t.clientHeight),T(2*Math.PI*v.y/t.clientHeight),m.copy(g)}function z(e){if(1==e.touches.length)x.set(e.touches[0].pageX,e.touches[0].pageY);else{const t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);x.set(t,n)}b.subVectors(x,y).multiplyScalar(n.panSpeed),P(b.x,b.y),y.copy(x)}function F(e){const t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+r*r);w.set(0,i),M.set(0,Math.pow(w.y/_.y,n.zoomSpeed)),R(M.y),_.copy(w)}function U(e){if(!1!==n.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){let t;switch(e.preventDefault(),n.domElement.focus?n.domElement.focus():window.focus(),e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case o.DOLLY:if(!1===n.enableZoom)return;!function(e){_.set(e.clientX,e.clientY)}(e),i=r.DOLLY;break;case o.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;I(e),i=r.PAN}else{if(!1===n.enableRotate)return;D(e),i=r.ROTATE}break;case o.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;D(e),i=r.ROTATE}else{if(!1===n.enablePan)return;I(e),i=r.PAN}break;default:i=r.NONE}i!==r.NONE&&(n.domElement.ownerDocument.addEventListener("pointermove",H),n.domElement.ownerDocument.addEventListener("pointerup",G),n.dispatchEvent(ux))}(e)}}function H(e){if(!1!==n.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){if(!1===n.enabled)return;switch(e.preventDefault(),i){case r.ROTATE:if(!1===n.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),v.subVectors(g,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;E(2*Math.PI*v.x/t.clientHeight),T(2*Math.PI*v.y/t.clientHeight),m.copy(g),n.update()}(e);break;case r.DOLLY:if(!1===n.enableZoom)return;!function(e){w.set(e.clientX,e.clientY),M.subVectors(w,_),M.y>0?R(S()):M.y<0&&q(S()),_.copy(w),n.update()}(e);break;case r.PAN:if(!1===n.enablePan)return;!function(e){x.set(e.clientX,e.clientY),b.subVectors(x,y).multiplyScalar(n.panSpeed),P(b.x,b.y),y.copy(x),n.update()}(e)}}(e)}}function G(e){switch(e.pointerType){case"mouse":case"pen":!function(e){if(n.domElement.ownerDocument.removeEventListener("pointermove",H),n.domElement.ownerDocument.removeEventListener("pointerup",G),!1===n.enabled)return;n.dispatchEvent(hx),i=r.NONE}()}}function V(e){!1===n.enabled||!1===n.enableZoom||i!==r.NONE&&i!==r.ROTATE||(e.preventDefault(),n.dispatchEvent(ux),function(e){e.deltaY<0?q(S()):e.deltaY>0&&R(S()),n.update()}(e),n.dispatchEvent(hx))}function j(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:P(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:P(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:P(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:P(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function W(e){if(!1!==n.enabled){switch(e.preventDefault(),e.touches.length){case 1:switch(n.touches.ONE){case s:if(!1===n.enableRotate)return;B(e),i=r.TOUCH_ROTATE;break;case A:if(!1===n.enablePan)return;k(e),i=r.TOUCH_PAN;break;default:i=r.NONE}break;case 2:switch(n.touches.TWO){case l:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&O(e),n.enablePan&&k(e)}(e),i=r.TOUCH_DOLLY_PAN;break;case c:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&O(e),n.enableRotate&&B(e)}(e),i=r.TOUCH_DOLLY_ROTATE;break;default:i=r.NONE}break;default:i=r.NONE}i!==r.NONE&&n.dispatchEvent(ux)}}function Q(e){if(!1!==n.enabled)switch(e.preventDefault(),i){case r.TOUCH_ROTATE:if(!1===n.enableRotate)return;N(e),n.update();break;case r.TOUCH_PAN:if(!1===n.enablePan)return;z(e),n.update();break;case r.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&F(e),n.enablePan&&z(e)}(e),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&F(e),n.enableRotate&&N(e)}(e),n.update();break;default:i=r.NONE}}function Y(e){!1!==n.enabled&&(n.dispatchEvent(hx),i=r.NONE)}function X(e){!1!==n.enabled&&e.preventDefault()}n.domElement.addEventListener("contextmenu",X),n.domElement.addEventListener("pointerdown",U),n.domElement.addEventListener("wheel",V,{passive:!1}),n.domElement.addEventListener("touchstart",W,{passive:!1}),n.domElement.addEventListener("touchend",Y),n.domElement.addEventListener("touchmove",Q,{passive:!1}),this.update()}}const fx={type:"change"};class px extends F{constructor(e,t){super(),void 0===t&&(console.warn('THREE.FlyControls: The second parameter "domElement" is now mandatory.'),t=document),this.object=e,this.domElement=t,this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1;const n=this,r=1e-6,i=new se,a=new Ae;this.tmpQuaternion=new se,this.mouseStatus=0,this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this.moveVector=new Ae(0,0,0),this.rotationVector=new Ae(0,0,0),this.keydown=function(e){if(!e.altKey){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this.moveState.forward=1;break;case"KeyS":this.moveState.back=1;break;case"KeyA":this.moveState.left=1;break;case"KeyD":this.moveState.right=1;break;case"KeyR":this.moveState.up=1;break;case"KeyF":this.moveState.down=1;break;case"ArrowUp":this.moveState.pitchUp=1;break;case"ArrowDown":this.moveState.pitchDown=1;break;case"ArrowLeft":this.moveState.yawLeft=1;break;case"ArrowRight":this.moveState.yawRight=1;break;case"KeyQ":this.moveState.rollLeft=1;break;case"KeyE":this.moveState.rollRight=1}this.updateMovementVector(),this.updateRotationVector()}},this.keyup=function(e){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this.moveState.forward=0;break;case"KeyS":this.moveState.back=0;break;case"KeyA":this.moveState.left=0;break;case"KeyD":this.moveState.right=0;break;case"KeyR":this.moveState.up=0;break;case"KeyF":this.moveState.down=0;break;case"ArrowUp":this.moveState.pitchUp=0;break;case"ArrowDown":this.moveState.pitchDown=0;break;case"ArrowLeft":this.moveState.yawLeft=0;break;case"ArrowRight":this.moveState.yawRight=0;break;case"KeyQ":this.moveState.rollLeft=0;break;case"KeyE":this.moveState.rollRight=0}this.updateMovementVector(),this.updateRotationVector()},this.mousedown=function(e){if(this.domElement!==document&&this.domElement.focus(),e.preventDefault(),this.dragToLook)this.mouseStatus++;else{switch(e.button){case 0:this.moveState.forward=1;break;case 2:this.moveState.back=1}this.updateMovementVector()}},this.mousemove=function(e){if(!this.dragToLook||this.mouseStatus>0){const t=this.getContainerDimensions(),n=t.size[0]/2,r=t.size[1]/2;this.moveState.yawLeft=-(e.pageX-t.offset[0]-n)/n,this.moveState.pitchDown=(e.pageY-t.offset[1]-r)/r,this.updateRotationVector()}},this.mouseup=function(e){if(e.preventDefault(),this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else{switch(e.button){case 0:this.moveState.forward=0;break;case 2:this.moveState.back=0}this.updateMovementVector()}this.updateRotationVector()},this.update=function(e){const t=e*n.movementSpeed,o=e*n.rollSpeed;n.object.translateX(n.moveVector.x*t),n.object.translateY(n.moveVector.y*t),n.object.translateZ(n.moveVector.z*t),n.tmpQuaternion.set(n.rotationVector.x*o,n.rotationVector.y*o,n.rotationVector.z*o,1).normalize(),n.object.quaternion.multiply(n.tmpQuaternion),(a.distanceToSquared(n.object.position)>r||8*(1-i.dot(n.object.quaternion))>r)&&(n.dispatchEvent(fx),i.copy(n.object.quaternion),a.copy(n.object.position))},this.updateMovementVector=function(){const e=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right,this.moveVector.y=-this.moveState.down+this.moveState.up,this.moveVector.z=-e+this.moveState.back},this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp,this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft,this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft},this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}},this.dispose=function(){this.domElement.removeEventListener("contextmenu",mx),this.domElement.removeEventListener("mousedown",s),this.domElement.removeEventListener("mousemove",o),this.domElement.removeEventListener("mouseup",A),window.removeEventListener("keydown",l),window.removeEventListener("keyup",c)};const o=this.mousemove.bind(this),s=this.mousedown.bind(this),A=this.mouseup.bind(this),l=this.keydown.bind(this),c=this.keyup.bind(this);this.domElement.addEventListener("contextmenu",mx),this.domElement.addEventListener("mousemove",o),this.domElement.addEventListener("mousedown",s),this.domElement.addEventListener("mouseup",A),window.addEventListener("keydown",l),window.addEventListener("keyup",c),this.updateMovementVector(),this.updateRotationVector()}}function mx(e){e.preventDefault()}var gx={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\t\t}"};class vx{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}const yx=new xs(-1,1,1,-1,0,1),xx=new Zt;xx.setAttribute("position",new Ut([-1,3,0,-1,-1,0,3,-1,0],3)),xx.setAttribute("uv",new Ut([0,2,0,0,2,0],2));class bx{constructor(e){this._mesh=new pn(xx,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,yx)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class _x extends vx{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof bn?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=xn.clone(e.uniforms),this.material=new bn({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new bx(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}}class wx extends vx{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),i=e.state;let a,o;i.buffers.color.setMask(!1),i.buffers.depth.setMask(!1),i.buffers.color.setLocked(!0),i.buffers.depth.setLocked(!0),this.inverse?(a=0,o=1):(a=1,o=0),i.buffers.stencil.setTest(!0),i.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),i.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),i.buffers.stencil.setClear(o),i.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),i.buffers.color.setLocked(!1),i.buffers.depth.setLocked(!1),i.buffers.stencil.setLocked(!1),i.buffers.stencil.setFunc(r.EQUAL,1,4294967295),i.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),i.buffers.stencil.setLocked(!0)}}class Mx extends vx{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Sx{constructor(e,t){if(this.renderer=e,void 0===t){const n={minFilter:m,magFilter:m,format:S},r=e.getSize(new K);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,(t=new oe(this._width*this._pixelRatio,this._height*this._pixelRatio,n)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===gx&&console.error("THREE.EffectComposer relies on CopyShader"),void 0===_x&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new _x(gx),this.clock=new Ds}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t1?r-1:0),a=1;a=0&&i<1?(s=a,A=o):i>=1&&i<2?(s=o,A=a):i>=2&&i<3?(A=a,l=o):i>=3&&i<4?(A=o,l=a):i>=4&&i<5?(s=o,l=a):i>=5&&i<6&&(s=a,l=o);var c=n-a/2;return r(s+c,A+c,l+c)}var Ux={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",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:"ff00ff",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:"639",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"};var Hx=/^#[a-fA-F0-9]{6}$/,Gx=/^#[a-fA-F0-9]{8}$/,Vx=/^#[a-fA-F0-9]{3}$/,jx=/^#[a-fA-F0-9]{4}$/,Wx=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,Qx=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i,Yx=/^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Xx=/^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;function Zx(e){if("string"!=typeof e)throw new Ox(3);var t=function(e){if("string"!=typeof e)return e;var t=e.toLowerCase();return Ux[t]?"#"+Ux[t]:e}(e);if(t.match(Hx))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(Gx)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(Vx))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(jx)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var i=Wx.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10)};var a=Qx.exec(t.substring(0,50));if(a)return{red:parseInt(""+a[1],10),green:parseInt(""+a[2],10),blue:parseInt(""+a[3],10),alpha:parseFloat(""+a[4])};var o=Yx.exec(t);if(o){var s="rgb("+Fx(parseInt(""+o[1],10),parseInt(""+o[2],10)/100,parseInt(""+o[3],10)/100)+")",A=Wx.exec(s);if(!A)throw new Ox(4,t,s);return{red:parseInt(""+A[1],10),green:parseInt(""+A[2],10),blue:parseInt(""+A[3],10)}}var l=Xx.exec(t.substring(0,50));if(l){var c="rgb("+Fx(parseInt(""+l[1],10),parseInt(""+l[2],10)/100,parseInt(""+l[3],10)/100)+")",u=Wx.exec(c);if(!u)throw new Ox(4,t,c);return{red:parseInt(""+u[1],10),green:parseInt(""+u[2],10),blue:parseInt(""+u[3],10),alpha:parseFloat(""+l[4])}}throw new Ox(5)}var Jx=function(e){return 7===e.length&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e};function Kx(e){var t=e.toString(16);return 1===t.length?"0"+t:t}function $x(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return Jx("#"+Kx(e)+Kx(t)+Kx(n));if("object"==typeof e&&void 0===t&&void 0===n)return Jx("#"+Kx(e.red)+Kx(e.green)+Kx(e.blue));throw new Ox(6)}function eb(e,t,n){return function(){var r=n.concat(Array.prototype.slice.call(arguments));return r.length>=t?e.apply(this,r):eb(e,t,r)}}function tb(e){return eb(e,e.length,[])}function nb(e,t){if("transparent"===t)return t;var n,r,i,a=Zx(t),o="number"==typeof a.alpha?a.alpha:1;return function(e,t,n,r){if("string"==typeof e&&"number"==typeof t){var i=Zx(e);return"rgba("+i.red+","+i.green+","+i.blue+","+t+")"}if("number"==typeof e&&"number"==typeof t&&"number"==typeof n&&"number"==typeof r)return r>=1?$x(e,t,n):"rgba("+e+","+t+","+n+","+r+")";if("object"==typeof e&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?$x(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new Ox(7)}(Lx({},a,{alpha:(n=0,r=1,i=(100*o+100*parseFloat(e))/100,Math.max(n,Math.min(r,i)))}))}var rb=tb(nb);function ib(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ab(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||sb(e,t)||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 ob(e){return function(e){if(Array.isArray(e))return Ab(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||sb(e)||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 sb(e,t){if(e){if("string"==typeof e)return Ab(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ab(e,t):void 0}}function Ab(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,r=arguments.length,i=new Array(r>3?r-3:0),a=3;a2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=e.camera;if(t){var a=new lb.Vector3(0,0,0),o=2*Math.max.apply(Math,ob(Object.entries(t).map((function(e){var t=ab(e,2),n=t[0],r=t[1];return Math.max.apply(Math,ob(r.map((function(e){return Math.abs(a[n]-e)}))))})))),s=(1-2*r/e.height)*i.fov,A=o/Math.atan(s*Math.PI/180),l=A/i.aspect,c=Math.max(A,l);if(c>0){var u=a.clone().sub(i.position).normalize().multiplyScalar(-c);this.cameraPosition(u,a,n)}}return this},getBbox:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0},n=new lb.Box3(new lb.Vector3(0,0,0),new lb.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach((function(e){return n.expandByObject(e)})),Object.assign.apply(Object,ob(["x","y","z"].map((function(e){return ib({},e,[n.min[e],n.max[e]])}))))):null},getScreenCoords:function(e,t,n,r){var i=new lb.Vector3(t,n,r);return i.project(this.camera()),{x:(i.x+1)*e.width/2,y:-(i.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=new lb.Vector2(t/e.width*2-1,-n/e.height*2+1),a=new lb.Raycaster;return a.setFromCamera(i,e.camera),Object.assign({},a.ray.at(r,new lb.Vector3))},intersectingObjects:function(e,t,n){var r=new lb.Vector2(t/e.width*2-1,-n/e.height*2+1),i=new lb.Raycaster;return i.params.Line.threshold=e.lineHoverPrecision,i.setFromCamera(r,e.camera),i.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls}},stateInit:function(){return{scene:new lb.Scene,camera:new lb.PerspectiveCamera,clock:new lb.Clock}},init:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.controlType,i=void 0===r?"trackball":r,a=n.rendererConfig,o=void 0===a?{}:a,s=n.extraRenderers,A=void 0===s?[]:s,l=n.waitForLoadComplete,c=void 0===l||l;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[i]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.toolTipElem=document.createElement("div"),t.toolTipElem.classList.add("scene-tooltip"),t.container.appendChild(t.toolTipElem),t.pointerPos=new lb.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach((function(e){return t.container.addEventListener(e,(function(n){if("pointerdown"===e&&(t.isPointerPressed=!0),!t.isPointerDragging&&"pointermove"===n.type&&(n.pressure>0||t.isPointerPressed)&&("touch"!==n.pointerType||void 0===n.movementX||[n.movementX,n.movementY].some((function(e){return Math.abs(e)>1})))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var r=(i=t.container,a=i.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,s=window.pageYOffset||document.documentElement.scrollTop,{top:a.top+s,left:a.left+o});t.pointerPos.x=n.pageX-r.left,t.pointerPos.y=n.pageY-r.top,t.toolTipElem.style.top="".concat(t.pointerPos.y,"px"),t.toolTipElem.style.left="".concat(t.pointerPos.x,"px"),t.toolTipElem.style.transform="translate(-".concat(t.pointerPos.x/t.width*100,"%, 21px)")}var i,a,o,s}),{passive:!0})})),t.container.addEventListener("pointerup",(function(e){t.isPointerPressed=!1,t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag)||requestAnimationFrame((function(){0===e.button&&t.onClick(t.hoverObj||null,e,t.intersectionPoint),2===e.button&&t.onRightClick&&t.onRightClick(t.hoverObj||null,e,t.intersectionPoint)}))}),{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",(function(e){t.onRightClick&&e.preventDefault()})),t.renderer=new lb.WebGLRenderer(Object.assign({antialias:!0,alpha:!0},o)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=A,t.extraRenderers.forEach((function(e){e.domElement.style.position="absolute",e.domElement.style.top="0px",e.domElement.style.pointerEvents="none",t.container.appendChild(e.domElement)})),t.postProcessingComposer=new Sx(t.renderer),t.postProcessingComposer.addPass(new Tx(t.scene,t.camera)),t.controls=new{trackball:lx,orbit:dx,fly:px}[i](t.camera,t.renderer.domElement),"fly"===i&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),"trackball"!==i&&"orbit"!==i||(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",(function(){t.controlsEngaged=!0})),t.controls.addEventListener("change",(function(){t.controlsEngaged&&(t.controlsDragging=!0)})),t.controls.addEventListener("end",(function(){t.controlsEngaged=!1,t.controlsDragging=!1}))),[t.renderer,t.postProcessingComposer].concat(ob(t.extraRenderers)).forEach((function(e){return e.setSize(t.width,t.height)})),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new lb.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!c,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&(e.container.style.width=e.width,e.container.style.height=e.height,[e.renderer,e.postProcessingComposer].concat(ob(e.extraRenderers)).forEach((function(t){return t.setSize(e.width,e.height)})),e.camera.aspect=e.width/e.height,e.camera.updateProjectionMatrix()),t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=e.skyRadius),e.camera.far=2.5*e.skyRadius,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new lb.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var n=Zx(e.backgroundColor).alpha;void 0===n&&(n=1),e.renderer.setClearColor(new lb.Color(rb(1,e.backgroundColor)),n)}function r(){e.loadComplete=e.scene.visible=!0}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?(new lb.TextureLoader).load(e.backgroundImageUrl,(function(t){e.skysphere.material=new lb.MeshBasicMaterial({map:t,side:lb.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&r()})):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&r())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("objects")&&((t.objects||[]).forEach((function(t){return e.scene.remove(t)})),e.objects.forEach((function(t){return e.scene.add(t)})))}});function ub(e,t){var n=new t;return{linkProp:function(t){return{default:n[t](),onChange:function(n,r){r[e][t](n)},triggerUpdate:!1}},linkMethod:function(t){return function(n){for(var r=n[e],i=arguments.length,a=new Array(i>1?i-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=a();if(void 0===t.lat&&void 0===t.lng&&void 0===t.altitude)return r;var i=Object.assign({},r,t);if(n){for(;r.lng-i.lng>180;)r.lng-=360;for(;r.lng-i.lng<-180;)r.lng+=360;new CA.Tween(r).to(i,n).easing(CA.Easing.Cubic.InOut).onUpdate(o).start()}else o(i);return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function o(t){var n=t.lat,r=t.lng,i=t.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(n,r,i))}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i