0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,a,n,i,s){Xc.subVectors(i,a),nm.subVectors(n,a),RE.subVectors(e,a);const o=Xc.dot(Xc),l=Xc.dot(nm),c=Xc.dot(RE),d=nm.dot(nm),u=nm.dot(RE),m=o*d-l*l;if(m===0)return s.set(0,0,0),null;const p=1/m,f=(d*c-l*u)*p,g=(o*u-l*c)*p;return s.set(1-f-g,g,f)}static containsPoint(e,a,n,i){return this.getBarycoord(e,a,n,i,im)===null?!1:im.x>=0&&im.y>=0&&im.x+im.y<=1}static getInterpolation(e,a,n,i,s,o,l,c){return this.getBarycoord(e,a,n,i,im)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,im.x),c.addScaledVector(o,im.y),c.addScaledVector(l,im.z),c)}static getInterpolatedAttribute(e,a,n,i,s,o){return BE.setScalar(0),UE.setScalar(0),HE.setScalar(0),BE.fromBufferAttribute(e,a),UE.fromBufferAttribute(e,n),HE.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(BE,s.x),o.addScaledVector(UE,s.y),o.addScaledVector(HE,s.z),o}static isFrontFacing(e,a,n,i){return Xc.subVectors(n,a),nm.subVectors(e,a),Xc.cross(nm).dot(i)<0}set(e,a,n){return this.a.copy(e),this.b.copy(a),this.c.copy(n),this}setFromPointsAndIndices(e,a,n,i){return this.a.copy(e[a]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,a,n,i){return this.a.fromBufferAttribute(e,a),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Xc.subVectors(this.c,this.b),nm.subVectors(this.a,this.b),Xc.cross(nm).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Gx.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,a){return Gx.getBarycoord(e,this.a,this.b,this.c,a)}getInterpolation(e,a,n,i,s){return Gx.getInterpolation(e,this.a,this.b,this.c,a,n,i,s)}containsPoint(e){return Gx.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Gx.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,a){const n=this.a,i=this.b,s=this.c;let o,l;ux.subVectors(i,n),mx.subVectors(s,n),zE.subVectors(e,n);const c=ux.dot(zE),d=mx.dot(zE);if(c<=0&&d<=0)return a.copy(n);IE.subVectors(e,i);const u=ux.dot(IE),m=mx.dot(IE);if(u>=0&&m<=u)return a.copy(i);const p=c*m-u*d;if(p<=0&&c>=0&&u<=0)return o=c/(c-u),a.copy(n).addScaledVector(ux,o);OE.subVectors(e,s);const f=ux.dot(OE),g=mx.dot(OE);if(g>=0&&f<=g)return a.copy(s);const v=f*d-c*g;if(v<=0&&d>=0&&g<=0)return l=d/(d-g),a.copy(n).addScaledVector(mx,l);const b=u*g-f*m;if(b<=0&&m-u>=0&&f-g>=0)return d6.subVectors(s,i),l=(m-u)/(m-u+(f-g)),a.copy(i).addScaledVector(d6,l);const x=1/(b+v+p);return o=v*x,l=p*x,a.copy(n).addScaledVector(ux,o).addScaledVector(mx,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const YJ={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},Qp={h:0,s:0,l:0},G_={h:0,s:0,l:0};function qE(t,e,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?t+(e-t)*6*a:a<1/2?e:a<2/3?t+(e-t)*6*(2/3-a):t}let hr=class{constructor(e,a,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,a,n)}set(e,a,n){if(a===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,a,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,a=vl){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ir.colorSpaceToWorking(this,a),this}setRGB(e,a,n,i=Ir.workingColorSpace){return this.r=e,this.g=a,this.b=n,Ir.colorSpaceToWorking(this,i),this}setHSL(e,a,n,i=Ir.workingColorSpace){if(e=Uwe(e,1),a=kr(a,0,1),n=kr(n,0,1),a===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+a):n+a-n*a,o=2*n-s;this.r=qE(o,s,e+1/3),this.g=qE(o,s,e),this.b=qE(o,s,e-1/3)}return Ir.colorSpaceToWorking(this,i),this}setStyle(e,a=vl){function n(s){s!==void 0&&parseFloat(s)<1&&$a("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],l=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,a);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,a);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,a);break;default:$a("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,a);if(o===6)return this.setHex(parseInt(s,16),a);$a("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,a);return this}setColorName(e,a=vl){const n=YJ[e.toLowerCase()];return n!==void 0?this.setHex(n,a):$a("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=Hm(e.r),this.g=Hm(e.g),this.b=Hm(e.b),this}copyLinearToSRGB(e){return this.r=dy(e.r),this.g=dy(e.g),this.b=dy(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=vl){return Ir.workingToColorSpace(Gs.copy(this),e),Math.round(kr(Gs.r*255,0,255))*65536+Math.round(kr(Gs.g*255,0,255))*256+Math.round(kr(Gs.b*255,0,255))}getHexString(e=vl){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,a=Ir.workingColorSpace){Ir.workingToColorSpace(Gs.copy(this),a);const n=Gs.r,i=Gs.g,s=Gs.b,o=Math.max(n,i,s),l=Math.min(n,i,s);let c,d;const u=(l+o)/2;if(l===o)c=0,d=0;else{const m=o-l;switch(d=u<=.5?m/(o+l):m/(2-o-l),o){case n:c=(i-s)/m+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const a in e){const n=e[a];if(n===void 0){$a(`Material: parameter '${a}' has value of undefined.`);continue}const i=this[a];if(i===void 0){$a(`Material: '${a}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[a]=n}}toJSON(e){const a=e===void 0||typeof e=="string";a&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(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.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==cy&&(n.blending=this.blending),this.side!==Jh&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==x3&&(n.blendSrc=this.blendSrc),this.blendDst!==y3&&(n.blendDst=this.blendDst),this.blendEquation!==ng&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==_y&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Y8&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==rx&&(n.stencilFail=this.stencilFail),this.stencilZFail!==rx&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==rx&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const l in s){const c=s[l];delete c.metadata,o.push(c)}return o}if(a){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const a=e.clippingPlanes;let n=null;if(a!==null){const i=a.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=a[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},sO=class extends iv{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new hr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ef,this.combine=QI,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};const Ai=new Ft,$_=new lr;let rSe=0,wo=class{constructor(e,a,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:rSe++}),this.name="",this.array=e,this.itemSize=a,this.count=e!==void 0?e.length/a:0,this.normalized=n,this.usage=Q8,this.updateRanges=[],this.gpuType=Am,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,a){this.updateRanges.push({start:e,count:a})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,a,n){e*=this.itemSize,n*=a.itemSize;for(let i=0,s=this.itemSize;ia.count&&$a("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),a.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Uh);const e=this.attributes.position,a=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){xi("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Ft(-1/0,-1/0,-1/0),new Ft(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),a)for(let n=0,i=a.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const d in c)c[d]!==void 0&&(e[d]=c[d]);return e}e.data={attributes:{}};const a=this.index;a!==null&&(e.data.index={type:a.array.constructor.name,array:Array.prototype.slice.call(a.array)});const n=this.attributes;for(const c in n){const d=n[c];e.data.attributes[c]=d.toJSON(e.data)}const i={};let s=!1;for(const c in this.morphAttributes){const d=this.morphAttributes[c],u=[];for(let m=0,p=d.length;m0&&(i[c]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere=l.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const a={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const d in i){const u=i[d];this.setAttribute(d,u.clone(a))}const s=e.morphAttributes;for(const d in s){const u=[],m=s[d];for(let p=0,f=m.length;p0){const i=a[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(u6.copy(s).invert(),Uf.copy(e.ray).applyMatrix4(u6),!(n.boundingBox!==null&&Uf.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,a,Uf)))}_computeIntersections(e,a,n){let i;const s=this.geometry,o=this.material,l=s.index,c=s.attributes.position,d=s.attributes.uv,u=s.attributes.uv1,m=s.attributes.normal,p=s.groups,f=s.drawRange;if(l!==null)if(Array.isArray(o))for(let g=0,v=p.length;ga.far?null:{distance:d,point:Z_.clone(),object:t}}function J_(t,e,a,n,i,s,o,l,c,d){t.getVertexPosition(l,K_),t.getVertexPosition(c,Y_),t.getVertexPosition(d,Q_);const u=iSe(t,e,a,n,K_,Y_,Q_,p6);if(u){const m=new Ft;p0.getBarycoord(p6,K_,Y_,Q_,m),i&&(u.uv=p0.getInterpolatedAttribute(i,l,c,d,m,new lr)),s&&(u.uv1=p0.getInterpolatedAttribute(s,l,c,d,m,new lr)),o&&(u.normal=p0.getInterpolatedAttribute(o,l,c,d,m,new Ft),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const p={a:l,b:c,c:d,normal:new Ft,materialIndex:0};p0.getNormal(K_,Y_,Q_,p.normal),u.face=p,u.barycoord=m}return u}let oO=class JJ extends Ac{constructor(e=1,a=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:a,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const l=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const c=[],d=[],u=[],m=[];let p=0,f=0;g("z","y","x",-1,-1,n,a,e,o,s,0),g("z","y","x",1,-1,n,a,-e,o,s,1),g("x","z","y",1,1,e,n,a,i,o,2),g("x","z","y",1,-1,e,n,-a,i,o,3),g("x","y","z",1,-1,e,a,n,i,s,4),g("x","y","z",-1,-1,e,a,-n,i,s,5),this.setIndex(c),this.setAttribute("position",new Cl(d,3)),this.setAttribute("normal",new Cl(u,3)),this.setAttribute("uv",new Cl(m,2));function g(v,b,x,S,k,C,N,T,j,D,P){const E=C/j,z=N/D,I=C/2,O=N/2,R=T/2,K=j+1,Z=D+1;let X=0,ce=0;const de=new Ft;for(let oe=0;oe0?1:-1,u.push(de.x,de.y,de.z),m.push(ne/j),m.push(1-oe/D),X+=1}}for(let oe=0;oe to .`)}let p=vd(),f;if(e){let S=typeof e=="string"?Qy(e):e;Bn(u==="/"||S.pathname?.startsWith(u),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${S.pathname}" was given in the \`location\` prop.`),f=S}else f=p;let g=f.pathname||"/",v=g;if(u!=="/"){let S=u.replace(/^\//,"").split("/");v="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let b=yZ(t,{pathname:v});Nc(m||b!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),Nc(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let x=whe(b&&b.map(S=>Object.assign({},S,{params:Object.assign({},c,S.params),pathname:Im([u,s.encodeLocation?s.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?u:Im([u,s.encodeLocation?s.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),o,a,n,i);return e&&x?y.createElement(MS.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...f},navigationType:"POP"}},x):x}function bhe(){let t=Che(),e=rhe(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,n="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:n},s={padding:"2px 4px",backgroundColor:n},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:s},"ErrorBoundary")," or"," ",y.createElement("code",{style:s},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),a?y.createElement("pre",{style:i},a):null,o)}var xhe=y.createElement(bhe,null),MZ=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const a=mhe(t.digest);a&&(t=a)}let e=t!==void 0?y.createElement(Rc.Provider,{value:this.props.routeContext},y.createElement(SI.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(yhe,{error:t},e):e}};MZ.contextType=she;var bE=new WeakMap;function yhe({children:t,error:e}){let{basename:a}=y.useContext(Fl);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let n=uhe(e.digest);if(n){let i=bE.get(e);if(i)throw i;let s=kZ(n.location,a);if(SZ&&!bE.get(e))if(s.isExternal||n.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:n.replace}));throw bE.set(e,o),o}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function vhe({routeContext:t,match:e,children:a}){let n=y.useContext(Xy);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),y.createElement(Rc.Provider,{value:t},a)}function whe(t,e=[],a=null,n=null,i=null){if(t==null){if(!a)return null;if(a.errors)t=a.matches;else if(e.length===0&&!a.initialized&&a.matches.length>0)t=a.matches;else return null}let s=t,o=a?.errors;if(o!=null){let u=s.findIndex(m=>m.route.id&&o?.[m.route.id]!==void 0);Bn(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,u+1))}let l=!1,c=-1;if(a)for(let u=0;u=0?s=s.slice(0,c+1):s=[s[0]];break}}}let d=a&&n?(u,m)=>{n(u,{location:a.location,params:a.matches?.[0]?.params??{},unstable_pattern:nhe(a.matches),errorInfo:m})}:void 0;return s.reduceRight((u,m,p)=>{let f,g=!1,v=null,b=null;a&&(f=o&&m.route.id?o[m.route.id]:void 0,v=m.route.errorElement||xhe,l&&(c<0&&p===0?(EZ("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,b=null):c===p&&(g=!0,b=m.route.hydrateFallbackElement||null)));let x=e.concat(s.slice(0,p+1)),S=()=>{let k;return f?k=v:g?k=b:m.route.Component?k=y.createElement(m.route.Component,null):m.route.element?k=m.route.element:k=u,y.createElement(vhe,{match:m,routeContext:{outlet:u,matches:x,isDataRoute:a!=null},children:k})};return a&&(m.route.ErrorBoundary||m.route.errorElement||p===0)?y.createElement(MZ,{location:a.location,revalidation:a.revalidation,component:v,error:f,children:S(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:d}):S()},null)}function kI(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function She(t){let e=y.useContext(Xy);return Bn(e,kI(t)),e}function khe(t){let e=y.useContext(TT);return Bn(e,kI(t)),e}function _he(t){let e=y.useContext(Rc);return Bn(e,kI(t)),e}function _I(t){let e=_he(t),a=e.matches[e.matches.length-1];return Bn(a.route.id,`${t} can only be used on routes that contain a unique "id"`),a.route.id}function Phe(){return _I("useRouteId")}function Che(){let t=y.useContext(SI),e=khe("useRouteError"),a=_I("useRouteError");return t!==void 0?t:e.errors?.[a]}function Nhe(){let{router:t}=She("useNavigate"),e=_I("useNavigate"),a=y.useRef(!1);return TZ(()=>{a.current=!0}),y.useCallback(async(i,s={})=>{Nc(a.current,NZ),a.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var f8={};function EZ(t,e,a){!e&&!f8[t]&&(f8[t]=!0,Nc(!1,a))}y.memo(The);function The({routes:t,future:e,state:a,onError:n}){return jZ(t,void 0,a,n,e)}function wg({to:t,replace:e,state:a,relative:n}){Bn(Zy()," may be used only in the context of a component.");let{static:i}=y.useContext(Fl);Nc(!i," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:s}=y.useContext(Rc),{pathname:o}=vd(),l=Ii(),c=wI(t,vI(s),o,n==="path"),d=JSON.stringify(c);return y.useEffect(()=>{l(JSON.parse(d),{replace:e,state:a,relative:n})},[l,d,n,e,a]),null}function DZ(t){return fhe(t.context)}function jr(t){Bn(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function Ahe({basename:t="/",children:e=null,location:a,navigationType:n="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){Bn(!Zy(),"You cannot render a inside another . You should never have more than one in your app.");let l=t.replace(/^\/*/,"/"),c=y.useMemo(()=>({basename:l,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[l,i,s,o]);typeof a=="string"&&(a=Qy(a));let{pathname:d="/",search:u="",hash:m="",state:p=null,key:f="default"}=a,g=y.useMemo(()=>{let v=Ym(d,l);return v==null?null:{location:{pathname:v,search:u,hash:m,state:p,key:f},navigationType:n}},[l,d,u,m,p,f,n]);return Nc(g!=null,` is not able to match the URL "${d}${u}${m}" because it does not start with the basename, so the won't render anything.`),g==null?null:y.createElement(Fl.Provider,{value:c},y.createElement(MS.Provider,{children:e,value:g}))}function jhe({children:t,location:e}){return ghe(KL(t),e)}function KL(t,e=[]){let a=[];return y.Children.forEach(t,(n,i)=>{if(!y.isValidElement(n))return;let s=[...e,i];if(n.type===y.Fragment){a.push.apply(a,KL(n.props.children,s));return}Bn(n.type===jr,`[${typeof n.type=="string"?n.type:n.type.name}] is not a component. All component children of must be a or `),Bn(!n.props.index||!n.props.children,"An index route cannot have child routes.");let o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=KL(n.props.children,s)),a.push(o)}),a}var CC="get",NC="application/x-www-form-urlencoded";function AT(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function Mhe(t){return AT(t)&&t.tagName.toLowerCase()==="button"}function Ehe(t){return AT(t)&&t.tagName.toLowerCase()==="form"}function Dhe(t){return AT(t)&&t.tagName.toLowerCase()==="input"}function Fhe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Lhe(t,e){return t.button===0&&(!e||e==="_self")&&!Fhe(t)}function YL(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,a)=>{let n=t[a];return e.concat(Array.isArray(n)?n.map(i=>[a,i]):[[a,n]])},[]))}function Rhe(t,e){let a=YL(t);return e&&e.forEach((n,i)=>{a.has(i)||e.getAll(i).forEach(s=>{a.append(i,s)})}),a}var F_=null;function zhe(){if(F_===null)try{new FormData(document.createElement("form"),0),F_=!1}catch{F_=!0}return F_}var Ihe=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function xE(t){return t!=null&&!Ihe.has(t)?(Nc(!1,`"${t}" is not a valid \`encType\` for \`