diff --git a/swift/out/404.html b/swift/out/404.html index 4376fc6..2c2fba6 100644 --- a/swift/out/404.html +++ b/swift/out/404.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/swift/out/_next/static/4505raTMHe4w9sCJLnohk/_buildManifest.js b/swift/out/_next/static/ZX1sTzohLtiVa-IXJZPX-/_buildManifest.js similarity index 79% rename from swift/out/_next/static/4505raTMHe4w9sCJLnohk/_buildManifest.js rename to swift/out/_next/static/ZX1sTzohLtiVa-IXJZPX-/_buildManifest.js index 6b195de..1b1dfa2 100644 --- a/swift/out/_next/static/4505raTMHe4w9sCJLnohk/_buildManifest.js +++ b/swift/out/_next/static/ZX1sTzohLtiVa-IXJZPX-/_buildManifest.js @@ -1 +1 @@ -self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/css/891db4ca6fc7f160.css","static/chunks/pages/index-0723cc3b940b78c7.js"],"/_error":["static/chunks/pages/_error-e4f561a102d9bb14.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file +self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/css/891db4ca6fc7f160.css","static/chunks/pages/index-dfc37f867ce37dd8.js"],"/_error":["static/chunks/pages/_error-e4f561a102d9bb14.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/swift/out/_next/static/4505raTMHe4w9sCJLnohk/_ssgManifest.js b/swift/out/_next/static/ZX1sTzohLtiVa-IXJZPX-/_ssgManifest.js similarity index 100% rename from swift/out/_next/static/4505raTMHe4w9sCJLnohk/_ssgManifest.js rename to swift/out/_next/static/ZX1sTzohLtiVa-IXJZPX-/_ssgManifest.js diff --git a/swift/out/_next/static/chunks/pages/index-0723cc3b940b78c7.js b/swift/out/_next/static/chunks/pages/index-dfc37f867ce37dd8.js similarity index 90% rename from swift/out/_next/static/chunks/pages/index-0723cc3b940b78c7.js rename to swift/out/_next/static/chunks/pages/index-dfc37f867ce37dd8.js index e1b66eb..731b64d 100644 --- a/swift/out/_next/static/chunks/pages/index-0723cc3b940b78c7.js +++ b/swift/out/_next/static/chunks/pages/index-dfc37f867ce37dd8.js @@ -1,4 +1,4 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{8312:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(1056)}])},1056:function(e,t,n){"use strict";let r,i,a,s,o,l,u,c,h,d,p;n.r(t),n.d(t,{default:function(){return dY}});var f,m,g,v,y,x=n(5893),_=n(9008),b=n.n(_),w=n(8122),S=n.n(w),M=n(7294),T=n(745),E=function(){return(E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n>8&255]+D[e>>16&255]+D[e>>24&255]+"-"+D[255&t]+D[t>>8&255]+"-"+D[t>>16&15|64]+D[t>>24&255]+"-"+D[63&n|128]+D[n>>8&255]+"-"+D[n>>16&255]+D[n>>24&255]+D[255&r]+D[r>>8&255]+D[r>>16&255]+D[r>>24&255];return i.toLowerCase()}function U(e,t,n){return Math.max(t,Math.min(n,e))}function B(e,t){return(e%t+t)%t}function H(e,t,n){return(1-n)*e+n*t}function G(e){return(e&e-1)==0&&0!==e}function V(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function W(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function j(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function q(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}var X=Object.freeze({__proto__:null,DEG2RAD:O,RAD2DEG:z,ceilPowerOfTwo:V,clamp:U,damp:function(e,t,n,r){return H(e,t,1-Math.exp(-n*r))},degToRad:function(e){return e*O},denormalize:j,euclideanModulo:B,floorPowerOfTwo:W,generateUUID:F,inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},isPowerOfTwo:G,lerp:H,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},normalize:q,pingpong:function(e,t=1){return t-Math.abs(B(e,2*t)-t)},radToDeg:function(e){return e*z},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},seededRandom:function(e){void 0!==e&&(k=e);let t=k+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},setQuaternionFromProperEuler:function(e,t,n,r,i){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+r)/2),c=s((t+r)/2),h=a((t-r)/2),d=s((t-r)/2),p=a((r-t)/2),f=s((r-t)/2);switch(i){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)}});class Y{constructor(e=0,t=0){Y.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let 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){let 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(){let e=Math.atan2(-this.y,-this.x)+Math.PI;return e}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let 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}*[Symbol.iterator](){yield this.x,yield this.y}}class Z{constructor(){Z.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,n,r,i,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=r,u[2]=s,u[3]=t,u[4]=i,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,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){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],_=r[2],b=r[5],w=r[8];return i[0]=a*f+s*v+o*_,i[3]=a*m+s*y+o*b,i[6]=a*g+s*x+o*w,i[1]=l*f+u*v+c*_,i[4]=l*m+u*y+c*b,i[7]=l*g+u*x+c*w,i[2]=h*f+d*v+p*_,i[5]=h*m+d*y+p*b,i[8]=h*g+d*x+p*w,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*i*u+n*s*o+r*i*l-r*a*o}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*i,d=l*i-a*o,p=t*c+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(r*l-u*n)*f,e[2]=(s*n-r*a)*f,e[3]=h*f,e[4]=(u*t-r*o)*f,e[5]=(r*i-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*i)*f,this}transpose(){let e;let t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,s){let o=Math.cos(i),l=Math.sin(i);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-r*l,r*o,-r*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(J.makeScale(e,t)),this}rotate(e){return this.premultiply(J.makeRotation(-e)),this}translate(e,t){return this.premultiply(J.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let 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){let 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 J=new Z;function K(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let Q={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function $(e,t){return new Q[e](t)}function ee(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function et(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function en(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let er={[R]:{[P]:et},[P]:{[R]:en}},ei={legacyMode:!0,get workingColorSpace(){return P},set workingColorSpace(colorSpace){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(er[t]&&void 0!==er[t][n]){let r=er[t][n];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},ea={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},es={r:0,g:0,b:0},eo={h:0,s:0,l:0},el={h:0,s:0,l:0};function eu(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}function ec(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}class eh{constructor(e,t,n){if(this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===t&&void 0===n)return this.set(e);return 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,t=R){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,ei.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=ei.workingColorSpace){return this.r=e,this.g=t,this.b=n,ei.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=ei.workingColorSpace){if(e=B(e,1),t=U(t,0,1),n=U(n,0,1),0===t)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=eu(i,r,e+1/3),this.g=eu(i,r,e),this.b=eu(i,r,e-1/3)}return ei.toWorkingColorSpace(this,r),this}setStyle(e,t=R){let n;function r(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;let i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,ei.toWorkingColorSpace(this,t),r(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,ei.toWorkingColorSpace(this,t),r(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){let n=parseFloat(e[1])/360,i=parseFloat(e[2])/100,a=parseFloat(e[3])/100;return r(e[4]),this.setHSL(n,i,a,t)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let e=n[1],r=e.length;if(3===r)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,ei.toWorkingColorSpace(this,t),this;if(6===r)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,ei.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=R){let n=ea[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=et(e.r),this.g=et(e.g),this.b=et(e.b),this}copyLinearToSRGB(e){return this.r=en(e.r),this.g=en(e.g),this.b=en(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=R){return ei.fromWorkingColorSpace(ec(this,es),e),U(255*es.r,0,255)<<16^U(255*es.g,0,255)<<8^U(255*es.b,0,255)<<0}getHexString(e=R){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ei.workingColorSpace){let n,r;ei.fromWorkingColorSpace(ec(this,es),t);let i=es.r,a=es.g,s=es.b,o=Math.max(i,a,s),l=Math.min(i,a,s),u=(l+o)/2;if(l===o)n=0,r=0;else{let e=o-l;switch(r=u<=.5?e/(o+l):e/(2-o-l),o){case i:n=(a-s)/e+(a2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=ee("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}eg.DEFAULT_IMAGE=null,eg.DEFAULT_MAPPING=300,eg.DEFAULT_ANISOTROPY=1;class ev{constructor(e=0,t=0,n=0,r=1){ev.prototype.isVector4=!0,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 Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let 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);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r;let i=e.elements,a=i[0],s=i[4],o=i[8],l=i[1],u=i[5],c=i[9],h=i[2],d=i[6],p=i[10];if(.01>Math.abs(s-l)&&.01>Math.abs(o-h)&&.01>Math.abs(c-d)){if(.1>Math.abs(s+l)&&.1>Math.abs(o+h)&&.1>Math.abs(c+d)&&.1>Math.abs(a+u+p-3))return this.set(1,0,0,0),this;let e=(a+1)/2,i=(u+1)/2,f=(p+1)/2,m=(s+l)/4,g=(o+h)/4,v=(c+d)/4;return e>i&&e>f?e<.01?(t=0,n=.707106781,r=.707106781):(n=m/(t=Math.sqrt(e)),r=g/t):i>f?i<.01?(t=.707106781,n=0,r=.707106781):(t=m/(n=Math.sqrt(i)),r=v/n):f<.01?(t=.707106781,n=.707106781,r=0):(t=g/(r=Math.sqrt(f)),n=v/r),this.set(t,n,r,Math.PI),this}let f=Math.sqrt((d-c)*(d-c)+(o-h)*(o-h)+(l-s)*(l-s));return .001>Math.abs(f)&&(f=1),this.x=(d-c)/f,this.y=(o-h)/f,this.z=(l-s)/f,this.w=Math.acos((a+u+p-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let 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.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ey extends N{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ev(0,0,e,t),this.scissorTest=!1,this.viewport=new ev(0,0,e,t),this.texture=new eg({width:e,height:t,depth:1},n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null,this.samples=void 0!==n.samples?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new ep(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ex extends eg{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class e_ extends eg{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class eb{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,s){let o=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(1===s){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==h||l!==d||u!==p){let e=1-s,t=o*h+l*d+u*p+c*f,n=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,s=Math.sin(s*a)/i}let i=s*n;if(o=o*e+h*i,l=l*e+d*i,u=u*e+p*i,c=c*e+f*i,e===1-s){let e=1/Math.sqrt(o*o+l*l+u*u+c*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,r,i,a){let s=n[r],o=n[r+1],l=n[r+2],u=n[r+3],c=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,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){let n=e._x,r=e._y,i=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(r/2),c=s(i/2),h=o(n/2),d=o(r/2),p=o(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let 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){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){let e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(i-l)*e,this._z=(a-r)*e}else if(n>s&&n>c){let e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-n-c);this._w=(i-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+c-n-s);this._w=(a-r)/e,this._x=(i+l)/e,this._y=(o+u)/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(U(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);return 0===n||this.slerp(e,Math.min(1,t/n)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+r*l-i*o,this._y=r*u+a*o+i*s-n*l,this._z=i*u+a*l+n*o-r*s,this._w=a*u-n*s-r*o-i*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,s=a*e._w+n*e._x+r*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(o),u=Math.atan2(l,s),c=Math.sin((1-t)*u)/l,h=Math.sin(t*u)/l;return this._w=a*c+this._w*h,this._x=n*c+this._x*h,this._y=r*c+this._y*h,this._z=i*c+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(i),n*Math.cos(i),t*Math.sin(r))}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(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ew{constructor(e=0,t=0,n=0){ew.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(eM.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(eM.setFromAxisAngle(e,t))}applyMatrix3(e){let 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){let 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){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,s=e.z,o=e.w,l=o*t+a*r-s*n,u=o*n+s*t-i*r,c=o*r+i*n-a*t,h=-i*t-a*n-s*r;return this.x=l*o+-(h*i)+-(u*s)- -(c*a),this.y=u*o+-(h*a)+-(c*i)- -(l*s),this.z=c*o+-(h*s)+-(l*a)- -(u*i),this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,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){let 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){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,s=t.y,o=t.z;return this.x=r*o-i*s,this.y=i*a-n*o,this.z=n*s-r*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return eS.copy(this).projectOnVector(e),this.sub(eS)}reflect(e){return this.sub(eS.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(U(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let 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){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),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)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let eS=new ew,eM=new eb;class eT{constructor(e=new ew(Infinity,Infinity,Infinity),t=new ew(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=Infinity,n=Infinity,r=Infinity,i=-1/0,a=-1/0,s=-1/0;for(let o=0,l=e.length;oi&&(i=l),u>a&&(a=u),c>s&&(s=c)}return this.min.set(t,n,r),this.max.set(i,a,s),this}setFromBufferAttribute(e){let t=Infinity,n=Infinity,r=Infinity,i=-1/0,a=-1/0,s=-1/0;for(let o=0,l=e.count;oi&&(i=l),u>a&&(a=u),c>s&&(s=c)}return this.min.set(t,n,r),this.max.set(i,a,s),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 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,eA),eA.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(ek),eO.subVectors(this.max,ek),eL.subVectors(e.a,ek),eR.subVectors(e.b,ek),eP.subVectors(e.c,ek),eI.subVectors(eR,eL),eN.subVectors(eP,eR),eD.subVectors(eL,eP);let t=[0,-eI.z,eI.y,0,-eN.z,eN.y,0,-eD.z,eD.y,eI.z,0,-eI.x,eN.z,0,-eN.x,eD.z,0,-eD.x,-eI.y,eI.x,0,-eN.y,eN.x,0,-eD.y,eD.x,0];return!!(eU(t,eL,eR,eP,eO)&&eU(t=[1,0,0,0,1,0,0,0,1],eL,eR,eP,eO))&&(ez.crossVectors(eI,eN),eU(t=[ez.x,ez.y,ez.z],eL,eR,eP,eO))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){let t=eA.copy(e).clamp(this.min,this.max);return t.sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(eA).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()||(eE[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),eE[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),eE[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),eE[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),eE[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),eE[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),eE[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),eE[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(eE)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}let eE=[new ew,new ew,new ew,new ew,new ew,new ew,new ew,new ew],eA=new ew,eC=new eT,eL=new ew,eR=new ew,eP=new ew,eI=new ew,eN=new ew,eD=new ew,ek=new ew,eO=new ew,ez=new ew,eF=new ew;function eU(e,t,n,r,i){for(let a=0,s=e.length-3;a<=s;a+=3){eF.fromArray(e,a);let s=i.x*Math.abs(eF.x)+i.y*Math.abs(eF.y)+i.z*Math.abs(eF.z),o=t.dot(eF),l=n.dot(eF),u=r.dot(eF);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let eB=new eT,eH=new ew,eG=new ew;class eV{constructor(e=new ew,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):eB.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 this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;eH.subVectors(e,this.center);let t=eH.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(eH,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(eG.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(eH.copy(e.center).add(eG)),this.expandByPoint(eH.copy(e.center).sub(eG))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}let eW=new ew,ej=new ew,eq=new ew,eX=new ew,eY=new ew,eZ=new ew,eJ=new ew;class eK{constructor(e=new ew,t=new ew(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.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,eW)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let 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){let t=eW.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(eW.copy(this.direction).multiplyScalar(t).add(this.origin),eW.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){let i,a,s,o;ej.copy(e).add(t).multiplyScalar(.5),eq.copy(t).sub(e).normalize(),eX.copy(this.origin).sub(ej);let l=.5*e.distanceTo(t),u=-this.direction.dot(eq),c=eX.dot(this.direction),h=-eX.dot(eq),d=eX.lengthSq(),p=Math.abs(1-u*u);if(p>0){if(i=u*h-c,a=u*c-h,o=l*p,i>=0){if(a>=-o){if(a<=o){let e=1/p;i*=e,a*=e,s=i*(i+u*a+2*c)+a*(u*i+a+2*h)+d}else s=-(i=Math.max(0,-(u*(a=l)+c)))*i+a*(a+2*h)+d}else s=-(i=Math.max(0,-(u*(a=-l)+c)))*i+a*(a+2*h)+d}else a<=-o?(a=(i=Math.max(0,-(-u*l+c)))>0?-l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d):a<=o?(i=0,s=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):(a=(i=Math.max(0,-(u*l+c)))>0?l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d)}else a=u>0?-l:l,s=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(eq).multiplyScalar(a).add(ej),s}intersectSphere(e,t){eW.subVectors(e.center,this.origin);let n=eW.dot(this.direction),r=eW.dot(eW)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),s=n-a,o=n+a;return s<0&&o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(0===t)return!0;let n=e.normal.dot(this.direction);return n*t<0}intersectBox(e,t){let n,r,i,a,s,o;let l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return(l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(i=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||i>r)?null:((i>n||isNaN(n))&&(n=i),(a=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>r)?null:((s>n||n!=n)&&(n=s),(o=0?n:r,t)}intersectsBox(e){return null!==this.intersectBox(e,eW)}intersectTriangle(e,t,n,r,i){let a;eY.subVectors(t,e),eZ.subVectors(n,e),eJ.crossVectors(eY,eZ);let s=this.direction.dot(eJ);if(s>0){if(r)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}eX.subVectors(this.origin,e);let o=a*this.direction.dot(eZ.crossVectors(eX,eZ));if(o<0)return null;let l=a*this.direction.dot(eY.cross(eX));if(l<0||o+l>s)return null;let u=-a*eX.dot(eJ);return u<0?null:this.at(u/s,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class eQ{constructor(){eQ.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new eQ().fromArray(this.elements)}copy(e){let 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){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,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){let t=this.elements,n=e.elements,r=1/e$.setFromMatrixColumn(e,0).length(),i=1/e$.setFromMatrixColumn(e,1).length(),a=1/e$.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){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-s*o,t[2]=i-e*l,t[6]=r+n*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e+i*s,t[4]=r*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-r,t[6]=i+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e-i*s,t[4]=-a*c,t[8]=r+n*s,t[1]=n+r*s,t[5]=a*u,t[9]=i-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=r*l-n,t[8]=e*l+i,t[1]=o*c,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=i-e*c,t[8]=r*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+r,t[10]=e-i*c}else if("XZY"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+i,t[5]=a*u,t[9]=n*c-r,t[2]=r*c-n,t[6]=s*u,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(e1,e,e3)}lookAt(e,t,n){let r=this.elements;return e5.subVectors(e,t),0===e5.lengthSq()&&(e5.z=1),e5.normalize(),e2.crossVectors(n,e5),0===e2.lengthSq()&&(1===Math.abs(n.z)?e5.x+=1e-4:e5.z+=1e-4,e5.normalize(),e2.crossVectors(n,e5)),e2.normalize(),e4.crossVectors(e5,e2),r[0]=e2.x,r[4]=e4.x,r[8]=e5.x,r[1]=e2.y,r[5]=e4.y,r[9]=e5.y,r[2]=e2.z,r[6]=e4.z,r[10]=e5.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],_=n[15],b=r[0],w=r[4],S=r[8],M=r[12],T=r[1],E=r[5],A=r[9],C=r[13],L=r[2],R=r[6],P=r[10],I=r[14],N=r[3],D=r[7],k=r[11],O=r[15];return i[0]=a*b+s*T+o*L+l*N,i[4]=a*w+s*E+o*R+l*D,i[8]=a*S+s*A+o*P+l*k,i[12]=a*M+s*C+o*I+l*O,i[1]=u*b+c*T+h*L+d*N,i[5]=u*w+c*E+h*R+d*D,i[9]=u*S+c*A+h*P+d*k,i[13]=u*M+c*C+h*I+d*O,i[2]=p*b+f*T+m*L+g*N,i[6]=p*w+f*E+m*R+g*D,i[10]=p*S+f*A+m*P+g*k,i[14]=p*M+f*C+m*I+g*O,i[3]=v*b+y*T+x*L+_*N,i[7]=v*w+y*E+x*R+_*D,i[11]=v*S+y*A+x*P+_*k,i[15]=v*M+y*C+x*I+_*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+i*o*c-r*l*c-i*s*h+n*l*h+r*s*d-n*o*d)+f*(+t*o*d-t*l*h+i*a*h-r*a*d+r*l*u-i*o*u)+m*(+t*l*c-t*s*d-i*a*c+n*a*d+i*s*u-n*l*u)+g*(-r*s*u-t*o*c+t*s*h+r*a*c-n*a*h+n*o*u)}transpose(){let e;let t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let 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(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*h*l+f*o*d-s*m*d-c*o*g+s*h*g,y=p*h*l-u*m*l-p*o*d+a*m*d+u*o*g-a*h*g,x=u*f*l-p*c*l+p*s*d-a*f*d-u*s*g+a*c*g,_=p*c*o-u*f*o-p*s*h+a*f*h+u*s*m-a*c*m,b=t*v+n*y+r*x+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let w=1/b;return e[0]=v*w,e[1]=(f*h*i-c*m*i-f*r*d+n*m*d+c*r*g-n*h*g)*w,e[2]=(s*m*i-f*o*i+f*r*l-n*m*l-s*r*g+n*o*g)*w,e[3]=(c*o*i-s*h*i-c*r*l+n*h*l+s*r*d-n*o*d)*w,e[4]=y*w,e[5]=(u*m*i-p*h*i+p*r*d-t*m*d-u*r*g+t*h*g)*w,e[6]=(p*o*i-a*m*i-p*r*l+t*m*l+a*r*g-t*o*g)*w,e[7]=(a*h*i-u*o*i+u*r*l-t*h*l-a*r*d+t*o*d)*w,e[8]=x*w,e[9]=(p*c*i-u*f*i-p*n*d+t*f*d+u*n*g-t*c*g)*w,e[10]=(a*f*i-p*s*i+p*n*l-t*f*l-a*n*g+t*s*g)*w,e[11]=(u*s*i-a*c*i-u*n*l+t*c*l+a*n*d-t*s*d)*w,e[12]=_*w,e[13]=(u*f*r-p*c*r+p*n*h-t*f*h-u*n*m+t*c*m)*w,e[14]=(p*s*r-a*f*r-p*n*o+t*f*o+a*n*m-t*s*m)*w,e[15]=(a*c*r-u*s*r+u*n*o-t*c*o-a*n*h+t*s*h)*w,this}scale(e){let 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(){let 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){let 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){let 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){let 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){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,s=e.y,o=e.z,l=i*a,u=i*s;return this.set(l*a+n,l*s-r*o,l*o+r*s,0,l*s+r*o,u*s+n,u*o-r*a,0,l*o-r*s,u*o+r*a,i*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,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){let r=this.elements,i=t._x,a=t._y,s=t._z,o=t._w,l=i+i,u=a+a,c=s+s,h=i*l,d=i*u,p=i*c,f=a*u,m=a*c,g=s*c,v=o*l,y=o*u,x=o*c,_=n.x,b=n.y,w=n.z;return r[0]=(1-(f+g))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(h+g))*b,r[6]=(m+v)*b,r[7]=0,r[8]=(p+y)*w,r[9]=(m-v)*w,r[10]=(1-(h+f))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=e$.set(r[0],r[1],r[2]).length(),a=e$.set(r[4],r[5],r[6]).length(),s=e$.set(r[8],r[9],r[10]).length(),o=this.determinant();o<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],e0.copy(this);let l=1/i,u=1/a,c=1/s;return e0.elements[0]*=l,e0.elements[1]*=l,e0.elements[2]*=l,e0.elements[4]*=u,e0.elements[5]*=u,e0.elements[6]*=u,e0.elements[8]*=c,e0.elements[9]*=c,e0.elements[10]*=c,t.setFromRotationMatrix(e0),n.x=i,n.y=a,n.z=s,this}makePerspective(e,t,n,r,i,a){let s=this.elements;return s[0]=2*i/(t-e),s[4]=0,s[8]=(t+e)/(t-e),s[12]=0,s[1]=0,s[5]=2*i/(n-r),s[9]=(n+r)/(n-r),s[13]=0,s[2]=0,s[6]=0,s[10]=-(a+i)/(a-i),s[14]=-2*a*i/(a-i),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,a){let s=this.elements,o=1/(t-e),l=1/(n-r),u=1/(a-i);return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-((t+e)*o),s[1]=0,s[5]=2*l,s[9]=0,s[13]=-((n+r)*l),s[2]=0,s[6]=0,s[10]=-2*u,s[14]=-((a+i)*u),s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,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){let 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}}let e$=new ew,e0=new eQ,e1=new ew(0,0,0),e3=new ew(1,1,1),e2=new ew,e4=new ew,e5=new ew,e6=new eQ,e8=new eb;class e7{constructor(e=0,t=0,n=0,r=e7.DEFAULT_ORDER){this.isEuler=!0,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=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],s=r[8],o=r[1],l=r[5],u=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(U(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-U(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(U(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,i));break;case"ZYX":this._y=Math.asin(-U(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(U(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-U(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,i)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return e6.makeRotationFromQuaternion(e),this.setFromRotationMatrix(e6,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return e8.setFromEuler(this),this.setFromQuaternion(e8,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}e7.DEFAULT_ORDER="XYZ";class e9{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(n=n.concat(i))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ta,e,ts),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ta,to,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){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),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=r,n;function a(e){let t=[];for(let n in e){let 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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){tf.subVectors(r,t),tm.subVectors(n,t),tg.subVectors(e,t);let a=tf.dot(tf),s=tf.dot(tm),o=tf.dot(tg),l=tm.dot(tm),u=tm.dot(tg),c=a*l-s*s;if(0===c)return i.set(-2,-1,-1);let h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return i.set(1-d-p,p,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,tv),tv.x>=0&&tv.y>=0&&tv.x+tv.y<=1}static getUV(e,t,n,r,i,a,s,o){return this.getBarycoord(e,t,n,r,tv),o.set(0,0),o.addScaledVector(i,tv.x),o.addScaledVector(a,tv.y),o.addScaledVector(s,tv.z),o}static isFrontFacing(e,t,n,r){return tf.subVectors(n,t),tm.subVectors(e,t),0>tf.cross(tm).dot(r)}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}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(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 tf.subVectors(this.c,this.b),tm.subVectors(this.a,this.b),.5*tf.cross(tm).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tM.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tM.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,r,i){return tM.getUV(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return tM.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tM.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,r;let i=this.a,a=this.b,s=this.c;ty.subVectors(a,i),tx.subVectors(s,i),tb.subVectors(e,i);let o=ty.dot(tb),l=tx.dot(tb);if(o<=0&&l<=0)return t.copy(i);tw.subVectors(e,a);let u=ty.dot(tw),c=tx.dot(tw);if(u>=0&&c<=u)return t.copy(a);let h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return n=o/(o-u),t.copy(i).addScaledVector(ty,n);tS.subVectors(e,s);let d=ty.dot(tS),p=tx.dot(tS);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(tx,r);let m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return t_.subVectors(s,a),r=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(t_,r);let g=1/(m+f+h);return n=f*g,r=h*g,t.copy(i).addScaledVector(ty,n).addScaledVector(tx,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let tT=0;class tE extends N{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:tT++}),this.uuid=F(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}let r=this[t];if(void 0===r){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let n in e){let 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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let 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.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=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.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class tA extends tE{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new eh(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let tC=new ew,tL=new Y;class tR{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let 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);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone(t));let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;tn.far?null:{distance:l,point:t1.clone(),object:e}}(e,t,n,r,tq,tX,tY,t0);if(u){i&&(tK.fromBufferAttribute(i,s),tQ.fromBufferAttribute(i,o),t$.fromBufferAttribute(i,l),u.uv=tM.getUV(t0,tq,tX,tY,tK,tQ,t$,new Y)),a&&(tK.fromBufferAttribute(a,s),tQ.fromBufferAttribute(a,o),t$.fromBufferAttribute(a,l),u.uv2=tM.getUV(t0,tq,tX,tY,tK,tQ,t$,new Y));let e={a:s,b:o,c:l,normal:new ew,materialIndex:0};tM.getNormal(tq,tX,tY,e.normal),u.face=e}return u}class t4 extends tG{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};let s=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let o=[],l=[],u=[],c=[],h=0,d=0;function p(e,t,n,r,i,a,p,f,m,g,v){let y=a/m,x=p/g,_=a/2,b=p/2,w=f/2,S=m+1,M=g+1,T=0,E=0,A=new ew;for(let a=0;a0?1:-1,u.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),T+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class ne extends tp{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new eQ,this.projectionMatrix=new eQ,this.projectionMatrixInverse=new eQ}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class nt extends ne{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,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){let t=.5*this.getFilmHeight()/e;this.fov=2*z*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*O*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*z*Math.atan(Math.tan(.5*O*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(){let e=this.near,t=e*Math.tan(.5*O*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/s,r*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(i+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class nn extends tp{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n;let r=new nt(-90,1,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);let i=new nt(-90,1,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(-1,0,0),this.add(i);let a=new nt(-90,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(0,1,0),this.add(a);let s=new nt(-90,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(0,-1,0),this.add(s);let o=new nt(-90,1,e,t);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);let l=new nt(-90,1,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();let n=this.renderTarget,[r,i,a,s,o,l]=this.children,u=e.getRenderTarget(),c=e.toneMapping,h=e.xr.enabled;e.toneMapping=0,e.xr.enabled=!1;let d=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,s),e.setRenderTarget(n,4),e.render(t,o),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.toneMapping=c,e.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}class nr extends eg{constructor(e,t,n,r,i,a,s,o,l,u){super(e=void 0!==e?e:[],t=void 0!==t?t:301,n,r,i,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ni extends ey{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1};this.texture=new nr([n,n,n,n,n,n],t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{8312:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(1056)}])},1056:function(e,t,n){"use strict";let r,i,a,s,o,l,u,c,h,d,p;n.r(t),n.d(t,{default:function(){return dj}});var f,m,g,v,y,x=n(5893),_=n(9008),b=n.n(_),w=n(8122),S=n.n(w),M=n(7294),T=n(745),E=function(){return(E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n>8&255]+D[e>>16&255]+D[e>>24&255]+"-"+D[255&t]+D[t>>8&255]+"-"+D[t>>16&15|64]+D[t>>24&255]+"-"+D[63&n|128]+D[n>>8&255]+"-"+D[n>>16&255]+D[n>>24&255]+D[255&r]+D[r>>8&255]+D[r>>16&255]+D[r>>24&255];return i.toLowerCase()}function U(e,t,n){return Math.max(t,Math.min(n,e))}function B(e,t){return(e%t+t)%t}function H(e,t,n){return(1-n)*e+n*t}function G(e){return(e&e-1)==0&&0!==e}function V(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function W(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function j(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function q(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}var X=Object.freeze({__proto__:null,DEG2RAD:O,RAD2DEG:z,ceilPowerOfTwo:V,clamp:U,damp:function(e,t,n,r){return H(e,t,1-Math.exp(-n*r))},degToRad:function(e){return e*O},denormalize:j,euclideanModulo:B,floorPowerOfTwo:W,generateUUID:F,inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},isPowerOfTwo:G,lerp:H,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},normalize:q,pingpong:function(e,t=1){return t-Math.abs(B(e,2*t)-t)},radToDeg:function(e){return e*z},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},seededRandom:function(e){void 0!==e&&(k=e);let t=k+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},setQuaternionFromProperEuler:function(e,t,n,r,i){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+r)/2),c=s((t+r)/2),h=a((t-r)/2),d=s((t-r)/2),p=a((r-t)/2),f=s((r-t)/2);switch(i){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)}});class Y{constructor(e=0,t=0){Y.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let 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){let 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(){let e=Math.atan2(-this.y,-this.x)+Math.PI;return e}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let 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}*[Symbol.iterator](){yield this.x,yield this.y}}class Z{constructor(){Z.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,n,r,i,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=r,u[2]=s,u[3]=t,u[4]=i,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,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){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],_=r[2],b=r[5],w=r[8];return i[0]=a*f+s*v+o*_,i[3]=a*m+s*y+o*b,i[6]=a*g+s*x+o*w,i[1]=l*f+u*v+c*_,i[4]=l*m+u*y+c*b,i[7]=l*g+u*x+c*w,i[2]=h*f+d*v+p*_,i[5]=h*m+d*y+p*b,i[8]=h*g+d*x+p*w,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*i*u+n*s*o+r*i*l-r*a*o}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*i,d=l*i-a*o,p=t*c+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(r*l-u*n)*f,e[2]=(s*n-r*a)*f,e[3]=h*f,e[4]=(u*t-r*o)*f,e[5]=(r*i-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*i)*f,this}transpose(){let e;let t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,s){let o=Math.cos(i),l=Math.sin(i);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-r*l,r*o,-r*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(J.makeScale(e,t)),this}rotate(e){return this.premultiply(J.makeRotation(-e)),this}translate(e,t){return this.premultiply(J.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let 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){let 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 J=new Z;function K(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let Q={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function $(e,t){return new Q[e](t)}function ee(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function et(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function en(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let er={[R]:{[P]:et},[P]:{[R]:en}},ei={legacyMode:!0,get workingColorSpace(){return P},set workingColorSpace(colorSpace){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(er[t]&&void 0!==er[t][n]){let r=er[t][n];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},ea={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},es={r:0,g:0,b:0},eo={h:0,s:0,l:0},el={h:0,s:0,l:0};function eu(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}function ec(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}class eh{constructor(e,t,n){if(this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===t&&void 0===n)return this.set(e);return 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,t=R){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,ei.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=ei.workingColorSpace){return this.r=e,this.g=t,this.b=n,ei.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=ei.workingColorSpace){if(e=B(e,1),t=U(t,0,1),n=U(n,0,1),0===t)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=eu(i,r,e+1/3),this.g=eu(i,r,e),this.b=eu(i,r,e-1/3)}return ei.toWorkingColorSpace(this,r),this}setStyle(e,t=R){let n;function r(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;let i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,ei.toWorkingColorSpace(this,t),r(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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,ei.toWorkingColorSpace(this,t),r(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){let n=parseFloat(e[1])/360,i=parseFloat(e[2])/100,a=parseFloat(e[3])/100;return r(e[4]),this.setHSL(n,i,a,t)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let e=n[1],r=e.length;if(3===r)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,ei.toWorkingColorSpace(this,t),this;if(6===r)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,ei.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=R){let n=ea[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=et(e.r),this.g=et(e.g),this.b=et(e.b),this}copyLinearToSRGB(e){return this.r=en(e.r),this.g=en(e.g),this.b=en(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=R){return ei.fromWorkingColorSpace(ec(this,es),e),U(255*es.r,0,255)<<16^U(255*es.g,0,255)<<8^U(255*es.b,0,255)<<0}getHexString(e=R){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ei.workingColorSpace){let n,r;ei.fromWorkingColorSpace(ec(this,es),t);let i=es.r,a=es.g,s=es.b,o=Math.max(i,a,s),l=Math.min(i,a,s),u=(l+o)/2;if(l===o)n=0,r=0;else{let e=o-l;switch(r=u<=.5?e/(o+l):e/(2-o-l),o){case i:n=(a-s)/e+(a2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=ee("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}eg.DEFAULT_IMAGE=null,eg.DEFAULT_MAPPING=300,eg.DEFAULT_ANISOTROPY=1;class ev{constructor(e=0,t=0,n=0,r=1){ev.prototype.isVector4=!0,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 Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let 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);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r;let i=e.elements,a=i[0],s=i[4],o=i[8],l=i[1],u=i[5],c=i[9],h=i[2],d=i[6],p=i[10];if(.01>Math.abs(s-l)&&.01>Math.abs(o-h)&&.01>Math.abs(c-d)){if(.1>Math.abs(s+l)&&.1>Math.abs(o+h)&&.1>Math.abs(c+d)&&.1>Math.abs(a+u+p-3))return this.set(1,0,0,0),this;let e=(a+1)/2,i=(u+1)/2,f=(p+1)/2,m=(s+l)/4,g=(o+h)/4,v=(c+d)/4;return e>i&&e>f?e<.01?(t=0,n=.707106781,r=.707106781):(n=m/(t=Math.sqrt(e)),r=g/t):i>f?i<.01?(t=.707106781,n=0,r=.707106781):(t=m/(n=Math.sqrt(i)),r=v/n):f<.01?(t=.707106781,n=.707106781,r=0):(t=g/(r=Math.sqrt(f)),n=v/r),this.set(t,n,r,Math.PI),this}let f=Math.sqrt((d-c)*(d-c)+(o-h)*(o-h)+(l-s)*(l-s));return .001>Math.abs(f)&&(f=1),this.x=(d-c)/f,this.y=(o-h)/f,this.z=(l-s)/f,this.w=Math.acos((a+u+p-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let 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.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ey extends N{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ev(0,0,e,t),this.scissorTest=!1,this.viewport=new ev(0,0,e,t),this.texture=new eg({width:e,height:t,depth:1},n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null,this.samples=void 0!==n.samples?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new ep(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ex extends eg{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class e_ extends eg{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class eb{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,s){let o=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c;return}if(1===s){e[t+0]=h,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==h||l!==d||u!==p){let e=1-s,t=o*h+l*d+u*p+c*f,n=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,s=Math.sin(s*a)/i}let i=s*n;if(o=o*e+h*i,l=l*e+d*i,u=u*e+p*i,c=c*e+f*i,e===1-s){let e=1/Math.sqrt(o*o+l*l+u*u+c*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,r,i,a){let s=n[r],o=n[r+1],l=n[r+2],u=n[r+3],c=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,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){let n=e._x,r=e._y,i=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(r/2),c=s(i/2),h=o(n/2),d=o(r/2),p=o(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let 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){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){let e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(i-l)*e,this._z=(a-r)*e}else if(n>s&&n>c){let e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-n-c);this._w=(i-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+c-n-s);this._w=(a-r)/e,this._x=(i+l)/e,this._y=(o+u)/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(U(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);return 0===n||this.slerp(e,Math.min(1,t/n)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+r*l-i*o,this._y=r*u+a*o+i*s-n*l,this._z=i*u+a*l+n*o-r*s,this._w=a*u-n*s-r*o-i*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,s=a*e._w+n*e._x+r*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(o),u=Math.atan2(l,s),c=Math.sin((1-t)*u)/l,h=Math.sin(t*u)/l;return this._w=a*c+this._w*h,this._x=n*c+this._x*h,this._y=r*c+this._y*h,this._z=i*c+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(i),n*Math.cos(i),t*Math.sin(r))}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(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ew{constructor(e=0,t=0,n=0){ew.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(eM.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(eM.setFromAxisAngle(e,t))}applyMatrix3(e){let 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){let 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){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,s=e.z,o=e.w,l=o*t+a*r-s*n,u=o*n+s*t-i*r,c=o*r+i*n-a*t,h=-i*t-a*n-s*r;return this.x=l*o+-(h*i)+-(u*s)- -(c*a),this.y=u*o+-(h*a)+-(c*i)- -(l*s),this.z=c*o+-(h*s)+-(l*a)- -(u*i),this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,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){let 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){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,s=t.y,o=t.z;return this.x=r*o-i*s,this.y=i*a-n*o,this.z=n*s-r*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return eS.copy(this).projectOnVector(e),this.sub(eS)}reflect(e){return this.sub(eS.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(U(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let 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){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),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)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let eS=new ew,eM=new eb;class eT{constructor(e=new ew(Infinity,Infinity,Infinity),t=new ew(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=Infinity,n=Infinity,r=Infinity,i=-1/0,a=-1/0,s=-1/0;for(let o=0,l=e.length;oi&&(i=l),u>a&&(a=u),c>s&&(s=c)}return this.min.set(t,n,r),this.max.set(i,a,s),this}setFromBufferAttribute(e){let t=Infinity,n=Infinity,r=Infinity,i=-1/0,a=-1/0,s=-1/0;for(let o=0,l=e.count;oi&&(i=l),u>a&&(a=u),c>s&&(s=c)}return this.min.set(t,n,r),this.max.set(i,a,s),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 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,eA),eA.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(ek),eO.subVectors(this.max,ek),eL.subVectors(e.a,ek),eR.subVectors(e.b,ek),eP.subVectors(e.c,ek),eI.subVectors(eR,eL),eN.subVectors(eP,eR),eD.subVectors(eL,eP);let t=[0,-eI.z,eI.y,0,-eN.z,eN.y,0,-eD.z,eD.y,eI.z,0,-eI.x,eN.z,0,-eN.x,eD.z,0,-eD.x,-eI.y,eI.x,0,-eN.y,eN.x,0,-eD.y,eD.x,0];return!!(eU(t,eL,eR,eP,eO)&&eU(t=[1,0,0,0,1,0,0,0,1],eL,eR,eP,eO))&&(ez.crossVectors(eI,eN),eU(t=[ez.x,ez.y,ez.z],eL,eR,eP,eO))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){let t=eA.copy(e).clamp(this.min,this.max);return t.sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(eA).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()||(eE[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),eE[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),eE[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),eE[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),eE[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),eE[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),eE[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),eE[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(eE)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}let eE=[new ew,new ew,new ew,new ew,new ew,new ew,new ew,new ew],eA=new ew,eC=new eT,eL=new ew,eR=new ew,eP=new ew,eI=new ew,eN=new ew,eD=new ew,ek=new ew,eO=new ew,ez=new ew,eF=new ew;function eU(e,t,n,r,i){for(let a=0,s=e.length-3;a<=s;a+=3){eF.fromArray(e,a);let s=i.x*Math.abs(eF.x)+i.y*Math.abs(eF.y)+i.z*Math.abs(eF.z),o=t.dot(eF),l=n.dot(eF),u=r.dot(eF);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let eB=new eT,eH=new ew,eG=new ew;class eV{constructor(e=new ew,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):eB.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 this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;eH.subVectors(e,this.center);let t=eH.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(eH,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(eG.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(eH.copy(e.center).add(eG)),this.expandByPoint(eH.copy(e.center).sub(eG))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}let eW=new ew,ej=new ew,eq=new ew,eX=new ew,eY=new ew,eZ=new ew,eJ=new ew;class eK{constructor(e=new ew,t=new ew(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.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,eW)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let 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){let t=eW.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(eW.copy(this.direction).multiplyScalar(t).add(this.origin),eW.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){let i,a,s,o;ej.copy(e).add(t).multiplyScalar(.5),eq.copy(t).sub(e).normalize(),eX.copy(this.origin).sub(ej);let l=.5*e.distanceTo(t),u=-this.direction.dot(eq),c=eX.dot(this.direction),h=-eX.dot(eq),d=eX.lengthSq(),p=Math.abs(1-u*u);if(p>0){if(i=u*h-c,a=u*c-h,o=l*p,i>=0){if(a>=-o){if(a<=o){let e=1/p;i*=e,a*=e,s=i*(i+u*a+2*c)+a*(u*i+a+2*h)+d}else s=-(i=Math.max(0,-(u*(a=l)+c)))*i+a*(a+2*h)+d}else s=-(i=Math.max(0,-(u*(a=-l)+c)))*i+a*(a+2*h)+d}else a<=-o?(a=(i=Math.max(0,-(-u*l+c)))>0?-l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d):a<=o?(i=0,s=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):(a=(i=Math.max(0,-(u*l+c)))>0?l:Math.min(Math.max(-l,-h),l),s=-i*i+a*(a+2*h)+d)}else a=u>0?-l:l,s=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(eq).multiplyScalar(a).add(ej),s}intersectSphere(e,t){eW.subVectors(e.center,this.origin);let n=eW.dot(this.direction),r=eW.dot(eW)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),s=n-a,o=n+a;return s<0&&o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(0===t)return!0;let n=e.normal.dot(this.direction);return n*t<0}intersectBox(e,t){let n,r,i,a,s,o;let l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return(l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(i=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||i>r)?null:((i>n||isNaN(n))&&(n=i),(a=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>r)?null:((s>n||n!=n)&&(n=s),(o=0?n:r,t)}intersectsBox(e){return null!==this.intersectBox(e,eW)}intersectTriangle(e,t,n,r,i){let a;eY.subVectors(t,e),eZ.subVectors(n,e),eJ.crossVectors(eY,eZ);let s=this.direction.dot(eJ);if(s>0){if(r)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}eX.subVectors(this.origin,e);let o=a*this.direction.dot(eZ.crossVectors(eX,eZ));if(o<0)return null;let l=a*this.direction.dot(eY.cross(eX));if(l<0||o+l>s)return null;let u=-a*eX.dot(eJ);return u<0?null:this.at(u/s,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class eQ{constructor(){eQ.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,n,r,i,a,s,o,l,u,c,h,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new eQ().fromArray(this.elements)}copy(e){let 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){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,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){let t=this.elements,n=e.elements,r=1/e$.setFromMatrixColumn(e,0).length(),i=1/e$.setFromMatrixColumn(e,1).length(),a=1/e$.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){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-s*o,t[2]=i-e*l,t[6]=r+n*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e+i*s,t[4]=r*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-r,t[6]=i+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e-i*s,t[4]=-a*c,t[8]=r+n*s,t[1]=n+r*s,t[5]=a*u,t[9]=i-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,n=a*c,r=s*u,i=s*c;t[0]=o*u,t[4]=r*l-n,t[8]=e*l+i,t[1]=o*c,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=i-e*c,t[8]=r*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+r,t[10]=e-i*c}else if("XZY"===e.order){let e=a*o,n=a*l,r=s*o,i=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+i,t[5]=a*u,t[9]=n*c-r,t[2]=r*c-n,t[6]=s*u,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(e1,e,e3)}lookAt(e,t,n){let r=this.elements;return e5.subVectors(e,t),0===e5.lengthSq()&&(e5.z=1),e5.normalize(),e2.crossVectors(n,e5),0===e2.lengthSq()&&(1===Math.abs(n.z)?e5.x+=1e-4:e5.z+=1e-4,e5.normalize(),e2.crossVectors(n,e5)),e2.normalize(),e4.crossVectors(e5,e2),r[0]=e2.x,r[4]=e4.x,r[8]=e5.x,r[1]=e2.y,r[5]=e4.y,r[9]=e5.y,r[2]=e2.z,r[6]=e4.z,r[10]=e5.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],_=n[15],b=r[0],w=r[4],S=r[8],M=r[12],T=r[1],E=r[5],A=r[9],C=r[13],L=r[2],R=r[6],P=r[10],I=r[14],N=r[3],D=r[7],k=r[11],O=r[15];return i[0]=a*b+s*T+o*L+l*N,i[4]=a*w+s*E+o*R+l*D,i[8]=a*S+s*A+o*P+l*k,i[12]=a*M+s*C+o*I+l*O,i[1]=u*b+c*T+h*L+d*N,i[5]=u*w+c*E+h*R+d*D,i[9]=u*S+c*A+h*P+d*k,i[13]=u*M+c*C+h*I+d*O,i[2]=p*b+f*T+m*L+g*N,i[6]=p*w+f*E+m*R+g*D,i[10]=p*S+f*A+m*P+g*k,i[14]=p*M+f*C+m*I+g*O,i[3]=v*b+y*T+x*L+_*N,i[7]=v*w+y*E+x*R+_*D,i[11]=v*S+y*A+x*P+_*k,i[15]=v*M+y*C+x*I+_*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+i*o*c-r*l*c-i*s*h+n*l*h+r*s*d-n*o*d)+f*(+t*o*d-t*l*h+i*a*h-r*a*d+r*l*u-i*o*u)+m*(+t*l*c-t*s*d-i*a*c+n*a*d+i*s*u-n*l*u)+g*(-r*s*u-t*o*c+t*s*h+r*a*c-n*a*h+n*o*u)}transpose(){let e;let t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let 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(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*h*l+f*o*d-s*m*d-c*o*g+s*h*g,y=p*h*l-u*m*l-p*o*d+a*m*d+u*o*g-a*h*g,x=u*f*l-p*c*l+p*s*d-a*f*d-u*s*g+a*c*g,_=p*c*o-u*f*o-p*s*h+a*f*h+u*s*m-a*c*m,b=t*v+n*y+r*x+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let w=1/b;return e[0]=v*w,e[1]=(f*h*i-c*m*i-f*r*d+n*m*d+c*r*g-n*h*g)*w,e[2]=(s*m*i-f*o*i+f*r*l-n*m*l-s*r*g+n*o*g)*w,e[3]=(c*o*i-s*h*i-c*r*l+n*h*l+s*r*d-n*o*d)*w,e[4]=y*w,e[5]=(u*m*i-p*h*i+p*r*d-t*m*d-u*r*g+t*h*g)*w,e[6]=(p*o*i-a*m*i-p*r*l+t*m*l+a*r*g-t*o*g)*w,e[7]=(a*h*i-u*o*i+u*r*l-t*h*l-a*r*d+t*o*d)*w,e[8]=x*w,e[9]=(p*c*i-u*f*i-p*n*d+t*f*d+u*n*g-t*c*g)*w,e[10]=(a*f*i-p*s*i+p*n*l-t*f*l-a*n*g+t*s*g)*w,e[11]=(u*s*i-a*c*i-u*n*l+t*c*l+a*n*d-t*s*d)*w,e[12]=_*w,e[13]=(u*f*r-p*c*r+p*n*h-t*f*h-u*n*m+t*c*m)*w,e[14]=(p*s*r-a*f*r-p*n*o+t*f*o+a*n*m-t*s*m)*w,e[15]=(a*c*r-u*s*r+u*n*o-t*c*o-a*n*h+t*s*h)*w,this}scale(e){let 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(){let 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){let 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){let 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){let 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){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,s=e.y,o=e.z,l=i*a,u=i*s;return this.set(l*a+n,l*s-r*o,l*o+r*s,0,l*s+r*o,u*s+n,u*o-r*a,0,l*o-r*s,u*o+r*a,i*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,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){let r=this.elements,i=t._x,a=t._y,s=t._z,o=t._w,l=i+i,u=a+a,c=s+s,h=i*l,d=i*u,p=i*c,f=a*u,m=a*c,g=s*c,v=o*l,y=o*u,x=o*c,_=n.x,b=n.y,w=n.z;return r[0]=(1-(f+g))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(h+g))*b,r[6]=(m+v)*b,r[7]=0,r[8]=(p+y)*w,r[9]=(m-v)*w,r[10]=(1-(h+f))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=e$.set(r[0],r[1],r[2]).length(),a=e$.set(r[4],r[5],r[6]).length(),s=e$.set(r[8],r[9],r[10]).length(),o=this.determinant();o<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],e0.copy(this);let l=1/i,u=1/a,c=1/s;return e0.elements[0]*=l,e0.elements[1]*=l,e0.elements[2]*=l,e0.elements[4]*=u,e0.elements[5]*=u,e0.elements[6]*=u,e0.elements[8]*=c,e0.elements[9]*=c,e0.elements[10]*=c,t.setFromRotationMatrix(e0),n.x=i,n.y=a,n.z=s,this}makePerspective(e,t,n,r,i,a){let s=this.elements;return s[0]=2*i/(t-e),s[4]=0,s[8]=(t+e)/(t-e),s[12]=0,s[1]=0,s[5]=2*i/(n-r),s[9]=(n+r)/(n-r),s[13]=0,s[2]=0,s[6]=0,s[10]=-(a+i)/(a-i),s[14]=-2*a*i/(a-i),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,a){let s=this.elements,o=1/(t-e),l=1/(n-r),u=1/(a-i);return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-((t+e)*o),s[1]=0,s[5]=2*l,s[9]=0,s[13]=-((n+r)*l),s[2]=0,s[6]=0,s[10]=-2*u,s[14]=-((a+i)*u),s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,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){let 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}}let e$=new ew,e0=new eQ,e1=new ew(0,0,0),e3=new ew(1,1,1),e2=new ew,e4=new ew,e5=new ew,e6=new eQ,e8=new eb;class e7{constructor(e=0,t=0,n=0,r=e7.DEFAULT_ORDER){this.isEuler=!0,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=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],s=r[8],o=r[1],l=r[5],u=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(U(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-U(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(U(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,i));break;case"ZYX":this._y=Math.asin(-U(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(U(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-U(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,i)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return e6.makeRotationFromQuaternion(e),this.setFromRotationMatrix(e6,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return e8.setFromEuler(this),this.setFromQuaternion(e8,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}e7.DEFAULT_ORDER="XYZ";class e9{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(n=n.concat(i))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ta,e,ts),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ta,to,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){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),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=r,n;function a(e){let t=[];for(let n in e){let 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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){tf.subVectors(r,t),tm.subVectors(n,t),tg.subVectors(e,t);let a=tf.dot(tf),s=tf.dot(tm),o=tf.dot(tg),l=tm.dot(tm),u=tm.dot(tg),c=a*l-s*s;if(0===c)return i.set(-2,-1,-1);let h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return i.set(1-d-p,p,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,tv),tv.x>=0&&tv.y>=0&&tv.x+tv.y<=1}static getUV(e,t,n,r,i,a,s,o){return this.getBarycoord(e,t,n,r,tv),o.set(0,0),o.addScaledVector(i,tv.x),o.addScaledVector(a,tv.y),o.addScaledVector(s,tv.z),o}static isFrontFacing(e,t,n,r){return tf.subVectors(n,t),tm.subVectors(e,t),0>tf.cross(tm).dot(r)}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}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(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 tf.subVectors(this.c,this.b),tm.subVectors(this.a,this.b),.5*tf.cross(tm).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tM.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tM.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,r,i){return tM.getUV(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return tM.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tM.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,r;let i=this.a,a=this.b,s=this.c;ty.subVectors(a,i),tx.subVectors(s,i),tb.subVectors(e,i);let o=ty.dot(tb),l=tx.dot(tb);if(o<=0&&l<=0)return t.copy(i);tw.subVectors(e,a);let u=ty.dot(tw),c=tx.dot(tw);if(u>=0&&c<=u)return t.copy(a);let h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return n=o/(o-u),t.copy(i).addScaledVector(ty,n);tS.subVectors(e,s);let d=ty.dot(tS),p=tx.dot(tS);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(tx,r);let m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return t_.subVectors(s,a),r=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(t_,r);let g=1/(m+f+h);return n=f*g,r=h*g,t.copy(i).addScaledVector(ty,n).addScaledVector(tx,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let tT=0;class tE extends N{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:tT++}),this.uuid=F(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}let r=this[t];if(void 0===r){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let n in e){let 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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let 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.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=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.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class tA extends tE{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new eh(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let tC=new ew,tL=new Y;class tR{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let 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);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone(t));let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;tn.far?null:{distance:l,point:t1.clone(),object:e}}(e,t,n,r,tq,tX,tY,t0);if(u){i&&(tK.fromBufferAttribute(i,s),tQ.fromBufferAttribute(i,o),t$.fromBufferAttribute(i,l),u.uv=tM.getUV(t0,tq,tX,tY,tK,tQ,t$,new Y)),a&&(tK.fromBufferAttribute(a,s),tQ.fromBufferAttribute(a,o),t$.fromBufferAttribute(a,l),u.uv2=tM.getUV(t0,tq,tX,tY,tK,tQ,t$,new Y));let e={a:s,b:o,c:l,normal:new ew,materialIndex:0};tM.getNormal(tq,tX,tY,e.normal),u.face=e}return u}class t4 extends tG{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};let s=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let o=[],l=[],u=[],c=[],h=0,d=0;function p(e,t,n,r,i,a,p,f,m,g,v){let y=a/m,x=p/g,_=a/2,b=p/2,w=f/2,S=m+1,M=g+1,T=0,E=0,A=new ew;for(let a=0;a0?1:-1,u.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),T+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class ne extends tp{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new eQ,this.projectionMatrix=new eQ,this.projectionMatrixInverse=new eQ}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class nt extends ne{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,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){let t=.5*this.getFilmHeight()/e;this.fov=2*z*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*O*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*z*Math.atan(Math.tan(.5*O*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(){let e=this.near,t=e*Math.tan(.5*O*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/s,r*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(i+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class nn extends tp{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n;let r=new nt(-90,1,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);let i=new nt(-90,1,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(-1,0,0),this.add(i);let a=new nt(-90,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(0,1,0),this.add(a);let s=new nt(-90,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(0,-1,0),this.add(s);let o=new nt(-90,1,e,t);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);let l=new nt(-90,1,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();let n=this.renderTarget,[r,i,a,s,o,l]=this.children,u=e.getRenderTarget(),c=e.toneMapping,h=e.xr.enabled;e.toneMapping=0,e.xr.enabled=!1;let d=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,s),e.setRenderTarget(n,4),e.render(t,o),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.toneMapping=c,e.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}class nr extends eg{constructor(e,t,n,r,i,a,s,o,l,u){super(e=void 0!==e?e:[],t=void 0!==t?t:301,n,r,i,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ni extends ey{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1};this.texture=new nr([n,n,n,n,n,n],t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -191,7 +191,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */lS.ConcurrentRoot=1,lS.ContinuousEventPriority=4,lS.DefaultEventPriority=16,lS.DiscreteEventPriority=1,lS.IdleEventPriority=536870912,lS.LegacyRoot=0,lw.exports=lS;let lM="undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),lT=lM?M.useEffect:M.useLayoutEffect;function lE(e){let t="function"==typeof e?function(e){let t;let n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(i!==t){let e=t;t=r?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a=(e,r=i,a=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let s=r(t);function o(){let n=r(t);if(!a(s,n)){let t=s;e(s=n,t)}}return n.add(o),()=>n.delete(o)},s=(e,t,r)=>t||r?a(e,t,r):(n.add(e),()=>n.delete(e)),o=()=>n.clear(),l={setState:r,getState:i,subscribe:s,destroy:o};return t=e(r,i,l),l}(e):e,n=(e=t.getState,n=Object.is)=>{let r;let[,i]=(0,M.useReducer)(e=>e+1,0),a=t.getState(),s=(0,M.useRef)(a),o=(0,M.useRef)(e),l=(0,M.useRef)(n),u=(0,M.useRef)(!1),c=(0,M.useRef)();void 0===c.current&&(c.current=e(a));let h=!1;(s.current!==a||o.current!==e||l.current!==n||u.current)&&(r=e(a),h=!n(c.current,r)),lT(()=>{h&&(c.current=r),s.current=a,o.current=e,l.current=n,u.current=!1});let d=(0,M.useRef)(a);lT(()=>{let e=()=>{try{let e=t.getState(),n=o.current(e);l.current(c.current,n)||(s.current=e,c.current=n,i())}catch(e){u.current=!0,i()}},n=t.subscribe(e);return t.getState()!==d.current&&e(),n},[]);let p=h?r:c.current;return(0,M.useDebugValue)(p),p};return Object.assign(n,t),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");let e=[n,t];return{next(){let t=e.length<=0;return{value:e.shift(),done:t}}}},n}var lA={exports:{}},lC={exports:{}},lL={};!function(e){function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(l,n))ui(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[o]=n,r=o);else if(ui(c,n))e[r]=c,e[u]=n,r=u;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var a,s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var u=[],c=[],h=1,d=null,p=3,f=!1,m=!1,g=!1,v="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,x="undefined"!=typeof setImmediate?setImmediate:null;function _(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else if(i.startTime<=e)r(c),i.sortIndex=i.expirationTime,t(u,i);else break;i=n(c)}}function b(e){if(g=!1,_(e),!m){if(null!==n(u))m=!0,I(w);else{var t=n(c);null!==t&&N(b,t.startTime-e)}}}function w(t,i){m=!1,g&&(g=!1,y(T),T=-1),f=!0;var a=p;try{for(_(i),d=n(u);null!==d&&(!(d.expirationTime>i)||t&&!C());){var s=d.callback;if("function"==typeof s){d.callback=null,p=d.priorityLevel;var o=s(d.expirationTime<=i);i=e.unstable_now(),"function"==typeof o?d.callback=o:d===n(u)&&r(u),_(i)}else r(u);d=n(u)}if(null!==d)var l=!0;else{var h=n(c);null!==h&&N(b,h.startTime-i),l=!1}return l}finally{d=null,p=a,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S=!1,M=null,T=-1,E=5,A=-1;function C(){return!(e.unstable_now()-Ae||125s?(r.sortIndex=a,t(c,r),null===n(u)&&r===n(c)&&(g?(y(T),T=-1):g=!0,N(b,a-s))):(r.sortIndex=o,t(u,r),m||f||(m=!0,I(w))),r},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}}(lL),lC.exports=lL,lA.exports=function(e){var t,n,r,i,a,s={},o=lC.exports,l=Object.assign;function u(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n--o||i[s]!==a[o]){var l="\n"+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=o);break}}}finally{e3=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?e1(e):""}var e4=Object.prototype.hasOwnProperty,e5=[],e6=-1;function e8(e){return{current:e}}function e7(e){0>e6||(e.current=e5[e6],e5[e6]=null,e6--)}function e9(e,t){e5[++e6]=e.current,e.current=t}var te={},tt=e8(te),tn=e8(!1),tr=te;function ti(e,t){var n=e.type.contextTypes;if(!n)return te;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,a={};for(i in n)a[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function ta(e){return null!=(e=e.childContextTypes)}function ts(){e7(tn),e7(tt)}function to(e,t,n){if(tt.current!==te)throw Error(u(168));e9(tt,t),e9(tn,n)}function tl(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in t))throw Error(u(108,function(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return A(t);case 8:return t===f?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}(e)||"Unknown",i));return l({},n,r)}function tu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||te,tr=tt.current,e9(tt,e),e9(tn,tn.current),!0}function tc(e,t,n){var r=e.stateNode;if(!r)throw Error(u(169));n?(e=tl(e,t,tr),r.__reactInternalMemoizedMergedChildContext=e,e7(tn),e7(tt),e9(tt,e)):e7(tn),e9(tn,n)}var th=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(td(e)/tp|0)|0},td=Math.log,tp=Math.LN2,tf=64,tm=4194304;function tg(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function tv(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,s=268435455&n;if(0!==s){var o=s&~i;0!==o?r=tg(o):0!=(a&=s)&&(r=tg(a))}else 0!=(s=n&~i)?r=tg(s):0!==a&&(r=tg(a));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&i)&&((i=r&-r)>=(a=t&-t)||16===i&&0!=(4194240&a)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function t_(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-th(t)]=n}function tb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-th(n),i=1<>=s,i-=s,np=1<<32-th(t)+i|n<d?(p=h,h=null):p=h.sibling;var f=g(i,h,o[d],l);if(null===f){null===h&&(h=p);break}e&&h&&null===f.alternate&&t(i,h),s=a(f,s,d),null===c?u=f:c.sibling=f,c=f,h=p}if(d===o.length)return n(i,h),nb&&nm(i,d),u;if(null===h){for(;dp?(f=d,d=null):f=d.sibling;var x=g(i,d,y.value,l);if(null===x){null===d&&(d=f);break}e&&d&&null===x.alternate&&t(i,d),s=a(x,s,p),null===h?c=x:h.sibling=x,h=x,d=f}if(y.done)return n(i,d),nb&&nm(i,p),c;if(null===d){for(;!y.done;p++,y=o.next())null!==(y=m(i,y.value,l))&&(s=a(y,s,p),null===h?c=y:h.sibling=y,h=y);return nb&&nm(i,p),c}for(d=r(i,d);!y.done;p++,y=o.next())null!==(y=v(d,i,p,y.value,l))&&(e&&null!==y.alternate&&d.delete(null===y.key?p:y.key),s=a(y,s,p),null===h?c=y:h.sibling=y,h=y);return e&&d.forEach(function(e){return t(i,e)}),nb&&nm(i,p),c}(l,c,f,y);nN(l,f)}return"string"==typeof f&&""!==f||"number"==typeof f?(f=""+f,null!==c&&6===c.tag?(n(l,c.sibling),(c=i(c,f)).return=l,l=c):(n(l,c),(c=aV(f,l.mode,y)).return=l,l=c),s(l)):n(l,c)}}var nO=nk(!0),nz=nk(!1),nF={},nU=e8(nF),nB=e8(nF),nH=e8(nF);function nG(e){if(e===nF)throw Error(u(174));return e}function nV(e,t){e9(nH,t),e9(nB,e),e9(nU,nF),e=k(t),e7(nU),e9(nU,e)}function nW(){e7(nU),e7(nB),e7(nH)}function nj(e){var t=nG(nH.current),n=nG(nU.current);t=O(n,e.type,t),n!==t&&(e9(nB,e),e9(nU,t))}function nq(e){nB.current===e&&(e7(nU),e7(nB))}var nX=e8(0);function nY(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||ez(n)||eF(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var nZ=[];function nJ(){for(var e=0;en?n:4,e(!0);var r=nQ.transition;nQ.transition={};try{e(!1),t()}finally{tw=n,nQ.transition=r}}function rA(){return rn().memoizedState}function rC(e,t,n){var r=ac(e);n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},rR(e)?rP(t,n):(rI(e,t,n),null!==(e=ah(e,r,n=au()))&&rN(e,t,r))}function rL(e,t,n){var r=ac(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(rR(e))rP(t,i);else{rI(e,t,i);var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var s=t.lastRenderedState,o=a(s,n);if(i.hasEagerState=!0,i.eagerState=o,tk(o,s))return}catch(e){}finally{}null!==(e=ah(e,r,n=au()))&&rN(e,t,r)}}function rR(e){var t=e.alternate;return e===n0||null!==t&&t===n0}function rP(e,t){n4=n2=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rI(e,t,n){null!==iY&&0!=(1&e.mode)&&0==(2&iX)?(null===(e=t.interleaved)?(n.next=n,null===t$?t$=[t]:t$.push(t)):(n.next=e.next,e.next=n),t.interleaved=n):(null===(e=t.pending)?n.next=n:(n.next=e.next,e.next=n),t.pending=n)}function rN(e,t,n){if(0!=(4194240&n)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,tb(e,n)}}var rD={readContext:tQ,useCallback:n8,useContext:n8,useEffect:n8,useImperativeHandle:n8,useInsertionEffect:n8,useLayoutEffect:n8,useMemo:n8,useReducer:n8,useRef:n8,useState:n8,useDebugValue:n8,useDeferredValue:n8,useTransition:n8,useMutableSource:n8,useSyncExternalStore:n8,useId:n8,unstable_isNewReconciler:!1},rk={readContext:tQ,useCallback:function(e,t){return rt().memoizedState=[e,void 0===t?null:t],e},useContext:tQ,useEffect:rv,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,rm(4194308,4,rb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rm(4194308,4,e,t)},useInsertionEffect:function(e,t){return rm(4,2,e,t)},useMemo:function(e,t){var n=rt();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=rt();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=rC.bind(null,n0,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},rt().memoizedState=e},useState:rd,useDebugValue:rS,useDeferredValue:function(e){var t=rd(e),n=t[0],r=t[1];return rv(function(){var t=nQ.transition;nQ.transition={};try{r(e)}finally{nQ.transition=t}},[e]),n},useTransition:function(){var e=rd(!1),t=e[0];return e=rE.bind(null,e[1]),rt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=n0,i=rt();if(nb){if(void 0===n)throw Error(u(407));n=n()}else{if(n=t(),null===iY)throw Error(u(349));0!=(30&n$)||rl(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,rv(rc.bind(null,r,a,e),[e]),r.flags|=2048,rp(9,ru.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=rt(),t=iY.identifierPrefix;if(nb){var n=nf,r=np;t=":"+t+"R"+(n=(r&~(1<<32-th(r)-1)).toString(32)+n),0<(n=n5++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=n6++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},rO={readContext:tQ,useCallback:rM,useContext:tQ,useEffect:ry,useImperativeHandle:rw,useInsertionEffect:rx,useLayoutEffect:r_,useMemo:rT,useReducer:ri,useRef:rf,useState:function(){return ri(rr)},useDebugValue:rS,useDeferredValue:function(e){var t=ri(rr),n=t[0],r=t[1];return ry(function(){var t=nQ.transition;nQ.transition={};try{r(e)}finally{nQ.transition=t}},[e]),n},useTransition:function(){return[ri(rr)[0],rn().memoizedState]},useMutableSource:rs,useSyncExternalStore:ro,useId:rA,unstable_isNewReconciler:!1},rz={readContext:tQ,useCallback:rM,useContext:tQ,useEffect:ry,useImperativeHandle:rw,useInsertionEffect:rx,useLayoutEffect:r_,useMemo:rT,useReducer:ra,useRef:rf,useState:function(){return ra(rr)},useDebugValue:rS,useDeferredValue:function(e){var t=ra(rr),n=t[0],r=t[1];return ry(function(){var t=nQ.transition;nQ.transition={};try{r(e)}finally{nQ.transition=t}},[e]),n},useTransition:function(){return[ra(rr)[0],rn().memoizedState]},useMutableSource:rs,useSyncExternalStore:ro,useId:rA,unstable_isNewReconciler:!1};function rF(e,t){try{var n="",r=t;do n+=function(e){switch(e.tag){case 5:return e1(e.type);case 16:return e1("Lazy");case 13:return e1("Suspense");case 19:return e1("SuspenseList");case 0:case 2:case 15:return e=e2(e.type,!1);case 11:return e=e2(e.type.render,!1);case 1:return e=e2(e.type,!0);default:return""}}(r),r=r.return;while(r);var i=n}catch(e){i="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:i}}function rU(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var rB="function"==typeof WeakMap?WeakMap:Map;function rH(e,t,n){(n=t2(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){i9||(i9=!0,ae=r),rU(e,t)},n}function rG(e,t,n){(n=t2(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){rU(e,t)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(n.callback=function(){rU(e,t),"function"!=typeof r&&(null===at?at=new Set([this]):at.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:null!==n?n:""})}),n}function rV(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new rB;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=aI.bind(null,e,t,n),t.then(e,e))}function rW(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function rj(e,t,n,r,i){return 0==(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=t2(-1,1)).tag=2,t4(n,t))),n.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}function rq(e){e.flags|=4}function rX(e,t){if(null!==e&&e.child===t.child)return!0;if(0!=(16&t.flags))return!1;for(e=t.child;null!==e;){if(0!=(12854&e.flags)||0!=(12854&e.subtreeFlags))return!1;e=e.sibling}return!0}if(Z)t=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)B(e,n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},n=function(){},r=function(e,t,n,r,i){(e=e.memoizedProps)!==r&&(n=G(t.stateNode,n,e,r,i,nG(nU.current)),(t.updateQueue=n)&&rq(t))},i=function(e,t,n,r){n!==r&&rq(t)};else if(J){t=function(e,n,r,i){for(var a=n.child;null!==a;){if(5===a.tag){var s=a.stateNode;r&&i&&(s=eI(s,a.type,a.memoizedProps,a)),B(e,s)}else if(6===a.tag)s=a.stateNode,r&&i&&(s=eN(s,a.memoizedProps,a)),B(e,s);else if(4!==a.tag){if(22===a.tag&&null!==a.memoizedState)null!==(s=a.child)&&(s.return=a),t(e,a,!0,!0);else if(null!==a.child){a.child.return=a,a=a.child;continue}}if(a===n)break;for(;null===a.sibling;){if(null===a.return||a.return===n)return;a=a.return}a.sibling.return=a.return,a=a.sibling}};var rY=function(e,t,n,r){for(var i=t.child;null!==i;){if(5===i.tag){var a=i.stateNode;n&&r&&(a=eI(a,i.type,i.memoizedProps,i)),eL(e,a)}else if(6===i.tag)a=i.stateNode,n&&r&&(a=eN(a,i.memoizedProps,i)),eL(e,a);else if(4!==i.tag){if(22===i.tag&&null!==i.memoizedState)null!==(a=i.child)&&(a.return=i),rY(e,i,!0,!0);else if(null!==i.child){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};n=function(e,t){var n=t.stateNode;if(!rX(e,t)){var r=eC(e=n.containerInfo);rY(r,t,!1,!1),n.pendingChildren=r,rq(t),eR(e,r)}},r=function(e,n,r,i,a){var s=e.stateNode,o=e.memoizedProps;if((e=rX(e,n))&&o===i)n.stateNode=s;else{var l=n.stateNode,u=nG(nU.current),c=null;o!==i&&(c=G(l,r,o,i,a,u)),e&&null===c?n.stateNode=s:(H(s=eA(s,c,r,o,i,n,e,l),r,i,a,u)&&rq(n),n.stateNode=s,e?rq(n):t(s,n,!1,!1))}},i=function(e,t,n,r){n!==r?(e=nG(nH.current),n=nG(nU.current),t.stateNode=W(r,e,n,t),rq(t)):t.stateNode=e.stateNode}}else n=function(){},r=function(){},i=function(){};function rZ(e,t){if(!nb)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function rJ(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}var rK=c.ReactCurrentOwner,rQ=!1;function r$(e,t,n,r){t.child=null===e?nz(t,null,n,r):nO(t,e.child,n,r)}function r0(e,t,n,r,i){n=n.render;var a=t.ref;return(tK(t,i),r=n9(e,t,n,r,a,i),n=re(),null===e||rQ)?(nb&&n&&nv(t),t.flags|=1,r$(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,iu(e,t,i))}function r1(e,t,n,r,i){if(null===e){var a=n.type;return"function"!=typeof a||aF(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=aB(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,r3(e,t,a,r,i))}if(a=e.child,0==(e.lanes&i)){var s=a.memoizedProps;if((n=null!==(n=n.compare)?n:tH)(s,r)&&e.ref===t.ref)return iu(e,t,i)}return t.flags|=1,(e=aU(a,r)).ref=t.ref,e.return=t,t.child=e}function r3(e,t,n,r,i){if(null!==e&&tH(e.memoizedProps,r)&&e.ref===t.ref){if(rQ=!1,0==(e.lanes&i))return t.lanes=e.lanes,iu(e,t,i);0!=(131072&e.flags)&&(rQ=!0)}return r5(e,t,n,r,i)}function r2(e,t,n){var r=t.pendingProps,i=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null},e9(iQ,iK),iK|=n;else{if(0==(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null},t.updateQueue=null,e9(iQ,iK),iK|=e,null;t.memoizedState={baseLanes:0,cachePool:null},r=null!==a?a.baseLanes:n,e9(iQ,iK),iK|=r}}else null!==a?(r=a.baseLanes|n,t.memoizedState=null):r=n,e9(iQ,iK),iK|=r;return r$(e,t,i,n),t.child}function r4(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function r5(e,t,n,r,i){var a=ta(n)?tr:tt.current;return(a=ti(t,a),tK(t,i),n=n9(e,t,n,r,a,i),r=re(),null===e||rQ)?(nb&&r&&nv(t),t.flags|=1,r$(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,iu(e,t,i))}function r6(e,t,n,r,i){if(ta(n)){var a=!0;tu(t)}else a=!1;if(tK(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),nr(t,n,r),na(t,n,r,i),r=!0;else if(null===e){var s=t.stateNode,o=t.memoizedProps;s.props=o;var l=s.context,u=n.contextType;u="object"==typeof u&&null!==u?tQ(u):ti(t,u=ta(n)?tr:tt.current);var c=n.getDerivedStateFromProps,h="function"==typeof c||"function"==typeof s.getSnapshotBeforeUpdate;h||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(o!==r||l!==u)&&ni(t,s,r,u),t0=!1;var d=t.memoizedState;s.state=d,t8(t,r,s,i),l=t.memoizedState,o!==r||d!==l||tn.current||t0?("function"==typeof c&&(ne(t,n,c,r),l=t.memoizedState),(o=t0||nn(t,n,o,r,d,l,u))?(h||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.flags|=4194308)):("function"==typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=u,r=o):("function"==typeof s.componentDidMount&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,t3(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:tG(t.type,o),s.props=u,h=t.pendingProps,d=s.context,l="object"==typeof(l=n.contextType)&&null!==l?tQ(l):ti(t,l=ta(n)?tr:tt.current);var p=n.getDerivedStateFromProps;(c="function"==typeof p||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(o!==h||d!==l)&&ni(t,s,r,l),t0=!1,d=t.memoizedState,s.state=d,t8(t,r,s,i);var f=t.memoizedState;o!==h||d!==f||tn.current||t0?("function"==typeof p&&(ne(t,n,p,r),f=t.memoizedState),(u=t0||nn(t,n,u,r,d,f,l)||!1)?(c||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(r,f,l),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(r,f,l)),"function"==typeof s.componentDidUpdate&&(t.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof s.componentDidUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),s.props=r,s.state=f,s.context=l,r=u):("function"!=typeof s.componentDidUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return r8(e,t,n,r,a,i)}function r8(e,t,n,r,i,a){r4(e,t);var s=0!=(128&t.flags);if(!r&&!s)return i&&tc(t,n,!1),iu(e,t,a);r=t.stateNode,rK.current=t;var o=s&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&s?(t.child=nO(t,e.child,null,a),t.child=nO(t,null,o,a)):r$(e,t,o,a),t.memoizedState=r.state,i&&tc(t,n,!0),t.child}function r7(e){var t=e.stateNode;t.pendingContext?to(e,t.pendingContext,t.pendingContext!==t.context):t.context&&to(e,t.context,!1),nV(e,t.containerInfo)}function r9(e,t,n,r,i){return nR(),nP(i),t.flags|=256,r$(e,t,n,r),t.child}var ie={dehydrated:null,treeContext:null,retryLane:0};function it(e){return{baseLanes:e,cachePool:null}}function ir(e,t,n){var r,i,a,s,o,l,c,h,d,p,f,m,g,v,y=t.pendingProps,x=nX.current,_=!1,b=0!=(128&t.flags);if((v=b)||(v=(null===e||null!==e.memoizedState)&&0!=(2&x)),v?(_=!0,t.flags&=-129):(null===e||null!==e.memoizedState)&&(x|=1),e9(nX,1&x),null===e)return(nA(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated))?(0==(1&t.mode)?t.lanes=1:eF(e)?t.lanes=8:t.lanes=1073741824,null):(x=y.children,e=y.fallback,_?(y=t.mode,_=t.child,x={mode:"hidden",children:x},0==(1&y)&&null!==_?(_.childLanes=0,_.pendingProps=x):_=aG(x,y,0,null),e=aH(e,y,n,null),_.return=t,e.return=t,_.sibling=e,t.child=_,t.child.memoizedState=it(n),t.memoizedState=ie,e):ii(t,x));if(null!==(x=e.memoizedState)&&null!==(v=x.dehydrated)){if(b)return 256&t.flags?(t.flags&=-257,ia(e,t,n,Error(u(422)))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(_=y.fallback,x=t.mode,y=aG({mode:"visible",children:y.children},x,0,null),_=aH(_,x,n,null),_.flags|=2,y.return=t,_.return=t,y.sibling=_,t.child=y,0!=(1&t.mode)&&nO(t,e.child,null,n),t.child.memoizedState=it(n),t.memoizedState=ie,_);if(0==(1&t.mode))t=ia(e,t,n,null);else if(eF(v))t=ia(e,t,n,Error(u(419)));else if(y=0!=(n&e.childLanes),rQ||y){if(null!==(y=iY)){switch(n&-n){case 4:_=2;break;case 16:_=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:_=32;break;case 536870912:_=268435456;break;default:_=0}0!==(y=0!=(_&(y.suspendedLanes|n))?0:_)&&y!==x.retryLane&&(x.retryLane=y,ah(e,y,-1))}aM(),t=ia(e,t,n,Error(u(421)))}else ez(v)?(t.flags|=128,t.child=e.child,eU(v,t=aD.bind(null,e)),t=null):(n=x.treeContext,K&&(n_=eV(v),nx=t,nb=!0,nS=null,nw=!1,null!==n&&(nc[nh++]=np,nc[nh++]=nf,nc[nh++]=nd,np=n.id,nf=n.overflow,nd=t)),t=ii(t,t.pendingProps.children),t.flags|=4096);return t}return _?(r=e,i=t,a=y.children,s=y.fallback,o=n,l=i.mode,c=(r=r.child).sibling,h={mode:"hidden",children:a},0==(1&l)&&i.child!==r?((a=i.child).childLanes=0,a.pendingProps=h,i.deletions=null):(a=aU(r,h)).subtreeFlags=14680064&r.subtreeFlags,null!==c?s=aU(c,s):(s=aH(s,l,o,null),s.flags|=2),s.return=i,a.return=i,a.sibling=s,i.child=a,y=s,_=t.child,x=e.child.memoizedState,_.memoizedState=null===x?it(n):{baseLanes:x.baseLanes|n,cachePool:null},_.childLanes=e.childLanes&~n,t.memoizedState=ie,y):(d=e,p=t,f=y.children,m=n,d=(g=d.child).sibling,f=aU(g,{mode:"visible",children:f}),0==(1&p.mode)&&(f.lanes=m),f.return=p,f.sibling=null,null!==d&&(null===(m=p.deletions)?(p.deletions=[d],p.flags|=16):m.push(d)),n=p.child=f,t.memoizedState=null,n)}function ii(e,t){return(t=aG({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function ia(e,t,n,r){return null!==r&&nP(r),nO(t,e.child,null,n),e=ii(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function is(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),tJ(e.return,t,n)}function io(e,t,n,r,i){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function il(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(r$(e,t,r.children,n),0!=(2&(r=nX.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))a:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&is(e,n,t);else if(19===e.tag)is(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;null===e.sibling;){if(null===e.return||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(e9(nX,r),0==(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(i=null,n=t.child;null!==n;)null!==(e=n.alternate)&&null===nY(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),io(t,!1,i,n,a);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===nY(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}io(t,!0,n,null,a);break;case"together":io(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function iu(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),i1|=t.lanes,0==(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(u(153));if(null!==t.child){for(n=aU(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=aU(e,e.pendingProps)).return=t;n.sibling=null}return t.child}var ic=!1,ih=!1,id="function"==typeof WeakSet?WeakSet:Set,ip=null;function im(e,t){var n=e.ref;if(null!==n){if("function"==typeof n)try{n(null)}catch(n){aP(e,t,n)}else n.current=null}}function ig(e,t,n){try{n()}catch(n){aP(e,t,n)}}var iv=!1;function iy(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,void 0!==a&&ig(t,n,a)}i=i.next}while(i!==r)}}function ix(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function i_(e){var t=e.ref;if(null!==t){var n=e.stateNode;e=5===e.tag?D(n):n,"function"==typeof t?t(e):t.current=e}}function ib(e,t,n){if(tD&&"function"==typeof tD.onCommitFiberUnmount)try{tD.onCommitFiberUnmount(tN,t)}catch(e){}switch(t.tag){case 0:case 11:case 14:case 15:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var r=e=e.next;do{var i=r,a=i.destroy;i=i.tag,void 0!==a&&(0!=(2&i)?ig(t,n,a):0!=(4&i)&&ig(t,n,a)),r=r.next}while(r!==e)}break;case 1:if(im(t,n),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){aP(t,n,e)}break;case 5:im(t,n);break;case 4:Z?iE(e,t,n):J&&J&&(n=eC(t=t.stateNode.containerInfo),eP(t,n))}}function iw(e,t,n){for(var r=t;;)if(ib(e,r,n),null===r.child||Z&&4===r.tag){if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}else r.child.return=r,r=r.child}function iS(e){return 5===e.tag||3===e.tag||4===e.tag}function iM(e){a:for(;;){for(;null===e.sibling;){if(null===e.return||iS(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags||null===e.child||4===e.tag)continue a;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function iT(e){if(Z){a:{for(var t=e.return;null!==t;){if(iS(t))break a;t=t.return}throw Error(u(160))}var n=t;switch(n.tag){case 5:t=n.stateNode,32&n.flags&&(eb(t),n.flags&=-33),n=iM(e),function e(t,n,r){var i=t.tag;if(5===i||6===i)t=t.stateNode,n?ev(r,t,n):ed(r,t);else if(4!==i&&null!==(t=t.child))for(e(t,n,r),t=t.sibling;null!==t;)e(t,n,r),t=t.sibling}(e,n,t);break;case 3:case 4:t=n.stateNode.containerInfo,n=iM(e),function e(t,n,r){var i=t.tag;if(5===i||6===i)t=t.stateNode,n?ey(r,t,n):ep(r,t);else if(4!==i&&null!==(t=t.child))for(e(t,n,r),t=t.sibling;null!==t;)e(t,n,r),t=t.sibling}(e,n,t);break;default:throw Error(u(161))}}}function iE(e,t,n){for(var r,i,a=t,s=!1;;){if(!s){s=a.return;a:for(;;){if(null===s)throw Error(u(160));switch(r=s.stateNode,s.tag){case 5:i=!1;break a;case 3:case 4:r=r.containerInfo,i=!0;break a}s=s.return}s=!0}if(5===a.tag||6===a.tag)iw(e,a,n),i?e_(r,a.stateNode):ex(r,a.stateNode);else if(18===a.tag)i?eK(r,a.stateNode):eJ(r,a.stateNode);else if(4===a.tag){if(null!==a.child){r=a.stateNode.containerInfo,i=!0,a.child.return=a,a=a.child;continue}}else if(ib(e,a,n),null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break;for(;null===a.sibling;){if(null===a.return||a.return===t)return;4===(a=a.return).tag&&(s=!1)}a.sibling.return=a.return,a=a.sibling}}function iA(e,t){if(Z){switch(t.tag){case 0:case 11:case 14:case 15:iy(3,t,t.return),ix(3,t),iy(5,t,t.return);return;case 1:case 12:case 17:return;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps;e=null!==e?e.memoizedProps:r;var i=t.type,a=t.updateQueue;t.updateQueue=null,null!==a&&eg(n,a,i,e,r,t)}return;case 6:if(null===t.stateNode)throw Error(u(162));n=t.memoizedProps,ef(t.stateNode,null!==e?e.memoizedProps:n,n);return;case 3:K&&null!==e&&e.memoizedState.isDehydrated&&eY(t.stateNode.containerInfo);return;case 13:case 19:iC(t);return}throw Error(u(163))}switch(t.tag){case 0:case 11:case 14:case 15:iy(3,t,t.return),ix(3,t),iy(5,t,t.return);return;case 12:case 22:case 23:return;case 13:case 19:iC(t);return;case 3:K&&null!==e&&e.memoizedState.isDehydrated&&eY(t.stateNode.containerInfo)}a:if(J){switch(t.tag){case 1:case 5:case 6:break a;case 3:case 4:eP((t=t.stateNode).containerInfo,t.pendingChildren);break a}throw Error(u(163))}}function iC(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new id),t.forEach(function(t){var r=ak.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function iL(e){for(;null!==ip;){var t=ip;if(0!=(8772&t.flags)){var n=t.alternate;try{if(0!=(8772&t.flags))switch(t.tag){case 0:case 11:case 15:ih||ix(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!ih){if(null===n)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:tG(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}}var a=t.updateQueue;null!==a&&t7(t,a,r);break;case 3:var s=t.updateQueue;if(null!==s){if(n=null,null!==t.child)switch(t.child.tag){case 5:n=D(t.child.stateNode);break;case 1:n=t.child.stateNode}t7(t,s,n)}break;case 5:var o=t.stateNode;null===n&&4&t.flags&&em(o,t.type,t.memoizedProps,t);break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:break;case 13:if(K&&null===t.memoizedState){var l=t.alternate;if(null!==l){var c=l.memoizedState;if(null!==c){var h=c.dehydrated;null!==h&&eZ(h)}}}break;default:throw Error(u(163))}ih||512&t.flags&&i_(t)}catch(e){aP(t,t.return,e)}}if(t===e){ip=null;break}if(null!==(n=t.sibling)){n.return=t.return,ip=n;break}ip=t.return}}function iR(e){for(;null!==ip;){var t=ip;if(t===e){ip=null;break}var n=t.sibling;if(null!==n){n.return=t.return,ip=n;break}ip=t.return}}function iP(e){for(;null!==ip;){var t=ip;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ix(4,t)}catch(e){aP(t,n,e)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var i=t.return;try{r.componentDidMount()}catch(e){aP(t,i,e)}}var a=t.return;try{i_(t)}catch(e){aP(t,a,e)}break;case 5:var s=t.return;try{i_(t)}catch(e){aP(t,s,e)}}}catch(e){aP(t,t.return,e)}if(t===e){ip=null;break}var o=t.sibling;if(null!==o){o.return=t.return,ip=o;break}ip=t.return}}var iI=0,iN=1,iD=2,ik=3,iO=4;if("function"==typeof Symbol&&Symbol.for){var iz=Symbol.for;iI=iz("selector.component"),iN=iz("selector.has_pseudo_class"),iD=iz("selector.role"),ik=iz("selector.test_id"),iO=iz("selector.text")}function iF(e){var t=Q(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(u(364));return t}if(null===(e=ea(e)))throw Error(u(362));return e.stateNode.current}function iU(e,t){switch(t.$$typeof){case iI:if(e.type===t.value)return!0;break;case iN:a:{t=t.value,e=[e,0];for(var n=0;n";case iN:return":has("+(iB(e)||"")+")";case iD:return'[role="'+e.value+'"]';case iO:return'"'+e.value+'"';case ik:return'[data-testname="'+e.value+'"]';default:throw Error(u(365))}}function iH(e,t){var n=[];e=[e,0];for(var r=0;ri&&(i=s),r&=~a}if(r=i,10<(r=(120>(r=tC()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*iV(r/1960))-r)){e.timeoutHandle=j(aC.bind(null,e,i5),r);break}aC(e,i5);break;default:throw Error(u(329))}}}return ap(e,tC()),e.callbackNode===n?af.bind(null,e):null}function am(e,t){var n=i4;return e.current.memoizedState.isDehydrated&&(ab(e,t).flags|=256),2!==(e=aT(e,t))&&(t=i5,i5=n,null!==t&&ag(t)),e}function ag(e){null===i5?i5=e:i5.push.apply(i5,e)}function av(e,t){for(t&=~i2,t&=~i3,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0i8&&(a.flags|=128,o=!0,rZ(l,!1),a.lanes=4194304)}}else{if(!o){if(null!==(e=nY(c))){if(a.flags|=128,o=!0,null!==(e=e.updateQueue)&&(a.updateQueue=e,a.flags|=4),rZ(l,!0),null===l.tail&&"hidden"===l.tailMode&&!c.alternate&&!nb)return rJ(a),null}else 2*tC()-l.renderingStartTime>i8&&1073741824!==s&&(a.flags|=128,o=!0,rZ(l,!1),a.lanes=4194304)}l.isBackwards?(c.sibling=a.child,a.child=c):(null!==(e=l.last)?e.sibling=c:a.child=c,l.last=c)}if(null!==l.tail)return a=l.tail,l.rendering=a,l.tail=a.sibling,l.renderingStartTime=tC(),a.sibling=null,e=nX.current,e9(nX,o?1&e|2:1&e),a;return rJ(a),null;case 22:case 23:return a_(),o=null!==a.memoizedState,null!==e&&null!==e.memoizedState!==o&&(a.flags|=8192),o&&0!=(1&a.mode)?0!=(1073741824&iK)&&(rJ(a),Z&&6&a.subtreeFlags&&(a.flags|=8192)):rJ(a),null;case 24:case 25:return null}throw Error(u(156,a.tag))}(s,a,iK))){iZ=s;return}}else{if(null!==(s=function(e,t){switch(ny(t),t.tag){case 1:return ta(t.type)&&ts(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return nW(),e7(tn),e7(tt),nJ(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return nq(t),null;case 13:if(e7(nX),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(u(340));nR()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return e7(nX),null;case 4:return nW(),null;case 10:return tZ(t.type._context),null;case 22:case 23:return a_(),null;default:return null}}(s,a))){s.flags&=32767,iZ=s;return}if(null!==e)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{i$=6,iZ=null;return}}if(null!==(a=a.sibling)){iZ=a;return}iZ=a=e}while(null!==a);0===i$&&(i$=5)}function aC(e,t){var n=tw,r=iq.transition;try{iq.transition=null,tw=1,function(e,t,n){do aL();while(null!==ar);if(0!=(6&iX))throw Error(u(327));var r=e.finishedWork,i=e.finishedLanes;if(null!==r){if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(u(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0e?16:e,null===ar)var r=!1;else{if(e=ar,ar=null,ai=0,0!=(6&iX))throw Error(u(331));var i=iX;for(iX|=4,ip=e.current;null!==ip;){var a=ip,s=a.child;if(0!=(16&ip.flags)){var o=a.deletions;if(null!==o){for(var l=0;ltC()-i6?ab(e,0):i2|=n),ap(e,t)}function aN(e,t){0===t&&(0==(1&e.mode)?t=1:(t=tm,0==(130023424&(tm<<=1))&&(tm=4194304)));var n=au();null!==(e=ad(e,t))&&(t_(e,t,n),ap(e,n))}function aD(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),aN(e,n)}function ak(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(u(314))}null!==r&&r.delete(t),aN(e,n)}function aO(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function az(e,t,n,r){return new aO(e,t,n,r)}function aF(e){return!(!(e=e.prototype)||!e.isReactComponent)}function aU(e,t){var n=e.alternate;return null===n?((n=az(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function aB(e,t,n,r,i,a){var s=2;if(r=e,"function"==typeof e)aF(e)&&(s=1);else if("string"==typeof e)s=5;else a:switch(e){case p:return aH(n.children,i,a,t);case f:s=8,i|=8;break;case m:return(e=az(12,n,t,2|i)).elementType=m,e.lanes=a,e;case x:return(e=az(13,n,t,i)).elementType=x,e.lanes=a,e;case _:return(e=az(19,n,t,i)).elementType=_,e.lanes=a,e;case S:return aG(n,i,a,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case g:s=10;break a;case v:s=9;break a;case y:s=11;break a;case b:s=14;break a;case w:s=16,r=null;break a}throw Error(u(130,null==e?e:typeof e,""))}return(t=az(s,n,t,i)).elementType=e,t.type=r,t.lanes=a,t}function aH(e,t,n,r){return(e=az(7,e,r,t)).lanes=n,e}function aG(e,t,n,r){return(e=az(22,e,r,t)).elementType=S,e.lanes=n,e.stateNode={},e}function aV(e,t,n){return(e=az(6,e,null,t)).lanes=n,e}function aW(e,t,n){return(t=az(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function aj(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=X,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=tx(0),this.expirationTimes=tx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tx(0),this.identifierPrefix=r,this.onRecoverableError=i,K&&(this.mutableSourceEagerHydrationData=null)}function aq(e,t,n,r,i,a,s,o,l){return e=new aj(e,t,n,o,l),1===t?(t=1,!0===a&&(t|=8)):t=0,a=az(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null},t1(a),e}function aX(e){if(!e)return te;e=e._reactInternals;a:{if(C(e)!==e||1!==e.tag)throw Error(u(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(ta(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(null!==t);throw Error(u(171))}if(1===e.tag){var n=e.type;if(ta(n))return tl(e,n,t)}return t}function aY(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(u(188));throw Error(u(268,e=Object.keys(e).join(",")))}return null===(e=P(t))?null:e.stateNode}function aZ(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n=c&&a>=d&&i<=h&&s<=p){e.splice(t,1);break}if(r!==c||n.width!==l.width||ps){if(!(a!==d||n.height!==l.height||hi)){c>r&&(l.width+=c-r,l.x=r),ha&&(l.height+=d-a,l.y=a),pn&&(n=s)),s ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},s.getPublicRootInstance=function(e){return(e=e.current).child?5===e.child.tag?D(e.child.stateNode):e.child.stateNode:null},s.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:aK,findFiberByHostInstance:e.findFiberByHostInstance||aQ,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{tN=t.inject(e),tD=t}catch(e){}e=!!t.checkDCE}}return e},s.isAlreadyRendering=function(){return!1},s.observeVisibleRects=function(e,t,n,r){if(!ei)throw Error(u(363));var i=eh(e=iG(e,t),n,r).disconnect;return{disconnect:function(){i()}}},s.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},s.runWithPriority=function(e,t){var n=tw;try{return tw=e,t()}finally{tw=n}},s.shouldError=function(){return null},s.shouldSuspend=function(){return!1},s.updateContainer=function(e,t,n,r){var i=t.current,a=au(),s=ac(i);return n=aX(n),null===t.context?t.context=n:t.pendingContext=n,(t=t2(a,s)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),t4(i,t),null!==(e=ah(i,s,a))&&t5(e,i,s),s},s};var lR=lA.exports;function lP(e,t,n=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;let r=e.length;if(t.length!==r)return!1;for(let i=0;ii.response=e).then(()=>{r.lifespan&&r.lifespan>0&&setTimeout(()=>{let e=lI.indexOf(i);-1!==e&&lI.splice(e,1)},r.lifespan)}).catch(e=>i.error=e)};if(lI.push(i),!n)throw i.promise}let lD=(e,t,n)=>lN(e,t,!1,n),lk=(e,t,n)=>void lN(e,t,!0,n),lO=e=>{if(void 0===e||0===e.length)lI.splice(0,lI.length);else{let t=lI.find(t=>lP(e,t.keys,t.equal));if(t){let e=lI.indexOf(t);-1!==e&&lI.splice(e,1)}}},lz="ColorManagement"in lb&&((e,...t)=>t.reduce((e,t)=>null==e?void 0:e[t],e))(lb,"ColorManagement")||null,lF=e=>e&&e.isOrthographicCamera,lU=e=>e&&e.hasOwnProperty("current"),lB="undefined"!=typeof window&&(null!=(g=window.document)&&g.createElement||(null==(v=window.navigator)?void 0:v.product)==="ReactNative")?M.useLayoutEffect:M.useEffect;function lH(e){let t=M.useRef(e);return lB(()=>void(t.current=e),[e]),t}function lG({set:e}){return lB(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}class lV extends M.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}lV.getDerivedStateFromError=()=>({error:!0});let lW="__default",lj=new Map,lq=e=>e&&!!e.memoized&&!!e.changes;function lX(e){let t="undefined"!=typeof window?window.devicePixelRatio:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}let lY=e=>{var t;return null==(t=e.__r3f)?void 0:t.root.getState()},lZ={obj:e=>e===Object(e)&&!lZ.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,arr:e=>Array.isArray(e),equ(e,t,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){let a;if(typeof e!=typeof t||!!e!=!!t)return!1;if(lZ.str(e)||lZ.num(e))return e===t;let s=lZ.obj(e);if(s&&"reference"===r)return e===t;let o=lZ.arr(e);if(o&&"reference"===n)return e===t;if((o||s)&&e===t)return!0;for(a in e)if(!(a in t))return!1;for(a in i?t:e)if(e[a]!==t[a])return!1;if(lZ.und(a)){if(o&&0===e.length&&0===t.length||s&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;if(e!==t)return!1}return!0}};function lJ(e,t){let n=e;return(null!=t&&t.primitive||!n.__r3f)&&(n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...t}),e}function lK(e,t){let n=e;if(!t.includes("-"))return{target:n,key:t};{let r=t.split("-"),i=r.pop();return{target:n=r.reduce((e,t)=>e[t],e),key:i}}}let lQ=/-\d+$/;function l$(e,t,n){if(lZ.str(n)){if(lQ.test(n)){let t=n.replace(lQ,""),{target:r,key:i}=lK(e,t);Array.isArray(r[i])||(r[i]=[])}let{target:r,key:i}=lK(e,n);t.__r3f.previousAttach=r[i],r[i]=t}else t.__r3f.previousAttach=n(e,t)}function l0(e,t,n){var r,i;if(lZ.str(n)){let{target:r,key:i}=lK(e,n),a=t.__r3f.previousAttach;void 0===a?delete r[i]:r[i]=a}else null==(r=t.__r3f)||null==r.previousAttach||r.previousAttach(e,t);null==(i=t.__r3f)||delete i.previousAttach}function l1(e,{children:t,key:n,ref:r,...i},{children:a,key:s,ref:o,...l}={},u=!1){var c;let h=null!=(c=null==e?void 0:e.__r3f)?c:{},d=Object.entries(i),p=[];if(u){let e=Object.keys(l);for(let t=0;t{var r;if(null!=(r=e.__r3f)&&r.primitive&&"object"===t||lZ.equ(n,l[t]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(t))return p.push([t,n,!0,[]]);let a=[];for(let e in t.includes("-")&&(a=t.split("-")),p.push([t,n,!1,a]),i){let n=i[e];e.startsWith(`${t}-`)&&p.push([e,n,!1,e.split("-")])}});let f={...i};return h.memoizedProps&&h.memoizedProps.args&&(f.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(f.attach=h.memoizedProps.attach),{memoized:f,changes:p}}function l3(e,t){var n,r,i;let a=null!=(n=e.__r3f)?n:{},s=a.root,o=null!=(r=null==s?void 0:null==s.getState?void 0:s.getState())?r:{},{memoized:l,changes:u}=lq(t)?t:l1(e,t),c=a.eventCount;e.__r3f&&(e.__r3f.memoizedProps=l);for(let t=0;te[t],e))&&c.set)){let[t,...r]=s.reverse();l=r.reverse().reduce((e,t)=>e[t],e),n=t}if(r===lW+"remove"){if(l.constructor){let e=lj.get(l.constructor);e||(e=new l.constructor,lj.set(l.constructor,e)),r=e[n]}else r=0}if(i)r?a.handlers[n]=r:delete a.handlers[n],a.eventCount=Object.keys(a.handlers).length;else if(c&&c.set&&(c.copy||c instanceof e9)){if(Array.isArray(r))c.fromArray?c.fromArray(r):c.set(...r);else if(c.copy&&r&&r.constructor&&c.constructor===r.constructor)c.copy(r);else if(void 0!==r){let e=c instanceof eh;!e&&c.setScalar?c.setScalar(r):c instanceof e9&&r instanceof e9?c.mask=r.mask:c.set(r),lz||o.linear||!e||c.convertSRGBToLinear()}}else l[n]=r,!o.linear&&l[n]instanceof eg&&1023===l[n].format&&1009===l[n].type&&(l[n].encoding=3001);l2(e)}if(a.parent&&o.internal&&e.raycast&&c!==a.eventCount){let t=o.internal.interaction.indexOf(e);t>-1&&o.internal.interaction.splice(t,1),a.eventCount&&o.internal.interaction.push(e)}let h=1===u.length&&"onUpdate"===u[0][0];return!h&&u.length&&null!=(i=e.__r3f)&&i.parent&&l4(e),e}function l2(e){var t,n;let r=null==(t=e.__r3f)?void 0:null==(n=t.root)?void 0:null==n.getState?void 0:n.getState();r&&0===r.internal.frames&&r.invalidate()}function l4(e){null==e.onUpdate||e.onUpdate(e)}function l5(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function l6(e,t,n,r){let i=n.get(t);i&&(n.delete(t),0===n.size&&(e.delete(r),i.target.releasePointerCapture(r)))}let l8={},l7=e=>void(l8={...l8,...e}),l9=e=>!!(null!=e&&e.render),ue=M.createContext(null),ut=(e,t)=>{let n=lE((n,r)=>{let i;let a=new ew,s=new ew,o=new ew;function l(e=r().camera,t=s,n=r().size){let{width:i,height:l,top:u,left:c}=n,h=i/l;t instanceof ew?o.copy(t):o.set(...t);let d=e.getWorldPosition(a).distanceTo(o);if(lF(e))return{width:i/e.zoom,height:l/e.zoom,top:u,left:c,factor:1,distance:d,aspect:h};{let t=e.fov*Math.PI/180,n=2*Math.tan(t/2)*d,r=n*(i/l);return{width:r,height:n,top:u,left:c,factor:i/r,distance:d,aspect:h}}}let u=e=>n(t=>({performance:{...t.performance,current:e}})),c=new Y,h={set:n,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,invalidate:(t=1)=>e(r(),t),advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,scene:lJ(new iE),controls:null,clock:new oI,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();i&&clearTimeout(i),e.performance.current!==e.performance.min&&u(e.performance.min),i=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:l},setEvents:e=>n(t=>({...t,events:{...t.events,...e}})),setSize:(e,t,i,a,o)=>{let u=r().camera,c={width:e,height:t,top:a||0,left:o||0,updateStyle:i};n(e=>({size:c,viewport:{...e.viewport,...l(u,s,c)}}))},setDpr:e=>n(t=>{let n=lX(e);return{viewport:{...t.viewport,dpr:n,initialDpr:t.viewport.initialDpr||n}}}),setFrameloop:(e="always")=>{let t=r().clock;t.stop(),t.elapsedTime=0,"never"!==e&&(t.start(),t.elapsedTime=0),n(()=>({frameloop:e}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:M.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(e,t,n)=>{let i=r().internal;return i.priority=i.priority+(t>0?1:0),i.subscribers.push({ref:e,priority:t,store:n}),i.subscribers=i.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let n=r().internal;null!=n&&n.subscribers&&(n.priority=n.priority-(t>0?1:0),n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}};return h}),r=n.getState(),i=r.size,a=r.viewport.dpr,s=r.camera;return n.subscribe(()=>{let{camera:e,size:t,viewport:r,gl:o,set:l}=n.getState();if(t!==i||r.dpr!==a){var u,c;i=t,a=r.dpr,(c=e).manual||(lF(c)?(c.left=-(t.width/2),c.right=t.width/2,c.top=t.height/2,c.bottom=-(t.height/2)):c.aspect=t.width/t.height,c.updateProjectionMatrix(),c.updateMatrixWorld()),o.setPixelRatio(r.dpr);let n=null!=(u=t.updateStyle)?u:"undefined"!=typeof HTMLCanvasElement&&o.domElement instanceof HTMLCanvasElement;o.setSize(t.width,t.height,n)}e!==s&&(s=e,l(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),n.subscribe(t=>e(t)),n},un=new Set,ur=new Set,ui=new Set;function ua(e,t){if(e.size)for(let{callback:n}of e.values())n(t)}function us(e,t){switch(e){case"before":return ua(un,t);case"after":return ua(ur,t);case"tail":return ua(ui,t)}}function uo(e,t,n){let r=t.clock.getDelta();for("never"===t.frameloop&&"number"==typeof e&&(r=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),u=t.internal.subscribers,l=0;le,t){return ul()(e,t)}function uc(e,t=0){let n=ul(),r=n.getState().internal.subscribe,i=lH(e);return lB(()=>r(i,t,n),[t,r,n]),null}function uh(e,t){return function(n,...r){let i=new n;return e&&e(i),Promise.all(r.map(e=>new Promise((n,r)=>i.load(e,e=>{e.scene&&Object.assign(e,function(e){let t={nodes:{},materials:{}};return e&&e.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material)}),t}(e.scene)),n(e)},t,t=>r(Error(`Could not load ${e}: ${t.message})`))))))}}function ud(e,t,n,r){let i=Array.isArray(t)?t:[t],a=lD(uh(n,r),[e,...i],{equal:lZ.equ});return Array.isArray(t)?a:a[0]}ud.preload=function(e,t,n){let r=Array.isArray(t)?t:[t];return lk(uh(n),[e,...r])},ud.clear=function(e,t){let n=Array.isArray(t)?t:[t];return lO([e,...n])};let up=new Map,{invalidate:uf,advance:um}=function(e){let t,n,r,i=!1;function a(s){for(let l of(n=requestAnimationFrame(a),i=!0,t=0,us("before",s),e.values())){var o;(r=l.store.getState()).internal.active&&("always"===r.frameloop||r.internal.frames>0)&&!(null!=(o=r.gl.xr)&&o.isPresenting)&&(t+=uo(s,r))}if(us("after",s),0===t)return us("tail",s),i=!1,cancelAnimationFrame(n)}return{loop:a,invalidate:function t(n,r=1){var s;if(!n)return e.forEach(e=>t(e.store.getState()),r);null!=(s=n.gl.xr)&&s.isPresenting||!n.internal.active||"never"===n.frameloop||(n.internal.frames=Math.min(60,n.internal.frames+r),i||(i=!0,requestAnimationFrame(a)))},advance:function(t,n=!0,r,i){if(n&&us("before",t),r)uo(t,r,i);else for(let n of e.values())uo(t,n.store.getState());n&&us("after",t)}}}(up),{reconciler:ug,applyProps:uv}=function(e,t){function n(e,{args:t=[],attach:n,...r},i){let a,s=`${e[0].toUpperCase()}${e.slice(1)}`;if("primitive"===e){if(void 0===r.object)throw Error("R3F: Primitives without 'object' are invalid!");let t=r.object;a=lJ(t,{type:e,root:i,attach:n,primitive:!0})}else{let r=l8[s];if(!r)throw Error(`R3F: ${s} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(t))throw Error("R3F: The args prop must be an array!");a=lJ(new r(...t),{type:e,root:i,attach:n,memoizedProps:{args:t}})}return void 0===a.__r3f.attach&&(a instanceof tG?a.__r3f.attach="geometry":a instanceof tE&&(a.__r3f.attach="material")),"inject"!==s&&l3(a,r),a}function r(e,t){let n=!1;if(t){var r,i;null!=(r=t.__r3f)&&r.attach?l$(e,t,t.__r3f.attach):t.isObject3D&&e.isObject3D&&(e.add(t),n=!0),n||null==(i=e.__r3f)||i.objects.push(t),t.__r3f||lJ(t,{}),t.__r3f.parent=e,l4(t),l2(t)}}function i(e,t,n){let r=!1;if(t){var i,a;if(null!=(i=t.__r3f)&&i.attach)l$(e,t,t.__r3f.attach);else if(t.isObject3D&&e.isObject3D){t.parent=e,t.dispatchEvent({type:"added"});let i=e.children.filter(e=>e!==t),a=i.indexOf(n);e.children=[...i.slice(0,a),t,...i.slice(a)],r=!0}r||null==(a=e.__r3f)||a.objects.push(t),t.__r3f||lJ(t,{}),t.__r3f.parent=e,l4(t),l2(t)}}function a(e,t,n=!1){e&&[...e].forEach(e=>s(t,e,n))}function s(e,t,n){if(t){var r,i,s,o,l;t.__r3f&&(t.__r3f.parent=null),null!=(r=e.__r3f)&&r.objects&&(e.__r3f.objects=e.__r3f.objects.filter(e=>e!==t)),null!=(i=t.__r3f)&&i.attach?l0(e,t,t.__r3f.attach):t.isObject3D&&e.isObject3D&&(e.remove(t),null!=(o=t.__r3f)&&o.root&&function(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,r)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(r)}),n.capturedMap.forEach((e,r)=>{l6(n.capturedMap,t,e,r)})}(t.__r3f.root,t));let u=null==(s=t.__r3f)?void 0:s.primitive,c=void 0===n?null!==t.dispose&&!u:n;u||(a(null==(l=t.__r3f)?void 0:l.objects,t,c),a(t.children,t,c)),t.__r3f&&(delete t.__r3f.root,delete t.__r3f.objects,delete t.__r3f.handlers,delete t.__r3f.memoizedProps,u||delete t.__r3f),c&&t.dispose&&"Scene"!==t.type&&lC.exports.unstable_scheduleCallback(lC.exports.unstable_IdlePriority,()=>{try{t.dispose()}catch(e){}}),l2(e)}}let o=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters."),l=lR({createInstance:n,removeChild:s,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(e,t)=>{if(!t)return;let n=e.getState().scene;n.__r3f&&(n.__r3f.root=e,r(n,t))},removeChildFromContainer:(e,t)=>{t&&s(e.getState().scene,t)},insertInContainerBefore:(e,t,n)=>{if(!t||!n)return;let r=e.getState().scene;r.__r3f&&i(r,t,n)},getRootHostContext:()=>null,getChildHostContext:e=>e,finalizeInitialChildren(e){var t;let n=null!=(t=null==e?void 0:e.__r3f)?t:{};return Boolean(n.handlers)},prepareUpdate(e,t,n,r){if(e.__r3f.primitive&&r.object&&r.object!==e)return[!0];{let{args:t=[],children:i,...a}=r,{args:s=[],children:o,...l}=n;if(!Array.isArray(t))throw Error("R3F: the args prop must be an array!");if(t.some((e,t)=>e!==s[t]))return[!0];let u=l1(e,a,l,!0);return u.changes.length?[!1,u]:null}},commitUpdate(e,[t,i],a,o,l,u){t?function(e,t,i,a){var o;let l=null==(o=e.__r3f)?void 0:o.parent;if(!l)return;let u=n(t,i,e.__r3f.root);if(e.children){for(let t of e.children)t.__r3f&&r(u,t);e.children=e.children.filter(e=>!e.__r3f)}if(e.__r3f.objects.forEach(e=>r(u,e)),e.__r3f.objects=[],e.__r3f.autoRemovedBeforeAppend||s(l,e),u.parent&&(u.__r3f.autoRemovedBeforeAppend=!0),r(l,u),u.raycast&&u.__r3f.eventCount){let e=u.__r3f.root.getState();e.internal.interaction.push(u)}[a,a.alternate].forEach(e=>{null!==e&&(e.stateNode=u,e.ref&&("function"==typeof e.ref?e.ref(u):e.ref.current=u))})}(e,a,l,u):l3(e,i)},commitMount(e,t,n,r){var i;let a=null!=(i=e.__r3f)?i:{};e.raycast&&a.handlers&&a.eventCount&&e.__r3f.root.getState().internal.interaction.push(e)},getPublicInstance:e=>e,prepareForCommit:()=>null,preparePortalMount:e=>lJ(e.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(e){var t;let{attach:n,parent:r}=null!=(t=e.__r3f)?t:{};n&&r&&l0(r,e,n),e.isObject3D&&(e.visible=!1),l2(e)},unhideInstance(e,t){var n;let{attach:r,parent:i}=null!=(n=e.__r3f)?n:{};r&&i&&l$(i,e,r),(e.isObject3D&&null==t.visible||t.visible)&&(e.visible=!0),l2(e)},createTextInstance:o,hideTextInstance:o,unhideTextInstance:o,getCurrentEventPriority:()=>t?t():lw.exports.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:"undefined"!=typeof performance&&lZ.fun(performance.now)?performance.now:lZ.fun(Date.now)?Date.now:()=>0,scheduleTimeout:lZ.fun(setTimeout)?setTimeout:void 0,cancelTimeout:lZ.fun(clearTimeout)?clearTimeout:void 0});return{reconciler:l,applyProps:l3}}(0,function(){var e;let t="undefined"!=typeof self&&self||"undefined"!=typeof window&&window;if(!t)return lw.exports.DefaultEventPriority;let n=null==(e=t.event)?void 0:e.type;switch(n){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return lw.exports.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return lw.exports.ContinuousEventPriority;default:return lw.exports.DefaultEventPriority}}),uy={objects:"shallow",strict:!1},ux=(e,t)=>{let n="function"==typeof e?e(t):e;return l9(n)?n:new iw({powerPreference:"high-performance",canvas:t,antialias:!0,alpha:!0,...e})};function u_({store:e,children:t,onCreated:n,rootElement:r}){return lB(()=>{let t=e.getState();t.set(e=>({internal:{...e.internal,active:!0}})),n&&n(t),e.getState().events.connected||null==t.events.connect||t.events.connect(r)},[]),M.createElement(ue.Provider,{value:e},t)}function ub(e,t){let n=up.get(e),r=null==n?void 0:n.fiber;if(r){let i=null==n?void 0:n.store.getState();i&&(i.internal.active=!1),ug.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var n,r,a,s;null==i.events.disconnect||i.events.disconnect(),null==(n=i.gl)||null==(r=n.renderLists)||null==r.dispose||r.dispose(),null==(a=i.gl)||null==a.forceContextLoss||a.forceContextLoss(),null!=(s=i.gl)&&s.xr&&i.xr.disconnect(),function(e){for(let t in e.dispose&&"Scene"!==e.type&&e.dispose(),e)null==t.dispose||t.dispose(),delete e[t]}(i),up.delete(e),t&&t(e)}catch(e){}},500)})}}function uw(){return(uw=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0?i=setTimeout(r,t-u):(i=null,n||(l=e.apply(s,a),s=a=null))}null==t&&(t=100);var i,a,s,o,l,u=function(){s=this,a=arguments,o=Date.now();var u=n&&!i;return i||(i=setTimeout(r,t)),u&&(l=e.apply(s,a),s=a=null),l};return u.clear=function(){i&&(clearTimeout(i),i=null)},u.flush=function(){i&&(l=e.apply(s,a),s=a=null,clearTimeout(i),i=null)},u}ug.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:M.version}),uS.debounce=uS;let uM=["x","y","top","bottom","left","right","width","height"],uT=(e,t)=>uM.every(n=>e[n]===t[n]);var uE=Object.defineProperty,uA=Object.defineProperties,uC=Object.getOwnPropertyDescriptors,uL=Object.getOwnPropertySymbols,uR=Object.prototype.hasOwnProperty,uP=Object.prototype.propertyIsEnumerable,uI=(e,t,n)=>t in e?uE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uN=(e,t)=>{for(var n in t||(t={}))uR.call(t,n)&&uI(e,n,t[n]);if(uL)for(var n of uL(t))uP.call(t,n)&&uI(e,n,t[n]);return e},uD=(e,t)=>uA(e,uC(t));function uk(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}let uO=uk(M.createContext(null));class uz extends M.Component{render(){return M.createElement(uO.Provider,{value:this._reactInternals},this.props.children)}}let{ReactCurrentOwner:uF,ReactCurrentDispatcher:uU}=M.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,uB={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function uH(e){let{handlePointer:t}=function(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let r=e.eventObject,i=r.__r3f,a=null==i?void 0:i.handlers;if(n.hovered.delete(l5(e)),null!=i&&i.eventCount){let n={...e,intersections:t};null==a.onPointerOut||a.onPointerOut(n),null==a.onPointerLeave||a.onPointerLeave(n)}}}function r(e,t){for(let n=0;nn([]);case"onLostPointerCapture":return t=>{let{internal:r}=e.getState();"pointerId"in t&&r.capturedMap.has(t.pointerId)&&(r.capturedMap.delete(t.pointerId),n([]))}}return function(a){let{onPointerMissed:s,internal:o}=e.getState();o.lastEvent.current=a;let l="onPointerMove"===i,u="onClick"===i||"onContextMenu"===i||"onDoubleClick"===i,c=function(t,n){let r=e.getState(),i=new Set,a=[],s=n?n(r.internal.interaction):r.internal.interaction;for(let e=0;e{let n=lY(e.object),r=lY(t.object);return n&&r&&r.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=l5(e);return!i.has(t)&&(i.add(t),!0)});for(let e of(r.events.filter&&(o=r.events.filter(o,r)),o)){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&r.internal.capturedMap.has(t.pointerId))for(let e of r.internal.capturedMap.get(t.pointerId).values())i.has(l5(e.intersection))||a.push(e.intersection);return a}(a,l?t:void 0),h=u?function(t){let{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}(a):0;"onPointerDown"===i&&(o.initialClick=[a.offsetX,a.offsetY],o.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&h<=2&&(r(a,o.interaction),s&&s(a)),l&&n(c),function(t,r,i,a){let s=e.getState();if(t.length){let e={stopped:!1};for(let o of t){let l=lY(o.object)||s,{raycaster:u,pointer:c,camera:h,internal:d}=l,p=new ew(c.x,c.y,0).unproject(h),f=e=>{var t,n;return null!=(t=null==(n=d.capturedMap.get(e))?void 0:n.has(o.eventObject))&&t},m=e=>{let t={intersection:o,target:r.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,t):d.capturedMap.set(e,new Map([[o.eventObject,t]])),r.target.setPointerCapture(e)},g=e=>{let t=d.capturedMap.get(e);t&&l6(d.capturedMap,o.eventObject,t,e)},v={};for(let e in r){let t=r[e];"function"!=typeof t&&(v[e]=t)}let y={...o,...v,pointer:c,intersections:t,stopped:e.stopped,delta:i,unprojectedPoint:p,ray:u.ray,camera:h,stopPropagation(){let i="pointerId"in r&&d.capturedMap.get(r.pointerId);if((!i||i.has(o.eventObject))&&(y.stopped=e.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject))){let e=t.slice(0,t.indexOf(o));n([...e,o])}},target:{hasPointerCapture:f,setPointerCapture:m,releasePointerCapture:g},currentTarget:{hasPointerCapture:f,setPointerCapture:m,releasePointerCapture:g},nativeEvent:r};if(a(y),!0===e.stopped)break}}}(c,a,h,function(e){let t=e.eventObject,n=t.__r3f,s=null==n?void 0:n.handlers;if(null!=n&&n.eventCount){if(l){if(s.onPointerOver||s.onPointerEnter||s.onPointerOut||s.onPointerLeave){let t=l5(e),n=o.hovered.get(t);n?n.stopped&&e.stopPropagation():(o.hovered.set(t,e),null==s.onPointerOver||s.onPointerOver(e),null==s.onPointerEnter||s.onPointerEnter(e))}null==s.onPointerMove||s.onPointerMove(e)}else{let n=s[i];n?(!u||o.initialHits.includes(t))&&(r(a,o.interaction.filter(e=>!o.initialHits.includes(e))),n(e)):u&&o.initialHits.includes(t)&&r(a,o.interaction.filter(e=>!o.initialHits.includes(e)))}}})}}}}(e);return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-(2*(e.offsetY/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(uB).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var t;let{events:n,internal:r}=e.getState();null!=(t=r.lastEvent)&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var n;let{set:r,events:i}=e.getState();null==i.disconnect||i.disconnect(),r(e=>({events:{...e.events,connected:t}})),Object.entries(null!=(n=i.handlers)?n:[]).forEach(([e,n])=>{let[r,i]=uB[e];t.addEventListener(r,n,{passive:i})})},disconnect:()=>{let{set:t,events:n}=e.getState();if(n.connected){var r;Object.entries(null!=(r=n.handlers)?r:[]).forEach(([e,t])=>{if(n&&n.connected instanceof HTMLElement){let[r]=uB[e];n.connected.removeEventListener(r,t)}}),t(e=>({events:{...e.events,connected:void 0}}))}}}}let uG=M.forwardRef(function({children:e,fallback:t,resize:n,style:r,gl:i,events:a=uH,eventSource:s,eventPrefix:o,shadows:l,linear:u,flat:c,legacy:h,orthographic:d,frameloop:p,dpr:f,performance:m,raycaster:g,camera:v,onPointerMissed:y,onCreated:x,..._},b){M.useMemo(()=>l7(lb),[]);let w=function(){var e,t;let n=function(){let e=M.useContext(uO);if(!e)throw Error("its-fine: useFiber must be called within a !");let t=M.useId(),n=M.useMemo(()=>{var n;return null!=(n=uF.current)?n:function e(t,n,r){if(!t)return;if(!0===r(t))return t;let i=n?t.return:t.child;for(;i;){let t=e(i,n,r);if(t)return t;i=n?null:i.sibling}}(e,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}})},[e,t]);return n}(),[r]=M.useState(()=>new Map);r.clear();let i=n;for(;i;){let n=null==(e=i.type)?void 0:e._context;n&&n!==uO&&!r.has(n)&&r.set(n,null==(t=uU.current)?void 0:t.readContext(uk(n))),i=i.return}return M.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>M.createElement(e,null,M.createElement(t.Provider,uD(uN({},n),{value:r.get(t)}))),e=>M.createElement(uz,uN({},e))),[r])}(),[S,T]=function(e){var t;let{debounce:n,scroll:r,polyfill:i,offsetSize:a}=void 0===e?{debounce:0,scroll:!1,offsetSize:!1}:e,s=i||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[o,l]=(0,M.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=(0,M.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),c=n?"number"==typeof n?n:n.scroll:null,h=n?"number"==typeof n?n:n.resize:null,d=(0,M.useRef)(!1);(0,M.useEffect)(()=>(d.current=!0,()=>void(d.current=!1)));let[p,f,m]=(0,M.useMemo)(()=>{let e=()=>{if(!u.current.element)return;let{left:e,top:t,width:n,height:r,bottom:i,right:s,x:o,y:c}=u.current.element.getBoundingClientRect(),h={left:e,top:t,width:n,height:r,bottom:i,right:s,x:o,y:c};u.current.element instanceof HTMLElement&&a&&(h.height=u.current.element.offsetHeight,h.width=u.current.element.offsetWidth),Object.freeze(h),d.current&&!uT(u.current.lastBounds,h)&&l(u.current.lastBounds=h)};return[e,h?uS(e,h):e,c?uS(e,c):e]},[l,a,c,h]);function g(){u.current.scrollContainers&&(u.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",m,!0)),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null)}function v(){u.current.element&&(u.current.resizeObserver=new s(m),u.current.resizeObserver.observe(u.current.element),r&&u.current.scrollContainers&&u.current.scrollContainers.forEach(e=>e.addEventListener("scroll",m,{capture:!0,passive:!0})))}let y=e=>{e&&e!==u.current.element&&(g(),u.current.element=e,u.current.scrollContainers=function e(t){let n=[];if(!t||t===document.body)return n;let{overflow:r,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[r,i,a].some(e=>"auto"===e||"scroll"===e)&&n.push(t),[...n,...e(t.parentElement)]}(e),v())};return t=Boolean(r),(0,M.useEffect)(()=>{if(t)return window.addEventListener("scroll",m,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",m,!0)},[m,t]),(0,M.useEffect)(()=>(window.addEventListener("resize",f),()=>void window.removeEventListener("resize",f)),[f]),(0,M.useEffect)(()=>{g(),v()},[r,m,f]),(0,M.useEffect)(()=>g,[]),[y,o,p]}({scroll:!0,debounce:{scroll:50,resize:0},...n}),E=M.useRef(null),A=M.useRef(null),[C,L]=M.useState(null);M.useImperativeHandle(b,()=>E.current);let R=lH(y),[P,I]=M.useState(!1),[N,D]=M.useState(!1);if(P)throw P;if(N)throw N;let k=M.useRef(null);return T.width>0&&T.height>0&&C&&(k.current||(k.current=function(e){let t;let n=up.get(e),r=null==n?void 0:n.fiber,i=null==n?void 0:n.store;n&&console.warn("R3F.createRoot should only be called once!");let a="function"==typeof reportError?reportError:console.error,s=i||ut(uf,um),o=r||ug.createContainer(s,lw.exports.ConcurrentRoot,null,!1,null,"",a,null);n||up.set(e,{fiber:o,store:s});let l=!1;return{configure(n={}){let{gl:r,size:i,events:a,onCreated:o,shadows:u=!1,linear:c=!1,flat:h=!1,legacy:d=!1,orthographic:p=!1,frameloop:f="always",dpr:m=[1,2],performance:g,raycaster:v,camera:y,onPointerMissed:x}=n,_=s.getState(),b=_.gl;_.gl||_.set({gl:b=ux(r,e)});let w=_.raycaster;w||_.set({raycaster:w=new o5});let{params:S,...M}=v||{};if(lZ.equ(M,w,uy)||uv(w,{...M}),lZ.equ(S,w.params,uy)||uv(w,{params:{...w.params,...S}}),!_.camera){let e=y instanceof ne,t=e?y:p?new nT(0,0,0,0,.1,1e3):new nt(75,0,.1,1e3);e||(t.position.z=5,y&&uv(t,y),null!=y&&y.rotation||t.lookAt(0,0,0)),_.set({camera:t})}if(!_.xr){let e=(e,t)=>{let n=s.getState();"never"!==n.frameloop&&um(e,!0,n,t)},t=()=>{let t=s.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||uf(t)},n={connect(){let e=s.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){let e=s.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};b.xr&&n.connect(),_.set({xr:n})}if(b.shadowMap){let e=b.shadowMap.enabled,t=b.shadowMap.type;if(b.shadowMap.enabled=!!u,lZ.boo(u))b.shadowMap.type=2;else if(lZ.str(u)){var T;b.shadowMap.type=null!=(T=({basic:0,percentage:1,soft:2,variance:3})[u])?T:2}else lZ.obj(u)&&Object.assign(b.shadowMap,u);(e!==b.shadowMap.enabled||t!==b.shadowMap.type)&&(b.shadowMap.needsUpdate=!0)}lz&&("enabled"in lz?lz.enabled=!d:"legacyMode"in lz&&(lz.legacyMode=d));let E=c?3e3:3001,A=h?0:4;b.outputEncoding!==E&&(b.outputEncoding=E),b.toneMapping!==A&&(b.toneMapping=A),_.legacy!==d&&_.set(()=>({legacy:d})),_.linear!==c&&_.set(()=>({linear:c})),_.flat!==h&&_.set(()=>({flat:h})),!r||lZ.fun(r)||l9(r)||lZ.equ(r,b,uy)||uv(b,r),a&&!_.events.handlers&&_.set({events:a(s)});let C=function(e,t){if(t)return t;if("undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:t,height:n,top:r,left:i}=e.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:i}}return"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0}}(e,i);return lZ.equ(C,_.size,uy)||_.setSize(C.width,C.height,C.updateStyle,C.top,C.left),m&&_.viewport.dpr!==lX(m)&&_.setDpr(m),_.frameloop!==f&&_.setFrameloop(f),_.onPointerMissed||_.set({onPointerMissed:x}),g&&!lZ.equ(g,_.performance,uy)&&_.set(e=>({performance:{...e.performance,...g}})),t=o,l=!0,this},render(n){return l||this.configure(),ug.updateContainer(M.createElement(u_,{store:s,children:n,onCreated:t,rootElement:e}),o,null,()=>void 0),s},unmount(){ub(e)}}}(C)),k.current.configure({gl:i,events:a,shadows:l,linear:u,flat:c,legacy:h,orthographic:d,frameloop:p,dpr:f,performance:m,raycaster:g,camera:v,size:T,onPointerMissed:(...e)=>null==R.current?void 0:R.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(s?lU(s)?s.current:s:A.current),o&&e.setEvents({compute:(e,t)=>{let n=e[o+"X"],r=e[o+"Y"];t.pointer.set(n/t.size.width*2-1,-(2*(r/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==x||x(e)}}),k.current.render(M.createElement(w,null,M.createElement(lV,{set:D},M.createElement(M.Suspense,{fallback:M.createElement(lG,{set:I})},e))))),lB(()=>{L(E.current)},[]),M.useEffect(()=>{if(C)return()=>ub(C)},[C]),M.createElement("div",uw({ref:A,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:s?"none":"auto",...r}},_),M.createElement("div",{ref:S,style:{width:"100%",height:"100%"}},M.createElement("canvas",{ref:E,style:{display:"block"}},t)))}),uV=M.forwardRef(function(e,t){return M.createElement(uz,null,M.createElement(uG,uw({},e,{ref:t})))});var uW=null,uj=null,uq=function(e,t){var n=document.createElement("a");"string"==typeof n.download&&(document.body.appendChild(n),n.download=t,n.href=e,n.click(),document.body.removeChild(n))},uX=function(e){var t=uu(function(e){return e.gl});uu(function(e){return e.camera}),uu(function(e){return e.scene}),(0,M.useEffect)(function(){null===uW&&Promise.all([n.e(633),n.e(509)]).then(n.bind(n,8509)).then(function(e){return e.C}).then(function(e){uW=e.default}),null===uj&&Promise.all([n.e(633),n.e(124)]).then(n.bind(n,5124)).then(function(e){return e.C}).then(function(e){uj=e.default})},[]);var r=(0,M.useMemo)(function(){return uW&&uj?uW&&("webm"===e.format||"gif"===e.format)?new uW({format:e.format,framerate:e.framerate,verbose:!0,motionBlurFrames:!1,display:!0,quality:100,workersPath:"./"}):new uj({format:e.format,framerate:e.framerate,verbose:!0,motionBlurFrames:!1,display:!0,quality:100,workersPath:"./"}):null},[e.format,e.framerate]);return(0,M.useEffect)(function(){e.startRecord&&(console.log("HUIGHIUG"),e.setStates(E(E({},e),{startRecord:!1,isRecording:!0,shouldCapture:!0})),r.start()),e.stopRecord&&(r.stop(),r.save(function(t){var n,r=window.URL.createObjectURL(t),i=document.createElement("a");i.href=r,i.setAttribute("download",e.filename+"."+("webm"===(n=e.format)||"gif"===n?n:"tar")),i.click()}),e.setStates(E(E({},e),{stopRecord:!1,isRecording:!1}))),e.screenshot&&(uq(t.domElement.toDataURL("image/png"),e.snap_filename+".png"),e.setStates(E(E({},e),{screenshot:!1})))},[e.startRecord,e.stopRecord,e.screenshot]),uc(function(t){var n=t.gl,i=t.scene,a=t.camera;e.isRecording||n.render(i,a),e.isRecording&&("jpeg"===e.format||"png"===e.format||"gif"===e.format)?(n.render(i,a),r.capture(n.domElement)):e.isRecording&&e.shouldCapture&&(n.render(i,a),r.capture(n.domElement),e.setStates(E(E({},e),{shouldCapture:!1})))},1),M.createElement(M.Fragment,null)},uY=M.createContext(null);function uZ(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var uJ={info:"SwiftInfo-module_info__mv3Pe",fps:"SwiftInfo-module_fps__kSPPS",simTime:"SwiftInfo-module_simTime__u0SeI",spacer:"SwiftInfo-module_spacer__bwEmU",button:"SwiftInfo-module_button__gCRw6",svg:"SwiftInfo-module_svg__A7QrM",sr:"SwiftInfo-module_sr__HqlGA"};uZ('.SwiftInfo-module_info__mv3Pe {\n float: right;\n z-index: 10000;\n position: absolute;\n top: 0px;\n right: 0px;\n height: 32px;\n width: 245px;\n color: #969696;\n text-align: left;\n background-color: #1e1e1e;\n border-radius: 0px 0px 0px 15px;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;\n font-size: 13px;\n}\n\n.SwiftInfo-module_info__mv3Pe .SwiftInfo-module_fps__kSPPS {\n position: absolute;\n top: 50%;\n width: 60px;\n display: inline-block;\n transform: translateY(-50%);\n right: 120px;\n}\n\n.SwiftInfo-module_info__mv3Pe .SwiftInfo-module_simTime__u0SeI {\n position: absolute;\n top: 50%;\n width: 80px;\n display: inline-block;\n transform: translateY(-50%);\n right: 130px;\n}\n\n.SwiftInfo-module_spacer__bwEmU {\n float: right;\n width: 10px;\n height: 10px;\n}\n\n.SwiftInfo-module_button__gCRw6 {\n float: right;\n background-color: #1e1e1e;\n width: 26px;\n height: 26px;\n border: none;\n border-radius: 16px;\n margin: 3px;\n padding: 3px;\n transition-duration: 0.2s;\n outline: none;\n}\n\n.SwiftInfo-module_svg__A7QrM {\n width: 20px;\n height: 20px;\n}\n\n.SwiftInfo-module_button__gCRw6:enabled:hover {\n background-color: #616161;\n}\n\n.SwiftInfo-module_button__gCRw6:enabled:active {\n background-color: #8f8f8f;\n}\n\n.SwiftInfo-module_button__gCRw6:disabled {\n opacity: 0.65;\n}\n\n.SwiftInfo-module_sr__HqlGA {\n height: 1px;\n overflow: hidden;\n position: absolute;\n width: 1px;\n}');var uK=function(e){var t=Math.floor(e),n=Math.floor(t/60),r=1e3*e%1e3,i="",a="";return r=Math.round(r),t%=60,i=t<10?"0"+t:t.toString(),a=n<10?"0"+n:n.toString(),r<10?r*=100:r<100&&(r*=10),a+":"+i+"."+(0===r?"000":r.toString())},uQ=function(e){return M.createElement("button",{className:uJ.button,onClick:e.onClick,title:e.title,disabled:e.connected},M.createElement("img",{className:uJ.svg,src:e.path}))},u$=function(e){var t=(0,M.useContext)(uY),n=(0,M.useState)("icons/pause.svg"),r=n[0],i=n[1],a=(0,M.useState)("icons/realtime.svg"),s=a[0],o=a[1],l=(0,M.useState)("icons/stopRender.svg"),u=l[0],c=l[1],h=(0,M.useState)("Pause the simulation"),d=h[0],p=h[1],f=(0,M.useState)("Play at real-time"),m=f[0],g=f[1],v=(0,M.useState)("Stop rendering (simulation continues)"),y=v[0],x=v[1],_=(0,M.useState)(!1),b=_[0],w=_[1],S=(0,M.useState)(!0),T=S[0],E=S[1],A=(0,M.useState)(!0),C=A[0],L=A[1];return M.createElement("div",{className:uJ.info},M.createElement("div",{className:uJ.spacer}),M.createElement(uQ,{path:r,onClick:function(){var e;b?(p("Pause the simulation"),i("icons/pause.svg"),e=!1):(p("Continue the simulation"),i("icons/play.svg"),e=!0),w(e),t({type:"userInputNoState",index:0,data:e})},title:d,connected:!e.connected}),M.createElement(uQ,{path:s,onClick:function(){var e;T?(g("Play at full speed"),o("icons/fasttime.svg"),e=!1):(g("Play at real-time"),o("icons/realtime.svg"),e=!0),E(e),t({type:"userInputNoState",index:1,data:e})},title:m,connected:!e.connected}),M.createElement(uQ,{path:u,onClick:function(){var e;C?(x("Start rendering"),c("icons/startRender.svg"),e=!1):(x("Stop rendering (simulation continues)"),c("icons/stopRender.svg"),e=!0),L(e),t({type:"userInputNoState",index:2,data:e})},title:y,connected:!e.connected}),M.createElement(uQ,{path:"icons/snap.svg",onClick:function(){e.screenshot("swift_snap")},title:"Take screenshot",connected:!e.connected}),M.createElement("div",{className:uJ.simTime},uK(e.time)))},u0={sidenav:"SwiftBar-module_sidenav__Ux6xv",buttonDiv:"SwiftBar-module_buttonDiv__PkVia",buttonButton:"SwiftBar-module_buttonButton__lEKE8",labelDiv:"SwiftBar-module_labelDiv__aDTlE",sliderDiv:"SwiftBar-module_sliderDiv__tUViB",sliderValDiv:"SwiftBar-module_sliderValDiv__R3QLp",sliderVals:"SwiftBar-module_sliderVals__BOmPO",sliderMin:"SwiftBar-module_sliderMin__u0Nae",sliderVal:"SwiftBar-module_sliderVal__ya40a",sliderMax:"SwiftBar-module_sliderMax__VOStu",sliderP:"SwiftBar-module_sliderP__WI0tL",slider:"SwiftBar-module_slider__0hP0z",selectDiv:"SwiftBar-module_selectDiv__IS8hH",selectLabel:"SwiftBar-module_selectLabel__XSo1K",selectSelect:"SwiftBar-module_selectSelect__2ItDn",checkboxDiv:"SwiftBar-module_checkboxDiv__lgM76",checkboxLabel:"SwiftBar-module_checkboxLabel__BLeHI",checkboxCont:"SwiftBar-module_checkboxCont__gnAQh",radioDiv:"SwiftBar-module_radioDiv__QHilZ",radioLabel:"SwiftBar-module_radioLabel__bqRHa",radioCont:"SwiftBar-module_radioCont__y-lnG"};uZ(".SwiftBar-module_sidenav__Ux6xv {\n height: 100%;\n width: 20%;\n min-width: 3cm;\n max-width: 7cm;\n position: fixed;\n z-index: 1;\n top: 0;\n left: 0;\n background-color: #1e1e1e;\n overflow-x: hidden;\n padding-top: 20px;\n}\n\n/* ----------------- Button ----------------- */\n.SwiftBar-module_buttonDiv__PkVia {\n display: flex;\n justify-content: center;\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n}\n\n.SwiftBar-module_buttonButton__lEKE8 {\n background-color: #383838;\n text-align: center;\n min-width: 80%;\n max-width: 90%;\n border: none;\n color: #d3d3d3;\n height: 2.5em;\n border-radius: 2px;\n transition-duration: 0.2s;\n}\n\n.SwiftBar-module_buttonButton__lEKE8:hover {\n background-color: #616161; /* Green */\n color: white;\n}\n\n.SwiftBar-module_buttonButton__lEKE8:active {\n background-color: #8f8f8f; /* Green */\n color: white;\n}\n\n/* ----------------- Label ----------------- */\n.SwiftBar-module_labelDiv__aDTlE {\n text-align: center;\n display: flex;\n justify-content: center;\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 1cm;\n}\n\n.SwiftBar-module_labelDiv__aDTlE p {\n font-size: 1.3em;\n width: 90%;\n margin-top: 0;\n margin-left: 5%;\n margin-right: 5%;\n margin-bottom: 0;\n color: #d3d3d3;\n font-weight: bold;\n}\n\n/* ----------------- SLIDERS ----------------- */\n.SwiftBar-module_sliderDiv__tUViB {\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n}\n\n.SwiftBar-module_sliderValDiv__R3QLp {\n margin-left: 5%;\n margin-top: 0.3cm;\n margin-bottom: 0;\n width: 90%;\n}\n\n.SwiftBar-module_sliderVals__BOmPO {\n display: inline-block;\n width: 33%;\n margin: 0;\n}\n\n.SwiftBar-module_sliderMin__u0Nae {\n text-align: left;\n color: #8a8a8a;\n}\n\n.SwiftBar-module_sliderVal__ya40a {\n text-align: center;\n color: #8a8a8a;\n}\n\n.SwiftBar-module_sliderMax__VOStu {\n text-align: right;\n color: #8a8a8a;\n}\n\n.SwiftBar-module_sliderP__WI0tL {\n /* text-align: left; */\n width: 90%;\n margin-top: 0;\n margin-bottom: 0.3cm;\n margin-left: 5%;\n margin-right: 5%;\n color: #d3d3d3;\n font-weight: bold;\n}\n\n.SwiftBar-module_slider__0hP0z {\n -webkit-appearance: none; /* Override default CSS styles */\n appearance: none;\n width: 90%; /* Full-width */\n margin-left: 5%;\n height: 7px; /* Specified height */\n border-radius: 3px;\n background: #d3d3d3; /* Grey background */\n outline: none; /* Remove outline */\n opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */\n -webkit-transition: 0.2s; /* 0.2 seconds transition on hover */\n transition: opacity 0.2s;\n}\n\n.SwiftBar-module_slider__0hP0z:hover {\n opacity: 1; /* Fully shown on mouse-over */\n}\n\n.SwiftBar-module_slider__0hP0z::-webkit-slider-thumb {\n -webkit-appearance: none; /* Override default look */\n appearance: none;\n width: 26px; /* Set a specific slider handle width */\n height: 26px; /* Slider handle height */\n border-radius: 13px;\n background: #0db8de; /* Green background */\n cursor: pointer; /* Cursor on hover */\n}\n\n.SwiftBar-module_slider__0hP0z::-moz-range-thumb {\n width: 25px; /* Set a specific slider handle width */\n height: 25px; /* Slider handle height */\n background: #0db8de; /* Green background */\n cursor: pointer; /* Cursor on hover */\n}\n\n/* ----------------- SELECT ----------------- */\n.SwiftBar-module_selectDiv__IS8hH {\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n display: flex;\n align-items: center;\n padding-left: 5%;\n}\n\n.SwiftBar-module_selectLabel__XSo1K {\n color: #d3d3d3;\n font-weight: bold;\n padding-right: 5px;\n line-height: 2;\n display: inline-block;\n}\n\n.SwiftBar-module_selectSelect__2ItDn {\n min-width: 70px;\n border-radius: 2px;\n height: 1.5em;\n background-color: #383838;\n color: #d3d3d3;\n border-color: #383838;\n margin-right: 5px;\n margin-left: 5px;\n}\n\n/* ----------------- Checkbox ----------------- */\n.SwiftBar-module_checkboxDiv__lgM76 {\n color: #d3d3d3;\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n}\n\n.SwiftBar-module_checkboxLabel__BLeHI {\n color: #d3d3d3;\n margin-left: 5%;\n font-weight: bold;\n}\n\n.SwiftBar-module_checkboxCont__gnAQh {\n text-align: left;\n margin-left: 10%;\n}\n\n.SwiftBar-module_checkboxCont__gnAQh label {\n display: block;\n padding-right: 10px;\n white-space: nowrap;\n}\n\n.SwiftBar-module_checkboxCont__gnAQh input {\n /* float: left; */\n vertical-align: middle;\n}\n\n.SwiftBar-module_checkboxCont__gnAQh span {\n vertical-align: middle;\n line-height: 1.5em;\n display: inline;\n}\n\n.SwiftBar-module_checkboxDiv__lgM76 p {\n width: 90%;\n margin-top: 0;\n margin-bottom: 8px;\n margin-left: 5%;\n margin-right: 5%;\n color: #d3d3d3;\n font-weight: bold;\n}\n\n/* ----------------- Radio ----------------- */\n.SwiftBar-module_radioDiv__QHilZ {\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n color: #d3d3d3;\n}\n\n.SwiftBar-module_radioLabel__bqRHa {\n color: #d3d3d3;\n margin-left: 5%;\n font-weight: bold;\n}\n\n.SwiftBar-module_radioCont__y-lnG {\n text-align: left;\n margin-left: 10%;\n}\n\n.SwiftBar-module_radioCont__y-lnG label {\n display: block;\n padding-right: 10px;\n white-space: nowrap;\n}\n\n.SwiftBar-module_radioCont__y-lnG input {\n vertical-align: middle;\n margin-bottom: 3px;\n margin-top: 3px;\n}\n\n.SwiftBar-module_radioCont__y-lnG label span {\n vertical-align: middle;\n line-height: 1.5em;\n}\n\n.SwiftBar-module_radioDiv__QHilZ p {\n width: 90%;\n margin-top: 0;\n margin-bottom: 8px;\n margin-left: 5%;\n margin-right: 5%;\n color: #d3d3d3;\n font-weight: bold;\n}");var u1=function(e){var t=(0,M.useContext)(uY);return M.createElement("div",{className:u0.buttonDiv},M.createElement("button",{type:"button",className:u0.buttonButton,id:"button"+e.id,onClick:function(){return t({type:"userInputNoState",index:e.id,data:1})}},e.desc))},u3=function(e){return M.createElement("div",{className:u0.labelDiv},M.createElement("p",{id:"label"+e.id},e.desc))},u2=function(e){var t=(0,M.useContext)(uY),n=(0,M.useRef)(null),r=(0,M.useRef)(null),i=function(){r.current.innerHTML=n.current.value+e.unit,t({type:"userInputState",index:e.id,data:parseFloat(n.current.value),valueName:"value",value:parseFloat(n.current.value)})};return(0,M.useEffect)(function(){i()},[e.value]),M.createElement("div",{className:u0.sliderDiv,id:"slider-div"+e.id},M.createElement("p",{className:u0.sliderP,id:"desc"+e.id},e.desc),M.createElement("input",{ref:n,type:"range",value:e.value,step:e.step,min:e.min,max:e.max,className:u0.slider,id:"slider"+e.id,onInput:i}),M.createElement("div",{className:u0.sliderValDiv,id:"slider-val-div"+e.id},M.createElement("p",{className:[u0.sliderVals,u0.sliderMin].join(" "),id:"min"+e.id},e.min),M.createElement("p",{ref:r,className:[u0.sliderVals,u0.sliderVal].join(" "),id:"value"+e.id},e.value+e.unit),M.createElement("p",{className:[u0.sliderVals,u0.sliderMax].join(" "),id:"max"+e.id},e.max)))},u4=function(e){var t=(0,M.useContext)(uY),n=(0,M.useRef)(null);return(0,M.useEffect)(function(){t({type:"userInputNoState",index:e.id,data:parseInt(n.current.value)})},[e.value]),M.createElement("div",{className:u0.selectDiv},M.createElement("label",{id:"label"+e.id,className:u0.selectLabel},e.desc),M.createElement("select",{ref:n,id:"select"+e.id,className:u0.selectSelect,onChange:function(r){t({type:"userInputState",index:e.id,data:parseInt(n.current.value),valueName:"value",value:parseInt(n.current.value)})},value:e.value},e.options.map(function(t,n){return M.createElement("option",{key:e.id+" "+n,value:n},t)})))},u5=function(e){var t=(0,M.useContext)(uY),n=(0,M.useRef)(null),r=function(){for(var e=n.current.getElementsByTagName("input"),t=[],r=0;r0)},e.elements.map(function(e,t){return M.createElement(u8,E({key:e.id.toString()+t},e))}))},u9={swiftContainer:"Swift-module_swiftContainer__Wzrsc"};uZ(".Swift-module_swiftContainer__Wzrsc {\n width: 100%;\n height: 100%;\n background-color: aqua;\n position: relative;\n}");var ce=function(e,t){switch(console.log("action: ",t,"state ",e),t.type){case"newElement":return E(E({},e),{formElements:A(e.formElements,[t.data])});case"userInputState":var n=E({},e.formData),r=A(e.formElements);return n[t.index]=t.data,r[t.index-3][t.valueName]=t.value,{formElements:r,formData:n};case"userInputNoState":var i=E({},e.formData);return i[t.index]=t.data,{formElements:A(e.formElements),formData:i};case"wsUpdate":var a=A(e.formElements);return a[t.index-3]=t.data,E(E({},e),{formElements:a});case"reset":var s=E({},e.formData);return t.indices.map(function(e){delete s[e]}),{formData:s,formElements:A(e.formElements)};default:throw Error()}},ct={exports:{}},cn="object"==typeof Reflect?Reflect:null,cr=cn&&"function"==typeof cn.apply?cn.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};y=cn&&"function"==typeof cn.ownKeys?cn.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var ci=Number.isNaN||function(e){return e!=e};function ca(){ca.init.call(this)}ct.exports=ca,ct.exports.once=function(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}cm(e,t,a,{once:!0}),"error"!==t&&"function"==typeof e.on&&cm(e,"error",i,{once:!0})})},ca.EventEmitter=ca,ca.prototype._events=void 0,ca.prototype._eventsCount=0,ca.prototype._maxListeners=void 0;var cs=10;function co(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function cl(e){return void 0===e._maxListeners?ca.defaultMaxListeners:e._maxListeners}function cu(e,t,n,r){if(co(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),s=a[t]),void 0===s)s=a[t]=n,++e._eventsCount;else if("function"==typeof s?s=a[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=cl(e))>0&&s.length>i&&!s.warned){s.warned=!0;var i,a,s,o=Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=s.length,console&&console.warn&&console.warn(o)}return e}function cc(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ch(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=cc.bind(r);return i.listener=n,r.wrapFn=i,i}function cd(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var a,s=Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var o=i[e];if(void 0===o)return!1;if("function"==typeof o)cr(o,this,t);else for(var l=o.length,u=cf(o,l),n=0;n=0;a--)if(n[a]===t||n[a].listener===t){s=n[a].listener,i=a;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},ca.prototype.listeners=function(e){return cd(this,e,!0)},ca.prototype.rawListeners=function(e){return cd(this,e,!1)},ca.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):cp.call(e,t)},ca.prototype.listenerCount=cp,ca.prototype.eventNames=function(){return this._eventsCount>0?y(this._events):[]};var cg=new ct.exports.EventEmitter;let cv=new ew,cy=new ew,cx=new ew;function c_(e,t,n){let r=cv.setFromMatrixPosition(e.matrixWorld);r.project(t);let i=n.width/2,a=n.height/2;return[r.x*i+i,-(r.y*a)+a]}let cb=e=>1e-10>Math.abs(e)?0:e;function cw(e,t,n=""){let r="matrix3d(";for(let n=0;16!==n;n++)r+=cb(t[n]*e.elements[n])+(15!==n?",":")");return n+r}let cS=(f=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>cw(e,f)),cM=(m=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>cw(e,m(t),"translate(-50%,-50%)")),cT=M.forwardRef(({children:e,eps:t=.001,style:n,className:r,prepend:i,center:a,fullscreen:s,portal:o,distanceFactor:l,sprite:u=!1,transform:c=!1,occlude:h,onOcclude:d,castShadow:p,receiveShadow:f,material:m,geometry:g,zIndexRange:v=[16777271,0],calculatePosition:y=c_,as:x="div",wrapperClass:_,pointerEvents:b="auto",...w},S)=>{let{gl:E,camera:A,scene:C,size:L,raycaster:R,events:P,viewport:I}=uu(),[N]=M.useState(()=>document.createElement(x)),D=M.useRef(),k=M.useRef(null),O=M.useRef(0),z=M.useRef([0,0]),F=M.useRef(null),U=M.useRef(null),B=(null==o?void 0:o.current)||P.connected||E.domElement.parentNode,H=M.useRef(null),G=M.useRef(!1),V=M.useMemo(()=>{var e;return h&&"blending"!==h||Array.isArray(h)&&h.length&&(e=h[0])&&"object"==typeof e&&"current"in e},[h]);M.useLayoutEffect(()=>{let e=E.domElement;h&&"blending"===h?(e.style.zIndex=`${Math.floor(v[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[h]),M.useLayoutEffect(()=>{if(k.current){let e=D.current=T.createRoot(N);if(C.updateMatrixWorld(),c)N.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=y(k.current,A,L);N.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return B&&(i?B.prepend(N):B.appendChild(N)),()=>{B&&B.removeChild(N),e.unmount()}}},[B,c]),M.useLayoutEffect(()=>{_&&(N.className=_)},[_]);let W=M.useMemo(()=>c?{position:"absolute",top:0,left:0,width:L.width,height:L.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:a?"translate3d(-50%,-50%,0)":"none",...s&&{top:-L.height/2,left:-L.width/2,width:L.width,height:L.height},...n},[n,a,s,L,c]),j=M.useMemo(()=>({position:"absolute",pointerEvents:b}),[b]);M.useLayoutEffect(()=>{var t,i;G.current=!1,c?null==(t=D.current)||t.render(M.createElement("div",{ref:F,style:W},M.createElement("div",{ref:U,style:j},M.createElement("div",{ref:S,className:r,style:n,children:e})))):null==(i=D.current)||i.render(M.createElement("div",{ref:S,style:W,className:r,children:e}))});let q=M.useRef(!0);uc(e=>{if(k.current){A.updateMatrixWorld(),k.current.updateWorldMatrix(!0,!1);let e=c?z.current:y(k.current,A,L);if(c||Math.abs(O.current-A.zoom)>t||Math.abs(z.current[0]-e[0])>t||Math.abs(z.current[1]-e[1])>t){let t=function(e,t){let n=cv.setFromMatrixPosition(e.matrixWorld),r=cy.setFromMatrixPosition(t.matrixWorld),i=n.sub(r),a=t.getWorldDirection(cx);return i.angleTo(a)>Math.PI/2}(k.current,A),n=!1;V&&("blending"!==h?n=[C]:Array.isArray(h)&&(n=h.map(e=>e.current)));let r=q.current;if(n){let e=function(e,t,n,r){let i=cv.setFromMatrixPosition(e.matrixWorld),a=i.clone();a.project(t),n.setFromCamera(a,t);let s=n.intersectObjects(r,!0);if(s.length){let e=s[0].distance,t=i.distanceTo(n.ray.origin);return t({vertexShader:c?void 0:` + */lS.ConcurrentRoot=1,lS.ContinuousEventPriority=4,lS.DefaultEventPriority=16,lS.DiscreteEventPriority=1,lS.IdleEventPriority=536870912,lS.LegacyRoot=0,lw.exports=lS;let lM="undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),lT=lM?M.useEffect:M.useLayoutEffect;function lE(e){let t="function"==typeof e?function(e){let t;let n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(i!==t){let e=t;t=r?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a=(e,r=i,a=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let s=r(t);function o(){let n=r(t);if(!a(s,n)){let t=s;e(s=n,t)}}return n.add(o),()=>n.delete(o)},s=(e,t,r)=>t||r?a(e,t,r):(n.add(e),()=>n.delete(e)),o=()=>n.clear(),l={setState:r,getState:i,subscribe:s,destroy:o};return t=e(r,i,l),l}(e):e,n=(e=t.getState,n=Object.is)=>{let r;let[,i]=(0,M.useReducer)(e=>e+1,0),a=t.getState(),s=(0,M.useRef)(a),o=(0,M.useRef)(e),l=(0,M.useRef)(n),u=(0,M.useRef)(!1),c=(0,M.useRef)();void 0===c.current&&(c.current=e(a));let h=!1;(s.current!==a||o.current!==e||l.current!==n||u.current)&&(r=e(a),h=!n(c.current,r)),lT(()=>{h&&(c.current=r),s.current=a,o.current=e,l.current=n,u.current=!1});let d=(0,M.useRef)(a);lT(()=>{let e=()=>{try{let e=t.getState(),n=o.current(e);l.current(c.current,n)||(s.current=e,c.current=n,i())}catch(e){u.current=!0,i()}},n=t.subscribe(e);return t.getState()!==d.current&&e(),n},[]);let p=h?r:c.current;return(0,M.useDebugValue)(p),p};return Object.assign(n,t),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");let e=[n,t];return{next(){let t=e.length<=0;return{value:e.shift(),done:t}}}},n}var lA={exports:{}},lC={exports:{}},lL={};!function(e){function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(l,n))ui(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[o]=n,r=o);else if(ui(c,n))e[r]=c,e[u]=n,r=u;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var a,s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var u=[],c=[],h=1,d=null,p=3,f=!1,m=!1,g=!1,v="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,x="undefined"!=typeof setImmediate?setImmediate:null;function _(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else if(i.startTime<=e)r(c),i.sortIndex=i.expirationTime,t(u,i);else break;i=n(c)}}function b(e){if(g=!1,_(e),!m){if(null!==n(u))m=!0,I(w);else{var t=n(c);null!==t&&N(b,t.startTime-e)}}}function w(t,i){m=!1,g&&(g=!1,y(T),T=-1),f=!0;var a=p;try{for(_(i),d=n(u);null!==d&&(!(d.expirationTime>i)||t&&!C());){var s=d.callback;if("function"==typeof s){d.callback=null,p=d.priorityLevel;var o=s(d.expirationTime<=i);i=e.unstable_now(),"function"==typeof o?d.callback=o:d===n(u)&&r(u),_(i)}else r(u);d=n(u)}if(null!==d)var l=!0;else{var h=n(c);null!==h&&N(b,h.startTime-i),l=!1}return l}finally{d=null,p=a,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S=!1,M=null,T=-1,E=5,A=-1;function C(){return!(e.unstable_now()-Ae||125s?(r.sortIndex=a,t(c,r),null===n(u)&&r===n(c)&&(g?(y(T),T=-1):g=!0,N(b,a-s))):(r.sortIndex=o,t(u,r),m||f||(m=!0,I(w))),r},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}}(lL),lC.exports=lL,lA.exports=function(e){var t,n,r,i,a,s={},o=lC.exports,l=Object.assign;function u(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n--o||i[s]!==a[o]){var l="\n"+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=o);break}}}finally{e3=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?e1(e):""}var e4=Object.prototype.hasOwnProperty,e5=[],e6=-1;function e8(e){return{current:e}}function e7(e){0>e6||(e.current=e5[e6],e5[e6]=null,e6--)}function e9(e,t){e5[++e6]=e.current,e.current=t}var te={},tt=e8(te),tn=e8(!1),tr=te;function ti(e,t){var n=e.type.contextTypes;if(!n)return te;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,a={};for(i in n)a[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function ta(e){return null!=(e=e.childContextTypes)}function ts(){e7(tn),e7(tt)}function to(e,t,n){if(tt.current!==te)throw Error(u(168));e9(tt,t),e9(tn,n)}function tl(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in t))throw Error(u(108,function(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return A(t);case 8:return t===f?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}(e)||"Unknown",i));return l({},n,r)}function tu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||te,tr=tt.current,e9(tt,e),e9(tn,tn.current),!0}function tc(e,t,n){var r=e.stateNode;if(!r)throw Error(u(169));n?(e=tl(e,t,tr),r.__reactInternalMemoizedMergedChildContext=e,e7(tn),e7(tt),e9(tt,e)):e7(tn),e9(tn,n)}var th=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(td(e)/tp|0)|0},td=Math.log,tp=Math.LN2,tf=64,tm=4194304;function tg(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function tv(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,s=268435455&n;if(0!==s){var o=s&~i;0!==o?r=tg(o):0!=(a&=s)&&(r=tg(a))}else 0!=(s=n&~i)?r=tg(s):0!==a&&(r=tg(a));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&i)&&((i=r&-r)>=(a=t&-t)||16===i&&0!=(4194240&a)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function t_(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-th(t)]=n}function tb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-th(n),i=1<>=s,i-=s,np=1<<32-th(t)+i|n<d?(p=h,h=null):p=h.sibling;var f=g(i,h,o[d],l);if(null===f){null===h&&(h=p);break}e&&h&&null===f.alternate&&t(i,h),s=a(f,s,d),null===c?u=f:c.sibling=f,c=f,h=p}if(d===o.length)return n(i,h),nb&&nm(i,d),u;if(null===h){for(;dp?(f=d,d=null):f=d.sibling;var x=g(i,d,y.value,l);if(null===x){null===d&&(d=f);break}e&&d&&null===x.alternate&&t(i,d),s=a(x,s,p),null===h?c=x:h.sibling=x,h=x,d=f}if(y.done)return n(i,d),nb&&nm(i,p),c;if(null===d){for(;!y.done;p++,y=o.next())null!==(y=m(i,y.value,l))&&(s=a(y,s,p),null===h?c=y:h.sibling=y,h=y);return nb&&nm(i,p),c}for(d=r(i,d);!y.done;p++,y=o.next())null!==(y=v(d,i,p,y.value,l))&&(e&&null!==y.alternate&&d.delete(null===y.key?p:y.key),s=a(y,s,p),null===h?c=y:h.sibling=y,h=y);return e&&d.forEach(function(e){return t(i,e)}),nb&&nm(i,p),c}(l,c,f,y);nN(l,f)}return"string"==typeof f&&""!==f||"number"==typeof f?(f=""+f,null!==c&&6===c.tag?(n(l,c.sibling),(c=i(c,f)).return=l,l=c):(n(l,c),(c=aV(f,l.mode,y)).return=l,l=c),s(l)):n(l,c)}}var nO=nk(!0),nz=nk(!1),nF={},nU=e8(nF),nB=e8(nF),nH=e8(nF);function nG(e){if(e===nF)throw Error(u(174));return e}function nV(e,t){e9(nH,t),e9(nB,e),e9(nU,nF),e=k(t),e7(nU),e9(nU,e)}function nW(){e7(nU),e7(nB),e7(nH)}function nj(e){var t=nG(nH.current),n=nG(nU.current);t=O(n,e.type,t),n!==t&&(e9(nB,e),e9(nU,t))}function nq(e){nB.current===e&&(e7(nU),e7(nB))}var nX=e8(0);function nY(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||ez(n)||eF(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var nZ=[];function nJ(){for(var e=0;en?n:4,e(!0);var r=nQ.transition;nQ.transition={};try{e(!1),t()}finally{tw=n,nQ.transition=r}}function rA(){return rn().memoizedState}function rC(e,t,n){var r=ac(e);n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},rR(e)?rP(t,n):(rI(e,t,n),null!==(e=ah(e,r,n=au()))&&rN(e,t,r))}function rL(e,t,n){var r=ac(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(rR(e))rP(t,i);else{rI(e,t,i);var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var s=t.lastRenderedState,o=a(s,n);if(i.hasEagerState=!0,i.eagerState=o,tk(o,s))return}catch(e){}finally{}null!==(e=ah(e,r,n=au()))&&rN(e,t,r)}}function rR(e){var t=e.alternate;return e===n0||null!==t&&t===n0}function rP(e,t){n4=n2=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rI(e,t,n){null!==iY&&0!=(1&e.mode)&&0==(2&iX)?(null===(e=t.interleaved)?(n.next=n,null===t$?t$=[t]:t$.push(t)):(n.next=e.next,e.next=n),t.interleaved=n):(null===(e=t.pending)?n.next=n:(n.next=e.next,e.next=n),t.pending=n)}function rN(e,t,n){if(0!=(4194240&n)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,tb(e,n)}}var rD={readContext:tQ,useCallback:n8,useContext:n8,useEffect:n8,useImperativeHandle:n8,useInsertionEffect:n8,useLayoutEffect:n8,useMemo:n8,useReducer:n8,useRef:n8,useState:n8,useDebugValue:n8,useDeferredValue:n8,useTransition:n8,useMutableSource:n8,useSyncExternalStore:n8,useId:n8,unstable_isNewReconciler:!1},rk={readContext:tQ,useCallback:function(e,t){return rt().memoizedState=[e,void 0===t?null:t],e},useContext:tQ,useEffect:rv,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,rm(4194308,4,rb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rm(4194308,4,e,t)},useInsertionEffect:function(e,t){return rm(4,2,e,t)},useMemo:function(e,t){var n=rt();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=rt();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=rC.bind(null,n0,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},rt().memoizedState=e},useState:rd,useDebugValue:rS,useDeferredValue:function(e){var t=rd(e),n=t[0],r=t[1];return rv(function(){var t=nQ.transition;nQ.transition={};try{r(e)}finally{nQ.transition=t}},[e]),n},useTransition:function(){var e=rd(!1),t=e[0];return e=rE.bind(null,e[1]),rt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=n0,i=rt();if(nb){if(void 0===n)throw Error(u(407));n=n()}else{if(n=t(),null===iY)throw Error(u(349));0!=(30&n$)||rl(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,rv(rc.bind(null,r,a,e),[e]),r.flags|=2048,rp(9,ru.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=rt(),t=iY.identifierPrefix;if(nb){var n=nf,r=np;t=":"+t+"R"+(n=(r&~(1<<32-th(r)-1)).toString(32)+n),0<(n=n5++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=n6++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},rO={readContext:tQ,useCallback:rM,useContext:tQ,useEffect:ry,useImperativeHandle:rw,useInsertionEffect:rx,useLayoutEffect:r_,useMemo:rT,useReducer:ri,useRef:rf,useState:function(){return ri(rr)},useDebugValue:rS,useDeferredValue:function(e){var t=ri(rr),n=t[0],r=t[1];return ry(function(){var t=nQ.transition;nQ.transition={};try{r(e)}finally{nQ.transition=t}},[e]),n},useTransition:function(){return[ri(rr)[0],rn().memoizedState]},useMutableSource:rs,useSyncExternalStore:ro,useId:rA,unstable_isNewReconciler:!1},rz={readContext:tQ,useCallback:rM,useContext:tQ,useEffect:ry,useImperativeHandle:rw,useInsertionEffect:rx,useLayoutEffect:r_,useMemo:rT,useReducer:ra,useRef:rf,useState:function(){return ra(rr)},useDebugValue:rS,useDeferredValue:function(e){var t=ra(rr),n=t[0],r=t[1];return ry(function(){var t=nQ.transition;nQ.transition={};try{r(e)}finally{nQ.transition=t}},[e]),n},useTransition:function(){return[ra(rr)[0],rn().memoizedState]},useMutableSource:rs,useSyncExternalStore:ro,useId:rA,unstable_isNewReconciler:!1};function rF(e,t){try{var n="",r=t;do n+=function(e){switch(e.tag){case 5:return e1(e.type);case 16:return e1("Lazy");case 13:return e1("Suspense");case 19:return e1("SuspenseList");case 0:case 2:case 15:return e=e2(e.type,!1);case 11:return e=e2(e.type.render,!1);case 1:return e=e2(e.type,!0);default:return""}}(r),r=r.return;while(r);var i=n}catch(e){i="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:i}}function rU(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var rB="function"==typeof WeakMap?WeakMap:Map;function rH(e,t,n){(n=t2(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){i9||(i9=!0,ae=r),rU(e,t)},n}function rG(e,t,n){(n=t2(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){rU(e,t)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(n.callback=function(){rU(e,t),"function"!=typeof r&&(null===at?at=new Set([this]):at.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:null!==n?n:""})}),n}function rV(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new rB;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=aI.bind(null,e,t,n),t.then(e,e))}function rW(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function rj(e,t,n,r,i){return 0==(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=t2(-1,1)).tag=2,t4(n,t))),n.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}function rq(e){e.flags|=4}function rX(e,t){if(null!==e&&e.child===t.child)return!0;if(0!=(16&t.flags))return!1;for(e=t.child;null!==e;){if(0!=(12854&e.flags)||0!=(12854&e.subtreeFlags))return!1;e=e.sibling}return!0}if(Z)t=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)B(e,n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},n=function(){},r=function(e,t,n,r,i){(e=e.memoizedProps)!==r&&(n=G(t.stateNode,n,e,r,i,nG(nU.current)),(t.updateQueue=n)&&rq(t))},i=function(e,t,n,r){n!==r&&rq(t)};else if(J){t=function(e,n,r,i){for(var a=n.child;null!==a;){if(5===a.tag){var s=a.stateNode;r&&i&&(s=eI(s,a.type,a.memoizedProps,a)),B(e,s)}else if(6===a.tag)s=a.stateNode,r&&i&&(s=eN(s,a.memoizedProps,a)),B(e,s);else if(4!==a.tag){if(22===a.tag&&null!==a.memoizedState)null!==(s=a.child)&&(s.return=a),t(e,a,!0,!0);else if(null!==a.child){a.child.return=a,a=a.child;continue}}if(a===n)break;for(;null===a.sibling;){if(null===a.return||a.return===n)return;a=a.return}a.sibling.return=a.return,a=a.sibling}};var rY=function(e,t,n,r){for(var i=t.child;null!==i;){if(5===i.tag){var a=i.stateNode;n&&r&&(a=eI(a,i.type,i.memoizedProps,i)),eL(e,a)}else if(6===i.tag)a=i.stateNode,n&&r&&(a=eN(a,i.memoizedProps,i)),eL(e,a);else if(4!==i.tag){if(22===i.tag&&null!==i.memoizedState)null!==(a=i.child)&&(a.return=i),rY(e,i,!0,!0);else if(null!==i.child){i.child.return=i,i=i.child;continue}}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};n=function(e,t){var n=t.stateNode;if(!rX(e,t)){var r=eC(e=n.containerInfo);rY(r,t,!1,!1),n.pendingChildren=r,rq(t),eR(e,r)}},r=function(e,n,r,i,a){var s=e.stateNode,o=e.memoizedProps;if((e=rX(e,n))&&o===i)n.stateNode=s;else{var l=n.stateNode,u=nG(nU.current),c=null;o!==i&&(c=G(l,r,o,i,a,u)),e&&null===c?n.stateNode=s:(H(s=eA(s,c,r,o,i,n,e,l),r,i,a,u)&&rq(n),n.stateNode=s,e?rq(n):t(s,n,!1,!1))}},i=function(e,t,n,r){n!==r?(e=nG(nH.current),n=nG(nU.current),t.stateNode=W(r,e,n,t),rq(t)):t.stateNode=e.stateNode}}else n=function(){},r=function(){},i=function(){};function rZ(e,t){if(!nb)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function rJ(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}var rK=c.ReactCurrentOwner,rQ=!1;function r$(e,t,n,r){t.child=null===e?nz(t,null,n,r):nO(t,e.child,n,r)}function r0(e,t,n,r,i){n=n.render;var a=t.ref;return(tK(t,i),r=n9(e,t,n,r,a,i),n=re(),null===e||rQ)?(nb&&n&&nv(t),t.flags|=1,r$(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,iu(e,t,i))}function r1(e,t,n,r,i){if(null===e){var a=n.type;return"function"!=typeof a||aF(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=aB(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,r3(e,t,a,r,i))}if(a=e.child,0==(e.lanes&i)){var s=a.memoizedProps;if((n=null!==(n=n.compare)?n:tH)(s,r)&&e.ref===t.ref)return iu(e,t,i)}return t.flags|=1,(e=aU(a,r)).ref=t.ref,e.return=t,t.child=e}function r3(e,t,n,r,i){if(null!==e&&tH(e.memoizedProps,r)&&e.ref===t.ref){if(rQ=!1,0==(e.lanes&i))return t.lanes=e.lanes,iu(e,t,i);0!=(131072&e.flags)&&(rQ=!0)}return r5(e,t,n,r,i)}function r2(e,t,n){var r=t.pendingProps,i=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null},e9(iQ,iK),iK|=n;else{if(0==(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null},t.updateQueue=null,e9(iQ,iK),iK|=e,null;t.memoizedState={baseLanes:0,cachePool:null},r=null!==a?a.baseLanes:n,e9(iQ,iK),iK|=r}}else null!==a?(r=a.baseLanes|n,t.memoizedState=null):r=n,e9(iQ,iK),iK|=r;return r$(e,t,i,n),t.child}function r4(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function r5(e,t,n,r,i){var a=ta(n)?tr:tt.current;return(a=ti(t,a),tK(t,i),n=n9(e,t,n,r,a,i),r=re(),null===e||rQ)?(nb&&r&&nv(t),t.flags|=1,r$(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,iu(e,t,i))}function r6(e,t,n,r,i){if(ta(n)){var a=!0;tu(t)}else a=!1;if(tK(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),nr(t,n,r),na(t,n,r,i),r=!0;else if(null===e){var s=t.stateNode,o=t.memoizedProps;s.props=o;var l=s.context,u=n.contextType;u="object"==typeof u&&null!==u?tQ(u):ti(t,u=ta(n)?tr:tt.current);var c=n.getDerivedStateFromProps,h="function"==typeof c||"function"==typeof s.getSnapshotBeforeUpdate;h||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(o!==r||l!==u)&&ni(t,s,r,u),t0=!1;var d=t.memoizedState;s.state=d,t8(t,r,s,i),l=t.memoizedState,o!==r||d!==l||tn.current||t0?("function"==typeof c&&(ne(t,n,c,r),l=t.memoizedState),(o=t0||nn(t,n,o,r,d,l,u))?(h||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.flags|=4194308)):("function"==typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=u,r=o):("function"==typeof s.componentDidMount&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,t3(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:tG(t.type,o),s.props=u,h=t.pendingProps,d=s.context,l="object"==typeof(l=n.contextType)&&null!==l?tQ(l):ti(t,l=ta(n)?tr:tt.current);var p=n.getDerivedStateFromProps;(c="function"==typeof p||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(o!==h||d!==l)&&ni(t,s,r,l),t0=!1,d=t.memoizedState,s.state=d,t8(t,r,s,i);var f=t.memoizedState;o!==h||d!==f||tn.current||t0?("function"==typeof p&&(ne(t,n,p,r),f=t.memoizedState),(u=t0||nn(t,n,u,r,d,f,l)||!1)?(c||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(r,f,l),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(r,f,l)),"function"==typeof s.componentDidUpdate&&(t.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof s.componentDidUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),s.props=r,s.state=f,s.context=l,r=u):("function"!=typeof s.componentDidUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||o===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return r8(e,t,n,r,a,i)}function r8(e,t,n,r,i,a){r4(e,t);var s=0!=(128&t.flags);if(!r&&!s)return i&&tc(t,n,!1),iu(e,t,a);r=t.stateNode,rK.current=t;var o=s&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&s?(t.child=nO(t,e.child,null,a),t.child=nO(t,null,o,a)):r$(e,t,o,a),t.memoizedState=r.state,i&&tc(t,n,!0),t.child}function r7(e){var t=e.stateNode;t.pendingContext?to(e,t.pendingContext,t.pendingContext!==t.context):t.context&&to(e,t.context,!1),nV(e,t.containerInfo)}function r9(e,t,n,r,i){return nR(),nP(i),t.flags|=256,r$(e,t,n,r),t.child}var ie={dehydrated:null,treeContext:null,retryLane:0};function it(e){return{baseLanes:e,cachePool:null}}function ir(e,t,n){var r,i,a,s,o,l,c,h,d,p,f,m,g,v,y=t.pendingProps,x=nX.current,_=!1,b=0!=(128&t.flags);if((v=b)||(v=(null===e||null!==e.memoizedState)&&0!=(2&x)),v?(_=!0,t.flags&=-129):(null===e||null!==e.memoizedState)&&(x|=1),e9(nX,1&x),null===e)return(nA(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated))?(0==(1&t.mode)?t.lanes=1:eF(e)?t.lanes=8:t.lanes=1073741824,null):(x=y.children,e=y.fallback,_?(y=t.mode,_=t.child,x={mode:"hidden",children:x},0==(1&y)&&null!==_?(_.childLanes=0,_.pendingProps=x):_=aG(x,y,0,null),e=aH(e,y,n,null),_.return=t,e.return=t,_.sibling=e,t.child=_,t.child.memoizedState=it(n),t.memoizedState=ie,e):ii(t,x));if(null!==(x=e.memoizedState)&&null!==(v=x.dehydrated)){if(b)return 256&t.flags?(t.flags&=-257,ia(e,t,n,Error(u(422)))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(_=y.fallback,x=t.mode,y=aG({mode:"visible",children:y.children},x,0,null),_=aH(_,x,n,null),_.flags|=2,y.return=t,_.return=t,y.sibling=_,t.child=y,0!=(1&t.mode)&&nO(t,e.child,null,n),t.child.memoizedState=it(n),t.memoizedState=ie,_);if(0==(1&t.mode))t=ia(e,t,n,null);else if(eF(v))t=ia(e,t,n,Error(u(419)));else if(y=0!=(n&e.childLanes),rQ||y){if(null!==(y=iY)){switch(n&-n){case 4:_=2;break;case 16:_=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:_=32;break;case 536870912:_=268435456;break;default:_=0}0!==(y=0!=(_&(y.suspendedLanes|n))?0:_)&&y!==x.retryLane&&(x.retryLane=y,ah(e,y,-1))}aM(),t=ia(e,t,n,Error(u(421)))}else ez(v)?(t.flags|=128,t.child=e.child,eU(v,t=aD.bind(null,e)),t=null):(n=x.treeContext,K&&(n_=eV(v),nx=t,nb=!0,nS=null,nw=!1,null!==n&&(nc[nh++]=np,nc[nh++]=nf,nc[nh++]=nd,np=n.id,nf=n.overflow,nd=t)),t=ii(t,t.pendingProps.children),t.flags|=4096);return t}return _?(r=e,i=t,a=y.children,s=y.fallback,o=n,l=i.mode,c=(r=r.child).sibling,h={mode:"hidden",children:a},0==(1&l)&&i.child!==r?((a=i.child).childLanes=0,a.pendingProps=h,i.deletions=null):(a=aU(r,h)).subtreeFlags=14680064&r.subtreeFlags,null!==c?s=aU(c,s):(s=aH(s,l,o,null),s.flags|=2),s.return=i,a.return=i,a.sibling=s,i.child=a,y=s,_=t.child,x=e.child.memoizedState,_.memoizedState=null===x?it(n):{baseLanes:x.baseLanes|n,cachePool:null},_.childLanes=e.childLanes&~n,t.memoizedState=ie,y):(d=e,p=t,f=y.children,m=n,d=(g=d.child).sibling,f=aU(g,{mode:"visible",children:f}),0==(1&p.mode)&&(f.lanes=m),f.return=p,f.sibling=null,null!==d&&(null===(m=p.deletions)?(p.deletions=[d],p.flags|=16):m.push(d)),n=p.child=f,t.memoizedState=null,n)}function ii(e,t){return(t=aG({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function ia(e,t,n,r){return null!==r&&nP(r),nO(t,e.child,null,n),e=ii(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function is(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),tJ(e.return,t,n)}function io(e,t,n,r,i){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function il(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(r$(e,t,r.children,n),0!=(2&(r=nX.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))a:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&is(e,n,t);else if(19===e.tag)is(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;null===e.sibling;){if(null===e.return||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(e9(nX,r),0==(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(i=null,n=t.child;null!==n;)null!==(e=n.alternate)&&null===nY(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),io(t,!1,i,n,a);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===nY(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}io(t,!0,n,null,a);break;case"together":io(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function iu(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),i1|=t.lanes,0==(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(u(153));if(null!==t.child){for(n=aU(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=aU(e,e.pendingProps)).return=t;n.sibling=null}return t.child}var ic=!1,ih=!1,id="function"==typeof WeakSet?WeakSet:Set,ip=null;function im(e,t){var n=e.ref;if(null!==n){if("function"==typeof n)try{n(null)}catch(n){aP(e,t,n)}else n.current=null}}function ig(e,t,n){try{n()}catch(n){aP(e,t,n)}}var iv=!1;function iy(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,void 0!==a&&ig(t,n,a)}i=i.next}while(i!==r)}}function ix(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function i_(e){var t=e.ref;if(null!==t){var n=e.stateNode;e=5===e.tag?D(n):n,"function"==typeof t?t(e):t.current=e}}function ib(e,t,n){if(tD&&"function"==typeof tD.onCommitFiberUnmount)try{tD.onCommitFiberUnmount(tN,t)}catch(e){}switch(t.tag){case 0:case 11:case 14:case 15:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var r=e=e.next;do{var i=r,a=i.destroy;i=i.tag,void 0!==a&&(0!=(2&i)?ig(t,n,a):0!=(4&i)&&ig(t,n,a)),r=r.next}while(r!==e)}break;case 1:if(im(t,n),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){aP(t,n,e)}break;case 5:im(t,n);break;case 4:Z?iE(e,t,n):J&&J&&(n=eC(t=t.stateNode.containerInfo),eP(t,n))}}function iw(e,t,n){for(var r=t;;)if(ib(e,r,n),null===r.child||Z&&4===r.tag){if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}else r.child.return=r,r=r.child}function iS(e){return 5===e.tag||3===e.tag||4===e.tag}function iM(e){a:for(;;){for(;null===e.sibling;){if(null===e.return||iS(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags||null===e.child||4===e.tag)continue a;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function iT(e){if(Z){a:{for(var t=e.return;null!==t;){if(iS(t))break a;t=t.return}throw Error(u(160))}var n=t;switch(n.tag){case 5:t=n.stateNode,32&n.flags&&(eb(t),n.flags&=-33),n=iM(e),function e(t,n,r){var i=t.tag;if(5===i||6===i)t=t.stateNode,n?ev(r,t,n):ed(r,t);else if(4!==i&&null!==(t=t.child))for(e(t,n,r),t=t.sibling;null!==t;)e(t,n,r),t=t.sibling}(e,n,t);break;case 3:case 4:t=n.stateNode.containerInfo,n=iM(e),function e(t,n,r){var i=t.tag;if(5===i||6===i)t=t.stateNode,n?ey(r,t,n):ep(r,t);else if(4!==i&&null!==(t=t.child))for(e(t,n,r),t=t.sibling;null!==t;)e(t,n,r),t=t.sibling}(e,n,t);break;default:throw Error(u(161))}}}function iE(e,t,n){for(var r,i,a=t,s=!1;;){if(!s){s=a.return;a:for(;;){if(null===s)throw Error(u(160));switch(r=s.stateNode,s.tag){case 5:i=!1;break a;case 3:case 4:r=r.containerInfo,i=!0;break a}s=s.return}s=!0}if(5===a.tag||6===a.tag)iw(e,a,n),i?e_(r,a.stateNode):ex(r,a.stateNode);else if(18===a.tag)i?eK(r,a.stateNode):eJ(r,a.stateNode);else if(4===a.tag){if(null!==a.child){r=a.stateNode.containerInfo,i=!0,a.child.return=a,a=a.child;continue}}else if(ib(e,a,n),null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break;for(;null===a.sibling;){if(null===a.return||a.return===t)return;4===(a=a.return).tag&&(s=!1)}a.sibling.return=a.return,a=a.sibling}}function iA(e,t){if(Z){switch(t.tag){case 0:case 11:case 14:case 15:iy(3,t,t.return),ix(3,t),iy(5,t,t.return);return;case 1:case 12:case 17:return;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps;e=null!==e?e.memoizedProps:r;var i=t.type,a=t.updateQueue;t.updateQueue=null,null!==a&&eg(n,a,i,e,r,t)}return;case 6:if(null===t.stateNode)throw Error(u(162));n=t.memoizedProps,ef(t.stateNode,null!==e?e.memoizedProps:n,n);return;case 3:K&&null!==e&&e.memoizedState.isDehydrated&&eY(t.stateNode.containerInfo);return;case 13:case 19:iC(t);return}throw Error(u(163))}switch(t.tag){case 0:case 11:case 14:case 15:iy(3,t,t.return),ix(3,t),iy(5,t,t.return);return;case 12:case 22:case 23:return;case 13:case 19:iC(t);return;case 3:K&&null!==e&&e.memoizedState.isDehydrated&&eY(t.stateNode.containerInfo)}a:if(J){switch(t.tag){case 1:case 5:case 6:break a;case 3:case 4:eP((t=t.stateNode).containerInfo,t.pendingChildren);break a}throw Error(u(163))}}function iC(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new id),t.forEach(function(t){var r=ak.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function iL(e){for(;null!==ip;){var t=ip;if(0!=(8772&t.flags)){var n=t.alternate;try{if(0!=(8772&t.flags))switch(t.tag){case 0:case 11:case 15:ih||ix(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!ih){if(null===n)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:tG(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}}var a=t.updateQueue;null!==a&&t7(t,a,r);break;case 3:var s=t.updateQueue;if(null!==s){if(n=null,null!==t.child)switch(t.child.tag){case 5:n=D(t.child.stateNode);break;case 1:n=t.child.stateNode}t7(t,s,n)}break;case 5:var o=t.stateNode;null===n&&4&t.flags&&em(o,t.type,t.memoizedProps,t);break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:break;case 13:if(K&&null===t.memoizedState){var l=t.alternate;if(null!==l){var c=l.memoizedState;if(null!==c){var h=c.dehydrated;null!==h&&eZ(h)}}}break;default:throw Error(u(163))}ih||512&t.flags&&i_(t)}catch(e){aP(t,t.return,e)}}if(t===e){ip=null;break}if(null!==(n=t.sibling)){n.return=t.return,ip=n;break}ip=t.return}}function iR(e){for(;null!==ip;){var t=ip;if(t===e){ip=null;break}var n=t.sibling;if(null!==n){n.return=t.return,ip=n;break}ip=t.return}}function iP(e){for(;null!==ip;){var t=ip;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ix(4,t)}catch(e){aP(t,n,e)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var i=t.return;try{r.componentDidMount()}catch(e){aP(t,i,e)}}var a=t.return;try{i_(t)}catch(e){aP(t,a,e)}break;case 5:var s=t.return;try{i_(t)}catch(e){aP(t,s,e)}}}catch(e){aP(t,t.return,e)}if(t===e){ip=null;break}var o=t.sibling;if(null!==o){o.return=t.return,ip=o;break}ip=t.return}}var iI=0,iN=1,iD=2,ik=3,iO=4;if("function"==typeof Symbol&&Symbol.for){var iz=Symbol.for;iI=iz("selector.component"),iN=iz("selector.has_pseudo_class"),iD=iz("selector.role"),ik=iz("selector.test_id"),iO=iz("selector.text")}function iF(e){var t=Q(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(u(364));return t}if(null===(e=ea(e)))throw Error(u(362));return e.stateNode.current}function iU(e,t){switch(t.$$typeof){case iI:if(e.type===t.value)return!0;break;case iN:a:{t=t.value,e=[e,0];for(var n=0;n";case iN:return":has("+(iB(e)||"")+")";case iD:return'[role="'+e.value+'"]';case iO:return'"'+e.value+'"';case ik:return'[data-testname="'+e.value+'"]';default:throw Error(u(365))}}function iH(e,t){var n=[];e=[e,0];for(var r=0;ri&&(i=s),r&=~a}if(r=i,10<(r=(120>(r=tC()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*iV(r/1960))-r)){e.timeoutHandle=j(aC.bind(null,e,i5),r);break}aC(e,i5);break;default:throw Error(u(329))}}}return ap(e,tC()),e.callbackNode===n?af.bind(null,e):null}function am(e,t){var n=i4;return e.current.memoizedState.isDehydrated&&(ab(e,t).flags|=256),2!==(e=aT(e,t))&&(t=i5,i5=n,null!==t&&ag(t)),e}function ag(e){null===i5?i5=e:i5.push.apply(i5,e)}function av(e,t){for(t&=~i2,t&=~i3,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0i8&&(a.flags|=128,o=!0,rZ(l,!1),a.lanes=4194304)}}else{if(!o){if(null!==(e=nY(c))){if(a.flags|=128,o=!0,null!==(e=e.updateQueue)&&(a.updateQueue=e,a.flags|=4),rZ(l,!0),null===l.tail&&"hidden"===l.tailMode&&!c.alternate&&!nb)return rJ(a),null}else 2*tC()-l.renderingStartTime>i8&&1073741824!==s&&(a.flags|=128,o=!0,rZ(l,!1),a.lanes=4194304)}l.isBackwards?(c.sibling=a.child,a.child=c):(null!==(e=l.last)?e.sibling=c:a.child=c,l.last=c)}if(null!==l.tail)return a=l.tail,l.rendering=a,l.tail=a.sibling,l.renderingStartTime=tC(),a.sibling=null,e=nX.current,e9(nX,o?1&e|2:1&e),a;return rJ(a),null;case 22:case 23:return a_(),o=null!==a.memoizedState,null!==e&&null!==e.memoizedState!==o&&(a.flags|=8192),o&&0!=(1&a.mode)?0!=(1073741824&iK)&&(rJ(a),Z&&6&a.subtreeFlags&&(a.flags|=8192)):rJ(a),null;case 24:case 25:return null}throw Error(u(156,a.tag))}(s,a,iK))){iZ=s;return}}else{if(null!==(s=function(e,t){switch(ny(t),t.tag){case 1:return ta(t.type)&&ts(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return nW(),e7(tn),e7(tt),nJ(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return nq(t),null;case 13:if(e7(nX),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(u(340));nR()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return e7(nX),null;case 4:return nW(),null;case 10:return tZ(t.type._context),null;case 22:case 23:return a_(),null;default:return null}}(s,a))){s.flags&=32767,iZ=s;return}if(null!==e)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{i$=6,iZ=null;return}}if(null!==(a=a.sibling)){iZ=a;return}iZ=a=e}while(null!==a);0===i$&&(i$=5)}function aC(e,t){var n=tw,r=iq.transition;try{iq.transition=null,tw=1,function(e,t,n){do aL();while(null!==ar);if(0!=(6&iX))throw Error(u(327));var r=e.finishedWork,i=e.finishedLanes;if(null!==r){if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(u(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0e?16:e,null===ar)var r=!1;else{if(e=ar,ar=null,ai=0,0!=(6&iX))throw Error(u(331));var i=iX;for(iX|=4,ip=e.current;null!==ip;){var a=ip,s=a.child;if(0!=(16&ip.flags)){var o=a.deletions;if(null!==o){for(var l=0;ltC()-i6?ab(e,0):i2|=n),ap(e,t)}function aN(e,t){0===t&&(0==(1&e.mode)?t=1:(t=tm,0==(130023424&(tm<<=1))&&(tm=4194304)));var n=au();null!==(e=ad(e,t))&&(t_(e,t,n),ap(e,n))}function aD(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),aN(e,n)}function ak(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(u(314))}null!==r&&r.delete(t),aN(e,n)}function aO(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function az(e,t,n,r){return new aO(e,t,n,r)}function aF(e){return!(!(e=e.prototype)||!e.isReactComponent)}function aU(e,t){var n=e.alternate;return null===n?((n=az(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function aB(e,t,n,r,i,a){var s=2;if(r=e,"function"==typeof e)aF(e)&&(s=1);else if("string"==typeof e)s=5;else a:switch(e){case p:return aH(n.children,i,a,t);case f:s=8,i|=8;break;case m:return(e=az(12,n,t,2|i)).elementType=m,e.lanes=a,e;case x:return(e=az(13,n,t,i)).elementType=x,e.lanes=a,e;case _:return(e=az(19,n,t,i)).elementType=_,e.lanes=a,e;case S:return aG(n,i,a,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case g:s=10;break a;case v:s=9;break a;case y:s=11;break a;case b:s=14;break a;case w:s=16,r=null;break a}throw Error(u(130,null==e?e:typeof e,""))}return(t=az(s,n,t,i)).elementType=e,t.type=r,t.lanes=a,t}function aH(e,t,n,r){return(e=az(7,e,r,t)).lanes=n,e}function aG(e,t,n,r){return(e=az(22,e,r,t)).elementType=S,e.lanes=n,e.stateNode={},e}function aV(e,t,n){return(e=az(6,e,null,t)).lanes=n,e}function aW(e,t,n){return(t=az(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function aj(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=X,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=tx(0),this.expirationTimes=tx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tx(0),this.identifierPrefix=r,this.onRecoverableError=i,K&&(this.mutableSourceEagerHydrationData=null)}function aq(e,t,n,r,i,a,s,o,l){return e=new aj(e,t,n,o,l),1===t?(t=1,!0===a&&(t|=8)):t=0,a=az(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null},t1(a),e}function aX(e){if(!e)return te;e=e._reactInternals;a:{if(C(e)!==e||1!==e.tag)throw Error(u(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(ta(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(null!==t);throw Error(u(171))}if(1===e.tag){var n=e.type;if(ta(n))return tl(e,n,t)}return t}function aY(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(u(188));throw Error(u(268,e=Object.keys(e).join(",")))}return null===(e=P(t))?null:e.stateNode}function aZ(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n=c&&a>=d&&i<=h&&s<=p){e.splice(t,1);break}if(r!==c||n.width!==l.width||ps){if(!(a!==d||n.height!==l.height||hi)){c>r&&(l.width+=c-r,l.x=r),ha&&(l.height+=d-a,l.y=a),pn&&(n=s)),s ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},s.getPublicRootInstance=function(e){return(e=e.current).child?5===e.child.tag?D(e.child.stateNode):e.child.stateNode:null},s.injectIntoDevTools=function(e){if(e={bundleType:e.bundleType,version:e.version,rendererPackageName:e.rendererPackageName,rendererConfig:e.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:aK,findFiberByHostInstance:e.findFiberByHostInstance||aQ,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{tN=t.inject(e),tD=t}catch(e){}e=!!t.checkDCE}}return e},s.isAlreadyRendering=function(){return!1},s.observeVisibleRects=function(e,t,n,r){if(!ei)throw Error(u(363));var i=eh(e=iG(e,t),n,r).disconnect;return{disconnect:function(){i()}}},s.registerMutableSourceForHydration=function(e,t){var n=t._getVersion;n=n(t._source),null==e.mutableSourceEagerHydrationData?e.mutableSourceEagerHydrationData=[t,n]:e.mutableSourceEagerHydrationData.push(t,n)},s.runWithPriority=function(e,t){var n=tw;try{return tw=e,t()}finally{tw=n}},s.shouldError=function(){return null},s.shouldSuspend=function(){return!1},s.updateContainer=function(e,t,n,r){var i=t.current,a=au(),s=ac(i);return n=aX(n),null===t.context?t.context=n:t.pendingContext=n,(t=t2(a,s)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),t4(i,t),null!==(e=ah(i,s,a))&&t5(e,i,s),s},s};var lR=lA.exports;function lP(e,t,n=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;let r=e.length;if(t.length!==r)return!1;for(let i=0;ii.response=e).then(()=>{r.lifespan&&r.lifespan>0&&setTimeout(()=>{let e=lI.indexOf(i);-1!==e&&lI.splice(e,1)},r.lifespan)}).catch(e=>i.error=e)};if(lI.push(i),!n)throw i.promise}let lD=(e,t,n)=>lN(e,t,!1,n),lk=(e,t,n)=>void lN(e,t,!0,n),lO=e=>{if(void 0===e||0===e.length)lI.splice(0,lI.length);else{let t=lI.find(t=>lP(e,t.keys,t.equal));if(t){let e=lI.indexOf(t);-1!==e&&lI.splice(e,1)}}},lz=e=>e&&e.isOrthographicCamera,lF=e=>e&&e.hasOwnProperty("current"),lU="undefined"!=typeof window&&(null!=(g=window.document)&&g.createElement||(null==(v=window.navigator)?void 0:v.product)==="ReactNative")?M.useLayoutEffect:M.useEffect;function lB(e){let t=M.useRef(e);return lU(()=>void(t.current=e),[e]),t}function lH({set:e}){return lU(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}class lG extends M.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}lG.getDerivedStateFromError=()=>({error:!0});let lV="__default",lW=new Map,lj=e=>e&&!!e.memoized&&!!e.changes;function lq(e){let t="undefined"!=typeof window?window.devicePixelRatio:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}let lX=e=>{var t;return null==(t=e.__r3f)?void 0:t.root.getState()},lY={obj:e=>e===Object(e)&&!lY.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,arr:e=>Array.isArray(e),equ(e,t,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){let a;if(typeof e!=typeof t||!!e!=!!t)return!1;if(lY.str(e)||lY.num(e))return e===t;let s=lY.obj(e);if(s&&"reference"===r)return e===t;let o=lY.arr(e);if(o&&"reference"===n)return e===t;if((o||s)&&e===t)return!0;for(a in e)if(!(a in t))return!1;for(a in i?t:e)if(e[a]!==t[a])return!1;if(lY.und(a)){if(o&&0===e.length&&0===t.length||s&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;if(e!==t)return!1}return!0}};function lZ(e,t){let n=e;return(null!=t&&t.primitive||!n.__r3f)&&(n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...t}),e}function lJ(e,t){let n=e;if(!t.includes("-"))return{target:n,key:t};{let r=t.split("-"),i=r.pop();return{target:n=r.reduce((e,t)=>e[t],e),key:i}}}let lK=/-\d+$/;function lQ(e,t,n){if(lY.str(n)){if(lK.test(n)){let t=n.replace(lK,""),{target:r,key:i}=lJ(e,t);Array.isArray(r[i])||(r[i]=[])}let{target:r,key:i}=lJ(e,n);t.__r3f.previousAttach=r[i],r[i]=t}else t.__r3f.previousAttach=n(e,t)}function l$(e,t,n){var r,i;if(lY.str(n)){let{target:r,key:i}=lJ(e,n),a=t.__r3f.previousAttach;void 0===a?delete r[i]:r[i]=a}else null==(r=t.__r3f)||null==r.previousAttach||r.previousAttach(e,t);null==(i=t.__r3f)||delete i.previousAttach}function l0(e,{children:t,key:n,ref:r,...i},{children:a,key:s,ref:o,...l}={},u=!1){var c;let h=null!=(c=null==e?void 0:e.__r3f)?c:{},d=Object.entries(i),p=[];if(u){let e=Object.keys(l);for(let t=0;t{var r;if(null!=(r=e.__r3f)&&r.primitive&&"object"===t||lY.equ(n,l[t]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(t))return p.push([t,n,!0,[]]);let a=[];for(let e in t.includes("-")&&(a=t.split("-")),p.push([t,n,!1,a]),i){let n=i[e];e.startsWith(`${t}-`)&&p.push([e,n,!1,e.split("-")])}});let f={...i};return h.memoizedProps&&h.memoizedProps.args&&(f.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(f.attach=h.memoizedProps.attach),{memoized:f,changes:p}}function l1(e,t){var n,r,i;let a=null!=(n=e.__r3f)?n:{},s=a.root,o=null!=(r=null==s?void 0:null==s.getState?void 0:s.getState())?r:{},{memoized:l,changes:u}=lj(t)?t:l0(e,t),c=a.eventCount;e.__r3f&&(e.__r3f.memoizedProps=l);for(let t=0;te[t],e))&&c.set)){let[t,...r]=s.reverse();l=r.reverse().reduce((e,t)=>e[t],e),n=t}if(r===lV+"remove"){if(l.constructor){let e=lW.get(l.constructor);e||(e=new l.constructor,lW.set(l.constructor,e)),r=e[n]}else r=0}if(i)r?a.handlers[n]=r:delete a.handlers[n],a.eventCount=Object.keys(a.handlers).length;else if(c&&c.set&&(c.copy||c instanceof e9)){if(Array.isArray(r))c.fromArray?c.fromArray(r):c.set(...r);else if(c.copy&&r&&r.constructor&&c.constructor===r.constructor)c.copy(r);else if(void 0!==r){let e=c instanceof eh;!e&&c.setScalar?c.setScalar(r):c instanceof e9&&r instanceof e9?c.mask=r.mask:c.set(r);let t="ColorManagement"in lb;t||o.linear||!e||c.convertSRGBToLinear()}}else l[n]=r,!o.linear&&l[n]instanceof eg&&1023===l[n].format&&1009===l[n].type&&(l[n].encoding=3001);l3(e)}if(a.parent&&o.internal&&e.raycast&&c!==a.eventCount){let t=o.internal.interaction.indexOf(e);t>-1&&o.internal.interaction.splice(t,1),a.eventCount&&o.internal.interaction.push(e)}let h=1===u.length&&"onUpdate"===u[0][0];return!h&&u.length&&null!=(i=e.__r3f)&&i.parent&&l2(e),e}function l3(e){var t,n;let r=null==(t=e.__r3f)?void 0:null==(n=t.root)?void 0:null==n.getState?void 0:n.getState();r&&0===r.internal.frames&&r.invalidate()}function l2(e){null==e.onUpdate||e.onUpdate(e)}function l4(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function l5(e,t,n,r){let i=n.get(t);i&&(n.delete(t),0===n.size&&(e.delete(r),i.target.releasePointerCapture(r)))}let l6={},l8=e=>void(l6={...l6,...e}),l7=e=>!!(null!=e&&e.render),l9=M.createContext(null),ue=(e,t)=>{let n=lE((n,r)=>{let i;let a=new ew,s=new ew,o=new ew;function l(e=r().camera,t=s,n=r().size){let{width:i,height:l,top:u,left:c}=n,h=i/l;t instanceof ew?o.copy(t):o.set(...t);let d=e.getWorldPosition(a).distanceTo(o);if(lz(e))return{width:i/e.zoom,height:l/e.zoom,top:u,left:c,factor:1,distance:d,aspect:h};{let t=e.fov*Math.PI/180,n=2*Math.tan(t/2)*d,r=n*(i/l);return{width:r,height:n,top:u,left:c,factor:i/r,distance:d,aspect:h}}}let u=e=>n(t=>({performance:{...t.performance,current:e}})),c=new Y,h={set:n,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,invalidate:(t=1)=>e(r(),t),advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,scene:lZ(new iE),controls:null,clock:new oI,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();i&&clearTimeout(i),e.performance.current!==e.performance.min&&u(e.performance.min),i=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:l},setEvents:e=>n(t=>({...t,events:{...t.events,...e}})),setSize:(e,t,i,a,o)=>{let u=r().camera,c={width:e,height:t,top:a||0,left:o||0,updateStyle:i};n(e=>({size:c,viewport:{...e.viewport,...l(u,s,c)}}))},setDpr:e=>n(t=>{let n=lq(e);return{viewport:{...t.viewport,dpr:n,initialDpr:t.viewport.initialDpr||n}}}),setFrameloop:(e="always")=>{let t=r().clock;t.stop(),t.elapsedTime=0,"never"!==e&&(t.start(),t.elapsedTime=0),n(()=>({frameloop:e}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:M.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(e,t,n)=>{let i=r().internal;return i.priority=i.priority+(t>0?1:0),i.subscribers.push({ref:e,priority:t,store:n}),i.subscribers=i.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let n=r().internal;null!=n&&n.subscribers&&(n.priority=n.priority-(t>0?1:0),n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}};return h}),r=n.getState(),i=r.size,a=r.viewport.dpr,s=r.camera;return n.subscribe(()=>{let{camera:e,size:t,viewport:r,gl:o,set:l}=n.getState();if(t!==i||r.dpr!==a){var u;i=t,a=r.dpr,(u=e).manual||(lz(u)?(u.left=-(t.width/2),u.right=t.width/2,u.top=t.height/2,u.bottom=-(t.height/2)):u.aspect=t.width/t.height,u.updateProjectionMatrix(),u.updateMatrixWorld()),o.setPixelRatio(r.dpr),o.setSize(t.width,t.height,t.updateStyle)}e!==s&&(s=e,l(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),n.subscribe(t=>e(t)),n},ut=new Set,un=new Set,ur=new Set;function ui(e,t){if(e.size)for(let{callback:n}of e.values())n(t)}function ua(e,t){switch(e){case"before":return ui(ut,t);case"after":return ui(un,t);case"tail":return ui(ur,t)}}function us(e,t,n){let r=t.clock.getDelta();for("never"===t.frameloop&&"number"==typeof e&&(r=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),u=t.internal.subscribers,l=0;le,t){return uo()(e,t)}function uu(e,t=0){let n=uo(),r=n.getState().internal.subscribe,i=lB(e);return lU(()=>r(i,t,n),[t,r,n]),null}function uc(e,t){return function(n,...r){let i=new n;return e&&e(i),Promise.all(r.map(e=>new Promise((n,r)=>i.load(e,e=>{e.scene&&Object.assign(e,function(e){let t={nodes:{},materials:{}};return e&&e.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material)}),t}(e.scene)),n(e)},t,t=>r(Error(`Could not load ${e}: ${t.message})`))))))}}function uh(e,t,n,r){let i=Array.isArray(t)?t:[t],a=lD(uc(n,r),[e,...i],{equal:lY.equ});return Array.isArray(t)?a:a[0]}uh.preload=function(e,t,n){let r=Array.isArray(t)?t:[t];return lk(uc(n),[e,...r])},uh.clear=function(e,t){let n=Array.isArray(t)?t:[t];return lO([e,...n])};let ud=new Map,{invalidate:up,advance:uf}=function(e){let t,n,r,i=!1;function a(s){for(let l of(n=requestAnimationFrame(a),i=!0,t=0,ua("before",s),e.values())){var o;(r=l.store.getState()).internal.active&&("always"===r.frameloop||r.internal.frames>0)&&!(null!=(o=r.gl.xr)&&o.isPresenting)&&(t+=us(s,r))}if(ua("after",s),0===t)return ua("tail",s),i=!1,cancelAnimationFrame(n)}return{loop:a,invalidate:function t(n,r=1){var s;if(!n)return e.forEach(e=>t(e.store.getState()),r);null!=(s=n.gl.xr)&&s.isPresenting||!n.internal.active||"never"===n.frameloop||(n.internal.frames=Math.min(60,n.internal.frames+r),i||(i=!0,requestAnimationFrame(a)))},advance:function(t,n=!0,r,i){if(n&&ua("before",t),r)us(t,r,i);else for(let n of e.values())us(t,n.store.getState());n&&ua("after",t)}}}(ud),{reconciler:um,applyProps:ug}=function(e,t){function n(e,{args:t=[],attach:n,...r},i){let a,s=`${e[0].toUpperCase()}${e.slice(1)}`;if("primitive"===e){if(void 0===r.object)throw Error("R3F: Primitives without 'object' are invalid!");let t=r.object;a=lZ(t,{type:e,root:i,attach:n,primitive:!0})}else{let r=l6[s];if(!r)throw Error(`R3F: ${s} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(t))throw Error("R3F: The args prop must be an array!");a=lZ(new r(...t),{type:e,root:i,attach:n,memoizedProps:{args:t}})}return void 0===a.__r3f.attach&&(a instanceof tG?a.__r3f.attach="geometry":a instanceof tE&&(a.__r3f.attach="material")),"inject"!==s&&l1(a,r),a}function r(e,t){let n=!1;if(t){var r,i;null!=(r=t.__r3f)&&r.attach?lQ(e,t,t.__r3f.attach):t.isObject3D&&e.isObject3D&&(e.add(t),n=!0),n||null==(i=e.__r3f)||i.objects.push(t),t.__r3f||lZ(t,{}),t.__r3f.parent=e,l2(t),l3(t)}}function i(e,t,n){let r=!1;if(t){var i,a;if(null!=(i=t.__r3f)&&i.attach)lQ(e,t,t.__r3f.attach);else if(t.isObject3D&&e.isObject3D){t.parent=e,t.dispatchEvent({type:"added"});let i=e.children.filter(e=>e!==t),a=i.indexOf(n);e.children=[...i.slice(0,a),t,...i.slice(a)],r=!0}r||null==(a=e.__r3f)||a.objects.push(t),t.__r3f||lZ(t,{}),t.__r3f.parent=e,l2(t),l3(t)}}function a(e,t,n=!1){e&&[...e].forEach(e=>s(t,e,n))}function s(e,t,n){if(t){var r,i,s,o,l;t.__r3f&&(t.__r3f.parent=null),null!=(r=e.__r3f)&&r.objects&&(e.__r3f.objects=e.__r3f.objects.filter(e=>e!==t)),null!=(i=t.__r3f)&&i.attach?l$(e,t,t.__r3f.attach):t.isObject3D&&e.isObject3D&&(e.remove(t),null!=(o=t.__r3f)&&o.root&&function(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,r)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(r)}),n.capturedMap.forEach((e,r)=>{l5(n.capturedMap,t,e,r)})}(t.__r3f.root,t));let u=null==(s=t.__r3f)?void 0:s.primitive,c=void 0===n?null!==t.dispose&&!u:n;u||(a(null==(l=t.__r3f)?void 0:l.objects,t,c),a(t.children,t,c)),t.__r3f&&(delete t.__r3f.root,delete t.__r3f.objects,delete t.__r3f.handlers,delete t.__r3f.memoizedProps,u||delete t.__r3f),c&&t.dispose&&"Scene"!==t.type&&lC.exports.unstable_scheduleCallback(lC.exports.unstable_IdlePriority,()=>{try{t.dispose()}catch(e){}}),l3(e)}}let o=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters."),l=lR({createInstance:n,removeChild:s,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(e,t)=>{if(!t)return;let n=e.getState().scene;n.__r3f&&(n.__r3f.root=e,r(n,t))},removeChildFromContainer:(e,t)=>{t&&s(e.getState().scene,t)},insertInContainerBefore:(e,t,n)=>{if(!t||!n)return;let r=e.getState().scene;r.__r3f&&i(r,t,n)},getRootHostContext:()=>null,getChildHostContext:e=>e,finalizeInitialChildren(e){var t;let n=null!=(t=null==e?void 0:e.__r3f)?t:{};return Boolean(n.handlers)},prepareUpdate(e,t,n,r){if(e.__r3f.primitive&&r.object&&r.object!==e)return[!0];{let{args:t=[],children:i,...a}=r,{args:s=[],children:o,...l}=n;if(!Array.isArray(t))throw Error("R3F: the args prop must be an array!");if(t.some((e,t)=>e!==s[t]))return[!0];let u=l0(e,a,l,!0);return u.changes.length?[!1,u]:null}},commitUpdate(e,[t,i],a,o,l,u){t?function(e,t,i,a){var o;let l=null==(o=e.__r3f)?void 0:o.parent;if(!l)return;let u=n(t,i,e.__r3f.root);if(e.children){for(let t of e.children)t.__r3f&&r(u,t);e.children=e.children.filter(e=>!e.__r3f)}if(e.__r3f.objects.forEach(e=>r(u,e)),e.__r3f.objects=[],e.__r3f.autoRemovedBeforeAppend||s(l,e),u.parent&&(u.__r3f.autoRemovedBeforeAppend=!0),r(l,u),u.raycast&&u.__r3f.eventCount){let e=u.__r3f.root.getState();e.internal.interaction.push(u)}[a,a.alternate].forEach(e=>{null!==e&&(e.stateNode=u,e.ref&&("function"==typeof e.ref?e.ref(u):e.ref.current=u))})}(e,a,l,u):l1(e,i)},commitMount(e,t,n,r){var i;let a=null!=(i=e.__r3f)?i:{};e.raycast&&a.handlers&&a.eventCount&&e.__r3f.root.getState().internal.interaction.push(e)},getPublicInstance:e=>e,prepareForCommit:()=>null,preparePortalMount:e=>lZ(e.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(e){var t;let{attach:n,parent:r}=null!=(t=e.__r3f)?t:{};n&&r&&l$(r,e,n),e.isObject3D&&(e.visible=!1),l3(e)},unhideInstance(e,t){var n;let{attach:r,parent:i}=null!=(n=e.__r3f)?n:{};r&&i&&lQ(i,e,r),(e.isObject3D&&null==t.visible||t.visible)&&(e.visible=!0),l3(e)},createTextInstance:o,hideTextInstance:o,unhideTextInstance:o,getCurrentEventPriority:()=>t?t():lw.exports.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:"undefined"!=typeof performance&&lY.fun(performance.now)?performance.now:lY.fun(Date.now)?Date.now:()=>0,scheduleTimeout:lY.fun(setTimeout)?setTimeout:void 0,cancelTimeout:lY.fun(clearTimeout)?clearTimeout:void 0});return{reconciler:l,applyProps:l1}}(0,function(){var e;let t="undefined"!=typeof self&&self||"undefined"!=typeof window&&window;if(!t)return lw.exports.DefaultEventPriority;let n=null==(e=t.event)?void 0:e.type;switch(n){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return lw.exports.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return lw.exports.ContinuousEventPriority;default:return lw.exports.DefaultEventPriority}}),uv={objects:"shallow",strict:!1},uy=(e,t)=>{let n="function"==typeof e?e(t):e;return l7(n)?n:new iw({powerPreference:"high-performance",canvas:t,antialias:!0,alpha:!0,...e})};function ux({store:e,children:t,onCreated:n,rootElement:r}){return lU(()=>{let t=e.getState();t.set(e=>({internal:{...e.internal,active:!0}})),n&&n(t),e.getState().events.connected||null==t.events.connect||t.events.connect(r)},[]),M.createElement(l9.Provider,{value:e},t)}function u_(e,t){let n=ud.get(e),r=null==n?void 0:n.fiber;if(r){let i=null==n?void 0:n.store.getState();i&&(i.internal.active=!1),um.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var n,r,a,s;null==i.events.disconnect||i.events.disconnect(),null==(n=i.gl)||null==(r=n.renderLists)||null==r.dispose||r.dispose(),null==(a=i.gl)||null==a.forceContextLoss||a.forceContextLoss(),null!=(s=i.gl)&&s.xr&&i.xr.disconnect(),function(e){for(let t in e.dispose&&"Scene"!==e.type&&e.dispose(),e)null==t.dispose||t.dispose(),delete e[t]}(i),ud.delete(e),t&&t(e)}catch(e){}},500)})}}function ub(){return(ub=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0?i=setTimeout(r,t-u):(i=null,n||(l=e.apply(s,a),s=a=null))}null==t&&(t=100);var i,a,s,o,l,u=function(){s=this,a=arguments,o=Date.now();var u=n&&!i;return i||(i=setTimeout(r,t)),u&&(l=e.apply(s,a),s=a=null),l};return u.clear=function(){i&&(clearTimeout(i),i=null)},u.flush=function(){i&&(l=e.apply(s,a),s=a=null,clearTimeout(i),i=null)},u}um.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:M.version}),uw.debounce=uw;let uS=["x","y","top","bottom","left","right","width","height"],uM=(e,t)=>uS.every(n=>e[n]===t[n]);var uT=Object.defineProperty,uE=Object.defineProperties,uA=Object.getOwnPropertyDescriptors,uC=Object.getOwnPropertySymbols,uL=Object.prototype.hasOwnProperty,uR=Object.prototype.propertyIsEnumerable,uP=(e,t,n)=>t in e?uT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uI=(e,t)=>{for(var n in t||(t={}))uL.call(t,n)&&uP(e,n,t[n]);if(uC)for(var n of uC(t))uR.call(t,n)&&uP(e,n,t[n]);return e},uN=(e,t)=>uE(e,uA(t));function uD(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}let uk=uD(M.createContext(null));class uO extends M.Component{render(){return M.createElement(uk.Provider,{value:this._reactInternals},this.props.children)}}let{ReactCurrentOwner:uz,ReactCurrentDispatcher:uF}=M.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,uU={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function uB(e){let{handlePointer:t}=function(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let r=e.eventObject,i=r.__r3f,a=null==i?void 0:i.handlers;if(n.hovered.delete(l4(e)),null!=i&&i.eventCount){let n={...e,intersections:t};null==a.onPointerOut||a.onPointerOut(n),null==a.onPointerLeave||a.onPointerLeave(n)}}}function r(e,t){for(let n=0;nn([]);case"onLostPointerCapture":return t=>{let{internal:r}=e.getState();"pointerId"in t&&r.capturedMap.has(t.pointerId)&&(r.capturedMap.delete(t.pointerId),n([]))}}return function(a){let{onPointerMissed:s,internal:o}=e.getState();o.lastEvent.current=a;let l="onPointerMove"===i,u="onClick"===i||"onContextMenu"===i||"onDoubleClick"===i,c=function(t,n){let r=e.getState(),i=new Set,a=[],s=n?n(r.internal.interaction):r.internal.interaction;for(let e=0;e{let n=lX(e.object),r=lX(t.object);return n&&r&&r.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=l4(e);return!i.has(t)&&(i.add(t),!0)});for(let e of(r.events.filter&&(o=r.events.filter(o,r)),o)){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&r.internal.capturedMap.has(t.pointerId))for(let e of r.internal.capturedMap.get(t.pointerId).values())i.has(l4(e.intersection))||a.push(e.intersection);return a}(a,l?t:void 0),h=u?function(t){let{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}(a):0;"onPointerDown"===i&&(o.initialClick=[a.offsetX,a.offsetY],o.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&h<=2&&(r(a,o.interaction),s&&s(a)),l&&n(c),function(t,r,i,a){let s=e.getState();if(t.length){let e={stopped:!1};for(let o of t){let l=lX(o.object)||s,{raycaster:u,pointer:c,camera:h,internal:d}=l,p=new ew(c.x,c.y,0).unproject(h),f=e=>{var t,n;return null!=(t=null==(n=d.capturedMap.get(e))?void 0:n.has(o.eventObject))&&t},m=e=>{let t={intersection:o,target:r.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,t):d.capturedMap.set(e,new Map([[o.eventObject,t]])),r.target.setPointerCapture(e)},g=e=>{let t=d.capturedMap.get(e);t&&l5(d.capturedMap,o.eventObject,t,e)},v={};for(let e in r){let t=r[e];"function"!=typeof t&&(v[e]=t)}let y={...o,...v,pointer:c,intersections:t,stopped:e.stopped,delta:i,unprojectedPoint:p,ray:u.ray,camera:h,stopPropagation(){let i="pointerId"in r&&d.capturedMap.get(r.pointerId);if((!i||i.has(o.eventObject))&&(y.stopped=e.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject))){let e=t.slice(0,t.indexOf(o));n([...e,o])}},target:{hasPointerCapture:f,setPointerCapture:m,releasePointerCapture:g},currentTarget:{hasPointerCapture:f,setPointerCapture:m,releasePointerCapture:g},nativeEvent:r};if(a(y),!0===e.stopped)break}}}(c,a,h,function(e){let t=e.eventObject,n=t.__r3f,s=null==n?void 0:n.handlers;if(null!=n&&n.eventCount){if(l){if(s.onPointerOver||s.onPointerEnter||s.onPointerOut||s.onPointerLeave){let t=l4(e),n=o.hovered.get(t);n?n.stopped&&e.stopPropagation():(o.hovered.set(t,e),null==s.onPointerOver||s.onPointerOver(e),null==s.onPointerEnter||s.onPointerEnter(e))}null==s.onPointerMove||s.onPointerMove(e)}else{let n=s[i];n?(!u||o.initialHits.includes(t))&&(r(a,o.interaction.filter(e=>!o.initialHits.includes(e))),n(e)):u&&o.initialHits.includes(t)&&r(a,o.interaction.filter(e=>!o.initialHits.includes(e)))}}})}}}}(e);return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-(2*(e.offsetY/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(uU).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var t;let{events:n,internal:r}=e.getState();null!=(t=r.lastEvent)&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var n;let{set:r,events:i}=e.getState();null==i.disconnect||i.disconnect(),r(e=>({events:{...e.events,connected:t}})),Object.entries(null!=(n=i.handlers)?n:[]).forEach(([e,n])=>{let[r,i]=uU[e];t.addEventListener(r,n,{passive:i})})},disconnect:()=>{let{set:t,events:n}=e.getState();if(n.connected){var r;Object.entries(null!=(r=n.handlers)?r:[]).forEach(([e,t])=>{if(n&&n.connected instanceof HTMLElement){let[r]=uU[e];n.connected.removeEventListener(r,t)}}),t(e=>({events:{...e.events,connected:void 0}}))}}}}let uH=M.forwardRef(function({children:e,fallback:t,resize:n,style:r,gl:i,events:a=uB,eventSource:s,eventPrefix:o,shadows:l,linear:u,flat:c,legacy:h,orthographic:d,frameloop:p,dpr:f,performance:m,raycaster:g,camera:v,onPointerMissed:y,onCreated:x,..._},b){M.useMemo(()=>l8(lb),[]);let w=function(){var e,t;let n=function(){let e=M.useContext(uk);if(!e)throw Error("its-fine: useFiber must be called within a !");let t=M.useId(),n=M.useMemo(()=>{var n;return null!=(n=uz.current)?n:function e(t,n,r){if(!t)return;if(!0===r(t))return t;let i=n?t.return:t.child;for(;i;){let t=e(i,n,r);if(t)return t;i=n?null:i.sibling}}(e,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}})},[e,t]);return n}(),[r]=M.useState(()=>new Map);r.clear();let i=n;for(;i;){let n=null==(e=i.type)?void 0:e._context;n&&n!==uk&&!r.has(n)&&r.set(n,null==(t=uF.current)?void 0:t.readContext(uD(n))),i=i.return}return M.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>M.createElement(e,null,M.createElement(t.Provider,uN(uI({},n),{value:r.get(t)}))),e=>M.createElement(uO,uI({},e))),[r])}(),[S,T]=function(e){var t;let{debounce:n,scroll:r,polyfill:i,offsetSize:a}=void 0===e?{debounce:0,scroll:!1,offsetSize:!1}:e,s=i||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[o,l]=(0,M.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=(0,M.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),c=n?"number"==typeof n?n:n.scroll:null,h=n?"number"==typeof n?n:n.resize:null,d=(0,M.useRef)(!1);(0,M.useEffect)(()=>(d.current=!0,()=>void(d.current=!1)));let[p,f,m]=(0,M.useMemo)(()=>{let e=()=>{if(!u.current.element)return;let{left:e,top:t,width:n,height:r,bottom:i,right:s,x:o,y:c}=u.current.element.getBoundingClientRect(),h={left:e,top:t,width:n,height:r,bottom:i,right:s,x:o,y:c};u.current.element instanceof HTMLElement&&a&&(h.height=u.current.element.offsetHeight,h.width=u.current.element.offsetWidth),Object.freeze(h),d.current&&!uM(u.current.lastBounds,h)&&l(u.current.lastBounds=h)};return[e,h?uw(e,h):e,c?uw(e,c):e]},[l,a,c,h]);function g(){u.current.scrollContainers&&(u.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",m,!0)),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null)}function v(){u.current.element&&(u.current.resizeObserver=new s(m),u.current.resizeObserver.observe(u.current.element),r&&u.current.scrollContainers&&u.current.scrollContainers.forEach(e=>e.addEventListener("scroll",m,{capture:!0,passive:!0})))}let y=e=>{e&&e!==u.current.element&&(g(),u.current.element=e,u.current.scrollContainers=function e(t){let n=[];if(!t||t===document.body)return n;let{overflow:r,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[r,i,a].some(e=>"auto"===e||"scroll"===e)&&n.push(t),[...n,...e(t.parentElement)]}(e),v())};return t=Boolean(r),(0,M.useEffect)(()=>{if(t)return window.addEventListener("scroll",m,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",m,!0)},[m,t]),(0,M.useEffect)(()=>(window.addEventListener("resize",f),()=>void window.removeEventListener("resize",f)),[f]),(0,M.useEffect)(()=>{g(),v()},[r,m,f]),(0,M.useEffect)(()=>g,[]),[y,o,p]}({scroll:!0,debounce:{scroll:50,resize:0},...n}),E=M.useRef(null),A=M.useRef(null),[C,L]=M.useState(null);M.useImperativeHandle(b,()=>E.current);let R=lB(y),[P,I]=M.useState(!1),[N,D]=M.useState(!1);if(P)throw P;if(N)throw N;let k=M.useRef(null);return T.width>0&&T.height>0&&C&&(k.current||(k.current=function(e){let t;let n=ud.get(e),r=null==n?void 0:n.fiber,i=null==n?void 0:n.store;n&&console.warn("R3F.createRoot should only be called once!");let a="function"==typeof reportError?reportError:console.error,s=i||ue(up,uf),o=r||um.createContainer(s,lw.exports.ConcurrentRoot,null,!1,null,"",a,null);n||ud.set(e,{fiber:o,store:s});let l=!1;return{configure(n={}){let{gl:r,size:i,events:a,onCreated:o,shadows:u=!1,linear:c=!1,flat:h=!1,legacy:d=!1,orthographic:p=!1,frameloop:f="always",dpr:m=[1,2],performance:g,raycaster:v,camera:y,onPointerMissed:x}=n,_=s.getState(),b=_.gl;_.gl||_.set({gl:b=uy(r,e)});let w=_.raycaster;w||_.set({raycaster:w=new o5});let{params:S,...M}=v||{};if(lY.equ(M,w,uv)||ug(w,{...M}),lY.equ(S,w.params,uv)||ug(w,{params:{...w.params,...S}}),!_.camera){let e=y instanceof ne,t=e?y:p?new nT(0,0,0,0,.1,1e3):new nt(75,0,.1,1e3);e||(t.position.z=5,y&&ug(t,y),null!=y&&y.rotation||t.lookAt(0,0,0)),_.set({camera:t})}if(!_.xr){let e=(e,t)=>{let n=s.getState();"never"!==n.frameloop&&uf(e,!0,n,t)},t=()=>{let t=s.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||up(t)},n={connect(){let e=s.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){let e=s.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};b.xr&&n.connect(),_.set({xr:n})}if(b.shadowMap){let e=b.shadowMap.enabled,t=b.shadowMap.type;if(b.shadowMap.enabled=!!u,lY.boo(u))b.shadowMap.type=2;else if(lY.str(u)){var T;b.shadowMap.type=null!=(T=({basic:0,percentage:1,soft:2,variance:3})[u])?T:2}else lY.obj(u)&&Object.assign(b.shadowMap,u);(e!==b.shadowMap.enabled||t!==b.shadowMap.type)&&(b.shadowMap.needsUpdate=!0)}"ColorManagement"in lb&&function(e,t,n){let r=n.pop(),i=n.reduce((e,t)=>e[t],e);i[r]=t}(lb,d,["ColorManagement","legacyMode"]);let E=c?3e3:3001,A=h?0:4;b.outputEncoding!==E&&(b.outputEncoding=E),b.toneMapping!==A&&(b.toneMapping=A),_.legacy!==d&&_.set(()=>({legacy:d})),_.linear!==c&&_.set(()=>({linear:c})),_.flat!==h&&_.set(()=>({flat:h})),!r||lY.fun(r)||l7(r)||lY.equ(r,b,uv)||ug(b,r),a&&!_.events.handlers&&_.set({events:a(s)}),m&&_.viewport.dpr!==lq(m)&&_.setDpr(m);let C=function(e,t){if(t)return t;if(e instanceof HTMLCanvasElement&&e.parentElement){let{width:t,height:n,top:r,left:i}=e.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:i}}return{width:0,height:0,top:0,left:0}}(e,i);return lY.equ(C,_.size,uv)||_.setSize(C.width,C.height,C.updateStyle,C.top,C.left),_.frameloop!==f&&_.setFrameloop(f),_.onPointerMissed||_.set({onPointerMissed:x}),g&&!lY.equ(g,_.performance,uv)&&_.set(e=>({performance:{...e.performance,...g}})),t=o,l=!0,this},render(n){return l||this.configure(),um.updateContainer(M.createElement(ux,{store:s,children:n,onCreated:t,rootElement:e}),o,null,()=>void 0),s},unmount(){u_(e)}}}(C)),k.current.configure({gl:i,events:a,shadows:l,linear:u,flat:c,legacy:h,orthographic:d,frameloop:p,dpr:f,performance:m,raycaster:g,camera:v,size:T,onPointerMissed:(...e)=>null==R.current?void 0:R.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(s?lF(s)?s.current:s:A.current),o&&e.setEvents({compute:(e,t)=>{let n=e[o+"X"],r=e[o+"Y"];t.pointer.set(n/t.size.width*2-1,-(2*(r/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==x||x(e)}}),k.current.render(M.createElement(w,null,M.createElement(lG,{set:D},M.createElement(M.Suspense,{fallback:M.createElement(lH,{set:I})},e))))),lU(()=>{L(E.current)},[]),M.useEffect(()=>{if(C)return()=>u_(C)},[C]),M.createElement("div",ub({ref:A,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:s?"none":"auto",...r}},_),M.createElement("div",{ref:S,style:{width:"100%",height:"100%"}},M.createElement("canvas",{ref:E,style:{display:"block"}},t)))}),uG=M.forwardRef(function(e,t){return M.createElement(uO,null,M.createElement(uH,ub({},e,{ref:t})))});var uV=null,uW=null,uj=function(e,t){var n=document.createElement("a");"string"==typeof n.download&&(document.body.appendChild(n),n.download=t,n.href=e,n.click(),document.body.removeChild(n))},uq=function(e){var t=ul(function(e){return e.gl});ul(function(e){return e.camera}),ul(function(e){return e.scene}),(0,M.useEffect)(function(){null===uV&&Promise.all([n.e(633),n.e(509)]).then(n.bind(n,8509)).then(function(e){return e.C}).then(function(e){uV=e.default}),null===uW&&Promise.all([n.e(633),n.e(124)]).then(n.bind(n,5124)).then(function(e){return e.C}).then(function(e){uW=e.default})},[]);var r=(0,M.useMemo)(function(){return uV&&uW?uV&&("webm"===e.format||"gif"===e.format)?new uV({format:e.format,framerate:e.framerate,verbose:!0,motionBlurFrames:!1,display:!0,quality:100,workersPath:"./"}):new uW({format:e.format,framerate:e.framerate,verbose:!0,motionBlurFrames:!1,display:!0,quality:100,workersPath:"./"}):null},[e.format,e.framerate]);return(0,M.useEffect)(function(){e.startRecord&&(console.log("HUIGHIUG"),e.setStates(E(E({},e),{startRecord:!1,isRecording:!0,shouldCapture:!0})),r.start()),e.stopRecord&&(r.stop(),r.save(function(t){var n,r=window.URL.createObjectURL(t),i=document.createElement("a");i.href=r,i.setAttribute("download",e.filename+"."+("webm"===(n=e.format)||"gif"===n?n:"tar")),i.click()}),e.setStates(E(E({},e),{stopRecord:!1,isRecording:!1}))),e.screenshot&&(uj(t.domElement.toDataURL("image/png"),e.snap_filename+".png"),e.setStates(E(E({},e),{screenshot:!1})))},[e.startRecord,e.stopRecord,e.screenshot]),uu(function(t){var n=t.gl,i=t.scene,a=t.camera;e.isRecording||n.render(i,a),e.isRecording&&("jpeg"===e.format||"png"===e.format||"gif"===e.format)?(n.render(i,a),r.capture(n.domElement)):e.isRecording&&e.shouldCapture&&(n.render(i,a),r.capture(n.domElement),e.setStates(E(E({},e),{shouldCapture:!1})))},1),M.createElement(M.Fragment,null)},uX=M.createContext(null);function uY(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var uZ={info:"SwiftInfo-module_info__mv3Pe",fps:"SwiftInfo-module_fps__kSPPS",simTime:"SwiftInfo-module_simTime__u0SeI",spacer:"SwiftInfo-module_spacer__bwEmU",button:"SwiftInfo-module_button__gCRw6",svg:"SwiftInfo-module_svg__A7QrM",sr:"SwiftInfo-module_sr__HqlGA"};uY('.SwiftInfo-module_info__mv3Pe {\n float: right;\n z-index: 10000;\n position: absolute;\n top: 0px;\n right: 0px;\n height: 32px;\n width: 245px;\n color: #969696;\n text-align: left;\n background-color: #1e1e1e;\n border-radius: 0px 0px 0px 15px;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;\n font-size: 13px;\n}\n\n.SwiftInfo-module_info__mv3Pe .SwiftInfo-module_fps__kSPPS {\n position: absolute;\n top: 50%;\n width: 60px;\n display: inline-block;\n transform: translateY(-50%);\n right: 120px;\n}\n\n.SwiftInfo-module_info__mv3Pe .SwiftInfo-module_simTime__u0SeI {\n position: absolute;\n top: 50%;\n width: 80px;\n display: inline-block;\n transform: translateY(-50%);\n right: 130px;\n}\n\n.SwiftInfo-module_spacer__bwEmU {\n float: right;\n width: 10px;\n height: 10px;\n}\n\n.SwiftInfo-module_button__gCRw6 {\n float: right;\n background-color: #1e1e1e;\n width: 26px;\n height: 26px;\n border: none;\n border-radius: 16px;\n margin: 3px;\n padding: 3px;\n transition-duration: 0.2s;\n outline: none;\n}\n\n.SwiftInfo-module_svg__A7QrM {\n width: 20px;\n height: 20px;\n}\n\n.SwiftInfo-module_button__gCRw6:enabled:hover {\n background-color: #616161;\n}\n\n.SwiftInfo-module_button__gCRw6:enabled:active {\n background-color: #8f8f8f;\n}\n\n.SwiftInfo-module_button__gCRw6:disabled {\n opacity: 0.65;\n}\n\n.SwiftInfo-module_sr__HqlGA {\n height: 1px;\n overflow: hidden;\n position: absolute;\n width: 1px;\n}');var uJ=function(e){var t=Math.floor(e),n=Math.floor(t/60),r=1e3*e%1e3,i="",a="";return r=Math.round(r),t%=60,i=t<10?"0"+t:t.toString(),a=n<10?"0"+n:n.toString(),r<10?r*=100:r<100&&(r*=10),a+":"+i+"."+(0===r?"000":r.toString())},uK=function(e){return M.createElement("button",{className:uZ.button,onClick:e.onClick,title:e.title,disabled:e.connected},M.createElement("img",{className:uZ.svg,src:e.path}))},uQ=function(e){var t=(0,M.useContext)(uX),n=(0,M.useState)("icons/pause.svg"),r=n[0],i=n[1],a=(0,M.useState)("icons/realtime.svg"),s=a[0],o=a[1],l=(0,M.useState)("icons/stopRender.svg"),u=l[0],c=l[1],h=(0,M.useState)("Pause the simulation"),d=h[0],p=h[1],f=(0,M.useState)("Play at real-time"),m=f[0],g=f[1],v=(0,M.useState)("Stop rendering (simulation continues)"),y=v[0],x=v[1],_=(0,M.useState)(!1),b=_[0],w=_[1],S=(0,M.useState)(!0),T=S[0],E=S[1],A=(0,M.useState)(!0),C=A[0],L=A[1];return M.createElement("div",{className:uZ.info},M.createElement("div",{className:uZ.spacer}),M.createElement(uK,{path:r,onClick:function(){var e;b?(p("Pause the simulation"),i("icons/pause.svg"),e=!1):(p("Continue the simulation"),i("icons/play.svg"),e=!0),w(e),t({type:"userInputNoState",index:0,data:e})},title:d,connected:!e.connected}),M.createElement(uK,{path:s,onClick:function(){var e;T?(g("Play at full speed"),o("icons/fasttime.svg"),e=!1):(g("Play at real-time"),o("icons/realtime.svg"),e=!0),E(e),t({type:"userInputNoState",index:1,data:e})},title:m,connected:!e.connected}),M.createElement(uK,{path:u,onClick:function(){var e;C?(x("Start rendering"),c("icons/startRender.svg"),e=!1):(x("Stop rendering (simulation continues)"),c("icons/stopRender.svg"),e=!0),L(e),t({type:"userInputNoState",index:2,data:e})},title:y,connected:!e.connected}),M.createElement(uK,{path:"icons/snap.svg",onClick:function(){e.screenshot("swift_snap")},title:"Take screenshot",connected:!e.connected}),M.createElement("div",{className:uZ.simTime},uJ(e.time)))},u$={sidenav:"SwiftBar-module_sidenav__Ux6xv",buttonDiv:"SwiftBar-module_buttonDiv__PkVia",buttonButton:"SwiftBar-module_buttonButton__lEKE8",labelDiv:"SwiftBar-module_labelDiv__aDTlE",sliderDiv:"SwiftBar-module_sliderDiv__tUViB",sliderValDiv:"SwiftBar-module_sliderValDiv__R3QLp",sliderVals:"SwiftBar-module_sliderVals__BOmPO",sliderMin:"SwiftBar-module_sliderMin__u0Nae",sliderVal:"SwiftBar-module_sliderVal__ya40a",sliderMax:"SwiftBar-module_sliderMax__VOStu",sliderP:"SwiftBar-module_sliderP__WI0tL",slider:"SwiftBar-module_slider__0hP0z",selectDiv:"SwiftBar-module_selectDiv__IS8hH",selectLabel:"SwiftBar-module_selectLabel__XSo1K",selectSelect:"SwiftBar-module_selectSelect__2ItDn",checkboxDiv:"SwiftBar-module_checkboxDiv__lgM76",checkboxLabel:"SwiftBar-module_checkboxLabel__BLeHI",checkboxCont:"SwiftBar-module_checkboxCont__gnAQh",radioDiv:"SwiftBar-module_radioDiv__QHilZ",radioLabel:"SwiftBar-module_radioLabel__bqRHa",radioCont:"SwiftBar-module_radioCont__y-lnG"};uY(".SwiftBar-module_sidenav__Ux6xv {\n height: 100%;\n width: 20%;\n min-width: 3cm;\n max-width: 7cm;\n position: fixed;\n z-index: 1;\n top: 0;\n left: 0;\n background-color: #1e1e1e;\n overflow-x: hidden;\n padding-top: 20px;\n}\n\n/* ----------------- Button ----------------- */\n.SwiftBar-module_buttonDiv__PkVia {\n display: flex;\n justify-content: center;\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n}\n\n.SwiftBar-module_buttonButton__lEKE8 {\n background-color: #383838;\n text-align: center;\n min-width: 80%;\n max-width: 90%;\n border: none;\n color: #d3d3d3;\n height: 2.5em;\n border-radius: 2px;\n transition-duration: 0.2s;\n}\n\n.SwiftBar-module_buttonButton__lEKE8:hover {\n background-color: #616161; /* Green */\n color: white;\n}\n\n.SwiftBar-module_buttonButton__lEKE8:active {\n background-color: #8f8f8f; /* Green */\n color: white;\n}\n\n/* ----------------- Label ----------------- */\n.SwiftBar-module_labelDiv__aDTlE {\n text-align: center;\n display: flex;\n justify-content: center;\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 1cm;\n}\n\n.SwiftBar-module_labelDiv__aDTlE p {\n font-size: 1.3em;\n width: 90%;\n margin-top: 0;\n margin-left: 5%;\n margin-right: 5%;\n margin-bottom: 0;\n color: #d3d3d3;\n font-weight: bold;\n}\n\n/* ----------------- SLIDERS ----------------- */\n.SwiftBar-module_sliderDiv__tUViB {\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n}\n\n.SwiftBar-module_sliderValDiv__R3QLp {\n margin-left: 5%;\n margin-top: 0.3cm;\n margin-bottom: 0;\n width: 90%;\n}\n\n.SwiftBar-module_sliderVals__BOmPO {\n display: inline-block;\n width: 33%;\n margin: 0;\n}\n\n.SwiftBar-module_sliderMin__u0Nae {\n text-align: left;\n color: #8a8a8a;\n}\n\n.SwiftBar-module_sliderVal__ya40a {\n text-align: center;\n color: #8a8a8a;\n}\n\n.SwiftBar-module_sliderMax__VOStu {\n text-align: right;\n color: #8a8a8a;\n}\n\n.SwiftBar-module_sliderP__WI0tL {\n /* text-align: left; */\n width: 90%;\n margin-top: 0;\n margin-bottom: 0.3cm;\n margin-left: 5%;\n margin-right: 5%;\n color: #d3d3d3;\n font-weight: bold;\n}\n\n.SwiftBar-module_slider__0hP0z {\n -webkit-appearance: none; /* Override default CSS styles */\n appearance: none;\n width: 90%; /* Full-width */\n margin-left: 5%;\n height: 7px; /* Specified height */\n border-radius: 3px;\n background: #d3d3d3; /* Grey background */\n outline: none; /* Remove outline */\n opacity: 0.7; /* Set transparency (for mouse-over effects on hover) */\n -webkit-transition: 0.2s; /* 0.2 seconds transition on hover */\n transition: opacity 0.2s;\n}\n\n.SwiftBar-module_slider__0hP0z:hover {\n opacity: 1; /* Fully shown on mouse-over */\n}\n\n.SwiftBar-module_slider__0hP0z::-webkit-slider-thumb {\n -webkit-appearance: none; /* Override default look */\n appearance: none;\n width: 26px; /* Set a specific slider handle width */\n height: 26px; /* Slider handle height */\n border-radius: 13px;\n background: #0db8de; /* Green background */\n cursor: pointer; /* Cursor on hover */\n}\n\n.SwiftBar-module_slider__0hP0z::-moz-range-thumb {\n width: 25px; /* Set a specific slider handle width */\n height: 25px; /* Slider handle height */\n background: #0db8de; /* Green background */\n cursor: pointer; /* Cursor on hover */\n}\n\n/* ----------------- SELECT ----------------- */\n.SwiftBar-module_selectDiv__IS8hH {\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n display: flex;\n align-items: center;\n padding-left: 5%;\n}\n\n.SwiftBar-module_selectLabel__XSo1K {\n color: #d3d3d3;\n font-weight: bold;\n padding-right: 5px;\n line-height: 2;\n display: inline-block;\n}\n\n.SwiftBar-module_selectSelect__2ItDn {\n min-width: 70px;\n border-radius: 2px;\n height: 1.5em;\n background-color: #383838;\n color: #d3d3d3;\n border-color: #383838;\n margin-right: 5px;\n margin-left: 5px;\n}\n\n/* ----------------- Checkbox ----------------- */\n.SwiftBar-module_checkboxDiv__lgM76 {\n color: #d3d3d3;\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n}\n\n.SwiftBar-module_checkboxLabel__BLeHI {\n color: #d3d3d3;\n margin-left: 5%;\n font-weight: bold;\n}\n\n.SwiftBar-module_checkboxCont__gnAQh {\n text-align: left;\n margin-left: 10%;\n}\n\n.SwiftBar-module_checkboxCont__gnAQh label {\n display: block;\n padding-right: 10px;\n white-space: nowrap;\n}\n\n.SwiftBar-module_checkboxCont__gnAQh input {\n /* float: left; */\n vertical-align: middle;\n}\n\n.SwiftBar-module_checkboxCont__gnAQh span {\n vertical-align: middle;\n line-height: 1.5em;\n display: inline;\n}\n\n.SwiftBar-module_checkboxDiv__lgM76 p {\n width: 90%;\n margin-top: 0;\n margin-bottom: 8px;\n margin-left: 5%;\n margin-right: 5%;\n color: #d3d3d3;\n font-weight: bold;\n}\n\n/* ----------------- Radio ----------------- */\n.SwiftBar-module_radioDiv__QHilZ {\n width: 100%;\n margin-bottom: 0.5cm;\n margin-top: 0.5cm;\n color: #d3d3d3;\n}\n\n.SwiftBar-module_radioLabel__bqRHa {\n color: #d3d3d3;\n margin-left: 5%;\n font-weight: bold;\n}\n\n.SwiftBar-module_radioCont__y-lnG {\n text-align: left;\n margin-left: 10%;\n}\n\n.SwiftBar-module_radioCont__y-lnG label {\n display: block;\n padding-right: 10px;\n white-space: nowrap;\n}\n\n.SwiftBar-module_radioCont__y-lnG input {\n vertical-align: middle;\n margin-bottom: 3px;\n margin-top: 3px;\n}\n\n.SwiftBar-module_radioCont__y-lnG label span {\n vertical-align: middle;\n line-height: 1.5em;\n}\n\n.SwiftBar-module_radioDiv__QHilZ p {\n width: 90%;\n margin-top: 0;\n margin-bottom: 8px;\n margin-left: 5%;\n margin-right: 5%;\n color: #d3d3d3;\n font-weight: bold;\n}");var u0=function(e){var t=(0,M.useContext)(uX);return M.createElement("div",{className:u$.buttonDiv},M.createElement("button",{type:"button",className:u$.buttonButton,id:"button"+e.id,onClick:function(){return t({type:"userInputNoState",index:e.id,data:1})}},e.desc))},u1=function(e){return M.createElement("div",{className:u$.labelDiv},M.createElement("p",{id:"label"+e.id},e.desc))},u3=function(e){var t=(0,M.useContext)(uX),n=(0,M.useRef)(null),r=(0,M.useRef)(null),i=function(){r.current.innerHTML=n.current.value+e.unit,t({type:"userInputState",index:e.id,data:parseFloat(n.current.value),valueName:"value",value:parseFloat(n.current.value)})};return(0,M.useEffect)(function(){i()},[e.value]),M.createElement("div",{className:u$.sliderDiv,id:"slider-div"+e.id},M.createElement("p",{className:u$.sliderP,id:"desc"+e.id},e.desc),M.createElement("input",{ref:n,type:"range",value:e.value,step:e.step,min:e.min,max:e.max,className:u$.slider,id:"slider"+e.id,onInput:i}),M.createElement("div",{className:u$.sliderValDiv,id:"slider-val-div"+e.id},M.createElement("p",{className:[u$.sliderVals,u$.sliderMin].join(" "),id:"min"+e.id},e.min),M.createElement("p",{ref:r,className:[u$.sliderVals,u$.sliderVal].join(" "),id:"value"+e.id},e.value+e.unit),M.createElement("p",{className:[u$.sliderVals,u$.sliderMax].join(" "),id:"max"+e.id},e.max)))},u2=function(e){var t=(0,M.useContext)(uX),n=(0,M.useRef)(null);return(0,M.useEffect)(function(){t({type:"userInputNoState",index:e.id,data:parseInt(n.current.value)})},[e.value]),M.createElement("div",{className:u$.selectDiv},M.createElement("label",{id:"label"+e.id,className:u$.selectLabel},e.desc),M.createElement("select",{ref:n,id:"select"+e.id,className:u$.selectSelect,onChange:function(r){t({type:"userInputState",index:e.id,data:parseInt(n.current.value),valueName:"value",value:parseInt(n.current.value)})},value:e.value},e.options.map(function(t,n){return M.createElement("option",{key:e.id+" "+n,value:n},t)})))},u4=function(e){var t=(0,M.useContext)(uX),n=(0,M.useRef)(null),r=function(){for(var e=n.current.getElementsByTagName("input"),t=[],r=0;r0)},e.elements.map(function(e,t){return M.createElement(u6,E({key:e.id.toString()+t},e))}))},u7={swiftContainer:"Swift-module_swiftContainer__Wzrsc"};uY(".Swift-module_swiftContainer__Wzrsc {\n width: 100%;\n height: 100%;\n background-color: aqua;\n position: relative;\n}");var u9=function(e,t){switch(console.log("action: ",t,"state ",e),t.type){case"newElement":return E(E({},e),{formElements:A(e.formElements,[t.data])});case"userInputState":var n=E({},e.formData),r=A(e.formElements);return n[t.index]=t.data,r[t.index-3][t.valueName]=t.value,{formElements:r,formData:n};case"userInputNoState":var i=E({},e.formData);return i[t.index]=t.data,{formElements:A(e.formElements),formData:i};case"wsUpdate":var a=A(e.formElements);return a[t.index-3]=t.data,E(E({},e),{formElements:a});case"reset":var s=E({},e.formData);return t.indices.map(function(e){delete s[e]}),{formData:s,formElements:A(e.formElements)};default:throw Error()}},ce={exports:{}},ct="object"==typeof Reflect?Reflect:null,cn=ct&&"function"==typeof ct.apply?ct.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};y=ct&&"function"==typeof ct.ownKeys?ct.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var cr=Number.isNaN||function(e){return e!=e};function ci(){ci.init.call(this)}ce.exports=ci,ce.exports.once=function(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}cf(e,t,a,{once:!0}),"error"!==t&&"function"==typeof e.on&&cf(e,"error",i,{once:!0})})},ci.EventEmitter=ci,ci.prototype._events=void 0,ci.prototype._eventsCount=0,ci.prototype._maxListeners=void 0;var ca=10;function cs(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function co(e){return void 0===e._maxListeners?ci.defaultMaxListeners:e._maxListeners}function cl(e,t,n,r){if(cs(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),s=a[t]),void 0===s)s=a[t]=n,++e._eventsCount;else if("function"==typeof s?s=a[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=co(e))>0&&s.length>i&&!s.warned){s.warned=!0;var i,a,s,o=Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=s.length,console&&console.warn&&console.warn(o)}return e}function cu(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function cc(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=cu.bind(r);return i.listener=n,r.wrapFn=i,i}function ch(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var a,s=Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var o=i[e];if(void 0===o)return!1;if("function"==typeof o)cn(o,this,t);else for(var l=o.length,u=cp(o,l),n=0;n=0;a--)if(n[a]===t||n[a].listener===t){s=n[a].listener,i=a;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},ci.prototype.listeners=function(e){return ch(this,e,!0)},ci.prototype.rawListeners=function(e){return ch(this,e,!1)},ci.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):cd.call(e,t)},ci.prototype.listenerCount=cd,ci.prototype.eventNames=function(){return this._eventsCount>0?y(this._events):[]};var cm=new ce.exports.EventEmitter;let cg=new ew,cv=new ew,cy=new ew;function cx(e,t,n){let r=cg.setFromMatrixPosition(e.matrixWorld);r.project(t);let i=n.width/2,a=n.height/2;return[r.x*i+i,-(r.y*a)+a]}let c_=e=>1e-10>Math.abs(e)?0:e;function cb(e,t,n=""){let r="matrix3d(";for(let n=0;16!==n;n++)r+=c_(t[n]*e.elements[n])+(15!==n?",":")");return n+r}let cw=(f=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>cb(e,f)),cS=(m=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>cb(e,m(t),"translate(-50%,-50%)")),cM=M.forwardRef(({children:e,eps:t=.001,style:n,className:r,prepend:i,center:a,fullscreen:s,portal:o,distanceFactor:l,sprite:u=!1,transform:c=!1,occlude:h,onOcclude:d,castShadow:p,receiveShadow:f,material:m,geometry:g,zIndexRange:v=[16777271,0],calculatePosition:y=cx,as:x="div",wrapperClass:_,pointerEvents:b="auto",...w},S)=>{let{gl:E,camera:A,scene:C,size:L,raycaster:R,events:P,viewport:I}=ul(),[N]=M.useState(()=>document.createElement(x)),D=M.useRef(),k=M.useRef(null),O=M.useRef(0),z=M.useRef([0,0]),F=M.useRef(null),U=M.useRef(null),B=(null==o?void 0:o.current)||P.connected||E.domElement.parentNode,H=M.useRef(null),G=M.useRef(!1),V=M.useMemo(()=>{var e;return h&&"blending"!==h||Array.isArray(h)&&h.length&&(e=h[0])&&"object"==typeof e&&"current"in e},[h]);M.useLayoutEffect(()=>{let e=E.domElement;h&&"blending"===h?(e.style.zIndex=`${Math.floor(v[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[h]),M.useLayoutEffect(()=>{if(k.current){let e=D.current=T.createRoot(N);if(C.updateMatrixWorld(),c)N.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=y(k.current,A,L);N.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return B&&(i?B.prepend(N):B.appendChild(N)),()=>{B&&B.removeChild(N),e.unmount()}}},[B,c]),M.useLayoutEffect(()=>{_&&(N.className=_)},[_]);let W=M.useMemo(()=>c?{position:"absolute",top:0,left:0,width:L.width,height:L.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:a?"translate3d(-50%,-50%,0)":"none",...s&&{top:-L.height/2,left:-L.width/2,width:L.width,height:L.height},...n},[n,a,s,L,c]),j=M.useMemo(()=>({position:"absolute",pointerEvents:b}),[b]);M.useLayoutEffect(()=>{var t,i;G.current=!1,c?null==(t=D.current)||t.render(M.createElement("div",{ref:F,style:W},M.createElement("div",{ref:U,style:j},M.createElement("div",{ref:S,className:r,style:n,children:e})))):null==(i=D.current)||i.render(M.createElement("div",{ref:S,style:W,className:r,children:e}))});let q=M.useRef(!0);uu(e=>{if(k.current){A.updateMatrixWorld(),k.current.updateWorldMatrix(!0,!1);let e=c?z.current:y(k.current,A,L);if(c||Math.abs(O.current-A.zoom)>t||Math.abs(z.current[0]-e[0])>t||Math.abs(z.current[1]-e[1])>t){let t=function(e,t){let n=cg.setFromMatrixPosition(e.matrixWorld),r=cv.setFromMatrixPosition(t.matrixWorld),i=n.sub(r),a=t.getWorldDirection(cy);return i.angleTo(a)>Math.PI/2}(k.current,A),n=!1;V&&("blending"!==h?n=[C]:Array.isArray(h)&&(n=h.map(e=>e.current)));let r=q.current;if(n){let e=function(e,t,n,r){let i=cg.setFromMatrixPosition(e.matrixWorld),a=i.clone();a.project(t),n.setFromCamera(a,t);let s=n.intersectObjects(r,!0);if(s.length){let e=s[0].distance,t=i.distanceTo(n.ray.origin);return t({vertexShader:c?void 0:` /* This shader is from the THREE's SpriteMaterial. We need to turn the backing plane into a Sprite @@ -228,9 +228,9 @@ void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); } - `}),[c]);return M.createElement("group",uw({},w,{ref:k}),h&&!V&&M.createElement("mesh",{castShadow:p,receiveShadow:f,ref:H},g||M.createElement("planeGeometry",null),m||M.createElement("shaderMaterial",{side:2,vertexShader:X.vertexShader,fragmentShader:X.fragmentShader})))}),cE=0,cA=lE(e=>(s2.onStart=(t,n,r)=>{e({active:!0,item:t,loaded:n,total:r,progress:(n-cE)/(r-cE)*100})},s2.onLoad=()=>{e({active:!1})},s2.onError=t=>e(e=>({errors:[...e.errors,t]})),s2.onProgress=(t,n,r)=>{n===r&&(cE=r),e({active:!0,item:t,loaded:n,total:r,progress:(n-cE)/(r-cE)*100||100})},{errors:[],active:!1,progress:0,item:"",loaded:0,total:0})),cC=e=>"function"==typeof e,cL=M.forwardRef(({envMap:e,resolution:t=256,frames:n=1/0,makeDefault:r,children:i,...a},s)=>{var o;let l=uu(({set:e})=>e),u=uu(({camera:e})=>e),c=uu(({size:e})=>e),h=M.useRef(null),d=M.useRef(null),p=function(e,t,n){let{gl:r,size:i,viewport:a}=uu(),s="number"==typeof e?e:i.width*a.dpr,o="number"==typeof t?t:i.height*a.dpr,{samples:l=0,depth:u,...c}=("number"==typeof e?void 0:e)||{},h=M.useMemo(()=>{let e;return e=new ey(s,o,{minFilter:1006,magFilter:1006,encoding:r.outputEncoding,type:1016,...c}),u&&(e.depthTexture=new iy(s,o,1015)),e.samples=l,e},[]);return M.useLayoutEffect(()=>{h.setSize(s,o),l&&(h.samples=l)},[l,h,s,o]),M.useEffect(()=>()=>h.dispose(),[]),h}(t);M.useLayoutEffect(()=>{a.manual||(h.current.aspect=c.width/c.height)},[c,a]),M.useLayoutEffect(()=>{h.current.updateProjectionMatrix()});let f=0,m=null,g=cC(i);return uc(t=>{g&&(n===1/0||f{if(r)return l(()=>({camera:h.current})),()=>l(()=>({camera:u}))},[h,r,l]),M.createElement(M.Fragment,null,M.createElement("perspectiveCamera",uw({ref:(o=[h,s],function(e){o.forEach(function(t){"function"==typeof t?t(e):null!=t&&(t.current=e)})})},a),!g&&i),M.createElement("group",{ref:d},g&&i(p.texture)))});class cR extends s4{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new s8(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=function(e){if("string"!=typeof e)return e;{let t=new Uint8Array(e.length);for(let n=0;n>5&31)/31,u=(e>>10&31)/31):(o=t,l=n,u=r)}for(let t=1;t<=3;t++){let n=i+12*t,r=9*e+(t-1)*3;p[r]=a.getFloat32(n,!0),p[r+1]=a.getFloat32(n+4,!0),p[r+2]=a.getFloat32(n+8,!0),f[r]=s,f[r+1]=d,f[r+2]=m,c&&(h[r]=o,h[r+1]=l,h[r+2]=u)}}return d.setAttribute("position",new tR(p,3)),d.setAttribute("normal",new tR(f,3)),c&&(d.setAttribute("color",new tR(h,3)),d.hasColors=!0,d.alpha=i),d}(t)}}function cP(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2!==t&&1!==t)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let n=e.getIndex();if(null===n){let t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported."));return}let l=new hl(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}}function cN(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let cD={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ck{constructor(e){this.parser=e,this.name=cD.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0))return null;throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures")}return t.loadTextureImage(e,i.source,a)}}class cq{constructor(e){this.parser=e,this.name=cD.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],s=r.images[a.source],o=n.textureLoader;if(s.uri){let e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(i){if(i)return n.loadTextureImage(e,a.source,o);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class cX{constructor(e){this.name=cD.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(!n.extensions||!n.extensions[this.name])return null;{let e=n.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files")}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*s);return i.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}}}class cY{constructor(e){this.name=cD.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==c4.TRIANGLES&&e.mode!==c4.TRIANGLE_STRIP&&e.mode!==c4.TRIANGLE_FAN&&void 0!==e.mode)return null;let i=n.extensions[this.name],a=i.attributes,s=[],o={};for(let e in a)s.push(this.parser.getDependency("accessor",a[e]).then(t=>(o[e]=t,o[e])));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new eQ,n=new ew,a=new eb,s=new ew(1,1,1),l=new at(e.geometry,e.material,r);for(let e=0;e-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||r&&i<98?this.textureLoader=new oe(this.options.manager):this.textureLoader=new oA(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new s8(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};hr(i,a,r),hi(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n{let n=this.associations.get(e);for(let[r,a]of(null!=n&&this.associations.set(t,n),e.children.entries()))i(a,t.children[r])};return i(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&a.setY(t,h[e*o+1]),o>=3&&a.setZ(t,h[e*o+2]),o>=4&&a.setW(t,h[e*o+3]),o>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e],i=r.source,a=t.images[i],s=this.textureLoader;if(a.uri){let e=n.manager.getHandler(a.uri);null!==e&&(s=e)}return this.loadTextureImage(e,i,s)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],s=i.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||s.name||"";let n=i.samplers||{},o=n[a.sampler]||{};return t.magFilter=c6[o.magFilter]||1006,t.minFilter=c6[o.minFilter]||1008,t.wrapS=c8[o.wrapS]||1e3,t.wrapT=c8[o.wrapT]||1e3,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let n=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=n.images[e],a=self.URL||self.webkitURL,s=i.uri||"",o=!1;if(void 0!==i.bufferView)s=this.getDependency("bufferView",i.bufferView).then(function(e){o=!0;let t=new Blob([e],{type:i.mimeType});return s=a.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(s).then(function(e){return new Promise(function(n,i){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){let t=new eg(e);t.needsUpdate=!0,n(t)}),t.load(ob.resolveURL(e,r.path),a,void 0,i)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),i.extensions[cD.KHR_TEXTURE_TRANSFORM]){let e=void 0!==n.extensions?n.extensions[cD.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[cD.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==r&&(a.encoding=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+n.uuid,t=this.cache.get(e);t||(t=new ap,tE.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e="LineBasicMaterial:"+n.uuid,t=this.cache.get(e);t||(t=new an,tE.prototype.copy.call(t,n),t.color.copy(n.color),this.cache.add(e,t)),n=t}if(r||i||a){let e="ClonedMaterial:"+n.uuid+":";r&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=n}getMaterialType(){return sA}loadMaterial(e){let t;let n=this,r=this.json,i=this.extensions,a=r.materials[e],s={},o=a.extensions||{},l=[];if(o[cD.KHR_MATERIALS_UNLIT]){let e=i[cD.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(s,a,n))}else{let r=a.pbrMetallicRoughness||{};if(s.color=new eh(1,1,1),s.opacity=1,Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;s.color.fromArray(e),s.opacity=e[3]}void 0!==r.baseColorTexture&&l.push(n.assignTexture(s,"map",r.baseColorTexture,3001)),s.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,s.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(l.push(n.assignTexture(s,"metalnessMap",r.metallicRoughnessTexture)),l.push(n.assignTexture(s,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===a.doubleSided&&(s.side=2);let u=a.alphaMode||hn.OPAQUE;if(u===hn.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,u===hn.MASK&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==tA&&(l.push(n.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new Y(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;s.normalScale.set(e,e)}return void 0!==a.occlusionTexture&&t!==tA&&(l.push(n.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==tA&&(s.emissive=new eh().fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==tA&&l.push(n.assignTexture(s,"emissiveMap",a.emissiveTexture,3001)),Promise.all(l).then(function(){let r=new t(s);return a.name&&(r.name=a.name),hi(r,a),n.associations.set(r,{materials:e}),a.extensions&&hr(i,r,a),r})}createUniqueName(e){let t=o0.sanitizeNodeName(e||""),n=t;for(let e=1;this.nodeNamesUsed[n];++e)n=t+"_"+e;return this.nodeNamesUsed[n]=!0,n}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache,i=[];for(let a=0,s=e.length;a0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,r=t.weights.length;n1?new im:1===o.length?o[0]:new tp)!==o[0])for(let e=0,t=o.length;e{let t=new Map;for(let[e,n]of r.associations)(e instanceof tE||e instanceof eg)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);null!=n&&t.set(e,n)}),t})(i),i})}}function hu(e,t,n){let r=t.attributes,i=[];for(let t in r){let a=c9[t]||t.toLowerCase();a in e.attributes||i.push(function(t,r){return n.getDependency("accessor",t).then(function(t){e.setAttribute(r,t)})}(r[t],a))}if(void 0!==t.indices&&!e.index){let r=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(r)}return hi(e,t),!function(e,t,n){let r=t.attributes,i=new eT;if(void 0===r.POSITION)return;{let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(void 0!==t&&void 0!==a){if(i.set(new ew(t[0],t[1],t[2]),new ew(a[0],a[1],a[2])),e.normalized){let t=hs(c5[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}let a=t.targets;if(void 0!==a){let e=new ew,t=new ew;for(let r=0,i=a.length;r256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case 2:case 3:case 10:case 11:e.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case 0:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',e.pixel_size)}(r),r.id_length+t>e.length&&console.error("THREE.TGALoader: No data."),t+=r.id_length;let i=!1,a=!1,s=!1;switch(r.image_type){case 9:i=!0,a=!0;break;case 1:a=!0;break;case 10:i=!0;break;case 2:break;case 11:i=!0,s=!0;break;case 3:s=!0}let o=new Uint8Array(r.width*r.height*4),l=function(e,t,n,r,i){let a,s;let o=n.pixel_size>>3,l=n.width*n.height*o;if(t&&(s=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){let e,t,n;a=new Uint8Array(l);let s=0,u=new Uint8Array(o);for(;s>4){default:case 2:o=0,u=1,h=t,l=0,c=1,d=n;break;case 0:o=0,u=1,h=t,l=n-1,c=-1,d=-1;break;case 3:o=t-1,u=-1,h=-1,l=0,c=1,d=n;break;case 1:o=t-1,u=-1,h=-1,l=n-1,c=-1,d=-1}if(s)switch(r.pixel_size){case 8:!function(e,t,n,i,a,s,o,l){let u,c=0,h,d,p=r.width;for(d=t;d!==i;d+=n)for(h=a;h!==o;h+=s,c++)u=l[c],e[(h+p*d)*4+0]=u,e[(h+p*d)*4+1]=u,e[(h+p*d)*4+2]=u,e[(h+p*d)*4+3]=255}(e,l,c,d,o,u,h,i);break;case 16:!function(e,t,n,i,a,s,o,l){let u=0,c,h,d=r.width;for(h=t;h!==i;h+=n)for(c=a;c!==o;c+=s,u+=2)e[(c+d*h)*4+0]=l[u+0],e[(c+d*h)*4+1]=l[u+0],e[(c+d*h)*4+2]=l[u+0],e[(c+d*h)*4+3]=l[u+1]}(e,l,c,d,o,u,h,i);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(r.pixel_size){case 8:!function(e,t,n,i,a,s,o,l,u){let c,h=0,d,p,f=r.width;for(p=t;p!==i;p+=n)for(d=a;d!==o;d+=s,h++)c=l[h],e[(d+f*p)*4+3]=255,e[(d+f*p)*4+2]=u[3*c+0],e[(d+f*p)*4+1]=u[3*c+1],e[(d+f*p)*4+0]=u[3*c+2]}(e,l,c,d,o,u,h,i,a);break;case 16:!function(e,t,n,i,a,s,o,l){let u,c=0,h,d,p=r.width;for(d=t;d!==i;d+=n)for(h=a;h!==o;h+=s,c+=2)u=l[c+0]+(l[c+1]<<8),e[(h+p*d)*4+0]=(31744&u)>>7,e[(h+p*d)*4+1]=(992&u)>>2,e[(h+p*d)*4+2]=(31&u)<<3,e[(h+p*d)*4+3]=32768&u?0:255}(e,l,c,d,o,u,h,i);break;case 24:!function(e,t,n,i,a,s,o,l){let u=0,c,h,d=r.width;for(h=t;h!==i;h+=n)for(c=a;c!==o;c+=s,u+=3)e[(c+d*h)*4+3]=255,e[(c+d*h)*4+2]=l[u+0],e[(c+d*h)*4+1]=l[u+1],e[(c+d*h)*4+0]=l[u+2]}(e,l,c,d,o,u,h,i);break;case 32:!function(e,t,n,i,a,s,o,l){let u=0,c,h,d=r.width;for(h=t;h!==i;h+=n)for(c=a;c!==o;c+=s,u+=4)e[(c+d*h)*4+2]=l[u+0],e[(c+d*h)*4+1]=l[u+1],e[(c+d*h)*4+0]=l[u+2],e[(c+d*h)*4+3]=l[u+3]}(e,l,c,d,o,u,h,i);break;default:console.error("THREE.TGALoader: Format not supported.")}}(o,r.width,r.height,l.pixel_data,l.palettes),{data:o,width:r.width,height:r.height,flipY:!0,generateMipmaps:!0,minFilter:1008}}}class hh extends s4{constructor(e){super(e)}load(e,t,n,r){let i=this,a=""===i.path?ob.extractUrlBase(e):i.path,s=new s8(i.manager);s.setPath(i.path),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e,t){var n,r,i;let a;function s(e,t){let n=[],r=e.childNodes;for(let e=0,i=r.length;e=0;){let r=e[t];if(null!==r.value[n])return r;t--}return null}(e,i,t),r=function(e,t,n){for(;t0&&t.push(new s$(r+".position",i,a)),s.length>0&&t.push(new sK(r+".quaternion",i,s)),o.length>0&&t.push(new s$(r+".scale",i,o))}(h,t)}return t}function m(e){return p(el.animations[e],f)}let g=new ew,v=new ew,y=new eb;function x(e){let t=[],n=e.name,r=e.end-e.start||-1,i=e.animations;for(let e=0,n=i.length;e>>0)+2).toLowerCase()?a:er;if(void 0===o)return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",i),null;{let n=o.load(i),r=e.extra;if(void 0!==r&&void 0!==r.technique&&!1===c(r.technique)){let e=r.technique;n.wrapS=e.wrapU?1e3:1001,n.wrapT=e.wrapV?1e3:1001,n.offset.set(e.offsetU||0,e.offsetV||0),n.repeat.set(e.repeatU||1,e.repeatV||1)}else n.wrapS=1e3,n.wrapT=1e3;return null!==t&&(n.encoding=t),n}}}n.name=e.name||"";let o=i.parameters;for(let e in o){let t=o[e];switch(e){case"diffuse":t.color&&n.color.fromArray(t.color),t.texture&&(n.map=s(t.texture,3001));break;case"specular":t.color&&n.specular&&n.specular.fromArray(t.color),t.texture&&(n.specularMap=s(t.texture));break;case"bump":t.texture&&(n.normalMap=s(t.texture));break;case"ambient":t.texture&&(n.lightMap=s(t.texture,3001));break;case"shininess":t.float&&n.shininess&&(n.shininess=t.float);break;case"emission":t.color&&n.emissive&&n.emissive.fromArray(t.color),t.texture&&(n.emissiveMap=s(t.texture,3001))}}n.color.convertSRGBToLinear(),n.specular&&n.specular.convertSRGBToLinear(),n.emissive&&n.emissive.convertSRGBToLinear();let l=o.transparent,u=o.transparency;if(void 0===u&&l&&(u={float:1}),void 0===l&&u&&(l={opaque:"A_ONE",data:{color:[1,1,1,1]}}),l&&u){if(l.data.texture)n.transparent=!0;else{let e=l.data.color;switch(l.opaque){case"A_ONE":n.opacity=e[3]*u.float;break;case"RGB_ZERO":n.opacity=1-e[0]*u.float;break;case"A_ZERO":n.opacity=1-e[3]*u.float;break;case"RGB_ONE":n.opacity=e[0]*u.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',l.opaque)}n.opacity<1&&(n.transparent=!0)}}if(void 0!==i.extra&&void 0!==i.extra.technique){let e=i.extra.technique;for(let t in e){let r=e[t];switch(t){case"double_sided":n.side=1===r?2:0;break;case"bump":n.normalMap=s(r.texture),n.normalScale=new Y(1,1)}}}return n}function L(e){let t;switch(e.optics.technique){case"perspective":t=new nt(e.optics.parameters.yfov,e.optics.parameters.aspect_ratio,e.optics.parameters.znear,e.optics.parameters.zfar);break;case"orthographic":let n=e.optics.parameters.ymag,r=e.optics.parameters.xmag,i=e.optics.parameters.aspect_ratio;r=void 0===r?n*i:r,n=void 0===n?r/i:n,r*=.5,n*=.5,t=new nT(-r,r,n,-n,e.optics.parameters.znear,e.optics.parameters.zfar);break;default:t=new nt}return t.name=e.name||"",t}function R(e){let t;switch(e.technique){case"directional":t=new om;break;case"point":t=new op;break;case"spot":t=new ol;break;case"ambient":t=new og}return e.parameters.color&&t.color.copy(e.parameters.color),e.parameters.distance&&(t.distance=e.parameters.distance),t}function P(e){let t={array:[],stride:3};for(let n=0;n0&&t0&&h.setAttribute("position",new tD(i.array,i.stride)),a.array.length>0&&h.setAttribute("normal",new tD(a.array,a.stride)),l.array.length>0&&h.setAttribute("color",new tD(l.array,l.stride)),s.array.length>0&&h.setAttribute("uv",new tD(s.array,s.stride)),o.array.length>0&&h.setAttribute("uv2",new tD(o.array,o.stride)),u.array.length>0&&h.setAttribute("skinIndex",new tD(u.array,u.stride)),c.array.length>0&&h.setAttribute("skinWeight",new tD(c.array,c.stride)),r.data=h,r.type=e[0].type,r.materialKeys=d,r}(i,n,r)}return t}function N(e,t,n,r,i=!1){let a=e.p,s=e.stride,o=e.vcount;function l(e){let t=a[e+n]*c,s=t+c;for(;t4)for(let t=1,r=n-2;t<=r;t++){let n=e+0*s,r=e+s*t,i=e+s*(t+1);l(n),l(r),l(i)}e+=s*n}}else for(let e=0,t=a.length;e0?a+o:a;t.inputs[c]={id:i,offset:s},t.stride=Math.max(t.stride,s+1),"TEXCOORD"===a&&(t.hasUV=!0);break;case"vcount":t.vcount=l(r.textContent);break;case"p":t.p=l(r.textContent)}}return t}(r));break;default:console.log(r)}}el.geometries[e.getAttribute("id")]=t}}),h($,"library_nodes","node",B),h($,"library_visual_scenes","visual_scene",function(e){let t={name:e.getAttribute("name"),children:[]};!function(e){let t=e.getElementsByTagName("node");for(let e=0;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}(r)}}return t}(r);break;case"link":t.links.push(function e(t){let n={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",attachments:[],transforms:[]};for(let r=0;rr.limits.max||t0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices,n=this.object.geometry.vertices;n.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices,n=this.object.geometry.vertices;n.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;hv.fromArray(r,e),hy.fromArray(r,t),hx.fromArray(r,n),hb.subVectors(hx,hy),h_.subVectors(hv,hy),hb.cross(h_),hb.normalize(),i.push(hb.x,hb.y,hb.z),i.push(hb.x,hb.y,hb.z),i.push(hb.x,hb.y,hb.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;void 0!==r[e]&&i.push(r[e+0],r[e+1],r[e+2]),void 0!==r[t]&&i.push(r[t+0],r[t+1],r[t+2]),void 0!==r[n]&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs,n=this.object.geometry.uvs;n.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,s,o,l){let u=this.vertices.length,c=this.parseVertexIndex(e,u),h=this.parseVertexIndex(t,u),d=this.parseVertexIndex(n,u);if(this.addVertex(c,h,d),this.addColor(c,h,d),void 0!==s&&""!==s){let e=this.normals.length;c=this.parseNormalIndex(s,e),h=this.parseNormalIndex(o,e),d=this.parseNormalIndex(l,e),this.addNormal(c,h,d)}else this.addFaceNormal(c,h,d);if(void 0!==r&&""!==r){let e=this.uvs.length;c=this.parseUVIndex(r,e),h=this.parseUVIndex(i,e),d=this.parseUVIndex(a,e),this.addUV(c,h,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";let t=this.vertices.length;for(let n=0,r=e.length;n=7?(hw.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])).convertSRGBToLinear(),t.colors.push(hw.r,hw.g,hw.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case"vt":t.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if("f"===a){let e=i.slice(1).trim(),n=e.split(hg),r=[];for(let e=0,t=n.length;e0){let e=t.split("/");r.push(e)}}let a=r[0];for(let e=1,n=r.length-1;e1){let e=r[1].trim().toLowerCase();t.object.smooth="0"!==e&&"off"!==e}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if("\x00"===i)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+i+'"')}}}t.finalize();let i=new im;i.materialLibraries=[].concat(t.materialLibraries);let a=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length);if(!0===a)for(let e=0,n=t.objects.length;e0&&c.setAttribute("normal",new tD(a.normals,3)),a.colors.length>0&&(u=!0,c.setAttribute("color",new tD(a.colors,3))),!0===a.hasUVIndices&&c.setAttribute("uv",new tD(a.uvs,2));let h=[];for(let e=0,n=s.length;e1){for(let e=0,t=s.length;e0){let e=new ap({size:1,sizeAttenuation:!1}),n=new tG;n.setAttribute("position",new tD(t.vertices,3)),t.colors.length>0&&void 0!==t.colors[0]&&(n.setAttribute("color",new tD(t.colors,3)),e.vertexColors=!0);let r=new ay(n,e);i.add(r)}return i}}class hT extends s4{constructor(e){super(e)}load(e,t,n,r){let i=this,a=""===this.path?ob.extractUrlBase(e):this.path,s=new s8(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){let n=e.split("\n"),r={},i=/\s+/,a={};for(let e=0;e=0?t.substring(0,s):t;o=o.toLowerCase();let l=s>=0?t.substring(s+1):"";if(l=l.trim(),"newmtl"===o)r={name:l},a[l]=r;else if("ka"===o||"kd"===o||"ks"===o||"ke"===o){let e=l.split(i,3);r[o]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else r[o]=l}let s=new hE(this.resourcePath||t,this.materialOptions);return s.setCrossOrigin(this.crossOrigin),s.setManager(this.manager),s.setMaterials(a),s}}class hE{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:0,this.wrap=void 0!==this.options.wrap?this.options.wrap:1e3}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;let t={};for(let n in e){let r=e[n],i={};for(let e in t[n]=i,r){let t=!0,n=r[e],a=e.toLowerCase();switch(a){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(t=!1)}t&&(i[a]=n)}}return t}preload(){for(let e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(let t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){let t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function i(e,n){var i,a;if(r[e])return;let s=t.getTextureParams(n,r),o=t.loadTexture((i=t.baseUrl,"string"!=typeof(a=s.url)||""===a?"":/^https?:\/\//i.test(a)?a:i+a));o.repeat.copy(s.scale),o.offset.copy(s.offset),o.wrapS=t.wrap,o.wrapT=t.wrap,("map"===e||"emissiveMap"===e)&&(o.encoding=3001),r[e]=o}for(let e in n){let t;let a=n[e];if(""!==a)switch(e.toLowerCase()){case"kd":r.color=new eh().fromArray(a).convertSRGBToLinear();break;case"ks":r.specular=new eh().fromArray(a).convertSRGBToLinear();break;case"ke":r.emissive=new eh().fromArray(a).convertSRGBToLinear();break;case"map_kd":i("map",a);break;case"map_ks":i("specularMap",a);break;case"map_ke":i("emissiveMap",a);break;case"norm":i("normalMap",a);break;case"map_bump":case"bump":i("bumpMap",a);break;case"map_d":i("alphaMap",a),r.transparent=!0;break;case"ns":r.shininess=parseFloat(a);break;case"d":(t=parseFloat(a))<1&&(r.opacity=t,r.transparent=!0);break;case"tr":t=parseFloat(a),this.options&&this.options.invertTrProperty&&(t=1-t),t>0&&(r.opacity=1-t,r.transparent=!0)}}return this.materials[e]=new sL(r),this.materials[e]}getTextureParams(e,t){let n;let r={scale:new Y(1,1),offset:new Y(0,0)},i=e.split(/\s+/);return(n=i.indexOf("-bm"))>=0&&(t.bumpScale=parseFloat(i[n+1]),i.splice(n,2)),(n=i.indexOf("-s"))>=0&&(r.scale.set(parseFloat(i[n+1]),parseFloat(i[n+2])),i.splice(n,4)),(n=i.indexOf("-o"))>=0&&(r.offset.set(parseFloat(i[n+1]),parseFloat(i[n+2])),i.splice(n,4)),r.url=i.join(" ").trim(),r}loadTexture(e,t,n,r,i){let a=void 0!==this.manager?this.manager:s2,s=a.getHandler(e);null===s&&(s=new oe(a)),s.setCrossOrigin&&s.setCrossOrigin(this.crossOrigin);let o=s.load(e,n,r,i);return void 0!==t&&(o.mapping=t),o}}class hA extends s4{constructor(e){super(e),this.littleEndian=!0}load(e,t,n,r){let i=this,a=new s8(i.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=new TextDecoder().decode(e),n=function(e){let t={},n=e.search(/[\r\n]DATA\s(\S*)\s/i),r=/[\r\n]DATA\s(\S*)\s/i.exec(e.slice(n-1));if(t.data=r[1],t.headerLen=r[0].length+n,t.str=e.slice(0,t.headerLen),t.str=t.str.replace(/#.*/gi,""),t.version=/VERSION (.*)/i.exec(t.str),t.fields=/FIELDS (.*)/i.exec(t.str),t.size=/SIZE (.*)/i.exec(t.str),t.type=/TYPE (.*)/i.exec(t.str),t.count=/COUNT (.*)/i.exec(t.str),t.width=/WIDTH (.*)/i.exec(t.str),t.height=/HEIGHT (.*)/i.exec(t.str),t.viewpoint=/VIEWPOINT (.*)/i.exec(t.str),t.points=/POINTS (.*)/i.exec(t.str),null!==t.version&&(t.version=parseFloat(t.version[1])),t.fields=null!==t.fields?t.fields[1].split(" "):[],null!==t.type&&(t.type=t.type[1].split(" ")),null!==t.width&&(t.width=parseInt(t.width[1])),null!==t.height&&(t.height=parseInt(t.height[1])),null!==t.viewpoint&&(t.viewpoint=t.viewpoint[1]),null!==t.points&&(t.points=parseInt(t.points[1],10)),null===t.points&&(t.points=t.width*t.height),null!==t.size&&(t.size=t.size[1].split(" ").map(function(e){return parseInt(e,10)})),null!==t.count)t.count=t.count[1].split(" ").map(function(e){return parseInt(e,10)});else{t.count=[];for(let e=0,n=t.fields.length;e"rgb"===e),r=n.type[t],i=parseFloat(l[e.rgb]),s=i;if("F"===r){let e=new Float32Array(1);e[0]=i,s=new Int32Array(e.buffer)[0]}let o=s>>16&255,u=s>>8&255,c=s>>0&255;a.push(o/255,u/255,c/255)}void 0!==e.normal_x&&(i.push(parseFloat(l[e.normal_x])),i.push(parseFloat(l[e.normal_y])),i.push(parseFloat(l[e.normal_z]))),void 0!==e.intensity&&s.push(parseFloat(l[e.intensity])),void 0!==e.label&&o.push(parseInt(l[e.label]))}}if("binary_compressed"===n.data){let t=new Uint32Array(e.slice(n.headerLen,n.headerLen+8)),l=t[0],u=t[1],c=function(e,t){let n,r,i;let a=e.length,s=new Uint8Array(t),o=0,l=0;do if((n=e[o++])<32){if(l+ ++n>t)throw Error("Output buffer is not large enough");if(o+n>a)throw Error("Invalid compressed data");do s[l++]=e[o++];while(--n)}else{if(r=n>>5,i=l-((31&n)<<8)-1,o>=a||7===r&&(r+=e[o++],o>=a))throw Error("Invalid compressed data");if(i-=e[o++],l+r+2>t)throw Error("Output buffer is not large enough");if(i<0||i>=l)throw Error("Invalid compressed data");do s[l++]=s[i++];while(--r+2)}while(o0&&l.setAttribute("position",new tD(r,3)),i.length>0&&l.setAttribute("normal",new tD(i,3)),a.length>0&&l.setAttribute("color",new tD(a,3)),s.length>0&&l.setAttribute("intensity",new tD(s,1)),o.length>0&&l.setAttribute("label",new tI(o,1)),l.computeBoundingSphere();let u=new ap({size:.005});return a.length>0&&(u.vertexColors=!0),new ay(l,u)}}let hC=new eh;class hL extends s4{constructor(e){super(e),this.propertyNameMapping={},this.customPropertyMapping={}}load(e,t,n,r){let i=this,a=new s8(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}setPropertyNameMapping(e){this.propertyNameMapping=e}setCustomPropertyNameMapping(e){this.customPropertyMapping=e}parse(e){let t;function n(e){let t;let n="",r=0,i=/^ply([\s\S]*)end_header(\r\n|\r|\n)/.exec(e);null!==i&&(n=i[1],r=new Blob([i[0]]).size);let a={comments:[],elements:[],headerLength:r,objInfo:""},s=n.split(/\r\n|\r|\n/);for(let e=0;ee.name);function n(e){for(let n=0,r=e.length;n=p.count&&(h++,d=0,f=a((p=t.elements[h]).properties));let i=function(e,t){let n=t.split(/\s+/),i={};for(let t=0;t0&&t.setIndex(e.indices),t.setAttribute("position",new tD(e.vertices,3)),e.normals.length>0&&t.setAttribute("normal",new tD(e.normals,3)),e.uvs.length>0&&t.setAttribute("uv",new tD(e.uvs,2)),e.colors.length>0&&t.setAttribute("color",new tD(e.colors,3)),e.faceVertexUvs.length>0&&(t=t.toNonIndexed()).setAttribute("uv",new tD(e.faceVertexUvs,2)),Object.keys(u.customPropertyMapping)))e[n].length>0&&t.setAttribute(n,new tD(e[n],u.customPropertyMapping[n].length));return t.computeBoundingSphere(),t}function l(e,t,n,r){if("vertex"===t)for(let t of(e.vertices.push(n[r.attrX],n[r.attrY],n[r.attrZ]),null!==r.attrNX&&null!==r.attrNY&&null!==r.attrNZ&&e.normals.push(n[r.attrNX],n[r.attrNY],n[r.attrNZ]),null!==r.attrS&&null!==r.attrT&&e.uvs.push(n[r.attrS],n[r.attrT]),null!==r.attrR&&null!==r.attrG&&null!==r.attrB&&(hC.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255).convertSRGBToLinear(),e.colors.push(hC.r,hC.g,hC.b)),Object.keys(u.customPropertyMapping)))for(let r of u.customPropertyMapping[t])e[t].push(n[r]);else if("face"===t){let t=n.vertex_indices||n.vertex_index,r=n.texcoord;3===t.length?(e.indices.push(t[0],t[1],t[2]),r&&6===r.length&&(e.faceVertexUvs.push(r[0],r[1]),e.faceVertexUvs.push(r[2],r[3]),e.faceVertexUvs.push(r[4],r[5]))):4===t.length&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3]))}}let u=this;if(e instanceof ArrayBuffer){let r=new Uint8Array(e),u=function(e){let t=0,n=!0,r="",i=[];do{let a=String.fromCharCode(e[t++]);"\n"!==a&&"\r"!==a?r+=a:("end_header"===r&&(n=!1),""!==r&&(i.push(r),r=""))}while(n&&te.getInt8(t),size:1};case"uint8":case"uchar":return{read:t=>e.getUint8(t),size:1};case"int16":case"short":return{read:t=>e.getInt16(t,n),size:2};case"uint16":case"ushort":return{read:t=>e.getUint16(t,n),size:2};case"int32":case"int":return{read:t=>e.getInt32(t,n),size:4};case"uint32":case"uint":return{read:t=>e.getUint32(t,n),size:4};case"float32":case"float":return{read:t=>e.getFloat32(t,n),size:4};case"float64":case"double":return{read:t=>e.getFloat64(t,n),size:8}}}for(let i=0,a=e.length;i(s2.onStart=(t,n,r)=>{e({active:!0,item:t,loaded:n,total:r,progress:(n-cT)/(r-cT)*100})},s2.onLoad=()=>{e({active:!1})},s2.onError=t=>e(e=>({errors:[...e.errors,t]})),s2.onProgress=(t,n,r)=>{n===r&&(cT=r),e({active:!0,item:t,loaded:n,total:r,progress:(n-cT)/(r-cT)*100||100})},{errors:[],active:!1,progress:0,item:"",loaded:0,total:0})),cA=e=>"function"==typeof e,cC=M.forwardRef(({envMap:e,resolution:t=256,frames:n=1/0,makeDefault:r,children:i,...a},s)=>{var o;let l=ul(({set:e})=>e),u=ul(({camera:e})=>e),c=ul(({size:e})=>e),h=M.useRef(null),d=M.useRef(null),p=function(e,t,n){let{gl:r,size:i,viewport:a}=ul(),s="number"==typeof e?e:i.width*a.dpr,o="number"==typeof t?t:i.height*a.dpr,{samples:l=0,depth:u,...c}=("number"==typeof e?void 0:e)||{},h=M.useMemo(()=>{let e;return e=new ey(s,o,{minFilter:1006,magFilter:1006,encoding:r.outputEncoding,type:1016,...c}),u&&(e.depthTexture=new iy(s,o,1015)),e.samples=l,e},[]);return M.useLayoutEffect(()=>{h.setSize(s,o),l&&(h.samples=l)},[l,h,s,o]),M.useEffect(()=>()=>h.dispose(),[]),h}(t);M.useLayoutEffect(()=>{a.manual||(h.current.aspect=c.width/c.height)},[c,a]),M.useLayoutEffect(()=>{h.current.updateProjectionMatrix()});let f=0,m=null,g=cA(i);return uu(t=>{g&&(n===1/0||f{if(r)return l(()=>({camera:h.current})),()=>l(()=>({camera:u}))},[h,r,l]),M.createElement(M.Fragment,null,M.createElement("perspectiveCamera",ub({ref:(o=[h,s],function(e){o.forEach(function(t){"function"==typeof t?t(e):null!=t&&(t.current=e)})})},a),!g&&i),M.createElement("group",{ref:d},g&&i(p.texture)))});class cL extends s4{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new s8(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=function(e){if("string"!=typeof e)return e;{let t=new Uint8Array(e.length);for(let n=0;n>5&31)/31,u=(e>>10&31)/31):(o=t,l=n,u=r)}for(let t=1;t<=3;t++){let n=i+12*t,r=9*e+(t-1)*3;p[r]=a.getFloat32(n,!0),p[r+1]=a.getFloat32(n+4,!0),p[r+2]=a.getFloat32(n+8,!0),f[r]=s,f[r+1]=d,f[r+2]=m,c&&(h[r]=o,h[r+1]=l,h[r+2]=u)}}return d.setAttribute("position",new tR(p,3)),d.setAttribute("normal",new tR(f,3)),c&&(d.setAttribute("color",new tR(h,3)),d.hasColors=!0,d.alpha=i),d}(t)}}function cR(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2!==t&&1!==t)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let n=e.getIndex();if(null===n){let t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported."));return}let l=new ho(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}}function cI(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let cN={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class cD{constructor(e){this.parser=e,this.name=cN.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0))return null;throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures")}return t.loadTextureImage(e,i.source,a)}}class cj{constructor(e){this.parser=e,this.name=cN.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],s=r.images[a.source],o=n.textureLoader;if(s.uri){let e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(i){if(i)return n.loadTextureImage(e,a.source,o);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class cq{constructor(e){this.name=cN.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(!n.extensions||!n.extensions[this.name])return null;{let e=n.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files")}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*s);return i.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}}}class cX{constructor(e){this.name=cN.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==c2.TRIANGLES&&e.mode!==c2.TRIANGLE_STRIP&&e.mode!==c2.TRIANGLE_FAN&&void 0!==e.mode)return null;let i=n.extensions[this.name],a=i.attributes,s=[],o={};for(let e in a)s.push(this.parser.getDependency("accessor",a[e]).then(t=>(o[e]=t,o[e])));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new eQ,n=new ew,a=new eb,s=new ew(1,1,1),l=new at(e.geometry,e.material,r);for(let e=0;e-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||r&&i<98?this.textureLoader=new oe(this.options.manager):this.textureLoader=new oA(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new s8(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};hn(i,a,r),hr(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n{let n=this.associations.get(e);for(let[r,a]of(null!=n&&this.associations.set(t,n),e.children.entries()))i(a,t.children[r])};return i(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&a.setY(t,h[e*o+1]),o>=3&&a.setZ(t,h[e*o+2]),o>=4&&a.setW(t,h[e*o+3]),o>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e],i=r.source,a=t.images[i],s=this.textureLoader;if(a.uri){let e=n.manager.getHandler(a.uri);null!==e&&(s=e)}return this.loadTextureImage(e,i,s)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],s=i.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||s.name||"";let n=i.samplers||{},o=n[a.sampler]||{};return t.magFilter=c5[o.magFilter]||1006,t.minFilter=c5[o.minFilter]||1008,t.wrapS=c6[o.wrapS]||1e3,t.wrapT=c6[o.wrapT]||1e3,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let n=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=n.images[e],a=self.URL||self.webkitURL,s=i.uri||"",o=!1;if(void 0!==i.bufferView)s=this.getDependency("bufferView",i.bufferView).then(function(e){o=!0;let t=new Blob([e],{type:i.mimeType});return s=a.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(s).then(function(e){return new Promise(function(n,i){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){let t=new eg(e);t.needsUpdate=!0,n(t)}),t.load(ob.resolveURL(e,r.path),a,void 0,i)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),i.extensions[cN.KHR_TEXTURE_TRANSFORM]){let e=void 0!==n.extensions?n.extensions[cN.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[cN.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==r&&(a.encoding=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+n.uuid,t=this.cache.get(e);t||(t=new ap,tE.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e="LineBasicMaterial:"+n.uuid,t=this.cache.get(e);t||(t=new an,tE.prototype.copy.call(t,n),t.color.copy(n.color),this.cache.add(e,t)),n=t}if(r||i||a){let e="ClonedMaterial:"+n.uuid+":";r&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=n}getMaterialType(){return sA}loadMaterial(e){let t;let n=this,r=this.json,i=this.extensions,a=r.materials[e],s={},o=a.extensions||{},l=[];if(o[cN.KHR_MATERIALS_UNLIT]){let e=i[cN.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(s,a,n))}else{let r=a.pbrMetallicRoughness||{};if(s.color=new eh(1,1,1),s.opacity=1,Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;s.color.fromArray(e),s.opacity=e[3]}void 0!==r.baseColorTexture&&l.push(n.assignTexture(s,"map",r.baseColorTexture,3001)),s.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,s.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(l.push(n.assignTexture(s,"metalnessMap",r.metallicRoughnessTexture)),l.push(n.assignTexture(s,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===a.doubleSided&&(s.side=2);let u=a.alphaMode||ht.OPAQUE;if(u===ht.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,u===ht.MASK&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==tA&&(l.push(n.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new Y(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;s.normalScale.set(e,e)}return void 0!==a.occlusionTexture&&t!==tA&&(l.push(n.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==tA&&(s.emissive=new eh().fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==tA&&l.push(n.assignTexture(s,"emissiveMap",a.emissiveTexture,3001)),Promise.all(l).then(function(){let r=new t(s);return a.name&&(r.name=a.name),hr(r,a),n.associations.set(r,{materials:e}),a.extensions&&hn(i,r,a),r})}createUniqueName(e){let t=o0.sanitizeNodeName(e||""),n=t;for(let e=1;this.nodeNamesUsed[n];++e)n=t+"_"+e;return this.nodeNamesUsed[n]=!0,n}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache,i=[];for(let a=0,s=e.length;a0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,r=t.weights.length;n1?new im:1===o.length?o[0]:new tp)!==o[0])for(let e=0,t=o.length;e{let t=new Map;for(let[e,n]of r.associations)(e instanceof tE||e instanceof eg)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);null!=n&&t.set(e,n)}),t})(i),i})}}function hl(e,t,n){let r=t.attributes,i=[];for(let t in r){let a=c7[t]||t.toLowerCase();a in e.attributes||i.push(function(t,r){return n.getDependency("accessor",t).then(function(t){e.setAttribute(r,t)})}(r[t],a))}if(void 0!==t.indices&&!e.index){let r=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(r)}return hr(e,t),!function(e,t,n){let r=t.attributes,i=new eT;if(void 0===r.POSITION)return;{let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(void 0!==t&&void 0!==a){if(i.set(new ew(t[0],t[1],t[2]),new ew(a[0],a[1],a[2])),e.normalized){let t=ha(c4[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}let a=t.targets;if(void 0!==a){let e=new ew,t=new ew;for(let r=0,i=a.length;r256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case 2:case 3:case 10:case 11:e.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case 0:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',e.pixel_size)}(r),r.id_length+t>e.length&&console.error("THREE.TGALoader: No data."),t+=r.id_length;let i=!1,a=!1,s=!1;switch(r.image_type){case 9:i=!0,a=!0;break;case 1:a=!0;break;case 10:i=!0;break;case 2:break;case 11:i=!0,s=!0;break;case 3:s=!0}let o=new Uint8Array(r.width*r.height*4),l=function(e,t,n,r,i){let a,s;let o=n.pixel_size>>3,l=n.width*n.height*o;if(t&&(s=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){let e,t,n;a=new Uint8Array(l);let s=0,u=new Uint8Array(o);for(;s>4){default:case 2:o=0,u=1,h=t,l=0,c=1,d=n;break;case 0:o=0,u=1,h=t,l=n-1,c=-1,d=-1;break;case 3:o=t-1,u=-1,h=-1,l=0,c=1,d=n;break;case 1:o=t-1,u=-1,h=-1,l=n-1,c=-1,d=-1}if(s)switch(r.pixel_size){case 8:!function(e,t,n,i,a,s,o,l){let u,c=0,h,d,p=r.width;for(d=t;d!==i;d+=n)for(h=a;h!==o;h+=s,c++)u=l[c],e[(h+p*d)*4+0]=u,e[(h+p*d)*4+1]=u,e[(h+p*d)*4+2]=u,e[(h+p*d)*4+3]=255}(e,l,c,d,o,u,h,i);break;case 16:!function(e,t,n,i,a,s,o,l){let u=0,c,h,d=r.width;for(h=t;h!==i;h+=n)for(c=a;c!==o;c+=s,u+=2)e[(c+d*h)*4+0]=l[u+0],e[(c+d*h)*4+1]=l[u+0],e[(c+d*h)*4+2]=l[u+0],e[(c+d*h)*4+3]=l[u+1]}(e,l,c,d,o,u,h,i);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(r.pixel_size){case 8:!function(e,t,n,i,a,s,o,l,u){let c,h=0,d,p,f=r.width;for(p=t;p!==i;p+=n)for(d=a;d!==o;d+=s,h++)c=l[h],e[(d+f*p)*4+3]=255,e[(d+f*p)*4+2]=u[3*c+0],e[(d+f*p)*4+1]=u[3*c+1],e[(d+f*p)*4+0]=u[3*c+2]}(e,l,c,d,o,u,h,i,a);break;case 16:!function(e,t,n,i,a,s,o,l){let u,c=0,h,d,p=r.width;for(d=t;d!==i;d+=n)for(h=a;h!==o;h+=s,c+=2)u=l[c+0]+(l[c+1]<<8),e[(h+p*d)*4+0]=(31744&u)>>7,e[(h+p*d)*4+1]=(992&u)>>2,e[(h+p*d)*4+2]=(31&u)<<3,e[(h+p*d)*4+3]=32768&u?0:255}(e,l,c,d,o,u,h,i);break;case 24:!function(e,t,n,i,a,s,o,l){let u=0,c,h,d=r.width;for(h=t;h!==i;h+=n)for(c=a;c!==o;c+=s,u+=3)e[(c+d*h)*4+3]=255,e[(c+d*h)*4+2]=l[u+0],e[(c+d*h)*4+1]=l[u+1],e[(c+d*h)*4+0]=l[u+2]}(e,l,c,d,o,u,h,i);break;case 32:!function(e,t,n,i,a,s,o,l){let u=0,c,h,d=r.width;for(h=t;h!==i;h+=n)for(c=a;c!==o;c+=s,u+=4)e[(c+d*h)*4+2]=l[u+0],e[(c+d*h)*4+1]=l[u+1],e[(c+d*h)*4+0]=l[u+2],e[(c+d*h)*4+3]=l[u+3]}(e,l,c,d,o,u,h,i);break;default:console.error("THREE.TGALoader: Format not supported.")}}(o,r.width,r.height,l.pixel_data,l.palettes),{data:o,width:r.width,height:r.height,flipY:!0,generateMipmaps:!0,minFilter:1008}}}class hc extends s4{constructor(e){super(e)}load(e,t,n,r){let i=this,a=""===i.path?ob.extractUrlBase(e):i.path,s=new s8(i.manager);s.setPath(i.path),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e,t){var n,r,i;let a;function s(e,t){let n=[],r=e.childNodes;for(let e=0,i=r.length;e=0;){let r=e[t];if(null!==r.value[n])return r;t--}return null}(e,i,t),r=function(e,t,n){for(;t0&&t.push(new s$(r+".position",i,a)),s.length>0&&t.push(new sK(r+".quaternion",i,s)),o.length>0&&t.push(new s$(r+".scale",i,o))}(h,t)}return t}function m(e){return p(el.animations[e],f)}let g=new ew,v=new ew,y=new eb;function x(e){let t=[],n=e.name,r=e.end-e.start||-1,i=e.animations;for(let e=0,n=i.length;e>>0)+2).toLowerCase()?a:er;if(void 0===o)return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",i),null;{let n=o.load(i),r=e.extra;if(void 0!==r&&void 0!==r.technique&&!1===c(r.technique)){let e=r.technique;n.wrapS=e.wrapU?1e3:1001,n.wrapT=e.wrapV?1e3:1001,n.offset.set(e.offsetU||0,e.offsetV||0),n.repeat.set(e.repeatU||1,e.repeatV||1)}else n.wrapS=1e3,n.wrapT=1e3;return null!==t&&(n.encoding=t),n}}}n.name=e.name||"";let o=i.parameters;for(let e in o){let t=o[e];switch(e){case"diffuse":t.color&&n.color.fromArray(t.color),t.texture&&(n.map=s(t.texture,3001));break;case"specular":t.color&&n.specular&&n.specular.fromArray(t.color),t.texture&&(n.specularMap=s(t.texture));break;case"bump":t.texture&&(n.normalMap=s(t.texture));break;case"ambient":t.texture&&(n.lightMap=s(t.texture,3001));break;case"shininess":t.float&&n.shininess&&(n.shininess=t.float);break;case"emission":t.color&&n.emissive&&n.emissive.fromArray(t.color),t.texture&&(n.emissiveMap=s(t.texture,3001))}}n.color.convertSRGBToLinear(),n.specular&&n.specular.convertSRGBToLinear(),n.emissive&&n.emissive.convertSRGBToLinear();let l=o.transparent,u=o.transparency;if(void 0===u&&l&&(u={float:1}),void 0===l&&u&&(l={opaque:"A_ONE",data:{color:[1,1,1,1]}}),l&&u){if(l.data.texture)n.transparent=!0;else{let e=l.data.color;switch(l.opaque){case"A_ONE":n.opacity=e[3]*u.float;break;case"RGB_ZERO":n.opacity=1-e[0]*u.float;break;case"A_ZERO":n.opacity=1-e[3]*u.float;break;case"RGB_ONE":n.opacity=e[0]*u.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',l.opaque)}n.opacity<1&&(n.transparent=!0)}}if(void 0!==i.extra&&void 0!==i.extra.technique){let e=i.extra.technique;for(let t in e){let r=e[t];switch(t){case"double_sided":n.side=1===r?2:0;break;case"bump":n.normalMap=s(r.texture),n.normalScale=new Y(1,1)}}}return n}function L(e){let t;switch(e.optics.technique){case"perspective":t=new nt(e.optics.parameters.yfov,e.optics.parameters.aspect_ratio,e.optics.parameters.znear,e.optics.parameters.zfar);break;case"orthographic":let n=e.optics.parameters.ymag,r=e.optics.parameters.xmag,i=e.optics.parameters.aspect_ratio;r=void 0===r?n*i:r,n=void 0===n?r/i:n,r*=.5,n*=.5,t=new nT(-r,r,n,-n,e.optics.parameters.znear,e.optics.parameters.zfar);break;default:t=new nt}return t.name=e.name||"",t}function R(e){let t;switch(e.technique){case"directional":t=new om;break;case"point":t=new op;break;case"spot":t=new ol;break;case"ambient":t=new og}return e.parameters.color&&t.color.copy(e.parameters.color),e.parameters.distance&&(t.distance=e.parameters.distance),t}function P(e){let t={array:[],stride:3};for(let n=0;n0&&t0&&h.setAttribute("position",new tD(i.array,i.stride)),a.array.length>0&&h.setAttribute("normal",new tD(a.array,a.stride)),l.array.length>0&&h.setAttribute("color",new tD(l.array,l.stride)),s.array.length>0&&h.setAttribute("uv",new tD(s.array,s.stride)),o.array.length>0&&h.setAttribute("uv2",new tD(o.array,o.stride)),u.array.length>0&&h.setAttribute("skinIndex",new tD(u.array,u.stride)),c.array.length>0&&h.setAttribute("skinWeight",new tD(c.array,c.stride)),r.data=h,r.type=e[0].type,r.materialKeys=d,r}(i,n,r)}return t}function N(e,t,n,r,i=!1){let a=e.p,s=e.stride,o=e.vcount;function l(e){let t=a[e+n]*c,s=t+c;for(;t4)for(let t=1,r=n-2;t<=r;t++){let n=e+0*s,r=e+s*t,i=e+s*(t+1);l(n),l(r),l(i)}e+=s*n}}else for(let e=0,t=a.length;e0?a+o:a;t.inputs[c]={id:i,offset:s},t.stride=Math.max(t.stride,s+1),"TEXCOORD"===a&&(t.hasUV=!0);break;case"vcount":t.vcount=l(r.textContent);break;case"p":t.p=l(r.textContent)}}return t}(r));break;default:console.log(r)}}el.geometries[e.getAttribute("id")]=t}}),h($,"library_nodes","node",B),h($,"library_visual_scenes","visual_scene",function(e){let t={name:e.getAttribute("name"),children:[]};!function(e){let t=e.getElementsByTagName("node");for(let e=0;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}(r)}}return t}(r);break;case"link":t.links.push(function e(t){let n={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",attachments:[],transforms:[]};for(let r=0;rr.limits.max||t0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices,n=this.object.geometry.vertices;n.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices,n=this.object.geometry.vertices;n.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;hg.fromArray(r,e),hv.fromArray(r,t),hy.fromArray(r,n),h_.subVectors(hy,hv),hx.subVectors(hg,hv),h_.cross(hx),h_.normalize(),i.push(h_.x,h_.y,h_.z),i.push(h_.x,h_.y,h_.z),i.push(h_.x,h_.y,h_.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;void 0!==r[e]&&i.push(r[e+0],r[e+1],r[e+2]),void 0!==r[t]&&i.push(r[t+0],r[t+1],r[t+2]),void 0!==r[n]&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs,n=this.object.geometry.uvs;n.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,s,o,l){let u=this.vertices.length,c=this.parseVertexIndex(e,u),h=this.parseVertexIndex(t,u),d=this.parseVertexIndex(n,u);if(this.addVertex(c,h,d),this.addColor(c,h,d),void 0!==s&&""!==s){let e=this.normals.length;c=this.parseNormalIndex(s,e),h=this.parseNormalIndex(o,e),d=this.parseNormalIndex(l,e),this.addNormal(c,h,d)}else this.addFaceNormal(c,h,d);if(void 0!==r&&""!==r){let e=this.uvs.length;c=this.parseUVIndex(r,e),h=this.parseUVIndex(i,e),d=this.parseUVIndex(a,e),this.addUV(c,h,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";let t=this.vertices.length;for(let n=0,r=e.length;n=7?(hb.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])).convertSRGBToLinear(),t.colors.push(hb.r,hb.g,hb.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case"vt":t.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if("f"===a){let e=i.slice(1).trim(),n=e.split(hm),r=[];for(let e=0,t=n.length;e0){let e=t.split("/");r.push(e)}}let a=r[0];for(let e=1,n=r.length-1;e1){let e=r[1].trim().toLowerCase();t.object.smooth="0"!==e&&"off"!==e}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if("\x00"===i)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+i+'"')}}}t.finalize();let i=new im;i.materialLibraries=[].concat(t.materialLibraries);let a=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length);if(!0===a)for(let e=0,n=t.objects.length;e0&&c.setAttribute("normal",new tD(a.normals,3)),a.colors.length>0&&(u=!0,c.setAttribute("color",new tD(a.colors,3))),!0===a.hasUVIndices&&c.setAttribute("uv",new tD(a.uvs,2));let h=[];for(let e=0,n=s.length;e1){for(let e=0,t=s.length;e0){let e=new ap({size:1,sizeAttenuation:!1}),n=new tG;n.setAttribute("position",new tD(t.vertices,3)),t.colors.length>0&&void 0!==t.colors[0]&&(n.setAttribute("color",new tD(t.colors,3)),e.vertexColors=!0);let r=new ay(n,e);i.add(r)}return i}}class hM extends s4{constructor(e){super(e)}load(e,t,n,r){let i=this,a=""===this.path?ob.extractUrlBase(e):this.path,s=new s8(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){let n=e.split("\n"),r={},i=/\s+/,a={};for(let e=0;e=0?t.substring(0,s):t;o=o.toLowerCase();let l=s>=0?t.substring(s+1):"";if(l=l.trim(),"newmtl"===o)r={name:l},a[l]=r;else if("ka"===o||"kd"===o||"ks"===o||"ke"===o){let e=l.split(i,3);r[o]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else r[o]=l}let s=new hT(this.resourcePath||t,this.materialOptions);return s.setCrossOrigin(this.crossOrigin),s.setManager(this.manager),s.setMaterials(a),s}}class hT{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:0,this.wrap=void 0!==this.options.wrap?this.options.wrap:1e3}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;let t={};for(let n in e){let r=e[n],i={};for(let e in t[n]=i,r){let t=!0,n=r[e],a=e.toLowerCase();switch(a){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(t=!1)}t&&(i[a]=n)}}return t}preload(){for(let e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(let t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){let t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function i(e,n){var i,a;if(r[e])return;let s=t.getTextureParams(n,r),o=t.loadTexture((i=t.baseUrl,"string"!=typeof(a=s.url)||""===a?"":/^https?:\/\//i.test(a)?a:i+a));o.repeat.copy(s.scale),o.offset.copy(s.offset),o.wrapS=t.wrap,o.wrapT=t.wrap,("map"===e||"emissiveMap"===e)&&(o.encoding=3001),r[e]=o}for(let e in n){let t;let a=n[e];if(""!==a)switch(e.toLowerCase()){case"kd":r.color=new eh().fromArray(a).convertSRGBToLinear();break;case"ks":r.specular=new eh().fromArray(a).convertSRGBToLinear();break;case"ke":r.emissive=new eh().fromArray(a).convertSRGBToLinear();break;case"map_kd":i("map",a);break;case"map_ks":i("specularMap",a);break;case"map_ke":i("emissiveMap",a);break;case"norm":i("normalMap",a);break;case"map_bump":case"bump":i("bumpMap",a);break;case"map_d":i("alphaMap",a),r.transparent=!0;break;case"ns":r.shininess=parseFloat(a);break;case"d":(t=parseFloat(a))<1&&(r.opacity=t,r.transparent=!0);break;case"tr":t=parseFloat(a),this.options&&this.options.invertTrProperty&&(t=1-t),t>0&&(r.opacity=1-t,r.transparent=!0)}}return this.materials[e]=new sL(r),this.materials[e]}getTextureParams(e,t){let n;let r={scale:new Y(1,1),offset:new Y(0,0)},i=e.split(/\s+/);return(n=i.indexOf("-bm"))>=0&&(t.bumpScale=parseFloat(i[n+1]),i.splice(n,2)),(n=i.indexOf("-s"))>=0&&(r.scale.set(parseFloat(i[n+1]),parseFloat(i[n+2])),i.splice(n,4)),(n=i.indexOf("-o"))>=0&&(r.offset.set(parseFloat(i[n+1]),parseFloat(i[n+2])),i.splice(n,4)),r.url=i.join(" ").trim(),r}loadTexture(e,t,n,r,i){let a=void 0!==this.manager?this.manager:s2,s=a.getHandler(e);null===s&&(s=new oe(a)),s.setCrossOrigin&&s.setCrossOrigin(this.crossOrigin);let o=s.load(e,n,r,i);return void 0!==t&&(o.mapping=t),o}}class hE extends s4{constructor(e){super(e),this.littleEndian=!0}load(e,t,n,r){let i=this,a=new s8(i.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=new TextDecoder().decode(e),n=function(e){let t={},n=e.search(/[\r\n]DATA\s(\S*)\s/i),r=/[\r\n]DATA\s(\S*)\s/i.exec(e.slice(n-1));if(t.data=r[1],t.headerLen=r[0].length+n,t.str=e.slice(0,t.headerLen),t.str=t.str.replace(/#.*/gi,""),t.version=/VERSION (.*)/i.exec(t.str),t.fields=/FIELDS (.*)/i.exec(t.str),t.size=/SIZE (.*)/i.exec(t.str),t.type=/TYPE (.*)/i.exec(t.str),t.count=/COUNT (.*)/i.exec(t.str),t.width=/WIDTH (.*)/i.exec(t.str),t.height=/HEIGHT (.*)/i.exec(t.str),t.viewpoint=/VIEWPOINT (.*)/i.exec(t.str),t.points=/POINTS (.*)/i.exec(t.str),null!==t.version&&(t.version=parseFloat(t.version[1])),t.fields=null!==t.fields?t.fields[1].split(" "):[],null!==t.type&&(t.type=t.type[1].split(" ")),null!==t.width&&(t.width=parseInt(t.width[1])),null!==t.height&&(t.height=parseInt(t.height[1])),null!==t.viewpoint&&(t.viewpoint=t.viewpoint[1]),null!==t.points&&(t.points=parseInt(t.points[1],10)),null===t.points&&(t.points=t.width*t.height),null!==t.size&&(t.size=t.size[1].split(" ").map(function(e){return parseInt(e,10)})),null!==t.count)t.count=t.count[1].split(" ").map(function(e){return parseInt(e,10)});else{t.count=[];for(let e=0,n=t.fields.length;e"rgb"===e),r=n.type[t],i=parseFloat(l[e.rgb]),s=i;if("F"===r){let e=new Float32Array(1);e[0]=i,s=new Int32Array(e.buffer)[0]}let o=s>>16&255,u=s>>8&255,c=s>>0&255;a.push(o/255,u/255,c/255)}void 0!==e.normal_x&&(i.push(parseFloat(l[e.normal_x])),i.push(parseFloat(l[e.normal_y])),i.push(parseFloat(l[e.normal_z]))),void 0!==e.intensity&&s.push(parseFloat(l[e.intensity])),void 0!==e.label&&o.push(parseInt(l[e.label]))}}if("binary_compressed"===n.data){let t=new Uint32Array(e.slice(n.headerLen,n.headerLen+8)),l=t[0],u=t[1],c=function(e,t){let n,r,i;let a=e.length,s=new Uint8Array(t),o=0,l=0;do if((n=e[o++])<32){if(l+ ++n>t)throw Error("Output buffer is not large enough");if(o+n>a)throw Error("Invalid compressed data");do s[l++]=e[o++];while(--n)}else{if(r=n>>5,i=l-((31&n)<<8)-1,o>=a||7===r&&(r+=e[o++],o>=a))throw Error("Invalid compressed data");if(i-=e[o++],l+r+2>t)throw Error("Output buffer is not large enough");if(i<0||i>=l)throw Error("Invalid compressed data");do s[l++]=s[i++];while(--r+2)}while(o0&&l.setAttribute("position",new tD(r,3)),i.length>0&&l.setAttribute("normal",new tD(i,3)),a.length>0&&l.setAttribute("color",new tD(a,3)),s.length>0&&l.setAttribute("intensity",new tD(s,1)),o.length>0&&l.setAttribute("label",new tI(o,1)),l.computeBoundingSphere();let u=new ap({size:.005});return a.length>0&&(u.vertexColors=!0),new ay(l,u)}}let hA=new eh;class hC extends s4{constructor(e){super(e),this.propertyNameMapping={},this.customPropertyMapping={}}load(e,t,n,r){let i=this,a=new s8(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}setPropertyNameMapping(e){this.propertyNameMapping=e}setCustomPropertyNameMapping(e){this.customPropertyMapping=e}parse(e){let t;function n(e){let t;let n="",r=0,i=/^ply([\s\S]*)end_header(\r\n|\r|\n)/.exec(e);null!==i&&(n=i[1],r=new Blob([i[0]]).size);let a={comments:[],elements:[],headerLength:r,objInfo:""},s=n.split(/\r\n|\r|\n/);for(let e=0;ee.name);function n(e){for(let n=0,r=e.length;n=p.count&&(h++,d=0,f=a((p=t.elements[h]).properties));let i=function(e,t){let n=t.split(/\s+/),i={};for(let t=0;t0&&t.setIndex(e.indices),t.setAttribute("position",new tD(e.vertices,3)),e.normals.length>0&&t.setAttribute("normal",new tD(e.normals,3)),e.uvs.length>0&&t.setAttribute("uv",new tD(e.uvs,2)),e.colors.length>0&&t.setAttribute("color",new tD(e.colors,3)),e.faceVertexUvs.length>0&&(t=t.toNonIndexed()).setAttribute("uv",new tD(e.faceVertexUvs,2)),Object.keys(u.customPropertyMapping)))e[n].length>0&&t.setAttribute(n,new tD(e[n],u.customPropertyMapping[n].length));return t.computeBoundingSphere(),t}function l(e,t,n,r){if("vertex"===t)for(let t of(e.vertices.push(n[r.attrX],n[r.attrY],n[r.attrZ]),null!==r.attrNX&&null!==r.attrNY&&null!==r.attrNZ&&e.normals.push(n[r.attrNX],n[r.attrNY],n[r.attrNZ]),null!==r.attrS&&null!==r.attrT&&e.uvs.push(n[r.attrS],n[r.attrT]),null!==r.attrR&&null!==r.attrG&&null!==r.attrB&&(hA.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255).convertSRGBToLinear(),e.colors.push(hA.r,hA.g,hA.b)),Object.keys(u.customPropertyMapping)))for(let r of u.customPropertyMapping[t])e[t].push(n[r]);else if("face"===t){let t=n.vertex_indices||n.vertex_index,r=n.texcoord;3===t.length?(e.indices.push(t[0],t[1],t[2]),r&&6===r.length&&(e.faceVertexUvs.push(r[0],r[1]),e.faceVertexUvs.push(r[2],r[3]),e.faceVertexUvs.push(r[4],r[5]))):4===t.length&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3]))}}let u=this;if(e instanceof ArrayBuffer){let r=new Uint8Array(e),u=function(e){let t=0,n=!0,r="",i=[];do{let a=String.fromCharCode(e[t++]);"\n"!==a&&"\r"!==a?r+=a:("end_header"===r&&(n=!1),""!==r&&(i.push(r),r=""))}while(n&&te.getInt8(t),size:1};case"uint8":case"uchar":return{read:t=>e.getUint8(t),size:1};case"int16":case"short":return{read:t=>e.getInt16(t,n),size:2};case"uint16":case"ushort":return{read:t=>e.getUint16(t,n),size:2};case"int32":case"int":return{read:t=>e.getInt32(t,n),size:4};case"uint32":case"uint":return{read:t=>e.getUint32(t,n),size:4};case"float32":case"float":return{read:t=>e.getFloat32(t,n),size:4};case"float64":case"double":return{read:t=>e.getFloat64(t,n),size:8}}}for(let i=0,a=e.length;i Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.6.9 -*/var hR=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(hR(""))}catch(e){hR=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var hP=Uint8Array,hI=Uint16Array,hN=Uint32Array,hD=new hP([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),hk=new hP([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),hO=new hP([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hz=function(e,t){for(var n=new hI(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&hV)<<1;hW=(61680&(hW=(52428&hW)>>>2|(13107&hW)<<2))>>>4|(3855&hW)<<4,hG[hV]=((65280&hW)>>>8|(255&hW)<<8)>>>1}for(var hj=function(e,t,n){for(var r,i=e.length,a=0,s=new hI(t);a>>l]=u}else for(a=0,r=new hI(i);a>>15-e[a]);return r},hq=new hP(288),hV=0;hV<144;++hV)hq[hV]=8;for(var hV=144;hV<256;++hV)hq[hV]=9;for(var hV=256;hV<280;++hV)hq[hV]=7;for(var hV=280;hV<288;++hV)hq[hV]=8;for(var hX=new hP(32),hV=0;hV<32;++hV)hX[hV]=5;var hY=hj(hq,9,1),hZ=hj(hX,5,1),hJ=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},hK=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},hQ=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},h$=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof hI?hI:e instanceof hN?hN:hP)(n-t);return r.set(e.subarray(t,n)),r},h0=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new hP(0);var i=!t||n,a=!n||n.i;n||(n={}),t||(t=new hP(3*r));var s=function(e){var n=t.length;if(e>n){var r=new hP(Math.max(2*n,e));r.set(t),t=r}},o=n.f||0,l=n.p||0,u=n.b||0,c=n.l,h=n.d,d=n.m,p=n.n,f=8*r;do{if(!c){n.f=o=hK(e,l,1);var m=hK(e,l+1,3);if(l+=3,m){if(1==m)c=hY,h=hZ,d=9,p=5;else if(2==m){var g=hK(e,l,31)+257,v=hK(e,l+10,15)+4,y=g+hK(e,l+5,31)+1;l+=14;for(var x=new hP(y),_=new hP(19),b=0;b>>4;if(E<16)x[b++]=E;else{var A=0,C=0;for(16==E?(C=3+hK(e,l,3),l+=2,A=x[b-1]):17==E?(C=3+hK(e,l,7),l+=3):18==E&&(C=11+hK(e,l,127),l+=7);C--;)x[b++]=A}}var L=x.subarray(0,g),R=x.subarray(g);d=hJ(L),p=hJ(R),c=hj(L,d,1),h=hj(R,p,1)}else throw"invalid block type"}else{var P,E=((P=l)/8|0)+(7&P&&1)+4,I=e[E-4]|e[E-3]<<8,N=E+I;if(N>r){if(a)throw"unexpected EOF";break}i&&s(u+I),t.set(e.subarray(E,N),u),n.b=u+=I,n.p=l=8*N;continue}if(l>f){if(a)throw"unexpected EOF";break}}i&&s(u+131072);for(var D=(1<>>4;if((l+=15&A)>f){if(a)throw"unexpected EOF";break}if(!A)throw"invalid length/literal";if(z<256)t[u++]=z;else if(256==z){O=l,c=null;break}else{var F=z-254;if(z>264){var b=z-257,U=hD[b];F=hK(e,l,(1<>>4;if(!B)throw"invalid distance";l+=15&B;var R=hH[H];if(H>3){var U=hk[H];R+=hQ(e,l)&(1<f){if(a)throw"unexpected EOF";break}i&&s(u+131072);for(var G=u+F;u>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"},h2="undefined"!=typeof TextDecoder&&new TextDecoder;try{h2.decode(h1,{stream:!0})}catch(e){}function h4(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let i=e,a=r,s=Math.floor((i+a)/2);for(;t=n[s+1];)t=a&&(l[i][0]=l[t][0]/o[c+1][u],r=l[i][0]*o[u][c]);let h=u>=-1?1:-u,d=e-1<=c?a-1:n-e;for(let e=h;e<=d;++e)l[i][e]=(l[t][e]-l[t][e-1])/o[c+1][u+e],r+=l[i][e]*o[u+e][c];e<=c&&(l[i][a]=-l[t][a-1]/o[c+1][e],r+=l[i][a]*o[e][c]),s[a][e]=r;let p=t;t=i,i=p}}let c=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)s[e][t]*=c;c*=n-e}return s}(o,r,e,a,t),u=[];for(let e=0;e=t.length&&t===df(e,0,t.length)}(e))h=new dt().parse(e);else{let t=df(e);if(!function(e){let t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;for(let r=0;rdi(t))throw Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+di(t));h=new de().parse(t)}let n=new oe(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new h8(n,this.manager).parse(h)}}class h8{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){d=this.parseConnections();let e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),i=new h7().parse(r);return this.parseScene(r,i,n),p}parseConnections(){let e=new Map;if("Connections"in h){let t=h.Connections.connections;t.forEach(function(t){let n=t[0],r=t[1],i=t[2];e.has(n)||e.set(n,{parents:[],children:[]}),e.get(n).parents.push({ID:r,relationship:i}),e.has(r)||e.set(r,{parents:[],children:[]}),e.get(r).children.push({ID:n,relationship:i})})}return e}parseImages(){let e={},t={};if("Video"in h.Objects){let n=h.Objects.Video;for(let r in n){let i=n[r],a=parseInt(r);if(e[a]=i.RelativeFilename||i.Filename,"Content"in i){let e=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a="string"==typeof i.Content&&""!==i.Content;if(e||a){let e=this.parseImage(n[r]);t[i.RelativeFilename||i.Filename]=e}}}}for(let n in e){let r=e[n];void 0!==t[r]?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){let t;let n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if("string"==typeof n)return"data:"+t+";base64,"+n;{let e=new Uint8Array(n);return window.URL.createObjectURL(new Blob([e],{type:t}))}}parseTextures(e){let t=new Map;if("Texture"in h.Objects){let n=h.Objects.Texture;for(let r in n){let i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}parseTexture(e,t){let n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;let r=e.WrapModeU,i=e.WrapModeV,a=void 0!==r?r.value:0,s=void 0!==i?i.value:0;if(n.wrapS=0===a?1e3:1001,n.wrapT=0===s?1e3:1001,"Scaling"in e){let t=e.Scaling.value;n.repeat.x=t[0],n.repeat.y=t[1]}if("Translation"in e){let t=e.Translation.value;n.offset.x=t[0],n.offset.y=t[1]}return n}loadTexture(e,t){let n,r;let i=this.textureLoader.path,a=d.get(e.id).children;void 0!==a&&a.length>0&&void 0!==t[a[0].ID]&&(0===(n=t[a[0].ID]).indexOf("blob:")||0===n.indexOf("data:"))&&this.textureLoader.setPath(void 0);let s=e.FileName.slice(-3).toLowerCase();if("tga"===s){let t=this.manager.getHandler(".tga");null===t?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),r=new eg):(t.setPath(this.textureLoader.path),r=t.load(n))}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),r=new eg):r=this.textureLoader.load(n);return this.textureLoader.setPath(i),r}parseMaterials(e){let t=new Map;if("Material"in h.Objects){let n=h.Objects.Material;for(let r in n){let i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}parseMaterial(e,t){let n;let r=e.id,i=e.attrName,a=e.ShadingModel;if("object"==typeof a&&(a=a.value),!d.has(r))return null;let s=this.parseParameters(e,t,r);switch(a.toLowerCase()){case"phong":n=new sL;break;case"lambert":n=new sI;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),n=new sL}return n.setValues(s),n.name=i,n}parseParameters(e,t,n){let r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new eh().fromArray(e.Diffuse.value):e.DiffuseColor&&("Color"===e.DiffuseColor.type||"ColorRGB"===e.DiffuseColor.type)&&(r.color=new eh().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new eh().fromArray(e.Emissive.value):e.EmissiveColor&&("Color"===e.EmissiveColor.type||"ColorRGB"===e.EmissiveColor.type)&&(r.emissive=new eh().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new eh().fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(r.specular=new eh().fromArray(e.SpecularColor.value));let i=this;return d.get(n).children.forEach(function(e){let n=e.relationship;switch(n){case"Bump":r.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(t,e.ID),void 0!==r.map&&(r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(t,e.ID),void 0!==r.emissiveMap&&(r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":r.envMap=i.getTexture(t,e.ID),void 0!==r.envMap&&(r.envMap.mapping=303,r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=i.getTexture(t,e.ID),void 0!==r.specularMap&&(r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(t,e.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}}),r}getTexture(e,t){return"LayeredTexture"in h.Objects&&t in h.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=d.get(t).children[0].ID),e.get(t)}parseDeformers(){let e={},t={};if("Deformer"in h.Objects){let n=h.Objects.Deformer;for(let r in n){let i=n[r],a=d.get(parseInt(r));if("Skin"===i.attrType){let t=this.parseSkeleton(a,n);t.ID=r,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),t.geometryID=a.parents[0].ID,e[r]=t}else if("BlendShape"===i.attrType){let e={id:r};e.rawTargets=this.parseMorphTargets(a,n),e.id=r,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=e}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(e){let r=t[e.ID];if("Cluster"!==r.attrType)return;let i={ID:e.ID,indices:[],weights:[],transformLink:new eQ().fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){let n=[];for(let r=0;r1?a=s:s.length>0?a=s[0]:(a=new sL({color:13421772}),s.push(a)),"color"in i.attributes&&s.forEach(function(e){e.vertexColors=!0}),i.FBX_Deformer?(r=new i$(i,a)).normalizeSkinWeights():r=new t3(i,a),r}createCurve(e,t){let n=e.children.reduce(function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e},null),r=new an({color:3342591,linewidth:1});return new al(n,r)}getTransformData(e,t){let n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=dd(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){if("LookAtProperty"in t){let t=d.get(e.ID).children;t.forEach(function(t){if("LookAtProperty"===t.relationship){let n=h.Objects.Model[t.ID];if("Lcl_Translation"in n){let t=n.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(t),p.add(e.target)):e.lookAt(new ew().fromArray(t))}}})}}bindSkeleton(e,t,n){let r=this.parsePoseNodes();for(let i in e){let a=e[i],s=d.get(parseInt(a.ID)).parents;s.forEach(function(e){if(t.has(e.ID)){let t=e.ID,i=d.get(t);i.parents.forEach(function(e){if(n.has(e.ID)){let t=n.get(e.ID);t.bind(new i4(a.bones),r[e.ID])}})}})}}parsePoseNodes(){let e={};if("Pose"in h.Objects){let t=h.Objects.Pose;for(let n in t)if("BindPose"===t[n].attrType&&t[n].NbPoseNodes>0){let r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(t){e[t.Node]=new eQ().fromArray(t.Matrix.a)}):e[r.Node]=new eQ().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in h&&"AmbientColor"in h.GlobalSettings){let e=h.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(0!==t||0!==n||0!==r){let e=new eh(t,n,r);p.add(new og(e,1))}}}}class h7{constructor(){this.negativeMaterialIndices=!1}parse(e){let t=new Map;if("Geometry"in h.Objects){let n=h.Objects.Geometry;for(let r in n){let i=d.get(parseInt(r)),a=this.parseGeometry(i,n[r],e);t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){let r=n.skeletons,i=[],a=e.parents.map(function(e){return h.Objects.Model[e.ID]});if(0===a.length)return;let s=e.children.reduce(function(e,t){return void 0!==r[t.ID]&&(e=r[t.ID]),e},null);e.children.forEach(function(e){void 0!==n.morphTargets[e.ID]&&i.push(n.morphTargets[e.ID])});let o=a[0],l={};"RotationOrder"in o&&(l.eulerOrder=dd(o.RotationOrder.value)),"InheritType"in o&&(l.inheritType=parseInt(o.InheritType.value)),"GeometricTranslation"in o&&(l.translation=o.GeometricTranslation.value),"GeometricRotation"in o&&(l.rotation=o.GeometricRotation.value),"GeometricScaling"in o&&(l.scale=o.GeometricScaling.value);let u=dh(l);return this.genGeometry(t,s,i,u)}genGeometry(e,t,n,r){let i=new tG;e.attrName&&(i.name=e.attrName);let a=this.parseGeoNode(e,t),s=this.genBuffers(a),o=new tD(s.vertex,3);if(o.applyMatrix4(r),i.setAttribute("position",o),s.colors.length>0&&i.setAttribute("color",new tD(s.colors,3)),t&&(i.setAttribute("skinIndex",new tP(s.weightsIndices,4)),i.setAttribute("skinWeight",new tD(s.vertexWeights,4)),i.FBX_Deformer=t),s.normal.length>0){let e=new Z().getNormalMatrix(r),t=new tD(s.normal,3);t.applyNormalMatrix(e),i.setAttribute("normal",t)}if(s.uvs.forEach(function(e,t){let n="uv"+(t+1).toString();0===t&&(n="uv"),i.setAttribute(n,new tD(s.uvs[t],2))}),a.material&&"AllSame"!==a.material.mappingType){let e=s.materialIndex[0],t=0;if(s.materialIndex.forEach(function(n,r){n!==e&&(i.addGroup(t,r-t,e),e=n,t=r)}),i.groups.length>0){let t=i.groups[i.groups.length-1],n=t.start+t.count;n!==s.materialIndex.length&&i.addGroup(n,s.materialIndex.length-n,e)}0===i.groups.length&&i.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i}parseGeoNode(e,t){let n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],s=[],o=[],l=[],u=[],c=[],h=this;return e.vertexIndices.forEach(function(d,p){let f;let m=!1;d<0&&(d^=-1,m=!0);let g=[],v=[];if(a.push(3*d,3*d+1,3*d+2),e.color){let t=dl(p,n,d,e.color);o.push(t[0],t[1],t[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach(function(e){v.push(e.weight),g.push(e.id)}),v.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);let e=[0,0,0,0],t=[0,0,0,0];v.forEach(function(n,r){let i=n,a=g[r];t.forEach(function(t,n,r){if(i>t){r[n]=i,i=t;let s=e[n];e[n]=a,a=s}})}),g=e,v=t}for(;v.length<4;)v.push(0),g.push(0);for(let e=0;e<4;++e)u.push(v[e]),c.push(g[e])}if(e.normal){let t=dl(p,n,d,e.normal);s.push(t[0],t[1],t[2])}e.material&&"AllSame"!==e.material.mappingType&&(f=dl(p,n,d,e.material)[0])<0&&(h.negativeMaterialIndices=!0,f=0),e.uv&&e.uv.forEach(function(e,t){let r=dl(p,n,d,e);void 0===l[t]&&(l[t]=[]),l[t].push(r[0]),l[t].push(r[1])}),r++,m&&(r>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,a,f,s,o,l,u,c,r),n++,r=0,a=[],s=[],o=[],l=[],u=[],c=[])}),t}genFace(e,t,n,r,i,a,s,o,l,u){for(let c=2;c1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");let a=e.get(i[0].ID);n[r]={name:t[r].attrName,layer:a}}return n}addClip(e){let t=[],n=this;return e.layer.forEach(function(e){t=t.concat(n.generateTracks(e))}),new s0(e.name,-1,t)}generateTracks(e){let t=[],n=new ew,r=new eb,i=new ew;if(e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=new e7().setFromQuaternion(r,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){let r=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==r&&t.push(r)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){let n=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);void 0!==n&&t.push(n)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){let n=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");void 0!==n&&t.push(n)}if(void 0!==e.DeformPercent){let n=this.generateMorphTrack(e);void 0!==n&&t.push(n)}return t}generateVectorTrack(e,t,n,r){let i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new s$(e+"."+r,i,a)}generateRotationTrack(e,t,n,r,i,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(X.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(X.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(X.degToRad));let s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,n);void 0!==r&&((r=r.map(X.degToRad)).push(a),r=new e7().fromArray(r),r=new eb().setFromEuler(r)),void 0!==i&&((i=i.map(X.degToRad)).push(a),i=new e7().fromArray(i),i=new eb().setFromEuler(i).invert());let l=new eb,u=new e7,c=[];for(let e=0;e1){let e=1,n=t[0];for(let r=1;r=180){let a=i/180,s=r/a,o=n+s,l=e.times[t-1],u=e.times[t]-l,c=u/a,h=l+c,d=[],p=[];for(;h1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());let a=this.getCurrentNode(),s=a.name;if("Properties70"===s){this.parseNodeSpecialProperty(e,r,i);return}if("C"===r){let e=i.split(",").slice(1),t=parseInt(e[0]),n=parseInt(e[1]),s=i.split(",").slice(3);s=s.map(function(e){return e.trim().replace(/^"/,"")}),r="connections",function(e,t){for(let n=0,r=e.length,i=t.length;n=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),s=e.getString(a);if(0===r)return null;let o=[];for(let t=0;t0?o[0]:"",u=o.length>1?o[1]:"",c=o.length>2?o[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);null!==r&&this.parseSubNode(s,n,r)}return n.propertyList=o,"number"==typeof l&&(n.id=l),""!==u&&(n.attrName=u),""!==c&&(n.attrType=c),""!==s&&(n.name=s),n}parseSubNode(e,t,n){if(!0===n.singleProperty){let e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if("Connections"===e&&"C"===n.name){let e=[];n.propertyList.forEach(function(t,n){0!==n&&e.push(t)}),void 0===t.connections&&(t.connections=[]),t.connections.push(e)}else if("Properties70"===n.name){let e=Object.keys(n);e.forEach(function(e){t[e]=n[e]})}else if("Properties70"===e&&"P"===n.name){let e,r=n.propertyList[0],i=n.propertyList[1],a=n.propertyList[2],s=n.propertyList[3];0===r.indexOf("Lcl ")&&(r=r.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),e="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[r]={type:i,type2:a,flag:s,value:e}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}parseProperty(e){let t;let n=e.getString(1);switch(n){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return t=e.getUint32(),e.getArrayBuffer(t);case"S":return t=e.getUint32(),e.getString(t);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r;let i=e.getUint32(),a=e.getUint32(),s=e.getUint32();if(0===a)switch(n){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}let o=h0((h3(r=new Uint8Array(e.getArrayBuffer(s))),r.subarray(2,-4)),void 0),l=new dn(o.buffer);switch(n){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw Error("THREE.FBXLoader: Unknown property type "+n)}}}class dn{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(1&this.getUint8())==1}getBooleanArray(e){let t=[];for(let n=0;n=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}}class dr{add(e,t){this[e]=t}}function di(e){let t=e.match(/FBXVersion: (\d+)/);if(t){let e=parseInt(t[1]);return e}throw Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function da(e){return e/46186158e3}let ds=[];function dl(e,t,n,r){let i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);let a=i*r.dataSize,s=a+r.dataSize;return function(e,t,n,r){for(let i=n,a=0;i1){let e=Math.sqrt(v);t*=e,n*=e,p=t*t,f=n*n}let y=p*g+f*m,x=(p*f-y)/y,_=Math.sqrt(Math.max(0,x));a===s&&(_=-_);let b=_*t*d/n,w=-_*n*h/t,S=Math.cos(i)*b-Math.sin(i)*w+(o.x+l.x)/2,M=Math.sin(i)*b+Math.cos(i)*w+(o.y+l.y)/2,T=r(1,0,(h-b)/t,(d-w)/n),E=r((h-b)/t,(d-w)/n,(-h-b)/t,(-d-w)/n)%(2*Math.PI);e.currentPath.absellipse(S,M,t,n,T,T+E,0===s,i)}function r(e,t,n,r){let i=Math.acos(Math.max(-1,Math.min(1,(e*n+t*r)/(Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r)))));return e*r-t*n<0&&(i=-i),i}function i(e,t){t=Object.assign({},t);let n={};if(e.hasAttribute("class")){let t=e.getAttribute("class").split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e=0;e--){let r=n[e].trim();if(""===r)continue;let i=r.indexOf("("),s=r.length;if(i>0&&i=1){let e=t[0],n=0;t.length>=2&&(n=t[1]),m.translate(e,n)}break;case"rotate":if(t.length>=1){let e=0,n=0,r=0;e=t[0]*Math.PI/180,t.length>=3&&(n=t[1],r=t[2]),g.makeTranslation(-n,-r),v.makeRotation(e),y.multiplyMatrices(v,g),g.makeTranslation(n,r),m.multiplyMatrices(g,y)}break;case"scale":if(t.length>=1){let e=t[0],n=e;t.length>=2&&(n=t[1]),m.scale(e,n)}break;case"skewX":1===t.length&&m.set(1,Math.tan(t[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===t.length&&m.set(1,0,0,Math.tan(t[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===t.length&&m.set(t[0],t[2],t[4],t[1],t[3],t[5],0,0,1)}}t.premultiply(m)}}return t}(e);return f.length>0&&t.premultiply(f[f.length-1]),b.copy(t),f.push(t),t}(t),o=!1,w=null;switch(t.nodeName){case"svg":case"g":r=i(t,r);break;case"style":!function(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(let t=0;te.trim());for(let e=0;e""!==e));p[r[e]]=Object.assign(p[r[e]]||{},t)}}}(t);break;case"path":r=i(t,r),t.hasAttribute("d")&&(w=function(e){let t=new ly,r=new Y,i=new Y,s=new Y,o=!0,l=!1,u=e.getAttribute("d"),c=u.match(/[a-df-z][^a-df-z]*/ig);for(let e=0,u=c.length;e0&&(r.copy(s),t.currentPath.currentPoint.copy(r),o=!0);break;default:console.warn(x)}l=!1}return t}(t));break;case"rect":r=i(t,r),w=function(e){let t=l(e.getAttribute("x")||0),n=l(e.getAttribute("y")||0),r=l(e.getAttribute("rx")||e.getAttribute("ry")||0),i=l(e.getAttribute("ry")||e.getAttribute("rx")||0),a=l(e.getAttribute("width")),s=l(e.getAttribute("height")),o=new ly;return o.moveTo(t+r,n),o.lineTo(t+a-r,n),(0!==r||0!==i)&&o.bezierCurveTo(t+a-.448084975506*r,n,t+a,n+.448084975506*i,t+a,n+i),o.lineTo(t+a,n+s-i),(0!==r||0!==i)&&o.bezierCurveTo(t+a,n+s-.448084975506*i,t+a-.448084975506*r,n+s,t+a-r,n+s),o.lineTo(t+r,n+s),(0!==r||0!==i)&&o.bezierCurveTo(t+.448084975506*r,n+s,t,n+s-.448084975506*i,t,n+s-i),o.lineTo(t,n+i),(0!==r||0!==i)&&o.bezierCurveTo(t,n+.448084975506*i,t+.448084975506*r,n,t+r,n),o}(t);break;case"polygon":r=i(t,r),w=function(e){let t=new ly,n=0;return e.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,function(e,r,i){let a=l(r),s=l(i);0===n?t.moveTo(a,s):t.lineTo(a,s),n++}),t.currentPath.autoClose=!0,t}(t);break;case"polyline":r=i(t,r),w=function(e){let t=new ly,n=0;return e.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,function(e,r,i){let a=l(r),s=l(i);0===n?t.moveTo(a,s):t.lineTo(a,s),n++}),t.currentPath.autoClose=!1,t}(t);break;case"circle":r=i(t,r),w=function(e){let t=l(e.getAttribute("cx")||0),n=l(e.getAttribute("cy")||0),r=l(e.getAttribute("r")||0),i=new aG;i.absarc(t,n,r,0,2*Math.PI);let a=new ly;return a.subPaths.push(i),a}(t);break;case"ellipse":r=i(t,r),w=function(e){let t=l(e.getAttribute("cx")||0),n=l(e.getAttribute("cy")||0),r=l(e.getAttribute("rx")||0),i=l(e.getAttribute("ry")||0),a=new aG;a.absellipse(t,n,r,i,0,2*Math.PI);let s=new ly;return s.subPaths.push(a),s}(t);break;case"line":r=i(t,r),w=function(e){let t=l(e.getAttribute("x1")||0),n=l(e.getAttribute("y1")||0),r=l(e.getAttribute("x2")||0),i=l(e.getAttribute("y2")||0),a=new ly;return a.moveTo(t,n),a.lineTo(r,i),a.currentPath.autoClose=!1,a}(t);break;case"defs":o=!0;break;case"use":r=i(t,r);let S=t.getAttributeNS("http://www.w3.org/1999/xlink","href")||"",M=S.substring(1),T=t.viewportElement.getElementById(M);T?e(T,r):console.warn("SVGLoader: 'use node' references non-existent node id: "+M)}w&&(void 0!==r.fill&&"none"!==r.fill&&w.color.setStyle(r.fill),function(e,t){function n(e){_.set(e.x,e.y,1).applyMatrix3(t),e.set(_.x,_.y)}let r=e.subPaths;for(let e=0,i=r.length;eNumber.EPSILON}(t)?function(e){let n=e.xRadius,r=e.yRadius,i=Math.cos(e.aRotation),a=Math.sin(e.aRotation),s=new ew(n*i,n*a,0),o=new ew(-r*a,r*i,0),l=s.applyMatrix3(t),c=o.applyMatrix3(t),h=m.set(l.x,c.x,0,l.y,c.y,0,0,0,1),d=g.copy(h).invert(),p=v.copy(d).transpose(),f=p.multiply(d),y=f.elements,x=function(e,t,n){let r,i,a,s,o;let l=e+n,u=e-n,c=Math.sqrt(u*u+4*t*t);return l>0?i=e*(o=1/(r=.5*(l+c)))*n-t*o*t:l<0?i=.5*(l-c):(r=.5*c,i=-.5*c),Math.abs(a=u>0?u+c:u-c)>2*Math.abs(t)?(s=1/Math.sqrt(1+(o=-2*t/a)*o),a=o*s):0===Math.abs(t)?(a=1,s=0):(a=1/Math.sqrt(1+(o=-.5*a/t)*o),s=o*a),u>0&&(o=a,a=-s,s=o),{rt1:r,rt2:i,cs:a,sn:s}}(y[0],y[1],y[4]),_=Math.sqrt(x.rt1),b=Math.sqrt(x.rt2);e.xRadius=1/_,e.yRadius=1/b,e.aRotation=Math.atan2(x.sn,x.cs);let w=(e.aEndAngle-e.aStartAngle)%(2*Math.PI){let{x:t,y:n}=new ew(Math.cos(e),Math.sin(e),0).applyMatrix3(i);return Math.atan2(n,t)};e.aStartAngle=a(e.aStartAngle),e.aEndAngle=a(e.aEndAngle),u(t)&&(e.aClockwise=!e.aClockwise)}}(r):function(e){let n=c(t),r=h(t);e.xRadius*=n,e.yRadius*=r;let i=n>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);e.aRotation+=i,u(t)&&(e.aStartAngle*=-1,e.aEndAngle*=-1,e.aClockwise=!e.aClockwise)}(r))}}}(w,b),d.push(w),w.userData={node:t,style:r});let E=t.childNodes;for(let t=0;t0?b.copy(f[f.length-1]):b.identity())}(w.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4});let S={paths:d,xml:w.documentElement};return S}static createShapes(e){let t={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},n={loc:t.ORIGIN,t:0};function r(e,r,i){let a=i.x-r.x,s=i.y-r.y,o=e.x-r.x,l=e.y-r.y,u=a*l-o*s;if(e.x===r.x&&e.y===r.y){n.loc=t.ORIGIN,n.t=0;return}if(e.x===i.x&&e.y===i.y){n.loc=t.DESTINATION,n.t=1;return}if(u<-Number.EPSILON){n.loc=t.LEFT;return}if(u>Number.EPSILON){n.loc=t.RIGHT;return}if(a*o<0||s*l<0){n.loc=t.BEHIND;return}if(Math.sqrt(a*a+s*s){let t=e.getPoints(),n=-999999999,r=999999999,s=-999999999,o=999999999;for(let e=0;en&&(n=i.y),i.ys&&(s=i.x),i.x=o&&(i=o-1),{curves:e.curves,points:t,isCW:sl.isClockWise(t),identifier:-1,boundingBox:new le(new Y(o,r),new Y(s,n))}});s=s.filter(e=>e.points.length>1);for(let e=0;e(function(e,i,a,s,o){(null==o||""===o)&&(o="nonzero");let l=new Y;e.boundingBox.getCenter(l);let u=[new Y(a,l.y),new Y(s,l.y)],c=function(e,i,a){let s=new Y;i.getCenter(s);let o=[];return a.forEach(i=>{if(i.boundingBox.containsPoint(s)){let a=function(e,i){let a=[],s=[];for(let o=1;o=1||y<0||y>1)return null;if(0===m&&0===g){for(let u=0;u<2;u++){if(r(0===u?a:s,e,i),n.loc==t.ORIGIN){let e=0===u?a:s;return{x:e.x,y:e.y,t:n.t}}if(n.loc==t.BETWEEN){let e=+(o+n.t*(l-o)).toPrecision(10),t=+(h+n.t*(d-h)).toPrecision(10);return{x:e,y:t,t:n.t}}}return null}{for(let o=0;o<2;o++)if(r(0===o?a:s,e,i),n.loc==t.ORIGIN){let e=0===o?a:s;return{x:e.x,y:e.y,t:n.t}}let u=+(o+v*(l-o)).toPrecision(10),c=+(h+v*(d-h)).toPrecision(10);return{x:u,y:c,t:v}}}(l,u,o,c);null!==h&&void 0===a.find(e=>e.t<=h.t+Number.EPSILON&&e.t>=h.t-Number.EPSILON)&&(a.push(h),s.push(new Y(h.x,h.y)))}}return s}(e,i.points);a.forEach(e=>{o.push({identifier:i.identifier,isCW:i.isCW,point:e})})}}),o.sort((e,t)=>e.point.x-t.point.x),o}(u,e.boundingBox,i);c.sort((e,t)=>e.point.x-t.point.x);let h=[],d=[];c.forEach(t=>{t.identifier===e.identifier?h.push(t):d.push(t)});let p=h[0].point.x,f=[],m=0;for(;m0&&f[f.length-1]===d[m].identifier?f.pop():f.push(d[m].identifier),m++;if(f.push(e.identifier),"evenodd"===o){let t=f.length%2==0,n=f[f.length-2];return{identifier:e.identifier,isHole:t,for:n}}if("nonzero"===o){let t=!0,n=null,r=null;for(let e=0;e{let t=o[e.identifier];if(!t.isHole){let t=new a1;t.curves=e.curves;let n=o.filter(t=>t.isHole&&t.for===e.identifier);n.forEach(e=>{let n=s[e.identifier],r=new aG;r.curves=n.curves,t.holes.push(r)}),l.push(t)}}),l}static getStrokeStyle(e,t,n,r,i){return{strokeColor:t=void 0!==t?t:"#000",strokeWidth:e=void 0!==e?e:1,strokeLineJoin:n=void 0!==n?n:"miter",strokeLineCap:r=void 0!==r?r:"butt",strokeMiterLimit:i=void 0!==i?i:4}}static pointsToStroke(e,t,n,r){let i=[],a=[],s=[];if(0===dg.pointsToStrokeWithBuffers(e,t,n,r,i,a,s))return null;let o=new tG;return o.setAttribute("position",new tD(i,3)),o.setAttribute("normal",new tD(a,3)),o.setAttribute("uv",new tD(s,2)),o}static pointsToStrokeWithBuffers(e,t,n,r,i,a,s,o){let l,u,c,h,d;let p=new Y,f=new Y,m=new Y,g=new Y,v=new Y,y=new Y,x=new Y,_=new Y,b=new Y,w=new Y,S=new Y,M=new Y,T=new Y,E=new Y,A=new Y,C=new Y,L=new Y;n=void 0!==n?n:12,r=void 0!==r?r:.001,o=void 0!==o?o:0,e=function(e){let t=!1;for(let n=1,i=e.length-1;n=r&&n.push(e[t]);return n.push(e[e.length-1]),n}(e);let R=e.length;if(R<2)return 0;let P=e[0].equals(e[R-1]),I=e[0],N=t.strokeWidth/2,D=1/(R-1),k=0,O,z=!1,F=0,U=3*o,B=2*o;H(e[0],e[1],p).multiplyScalar(N),_.copy(e[0]).sub(p),b.copy(e[0]).add(p),w.copy(_),S.copy(b);for(let n=1;np.dot(m)&&(h=!1),1===n&&(z=h),m.subVectors(u,l),m.normalize();let e=Math.abs(p.dot(m));if(e>Number.EPSILON){let n=N/e;m.multiplyScalar(-n),g.subVectors(l,I),v.copy(g).setLength(n).add(m),C.copy(v).negate();let r=v.length(),i=g.length();g.divideScalar(i),y.subVectors(u,l);let a=y.length();switch(y.divideScalar(a),g.dot(C)Math.abs(o)&&(s=Math.abs(Math.acos(o))),s/=n,m.copy(t);for(let t=0,r=n-1;tMath.PI&&(g-=m),v<-Math.PI?v+=m:v>Math.PI&&(v-=m),g<=v?s.theta=Math.max(g,Math.min(v,s.theta)):s.theta=s.theta>(g+v)/2?Math.max(g,s.theta):Math.min(v,s.theta)),s.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,s.phi)),s.makeSafe(),s.radius*=l,s.radius=Math.max(n.minDistance,Math.min(n.maxDistance,s.radius)),!0===n.enableDamping?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),t.setFromSpherical(s),t.applyQuaternion(d),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(o.theta*=1-n.dampingFactor,o.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(o.set(0,0,0),u.set(0,0,0)),l=1,!!(c||p.distanceToSquared(n.object.position)>a||8*(1-f.dot(n.object.quaternion))>a)&&(n.dispatchEvent(dF),p.copy(n.object.position),f.copy(n.object.quaternion),c=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",q),n.domElement.removeEventListener("pointerdown",B),n.domElement.removeEventListener("pointercancel",V),n.domElement.removeEventListener("wheel",W),n.domElement.removeEventListener("pointermove",H),n.domElement.removeEventListener("pointerup",G),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",j)};let 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},i=r.NONE,a=1e-6,s=new o7,o=new o7,l=1,u=new ew,c=!1,h=new Y,d=new Y,p=new Y,f=new Y,m=new Y,g=new Y,v=new Y,y=new Y,x=new Y,_=[],b={};function w(){return Math.pow(.95,n.zoomSpeed)}function S(e){o.theta-=e}function M(e){o.phi-=e}let T=function(){let e=new ew;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),u.add(e)}}(),E=function(){let e=new ew;return function(t,r){!0===n.screenSpacePanning?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),u.add(e)}}(),A=function(){let e=new ew;return function(t,r){let i=n.domElement;if(n.object.isPerspectiveCamera){let a=n.object.position;e.copy(a).sub(n.target);let s=e.length();T(2*t*(s*=Math.tan(n.object.fov/2*Math.PI/180))/i.clientHeight,n.object.matrix),E(2*r*s/i.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(T(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),E(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?l/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),c=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function P(e){n.object.isPerspectiveCamera?l*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),c=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(e){h.set(e.clientX,e.clientY)}function N(e){f.set(e.clientX,e.clientY)}function D(){if(1===_.length)h.set(_[0].pageX,_[0].pageY);else{let e=.5*(_[0].pageX+_[1].pageX),t=.5*(_[0].pageY+_[1].pageY);h.set(e,t)}}function k(){if(1===_.length)f.set(_[0].pageX,_[0].pageY);else{let e=.5*(_[0].pageX+_[1].pageX),t=.5*(_[0].pageY+_[1].pageY);f.set(e,t)}}function O(){let e=_[0].pageX-_[1].pageX,t=_[0].pageY-_[1].pageY;v.set(0,Math.sqrt(e*e+t*t))}function z(e){if(1==_.length)d.set(e.pageX,e.pageY);else{let t=J(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);d.set(n,r)}p.subVectors(d,h).multiplyScalar(n.rotateSpeed);let t=n.domElement;S(2*Math.PI*p.x/t.clientHeight),M(2*Math.PI*p.y/t.clientHeight),h.copy(d)}function F(e){if(1===_.length)m.set(e.pageX,e.pageY);else{let t=J(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);m.set(n,r)}g.subVectors(m,f).multiplyScalar(n.panSpeed),A(g.x,g.y),f.copy(m)}function U(e){let t=J(e),r=e.pageX-t.x,i=e.pageY-t.y;y.set(0,Math.sqrt(r*r+i*i)),x.set(0,Math.pow(y.y/v.y,n.zoomSpeed)),R(x.y),v.copy(y)}function B(e){!1!==n.enabled&&(0===_.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",H),n.domElement.addEventListener("pointerup",G)),_.push(e),"touch"===e.pointerType?function(e){switch(Z(e),_.length){case 1:switch(n.touches.ONE){case L.ROTATE:if(!1===n.enableRotate)return;D(),i=r.TOUCH_ROTATE;break;case L.PAN:if(!1===n.enablePan)return;k(),i=r.TOUCH_PAN;break;default:i=r.NONE}break;case 2:switch(n.touches.TWO){case L.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&O(),n.enablePan&&k(),i=r.TOUCH_DOLLY_PAN;break;case L.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&O(),n.enableRotate&&D(),i=r.TOUCH_DOLLY_ROTATE;break;default:i=r.NONE}break;default:i=r.NONE}i!==r.NONE&&n.dispatchEvent(dU)}(e):function(e){let t;switch(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 C.DOLLY:if(!1===n.enableZoom)return;v.set(e.clientX,e.clientY),i=r.DOLLY;break;case C.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;N(e),i=r.PAN}else{if(!1===n.enableRotate)return;I(e),i=r.ROTATE}break;case C.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;I(e),i=r.ROTATE}else{if(!1===n.enablePan)return;N(e),i=r.PAN}break;default:i=r.NONE}i!==r.NONE&&n.dispatchEvent(dU)}(e))}function H(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(Z(e),i){case r.TOUCH_ROTATE:if(!1===n.enableRotate)return;z(e),n.update();break;case r.TOUCH_PAN:if(!1===n.enablePan)return;F(e),n.update();break;case r.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&U(e),n.enablePan&&F(e),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&U(e),n.enableRotate&&z(e),n.update();break;default:i=r.NONE}}(e):function(e){switch(i){case r.ROTATE:if(!1===n.enableRotate)return;!function(e){d.set(e.clientX,e.clientY),p.subVectors(d,h).multiplyScalar(n.rotateSpeed);let t=n.domElement;S(2*Math.PI*p.x/t.clientHeight),M(2*Math.PI*p.y/t.clientHeight),h.copy(d),n.update()}(e);break;case r.DOLLY:if(!1===n.enableZoom)return;y.set(e.clientX,e.clientY),x.subVectors(y,v),x.y>0?R(w()):x.y<0&&P(w()),v.copy(y),n.update();break;case r.PAN:if(!1===n.enablePan)return;m.set(e.clientX,e.clientY),g.subVectors(m,f).multiplyScalar(n.panSpeed),A(g.x,g.y),f.copy(m),n.update()}}(e))}function G(e){X(e),0===_.length&&(n.domElement.releasePointerCapture(e.pointerId),n.domElement.removeEventListener("pointermove",H),n.domElement.removeEventListener("pointerup",G)),n.dispatchEvent(dB),i=r.NONE}function V(e){X(e)}function W(e){!1!==n.enabled&&!1!==n.enableZoom&&i===r.NONE&&(e.preventDefault(),n.dispatchEvent(dU),e.deltaY<0?P(w()):e.deltaY>0&&R(w()),n.update(),n.dispatchEvent(dB))}function j(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?M(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):A(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?M(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):A(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?S(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):A(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?S(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):A(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function q(e){!1!==n.enabled&&e.preventDefault()}function X(e){delete b[e.pointerId];for(let t=0;t<_.length;t++)if(_[t].pointerId==e.pointerId){_.splice(t,1);return}}function Z(e){let t=b[e.pointerId];void 0===t&&(t=new Y,b[e.pointerId]=t),t.set(e.pageX,e.pageY)}function J(e){let t=e.pointerId===_[0].pointerId?_[1]:_[0];return b[t.pointerId]}n.domElement.addEventListener("contextmenu",q),n.domElement.addEventListener("pointerdown",B),n.domElement.addEventListener("pointercancel",V),n.domElement.addEventListener("wheel",W,{passive:!1}),this.update()}}});var dH=function(e){var t=uu(),n=t.camera,r=t.gl.domElement,i=(0,M.useRef)();return uc(function(){return i.current.update()}),(0,M.useEffect)(function(){i.current.target=new ew(e.look_at[0],e.look_at[1],e.look_at[2])},[e.look_at]),M.createElement("orbitControls",{ref:i,args:[n,r]})},dG=function(e,t,n){var r=e.createDataChannel("sendDataChannel",{ordered:!0,protocol:"raw"});return r.onopen=function(e){console.log("RTC Connected"),t()},r.onclose=function(e){console.log("RTC Disconnected"),console.log(e),n(),setTimeout(function(){window.close()},5e3)},r.onerror=function(e){console.log("RTC Error"),console.log(e)},r.onmessage=function(e){var t=JSON.parse(e.data),n=t[0],r=t[1];cg.emit("wsRx",n,r)},r.onclosing=function(e){console.log("RTC Closing"),console.log(e)},dV(e),r},dV=function(e){return e.createOffer().then(function(t){return e.setLocalDescription(t)}).then(function(){return new Promise(function(t){if("complete"===e.iceGatheringState)t();else{var n=function(){"complete"===e.iceGatheringState&&(e.removeEventListener("icegatheringstatechange",n),t())};e.addEventListener("icegatheringstatechange",n)}})}).then(function(){var t=e.localDescription;return console.log(t),fetch("/offer",{body:JSON.stringify({type:"offer",offer:{sdp:t.sdp,type:t.type}}),headers:{"Content-Type":"application/json"},method:"POST"})}).then(function(e){return e.json()}).then(function(t){return e.setRemoteDescription(t)}).catch(function(e){console.log("RTC Connection Error"),console.log(e)})};tp.DEFAULT_UP=new ew(0,0,1);var dW=function(e){return M.createElement("group",null,e.meshes.map(function(e,t){return M.createElement(dz,E({key:t},e))}))},dj=M.forwardRef(function(e,t){return M.createElement("group",{ref:t},e.meshes.map(function(e,t){return M.createElement(dW,{key:t,meshes:e})}))}),dq=function(e){var t=(0,M.useState)(!0),n=t[0],r=t[1],i=(0,M.useState)(!1),a=i[0],s=i[1],o=(0,M.useState)(0),l=o[0],u=o[1],c=(0,M.useRef)(),h=(0,M.useRef)(null),d=(0,M.useState)([]),p=d[0],f=d[1],m=(0,M.useState)(!1),g=m[0],v=m[1],y=(0,M.useState)(!1),x=y[0],_=y[1],b=(0,M.useReducer)(ce,{formData:{},formElements:[]}),w=b[0],S=b[1],T=(0,M.useState)([.2,1.2,.7]),C=T[0],L=T[1],R=(0,M.useState)([0,0,.2]),P=R[0],I=R[1],N=(0,M.useState)({screenshot:!1,startRecord:!1,stopRecord:!1,isRecording:!1,shouldCapture:!1,ext:"png",filename:"swift_recording",snap_filename:"swift_snap",format:"",framerate:40,setStates:function(e){k(E({},e))}}),D=N[0],k=N[1],O=(0,M.useState)({chunkSize:0,lowWaterMark:0,highWaterMark:0}),z=O[0],F=O[1],U=(0,M.useState)({sendProgress:0,data:"",finished:!0}),B=U[0],H=U[1],G=(0,M.useRef)(null),V=(0,M.useRef)(null);(0,M.useEffect)(function(){var t=!1,n=!1;s(!0);var i=e.port,a=window.location.search.substring(1).split("&");if(0===i&&(i=parseInt(a[0])),null===i&&(t=!1),0===i?(t=!1,n=!1):1===i?(t=!1,n=!0):t=!0,r(t),t){console.log("Using Websockets on port "+i);var o="ws://localhost:"+i+"/";h.current=new WebSocket(o),h.current.onopen=function(){h.current.onclose=function(){setTimeout(function(){window.close()},5e3)},h.current.send("Connected"),v(!0)},cg.on("wsSwiftTx",function(e){h.current.send(e)})}else{console.log("Using RTC connection");var l={};n&&(l.iceServers=[{urls:["stun:stun.voipia.net:3478"]}]),G.current=new RTCPeerConnection(l),V.current=dG(G.current,W,j)}h.current&&(h.current.onmessage=function(e){var t=JSON.parse(e.data),n=t[0],r=t[1];cg.emit("wsRx",n,r)})},[]),(0,M.useEffect)(function(){cg.removeAllListeners("rtcLowWater"),cg.on("rtcLowWater",function(e){X(!1)}),cg.removeAllListeners("wsRx"),cg.on("wsRx",function(e,t){Y[e](t)})},[p,w,x,z,B]),(0,M.useEffect)(function(){n||(cg.removeAllListeners("wsSwiftTx"),cg.on("wsSwiftTx",function(e){q(e)}))},[x,n]);var W=function(){_(!0),v(!0);var e=G.current.sctp.maxMessageSize;F({chunkSize:e,lowWaterMark:e,highWaterMark:1*e}),V.current.bufferedAmountLowThreshold=e,V.current.addEventListener("bufferedamountlow",function(e){cg.emit("rtcLowWater",!1)}),X(!0)},j=function(){console.log("RTC Connection Closed"),_(!1)},q=function(e){if(!x){console.log("RTC not connected, can not send message to Swift");return}V.current.send(e)},X=function(e,t){var n=t||B;if(!n.finished&&(x||e)){for(var r=n.sendProgress,i=n.data.length-r;i>0;){if(V.current.bufferedAmount>z.highWaterMark){H(E(E({},n),{sendProgress:r}));return}var a=Math.min(z.chunkSize,i);V.current.send(n.data.slice(r,r+a)),i-=a,r+=a}H(E(E({},n),{finished:!0}))}},Y={shape_mounted:function(e){var t=e[0],n=e[1];try{var r=0;c.current.children[t].children.forEach(function(e,t){"loaded"===e.name&&r++}),r===n?cg.emit("wsSwiftTx","1"):cg.emit("wsSwiftTx","0")}catch(e){cg.emit("wsSwiftTx","0")}},shape:function(e){var t=p.length.toString();f(A(p,[e])),cg.emit("wsSwiftTx",t)},remove:function(e){var t=A(p);t[e]=[],f(t),cg.emit("wsSwiftTx","0")},shape_poses:function(e){0!==Object.keys(w.formData).length?(cg.emit("wsSwiftTx",JSON.stringify(w.formData)),S({type:"reset",indices:Object.keys(w.formData)})):cg.emit("wsSwiftTx","[]"),e.forEach(function(e){var t=e[0];e[1].forEach(function(e,n){c.current.children[t].children[n].position.set(e.t[0],e.t[1],e.t[2]);var r=new eb(e.q[0],e.q[1],e.q[2],e.q[3]);c.current.children[t].children[n].setRotationFromQuaternion(r)})}),k(E(E({},D),{shouldCapture:!0}))},sim_time:function(e){u(parseFloat(e))},close:function(e){h.current.close(),window.close()},element:function(e){S({type:"newElement",data:e}),cg.emit("wsSwiftTx","0")},update_element:function(e){S({type:"wsUpdate",index:e.id,data:e})},camera_pose:function(e){L(e.t),I(e.look_at)},start_recording:function(e){k(E(E({},D),{format:e[2],framerate:e[0],filename:e[1],startRecord:!0})),cg.emit("wsSwiftTx","0")},stop_recording:function(e){k(E(E({},D),{stopRecord:!0})),cg.emit("wsSwiftTx","0")},screenshot:function(e){k(E(E({},D),{screenshot:!0,snap_filename:e[0]})),cg.emit("wsSwiftTx","0")},get_frame:function(e){var t={sendProgress:0,data:document.getElementById(e).toDataURL("image/jpeg",.9),finished:!1};H(t),X(!1,t)}};return M.createElement("div",{className:u9.swiftContainer},M.createElement(uY.Provider,{value:S},M.createElement(u$,{time:l,connected:g,screenshot:function(){return k(E(E({},D),{screenshot:!0}))}}),M.createElement(u7,{elements:w.formElements})),M.createElement(uV,{gl:{antialias:!0,preserveDrawingBuffer:!0},id:"threeCanvas"},M.createElement(uX,E({},D)),M.createElement(dP,{t:C}),a&&M.createElement(M.Suspense,{fallback:null},M.createElement(dH,{look_at:P})),M.createElement("hemisphereLight",{groundColor:new eh(1118498)}),M.createElement(dR,{x:10,y:10,z:10,color:16777215,intensity:.2}),M.createElement(dR,{x:-10,y:-10,z:10,color:16777215,intensity:.2}),M.createElement(dL,null),M.createElement("axesHelper",{args:[100]}),M.createElement(dj,{meshes:p,ref:c})))};let dX=()=>(0,x.jsxs)("div",{className:S().container,children:[(0,x.jsxs)(b(),{children:[(0,x.jsx)("title",{children:"Swift"}),(0,x.jsx)("link",{rel:"icon",href:"/favicon.ico"}),(0,x.jsx)("meta",{"http-equiv":"cache-control",content:"no-cache"}),(0,x.jsx)("meta",{"http-equiv":"expires",content:"0"}),(0,x.jsx)("meta",{"http-equiv":"pragma",content:"no-cache"})]}),(0,x.jsx)("main",{className:S().main,children:(0,x.jsx)("div",{className:S().container,children:(0,x.jsx)(dq,{port:0})})})]});var dY=dX},8122:function(e){e.exports={container:"Home_container__bCOhY",main:"Home_main__nLjiQ"}},9008:function(e,t,n){e.exports=n(5443)}},function(e){e.O(0,[774,888,179],function(){return e(e.s=8312)}),_N_E=e.O()}]); \ No newline at end of file +*/var hL=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(hL(""))}catch(e){hL=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var hR=Uint8Array,hP=Uint16Array,hI=Uint32Array,hN=new hR([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),hD=new hR([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),hk=new hR([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hO=function(e,t){for(var n=new hP(31),r=0;r<31;++r)n[r]=t+=1<>>1|(21845&hG)<<1;hV=(61680&(hV=(52428&hV)>>>2|(13107&hV)<<2))>>>4|(3855&hV)<<4,hH[hG]=((65280&hV)>>>8|(255&hV)<<8)>>>1}for(var hW=function(e,t,n){for(var r,i=e.length,a=0,s=new hP(t);a>>l]=u}else for(a=0,r=new hP(i);a>>15-e[a]);return r},hj=new hR(288),hG=0;hG<144;++hG)hj[hG]=8;for(var hG=144;hG<256;++hG)hj[hG]=9;for(var hG=256;hG<280;++hG)hj[hG]=7;for(var hG=280;hG<288;++hG)hj[hG]=8;for(var hq=new hR(32),hG=0;hG<32;++hG)hq[hG]=5;var hX=hW(hj,9,1),hY=hW(hq,5,1),hZ=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},hJ=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},hK=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},hQ=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof hP?hP:e instanceof hI?hI:hR)(n-t);return r.set(e.subarray(t,n)),r},h$=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new hR(0);var i=!t||n,a=!n||n.i;n||(n={}),t||(t=new hR(3*r));var s=function(e){var n=t.length;if(e>n){var r=new hR(Math.max(2*n,e));r.set(t),t=r}},o=n.f||0,l=n.p||0,u=n.b||0,c=n.l,h=n.d,d=n.m,p=n.n,f=8*r;do{if(!c){n.f=o=hJ(e,l,1);var m=hJ(e,l+1,3);if(l+=3,m){if(1==m)c=hX,h=hY,d=9,p=5;else if(2==m){var g=hJ(e,l,31)+257,v=hJ(e,l+10,15)+4,y=g+hJ(e,l+5,31)+1;l+=14;for(var x=new hR(y),_=new hR(19),b=0;b>>4;if(E<16)x[b++]=E;else{var A=0,C=0;for(16==E?(C=3+hJ(e,l,3),l+=2,A=x[b-1]):17==E?(C=3+hJ(e,l,7),l+=3):18==E&&(C=11+hJ(e,l,127),l+=7);C--;)x[b++]=A}}var L=x.subarray(0,g),R=x.subarray(g);d=hZ(L),p=hZ(R),c=hW(L,d,1),h=hW(R,p,1)}else throw"invalid block type"}else{var P,E=((P=l)/8|0)+(7&P&&1)+4,I=e[E-4]|e[E-3]<<8,N=E+I;if(N>r){if(a)throw"unexpected EOF";break}i&&s(u+I),t.set(e.subarray(E,N),u),n.b=u+=I,n.p=l=8*N;continue}if(l>f){if(a)throw"unexpected EOF";break}}i&&s(u+131072);for(var D=(1<>>4;if((l+=15&A)>f){if(a)throw"unexpected EOF";break}if(!A)throw"invalid length/literal";if(z<256)t[u++]=z;else if(256==z){O=l,c=null;break}else{var F=z-254;if(z>264){var b=z-257,U=hN[b];F=hJ(e,l,(1<>>4;if(!B)throw"invalid distance";l+=15&B;var R=hB[H];if(H>3){var U=hD[H];R+=hK(e,l)&(1<f){if(a)throw"unexpected EOF";break}i&&s(u+131072);for(var G=u+F;u>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"},h3="undefined"!=typeof TextDecoder&&new TextDecoder;try{h3.decode(h0,{stream:!0})}catch(e){}function h2(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let i=e,a=r,s=Math.floor((i+a)/2);for(;t=n[s+1];)t=a&&(l[i][0]=l[t][0]/o[c+1][u],r=l[i][0]*o[u][c]);let h=u>=-1?1:-u,d=e-1<=c?a-1:n-e;for(let e=h;e<=d;++e)l[i][e]=(l[t][e]-l[t][e-1])/o[c+1][u+e],r+=l[i][e]*o[u+e][c];e<=c&&(l[i][a]=-l[t][a-1]/o[c+1][e],r+=l[i][a]*o[e][c]),s[a][e]=r;let p=t;t=i,i=p}}let c=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)s[e][t]*=c;c*=n-e}return s}(o,r,e,a,t),u=[];for(let e=0;e=t.length&&t===dp(e,0,t.length)}(e))h=new de().parse(e);else{let t=dp(e);if(!function(e){let t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;for(let r=0;rdr(t))throw Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+dr(t));h=new h9().parse(t)}let n=new oe(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new h6(n,this.manager).parse(h)}}class h6{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){d=this.parseConnections();let e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),i=new h8().parse(r);return this.parseScene(r,i,n),p}parseConnections(){let e=new Map;if("Connections"in h){let t=h.Connections.connections;t.forEach(function(t){let n=t[0],r=t[1],i=t[2];e.has(n)||e.set(n,{parents:[],children:[]}),e.get(n).parents.push({ID:r,relationship:i}),e.has(r)||e.set(r,{parents:[],children:[]}),e.get(r).children.push({ID:n,relationship:i})})}return e}parseImages(){let e={},t={};if("Video"in h.Objects){let n=h.Objects.Video;for(let r in n){let i=n[r],a=parseInt(r);if(e[a]=i.RelativeFilename||i.Filename,"Content"in i){let e=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a="string"==typeof i.Content&&""!==i.Content;if(e||a){let e=this.parseImage(n[r]);t[i.RelativeFilename||i.Filename]=e}}}}for(let n in e){let r=e[n];void 0!==t[r]?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){let t;let n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if("string"==typeof n)return"data:"+t+";base64,"+n;{let e=new Uint8Array(n);return window.URL.createObjectURL(new Blob([e],{type:t}))}}parseTextures(e){let t=new Map;if("Texture"in h.Objects){let n=h.Objects.Texture;for(let r in n){let i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}parseTexture(e,t){let n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;let r=e.WrapModeU,i=e.WrapModeV,a=void 0!==r?r.value:0,s=void 0!==i?i.value:0;if(n.wrapS=0===a?1e3:1001,n.wrapT=0===s?1e3:1001,"Scaling"in e){let t=e.Scaling.value;n.repeat.x=t[0],n.repeat.y=t[1]}if("Translation"in e){let t=e.Translation.value;n.offset.x=t[0],n.offset.y=t[1]}return n}loadTexture(e,t){let n,r;let i=this.textureLoader.path,a=d.get(e.id).children;void 0!==a&&a.length>0&&void 0!==t[a[0].ID]&&(0===(n=t[a[0].ID]).indexOf("blob:")||0===n.indexOf("data:"))&&this.textureLoader.setPath(void 0);let s=e.FileName.slice(-3).toLowerCase();if("tga"===s){let t=this.manager.getHandler(".tga");null===t?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),r=new eg):(t.setPath(this.textureLoader.path),r=t.load(n))}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),r=new eg):r=this.textureLoader.load(n);return this.textureLoader.setPath(i),r}parseMaterials(e){let t=new Map;if("Material"in h.Objects){let n=h.Objects.Material;for(let r in n){let i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}parseMaterial(e,t){let n;let r=e.id,i=e.attrName,a=e.ShadingModel;if("object"==typeof a&&(a=a.value),!d.has(r))return null;let s=this.parseParameters(e,t,r);switch(a.toLowerCase()){case"phong":n=new sL;break;case"lambert":n=new sI;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),n=new sL}return n.setValues(s),n.name=i,n}parseParameters(e,t,n){let r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new eh().fromArray(e.Diffuse.value):e.DiffuseColor&&("Color"===e.DiffuseColor.type||"ColorRGB"===e.DiffuseColor.type)&&(r.color=new eh().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new eh().fromArray(e.Emissive.value):e.EmissiveColor&&("Color"===e.EmissiveColor.type||"ColorRGB"===e.EmissiveColor.type)&&(r.emissive=new eh().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new eh().fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(r.specular=new eh().fromArray(e.SpecularColor.value));let i=this;return d.get(n).children.forEach(function(e){let n=e.relationship;switch(n){case"Bump":r.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(t,e.ID),void 0!==r.map&&(r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(t,e.ID),void 0!==r.emissiveMap&&(r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":r.envMap=i.getTexture(t,e.ID),void 0!==r.envMap&&(r.envMap.mapping=303,r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=i.getTexture(t,e.ID),void 0!==r.specularMap&&(r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(t,e.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}}),r}getTexture(e,t){return"LayeredTexture"in h.Objects&&t in h.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=d.get(t).children[0].ID),e.get(t)}parseDeformers(){let e={},t={};if("Deformer"in h.Objects){let n=h.Objects.Deformer;for(let r in n){let i=n[r],a=d.get(parseInt(r));if("Skin"===i.attrType){let t=this.parseSkeleton(a,n);t.ID=r,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),t.geometryID=a.parents[0].ID,e[r]=t}else if("BlendShape"===i.attrType){let e={id:r};e.rawTargets=this.parseMorphTargets(a,n),e.id=r,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=e}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){let n=[];return e.children.forEach(function(e){let r=t[e.ID];if("Cluster"!==r.attrType)return;let i={ID:e.ID,indices:[],weights:[],transformLink:new eQ().fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){let n=[];for(let r=0;r1?a=s:s.length>0?a=s[0]:(a=new sL({color:13421772}),s.push(a)),"color"in i.attributes&&s.forEach(function(e){e.vertexColors=!0}),i.FBX_Deformer?(r=new i$(i,a)).normalizeSkinWeights():r=new t3(i,a),r}createCurve(e,t){let n=e.children.reduce(function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e},null),r=new an({color:3342591,linewidth:1});return new al(n,r)}getTransformData(e,t){let n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=dh(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){if("LookAtProperty"in t){let t=d.get(e.ID).children;t.forEach(function(t){if("LookAtProperty"===t.relationship){let n=h.Objects.Model[t.ID];if("Lcl_Translation"in n){let t=n.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(t),p.add(e.target)):e.lookAt(new ew().fromArray(t))}}})}}bindSkeleton(e,t,n){let r=this.parsePoseNodes();for(let i in e){let a=e[i],s=d.get(parseInt(a.ID)).parents;s.forEach(function(e){if(t.has(e.ID)){let t=e.ID,i=d.get(t);i.parents.forEach(function(e){if(n.has(e.ID)){let t=n.get(e.ID);t.bind(new i4(a.bones),r[e.ID])}})}})}}parsePoseNodes(){let e={};if("Pose"in h.Objects){let t=h.Objects.Pose;for(let n in t)if("BindPose"===t[n].attrType&&t[n].NbPoseNodes>0){let r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(t){e[t.Node]=new eQ().fromArray(t.Matrix.a)}):e[r.Node]=new eQ().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in h&&"AmbientColor"in h.GlobalSettings){let e=h.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(0!==t||0!==n||0!==r){let e=new eh(t,n,r);p.add(new og(e,1))}}}}class h8{constructor(){this.negativeMaterialIndices=!1}parse(e){let t=new Map;if("Geometry"in h.Objects){let n=h.Objects.Geometry;for(let r in n){let i=d.get(parseInt(r)),a=this.parseGeometry(i,n[r],e);t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){let r=n.skeletons,i=[],a=e.parents.map(function(e){return h.Objects.Model[e.ID]});if(0===a.length)return;let s=e.children.reduce(function(e,t){return void 0!==r[t.ID]&&(e=r[t.ID]),e},null);e.children.forEach(function(e){void 0!==n.morphTargets[e.ID]&&i.push(n.morphTargets[e.ID])});let o=a[0],l={};"RotationOrder"in o&&(l.eulerOrder=dh(o.RotationOrder.value)),"InheritType"in o&&(l.inheritType=parseInt(o.InheritType.value)),"GeometricTranslation"in o&&(l.translation=o.GeometricTranslation.value),"GeometricRotation"in o&&(l.rotation=o.GeometricRotation.value),"GeometricScaling"in o&&(l.scale=o.GeometricScaling.value);let u=dc(l);return this.genGeometry(t,s,i,u)}genGeometry(e,t,n,r){let i=new tG;e.attrName&&(i.name=e.attrName);let a=this.parseGeoNode(e,t),s=this.genBuffers(a),o=new tD(s.vertex,3);if(o.applyMatrix4(r),i.setAttribute("position",o),s.colors.length>0&&i.setAttribute("color",new tD(s.colors,3)),t&&(i.setAttribute("skinIndex",new tP(s.weightsIndices,4)),i.setAttribute("skinWeight",new tD(s.vertexWeights,4)),i.FBX_Deformer=t),s.normal.length>0){let e=new Z().getNormalMatrix(r),t=new tD(s.normal,3);t.applyNormalMatrix(e),i.setAttribute("normal",t)}if(s.uvs.forEach(function(e,t){let n="uv"+(t+1).toString();0===t&&(n="uv"),i.setAttribute(n,new tD(s.uvs[t],2))}),a.material&&"AllSame"!==a.material.mappingType){let e=s.materialIndex[0],t=0;if(s.materialIndex.forEach(function(n,r){n!==e&&(i.addGroup(t,r-t,e),e=n,t=r)}),i.groups.length>0){let t=i.groups[i.groups.length-1],n=t.start+t.count;n!==s.materialIndex.length&&i.addGroup(n,s.materialIndex.length-n,e)}0===i.groups.length&&i.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i}parseGeoNode(e,t){let n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],s=[],o=[],l=[],u=[],c=[],h=this;return e.vertexIndices.forEach(function(d,p){let f;let m=!1;d<0&&(d^=-1,m=!0);let g=[],v=[];if(a.push(3*d,3*d+1,3*d+2),e.color){let t=ds(p,n,d,e.color);o.push(t[0],t[1],t[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach(function(e){v.push(e.weight),g.push(e.id)}),v.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);let e=[0,0,0,0],t=[0,0,0,0];v.forEach(function(n,r){let i=n,a=g[r];t.forEach(function(t,n,r){if(i>t){r[n]=i,i=t;let s=e[n];e[n]=a,a=s}})}),g=e,v=t}for(;v.length<4;)v.push(0),g.push(0);for(let e=0;e<4;++e)u.push(v[e]),c.push(g[e])}if(e.normal){let t=ds(p,n,d,e.normal);s.push(t[0],t[1],t[2])}e.material&&"AllSame"!==e.material.mappingType&&(f=ds(p,n,d,e.material)[0])<0&&(h.negativeMaterialIndices=!0,f=0),e.uv&&e.uv.forEach(function(e,t){let r=ds(p,n,d,e);void 0===l[t]&&(l[t]=[]),l[t].push(r[0]),l[t].push(r[1])}),r++,m&&(r>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,a,f,s,o,l,u,c,r),n++,r=0,a=[],s=[],o=[],l=[],u=[],c=[])}),t}genFace(e,t,n,r,i,a,s,o,l,u){for(let c=2;c1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");let a=e.get(i[0].ID);n[r]={name:t[r].attrName,layer:a}}return n}addClip(e){let t=[],n=this;return e.layer.forEach(function(e){t=t.concat(n.generateTracks(e))}),new s0(e.name,-1,t)}generateTracks(e){let t=[],n=new ew,r=new eb,i=new ew;if(e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=new e7().setFromQuaternion(r,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){let r=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==r&&t.push(r)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){let n=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);void 0!==n&&t.push(n)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){let n=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");void 0!==n&&t.push(n)}if(void 0!==e.DeformPercent){let n=this.generateMorphTrack(e);void 0!==n&&t.push(n)}return t}generateVectorTrack(e,t,n,r){let i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new s$(e+"."+r,i,a)}generateRotationTrack(e,t,n,r,i,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(X.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(X.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(X.degToRad));let s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,n);void 0!==r&&((r=r.map(X.degToRad)).push(a),r=new e7().fromArray(r),r=new eb().setFromEuler(r)),void 0!==i&&((i=i.map(X.degToRad)).push(a),i=new e7().fromArray(i),i=new eb().setFromEuler(i).invert());let l=new eb,u=new e7,c=[];for(let e=0;e1){let e=1,n=t[0];for(let r=1;r=180){let a=i/180,s=r/a,o=n+s,l=e.times[t-1],u=e.times[t]-l,c=u/a,h=l+c,d=[],p=[];for(;h1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());let a=this.getCurrentNode(),s=a.name;if("Properties70"===s){this.parseNodeSpecialProperty(e,r,i);return}if("C"===r){let e=i.split(",").slice(1),t=parseInt(e[0]),n=parseInt(e[1]),s=i.split(",").slice(3);s=s.map(function(e){return e.trim().replace(/^"/,"")}),r="connections",function(e,t){for(let n=0,r=e.length,i=t.length;n=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),s=e.getString(a);if(0===r)return null;let o=[];for(let t=0;t0?o[0]:"",u=o.length>1?o[1]:"",c=o.length>2?o[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);null!==r&&this.parseSubNode(s,n,r)}return n.propertyList=o,"number"==typeof l&&(n.id=l),""!==u&&(n.attrName=u),""!==c&&(n.attrType=c),""!==s&&(n.name=s),n}parseSubNode(e,t,n){if(!0===n.singleProperty){let e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if("Connections"===e&&"C"===n.name){let e=[];n.propertyList.forEach(function(t,n){0!==n&&e.push(t)}),void 0===t.connections&&(t.connections=[]),t.connections.push(e)}else if("Properties70"===n.name){let e=Object.keys(n);e.forEach(function(e){t[e]=n[e]})}else if("Properties70"===e&&"P"===n.name){let e,r=n.propertyList[0],i=n.propertyList[1],a=n.propertyList[2],s=n.propertyList[3];0===r.indexOf("Lcl ")&&(r=r.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),e="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[r]={type:i,type2:a,flag:s,value:e}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}parseProperty(e){let t;let n=e.getString(1);switch(n){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return t=e.getUint32(),e.getArrayBuffer(t);case"S":return t=e.getUint32(),e.getString(t);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r;let i=e.getUint32(),a=e.getUint32(),s=e.getUint32();if(0===a)switch(n){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}let o=h$((h1(r=new Uint8Array(e.getArrayBuffer(s))),r.subarray(2,-4)),void 0),l=new dt(o.buffer);switch(n){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw Error("THREE.FBXLoader: Unknown property type "+n)}}}class dt{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(1&this.getUint8())==1}getBooleanArray(e){let t=[];for(let n=0;n=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}}class dn{add(e,t){this[e]=t}}function dr(e){let t=e.match(/FBXVersion: (\d+)/);if(t){let e=parseInt(t[1]);return e}throw Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function di(e){return e/46186158e3}let da=[];function ds(e,t,n,r){let i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);let a=i*r.dataSize,s=a+r.dataSize;return function(e,t,n,r){for(let i=n,a=0;i1){let e=Math.sqrt(v);t*=e,n*=e,p=t*t,f=n*n}let y=p*g+f*m,x=(p*f-y)/y,_=Math.sqrt(Math.max(0,x));a===s&&(_=-_);let b=_*t*d/n,w=-_*n*h/t,S=Math.cos(i)*b-Math.sin(i)*w+(o.x+l.x)/2,M=Math.sin(i)*b+Math.cos(i)*w+(o.y+l.y)/2,T=r(1,0,(h-b)/t,(d-w)/n),E=r((h-b)/t,(d-w)/n,(-h-b)/t,(-d-w)/n)%(2*Math.PI);e.currentPath.absellipse(S,M,t,n,T,T+E,0===s,i)}function r(e,t,n,r){let i=Math.acos(Math.max(-1,Math.min(1,(e*n+t*r)/(Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r)))));return e*r-t*n<0&&(i=-i),i}function i(e,t){t=Object.assign({},t);let n={};if(e.hasAttribute("class")){let t=e.getAttribute("class").split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e=0;e--){let r=n[e].trim();if(""===r)continue;let i=r.indexOf("("),s=r.length;if(i>0&&i=1){let e=t[0],n=0;t.length>=2&&(n=t[1]),m.translate(e,n)}break;case"rotate":if(t.length>=1){let e=0,n=0,r=0;e=t[0]*Math.PI/180,t.length>=3&&(n=t[1],r=t[2]),g.makeTranslation(-n,-r),v.makeRotation(e),y.multiplyMatrices(v,g),g.makeTranslation(n,r),m.multiplyMatrices(g,y)}break;case"scale":if(t.length>=1){let e=t[0],n=e;t.length>=2&&(n=t[1]),m.scale(e,n)}break;case"skewX":1===t.length&&m.set(1,Math.tan(t[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===t.length&&m.set(1,0,0,Math.tan(t[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===t.length&&m.set(t[0],t[2],t[4],t[1],t[3],t[5],0,0,1)}}t.premultiply(m)}}return t}(e);return f.length>0&&t.premultiply(f[f.length-1]),b.copy(t),f.push(t),t}(t),o=!1,w=null;switch(t.nodeName){case"svg":case"g":r=i(t,r);break;case"style":!function(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(let t=0;te.trim());for(let e=0;e""!==e));p[r[e]]=Object.assign(p[r[e]]||{},t)}}}(t);break;case"path":r=i(t,r),t.hasAttribute("d")&&(w=function(e){let t=new ly,r=new Y,i=new Y,s=new Y,o=!0,l=!1,u=e.getAttribute("d"),c=u.match(/[a-df-z][^a-df-z]*/ig);for(let e=0,u=c.length;e0&&(r.copy(s),t.currentPath.currentPoint.copy(r),o=!0);break;default:console.warn(x)}l=!1}return t}(t));break;case"rect":r=i(t,r),w=function(e){let t=l(e.getAttribute("x")||0),n=l(e.getAttribute("y")||0),r=l(e.getAttribute("rx")||e.getAttribute("ry")||0),i=l(e.getAttribute("ry")||e.getAttribute("rx")||0),a=l(e.getAttribute("width")),s=l(e.getAttribute("height")),o=new ly;return o.moveTo(t+r,n),o.lineTo(t+a-r,n),(0!==r||0!==i)&&o.bezierCurveTo(t+a-.448084975506*r,n,t+a,n+.448084975506*i,t+a,n+i),o.lineTo(t+a,n+s-i),(0!==r||0!==i)&&o.bezierCurveTo(t+a,n+s-.448084975506*i,t+a-.448084975506*r,n+s,t+a-r,n+s),o.lineTo(t+r,n+s),(0!==r||0!==i)&&o.bezierCurveTo(t+.448084975506*r,n+s,t,n+s-.448084975506*i,t,n+s-i),o.lineTo(t,n+i),(0!==r||0!==i)&&o.bezierCurveTo(t,n+.448084975506*i,t+.448084975506*r,n,t+r,n),o}(t);break;case"polygon":r=i(t,r),w=function(e){let t=new ly,n=0;return e.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,function(e,r,i){let a=l(r),s=l(i);0===n?t.moveTo(a,s):t.lineTo(a,s),n++}),t.currentPath.autoClose=!0,t}(t);break;case"polyline":r=i(t,r),w=function(e){let t=new ly,n=0;return e.getAttribute("points").replace(/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,function(e,r,i){let a=l(r),s=l(i);0===n?t.moveTo(a,s):t.lineTo(a,s),n++}),t.currentPath.autoClose=!1,t}(t);break;case"circle":r=i(t,r),w=function(e){let t=l(e.getAttribute("cx")||0),n=l(e.getAttribute("cy")||0),r=l(e.getAttribute("r")||0),i=new aG;i.absarc(t,n,r,0,2*Math.PI);let a=new ly;return a.subPaths.push(i),a}(t);break;case"ellipse":r=i(t,r),w=function(e){let t=l(e.getAttribute("cx")||0),n=l(e.getAttribute("cy")||0),r=l(e.getAttribute("rx")||0),i=l(e.getAttribute("ry")||0),a=new aG;a.absellipse(t,n,r,i,0,2*Math.PI);let s=new ly;return s.subPaths.push(a),s}(t);break;case"line":r=i(t,r),w=function(e){let t=l(e.getAttribute("x1")||0),n=l(e.getAttribute("y1")||0),r=l(e.getAttribute("x2")||0),i=l(e.getAttribute("y2")||0),a=new ly;return a.moveTo(t,n),a.lineTo(r,i),a.currentPath.autoClose=!1,a}(t);break;case"defs":o=!0;break;case"use":r=i(t,r);let S=t.getAttributeNS("http://www.w3.org/1999/xlink","href")||"",M=S.substring(1),T=t.viewportElement.getElementById(M);T?e(T,r):console.warn("SVGLoader: 'use node' references non-existent node id: "+M)}w&&(void 0!==r.fill&&"none"!==r.fill&&w.color.setStyle(r.fill),function(e,t){function n(e){_.set(e.x,e.y,1).applyMatrix3(t),e.set(_.x,_.y)}let r=e.subPaths;for(let e=0,i=r.length;eNumber.EPSILON}(t)?function(e){let n=e.xRadius,r=e.yRadius,i=Math.cos(e.aRotation),a=Math.sin(e.aRotation),s=new ew(n*i,n*a,0),o=new ew(-r*a,r*i,0),l=s.applyMatrix3(t),c=o.applyMatrix3(t),h=m.set(l.x,c.x,0,l.y,c.y,0,0,0,1),d=g.copy(h).invert(),p=v.copy(d).transpose(),f=p.multiply(d),y=f.elements,x=function(e,t,n){let r,i,a,s,o;let l=e+n,u=e-n,c=Math.sqrt(u*u+4*t*t);return l>0?i=e*(o=1/(r=.5*(l+c)))*n-t*o*t:l<0?i=.5*(l-c):(r=.5*c,i=-.5*c),Math.abs(a=u>0?u+c:u-c)>2*Math.abs(t)?(s=1/Math.sqrt(1+(o=-2*t/a)*o),a=o*s):0===Math.abs(t)?(a=1,s=0):(a=1/Math.sqrt(1+(o=-.5*a/t)*o),s=o*a),u>0&&(o=a,a=-s,s=o),{rt1:r,rt2:i,cs:a,sn:s}}(y[0],y[1],y[4]),_=Math.sqrt(x.rt1),b=Math.sqrt(x.rt2);e.xRadius=1/_,e.yRadius=1/b,e.aRotation=Math.atan2(x.sn,x.cs);let w=(e.aEndAngle-e.aStartAngle)%(2*Math.PI){let{x:t,y:n}=new ew(Math.cos(e),Math.sin(e),0).applyMatrix3(i);return Math.atan2(n,t)};e.aStartAngle=a(e.aStartAngle),e.aEndAngle=a(e.aEndAngle),u(t)&&(e.aClockwise=!e.aClockwise)}}(r):function(e){let n=c(t),r=h(t);e.xRadius*=n,e.yRadius*=r;let i=n>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);e.aRotation+=i,u(t)&&(e.aStartAngle*=-1,e.aEndAngle*=-1,e.aClockwise=!e.aClockwise)}(r))}}}(w,b),d.push(w),w.userData={node:t,style:r});let E=t.childNodes;for(let t=0;t0?b.copy(f[f.length-1]):b.identity())}(w.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4});let S={paths:d,xml:w.documentElement};return S}static createShapes(e){let t={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},n={loc:t.ORIGIN,t:0};function r(e,r,i){let a=i.x-r.x,s=i.y-r.y,o=e.x-r.x,l=e.y-r.y,u=a*l-o*s;if(e.x===r.x&&e.y===r.y){n.loc=t.ORIGIN,n.t=0;return}if(e.x===i.x&&e.y===i.y){n.loc=t.DESTINATION,n.t=1;return}if(u<-Number.EPSILON){n.loc=t.LEFT;return}if(u>Number.EPSILON){n.loc=t.RIGHT;return}if(a*o<0||s*l<0){n.loc=t.BEHIND;return}if(Math.sqrt(a*a+s*s){let t=e.getPoints(),n=-999999999,r=999999999,s=-999999999,o=999999999;for(let e=0;en&&(n=i.y),i.ys&&(s=i.x),i.x=o&&(i=o-1),{curves:e.curves,points:t,isCW:sl.isClockWise(t),identifier:-1,boundingBox:new le(new Y(o,r),new Y(s,n))}});s=s.filter(e=>e.points.length>1);for(let e=0;e(function(e,i,a,s,o){(null==o||""===o)&&(o="nonzero");let l=new Y;e.boundingBox.getCenter(l);let u=[new Y(a,l.y),new Y(s,l.y)],c=function(e,i,a){let s=new Y;i.getCenter(s);let o=[];return a.forEach(i=>{if(i.boundingBox.containsPoint(s)){let a=function(e,i){let a=[],s=[];for(let o=1;o=1||y<0||y>1)return null;if(0===m&&0===g){for(let u=0;u<2;u++){if(r(0===u?a:s,e,i),n.loc==t.ORIGIN){let e=0===u?a:s;return{x:e.x,y:e.y,t:n.t}}if(n.loc==t.BETWEEN){let e=+(o+n.t*(l-o)).toPrecision(10),t=+(h+n.t*(d-h)).toPrecision(10);return{x:e,y:t,t:n.t}}}return null}{for(let o=0;o<2;o++)if(r(0===o?a:s,e,i),n.loc==t.ORIGIN){let e=0===o?a:s;return{x:e.x,y:e.y,t:n.t}}let u=+(o+v*(l-o)).toPrecision(10),c=+(h+v*(d-h)).toPrecision(10);return{x:u,y:c,t:v}}}(l,u,o,c);null!==h&&void 0===a.find(e=>e.t<=h.t+Number.EPSILON&&e.t>=h.t-Number.EPSILON)&&(a.push(h),s.push(new Y(h.x,h.y)))}}return s}(e,i.points);a.forEach(e=>{o.push({identifier:i.identifier,isCW:i.isCW,point:e})})}}),o.sort((e,t)=>e.point.x-t.point.x),o}(u,e.boundingBox,i);c.sort((e,t)=>e.point.x-t.point.x);let h=[],d=[];c.forEach(t=>{t.identifier===e.identifier?h.push(t):d.push(t)});let p=h[0].point.x,f=[],m=0;for(;m0&&f[f.length-1]===d[m].identifier?f.pop():f.push(d[m].identifier),m++;if(f.push(e.identifier),"evenodd"===o){let t=f.length%2==0,n=f[f.length-2];return{identifier:e.identifier,isHole:t,for:n}}if("nonzero"===o){let t=!0,n=null,r=null;for(let e=0;e{let t=o[e.identifier];if(!t.isHole){let t=new a1;t.curves=e.curves;let n=o.filter(t=>t.isHole&&t.for===e.identifier);n.forEach(e=>{let n=s[e.identifier],r=new aG;r.curves=n.curves,t.holes.push(r)}),l.push(t)}}),l}static getStrokeStyle(e,t,n,r,i){return{strokeColor:t=void 0!==t?t:"#000",strokeWidth:e=void 0!==e?e:1,strokeLineJoin:n=void 0!==n?n:"miter",strokeLineCap:r=void 0!==r?r:"butt",strokeMiterLimit:i=void 0!==i?i:4}}static pointsToStroke(e,t,n,r){let i=[],a=[],s=[];if(0===dm.pointsToStrokeWithBuffers(e,t,n,r,i,a,s))return null;let o=new tG;return o.setAttribute("position",new tD(i,3)),o.setAttribute("normal",new tD(a,3)),o.setAttribute("uv",new tD(s,2)),o}static pointsToStrokeWithBuffers(e,t,n,r,i,a,s,o){let l,u,c,h,d;let p=new Y,f=new Y,m=new Y,g=new Y,v=new Y,y=new Y,x=new Y,_=new Y,b=new Y,w=new Y,S=new Y,M=new Y,T=new Y,E=new Y,A=new Y,C=new Y,L=new Y;n=void 0!==n?n:12,r=void 0!==r?r:.001,o=void 0!==o?o:0,e=function(e){let t=!1;for(let n=1,i=e.length-1;n=r&&n.push(e[t]);return n.push(e[e.length-1]),n}(e);let R=e.length;if(R<2)return 0;let P=e[0].equals(e[R-1]),I=e[0],N=t.strokeWidth/2,D=1/(R-1),k=0,O,z=!1,F=0,U=3*o,B=2*o;H(e[0],e[1],p).multiplyScalar(N),_.copy(e[0]).sub(p),b.copy(e[0]).add(p),w.copy(_),S.copy(b);for(let n=1;np.dot(m)&&(h=!1),1===n&&(z=h),m.subVectors(u,l),m.normalize();let e=Math.abs(p.dot(m));if(e>Number.EPSILON){let n=N/e;m.multiplyScalar(-n),g.subVectors(l,I),v.copy(g).setLength(n).add(m),C.copy(v).negate();let r=v.length(),i=g.length();g.divideScalar(i),y.subVectors(u,l);let a=y.length();switch(y.divideScalar(a),g.dot(C)Math.abs(o)&&(s=Math.abs(Math.acos(o))),s/=n,m.copy(t);for(let t=0,r=n-1;tMath.PI&&(g-=m),v<-Math.PI?v+=m:v>Math.PI&&(v-=m),g<=v?s.theta=Math.max(g,Math.min(v,s.theta)):s.theta=s.theta>(g+v)/2?Math.max(g,s.theta):Math.min(v,s.theta)),s.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,s.phi)),s.makeSafe(),s.radius*=l,s.radius=Math.max(n.minDistance,Math.min(n.maxDistance,s.radius)),!0===n.enableDamping?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),t.setFromSpherical(s),t.applyQuaternion(d),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(o.theta*=1-n.dampingFactor,o.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(o.set(0,0,0),u.set(0,0,0)),l=1,!!(c||p.distanceToSquared(n.object.position)>a||8*(1-f.dot(n.object.quaternion))>a)&&(n.dispatchEvent(dz),p.copy(n.object.position),f.copy(n.object.quaternion),c=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",q),n.domElement.removeEventListener("pointerdown",B),n.domElement.removeEventListener("pointercancel",V),n.domElement.removeEventListener("wheel",W),n.domElement.removeEventListener("pointermove",H),n.domElement.removeEventListener("pointerup",G),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",j)};let 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},i=r.NONE,a=1e-6,s=new o7,o=new o7,l=1,u=new ew,c=!1,h=new Y,d=new Y,p=new Y,f=new Y,m=new Y,g=new Y,v=new Y,y=new Y,x=new Y,_=[],b={};function w(){return Math.pow(.95,n.zoomSpeed)}function S(e){o.theta-=e}function M(e){o.phi-=e}let T=function(){let e=new ew;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),u.add(e)}}(),E=function(){let e=new ew;return function(t,r){!0===n.screenSpacePanning?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),u.add(e)}}(),A=function(){let e=new ew;return function(t,r){let i=n.domElement;if(n.object.isPerspectiveCamera){let a=n.object.position;e.copy(a).sub(n.target);let s=e.length();T(2*t*(s*=Math.tan(n.object.fov/2*Math.PI/180))/i.clientHeight,n.object.matrix),E(2*r*s/i.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(T(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),E(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?l/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),c=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function P(e){n.object.isPerspectiveCamera?l*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),c=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(e){h.set(e.clientX,e.clientY)}function N(e){f.set(e.clientX,e.clientY)}function D(){if(1===_.length)h.set(_[0].pageX,_[0].pageY);else{let e=.5*(_[0].pageX+_[1].pageX),t=.5*(_[0].pageY+_[1].pageY);h.set(e,t)}}function k(){if(1===_.length)f.set(_[0].pageX,_[0].pageY);else{let e=.5*(_[0].pageX+_[1].pageX),t=.5*(_[0].pageY+_[1].pageY);f.set(e,t)}}function O(){let e=_[0].pageX-_[1].pageX,t=_[0].pageY-_[1].pageY;v.set(0,Math.sqrt(e*e+t*t))}function z(e){if(1==_.length)d.set(e.pageX,e.pageY);else{let t=J(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);d.set(n,r)}p.subVectors(d,h).multiplyScalar(n.rotateSpeed);let t=n.domElement;S(2*Math.PI*p.x/t.clientHeight),M(2*Math.PI*p.y/t.clientHeight),h.copy(d)}function F(e){if(1===_.length)m.set(e.pageX,e.pageY);else{let t=J(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);m.set(n,r)}g.subVectors(m,f).multiplyScalar(n.panSpeed),A(g.x,g.y),f.copy(m)}function U(e){let t=J(e),r=e.pageX-t.x,i=e.pageY-t.y;y.set(0,Math.sqrt(r*r+i*i)),x.set(0,Math.pow(y.y/v.y,n.zoomSpeed)),R(x.y),v.copy(y)}function B(e){!1!==n.enabled&&(0===_.length&&(n.domElement.setPointerCapture(e.pointerId),n.domElement.addEventListener("pointermove",H),n.domElement.addEventListener("pointerup",G)),_.push(e),"touch"===e.pointerType?function(e){switch(Z(e),_.length){case 1:switch(n.touches.ONE){case L.ROTATE:if(!1===n.enableRotate)return;D(),i=r.TOUCH_ROTATE;break;case L.PAN:if(!1===n.enablePan)return;k(),i=r.TOUCH_PAN;break;default:i=r.NONE}break;case 2:switch(n.touches.TWO){case L.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&O(),n.enablePan&&k(),i=r.TOUCH_DOLLY_PAN;break;case L.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&O(),n.enableRotate&&D(),i=r.TOUCH_DOLLY_ROTATE;break;default:i=r.NONE}break;default:i=r.NONE}i!==r.NONE&&n.dispatchEvent(dF)}(e):function(e){let t;switch(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 C.DOLLY:if(!1===n.enableZoom)return;v.set(e.clientX,e.clientY),i=r.DOLLY;break;case C.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;N(e),i=r.PAN}else{if(!1===n.enableRotate)return;I(e),i=r.ROTATE}break;case C.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;I(e),i=r.ROTATE}else{if(!1===n.enablePan)return;N(e),i=r.PAN}break;default:i=r.NONE}i!==r.NONE&&n.dispatchEvent(dF)}(e))}function H(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(Z(e),i){case r.TOUCH_ROTATE:if(!1===n.enableRotate)return;z(e),n.update();break;case r.TOUCH_PAN:if(!1===n.enablePan)return;F(e),n.update();break;case r.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&U(e),n.enablePan&&F(e),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&U(e),n.enableRotate&&z(e),n.update();break;default:i=r.NONE}}(e):function(e){switch(i){case r.ROTATE:if(!1===n.enableRotate)return;!function(e){d.set(e.clientX,e.clientY),p.subVectors(d,h).multiplyScalar(n.rotateSpeed);let t=n.domElement;S(2*Math.PI*p.x/t.clientHeight),M(2*Math.PI*p.y/t.clientHeight),h.copy(d),n.update()}(e);break;case r.DOLLY:if(!1===n.enableZoom)return;y.set(e.clientX,e.clientY),x.subVectors(y,v),x.y>0?R(w()):x.y<0&&P(w()),v.copy(y),n.update();break;case r.PAN:if(!1===n.enablePan)return;m.set(e.clientX,e.clientY),g.subVectors(m,f).multiplyScalar(n.panSpeed),A(g.x,g.y),f.copy(m),n.update()}}(e))}function G(e){X(e),0===_.length&&(n.domElement.releasePointerCapture(e.pointerId),n.domElement.removeEventListener("pointermove",H),n.domElement.removeEventListener("pointerup",G)),n.dispatchEvent(dU),i=r.NONE}function V(e){X(e)}function W(e){!1!==n.enabled&&!1!==n.enableZoom&&i===r.NONE&&(e.preventDefault(),n.dispatchEvent(dF),e.deltaY<0?P(w()):e.deltaY>0&&R(w()),n.update(),n.dispatchEvent(dU))}function j(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?M(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):A(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?M(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):A(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?S(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):A(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?S(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):A(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function q(e){!1!==n.enabled&&e.preventDefault()}function X(e){delete b[e.pointerId];for(let t=0;t<_.length;t++)if(_[t].pointerId==e.pointerId){_.splice(t,1);return}}function Z(e){let t=b[e.pointerId];void 0===t&&(t=new Y,b[e.pointerId]=t),t.set(e.pageX,e.pageY)}function J(e){let t=e.pointerId===_[0].pointerId?_[1]:_[0];return b[t.pointerId]}n.domElement.addEventListener("contextmenu",q),n.domElement.addEventListener("pointerdown",B),n.domElement.addEventListener("pointercancel",V),n.domElement.addEventListener("wheel",W,{passive:!1}),this.update()}}});var dB=function(e){var t=ul(),n=t.camera,r=t.gl.domElement,i=(0,M.useRef)();return uu(function(){return i.current.update()}),(0,M.useEffect)(function(){i.current.target=new ew(e.look_at[0],e.look_at[1],e.look_at[2])},[e.look_at]),M.createElement("orbitControls",{ref:i,args:[n,r]})};tp.DEFAULT_UP=new ew(0,0,1);var dH=function(e){return M.createElement("group",null,e.meshes.map(function(e,t){return M.createElement(dO,E({key:t},e))}))},dG=M.forwardRef(function(e,t){return M.createElement("group",{ref:t},e.meshes.map(function(e,t){return M.createElement(dH,{key:t,meshes:e})}))}),dV=function(e){var t=(0,M.useState)(!1),n=t[0],r=t[1],i=(0,M.useState)(0),a=i[0],s=i[1],o=(0,M.useRef)(),l=(0,M.useRef)(null),u=(0,M.useState)([]),c=u[0],h=u[1],d=(0,M.useState)(!1),p=d[0],f=d[1],m=(0,M.useReducer)(u9,{formData:{},formElements:[]}),g=m[0],v=m[1],y=(0,M.useState)([.2,1.2,.7]),x=y[0],_=y[1],b=(0,M.useState)([0,0,.2]),w=b[0],S=b[1],T=(0,M.useState)({screenshot:!1,startRecord:!1,stopRecord:!1,isRecording:!1,shouldCapture:!1,ext:"png",filename:"swift_recording",snap_filename:"swift_snap",format:"",framerate:40,setStates:function(e){L(E({},e))}}),C=T[0],L=T[1];(0,M.useEffect)(function(){var t,n,i,a,s=!0;r(!0);var o=e.port,u=window.location.search.substring(1).split("&");if(console.log(u),0===o&&(o=parseInt(u[0])),null===o&&(s=!1),12345==o)console.log("Hello World"),t=void 0,n=void 0,i=void 0,a=function(){var e,t,n,r,i;return function(e,t){var n,r,i,a,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(l){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}}(e.messages),a.label=3;case 3:return[4,t.next()];case 4:if((n=a.sent()).done)return[3,6];console.log(n.value.data),e.send({data:2}),a.label=5;case 5:return[3,3];case 6:return[3,13];case 7:return r={error:a.sent()},[3,13];case 8:if(a.trys.push([8,,11,12]),!(n&&!n.done&&(i=t.return)))return[3,10];return[4,i.call(t)];case 9:a.sent(),a.label=10;case 10:return[3,12];case 11:if(r)throw r.error;return[7];case 12:return[7];case 13:return console.log("I think it's closed"),[2]}})},new(i||(i=Promise))(function(e,r){function s(e){try{l(a.next(e))}catch(e){r(e)}}function o(e){try{l(a.throw(e))}catch(e){r(e)}}function l(t){var n;t.done?e(t.value):((n=t.value)instanceof i?n:new i(function(e){e(n)})).then(s,o)}l((a=a.apply(t,n||[])).next())});else{var c="ws://localhost:"+o+"/";s&&(l.current=new WebSocket(c),l.current.onopen=function(){l.current.onclose=function(){setTimeout(function(){window.close()},5e3)},l.current.send("Connected"),f(!0)},cm.on("wsSwiftTx",function(e){console.log(e),l.current.send(e)}))}l.current&&(l.current.onmessage=function(e){var t=JSON.parse(e.data),n=t[0],r=t[1];cm.emit("wsRx",n,r)})},[]),(0,M.useEffect)(function(){cm.removeAllListeners("wsRx"),cm.on("wsRx",function(e,t){console.log(e),R[e](t)})},[c,g]);var R={shape_update:function(e){var t=e[0],n=e[1];console.log(n);var r=A(c);console.log(r[t]),r[t]=[n],h(r),cm.emit("wsSwiftTx",e[0])},shape_mounted:function(e){var t=e[0],n=e[1];try{var r=0;o.current.children[t].children.forEach(function(e,t){"loaded"===e.name&&r++}),r===n?cm.emit("wsSwiftTx","1"):cm.emit("wsSwiftTx","0")}catch(e){cm.emit("wsSwiftTx","0")}},shape:function(e){var t=c.length.toString();h(A(c,[e])),cm.emit("wsSwiftTx",t)},remove:function(e){var t=A(c);t[e]=[],h(t),cm.emit("wsSwiftTx","0")},shape_poses:function(e){0!==Object.keys(g.formData).length?(cm.emit("wsSwiftTx",JSON.stringify(g.formData)),v({type:"reset",indices:Object.keys(g.formData)})):cm.emit("wsSwiftTx","[]"),e.forEach(function(e){var t=e[0];e[1].forEach(function(e,n){o.current.children[t].children[n].position.set(e.t[0],e.t[1],e.t[2]);var r=new eb(e.q[0],e.q[1],e.q[2],e.q[3]);o.current.children[t].children[n].setRotationFromQuaternion(r)})}),L(E(E({},C),{shouldCapture:!0}))},sim_time:function(e){s(parseFloat(e))},close:function(e){l.current.close(),window.close()},element:function(e){v({type:"newElement",data:e}),cm.emit("wsSwiftTx","0")},update_element:function(e){v({type:"wsUpdate",index:e.id,data:e})},camera_pose:function(e){_(e.t),S(e.look_at)},start_recording:function(e){L(E(E({},C),{format:e[2],framerate:e[0],filename:e[1],startRecord:!0})),cm.emit("wsSwiftTx","0")},stop_recording:function(e){L(E(E({},C),{stopRecord:!0})),cm.emit("wsSwiftTx","0")},screenshot:function(e){L(E(E({},C),{screenshot:!0,snap_filename:e[0]})),cm.emit("wsSwiftTx","0")}};return M.createElement("div",{className:u7.swiftContainer},M.createElement(uX.Provider,{value:v},M.createElement(uQ,{time:a,connected:p,screenshot:function(){return L(E(E({},C),{screenshot:!0}))}}),M.createElement(u8,{elements:g.formElements})),M.createElement(uG,{gl:{antialias:!0,preserveDrawingBuffer:!0},id:"threeCanvas"},M.createElement(uq,E({},C)),M.createElement(dR,{t:x}),n&&M.createElement(M.Suspense,{fallback:null},M.createElement(dB,{look_at:w})),M.createElement("hemisphereLight",{groundColor:new eh(1118498)}),M.createElement(dL,{x:10,y:10,z:10,color:16777215,intensity:.2}),M.createElement(dL,{x:-10,y:-10,z:10,color:16777215,intensity:.2}),M.createElement(dC,null),M.createElement("axesHelper",{args:[100]}),M.createElement(dG,{meshes:c,ref:o})))};let dW=()=>(0,x.jsxs)("div",{className:S().container,children:[(0,x.jsxs)(b(),{children:[(0,x.jsx)("title",{children:"Swift"}),(0,x.jsx)("link",{rel:"icon",href:"/favicon.ico"}),(0,x.jsx)("meta",{"http-equiv":"cache-control",content:"no-cache"}),(0,x.jsx)("meta",{"http-equiv":"expires",content:"0"}),(0,x.jsx)("meta",{"http-equiv":"pragma",content:"no-cache"})]}),(0,x.jsx)("main",{className:S().main,children:(0,x.jsx)("div",{className:S().container,children:(0,x.jsx)(dV,{port:0})})})]});var dj=dW},8122:function(e){e.exports={container:"Home_container__bCOhY",main:"Home_main__nLjiQ"}},9008:function(e,t,n){e.exports=n(5443)}},function(e){e.O(0,[774,888,179],function(){return e(e.s=8312)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/swift/out/index.html b/swift/out/index.html index ad0b303..3f3cc4d 100644 --- a/swift/out/index.html +++ b/swift/out/index.html @@ -1 +1 @@ -Swift
00:00.000
\ No newline at end of file +Swift
00:00.000
\ No newline at end of file