@epigraph/configurator 2.1.0-alpha → 2.1.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3933,12 +3933,12 @@ void main() {
|
|
|
3933
3933
|
|
|
3934
3934
|
}
|
|
3935
3935
|
|
|
3936
|
-
}`;class WebXRDepthSensing{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(_e,Dt,Vt){if(this.texture===null){const Gt=new Texture,zt=_e.properties.get(Gt);zt.__webglTexture=Dt.texture,(Dt.depthNear!=Vt.depthNear||Dt.depthFar!=Vt.depthFar)&&(this.depthNear=Dt.depthNear,this.depthFar=Dt.depthFar),this.texture=Gt}}render(_e,Dt){if(this.texture!==null){if(this.mesh===null){const Vt=Dt.cameras[0].viewport,Gt=new ShaderMaterial({vertexShader:_occlusion_vertex,fragmentShader:_occlusion_fragment,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Vt.z},depthHeight:{value:Vt.w}}});this.mesh=new Mesh(new PlaneGeometry(20,20),Gt)}_e.render(this.mesh,Dt)}}reset(){this.texture=null,this.mesh=null}}class WebXRManager extends EventDispatcher$2{constructor(_e,Dt){super();const Vt=this;let Gt=null,zt=1,jt=null,Ht="local-floor",Wt=1,qt=null,Xt=null,Kt=null,Yt=null,Zt=null,Jt=null;const nn=new WebXRDepthSensing,rn=Dt.getContextAttributes();let Qt=null,en=null;const tn=[],sn=[],cn=new Vector2;let un=null;const hn=new PerspectiveCamera;hn.layers.enable(1),hn.viewport=new Vector4;const fn=new PerspectiveCamera;fn.layers.enable(2),fn.viewport=new Vector4;const pn=[hn,fn],dn=new ArrayCamera;dn.layers.enable(1),dn.layers.enable(2);let mn=null,vn=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Nn){let Fn=tn[Nn];return Fn===void 0&&(Fn=new WebXRController,tn[Nn]=Fn),Fn.getTargetRaySpace()},this.getControllerGrip=function(Nn){let Fn=tn[Nn];return Fn===void 0&&(Fn=new WebXRController,tn[Nn]=Fn),Fn.getGripSpace()},this.getHand=function(Nn){let Fn=tn[Nn];return Fn===void 0&&(Fn=new WebXRController,tn[Nn]=Fn),Fn.getHandSpace()};function _n(Nn){const Fn=sn.indexOf(Nn.inputSource);if(Fn===-1)return;const Pn=tn[Fn];Pn!==void 0&&(Pn.update(Nn.inputSource,Nn.frame,qt||jt),Pn.dispatchEvent({type:Nn.type,data:Nn.inputSource}))}function En(){Gt.removeEventListener("select",_n),Gt.removeEventListener("selectstart",_n),Gt.removeEventListener("selectend",_n),Gt.removeEventListener("squeeze",_n),Gt.removeEventListener("squeezestart",_n),Gt.removeEventListener("squeezeend",_n),Gt.removeEventListener("end",En),Gt.removeEventListener("inputsourceschange",An);for(let Nn=0;Nn<tn.length;Nn++){const Fn=sn[Nn];Fn!==null&&(sn[Nn]=null,tn[Nn].disconnect(Fn))}mn=null,vn=null,nn.reset(),_e.setRenderTarget(Qt),Zt=null,Yt=null,Kt=null,Gt=null,en=null,Ln.stop(),Vt.isPresenting=!1,_e.setPixelRatio(un),_e.setSize(cn.width,cn.height,!1),Vt.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Nn){zt=Nn,Vt.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Nn){Ht=Nn,Vt.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return qt||jt},this.setReferenceSpace=function(Nn){qt=Nn},this.getBaseLayer=function(){return Yt!==null?Yt:Zt},this.getBinding=function(){return Kt},this.getFrame=function(){return Jt},this.getSession=function(){return Gt},this.setSession=async function(Nn){if(Gt=Nn,Gt!==null){if(Qt=_e.getRenderTarget(),Gt.addEventListener("select",_n),Gt.addEventListener("selectstart",_n),Gt.addEventListener("selectend",_n),Gt.addEventListener("squeeze",_n),Gt.addEventListener("squeezestart",_n),Gt.addEventListener("squeezeend",_n),Gt.addEventListener("end",En),Gt.addEventListener("inputsourceschange",An),rn.xrCompatible!==!0&&await Dt.makeXRCompatible(),un=_e.getPixelRatio(),_e.getSize(cn),Gt.renderState.layers===void 0){const Fn={antialias:rn.antialias,alpha:!0,depth:rn.depth,stencil:rn.stencil,framebufferScaleFactor:zt};Zt=new XRWebGLLayer(Gt,Dt,Fn),Gt.updateRenderState({baseLayer:Zt}),_e.setPixelRatio(1),_e.setSize(Zt.framebufferWidth,Zt.framebufferHeight,!1),en=new WebGLRenderTarget(Zt.framebufferWidth,Zt.framebufferHeight,{format:RGBAFormat,type:UnsignedByteType,colorSpace:_e.outputColorSpace,stencilBuffer:rn.stencil})}else{let Fn=null,Pn=null,Bn=null;rn.depth&&(Bn=rn.stencil?Dt.DEPTH24_STENCIL8:Dt.DEPTH_COMPONENT24,Fn=rn.stencil?DepthStencilFormat:DepthFormat,Pn=rn.stencil?UnsignedInt248Type:UnsignedIntType);const Hn={colorFormat:Dt.RGBA8,depthFormat:Bn,scaleFactor:zt};Kt=new XRWebGLBinding(Gt,Dt),Yt=Kt.createProjectionLayer(Hn),Gt.updateRenderState({layers:[Yt]}),_e.setPixelRatio(1),_e.setSize(Yt.textureWidth,Yt.textureHeight,!1),en=new WebGLRenderTarget(Yt.textureWidth,Yt.textureHeight,{format:RGBAFormat,type:UnsignedByteType,depthTexture:new DepthTexture(Yt.textureWidth,Yt.textureHeight,Pn,void 0,void 0,void 0,void 0,void 0,void 0,Fn),stencilBuffer:rn.stencil,colorSpace:_e.outputColorSpace,samples:rn.antialias?4:0});const qn=_e.properties.get(en);qn.__ignoreDepthValues=Yt.ignoreDepthValues}en.isXRRenderTarget=!0,this.setFoveation(Wt),qt=null,jt=await Gt.requestReferenceSpace(Ht),Ln.setContext(Gt),Ln.start(),Vt.isPresenting=!0,Vt.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Gt!==null)return Gt.environmentBlendMode};function An(Nn){for(let Fn=0;Fn<Nn.removed.length;Fn++){const Pn=Nn.removed[Fn],Bn=sn.indexOf(Pn);Bn>=0&&(sn[Bn]=null,tn[Bn].disconnect(Pn))}for(let Fn=0;Fn<Nn.added.length;Fn++){const Pn=Nn.added[Fn];let Bn=sn.indexOf(Pn);if(Bn===-1){for(let qn=0;qn<tn.length;qn++)if(qn>=sn.length){sn.push(Pn),Bn=qn;break}else if(sn[qn]===null){sn[qn]=Pn,Bn=qn;break}if(Bn===-1)break}const Hn=tn[Bn];Hn&&Hn.connect(Pn)}}const Tn=new Vector3,Cn=new Vector3;function yn(Nn,Fn,Pn){Tn.setFromMatrixPosition(Fn.matrixWorld),Cn.setFromMatrixPosition(Pn.matrixWorld);const Bn=Tn.distanceTo(Cn),Hn=Fn.projectionMatrix.elements,qn=Pn.projectionMatrix.elements,ar=Hn[14]/(Hn[10]-1),zn=Hn[14]/(Hn[10]+1),ur=(Hn[9]+1)/Hn[5],Wn=(Hn[9]-1)/Hn[5],or=(Hn[8]-1)/Hn[0],gr=(qn[8]+1)/qn[0],fr=ar*or,Un=ar*gr,In=Bn/(-or+gr),jn=In*-or;Fn.matrixWorld.decompose(Nn.position,Nn.quaternion,Nn.scale),Nn.translateX(jn),Nn.translateZ(In),Nn.matrixWorld.compose(Nn.position,Nn.quaternion,Nn.scale),Nn.matrixWorldInverse.copy(Nn.matrixWorld).invert();const er=ar+In,cr=zn+In,lr=fr-jn,Mr=Un+(Bn-jn),mr=ur*zn/cr*er,wr=Wn*zn/cr*er;Nn.projectionMatrix.makePerspective(lr,Mr,mr,wr,er,cr),Nn.projectionMatrixInverse.copy(Nn.projectionMatrix).invert()}function Sn(Nn,Fn){Fn===null?Nn.matrixWorld.copy(Nn.matrix):Nn.matrixWorld.multiplyMatrices(Fn.matrixWorld,Nn.matrix),Nn.matrixWorldInverse.copy(Nn.matrixWorld).invert()}this.updateCamera=function(Nn){if(Gt===null)return;nn.texture!==null&&(Nn.near=nn.depthNear,Nn.far=nn.depthFar),dn.near=fn.near=hn.near=Nn.near,dn.far=fn.far=hn.far=Nn.far,(mn!==dn.near||vn!==dn.far)&&(Gt.updateRenderState({depthNear:dn.near,depthFar:dn.far}),mn=dn.near,vn=dn.far,hn.near=mn,hn.far=vn,fn.near=mn,fn.far=vn,hn.updateProjectionMatrix(),fn.updateProjectionMatrix(),Nn.updateProjectionMatrix());const Fn=Nn.parent,Pn=dn.cameras;Sn(dn,Fn);for(let Bn=0;Bn<Pn.length;Bn++)Sn(Pn[Bn],Fn);Pn.length===2?yn(dn,hn,fn):dn.projectionMatrix.copy(hn.projectionMatrix),wn(Nn,dn,Fn)};function wn(Nn,Fn,Pn){Pn===null?Nn.matrix.copy(Fn.matrixWorld):(Nn.matrix.copy(Pn.matrixWorld),Nn.matrix.invert(),Nn.matrix.multiply(Fn.matrixWorld)),Nn.matrix.decompose(Nn.position,Nn.quaternion,Nn.scale),Nn.updateMatrixWorld(!0),Nn.projectionMatrix.copy(Fn.projectionMatrix),Nn.projectionMatrixInverse.copy(Fn.projectionMatrixInverse),Nn.isPerspectiveCamera&&(Nn.fov=RAD2DEG*2*Math.atan(1/Nn.projectionMatrix.elements[5]),Nn.zoom=1)}this.getCamera=function(){return dn},this.getFoveation=function(){if(!(Yt===null&&Zt===null))return Wt},this.setFoveation=function(Nn){Wt=Nn,Yt!==null&&(Yt.fixedFoveation=Nn),Zt!==null&&Zt.fixedFoveation!==void 0&&(Zt.fixedFoveation=Nn)},this.hasDepthSensing=function(){return nn.texture!==null};let xn=null;function Rn(Nn,Fn){if(Xt=Fn.getViewerPose(qt||jt),Jt=Fn,Xt!==null){const Pn=Xt.views;Zt!==null&&(_e.setRenderTargetFramebuffer(en,Zt.framebuffer),_e.setRenderTarget(en));let Bn=!1;Pn.length!==dn.cameras.length&&(dn.cameras.length=0,Bn=!0);for(let qn=0;qn<Pn.length;qn++){const ar=Pn[qn];let zn=null;if(Zt!==null)zn=Zt.getViewport(ar);else{const Wn=Kt.getViewSubImage(Yt,ar);zn=Wn.viewport,qn===0&&(_e.setRenderTargetTextures(en,Wn.colorTexture,Yt.ignoreDepthValues?void 0:Wn.depthStencilTexture),_e.setRenderTarget(en))}let ur=pn[qn];ur===void 0&&(ur=new PerspectiveCamera,ur.layers.enable(qn),ur.viewport=new Vector4,pn[qn]=ur),ur.matrix.fromArray(ar.transform.matrix),ur.matrix.decompose(ur.position,ur.quaternion,ur.scale),ur.projectionMatrix.fromArray(ar.projectionMatrix),ur.projectionMatrixInverse.copy(ur.projectionMatrix).invert(),ur.viewport.set(zn.x,zn.y,zn.width,zn.height),qn===0&&(dn.matrix.copy(ur.matrix),dn.matrix.decompose(dn.position,dn.quaternion,dn.scale)),Bn===!0&&dn.cameras.push(ur)}const Hn=Gt.enabledFeatures;if(Hn&&Hn.includes("depth-sensing")){const qn=Kt.getDepthInformation(Pn[0]);qn&&qn.isValid&&qn.texture&&nn.init(_e,qn,Gt.renderState)}}for(let Pn=0;Pn<tn.length;Pn++){const Bn=sn[Pn],Hn=tn[Pn];Bn!==null&&Hn!==void 0&&Hn.update(Bn,Fn,qt||jt)}nn.render(_e,dn),xn&&xn(Nn,Fn),Fn.detectedPlanes&&Vt.dispatchEvent({type:"planesdetected",data:Fn}),Jt=null}const Ln=new WebGLAnimation;Ln.setAnimationLoop(Rn),this.setAnimationLoop=function(Nn){xn=Nn},this.dispose=function(){}}}const _e1=new Euler,_m1=new Matrix4;function WebGLMaterials(kt,_e){function Dt(rn,Qt){rn.matrixAutoUpdate===!0&&rn.updateMatrix(),Qt.value.copy(rn.matrix)}function Vt(rn,Qt){Qt.color.getRGB(rn.fogColor.value,getUnlitUniformColorSpace(kt)),Qt.isFog?(rn.fogNear.value=Qt.near,rn.fogFar.value=Qt.far):Qt.isFogExp2&&(rn.fogDensity.value=Qt.density)}function Gt(rn,Qt,en,tn,sn){Qt.isMeshBasicMaterial||Qt.isMeshLambertMaterial?zt(rn,Qt):Qt.isMeshToonMaterial?(zt(rn,Qt),Kt(rn,Qt)):Qt.isMeshPhongMaterial?(zt(rn,Qt),Xt(rn,Qt)):Qt.isMeshStandardMaterial?(zt(rn,Qt),Yt(rn,Qt),Qt.isMeshPhysicalMaterial&&Zt(rn,Qt,sn)):Qt.isMeshMatcapMaterial?(zt(rn,Qt),Jt(rn,Qt)):Qt.isMeshDepthMaterial?zt(rn,Qt):Qt.isMeshDistanceMaterial?(zt(rn,Qt),nn(rn,Qt)):Qt.isMeshNormalMaterial?zt(rn,Qt):Qt.isLineBasicMaterial?(jt(rn,Qt),Qt.isLineDashedMaterial&&Ht(rn,Qt)):Qt.isPointsMaterial?Wt(rn,Qt,en,tn):Qt.isSpriteMaterial?qt(rn,Qt):Qt.isShadowMaterial?(rn.color.value.copy(Qt.color),rn.opacity.value=Qt.opacity):Qt.isShaderMaterial&&(Qt.uniformsNeedUpdate=!1)}function zt(rn,Qt){rn.opacity.value=Qt.opacity,Qt.color&&rn.diffuse.value.copy(Qt.color),Qt.emissive&&rn.emissive.value.copy(Qt.emissive).multiplyScalar(Qt.emissiveIntensity),Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.bumpMap&&(rn.bumpMap.value=Qt.bumpMap,Dt(Qt.bumpMap,rn.bumpMapTransform),rn.bumpScale.value=Qt.bumpScale,Qt.side===BackSide&&(rn.bumpScale.value*=-1)),Qt.normalMap&&(rn.normalMap.value=Qt.normalMap,Dt(Qt.normalMap,rn.normalMapTransform),rn.normalScale.value.copy(Qt.normalScale),Qt.side===BackSide&&rn.normalScale.value.negate()),Qt.displacementMap&&(rn.displacementMap.value=Qt.displacementMap,Dt(Qt.displacementMap,rn.displacementMapTransform),rn.displacementScale.value=Qt.displacementScale,rn.displacementBias.value=Qt.displacementBias),Qt.emissiveMap&&(rn.emissiveMap.value=Qt.emissiveMap,Dt(Qt.emissiveMap,rn.emissiveMapTransform)),Qt.specularMap&&(rn.specularMap.value=Qt.specularMap,Dt(Qt.specularMap,rn.specularMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest);const en=_e.get(Qt),tn=en.envMap,sn=en.envMapRotation;if(tn&&(rn.envMap.value=tn,_e1.copy(sn),_e1.x*=-1,_e1.y*=-1,_e1.z*=-1,tn.isCubeTexture&&tn.isRenderTargetTexture===!1&&(_e1.y*=-1,_e1.z*=-1),rn.envMapRotation.value.setFromMatrix4(_m1.makeRotationFromEuler(_e1)),rn.flipEnvMap.value=tn.isCubeTexture&&tn.isRenderTargetTexture===!1?-1:1,rn.reflectivity.value=Qt.reflectivity,rn.ior.value=Qt.ior,rn.refractionRatio.value=Qt.refractionRatio),Qt.lightMap){rn.lightMap.value=Qt.lightMap;const cn=kt._useLegacyLights===!0?Math.PI:1;rn.lightMapIntensity.value=Qt.lightMapIntensity*cn,Dt(Qt.lightMap,rn.lightMapTransform)}Qt.aoMap&&(rn.aoMap.value=Qt.aoMap,rn.aoMapIntensity.value=Qt.aoMapIntensity,Dt(Qt.aoMap,rn.aoMapTransform))}function jt(rn,Qt){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform))}function Ht(rn,Qt){rn.dashSize.value=Qt.dashSize,rn.totalSize.value=Qt.dashSize+Qt.gapSize,rn.scale.value=Qt.scale}function Wt(rn,Qt,en,tn){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,rn.size.value=Qt.size*en,rn.scale.value=tn*.5,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.uvTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest)}function qt(rn,Qt){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,rn.rotation.value=Qt.rotation,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest)}function Xt(rn,Qt){rn.specular.value.copy(Qt.specular),rn.shininess.value=Math.max(Qt.shininess,1e-4)}function Kt(rn,Qt){Qt.gradientMap&&(rn.gradientMap.value=Qt.gradientMap)}function Yt(rn,Qt){rn.metalness.value=Qt.metalness,Qt.metalnessMap&&(rn.metalnessMap.value=Qt.metalnessMap,Dt(Qt.metalnessMap,rn.metalnessMapTransform)),rn.roughness.value=Qt.roughness,Qt.roughnessMap&&(rn.roughnessMap.value=Qt.roughnessMap,Dt(Qt.roughnessMap,rn.roughnessMapTransform)),Qt.envMap&&(rn.envMapIntensity.value=Qt.envMapIntensity)}function Zt(rn,Qt,en){rn.ior.value=Qt.ior,Qt.sheen>0&&(rn.sheenColor.value.copy(Qt.sheenColor).multiplyScalar(Qt.sheen),rn.sheenRoughness.value=Qt.sheenRoughness,Qt.sheenColorMap&&(rn.sheenColorMap.value=Qt.sheenColorMap,Dt(Qt.sheenColorMap,rn.sheenColorMapTransform)),Qt.sheenRoughnessMap&&(rn.sheenRoughnessMap.value=Qt.sheenRoughnessMap,Dt(Qt.sheenRoughnessMap,rn.sheenRoughnessMapTransform))),Qt.clearcoat>0&&(rn.clearcoat.value=Qt.clearcoat,rn.clearcoatRoughness.value=Qt.clearcoatRoughness,Qt.clearcoatMap&&(rn.clearcoatMap.value=Qt.clearcoatMap,Dt(Qt.clearcoatMap,rn.clearcoatMapTransform)),Qt.clearcoatRoughnessMap&&(rn.clearcoatRoughnessMap.value=Qt.clearcoatRoughnessMap,Dt(Qt.clearcoatRoughnessMap,rn.clearcoatRoughnessMapTransform)),Qt.clearcoatNormalMap&&(rn.clearcoatNormalMap.value=Qt.clearcoatNormalMap,Dt(Qt.clearcoatNormalMap,rn.clearcoatNormalMapTransform),rn.clearcoatNormalScale.value.copy(Qt.clearcoatNormalScale),Qt.side===BackSide&&rn.clearcoatNormalScale.value.negate())),Qt.iridescence>0&&(rn.iridescence.value=Qt.iridescence,rn.iridescenceIOR.value=Qt.iridescenceIOR,rn.iridescenceThicknessMinimum.value=Qt.iridescenceThicknessRange[0],rn.iridescenceThicknessMaximum.value=Qt.iridescenceThicknessRange[1],Qt.iridescenceMap&&(rn.iridescenceMap.value=Qt.iridescenceMap,Dt(Qt.iridescenceMap,rn.iridescenceMapTransform)),Qt.iridescenceThicknessMap&&(rn.iridescenceThicknessMap.value=Qt.iridescenceThicknessMap,Dt(Qt.iridescenceThicknessMap,rn.iridescenceThicknessMapTransform))),Qt.transmission>0&&(rn.transmission.value=Qt.transmission,rn.transmissionSamplerMap.value=en.texture,rn.transmissionSamplerSize.value.set(en.width,en.height),Qt.transmissionMap&&(rn.transmissionMap.value=Qt.transmissionMap,Dt(Qt.transmissionMap,rn.transmissionMapTransform)),rn.thickness.value=Qt.thickness,Qt.thicknessMap&&(rn.thicknessMap.value=Qt.thicknessMap,Dt(Qt.thicknessMap,rn.thicknessMapTransform)),rn.attenuationDistance.value=Qt.attenuationDistance,rn.attenuationColor.value.copy(Qt.attenuationColor)),Qt.anisotropy>0&&(rn.anisotropyVector.value.set(Qt.anisotropy*Math.cos(Qt.anisotropyRotation),Qt.anisotropy*Math.sin(Qt.anisotropyRotation)),Qt.anisotropyMap&&(rn.anisotropyMap.value=Qt.anisotropyMap,Dt(Qt.anisotropyMap,rn.anisotropyMapTransform))),rn.specularIntensity.value=Qt.specularIntensity,rn.specularColor.value.copy(Qt.specularColor),Qt.specularColorMap&&(rn.specularColorMap.value=Qt.specularColorMap,Dt(Qt.specularColorMap,rn.specularColorMapTransform)),Qt.specularIntensityMap&&(rn.specularIntensityMap.value=Qt.specularIntensityMap,Dt(Qt.specularIntensityMap,rn.specularIntensityMapTransform))}function Jt(rn,Qt){Qt.matcap&&(rn.matcap.value=Qt.matcap)}function nn(rn,Qt){const en=_e.get(Qt).light;rn.referencePosition.value.setFromMatrixPosition(en.matrixWorld),rn.nearDistance.value=en.shadow.camera.near,rn.farDistance.value=en.shadow.camera.far}return{refreshFogUniforms:Vt,refreshMaterialUniforms:Gt}}function WebGLUniformsGroups(kt,_e,Dt,Vt){let Gt={},zt={},jt=[];const Ht=kt.getParameter(kt.MAX_UNIFORM_BUFFER_BINDINGS);function Wt(en,tn){const sn=tn.program;Vt.uniformBlockBinding(en,sn)}function qt(en,tn){let sn=Gt[en.id];sn===void 0&&(Jt(en),sn=Xt(en),Gt[en.id]=sn,en.addEventListener("dispose",rn));const cn=tn.program;Vt.updateUBOMapping(en,cn);const un=_e.render.frame;zt[en.id]!==un&&(Yt(en),zt[en.id]=un)}function Xt(en){const tn=Kt();en.__bindingPointIndex=tn;const sn=kt.createBuffer(),cn=en.__size,un=en.usage;return kt.bindBuffer(kt.UNIFORM_BUFFER,sn),kt.bufferData(kt.UNIFORM_BUFFER,cn,un),kt.bindBuffer(kt.UNIFORM_BUFFER,null),kt.bindBufferBase(kt.UNIFORM_BUFFER,tn,sn),sn}function Kt(){for(let en=0;en<Ht;en++)if(jt.indexOf(en)===-1)return jt.push(en),en;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function Yt(en){const tn=Gt[en.id],sn=en.uniforms,cn=en.__cache;kt.bindBuffer(kt.UNIFORM_BUFFER,tn);for(let un=0,hn=sn.length;un<hn;un++){const fn=Array.isArray(sn[un])?sn[un]:[sn[un]];for(let pn=0,dn=fn.length;pn<dn;pn++){const mn=fn[pn];if(Zt(mn,un,pn,cn)===!0){const vn=mn.__offset,_n=Array.isArray(mn.value)?mn.value:[mn.value];let En=0;for(let An=0;An<_n.length;An++){const Tn=_n[An],Cn=nn(Tn);typeof Tn=="number"||typeof Tn=="boolean"?(mn.__data[0]=Tn,kt.bufferSubData(kt.UNIFORM_BUFFER,vn+En,mn.__data)):Tn.isMatrix3?(mn.__data[0]=Tn.elements[0],mn.__data[1]=Tn.elements[1],mn.__data[2]=Tn.elements[2],mn.__data[3]=0,mn.__data[4]=Tn.elements[3],mn.__data[5]=Tn.elements[4],mn.__data[6]=Tn.elements[5],mn.__data[7]=0,mn.__data[8]=Tn.elements[6],mn.__data[9]=Tn.elements[7],mn.__data[10]=Tn.elements[8],mn.__data[11]=0):(Tn.toArray(mn.__data,En),En+=Cn.storage/Float32Array.BYTES_PER_ELEMENT)}kt.bufferSubData(kt.UNIFORM_BUFFER,vn,mn.__data)}}}kt.bindBuffer(kt.UNIFORM_BUFFER,null)}function Zt(en,tn,sn,cn){const un=en.value,hn=tn+"_"+sn;if(cn[hn]===void 0)return typeof un=="number"||typeof un=="boolean"?cn[hn]=un:cn[hn]=un.clone(),!0;{const fn=cn[hn];if(typeof un=="number"||typeof un=="boolean"){if(fn!==un)return cn[hn]=un,!0}else if(fn.equals(un)===!1)return fn.copy(un),!0}return!1}function Jt(en){const tn=en.uniforms;let sn=0;const cn=16;for(let hn=0,fn=tn.length;hn<fn;hn++){const pn=Array.isArray(tn[hn])?tn[hn]:[tn[hn]];for(let dn=0,mn=pn.length;dn<mn;dn++){const vn=pn[dn],_n=Array.isArray(vn.value)?vn.value:[vn.value];for(let En=0,An=_n.length;En<An;En++){const Tn=_n[En],Cn=nn(Tn),yn=sn%cn;yn!==0&&cn-yn<Cn.boundary&&(sn+=cn-yn),vn.__data=new Float32Array(Cn.storage/Float32Array.BYTES_PER_ELEMENT),vn.__offset=sn,sn+=Cn.storage}}}const un=sn%cn;return un>0&&(sn+=cn-un),en.__size=sn,en.__cache={},this}function nn(en){const tn={boundary:0,storage:0};return typeof en=="number"||typeof en=="boolean"?(tn.boundary=4,tn.storage=4):en.isVector2?(tn.boundary=8,tn.storage=8):en.isVector3||en.isColor?(tn.boundary=16,tn.storage=12):en.isVector4?(tn.boundary=16,tn.storage=16):en.isMatrix3?(tn.boundary=48,tn.storage=48):en.isMatrix4?(tn.boundary=64,tn.storage=64):en.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",en),tn}function rn(en){const tn=en.target;tn.removeEventListener("dispose",rn);const sn=jt.indexOf(tn.__bindingPointIndex);jt.splice(sn,1),kt.deleteBuffer(Gt[tn.id]),delete Gt[tn.id],delete zt[tn.id]}function Qt(){for(const en in Gt)kt.deleteBuffer(Gt[en]);jt=[],Gt={},zt={}}return{bind:Wt,update:qt,dispose:Qt}}class WebGLRenderer{constructor(_e={}){const{canvas:Dt=createCanvasElement(),context:Vt=null,depth:Gt=!0,stencil:zt=!1,alpha:jt=!1,antialias:Ht=!1,premultipliedAlpha:Wt=!0,preserveDrawingBuffer:qt=!1,powerPreference:Xt="default",failIfMajorPerformanceCaveat:Kt=!1}=_e;this.isWebGLRenderer=!0;let Yt;if(Vt!==null){if(typeof WebGLRenderingContext<"u"&&Vt instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");Yt=Vt.getContextAttributes().alpha}else Yt=jt;const Zt=new Uint32Array(4),Jt=new Int32Array(4);let nn=null,rn=null;const Qt=[],en=[];this.domElement=Dt,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=SRGBColorSpace$1,this._useLegacyLights=!1,this.toneMapping=NoToneMapping,this.toneMappingExposure=1;const tn=this;let sn=!1,cn=0,un=0,hn=null,fn=-1,pn=null;const dn=new Vector4,mn=new Vector4;let vn=null;const _n=new Color$1(0);let En=0,An=Dt.width,Tn=Dt.height,Cn=1,yn=null,Sn=null;const wn=new Vector4(0,0,An,Tn),xn=new Vector4(0,0,An,Tn);let Rn=!1;const Ln=new Frustum;let Nn=!1,Fn=!1;const Pn=new Matrix4,Bn=new Vector2,Hn=new Vector3,qn={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ar(){return hn===null?Cn:1}let zn=Vt;function ur(On,Gn){const tr=Dt.getContext(On,Gn);return tr!==null?tr:null}try{const On={alpha:!0,depth:Gt,stencil:zt,antialias:Ht,premultipliedAlpha:Wt,preserveDrawingBuffer:qt,powerPreference:Xt,failIfMajorPerformanceCaveat:Kt};if("setAttribute"in Dt&&Dt.setAttribute("data-engine",`three.js r${REVISION}`),Dt.addEventListener("webglcontextlost",Nr,!1),Dt.addEventListener("webglcontextrestored",yr,!1),Dt.addEventListener("webglcontextcreationerror",zr,!1),zn===null){const Gn="webgl2";if(zn=ur(Gn,On),zn===null)throw ur(Gn)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(On){throw console.error("THREE.WebGLRenderer: "+On.message),On}let Wn,or,gr,fr,Un,In,jn,er,cr,lr,Mr,mr,wr,Dr,Cr,Pr,Hr,Ir,Fr,os,ss,Jr,cs,fs;function Ur(){Wn=new WebGLExtensions(zn),Wn.init(),or=new WebGLCapabilities(zn,Wn,_e),Jr=new WebGLUtils(zn,Wn),gr=new WebGLState(zn),fr=new WebGLInfo(zn),Un=new WebGLProperties,In=new WebGLTextures(zn,Wn,gr,Un,or,Jr,fr),jn=new WebGLCubeMaps(tn),er=new WebGLCubeUVMaps(tn),cr=new WebGLAttributes(zn),cs=new WebGLBindingStates(zn,cr),lr=new WebGLGeometries(zn,cr,fr,cs),Mr=new WebGLObjects(zn,lr,cr,fr),Fr=new WebGLMorphtargets(zn,or,In),Pr=new WebGLClipping(Un),mr=new WebGLPrograms(tn,jn,er,Wn,or,cs,Pr),wr=new WebGLMaterials(tn,Un),Dr=new WebGLRenderLists,Cr=new WebGLRenderStates(Wn),Ir=new WebGLBackground(tn,jn,er,gr,Mr,Yt,Wt),Hr=new WebGLShadowMap(tn,Mr,or),fs=new WebGLUniformsGroups(zn,fr,or,gr),os=new WebGLBufferRenderer(zn,Wn,fr),ss=new WebGLIndexedBufferRenderer(zn,Wn,fr),fr.programs=mr.programs,tn.capabilities=or,tn.extensions=Wn,tn.properties=Un,tn.renderLists=Dr,tn.shadowMap=Hr,tn.state=gr,tn.info=fr}Ur();const ir=new WebXRManager(tn,zn);this.xr=ir,this.getContext=function(){return zn},this.getContextAttributes=function(){return zn.getContextAttributes()},this.forceContextLoss=function(){const On=Wn.get("WEBGL_lose_context");On&&On.loseContext()},this.forceContextRestore=function(){const On=Wn.get("WEBGL_lose_context");On&&On.restoreContext()},this.getPixelRatio=function(){return Cn},this.setPixelRatio=function(On){On!==void 0&&(Cn=On,this.setSize(An,Tn,!1))},this.getSize=function(On){return On.set(An,Tn)},this.setSize=function(On,Gn,tr=!0){if(ir.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}An=On,Tn=Gn,Dt.width=Math.floor(On*Cn),Dt.height=Math.floor(Gn*Cn),tr===!0&&(Dt.style.width=On+"px",Dt.style.height=Gn+"px"),this.setViewport(0,0,On,Gn)},this.getDrawingBufferSize=function(On){return On.set(An*Cn,Tn*Cn).floor()},this.setDrawingBufferSize=function(On,Gn,tr){An=On,Tn=Gn,Cn=tr,Dt.width=Math.floor(On*tr),Dt.height=Math.floor(Gn*tr),this.setViewport(0,0,On,Gn)},this.getCurrentViewport=function(On){return On.copy(dn)},this.getViewport=function(On){return On.copy(wn)},this.setViewport=function(On,Gn,tr,nr){On.isVector4?wn.set(On.x,On.y,On.z,On.w):wn.set(On,Gn,tr,nr),gr.viewport(dn.copy(wn).multiplyScalar(Cn).round())},this.getScissor=function(On){return On.copy(xn)},this.setScissor=function(On,Gn,tr,nr){On.isVector4?xn.set(On.x,On.y,On.z,On.w):xn.set(On,Gn,tr,nr),gr.scissor(mn.copy(xn).multiplyScalar(Cn).round())},this.getScissorTest=function(){return Rn},this.setScissorTest=function(On){gr.setScissorTest(Rn=On)},this.setOpaqueSort=function(On){yn=On},this.setTransparentSort=function(On){Sn=On},this.getClearColor=function(On){return On.copy(Ir.getClearColor())},this.setClearColor=function(){Ir.setClearColor.apply(Ir,arguments)},this.getClearAlpha=function(){return Ir.getClearAlpha()},this.setClearAlpha=function(){Ir.setClearAlpha.apply(Ir,arguments)},this.clear=function(On=!0,Gn=!0,tr=!0){let nr=0;if(On){let sr=!1;if(hn!==null){const pr=hn.texture.format;sr=pr===RGBAIntegerFormat||pr===RGIntegerFormat||pr===RedIntegerFormat}if(sr){const pr=hn.texture.type,_r=pr===UnsignedByteType||pr===UnsignedIntType||pr===UnsignedShortType||pr===UnsignedInt248Type||pr===UnsignedShort4444Type||pr===UnsignedShort5551Type,xr=Ir.getClearColor(),Tr=Ir.getClearAlpha(),br=xr.r,$r=xr.g,Rr=xr.b;_r?(Zt[0]=br,Zt[1]=$r,Zt[2]=Rr,Zt[3]=Tr,zn.clearBufferuiv(zn.COLOR,0,Zt)):(Jt[0]=br,Jt[1]=$r,Jt[2]=Rr,Jt[3]=Tr,zn.clearBufferiv(zn.COLOR,0,Jt))}else nr|=zn.COLOR_BUFFER_BIT}Gn&&(nr|=zn.DEPTH_BUFFER_BIT),tr&&(nr|=zn.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),zn.clear(nr)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){Dt.removeEventListener("webglcontextlost",Nr,!1),Dt.removeEventListener("webglcontextrestored",yr,!1),Dt.removeEventListener("webglcontextcreationerror",zr,!1),Dr.dispose(),Cr.dispose(),Un.dispose(),jn.dispose(),er.dispose(),Mr.dispose(),cs.dispose(),fs.dispose(),mr.dispose(),ir.dispose(),ir.removeEventListener("sessionstart",zs),ir.removeEventListener("sessionend",js),ro.stop()};function Nr(On){On.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),sn=!0}function yr(){console.log("THREE.WebGLRenderer: Context Restored."),sn=!1;const On=fr.autoReset,Gn=Hr.enabled,tr=Hr.autoUpdate,nr=Hr.needsUpdate,sr=Hr.type;Ur(),fr.autoReset=On,Hr.enabled=Gn,Hr.autoUpdate=tr,Hr.needsUpdate=nr,Hr.type=sr}function zr(On){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",On.statusMessage)}function Zr(On){const Gn=On.target;Gn.removeEventListener("dispose",Zr),gs(Gn)}function gs(On){bs(On),Un.remove(On)}function bs(On){const Gn=Un.get(On).programs;Gn!==void 0&&(Gn.forEach(function(tr){mr.releaseProgram(tr)}),On.isShaderMaterial&&mr.releaseShaderCache(On))}this.renderBufferDirect=function(On,Gn,tr,nr,sr,pr){Gn===null&&(Gn=qn);const _r=sr.isMesh&&sr.matrixWorld.determinant()<0,xr=Ls(On,Gn,tr,nr,sr);gr.setMaterial(nr,_r);let Tr=tr.index,br=1;if(nr.wireframe===!0){if(Tr=lr.getWireframeAttribute(tr),Tr===void 0)return;br=2}const $r=tr.drawRange,Rr=tr.attributes.position;let kr=$r.start*br,Xr=($r.start+$r.count)*br;pr!==null&&(kr=Math.max(kr,pr.start*br),Xr=Math.min(Xr,(pr.start+pr.count)*br)),Tr!==null?(kr=Math.max(kr,0),Xr=Math.min(Xr,Tr.count)):Rr!=null&&(kr=Math.max(kr,0),Xr=Math.min(Xr,Rr.count));const jr=Xr-kr;if(jr<0||jr===1/0)return;cs.setup(sr,nr,xr,tr,Tr);let es,qr=os;if(Tr!==null&&(es=cr.get(Tr),qr=ss,qr.setIndex(es)),sr.isMesh)nr.wireframe===!0?(gr.setLineWidth(nr.wireframeLinewidth*ar()),qr.setMode(zn.LINES)):qr.setMode(zn.TRIANGLES);else if(sr.isLine){let Lr=nr.linewidth;Lr===void 0&&(Lr=1),gr.setLineWidth(Lr*ar()),sr.isLineSegments?qr.setMode(zn.LINES):sr.isLineLoop?qr.setMode(zn.LINE_LOOP):qr.setMode(zn.LINE_STRIP)}else sr.isPoints?qr.setMode(zn.POINTS):sr.isSprite&&qr.setMode(zn.TRIANGLES);if(sr.isBatchedMesh)qr.renderMultiDraw(sr._multiDrawStarts,sr._multiDrawCounts,sr._multiDrawCount);else if(sr.isInstancedMesh)qr.renderInstances(kr,jr,sr.count);else if(tr.isInstancedBufferGeometry){const Lr=tr._maxInstanceCount!==void 0?tr._maxInstanceCount:1/0,_i=Math.min(tr.instanceCount,Lr);qr.renderInstances(kr,jr,_i)}else qr.render(kr,jr)};function Ts(On,Gn,tr){On.transparent===!0&&On.side===DoubleSide&&On.forceSinglePass===!1?(On.side=BackSide,On.needsUpdate=!0,Us(On,Gn,tr),On.side=FrontSide,On.needsUpdate=!0,Us(On,Gn,tr),On.side=DoubleSide):Us(On,Gn,tr)}this.compile=function(On,Gn,tr=null){tr===null&&(tr=On),rn=Cr.get(tr),rn.init(),en.push(rn),tr.traverseVisible(function(sr){sr.isLight&&sr.layers.test(Gn.layers)&&(rn.pushLight(sr),sr.castShadow&&rn.pushShadow(sr))}),On!==tr&&On.traverseVisible(function(sr){sr.isLight&&sr.layers.test(Gn.layers)&&(rn.pushLight(sr),sr.castShadow&&rn.pushShadow(sr))}),rn.setupLights(tn._useLegacyLights);const nr=new Set;return On.traverse(function(sr){const pr=sr.material;if(pr)if(Array.isArray(pr))for(let _r=0;_r<pr.length;_r++){const xr=pr[_r];Ts(xr,tr,sr),nr.add(xr)}else Ts(pr,tr,sr),nr.add(pr)}),en.pop(),rn=null,nr},this.compileAsync=function(On,Gn,tr=null){const nr=this.compile(On,Gn,tr);return new Promise(sr=>{function pr(){if(nr.forEach(function(_r){Un.get(_r).currentProgram.isReady()&&nr.delete(_r)}),nr.size===0){sr(On);return}setTimeout(pr,10)}Wn.get("KHR_parallel_shader_compile")!==null?pr():setTimeout(pr,10)})};let Ps=null;function vs(On){Ps&&Ps(On)}function zs(){ro.stop()}function js(){ro.start()}const ro=new WebGLAnimation;ro.setAnimationLoop(vs),typeof self<"u"&&ro.setContext(self),this.setAnimationLoop=function(On){Ps=On,ir.setAnimationLoop(On),On===null?ro.stop():ro.start()},ir.addEventListener("sessionstart",zs),ir.addEventListener("sessionend",js),this.render=function(On,Gn){if(Gn!==void 0&&Gn.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(sn===!0)return;On.matrixWorldAutoUpdate===!0&&On.updateMatrixWorld(),Gn.parent===null&&Gn.matrixWorldAutoUpdate===!0&&Gn.updateMatrixWorld(),ir.enabled===!0&&ir.isPresenting===!0&&(ir.cameraAutoUpdate===!0&&ir.updateCamera(Gn),Gn=ir.getCamera()),On.isScene===!0&&On.onBeforeRender(tn,On,Gn,hn),rn=Cr.get(On,en.length),rn.init(),en.push(rn),Pn.multiplyMatrices(Gn.projectionMatrix,Gn.matrixWorldInverse),Ln.setFromProjectionMatrix(Pn),Fn=this.localClippingEnabled,Nn=Pr.init(this.clippingPlanes,Fn),nn=Dr.get(On,Qt.length),nn.init(),Qt.push(nn),Bo(On,Gn,0,tn.sortObjects),nn.finish(),tn.sortObjects===!0&&nn.sort(yn,Sn),this.info.render.frame++,Nn===!0&&Pr.beginShadows();const tr=rn.state.shadowsArray;if(Hr.render(tr,On,Gn),Nn===!0&&Pr.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ir.enabled===!1||ir.isPresenting===!1||ir.hasDepthSensing()===!1)&&Ir.render(nn,On),rn.setupLights(tn._useLegacyLights),Gn.isArrayCamera){const nr=Gn.cameras;for(let sr=0,pr=nr.length;sr<pr;sr++){const _r=nr[sr];Uo(nn,On,_r,_r.viewport)}}else Uo(nn,On,Gn);hn!==null&&(In.updateMultisampleRenderTarget(hn),In.updateRenderTargetMipmap(hn)),On.isScene===!0&&On.onAfterRender(tn,On,Gn),cs.resetDefaultState(),fn=-1,pn=null,en.pop(),en.length>0?rn=en[en.length-1]:rn=null,Qt.pop(),Qt.length>0?nn=Qt[Qt.length-1]:nn=null};function Bo(On,Gn,tr,nr){if(On.visible===!1)return;if(On.layers.test(Gn.layers)){if(On.isGroup)tr=On.renderOrder;else if(On.isLOD)On.autoUpdate===!0&&On.update(Gn);else if(On.isLight)rn.pushLight(On),On.castShadow&&rn.pushShadow(On);else if(On.isSprite){if(!On.frustumCulled||Ln.intersectsSprite(On)){nr&&Hn.setFromMatrixPosition(On.matrixWorld).applyMatrix4(Pn);const _r=Mr.update(On),xr=On.material;xr.visible&&nn.push(On,_r,xr,tr,Hn.z,null)}}else if((On.isMesh||On.isLine||On.isPoints)&&(!On.frustumCulled||Ln.intersectsObject(On))){const _r=Mr.update(On),xr=On.material;if(nr&&(On.boundingSphere!==void 0?(On.boundingSphere===null&&On.computeBoundingSphere(),Hn.copy(On.boundingSphere.center)):(_r.boundingSphere===null&&_r.computeBoundingSphere(),Hn.copy(_r.boundingSphere.center)),Hn.applyMatrix4(On.matrixWorld).applyMatrix4(Pn)),Array.isArray(xr)){const Tr=_r.groups;for(let br=0,$r=Tr.length;br<$r;br++){const Rr=Tr[br],kr=xr[Rr.materialIndex];kr&&kr.visible&&nn.push(On,_r,kr,tr,Hn.z,Rr)}}else xr.visible&&nn.push(On,_r,xr,tr,Hn.z,null)}}const pr=On.children;for(let _r=0,xr=pr.length;_r<xr;_r++)Bo(pr[_r],Gn,tr,nr)}function Uo(On,Gn,tr,nr){const sr=On.opaque,pr=On.transmissive,_r=On.transparent;rn.setupLightsView(tr),Nn===!0&&Pr.setGlobalState(tn.clippingPlanes,tr),pr.length>0&&lo(sr,pr,Gn,tr),nr&&gr.viewport(dn.copy(nr)),sr.length>0&&co(sr,Gn,tr),pr.length>0&&co(pr,Gn,tr),_r.length>0&&co(_r,Gn,tr),gr.buffers.depth.setTest(!0),gr.buffers.depth.setMask(!0),gr.buffers.color.setMask(!0),gr.setPolygonOffset(!1)}function lo(On,Gn,tr,nr){if((tr.isScene===!0?tr.overrideMaterial:null)!==null)return;if(rn.state.transmissionRenderTarget===null){rn.state.transmissionRenderTarget=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:Wn.has("EXT_color_buffer_half_float")||Wn.has("EXT_color_buffer_float")?HalfFloatType:UnsignedByteType,minFilter:LinearMipmapLinearFilter,samples:4,stencilBuffer:zt});const br=Un.get(rn.state.transmissionRenderTarget);br.__isTransmissionRenderTarget=!0}const pr=rn.state.transmissionRenderTarget;tn.getDrawingBufferSize(Bn),pr.setSize(Bn.x,Bn.y);const _r=tn.getRenderTarget();tn.setRenderTarget(pr),tn.getClearColor(_n),En=tn.getClearAlpha(),En<1&&tn.setClearColor(16777215,.5),tn.clear();const xr=tn.toneMapping;tn.toneMapping=NoToneMapping,co(On,tr,nr),In.updateMultisampleRenderTarget(pr),In.updateRenderTargetMipmap(pr);let Tr=!1;for(let br=0,$r=Gn.length;br<$r;br++){const Rr=Gn[br],kr=Rr.object,Xr=Rr.geometry,jr=Rr.material,es=Rr.group;if(jr.side===DoubleSide&&kr.layers.test(nr.layers)){const qr=jr.side;jr.side=BackSide,jr.needsUpdate=!0,uo(kr,tr,nr,Xr,jr,es),jr.side=qr,jr.needsUpdate=!0,Tr=!0}}Tr===!0&&(In.updateMultisampleRenderTarget(pr),In.updateRenderTargetMipmap(pr)),tn.setRenderTarget(_r),tn.setClearColor(_n,En),tn.toneMapping=xr}function co(On,Gn,tr){const nr=Gn.isScene===!0?Gn.overrideMaterial:null;for(let sr=0,pr=On.length;sr<pr;sr++){const _r=On[sr],xr=_r.object,Tr=_r.geometry,br=nr===null?_r.material:nr,$r=_r.group;xr.layers.test(tr.layers)&&uo(xr,Gn,tr,Tr,br,$r)}}function uo(On,Gn,tr,nr,sr,pr){On.onBeforeRender(tn,Gn,tr,nr,sr,pr),On.modelViewMatrix.multiplyMatrices(tr.matrixWorldInverse,On.matrixWorld),On.normalMatrix.getNormalMatrix(On.modelViewMatrix),sr.onBeforeRender(tn,Gn,tr,nr,On,pr),sr.transparent===!0&&sr.side===DoubleSide&&sr.forceSinglePass===!1?(sr.side=BackSide,sr.needsUpdate=!0,tn.renderBufferDirect(tr,Gn,nr,sr,On,pr),sr.side=FrontSide,sr.needsUpdate=!0,tn.renderBufferDirect(tr,Gn,nr,sr,On,pr),sr.side=DoubleSide):tn.renderBufferDirect(tr,Gn,nr,sr,On,pr),On.onAfterRender(tn,Gn,tr,nr,sr,pr)}function Us(On,Gn,tr){Gn.isScene!==!0&&(Gn=qn);const nr=Un.get(On),sr=rn.state.lights,pr=rn.state.shadowsArray,_r=sr.state.version,xr=mr.getParameters(On,sr.state,pr,Gn,tr),Tr=mr.getProgramCacheKey(xr);let br=nr.programs;nr.environment=On.isMeshStandardMaterial?Gn.environment:null,nr.fog=Gn.fog,nr.envMap=(On.isMeshStandardMaterial?er:jn).get(On.envMap||nr.environment),nr.envMapRotation=nr.environment!==null&&On.envMap===null?Gn.environmentRotation:On.envMapRotation,br===void 0&&(On.addEventListener("dispose",Zr),br=new Map,nr.programs=br);let $r=br.get(Tr);if($r!==void 0){if(nr.currentProgram===$r&&nr.lightsStateVersion===_r)return Is(On,xr),$r}else xr.uniforms=mr.getUniforms(On),On.onBuild(tr,xr,tn),On.onBeforeCompile(xr,tn),$r=mr.acquireProgram(xr,Tr),br.set(Tr,$r),nr.uniforms=xr.uniforms;const Rr=nr.uniforms;return(!On.isShaderMaterial&&!On.isRawShaderMaterial||On.clipping===!0)&&(Rr.clippingPlanes=Pr.uniform),Is(On,xr),nr.needsLights=$n(On),nr.lightsStateVersion=_r,nr.needsLights&&(Rr.ambientLightColor.value=sr.state.ambient,Rr.lightProbe.value=sr.state.probe,Rr.directionalLights.value=sr.state.directional,Rr.directionalLightShadows.value=sr.state.directionalShadow,Rr.spotLights.value=sr.state.spot,Rr.spotLightShadows.value=sr.state.spotShadow,Rr.rectAreaLights.value=sr.state.rectArea,Rr.ltc_1.value=sr.state.rectAreaLTC1,Rr.ltc_2.value=sr.state.rectAreaLTC2,Rr.pointLights.value=sr.state.point,Rr.pointLightShadows.value=sr.state.pointShadow,Rr.hemisphereLights.value=sr.state.hemi,Rr.directionalShadowMap.value=sr.state.directionalShadowMap,Rr.directionalShadowMatrix.value=sr.state.directionalShadowMatrix,Rr.spotShadowMap.value=sr.state.spotShadowMap,Rr.spotLightMatrix.value=sr.state.spotLightMatrix,Rr.spotLightMap.value=sr.state.spotLightMap,Rr.pointShadowMap.value=sr.state.pointShadowMap,Rr.pointShadowMatrix.value=sr.state.pointShadowMatrix),nr.currentProgram=$r,nr.uniformsList=null,$r}function Ar(On){if(On.uniformsList===null){const Gn=On.currentProgram.getUniforms();On.uniformsList=WebGLUniforms.seqWithValue(Gn.seq,On.uniforms)}return On.uniformsList}function Is(On,Gn){const tr=Un.get(On);tr.outputColorSpace=Gn.outputColorSpace,tr.batching=Gn.batching,tr.instancing=Gn.instancing,tr.instancingColor=Gn.instancingColor,tr.instancingMorph=Gn.instancingMorph,tr.skinning=Gn.skinning,tr.morphTargets=Gn.morphTargets,tr.morphNormals=Gn.morphNormals,tr.morphColors=Gn.morphColors,tr.morphTargetsCount=Gn.morphTargetsCount,tr.numClippingPlanes=Gn.numClippingPlanes,tr.numIntersection=Gn.numClipIntersection,tr.vertexAlphas=Gn.vertexAlphas,tr.vertexTangents=Gn.vertexTangents,tr.toneMapping=Gn.toneMapping}function Ls(On,Gn,tr,nr,sr){Gn.isScene!==!0&&(Gn=qn),In.resetTextureUnits();const pr=Gn.fog,_r=nr.isMeshStandardMaterial?Gn.environment:null,xr=hn===null?tn.outputColorSpace:hn.isXRRenderTarget===!0?hn.texture.colorSpace:LinearSRGBColorSpace$1,Tr=(nr.isMeshStandardMaterial?er:jn).get(nr.envMap||_r),br=nr.vertexColors===!0&&!!tr.attributes.color&&tr.attributes.color.itemSize===4,$r=!!tr.attributes.tangent&&(!!nr.normalMap||nr.anisotropy>0),Rr=!!tr.morphAttributes.position,kr=!!tr.morphAttributes.normal,Xr=!!tr.morphAttributes.color;let jr=NoToneMapping;nr.toneMapped&&(hn===null||hn.isXRRenderTarget===!0)&&(jr=tn.toneMapping);const es=tr.morphAttributes.position||tr.morphAttributes.normal||tr.morphAttributes.color,qr=es!==void 0?es.length:0,Lr=Un.get(nr),_i=rn.state.lights;if(Nn===!0&&(Fn===!0||On!==pn)){const _s=On===pn&&nr.id===fn;Pr.setState(nr,On,_s)}let Wr=!1;nr.version===Lr.__version?(Lr.needsLights&&Lr.lightsStateVersion!==_i.state.version||Lr.outputColorSpace!==xr||sr.isBatchedMesh&&Lr.batching===!1||!sr.isBatchedMesh&&Lr.batching===!0||sr.isInstancedMesh&&Lr.instancing===!1||!sr.isInstancedMesh&&Lr.instancing===!0||sr.isSkinnedMesh&&Lr.skinning===!1||!sr.isSkinnedMesh&&Lr.skinning===!0||sr.isInstancedMesh&&Lr.instancingColor===!0&&sr.instanceColor===null||sr.isInstancedMesh&&Lr.instancingColor===!1&&sr.instanceColor!==null||sr.isInstancedMesh&&Lr.instancingMorph===!0&&sr.morphTexture===null||sr.isInstancedMesh&&Lr.instancingMorph===!1&&sr.morphTexture!==null||Lr.envMap!==Tr||nr.fog===!0&&Lr.fog!==pr||Lr.numClippingPlanes!==void 0&&(Lr.numClippingPlanes!==Pr.numPlanes||Lr.numIntersection!==Pr.numIntersection)||Lr.vertexAlphas!==br||Lr.vertexTangents!==$r||Lr.morphTargets!==Rr||Lr.morphNormals!==kr||Lr.morphColors!==Xr||Lr.toneMapping!==jr||Lr.morphTargetsCount!==qr)&&(Wr=!0):(Wr=!0,Lr.__version=nr.version);let hs=Lr.currentProgram;Wr===!0&&(hs=Us(nr,Gn,sr));let ts=!1,ys=!1,Ns=!1;const us=hs.getUniforms(),Cs=Lr.uniforms;if(gr.useProgram(hs.program)&&(ts=!0,ys=!0,Ns=!0),nr.id!==fn&&(fn=nr.id,ys=!0),ts||pn!==On){us.setValue(zn,"projectionMatrix",On.projectionMatrix),us.setValue(zn,"viewMatrix",On.matrixWorldInverse);const _s=us.map.cameraPosition;_s!==void 0&&_s.setValue(zn,Hn.setFromMatrixPosition(On.matrixWorld)),or.logarithmicDepthBuffer&&us.setValue(zn,"logDepthBufFC",2/(Math.log(On.far+1)/Math.LN2)),(nr.isMeshPhongMaterial||nr.isMeshToonMaterial||nr.isMeshLambertMaterial||nr.isMeshBasicMaterial||nr.isMeshStandardMaterial||nr.isShaderMaterial)&&us.setValue(zn,"isOrthographic",On.isOrthographicCamera===!0),pn!==On&&(pn=On,ys=!0,Ns=!0)}if(sr.isSkinnedMesh){us.setOptional(zn,sr,"bindMatrix"),us.setOptional(zn,sr,"bindMatrixInverse");const _s=sr.skeleton;_s&&(_s.boneTexture===null&&_s.computeBoneTexture(),us.setValue(zn,"boneTexture",_s.boneTexture,In))}sr.isBatchedMesh&&(us.setOptional(zn,sr,"batchingTexture"),us.setValue(zn,"batchingTexture",sr._matricesTexture,In));const ds=tr.morphAttributes;if((ds.position!==void 0||ds.normal!==void 0||ds.color!==void 0)&&Fr.update(sr,tr,hs),(ys||Lr.receiveShadow!==sr.receiveShadow)&&(Lr.receiveShadow=sr.receiveShadow,us.setValue(zn,"receiveShadow",sr.receiveShadow)),nr.isMeshGouraudMaterial&&nr.envMap!==null&&(Cs.envMap.value=Tr,Cs.flipEnvMap.value=Tr.isCubeTexture&&Tr.isRenderTargetTexture===!1?-1:1),nr.isMeshStandardMaterial&&nr.envMap===null&&Gn.environment!==null&&(Cs.envMapIntensity.value=Gn.environmentIntensity),ys&&(us.setValue(zn,"toneMappingExposure",tn.toneMappingExposure),Lr.needsLights&&kn(Cs,Ns),pr&&nr.fog===!0&&wr.refreshFogUniforms(Cs,pr),wr.refreshMaterialUniforms(Cs,nr,Cn,Tn,rn.state.transmissionRenderTarget),WebGLUniforms.upload(zn,Ar(Lr),Cs,In)),nr.isShaderMaterial&&nr.uniformsNeedUpdate===!0&&(WebGLUniforms.upload(zn,Ar(Lr),Cs,In),nr.uniformsNeedUpdate=!1),nr.isSpriteMaterial&&us.setValue(zn,"center",sr.center),us.setValue(zn,"modelViewMatrix",sr.modelViewMatrix),us.setValue(zn,"normalMatrix",sr.normalMatrix),us.setValue(zn,"modelMatrix",sr.matrixWorld),nr.isShaderMaterial||nr.isRawShaderMaterial){const _s=nr.uniformsGroups;for(let ms=0,ps=_s.length;ms<ps;ms++){const ws=_s[ms];fs.update(ws,hs),fs.bind(ws,hs)}}return hs}function kn(On,Gn){On.ambientLightColor.needsUpdate=Gn,On.lightProbe.needsUpdate=Gn,On.directionalLights.needsUpdate=Gn,On.directionalLightShadows.needsUpdate=Gn,On.pointLights.needsUpdate=Gn,On.pointLightShadows.needsUpdate=Gn,On.spotLights.needsUpdate=Gn,On.spotLightShadows.needsUpdate=Gn,On.rectAreaLights.needsUpdate=Gn,On.hemisphereLights.needsUpdate=Gn}function $n(On){return On.isMeshLambertMaterial||On.isMeshToonMaterial||On.isMeshPhongMaterial||On.isMeshStandardMaterial||On.isShadowMaterial||On.isShaderMaterial&&On.lights===!0}this.getActiveCubeFace=function(){return cn},this.getActiveMipmapLevel=function(){return un},this.getRenderTarget=function(){return hn},this.setRenderTargetTextures=function(On,Gn,tr){Un.get(On.texture).__webglTexture=Gn,Un.get(On.depthTexture).__webglTexture=tr;const nr=Un.get(On);nr.__hasExternalTextures=!0,nr.__autoAllocateDepthBuffer=tr===void 0,nr.__autoAllocateDepthBuffer||Wn.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),nr.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(On,Gn){const tr=Un.get(On);tr.__webglFramebuffer=Gn,tr.__useDefaultFramebuffer=Gn===void 0},this.setRenderTarget=function(On,Gn=0,tr=0){hn=On,cn=Gn,un=tr;let nr=!0,sr=null,pr=!1,_r=!1;if(On){const Tr=Un.get(On);Tr.__useDefaultFramebuffer!==void 0?(gr.bindFramebuffer(zn.FRAMEBUFFER,null),nr=!1):Tr.__webglFramebuffer===void 0?In.setupRenderTarget(On):Tr.__hasExternalTextures&&In.rebindTextures(On,Un.get(On.texture).__webglTexture,Un.get(On.depthTexture).__webglTexture);const br=On.texture;(br.isData3DTexture||br.isDataArrayTexture||br.isCompressedArrayTexture)&&(_r=!0);const $r=Un.get(On).__webglFramebuffer;On.isWebGLCubeRenderTarget?(Array.isArray($r[Gn])?sr=$r[Gn][tr]:sr=$r[Gn],pr=!0):On.samples>0&&In.useMultisampledRTT(On)===!1?sr=Un.get(On).__webglMultisampledFramebuffer:Array.isArray($r)?sr=$r[tr]:sr=$r,dn.copy(On.viewport),mn.copy(On.scissor),vn=On.scissorTest}else dn.copy(wn).multiplyScalar(Cn).floor(),mn.copy(xn).multiplyScalar(Cn).floor(),vn=Rn;if(gr.bindFramebuffer(zn.FRAMEBUFFER,sr)&&nr&&gr.drawBuffers(On,sr),gr.viewport(dn),gr.scissor(mn),gr.setScissorTest(vn),pr){const Tr=Un.get(On.texture);zn.framebufferTexture2D(zn.FRAMEBUFFER,zn.COLOR_ATTACHMENT0,zn.TEXTURE_CUBE_MAP_POSITIVE_X+Gn,Tr.__webglTexture,tr)}else if(_r){const Tr=Un.get(On.texture),br=Gn||0;zn.framebufferTextureLayer(zn.FRAMEBUFFER,zn.COLOR_ATTACHMENT0,Tr.__webglTexture,tr||0,br)}fn=-1},this.readRenderTargetPixels=function(On,Gn,tr,nr,sr,pr,_r){if(!(On&&On.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let xr=Un.get(On).__webglFramebuffer;if(On.isWebGLCubeRenderTarget&&_r!==void 0&&(xr=xr[_r]),xr){gr.bindFramebuffer(zn.FRAMEBUFFER,xr);try{const Tr=On.texture,br=Tr.format,$r=Tr.type;if(br!==RGBAFormat&&Jr.convert(br)!==zn.getParameter(zn.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Rr=$r===HalfFloatType&&(Wn.has("EXT_color_buffer_half_float")||Wn.has("EXT_color_buffer_float"));if($r!==UnsignedByteType&&Jr.convert($r)!==zn.getParameter(zn.IMPLEMENTATION_COLOR_READ_TYPE)&&$r!==FloatType&&!Rr){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Gn>=0&&Gn<=On.width-nr&&tr>=0&&tr<=On.height-sr&&zn.readPixels(Gn,tr,nr,sr,Jr.convert(br),Jr.convert($r),pr)}finally{const Tr=hn!==null?Un.get(hn).__webglFramebuffer:null;gr.bindFramebuffer(zn.FRAMEBUFFER,Tr)}}},this.copyFramebufferToTexture=function(On,Gn,tr=0){const nr=Math.pow(2,-tr),sr=Math.floor(Gn.image.width*nr),pr=Math.floor(Gn.image.height*nr);In.setTexture2D(Gn,0),zn.copyTexSubImage2D(zn.TEXTURE_2D,tr,0,0,On.x,On.y,sr,pr),gr.unbindTexture()},this.copyTextureToTexture=function(On,Gn,tr,nr=0){const sr=Gn.image.width,pr=Gn.image.height,_r=Jr.convert(tr.format),xr=Jr.convert(tr.type);In.setTexture2D(tr,0),zn.pixelStorei(zn.UNPACK_FLIP_Y_WEBGL,tr.flipY),zn.pixelStorei(zn.UNPACK_PREMULTIPLY_ALPHA_WEBGL,tr.premultiplyAlpha),zn.pixelStorei(zn.UNPACK_ALIGNMENT,tr.unpackAlignment),Gn.isDataTexture?zn.texSubImage2D(zn.TEXTURE_2D,nr,On.x,On.y,sr,pr,_r,xr,Gn.image.data):Gn.isCompressedTexture?zn.compressedTexSubImage2D(zn.TEXTURE_2D,nr,On.x,On.y,Gn.mipmaps[0].width,Gn.mipmaps[0].height,_r,Gn.mipmaps[0].data):zn.texSubImage2D(zn.TEXTURE_2D,nr,On.x,On.y,_r,xr,Gn.image),nr===0&&tr.generateMipmaps&&zn.generateMipmap(zn.TEXTURE_2D),gr.unbindTexture()},this.copyTextureToTexture3D=function(On,Gn,tr,nr,sr=0){const pr=Math.round(On.max.x-On.min.x),_r=Math.round(On.max.y-On.min.y),xr=On.max.z-On.min.z+1,Tr=Jr.convert(nr.format),br=Jr.convert(nr.type);let $r;if(nr.isData3DTexture)In.setTexture3D(nr,0),$r=zn.TEXTURE_3D;else if(nr.isDataArrayTexture||nr.isCompressedArrayTexture)In.setTexture2DArray(nr,0),$r=zn.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}zn.pixelStorei(zn.UNPACK_FLIP_Y_WEBGL,nr.flipY),zn.pixelStorei(zn.UNPACK_PREMULTIPLY_ALPHA_WEBGL,nr.premultiplyAlpha),zn.pixelStorei(zn.UNPACK_ALIGNMENT,nr.unpackAlignment);const Rr=zn.getParameter(zn.UNPACK_ROW_LENGTH),kr=zn.getParameter(zn.UNPACK_IMAGE_HEIGHT),Xr=zn.getParameter(zn.UNPACK_SKIP_PIXELS),jr=zn.getParameter(zn.UNPACK_SKIP_ROWS),es=zn.getParameter(zn.UNPACK_SKIP_IMAGES),qr=tr.isCompressedTexture?tr.mipmaps[sr]:tr.image;zn.pixelStorei(zn.UNPACK_ROW_LENGTH,qr.width),zn.pixelStorei(zn.UNPACK_IMAGE_HEIGHT,qr.height),zn.pixelStorei(zn.UNPACK_SKIP_PIXELS,On.min.x),zn.pixelStorei(zn.UNPACK_SKIP_ROWS,On.min.y),zn.pixelStorei(zn.UNPACK_SKIP_IMAGES,On.min.z),tr.isDataTexture||tr.isData3DTexture?zn.texSubImage3D($r,sr,Gn.x,Gn.y,Gn.z,pr,_r,xr,Tr,br,qr.data):nr.isCompressedArrayTexture?zn.compressedTexSubImage3D($r,sr,Gn.x,Gn.y,Gn.z,pr,_r,xr,Tr,qr.data):zn.texSubImage3D($r,sr,Gn.x,Gn.y,Gn.z,pr,_r,xr,Tr,br,qr),zn.pixelStorei(zn.UNPACK_ROW_LENGTH,Rr),zn.pixelStorei(zn.UNPACK_IMAGE_HEIGHT,kr),zn.pixelStorei(zn.UNPACK_SKIP_PIXELS,Xr),zn.pixelStorei(zn.UNPACK_SKIP_ROWS,jr),zn.pixelStorei(zn.UNPACK_SKIP_IMAGES,es),sr===0&&nr.generateMipmaps&&zn.generateMipmap($r),gr.unbindTexture()},this.initTexture=function(On){On.isCubeTexture?In.setTextureCube(On,0):On.isData3DTexture?In.setTexture3D(On,0):On.isDataArrayTexture||On.isCompressedArrayTexture?In.setTexture2DArray(On,0):In.setTexture2D(On,0),gr.unbindTexture()},this.resetState=function(){cn=0,un=0,hn=null,gr.reset(),cs.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(_e){this._outputColorSpace=_e;const Dt=this.getContext();Dt.drawingBufferColorSpace=_e===DisplayP3ColorSpace?"display-p3":"srgb",Dt.unpackColorSpace=ColorManagement.workingColorSpace===LinearDisplayP3ColorSpace?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(_e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=_e}}class FogExp2{constructor(_e,Dt=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color$1(_e),this.density=Dt}clone(){return new FogExp2(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Fog{constructor(_e,Dt=1,Vt=1e3){this.isFog=!0,this.name="",this.color=new Color$1(_e),this.near=Dt,this.far=Vt}clone(){return new Fog(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(_e,Dt){return super.copy(_e,Dt),_e.background!==null&&(this.background=_e.background.clone()),_e.environment!==null&&(this.environment=_e.environment.clone()),_e.fog!==null&&(this.fog=_e.fog.clone()),this.backgroundBlurriness=_e.backgroundBlurriness,this.backgroundIntensity=_e.backgroundIntensity,this.backgroundRotation.copy(_e.backgroundRotation),this.environmentIntensity=_e.environmentIntensity,this.environmentRotation.copy(_e.environmentRotation),_e.overrideMaterial!==null&&(this.overrideMaterial=_e.overrideMaterial.clone()),this.matrixAutoUpdate=_e.matrixAutoUpdate,this}toJSON(_e){const Dt=super.toJSON(_e);return this.fog!==null&&(Dt.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(Dt.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(Dt.object.backgroundIntensity=this.backgroundIntensity),Dt.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(Dt.object.environmentIntensity=this.environmentIntensity),Dt.object.environmentRotation=this.environmentRotation.toArray(),Dt}}class InterleavedBuffer{constructor(_e,Dt){this.isInterleavedBuffer=!0,this.array=_e,this.stride=Dt,this.count=_e!==void 0?_e.length/Dt:0,this.usage=StaticDrawUsage,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=generateUUID()}onUploadCallback(){}set needsUpdate(_e){_e===!0&&this.version++}get updateRange(){return warnOnce("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(_e){return this.usage=_e,this}addUpdateRange(_e,Dt){this.updateRanges.push({start:_e,count:Dt})}clearUpdateRanges(){this.updateRanges.length=0}copy(_e){return this.array=new _e.array.constructor(_e.array),this.count=_e.count,this.stride=_e.stride,this.usage=_e.usage,this}copyAt(_e,Dt,Vt){_e*=this.stride,Vt*=Dt.stride;for(let Gt=0,zt=this.stride;Gt<zt;Gt++)this.array[_e+Gt]=Dt.array[Vt+Gt];return this}set(_e,Dt=0){return this.array.set(_e,Dt),this}clone(_e){_e.arrayBuffers===void 0&&(_e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=generateUUID()),_e.arrayBuffers[this.array.buffer._uuid]===void 0&&(_e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const Dt=new this.array.constructor(_e.arrayBuffers[this.array.buffer._uuid]),Vt=new this.constructor(Dt,this.stride);return Vt.setUsage(this.usage),Vt}onUpload(_e){return this.onUploadCallback=_e,this}toJSON(_e){return _e.arrayBuffers===void 0&&(_e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=generateUUID()),_e.arrayBuffers[this.array.buffer._uuid]===void 0&&(_e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const _vector$6=new Vector3;class InterleavedBufferAttribute{constructor(_e,Dt,Vt,Gt=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=_e,this.itemSize=Dt,this.offset=Vt,this.normalized=Gt}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(_e){this.data.needsUpdate=_e}applyMatrix4(_e){for(let Dt=0,Vt=this.data.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.applyMatrix4(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}applyNormalMatrix(_e){for(let Dt=0,Vt=this.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.applyNormalMatrix(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}transformDirection(_e){for(let Dt=0,Vt=this.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.transformDirection(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}getComponent(_e,Dt){let Vt=this.array[_e*this.data.stride+this.offset+Dt];return this.normalized&&(Vt=denormalize(Vt,this.array)),Vt}setComponent(_e,Dt,Vt){return this.normalized&&(Vt=normalize(Vt,this.array)),this.data.array[_e*this.data.stride+this.offset+Dt]=Vt,this}setX(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset]=Dt,this}setY(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+1]=Dt,this}setZ(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+2]=Dt,this}setW(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+3]=Dt,this}getX(_e){let Dt=this.data.array[_e*this.data.stride+this.offset];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getY(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+1];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getZ(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+2];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getW(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+3];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}setXY(_e,Dt,Vt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this}setXYZ(_e,Dt,Vt,Gt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array),Gt=normalize(Gt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this.data.array[_e+2]=Gt,this}setXYZW(_e,Dt,Vt,Gt,zt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array),Gt=normalize(Gt,this.array),zt=normalize(zt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this.data.array[_e+2]=Gt,this.data.array[_e+3]=zt,this}clone(_e){if(_e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const Dt=[];for(let Vt=0;Vt<this.count;Vt++){const Gt=Vt*this.data.stride+this.offset;for(let zt=0;zt<this.itemSize;zt++)Dt.push(this.data.array[Gt+zt])}return new BufferAttribute(new this.array.constructor(Dt),this.itemSize,this.normalized)}else return _e.interleavedBuffers===void 0&&(_e.interleavedBuffers={}),_e.interleavedBuffers[this.data.uuid]===void 0&&(_e.interleavedBuffers[this.data.uuid]=this.data.clone(_e)),new InterleavedBufferAttribute(_e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(_e){if(_e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const Dt=[];for(let Vt=0;Vt<this.count;Vt++){const Gt=Vt*this.data.stride+this.offset;for(let zt=0;zt<this.itemSize;zt++)Dt.push(this.data.array[Gt+zt])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Dt,normalized:this.normalized}}else return _e.interleavedBuffers===void 0&&(_e.interleavedBuffers={}),_e.interleavedBuffers[this.data.uuid]===void 0&&(_e.interleavedBuffers[this.data.uuid]=this.data.toJSON(_e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class SpriteMaterial extends Material{constructor(_e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Color$1(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.map=_e.map,this.alphaMap=_e.alphaMap,this.rotation=_e.rotation,this.sizeAttenuation=_e.sizeAttenuation,this.fog=_e.fog,this}}let _geometry;const _intersectPoint=new Vector3,_worldScale=new Vector3,_mvPosition=new Vector3,_alignedPosition=new Vector2,_rotatedPosition=new Vector2,_viewWorldMatrix=new Matrix4,_vA=new Vector3,_vB=new Vector3,_vC=new Vector3,_uvA=new Vector2,_uvB=new Vector2,_uvC=new Vector2;class Sprite extends Object3D{constructor(_e=new SpriteMaterial){if(super(),this.isSprite=!0,this.type="Sprite",_geometry===void 0){_geometry=new BufferGeometry;const Dt=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),Vt=new InterleavedBuffer(Dt,5);_geometry.setIndex([0,1,2,0,2,3]),_geometry.setAttribute("position",new InterleavedBufferAttribute(Vt,3,0,!1)),_geometry.setAttribute("uv",new InterleavedBufferAttribute(Vt,2,3,!1))}this.geometry=_geometry,this.material=_e,this.center=new Vector2(.5,.5)}raycast(_e,Dt){_e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),_worldScale.setFromMatrixScale(this.matrixWorld),_viewWorldMatrix.copy(_e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(_e.camera.matrixWorldInverse,this.matrixWorld),_mvPosition.setFromMatrixPosition(this.modelViewMatrix),_e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&_worldScale.multiplyScalar(-_mvPosition.z);const Vt=this.material.rotation;let Gt,zt;Vt!==0&&(zt=Math.cos(Vt),Gt=Math.sin(Vt));const jt=this.center;transformVertex(_vA.set(-.5,-.5,0),_mvPosition,jt,_worldScale,Gt,zt),transformVertex(_vB.set(.5,-.5,0),_mvPosition,jt,_worldScale,Gt,zt),transformVertex(_vC.set(.5,.5,0),_mvPosition,jt,_worldScale,Gt,zt),_uvA.set(0,0),_uvB.set(1,0),_uvC.set(1,1);let Ht=_e.ray.intersectTriangle(_vA,_vB,_vC,!1,_intersectPoint);if(Ht===null&&(transformVertex(_vB.set(-.5,.5,0),_mvPosition,jt,_worldScale,Gt,zt),_uvB.set(0,1),Ht=_e.ray.intersectTriangle(_vA,_vC,_vB,!1,_intersectPoint),Ht===null))return;const Wt=_e.ray.origin.distanceTo(_intersectPoint);Wt<_e.near||Wt>_e.far||Dt.push({distance:Wt,point:_intersectPoint.clone(),uv:Triangle.getInterpolation(_intersectPoint,_vA,_vB,_vC,_uvA,_uvB,_uvC,new Vector2),face:null,object:this})}copy(_e,Dt){return super.copy(_e,Dt),_e.center!==void 0&&this.center.copy(_e.center),this.material=_e.material,this}}function transformVertex(kt,_e,Dt,Vt,Gt,zt){_alignedPosition.subVectors(kt,Dt).addScalar(.5).multiply(Vt),Gt!==void 0?(_rotatedPosition.x=zt*_alignedPosition.x-Gt*_alignedPosition.y,_rotatedPosition.y=Gt*_alignedPosition.x+zt*_alignedPosition.y):_rotatedPosition.copy(_alignedPosition),kt.copy(_e),kt.x+=_rotatedPosition.x,kt.y+=_rotatedPosition.y,kt.applyMatrix4(_viewWorldMatrix)}const _v1$2=new Vector3,_v2$1=new Vector3;class LOD extends Object3D{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(_e){super.copy(_e,!1);const Dt=_e.levels;for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++){const zt=Dt[Vt];this.addLevel(zt.object.clone(),zt.distance,zt.hysteresis)}return this.autoUpdate=_e.autoUpdate,this}addLevel(_e,Dt=0,Vt=0){Dt=Math.abs(Dt);const Gt=this.levels;let zt;for(zt=0;zt<Gt.length&&!(Dt<Gt[zt].distance);zt++);return Gt.splice(zt,0,{distance:Dt,hysteresis:Vt,object:_e}),this.add(_e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(_e){const Dt=this.levels;if(Dt.length>0){let Vt,Gt;for(Vt=1,Gt=Dt.length;Vt<Gt;Vt++){let zt=Dt[Vt].distance;if(Dt[Vt].object.visible&&(zt-=zt*Dt[Vt].hysteresis),_e<zt)break}return Dt[Vt-1].object}return null}raycast(_e,Dt){if(this.levels.length>0){_v1$2.setFromMatrixPosition(this.matrixWorld);const Gt=_e.ray.origin.distanceTo(_v1$2);this.getObjectForDistance(Gt).raycast(_e,Dt)}}update(_e){const Dt=this.levels;if(Dt.length>1){_v1$2.setFromMatrixPosition(_e.matrixWorld),_v2$1.setFromMatrixPosition(this.matrixWorld);const Vt=_v1$2.distanceTo(_v2$1)/_e.zoom;Dt[0].object.visible=!0;let Gt,zt;for(Gt=1,zt=Dt.length;Gt<zt;Gt++){let jt=Dt[Gt].distance;if(Dt[Gt].object.visible&&(jt-=jt*Dt[Gt].hysteresis),Vt>=jt)Dt[Gt-1].object.visible=!1,Dt[Gt].object.visible=!0;else break}for(this._currentLevel=Gt-1;Gt<zt;Gt++)Dt[Gt].object.visible=!1}}toJSON(_e){const Dt=super.toJSON(_e);this.autoUpdate===!1&&(Dt.object.autoUpdate=!1),Dt.object.levels=[];const Vt=this.levels;for(let Gt=0,zt=Vt.length;Gt<zt;Gt++){const jt=Vt[Gt];Dt.object.levels.push({object:jt.object.uuid,distance:jt.distance,hysteresis:jt.hysteresis})}return Dt}}const _basePosition=new Vector3,_skinIndex=new Vector4,_skinWeight=new Vector4,_vector3=new Vector3,_matrix4=new Matrix4,_vertex=new Vector3,_sphere$4=new Sphere,_inverseMatrix$2=new Matrix4,_ray$2=new Ray;class SkinnedMesh extends Mesh{constructor(_e,Dt){super(_e,Dt),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=AttachedBindMode,this.bindMatrix=new Matrix4,this.bindMatrixInverse=new Matrix4,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const _e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Box3),this.boundingBox.makeEmpty();const Dt=_e.getAttribute("position");for(let Vt=0;Vt<Dt.count;Vt++)this.getVertexPosition(Vt,_vertex),this.boundingBox.expandByPoint(_vertex)}computeBoundingSphere(){const _e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Sphere),this.boundingSphere.makeEmpty();const Dt=_e.getAttribute("position");for(let Vt=0;Vt<Dt.count;Vt++)this.getVertexPosition(Vt,_vertex),this.boundingSphere.expandByPoint(_vertex)}copy(_e,Dt){return super.copy(_e,Dt),this.bindMode=_e.bindMode,this.bindMatrix.copy(_e.bindMatrix),this.bindMatrixInverse.copy(_e.bindMatrixInverse),this.skeleton=_e.skeleton,_e.boundingBox!==null&&(this.boundingBox=_e.boundingBox.clone()),_e.boundingSphere!==null&&(this.boundingSphere=_e.boundingSphere.clone()),this}raycast(_e,Dt){const Vt=this.material,Gt=this.matrixWorld;Vt!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_sphere$4.copy(this.boundingSphere),_sphere$4.applyMatrix4(Gt),_e.ray.intersectsSphere(_sphere$4)!==!1&&(_inverseMatrix$2.copy(Gt).invert(),_ray$2.copy(_e.ray).applyMatrix4(_inverseMatrix$2),!(this.boundingBox!==null&&_ray$2.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(_e,Dt,_ray$2)))}getVertexPosition(_e,Dt){return super.getVertexPosition(_e,Dt),this.applyBoneTransform(_e,Dt),Dt}bind(_e,Dt){this.skeleton=_e,Dt===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),Dt=this.matrixWorld),this.bindMatrix.copy(Dt),this.bindMatrixInverse.copy(Dt).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const _e=new Vector4,Dt=this.geometry.attributes.skinWeight;for(let Vt=0,Gt=Dt.count;Vt<Gt;Vt++){_e.fromBufferAttribute(Dt,Vt);const zt=1/_e.manhattanLength();zt!==1/0?_e.multiplyScalar(zt):_e.set(1,0,0,0),Dt.setXYZW(Vt,_e.x,_e.y,_e.z,_e.w)}}updateMatrixWorld(_e){super.updateMatrixWorld(_e),this.bindMode===AttachedBindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===DetachedBindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(_e,Dt){const Vt=this.skeleton,Gt=this.geometry;_skinIndex.fromBufferAttribute(Gt.attributes.skinIndex,_e),_skinWeight.fromBufferAttribute(Gt.attributes.skinWeight,_e),_basePosition.copy(Dt).applyMatrix4(this.bindMatrix),Dt.set(0,0,0);for(let zt=0;zt<4;zt++){const jt=_skinWeight.getComponent(zt);if(jt!==0){const Ht=_skinIndex.getComponent(zt);_matrix4.multiplyMatrices(Vt.bones[Ht].matrixWorld,Vt.boneInverses[Ht]),Dt.addScaledVector(_vector3.copy(_basePosition).applyMatrix4(_matrix4),jt)}}return Dt.applyMatrix4(this.bindMatrixInverse)}}class Bone extends Object3D{constructor(){super(),this.isBone=!0,this.type="Bone"}}class DataTexture extends Texture{constructor(_e=null,Dt=1,Vt=1,Gt,zt,jt,Ht,Wt,qt=NearestFilter,Xt=NearestFilter,Kt,Yt){super(null,jt,Ht,Wt,qt,Xt,Gt,zt,Kt,Yt),this.isDataTexture=!0,this.image={data:_e,width:Dt,height:Vt},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const _offsetMatrix=new Matrix4,_identityMatrix$1=new Matrix4;class Skeleton{constructor(_e=[],Dt=[]){this.uuid=generateUUID(),this.bones=_e.slice(0),this.boneInverses=Dt,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const _e=this.bones,Dt=this.boneInverses;if(this.boneMatrices=new Float32Array(_e.length*16),Dt.length===0)this.calculateInverses();else if(_e.length!==Dt.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let Vt=0,Gt=this.bones.length;Vt<Gt;Vt++)this.boneInverses.push(new Matrix4)}}calculateInverses(){this.boneInverses.length=0;for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=new Matrix4;this.bones[_e]&&Vt.copy(this.bones[_e].matrixWorld).invert(),this.boneInverses.push(Vt)}}pose(){for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=this.bones[_e];Vt&&Vt.matrixWorld.copy(this.boneInverses[_e]).invert()}for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=this.bones[_e];Vt&&(Vt.parent&&Vt.parent.isBone?(Vt.matrix.copy(Vt.parent.matrixWorld).invert(),Vt.matrix.multiply(Vt.matrixWorld)):Vt.matrix.copy(Vt.matrixWorld),Vt.matrix.decompose(Vt.position,Vt.quaternion,Vt.scale))}}update(){const _e=this.bones,Dt=this.boneInverses,Vt=this.boneMatrices,Gt=this.boneTexture;for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=_e[zt]?_e[zt].matrixWorld:_identityMatrix$1;_offsetMatrix.multiplyMatrices(Ht,Dt[zt]),_offsetMatrix.toArray(Vt,zt*16)}Gt!==null&&(Gt.needsUpdate=!0)}clone(){return new Skeleton(this.bones,this.boneInverses)}computeBoneTexture(){let _e=Math.sqrt(this.bones.length*4);_e=Math.ceil(_e/4)*4,_e=Math.max(_e,4);const Dt=new Float32Array(_e*_e*4);Dt.set(this.boneMatrices);const Vt=new DataTexture(Dt,_e,_e,RGBAFormat,FloatType);return Vt.needsUpdate=!0,this.boneMatrices=Dt,this.boneTexture=Vt,this}getBoneByName(_e){for(let Dt=0,Vt=this.bones.length;Dt<Vt;Dt++){const Gt=this.bones[Dt];if(Gt.name===_e)return Gt}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(_e,Dt){this.uuid=_e.uuid;for(let Vt=0,Gt=_e.bones.length;Vt<Gt;Vt++){const zt=_e.bones[Vt];let jt=Dt[zt];jt===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",zt),jt=new Bone),this.bones.push(jt),this.boneInverses.push(new Matrix4().fromArray(_e.boneInverses[Vt]))}return this.init(),this}toJSON(){const _e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};_e.uuid=this.uuid;const Dt=this.bones,Vt=this.boneInverses;for(let Gt=0,zt=Dt.length;Gt<zt;Gt++){const jt=Dt[Gt];_e.bones.push(jt.uuid);const Ht=Vt[Gt];_e.boneInverses.push(Ht.toArray())}return _e}}class InstancedBufferAttribute extends BufferAttribute{constructor(_e,Dt,Vt,Gt=1){super(_e,Dt,Vt),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=Gt}copy(_e){return super.copy(_e),this.meshPerAttribute=_e.meshPerAttribute,this}toJSON(){const _e=super.toJSON();return _e.meshPerAttribute=this.meshPerAttribute,_e.isInstancedBufferAttribute=!0,_e}}const _instanceLocalMatrix=new Matrix4,_instanceWorldMatrix=new Matrix4,_instanceIntersects=[],_box3=new Box3,_identity=new Matrix4,_mesh$1=new Mesh,_sphere$3=new Sphere;class InstancedMesh extends Mesh{constructor(_e,Dt,Vt){super(_e,Dt),this.isInstancedMesh=!0,this.instanceMatrix=new InstancedBufferAttribute(new Float32Array(Vt*16),16),this.instanceColor=null,this.morphTexture=null,this.count=Vt,this.boundingBox=null,this.boundingSphere=null;for(let Gt=0;Gt<Vt;Gt++)this.setMatrixAt(Gt,_identity)}computeBoundingBox(){const _e=this.geometry,Dt=this.count;this.boundingBox===null&&(this.boundingBox=new Box3),_e.boundingBox===null&&_e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let Vt=0;Vt<Dt;Vt++)this.getMatrixAt(Vt,_instanceLocalMatrix),_box3.copy(_e.boundingBox).applyMatrix4(_instanceLocalMatrix),this.boundingBox.union(_box3)}computeBoundingSphere(){const _e=this.geometry,Dt=this.count;this.boundingSphere===null&&(this.boundingSphere=new Sphere),_e.boundingSphere===null&&_e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let Vt=0;Vt<Dt;Vt++)this.getMatrixAt(Vt,_instanceLocalMatrix),_sphere$3.copy(_e.boundingSphere).applyMatrix4(_instanceLocalMatrix),this.boundingSphere.union(_sphere$3)}copy(_e,Dt){return super.copy(_e,Dt),this.instanceMatrix.copy(_e.instanceMatrix),_e.morphTexture!==null&&(this.morphTexture=_e.morphTexture.clone()),_e.instanceColor!==null&&(this.instanceColor=_e.instanceColor.clone()),this.count=_e.count,_e.boundingBox!==null&&(this.boundingBox=_e.boundingBox.clone()),_e.boundingSphere!==null&&(this.boundingSphere=_e.boundingSphere.clone()),this}getColorAt(_e,Dt){Dt.fromArray(this.instanceColor.array,_e*3)}getMatrixAt(_e,Dt){Dt.fromArray(this.instanceMatrix.array,_e*16)}getMorphAt(_e,Dt){const Vt=Dt.morphTargetInfluences,Gt=this.morphTexture.source.data.data,zt=Vt.length+1,jt=_e*zt+1;for(let Ht=0;Ht<Vt.length;Ht++)Vt[Ht]=Gt[jt+Ht]}raycast(_e,Dt){const Vt=this.matrixWorld,Gt=this.count;if(_mesh$1.geometry=this.geometry,_mesh$1.material=this.material,_mesh$1.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_sphere$3.copy(this.boundingSphere),_sphere$3.applyMatrix4(Vt),_e.ray.intersectsSphere(_sphere$3)!==!1))for(let zt=0;zt<Gt;zt++){this.getMatrixAt(zt,_instanceLocalMatrix),_instanceWorldMatrix.multiplyMatrices(Vt,_instanceLocalMatrix),_mesh$1.matrixWorld=_instanceWorldMatrix,_mesh$1.raycast(_e,_instanceIntersects);for(let jt=0,Ht=_instanceIntersects.length;jt<Ht;jt++){const Wt=_instanceIntersects[jt];Wt.instanceId=zt,Wt.object=this,Dt.push(Wt)}_instanceIntersects.length=0}}setColorAt(_e,Dt){this.instanceColor===null&&(this.instanceColor=new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count*3),3)),Dt.toArray(this.instanceColor.array,_e*3)}setMatrixAt(_e,Dt){Dt.toArray(this.instanceMatrix.array,_e*16)}setMorphAt(_e,Dt){const Vt=Dt.morphTargetInfluences,Gt=Vt.length+1;this.morphTexture===null&&(this.morphTexture=new DataTexture(new Float32Array(Gt*this.count),Gt,this.count,RedFormat,FloatType));const zt=this.morphTexture.source.data.data;let jt=0;for(let qt=0;qt<Vt.length;qt++)jt+=Vt[qt];const Ht=this.geometry.morphTargetsRelative?1:1-jt,Wt=Gt*_e;zt[Wt]=Ht,zt.set(Vt,Wt+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function sortOpaque(kt,_e){return kt.z-_e.z}function sortTransparent(kt,_e){return _e.z-kt.z}class MultiDrawRenderList{constructor(){this.index=0,this.pool=[],this.list=[]}push(_e,Dt){const Vt=this.pool,Gt=this.list;this.index>=Vt.length&&Vt.push({start:-1,count:-1,z:-1});const zt=Vt[this.index];Gt.push(zt),this.index++,zt.start=_e.start,zt.count=_e.count,zt.z=Dt}reset(){this.list.length=0,this.index=0}}const ID_ATTR_NAME="batchId",_matrix$1=new Matrix4,_invMatrixWorld=new Matrix4,_identityMatrix$2=new Matrix4,_projScreenMatrix$2=new Matrix4,_frustum=new Frustum,_box$1=new Box3,_sphere$2=new Sphere,_vector$5=new Vector3,_renderList=new MultiDrawRenderList,_mesh=new Mesh,_batchIntersects=[];function copyAttributeData(kt,_e,Dt=0){const Vt=_e.itemSize;if(kt.isInterleavedBufferAttribute||kt.array.constructor!==_e.array.constructor){const Gt=kt.count;for(let zt=0;zt<Gt;zt++)for(let jt=0;jt<Vt;jt++)_e.setComponent(zt+Dt,jt,kt.getComponent(zt,jt))}else _e.array.set(kt.array,Dt*Vt);_e.needsUpdate=!0}class BatchedMesh extends Mesh{get maxGeometryCount(){return this._maxGeometryCount}constructor(_e,Dt,Vt=Dt*2,Gt){super(new BufferGeometry,Gt),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=_e,this._maxVertexCount=Dt,this._maxIndexCount=Vt,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(_e),this._multiDrawStarts=new Int32Array(_e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let _e=Math.sqrt(this._maxGeometryCount*4);_e=Math.ceil(_e/4)*4,_e=Math.max(_e,4);const Dt=new Float32Array(_e*_e*4),Vt=new DataTexture(Dt,_e,_e,RGBAFormat,FloatType);this._matricesTexture=Vt}_initializeGeometry(_e){const Dt=this.geometry,Vt=this._maxVertexCount,Gt=this._maxGeometryCount,zt=this._maxIndexCount;if(this._geometryInitialized===!1){for(const Ht in _e.attributes){const Wt=_e.getAttribute(Ht),{array:qt,itemSize:Xt,normalized:Kt}=Wt,Yt=new qt.constructor(Vt*Xt),Zt=new BufferAttribute(Yt,Xt,Kt);Dt.setAttribute(Ht,Zt)}if(_e.getIndex()!==null){const Ht=Vt>65536?new Uint32Array(zt):new Uint16Array(zt);Dt.setIndex(new BufferAttribute(Ht,1))}const jt=Gt>65536?new Uint32Array(Vt):new Uint16Array(Vt);Dt.setAttribute(ID_ATTR_NAME,new BufferAttribute(jt,1)),this._geometryInitialized=!0}}_validateGeometry(_e){if(_e.getAttribute(ID_ATTR_NAME))throw new Error(`BatchedMesh: Geometry cannot use attribute "${ID_ATTR_NAME}"`);const Dt=this.geometry;if(!!_e.getIndex()!=!!Dt.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const Vt in Dt.attributes){if(Vt===ID_ATTR_NAME)continue;if(!_e.hasAttribute(Vt))throw new Error(`BatchedMesh: Added geometry missing "${Vt}". All geometries must have consistent attributes.`);const Gt=_e.getAttribute(Vt),zt=Dt.getAttribute(Vt);if(Gt.itemSize!==zt.itemSize||Gt.normalized!==zt.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(_e){return this.customSort=_e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Box3);const _e=this._geometryCount,Dt=this.boundingBox,Vt=this._active;Dt.makeEmpty();for(let Gt=0;Gt<_e;Gt++)Vt[Gt]!==!1&&(this.getMatrixAt(Gt,_matrix$1),this.getBoundingBoxAt(Gt,_box$1).applyMatrix4(_matrix$1),Dt.union(_box$1))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Sphere);const _e=this._geometryCount,Dt=this.boundingSphere,Vt=this._active;Dt.makeEmpty();for(let Gt=0;Gt<_e;Gt++)Vt[Gt]!==!1&&(this.getMatrixAt(Gt,_matrix$1),this.getBoundingSphereAt(Gt,_sphere$2).applyMatrix4(_matrix$1),Dt.union(_sphere$2))}addGeometry(_e,Dt=-1,Vt=-1){if(this._initializeGeometry(_e),this._validateGeometry(_e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const Gt={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let zt=null;const jt=this._reservedRanges,Ht=this._drawRanges,Wt=this._bounds;this._geometryCount!==0&&(zt=jt[jt.length-1]),Dt===-1?Gt.vertexCount=_e.getAttribute("position").count:Gt.vertexCount=Dt,zt===null?Gt.vertexStart=0:Gt.vertexStart=zt.vertexStart+zt.vertexCount;const qt=_e.getIndex(),Xt=qt!==null;if(Xt&&(Vt===-1?Gt.indexCount=qt.count:Gt.indexCount=Vt,zt===null?Gt.indexStart=0:Gt.indexStart=zt.indexStart+zt.indexCount),Gt.indexStart!==-1&&Gt.indexStart+Gt.indexCount>this._maxIndexCount||Gt.vertexStart+Gt.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const Kt=this._visibility,Yt=this._active,Zt=this._matricesTexture,Jt=this._matricesTexture.image.data;Kt.push(!0),Yt.push(!0);const nn=this._geometryCount;this._geometryCount++,_identityMatrix$2.toArray(Jt,nn*16),Zt.needsUpdate=!0,jt.push(Gt),Ht.push({start:Xt?Gt.indexStart:Gt.vertexStart,count:-1}),Wt.push({boxInitialized:!1,box:new Box3,sphereInitialized:!1,sphere:new Sphere});const rn=this.geometry.getAttribute(ID_ATTR_NAME);for(let Qt=0;Qt<Gt.vertexCount;Qt++)rn.setX(Gt.vertexStart+Qt,nn);return rn.needsUpdate=!0,this.setGeometryAt(nn,_e),nn}setGeometryAt(_e,Dt){if(_e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(Dt);const Vt=this.geometry,Gt=Vt.getIndex()!==null,zt=Vt.getIndex(),jt=Dt.getIndex(),Ht=this._reservedRanges[_e];if(Gt&&jt.count>Ht.indexCount||Dt.attributes.position.count>Ht.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const Wt=Ht.vertexStart,qt=Ht.vertexCount;for(const Zt in Vt.attributes){if(Zt===ID_ATTR_NAME)continue;const Jt=Dt.getAttribute(Zt),nn=Vt.getAttribute(Zt);copyAttributeData(Jt,nn,Wt);const rn=Jt.itemSize;for(let Qt=Jt.count,en=qt;Qt<en;Qt++){const tn=Wt+Qt;for(let sn=0;sn<rn;sn++)nn.setComponent(tn,sn,0)}nn.needsUpdate=!0,nn.addUpdateRange(Wt*rn,qt*rn)}if(Gt){const Zt=Ht.indexStart;for(let Jt=0;Jt<jt.count;Jt++)zt.setX(Zt+Jt,Wt+jt.getX(Jt));for(let Jt=jt.count,nn=Ht.indexCount;Jt<nn;Jt++)zt.setX(Zt+Jt,Wt);zt.needsUpdate=!0,zt.addUpdateRange(Zt,Ht.indexCount)}const Xt=this._bounds[_e];Dt.boundingBox!==null?(Xt.box.copy(Dt.boundingBox),Xt.boxInitialized=!0):Xt.boxInitialized=!1,Dt.boundingSphere!==null?(Xt.sphere.copy(Dt.boundingSphere),Xt.sphereInitialized=!0):Xt.sphereInitialized=!1;const Kt=this._drawRanges[_e],Yt=Dt.getAttribute("position");return Kt.count=Gt?jt.count:Yt.count,this._visibilityChanged=!0,_e}deleteGeometry(_e){const Dt=this._active;return _e>=Dt.length||Dt[_e]===!1?this:(Dt[_e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(_e,Dt){if(this._active[_e]===!1)return null;const Gt=this._bounds[_e],zt=Gt.box,jt=this.geometry;if(Gt.boxInitialized===!1){zt.makeEmpty();const Ht=jt.index,Wt=jt.attributes.position,qt=this._drawRanges[_e];for(let Xt=qt.start,Kt=qt.start+qt.count;Xt<Kt;Xt++){let Yt=Xt;Ht&&(Yt=Ht.getX(Yt)),zt.expandByPoint(_vector$5.fromBufferAttribute(Wt,Yt))}Gt.boxInitialized=!0}return Dt.copy(zt),Dt}getBoundingSphereAt(_e,Dt){if(this._active[_e]===!1)return null;const Gt=this._bounds[_e],zt=Gt.sphere,jt=this.geometry;if(Gt.sphereInitialized===!1){zt.makeEmpty(),this.getBoundingBoxAt(_e,_box$1),_box$1.getCenter(zt.center);const Ht=jt.index,Wt=jt.attributes.position,qt=this._drawRanges[_e];let Xt=0;for(let Kt=qt.start,Yt=qt.start+qt.count;Kt<Yt;Kt++){let Zt=Kt;Ht&&(Zt=Ht.getX(Zt)),_vector$5.fromBufferAttribute(Wt,Zt),Xt=Math.max(Xt,zt.center.distanceToSquared(_vector$5))}zt.radius=Math.sqrt(Xt),Gt.sphereInitialized=!0}return Dt.copy(zt),Dt}setMatrixAt(_e,Dt){const Vt=this._active,Gt=this._matricesTexture,zt=this._matricesTexture.image.data,jt=this._geometryCount;return _e>=jt||Vt[_e]===!1?this:(Dt.toArray(zt,_e*16),Gt.needsUpdate=!0,this)}getMatrixAt(_e,Dt){const Vt=this._active,Gt=this._matricesTexture.image.data,zt=this._geometryCount;return _e>=zt||Vt[_e]===!1?null:Dt.fromArray(Gt,_e*16)}setVisibleAt(_e,Dt){const Vt=this._visibility,Gt=this._active,zt=this._geometryCount;return _e>=zt||Gt[_e]===!1||Vt[_e]===Dt?this:(Vt[_e]=Dt,this._visibilityChanged=!0,this)}getVisibleAt(_e){const Dt=this._visibility,Vt=this._active,Gt=this._geometryCount;return _e>=Gt||Vt[_e]===!1?!1:Dt[_e]}raycast(_e,Dt){const Vt=this._visibility,Gt=this._active,zt=this._drawRanges,jt=this._geometryCount,Ht=this.matrixWorld,Wt=this.geometry;_mesh.material=this.material,_mesh.geometry.index=Wt.index,_mesh.geometry.attributes=Wt.attributes,_mesh.geometry.boundingBox===null&&(_mesh.geometry.boundingBox=new Box3),_mesh.geometry.boundingSphere===null&&(_mesh.geometry.boundingSphere=new Sphere);for(let qt=0;qt<jt;qt++){if(!Vt[qt]||!Gt[qt])continue;const Xt=zt[qt];_mesh.geometry.setDrawRange(Xt.start,Xt.count),this.getMatrixAt(qt,_mesh.matrixWorld).premultiply(Ht),this.getBoundingBoxAt(qt,_mesh.geometry.boundingBox),this.getBoundingSphereAt(qt,_mesh.geometry.boundingSphere),_mesh.raycast(_e,_batchIntersects);for(let Kt=0,Yt=_batchIntersects.length;Kt<Yt;Kt++){const Zt=_batchIntersects[Kt];Zt.object=this,Zt.batchId=qt,Dt.push(Zt)}_batchIntersects.length=0}_mesh.material=null,_mesh.geometry.index=null,_mesh.geometry.attributes={},_mesh.geometry.setDrawRange(0,1/0)}copy(_e){return super.copy(_e),this.geometry=_e.geometry.clone(),this.perObjectFrustumCulled=_e.perObjectFrustumCulled,this.sortObjects=_e.sortObjects,this.boundingBox=_e.boundingBox!==null?_e.boundingBox.clone():null,this.boundingSphere=_e.boundingSphere!==null?_e.boundingSphere.clone():null,this._drawRanges=_e._drawRanges.map(Dt=>({...Dt})),this._reservedRanges=_e._reservedRanges.map(Dt=>({...Dt})),this._visibility=_e._visibility.slice(),this._active=_e._active.slice(),this._bounds=_e._bounds.map(Dt=>({boxInitialized:Dt.boxInitialized,box:Dt.box.clone(),sphereInitialized:Dt.sphereInitialized,sphere:Dt.sphere.clone()})),this._maxGeometryCount=_e._maxGeometryCount,this._maxVertexCount=_e._maxVertexCount,this._maxIndexCount=_e._maxIndexCount,this._geometryInitialized=_e._geometryInitialized,this._geometryCount=_e._geometryCount,this._multiDrawCounts=_e._multiDrawCounts.slice(),this._multiDrawStarts=_e._multiDrawStarts.slice(),this._matricesTexture=_e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(_e,Dt,Vt,Gt,zt){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const jt=Gt.getIndex(),Ht=jt===null?1:jt.array.BYTES_PER_ELEMENT,Wt=this._active,qt=this._visibility,Xt=this._multiDrawStarts,Kt=this._multiDrawCounts,Yt=this._drawRanges,Zt=this.perObjectFrustumCulled;Zt&&(_projScreenMatrix$2.multiplyMatrices(Vt.projectionMatrix,Vt.matrixWorldInverse).multiply(this.matrixWorld),_frustum.setFromProjectionMatrix(_projScreenMatrix$2,_e.coordinateSystem));let Jt=0;if(this.sortObjects){_invMatrixWorld.copy(this.matrixWorld).invert(),_vector$5.setFromMatrixPosition(Vt.matrixWorld).applyMatrix4(_invMatrixWorld);for(let Qt=0,en=qt.length;Qt<en;Qt++)if(qt[Qt]&&Wt[Qt]){this.getMatrixAt(Qt,_matrix$1),this.getBoundingSphereAt(Qt,_sphere$2).applyMatrix4(_matrix$1);let tn=!1;if(Zt&&(tn=!_frustum.intersectsSphere(_sphere$2)),!tn){const sn=_vector$5.distanceTo(_sphere$2.center);_renderList.push(Yt[Qt],sn)}}const nn=_renderList.list,rn=this.customSort;rn===null?nn.sort(zt.transparent?sortTransparent:sortOpaque):rn.call(this,nn,Vt);for(let Qt=0,en=nn.length;Qt<en;Qt++){const tn=nn[Qt];Xt[Jt]=tn.start*Ht,Kt[Jt]=tn.count,Jt++}_renderList.reset()}else for(let nn=0,rn=qt.length;nn<rn;nn++)if(qt[nn]&&Wt[nn]){let Qt=!1;if(Zt&&(this.getMatrixAt(nn,_matrix$1),this.getBoundingSphereAt(nn,_sphere$2).applyMatrix4(_matrix$1),Qt=!_frustum.intersectsSphere(_sphere$2)),!Qt){const en=Yt[nn];Xt[Jt]=en.start*Ht,Kt[Jt]=en.count,Jt++}}this._multiDrawCount=Jt,this._visibilityChanged=!1}onBeforeShadow(_e,Dt,Vt,Gt,zt,jt){this.onBeforeRender(_e,null,Gt,zt,jt)}}class LineBasicMaterial extends Material{constructor(_e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color$1(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.map=_e.map,this.linewidth=_e.linewidth,this.linecap=_e.linecap,this.linejoin=_e.linejoin,this.fog=_e.fog,this}}const _start$1=new Vector3,_end$1=new Vector3,_inverseMatrix$1=new Matrix4,_ray$1=new Ray,_sphere$1=new Sphere;class Line extends Object3D{constructor(_e=new BufferGeometry,Dt=new LineBasicMaterial){super(),this.isLine=!0,this.type="Line",this.geometry=_e,this.material=Dt,this.updateMorphTargets()}copy(_e,Dt){return super.copy(_e,Dt),this.material=Array.isArray(_e.material)?_e.material.slice():_e.material,this.geometry=_e.geometry,this}computeLineDistances(){const _e=this.geometry;if(_e.index===null){const Dt=_e.attributes.position,Vt=[0];for(let Gt=1,zt=Dt.count;Gt<zt;Gt++)_start$1.fromBufferAttribute(Dt,Gt-1),_end$1.fromBufferAttribute(Dt,Gt),Vt[Gt]=Vt[Gt-1],Vt[Gt]+=_start$1.distanceTo(_end$1);_e.setAttribute("lineDistance",new Float32BufferAttribute(Vt,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(_e,Dt){const Vt=this.geometry,Gt=this.matrixWorld,zt=_e.params.Line.threshold,jt=Vt.drawRange;if(Vt.boundingSphere===null&&Vt.computeBoundingSphere(),_sphere$1.copy(Vt.boundingSphere),_sphere$1.applyMatrix4(Gt),_sphere$1.radius+=zt,_e.ray.intersectsSphere(_sphere$1)===!1)return;_inverseMatrix$1.copy(Gt).invert(),_ray$1.copy(_e.ray).applyMatrix4(_inverseMatrix$1);const Ht=zt/((this.scale.x+this.scale.y+this.scale.z)/3),Wt=Ht*Ht,qt=new Vector3,Xt=new Vector3,Kt=new Vector3,Yt=new Vector3,Zt=this.isLineSegments?2:1,Jt=Vt.index,rn=Vt.attributes.position;if(Jt!==null){const Qt=Math.max(0,jt.start),en=Math.min(Jt.count,jt.start+jt.count);for(let tn=Qt,sn=en-1;tn<sn;tn+=Zt){const cn=Jt.getX(tn),un=Jt.getX(tn+1);if(qt.fromBufferAttribute(rn,cn),Xt.fromBufferAttribute(rn,un),_ray$1.distanceSqToSegment(qt,Xt,Yt,Kt)>Wt)continue;Yt.applyMatrix4(this.matrixWorld);const fn=_e.ray.origin.distanceTo(Yt);fn<_e.near||fn>_e.far||Dt.push({distance:fn,point:Kt.clone().applyMatrix4(this.matrixWorld),index:tn,face:null,faceIndex:null,object:this})}}else{const Qt=Math.max(0,jt.start),en=Math.min(rn.count,jt.start+jt.count);for(let tn=Qt,sn=en-1;tn<sn;tn+=Zt){if(qt.fromBufferAttribute(rn,tn),Xt.fromBufferAttribute(rn,tn+1),_ray$1.distanceSqToSegment(qt,Xt,Yt,Kt)>Wt)continue;Yt.applyMatrix4(this.matrixWorld);const un=_e.ray.origin.distanceTo(Yt);un<_e.near||un>_e.far||Dt.push({distance:un,point:Kt.clone().applyMatrix4(this.matrixWorld),index:tn,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const Dt=this.geometry.morphAttributes,Vt=Object.keys(Dt);if(Vt.length>0){const Gt=Dt[Vt[0]];if(Gt!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let zt=0,jt=Gt.length;zt<jt;zt++){const Ht=Gt[zt].name||String(zt);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Ht]=zt}}}}}const _start=new Vector3,_end=new Vector3;class LineSegments extends Line{constructor(_e,Dt){super(_e,Dt),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const _e=this.geometry;if(_e.index===null){const Dt=_e.attributes.position,Vt=[];for(let Gt=0,zt=Dt.count;Gt<zt;Gt+=2)_start.fromBufferAttribute(Dt,Gt),_end.fromBufferAttribute(Dt,Gt+1),Vt[Gt]=Gt===0?0:Vt[Gt-1],Vt[Gt+1]=Vt[Gt]+_start.distanceTo(_end);_e.setAttribute("lineDistance",new Float32BufferAttribute(Vt,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class LineLoop extends Line{constructor(_e,Dt){super(_e,Dt),this.isLineLoop=!0,this.type="LineLoop"}}class PointsMaterial extends Material{constructor(_e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color$1(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.map=_e.map,this.alphaMap=_e.alphaMap,this.size=_e.size,this.sizeAttenuation=_e.sizeAttenuation,this.fog=_e.fog,this}}const _inverseMatrix=new Matrix4,_ray=new Ray,_sphere$7=new Sphere,_position$2=new Vector3;class Points extends Object3D{constructor(_e=new BufferGeometry,Dt=new PointsMaterial){super(),this.isPoints=!0,this.type="Points",this.geometry=_e,this.material=Dt,this.updateMorphTargets()}copy(_e,Dt){return super.copy(_e,Dt),this.material=Array.isArray(_e.material)?_e.material.slice():_e.material,this.geometry=_e.geometry,this}raycast(_e,Dt){const Vt=this.geometry,Gt=this.matrixWorld,zt=_e.params.Points.threshold,jt=Vt.drawRange;if(Vt.boundingSphere===null&&Vt.computeBoundingSphere(),_sphere$7.copy(Vt.boundingSphere),_sphere$7.applyMatrix4(Gt),_sphere$7.radius+=zt,_e.ray.intersectsSphere(_sphere$7)===!1)return;_inverseMatrix.copy(Gt).invert(),_ray.copy(_e.ray).applyMatrix4(_inverseMatrix);const Ht=zt/((this.scale.x+this.scale.y+this.scale.z)/3),Wt=Ht*Ht,qt=Vt.index,Kt=Vt.attributes.position;if(qt!==null){const Yt=Math.max(0,jt.start),Zt=Math.min(qt.count,jt.start+jt.count);for(let Jt=Yt,nn=Zt;Jt<nn;Jt++){const rn=qt.getX(Jt);_position$2.fromBufferAttribute(Kt,rn),testPoint(_position$2,rn,Wt,Gt,_e,Dt,this)}}else{const Yt=Math.max(0,jt.start),Zt=Math.min(Kt.count,jt.start+jt.count);for(let Jt=Yt,nn=Zt;Jt<nn;Jt++)_position$2.fromBufferAttribute(Kt,Jt),testPoint(_position$2,Jt,Wt,Gt,_e,Dt,this)}}updateMorphTargets(){const Dt=this.geometry.morphAttributes,Vt=Object.keys(Dt);if(Vt.length>0){const Gt=Dt[Vt[0]];if(Gt!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let zt=0,jt=Gt.length;zt<jt;zt++){const Ht=Gt[zt].name||String(zt);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Ht]=zt}}}}}function testPoint(kt,_e,Dt,Vt,Gt,zt,jt){const Ht=_ray.distanceSqToPoint(kt);if(Ht<Dt){const Wt=new Vector3;_ray.closestPointToPoint(kt,Wt),Wt.applyMatrix4(Vt);const qt=Gt.ray.origin.distanceTo(Wt);if(qt<Gt.near||qt>Gt.far)return;zt.push({distance:qt,distanceToRay:Math.sqrt(Ht),point:Wt,index:_e,face:null,object:jt})}}class VideoTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt){super(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt),this.isVideoTexture=!0,this.minFilter=jt!==void 0?jt:LinearFilter,this.magFilter=zt!==void 0?zt:LinearFilter,this.generateMipmaps=!1;const Xt=this;function Kt(){Xt.needsUpdate=!0,_e.requestVideoFrameCallback(Kt)}"requestVideoFrameCallback"in _e&&_e.requestVideoFrameCallback(Kt)}clone(){return new this.constructor(this.image).copy(this)}update(){const _e=this.image;"requestVideoFrameCallback"in _e===!1&&_e.readyState>=_e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class FramebufferTexture extends Texture{constructor(_e,Dt){super({width:_e,height:Dt}),this.isFramebufferTexture=!0,this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.generateMipmaps=!1,this.needsUpdate=!0}}class CompressedTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt,Xt,Kt,Yt){super(null,jt,Ht,Wt,qt,Xt,Gt,zt,Kt,Yt),this.isCompressedTexture=!0,this.image={width:Dt,height:Vt},this.mipmaps=_e,this.flipY=!1,this.generateMipmaps=!1}}class CompressedArrayTexture extends CompressedTexture{constructor(_e,Dt,Vt,Gt,zt,jt){super(_e,Dt,Vt,zt,jt),this.isCompressedArrayTexture=!0,this.image.depth=Gt,this.wrapR=ClampToEdgeWrapping}}class CompressedCubeTexture extends CompressedTexture{constructor(_e,Dt,Vt){super(void 0,_e[0].width,_e[0].height,Dt,Vt,CubeReflectionMapping),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=_e}}class CanvasTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt){super(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Curve{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(_e,Dt){const Vt=this.getUtoTmapping(_e);return this.getPoint(Vt,Dt)}getPoints(_e=5){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPoint(Vt/_e));return Dt}getSpacedPoints(_e=5){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPointAt(Vt/_e));return Dt}getLength(){const _e=this.getLengths();return _e[_e.length-1]}getLengths(_e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===_e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const Dt=[];let Vt,Gt=this.getPoint(0),zt=0;Dt.push(0);for(let jt=1;jt<=_e;jt++)Vt=this.getPoint(jt/_e),zt+=Vt.distanceTo(Gt),Dt.push(zt),Gt=Vt;return this.cacheArcLengths=Dt,Dt}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(_e,Dt){const Vt=this.getLengths();let Gt=0;const zt=Vt.length;let jt;Dt?jt=Dt:jt=_e*Vt[zt-1];let Ht=0,Wt=zt-1,qt;for(;Ht<=Wt;)if(Gt=Math.floor(Ht+(Wt-Ht)/2),qt=Vt[Gt]-jt,qt<0)Ht=Gt+1;else if(qt>0)Wt=Gt-1;else{Wt=Gt;break}if(Gt=Wt,Vt[Gt]===jt)return Gt/(zt-1);const Xt=Vt[Gt],Yt=Vt[Gt+1]-Xt,Zt=(jt-Xt)/Yt;return(Gt+Zt)/(zt-1)}getTangent(_e,Dt){let Gt=_e-1e-4,zt=_e+1e-4;Gt<0&&(Gt=0),zt>1&&(zt=1);const jt=this.getPoint(Gt),Ht=this.getPoint(zt),Wt=Dt||(jt.isVector2?new Vector2:new Vector3);return Wt.copy(Ht).sub(jt).normalize(),Wt}getTangentAt(_e,Dt){const Vt=this.getUtoTmapping(_e);return this.getTangent(Vt,Dt)}computeFrenetFrames(_e,Dt){const Vt=new Vector3,Gt=[],zt=[],jt=[],Ht=new Vector3,Wt=new Matrix4;for(let Zt=0;Zt<=_e;Zt++){const Jt=Zt/_e;Gt[Zt]=this.getTangentAt(Jt,new Vector3)}zt[0]=new Vector3,jt[0]=new Vector3;let qt=Number.MAX_VALUE;const Xt=Math.abs(Gt[0].x),Kt=Math.abs(Gt[0].y),Yt=Math.abs(Gt[0].z);Xt<=qt&&(qt=Xt,Vt.set(1,0,0)),Kt<=qt&&(qt=Kt,Vt.set(0,1,0)),Yt<=qt&&Vt.set(0,0,1),Ht.crossVectors(Gt[0],Vt).normalize(),zt[0].crossVectors(Gt[0],Ht),jt[0].crossVectors(Gt[0],zt[0]);for(let Zt=1;Zt<=_e;Zt++){if(zt[Zt]=zt[Zt-1].clone(),jt[Zt]=jt[Zt-1].clone(),Ht.crossVectors(Gt[Zt-1],Gt[Zt]),Ht.length()>Number.EPSILON){Ht.normalize();const Jt=Math.acos(clamp$2(Gt[Zt-1].dot(Gt[Zt]),-1,1));zt[Zt].applyMatrix4(Wt.makeRotationAxis(Ht,Jt))}jt[Zt].crossVectors(Gt[Zt],zt[Zt])}if(Dt===!0){let Zt=Math.acos(clamp$2(zt[0].dot(zt[_e]),-1,1));Zt/=_e,Gt[0].dot(Ht.crossVectors(zt[0],zt[_e]))>0&&(Zt=-Zt);for(let Jt=1;Jt<=_e;Jt++)zt[Jt].applyMatrix4(Wt.makeRotationAxis(Gt[Jt],Zt*Jt)),jt[Jt].crossVectors(Gt[Jt],zt[Jt])}return{tangents:Gt,normals:zt,binormals:jt}}clone(){return new this.constructor().copy(this)}copy(_e){return this.arcLengthDivisions=_e.arcLengthDivisions,this}toJSON(){const _e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return _e.arcLengthDivisions=this.arcLengthDivisions,_e.type=this.type,_e}fromJSON(_e){return this.arcLengthDivisions=_e.arcLengthDivisions,this}}class EllipseCurve extends Curve{constructor(_e=0,Dt=0,Vt=1,Gt=1,zt=0,jt=Math.PI*2,Ht=!1,Wt=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=_e,this.aY=Dt,this.xRadius=Vt,this.yRadius=Gt,this.aStartAngle=zt,this.aEndAngle=jt,this.aClockwise=Ht,this.aRotation=Wt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=Math.PI*2;let zt=this.aEndAngle-this.aStartAngle;const jt=Math.abs(zt)<Number.EPSILON;for(;zt<0;)zt+=Gt;for(;zt>Gt;)zt-=Gt;zt<Number.EPSILON&&(jt?zt=0:zt=Gt),this.aClockwise===!0&&!jt&&(zt===Gt?zt=-Gt:zt=zt-Gt);const Ht=this.aStartAngle+_e*zt;let Wt=this.aX+this.xRadius*Math.cos(Ht),qt=this.aY+this.yRadius*Math.sin(Ht);if(this.aRotation!==0){const Xt=Math.cos(this.aRotation),Kt=Math.sin(this.aRotation),Yt=Wt-this.aX,Zt=qt-this.aY;Wt=Yt*Xt-Zt*Kt+this.aX,qt=Yt*Kt+Zt*Xt+this.aY}return Vt.set(Wt,qt)}copy(_e){return super.copy(_e),this.aX=_e.aX,this.aY=_e.aY,this.xRadius=_e.xRadius,this.yRadius=_e.yRadius,this.aStartAngle=_e.aStartAngle,this.aEndAngle=_e.aEndAngle,this.aClockwise=_e.aClockwise,this.aRotation=_e.aRotation,this}toJSON(){const _e=super.toJSON();return _e.aX=this.aX,_e.aY=this.aY,_e.xRadius=this.xRadius,_e.yRadius=this.yRadius,_e.aStartAngle=this.aStartAngle,_e.aEndAngle=this.aEndAngle,_e.aClockwise=this.aClockwise,_e.aRotation=this.aRotation,_e}fromJSON(_e){return super.fromJSON(_e),this.aX=_e.aX,this.aY=_e.aY,this.xRadius=_e.xRadius,this.yRadius=_e.yRadius,this.aStartAngle=_e.aStartAngle,this.aEndAngle=_e.aEndAngle,this.aClockwise=_e.aClockwise,this.aRotation=_e.aRotation,this}}class ArcCurve extends EllipseCurve{constructor(_e,Dt,Vt,Gt,zt,jt){super(_e,Dt,Vt,Vt,Gt,zt,jt),this.isArcCurve=!0,this.type="ArcCurve"}}function CubicPoly(){let kt=0,_e=0,Dt=0,Vt=0;function Gt(zt,jt,Ht,Wt){kt=zt,_e=Ht,Dt=-3*zt+3*jt-2*Ht-Wt,Vt=2*zt-2*jt+Ht+Wt}return{initCatmullRom:function(zt,jt,Ht,Wt,qt){Gt(jt,Ht,qt*(Ht-zt),qt*(Wt-jt))},initNonuniformCatmullRom:function(zt,jt,Ht,Wt,qt,Xt,Kt){let Yt=(jt-zt)/qt-(Ht-zt)/(qt+Xt)+(Ht-jt)/Xt,Zt=(Ht-jt)/Xt-(Wt-jt)/(Xt+Kt)+(Wt-Ht)/Kt;Yt*=Xt,Zt*=Xt,Gt(jt,Ht,Yt,Zt)},calc:function(zt){const jt=zt*zt,Ht=jt*zt;return kt+_e*zt+Dt*jt+Vt*Ht}}}const tmp=new Vector3,px=new CubicPoly,py=new CubicPoly,pz=new CubicPoly;class CatmullRomCurve3 extends Curve{constructor(_e=[],Dt=!1,Vt="centripetal",Gt=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=_e,this.closed=Dt,this.curveType=Vt,this.tension=Gt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.points,zt=Gt.length,jt=(zt-(this.closed?0:1))*_e;let Ht=Math.floor(jt),Wt=jt-Ht;this.closed?Ht+=Ht>0?0:(Math.floor(Math.abs(Ht)/zt)+1)*zt:Wt===0&&Ht===zt-1&&(Ht=zt-2,Wt=1);let qt,Xt;this.closed||Ht>0?qt=Gt[(Ht-1)%zt]:(tmp.subVectors(Gt[0],Gt[1]).add(Gt[0]),qt=tmp);const Kt=Gt[Ht%zt],Yt=Gt[(Ht+1)%zt];if(this.closed||Ht+2<zt?Xt=Gt[(Ht+2)%zt]:(tmp.subVectors(Gt[zt-1],Gt[zt-2]).add(Gt[zt-1]),Xt=tmp),this.curveType==="centripetal"||this.curveType==="chordal"){const Zt=this.curveType==="chordal"?.5:.25;let Jt=Math.pow(qt.distanceToSquared(Kt),Zt),nn=Math.pow(Kt.distanceToSquared(Yt),Zt),rn=Math.pow(Yt.distanceToSquared(Xt),Zt);nn<1e-4&&(nn=1),Jt<1e-4&&(Jt=nn),rn<1e-4&&(rn=nn),px.initNonuniformCatmullRom(qt.x,Kt.x,Yt.x,Xt.x,Jt,nn,rn),py.initNonuniformCatmullRom(qt.y,Kt.y,Yt.y,Xt.y,Jt,nn,rn),pz.initNonuniformCatmullRom(qt.z,Kt.z,Yt.z,Xt.z,Jt,nn,rn)}else this.curveType==="catmullrom"&&(px.initCatmullRom(qt.x,Kt.x,Yt.x,Xt.x,this.tension),py.initCatmullRom(qt.y,Kt.y,Yt.y,Xt.y,this.tension),pz.initCatmullRom(qt.z,Kt.z,Yt.z,Xt.z,this.tension));return Vt.set(px.calc(Wt),py.calc(Wt),pz.calc(Wt)),Vt}copy(_e){super.copy(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(Gt.clone())}return this.closed=_e.closed,this.curveType=_e.curveType,this.tension=_e.tension,this}toJSON(){const _e=super.toJSON();_e.points=[];for(let Dt=0,Vt=this.points.length;Dt<Vt;Dt++){const Gt=this.points[Dt];_e.points.push(Gt.toArray())}return _e.closed=this.closed,_e.curveType=this.curveType,_e.tension=this.tension,_e}fromJSON(_e){super.fromJSON(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(new Vector3().fromArray(Gt))}return this.closed=_e.closed,this.curveType=_e.curveType,this.tension=_e.tension,this}}function CatmullRom(kt,_e,Dt,Vt,Gt){const zt=(Vt-_e)*.5,jt=(Gt-Dt)*.5,Ht=kt*kt,Wt=kt*Ht;return(2*Dt-2*Vt+zt+jt)*Wt+(-3*Dt+3*Vt-2*zt-jt)*Ht+zt*kt+Dt}function QuadraticBezierP0(kt,_e){const Dt=1-kt;return Dt*Dt*_e}function QuadraticBezierP1(kt,_e){return 2*(1-kt)*kt*_e}function QuadraticBezierP2(kt,_e){return kt*kt*_e}function QuadraticBezier(kt,_e,Dt,Vt){return QuadraticBezierP0(kt,_e)+QuadraticBezierP1(kt,Dt)+QuadraticBezierP2(kt,Vt)}function CubicBezierP0(kt,_e){const Dt=1-kt;return Dt*Dt*Dt*_e}function CubicBezierP1(kt,_e){const Dt=1-kt;return 3*Dt*Dt*kt*_e}function CubicBezierP2(kt,_e){return 3*(1-kt)*kt*kt*_e}function CubicBezierP3(kt,_e){return kt*kt*kt*_e}function CubicBezier(kt,_e,Dt,Vt,Gt){return CubicBezierP0(kt,_e)+CubicBezierP1(kt,Dt)+CubicBezierP2(kt,Vt)+CubicBezierP3(kt,Gt)}class CubicBezierCurve extends Curve{constructor(_e=new Vector2,Dt=new Vector2,Vt=new Vector2,Gt=new Vector2){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=_e,this.v1=Dt,this.v2=Vt,this.v3=Gt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2,Ht=this.v3;return Vt.set(CubicBezier(_e,Gt.x,zt.x,jt.x,Ht.x),CubicBezier(_e,Gt.y,zt.y,jt.y,Ht.y)),Vt}copy(_e){return super.copy(_e),this.v0.copy(_e.v0),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this.v3.copy(_e.v3),this}toJSON(){const _e=super.toJSON();return _e.v0=this.v0.toArray(),_e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e.v3=this.v3.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v0.fromArray(_e.v0),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this.v3.fromArray(_e.v3),this}}class CubicBezierCurve3 extends Curve{constructor(_e=new Vector3,Dt=new Vector3,Vt=new Vector3,Gt=new Vector3){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=_e,this.v1=Dt,this.v2=Vt,this.v3=Gt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2,Ht=this.v3;return Vt.set(CubicBezier(_e,Gt.x,zt.x,jt.x,Ht.x),CubicBezier(_e,Gt.y,zt.y,jt.y,Ht.y),CubicBezier(_e,Gt.z,zt.z,jt.z,Ht.z)),Vt}copy(_e){return super.copy(_e),this.v0.copy(_e.v0),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this.v3.copy(_e.v3),this}toJSON(){const _e=super.toJSON();return _e.v0=this.v0.toArray(),_e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e.v3=this.v3.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v0.fromArray(_e.v0),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this.v3.fromArray(_e.v3),this}}class LineCurve extends Curve{constructor(_e=new Vector2,Dt=new Vector2){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=_e,this.v2=Dt}getPoint(_e,Dt=new Vector2){const Vt=Dt;return _e===1?Vt.copy(this.v2):(Vt.copy(this.v2).sub(this.v1),Vt.multiplyScalar(_e).add(this.v1)),Vt}getPointAt(_e,Dt){return this.getPoint(_e,Dt)}getTangent(_e,Dt=new Vector2){return Dt.subVectors(this.v2,this.v1).normalize()}getTangentAt(_e,Dt){return this.getTangent(_e,Dt)}copy(_e){return super.copy(_e),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this}toJSON(){const _e=super.toJSON();return _e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this}}class LineCurve3 extends Curve{constructor(_e=new Vector3,Dt=new Vector3){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=_e,this.v2=Dt}getPoint(_e,Dt=new Vector3){const Vt=Dt;return _e===1?Vt.copy(this.v2):(Vt.copy(this.v2).sub(this.v1),Vt.multiplyScalar(_e).add(this.v1)),Vt}getPointAt(_e,Dt){return this.getPoint(_e,Dt)}getTangent(_e,Dt=new Vector3){return Dt.subVectors(this.v2,this.v1).normalize()}getTangentAt(_e,Dt){return this.getTangent(_e,Dt)}copy(_e){return super.copy(_e),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this}toJSON(){const _e=super.toJSON();return _e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this}}class QuadraticBezierCurve extends Curve{constructor(_e=new Vector2,Dt=new Vector2,Vt=new Vector2){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=_e,this.v1=Dt,this.v2=Vt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2;return Vt.set(QuadraticBezier(_e,Gt.x,zt.x,jt.x),QuadraticBezier(_e,Gt.y,zt.y,jt.y)),Vt}copy(_e){return super.copy(_e),this.v0.copy(_e.v0),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this}toJSON(){const _e=super.toJSON();return _e.v0=this.v0.toArray(),_e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v0.fromArray(_e.v0),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this}}class QuadraticBezierCurve3 extends Curve{constructor(_e=new Vector3,Dt=new Vector3,Vt=new Vector3){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=_e,this.v1=Dt,this.v2=Vt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2;return Vt.set(QuadraticBezier(_e,Gt.x,zt.x,jt.x),QuadraticBezier(_e,Gt.y,zt.y,jt.y),QuadraticBezier(_e,Gt.z,zt.z,jt.z)),Vt}copy(_e){return super.copy(_e),this.v0.copy(_e.v0),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this}toJSON(){const _e=super.toJSON();return _e.v0=this.v0.toArray(),_e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v0.fromArray(_e.v0),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this}}class SplineCurve extends Curve{constructor(_e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=_e}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.points,zt=(Gt.length-1)*_e,jt=Math.floor(zt),Ht=zt-jt,Wt=Gt[jt===0?jt:jt-1],qt=Gt[jt],Xt=Gt[jt>Gt.length-2?Gt.length-1:jt+1],Kt=Gt[jt>Gt.length-3?Gt.length-1:jt+2];return Vt.set(CatmullRom(Ht,Wt.x,qt.x,Xt.x,Kt.x),CatmullRom(Ht,Wt.y,qt.y,Xt.y,Kt.y)),Vt}copy(_e){super.copy(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(Gt.clone())}return this}toJSON(){const _e=super.toJSON();_e.points=[];for(let Dt=0,Vt=this.points.length;Dt<Vt;Dt++){const Gt=this.points[Dt];_e.points.push(Gt.toArray())}return _e}fromJSON(_e){super.fromJSON(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(new Vector2().fromArray(Gt))}return this}}var Curves=Object.freeze({__proto__:null,ArcCurve,CatmullRomCurve3,CubicBezierCurve,CubicBezierCurve3,EllipseCurve,LineCurve,LineCurve3,QuadraticBezierCurve,QuadraticBezierCurve3,SplineCurve});class CurvePath extends Curve{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(_e){this.curves.push(_e)}closePath(){const _e=this.curves[0].getPoint(0),Dt=this.curves[this.curves.length-1].getPoint(1);if(!_e.equals(Dt)){const Vt=_e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Curves[Vt](Dt,_e))}return this}getPoint(_e,Dt){const Vt=_e*this.getLength(),Gt=this.getCurveLengths();let zt=0;for(;zt<Gt.length;){if(Gt[zt]>=Vt){const jt=Gt[zt]-Vt,Ht=this.curves[zt],Wt=Ht.getLength(),qt=Wt===0?0:1-jt/Wt;return Ht.getPointAt(qt,Dt)}zt++}return null}getLength(){const _e=this.getCurveLengths();return _e[_e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const _e=[];let Dt=0;for(let Vt=0,Gt=this.curves.length;Vt<Gt;Vt++)Dt+=this.curves[Vt].getLength(),_e.push(Dt);return this.cacheLengths=_e,_e}getSpacedPoints(_e=40){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPoint(Vt/_e));return this.autoClose&&Dt.push(Dt[0]),Dt}getPoints(_e=12){const Dt=[];let Vt;for(let Gt=0,zt=this.curves;Gt<zt.length;Gt++){const jt=zt[Gt],Ht=jt.isEllipseCurve?_e*2:jt.isLineCurve||jt.isLineCurve3?1:jt.isSplineCurve?_e*jt.points.length:_e,Wt=jt.getPoints(Ht);for(let qt=0;qt<Wt.length;qt++){const Xt=Wt[qt];Vt&&Vt.equals(Xt)||(Dt.push(Xt),Vt=Xt)}}return this.autoClose&&Dt.length>1&&!Dt[Dt.length-1].equals(Dt[0])&&Dt.push(Dt[0]),Dt}copy(_e){super.copy(_e),this.curves=[];for(let Dt=0,Vt=_e.curves.length;Dt<Vt;Dt++){const Gt=_e.curves[Dt];this.curves.push(Gt.clone())}return this.autoClose=_e.autoClose,this}toJSON(){const _e=super.toJSON();_e.autoClose=this.autoClose,_e.curves=[];for(let Dt=0,Vt=this.curves.length;Dt<Vt;Dt++){const Gt=this.curves[Dt];_e.curves.push(Gt.toJSON())}return _e}fromJSON(_e){super.fromJSON(_e),this.autoClose=_e.autoClose,this.curves=[];for(let Dt=0,Vt=_e.curves.length;Dt<Vt;Dt++){const Gt=_e.curves[Dt];this.curves.push(new Curves[Gt.type]().fromJSON(Gt))}return this}}class Path extends CurvePath{constructor(_e){super(),this.type="Path",this.currentPoint=new Vector2,_e&&this.setFromPoints(_e)}setFromPoints(_e){this.moveTo(_e[0].x,_e[0].y);for(let Dt=1,Vt=_e.length;Dt<Vt;Dt++)this.lineTo(_e[Dt].x,_e[Dt].y);return this}moveTo(_e,Dt){return this.currentPoint.set(_e,Dt),this}lineTo(_e,Dt){const Vt=new LineCurve(this.currentPoint.clone(),new Vector2(_e,Dt));return this.curves.push(Vt),this.currentPoint.set(_e,Dt),this}quadraticCurveTo(_e,Dt,Vt,Gt){const zt=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(_e,Dt),new Vector2(Vt,Gt));return this.curves.push(zt),this.currentPoint.set(Vt,Gt),this}bezierCurveTo(_e,Dt,Vt,Gt,zt,jt){const Ht=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(_e,Dt),new Vector2(Vt,Gt),new Vector2(zt,jt));return this.curves.push(Ht),this.currentPoint.set(zt,jt),this}splineThru(_e){const Dt=[this.currentPoint.clone()].concat(_e),Vt=new SplineCurve(Dt);return this.curves.push(Vt),this.currentPoint.copy(_e[_e.length-1]),this}arc(_e,Dt,Vt,Gt,zt,jt){const Ht=this.currentPoint.x,Wt=this.currentPoint.y;return this.absarc(_e+Ht,Dt+Wt,Vt,Gt,zt,jt),this}absarc(_e,Dt,Vt,Gt,zt,jt){return this.absellipse(_e,Dt,Vt,Vt,Gt,zt,jt),this}ellipse(_e,Dt,Vt,Gt,zt,jt,Ht,Wt){const qt=this.currentPoint.x,Xt=this.currentPoint.y;return this.absellipse(_e+qt,Dt+Xt,Vt,Gt,zt,jt,Ht,Wt),this}absellipse(_e,Dt,Vt,Gt,zt,jt,Ht,Wt){const qt=new EllipseCurve(_e,Dt,Vt,Gt,zt,jt,Ht,Wt);if(this.curves.length>0){const Kt=qt.getPoint(0);Kt.equals(this.currentPoint)||this.lineTo(Kt.x,Kt.y)}this.curves.push(qt);const Xt=qt.getPoint(1);return this.currentPoint.copy(Xt),this}copy(_e){return super.copy(_e),this.currentPoint.copy(_e.currentPoint),this}toJSON(){const _e=super.toJSON();return _e.currentPoint=this.currentPoint.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.currentPoint.fromArray(_e.currentPoint),this}}class LatheGeometry extends BufferGeometry{constructor(_e=[new Vector2(0,-.5),new Vector2(.5,0),new Vector2(0,.5)],Dt=12,Vt=0,Gt=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:_e,segments:Dt,phiStart:Vt,phiLength:Gt},Dt=Math.floor(Dt),Gt=clamp$2(Gt,0,Math.PI*2);const zt=[],jt=[],Ht=[],Wt=[],qt=[],Xt=1/Dt,Kt=new Vector3,Yt=new Vector2,Zt=new Vector3,Jt=new Vector3,nn=new Vector3;let rn=0,Qt=0;for(let en=0;en<=_e.length-1;en++)switch(en){case 0:rn=_e[en+1].x-_e[en].x,Qt=_e[en+1].y-_e[en].y,Zt.x=Qt*1,Zt.y=-rn,Zt.z=Qt*0,nn.copy(Zt),Zt.normalize(),Wt.push(Zt.x,Zt.y,Zt.z);break;case _e.length-1:Wt.push(nn.x,nn.y,nn.z);break;default:rn=_e[en+1].x-_e[en].x,Qt=_e[en+1].y-_e[en].y,Zt.x=Qt*1,Zt.y=-rn,Zt.z=Qt*0,Jt.copy(Zt),Zt.x+=nn.x,Zt.y+=nn.y,Zt.z+=nn.z,Zt.normalize(),Wt.push(Zt.x,Zt.y,Zt.z),nn.copy(Jt)}for(let en=0;en<=Dt;en++){const tn=Vt+en*Xt*Gt,sn=Math.sin(tn),cn=Math.cos(tn);for(let un=0;un<=_e.length-1;un++){Kt.x=_e[un].x*sn,Kt.y=_e[un].y,Kt.z=_e[un].x*cn,jt.push(Kt.x,Kt.y,Kt.z),Yt.x=en/Dt,Yt.y=un/(_e.length-1),Ht.push(Yt.x,Yt.y);const hn=Wt[3*un+0]*sn,fn=Wt[3*un+1],pn=Wt[3*un+0]*cn;qt.push(hn,fn,pn)}}for(let en=0;en<Dt;en++)for(let tn=0;tn<_e.length-1;tn++){const sn=tn+en*_e.length,cn=sn,un=sn+_e.length,hn=sn+_e.length+1,fn=sn+1;zt.push(cn,un,fn),zt.push(hn,fn,un)}this.setIndex(zt),this.setAttribute("position",new Float32BufferAttribute(jt,3)),this.setAttribute("uv",new Float32BufferAttribute(Ht,2)),this.setAttribute("normal",new Float32BufferAttribute(qt,3))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new LatheGeometry(_e.points,_e.segments,_e.phiStart,_e.phiLength)}}class CapsuleGeometry extends LatheGeometry{constructor(_e=1,Dt=1,Vt=4,Gt=8){const zt=new Path;zt.absarc(0,-Dt/2,_e,Math.PI*1.5,0),zt.absarc(0,Dt/2,_e,0,Math.PI*.5),super(zt.getPoints(Vt),Gt),this.type="CapsuleGeometry",this.parameters={radius:_e,length:Dt,capSegments:Vt,radialSegments:Gt}}static fromJSON(_e){return new CapsuleGeometry(_e.radius,_e.length,_e.capSegments,_e.radialSegments)}}class CircleGeometry extends BufferGeometry{constructor(_e=1,Dt=32,Vt=0,Gt=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:_e,segments:Dt,thetaStart:Vt,thetaLength:Gt},Dt=Math.max(3,Dt);const zt=[],jt=[],Ht=[],Wt=[],qt=new Vector3,Xt=new Vector2;jt.push(0,0,0),Ht.push(0,0,1),Wt.push(.5,.5);for(let Kt=0,Yt=3;Kt<=Dt;Kt++,Yt+=3){const Zt=Vt+Kt/Dt*Gt;qt.x=_e*Math.cos(Zt),qt.y=_e*Math.sin(Zt),jt.push(qt.x,qt.y,qt.z),Ht.push(0,0,1),Xt.x=(jt[Yt]/_e+1)/2,Xt.y=(jt[Yt+1]/_e+1)/2,Wt.push(Xt.x,Xt.y)}for(let Kt=1;Kt<=Dt;Kt++)zt.push(Kt,Kt+1,0);this.setIndex(zt),this.setAttribute("position",new Float32BufferAttribute(jt,3)),this.setAttribute("normal",new Float32BufferAttribute(Ht,3)),this.setAttribute("uv",new Float32BufferAttribute(Wt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new CircleGeometry(_e.radius,_e.segments,_e.thetaStart,_e.thetaLength)}}class CylinderGeometry extends BufferGeometry{constructor(_e=1,Dt=1,Vt=1,Gt=32,zt=1,jt=!1,Ht=0,Wt=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:_e,radiusBottom:Dt,height:Vt,radialSegments:Gt,heightSegments:zt,openEnded:jt,thetaStart:Ht,thetaLength:Wt};const qt=this;Gt=Math.floor(Gt),zt=Math.floor(zt);const Xt=[],Kt=[],Yt=[],Zt=[];let Jt=0;const nn=[],rn=Vt/2;let Qt=0;en(),jt===!1&&(_e>0&&tn(!0),Dt>0&&tn(!1)),this.setIndex(Xt),this.setAttribute("position",new Float32BufferAttribute(Kt,3)),this.setAttribute("normal",new Float32BufferAttribute(Yt,3)),this.setAttribute("uv",new Float32BufferAttribute(Zt,2));function en(){const sn=new Vector3,cn=new Vector3;let un=0;const hn=(Dt-_e)/Vt;for(let fn=0;fn<=zt;fn++){const pn=[],dn=fn/zt,mn=dn*(Dt-_e)+_e;for(let vn=0;vn<=Gt;vn++){const _n=vn/Gt,En=_n*Wt+Ht,An=Math.sin(En),Tn=Math.cos(En);cn.x=mn*An,cn.y=-dn*Vt+rn,cn.z=mn*Tn,Kt.push(cn.x,cn.y,cn.z),sn.set(An,hn,Tn).normalize(),Yt.push(sn.x,sn.y,sn.z),Zt.push(_n,1-dn),pn.push(Jt++)}nn.push(pn)}for(let fn=0;fn<Gt;fn++)for(let pn=0;pn<zt;pn++){const dn=nn[pn][fn],mn=nn[pn+1][fn],vn=nn[pn+1][fn+1],_n=nn[pn][fn+1];Xt.push(dn,mn,_n),Xt.push(mn,vn,_n),un+=6}qt.addGroup(Qt,un,0),Qt+=un}function tn(sn){const cn=Jt,un=new Vector2,hn=new Vector3;let fn=0;const pn=sn===!0?_e:Dt,dn=sn===!0?1:-1;for(let vn=1;vn<=Gt;vn++)Kt.push(0,rn*dn,0),Yt.push(0,dn,0),Zt.push(.5,.5),Jt++;const mn=Jt;for(let vn=0;vn<=Gt;vn++){const En=vn/Gt*Wt+Ht,An=Math.cos(En),Tn=Math.sin(En);hn.x=pn*Tn,hn.y=rn*dn,hn.z=pn*An,Kt.push(hn.x,hn.y,hn.z),Yt.push(0,dn,0),un.x=An*.5+.5,un.y=Tn*.5*dn+.5,Zt.push(un.x,un.y),Jt++}for(let vn=0;vn<Gt;vn++){const _n=cn+vn,En=mn+vn;sn===!0?Xt.push(En,En+1,_n):Xt.push(En+1,En,_n),fn+=3}qt.addGroup(Qt,fn,sn===!0?1:2),Qt+=fn}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new CylinderGeometry(_e.radiusTop,_e.radiusBottom,_e.height,_e.radialSegments,_e.heightSegments,_e.openEnded,_e.thetaStart,_e.thetaLength)}}class ConeGeometry extends CylinderGeometry{constructor(_e=1,Dt=1,Vt=32,Gt=1,zt=!1,jt=0,Ht=Math.PI*2){super(0,_e,Dt,Vt,Gt,zt,jt,Ht),this.type="ConeGeometry",this.parameters={radius:_e,height:Dt,radialSegments:Vt,heightSegments:Gt,openEnded:zt,thetaStart:jt,thetaLength:Ht}}static fromJSON(_e){return new ConeGeometry(_e.radius,_e.height,_e.radialSegments,_e.heightSegments,_e.openEnded,_e.thetaStart,_e.thetaLength)}}class PolyhedronGeometry extends BufferGeometry{constructor(_e=[],Dt=[],Vt=1,Gt=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:_e,indices:Dt,radius:Vt,detail:Gt};const zt=[],jt=[];Ht(Gt),qt(Vt),Xt(),this.setAttribute("position",new Float32BufferAttribute(zt,3)),this.setAttribute("normal",new Float32BufferAttribute(zt.slice(),3)),this.setAttribute("uv",new Float32BufferAttribute(jt,2)),Gt===0?this.computeVertexNormals():this.normalizeNormals();function Ht(en){const tn=new Vector3,sn=new Vector3,cn=new Vector3;for(let un=0;un<Dt.length;un+=3)Zt(Dt[un+0],tn),Zt(Dt[un+1],sn),Zt(Dt[un+2],cn),Wt(tn,sn,cn,en)}function Wt(en,tn,sn,cn){const un=cn+1,hn=[];for(let fn=0;fn<=un;fn++){hn[fn]=[];const pn=en.clone().lerp(sn,fn/un),dn=tn.clone().lerp(sn,fn/un),mn=un-fn;for(let vn=0;vn<=mn;vn++)vn===0&&fn===un?hn[fn][vn]=pn:hn[fn][vn]=pn.clone().lerp(dn,vn/mn)}for(let fn=0;fn<un;fn++)for(let pn=0;pn<2*(un-fn)-1;pn++){const dn=Math.floor(pn/2);pn%2===0?(Yt(hn[fn][dn+1]),Yt(hn[fn+1][dn]),Yt(hn[fn][dn])):(Yt(hn[fn][dn+1]),Yt(hn[fn+1][dn+1]),Yt(hn[fn+1][dn]))}}function qt(en){const tn=new Vector3;for(let sn=0;sn<zt.length;sn+=3)tn.x=zt[sn+0],tn.y=zt[sn+1],tn.z=zt[sn+2],tn.normalize().multiplyScalar(en),zt[sn+0]=tn.x,zt[sn+1]=tn.y,zt[sn+2]=tn.z}function Xt(){const en=new Vector3;for(let tn=0;tn<zt.length;tn+=3){en.x=zt[tn+0],en.y=zt[tn+1],en.z=zt[tn+2];const sn=rn(en)/2/Math.PI+.5,cn=Qt(en)/Math.PI+.5;jt.push(sn,1-cn)}Jt(),Kt()}function Kt(){for(let en=0;en<jt.length;en+=6){const tn=jt[en+0],sn=jt[en+2],cn=jt[en+4],un=Math.max(tn,sn,cn),hn=Math.min(tn,sn,cn);un>.9&&hn<.1&&(tn<.2&&(jt[en+0]+=1),sn<.2&&(jt[en+2]+=1),cn<.2&&(jt[en+4]+=1))}}function Yt(en){zt.push(en.x,en.y,en.z)}function Zt(en,tn){const sn=en*3;tn.x=_e[sn+0],tn.y=_e[sn+1],tn.z=_e[sn+2]}function Jt(){const en=new Vector3,tn=new Vector3,sn=new Vector3,cn=new Vector3,un=new Vector2,hn=new Vector2,fn=new Vector2;for(let pn=0,dn=0;pn<zt.length;pn+=9,dn+=6){en.set(zt[pn+0],zt[pn+1],zt[pn+2]),tn.set(zt[pn+3],zt[pn+4],zt[pn+5]),sn.set(zt[pn+6],zt[pn+7],zt[pn+8]),un.set(jt[dn+0],jt[dn+1]),hn.set(jt[dn+2],jt[dn+3]),fn.set(jt[dn+4],jt[dn+5]),cn.copy(en).add(tn).add(sn).divideScalar(3);const mn=rn(cn);nn(un,dn+0,en,mn),nn(hn,dn+2,tn,mn),nn(fn,dn+4,sn,mn)}}function nn(en,tn,sn,cn){cn<0&&en.x===1&&(jt[tn]=en.x-1),sn.x===0&&sn.z===0&&(jt[tn]=cn/2/Math.PI+.5)}function rn(en){return Math.atan2(en.z,-en.x)}function Qt(en){return Math.atan2(-en.y,Math.sqrt(en.x*en.x+en.z*en.z))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new PolyhedronGeometry(_e.vertices,_e.indices,_e.radius,_e.details)}}class DodecahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=(1+Math.sqrt(5))/2,Gt=1/Vt,zt=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-Gt,-Vt,0,-Gt,Vt,0,Gt,-Vt,0,Gt,Vt,-Gt,-Vt,0,-Gt,Vt,0,Gt,-Vt,0,Gt,Vt,0,-Vt,0,-Gt,Vt,0,-Gt,-Vt,0,Gt,Vt,0,Gt],jt=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(zt,jt,_e,Dt),this.type="DodecahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new DodecahedronGeometry(_e.radius,_e.detail)}}const _v0=new Vector3,_v1$1=new Vector3,_normal=new Vector3,_triangle=new Triangle;class EdgesGeometry extends BufferGeometry{constructor(_e=null,Dt=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:_e,thresholdAngle:Dt},_e!==null){const Gt=Math.pow(10,4),zt=Math.cos(DEG2RAD$1*Dt),jt=_e.getIndex(),Ht=_e.getAttribute("position"),Wt=jt?jt.count:Ht.count,qt=[0,0,0],Xt=["a","b","c"],Kt=new Array(3),Yt={},Zt=[];for(let Jt=0;Jt<Wt;Jt+=3){jt?(qt[0]=jt.getX(Jt),qt[1]=jt.getX(Jt+1),qt[2]=jt.getX(Jt+2)):(qt[0]=Jt,qt[1]=Jt+1,qt[2]=Jt+2);const{a:nn,b:rn,c:Qt}=_triangle;if(nn.fromBufferAttribute(Ht,qt[0]),rn.fromBufferAttribute(Ht,qt[1]),Qt.fromBufferAttribute(Ht,qt[2]),_triangle.getNormal(_normal),Kt[0]=`${Math.round(nn.x*Gt)},${Math.round(nn.y*Gt)},${Math.round(nn.z*Gt)}`,Kt[1]=`${Math.round(rn.x*Gt)},${Math.round(rn.y*Gt)},${Math.round(rn.z*Gt)}`,Kt[2]=`${Math.round(Qt.x*Gt)},${Math.round(Qt.y*Gt)},${Math.round(Qt.z*Gt)}`,!(Kt[0]===Kt[1]||Kt[1]===Kt[2]||Kt[2]===Kt[0]))for(let en=0;en<3;en++){const tn=(en+1)%3,sn=Kt[en],cn=Kt[tn],un=_triangle[Xt[en]],hn=_triangle[Xt[tn]],fn=`${sn}_${cn}`,pn=`${cn}_${sn}`;pn in Yt&&Yt[pn]?(_normal.dot(Yt[pn].normal)<=zt&&(Zt.push(un.x,un.y,un.z),Zt.push(hn.x,hn.y,hn.z)),Yt[pn]=null):fn in Yt||(Yt[fn]={index0:qt[en],index1:qt[tn],normal:_normal.clone()})}}for(const Jt in Yt)if(Yt[Jt]){const{index0:nn,index1:rn}=Yt[Jt];_v0.fromBufferAttribute(Ht,nn),_v1$1.fromBufferAttribute(Ht,rn),Zt.push(_v0.x,_v0.y,_v0.z),Zt.push(_v1$1.x,_v1$1.y,_v1$1.z)}this.setAttribute("position",new Float32BufferAttribute(Zt,3))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}}class Shape extends Path{constructor(_e){super(_e),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(_e){const Dt=[];for(let Vt=0,Gt=this.holes.length;Vt<Gt;Vt++)Dt[Vt]=this.holes[Vt].getPoints(_e);return Dt}extractPoints(_e){return{shape:this.getPoints(_e),holes:this.getPointsHoles(_e)}}copy(_e){super.copy(_e),this.holes=[];for(let Dt=0,Vt=_e.holes.length;Dt<Vt;Dt++){const Gt=_e.holes[Dt];this.holes.push(Gt.clone())}return this}toJSON(){const _e=super.toJSON();_e.uuid=this.uuid,_e.holes=[];for(let Dt=0,Vt=this.holes.length;Dt<Vt;Dt++){const Gt=this.holes[Dt];_e.holes.push(Gt.toJSON())}return _e}fromJSON(_e){super.fromJSON(_e),this.uuid=_e.uuid,this.holes=[];for(let Dt=0,Vt=_e.holes.length;Dt<Vt;Dt++){const Gt=_e.holes[Dt];this.holes.push(new Path().fromJSON(Gt))}return this}}const Earcut={triangulate:function(kt,_e,Dt=2){const Vt=_e&&_e.length,Gt=Vt?_e[0]*Dt:kt.length;let zt=linkedList(kt,0,Gt,Dt,!0);const jt=[];if(!zt||zt.next===zt.prev)return jt;let Ht,Wt,qt,Xt,Kt,Yt,Zt;if(Vt&&(zt=eliminateHoles(kt,_e,zt,Dt)),kt.length>80*Dt){Ht=qt=kt[0],Wt=Xt=kt[1];for(let Jt=Dt;Jt<Gt;Jt+=Dt)Kt=kt[Jt],Yt=kt[Jt+1],Kt<Ht&&(Ht=Kt),Yt<Wt&&(Wt=Yt),Kt>qt&&(qt=Kt),Yt>Xt&&(Xt=Yt);Zt=Math.max(qt-Ht,Xt-Wt),Zt=Zt!==0?32767/Zt:0}return earcutLinked(zt,jt,Dt,Ht,Wt,Zt,0),jt}};function linkedList(kt,_e,Dt,Vt,Gt){let zt,jt;if(Gt===signedArea(kt,_e,Dt,Vt)>0)for(zt=_e;zt<Dt;zt+=Vt)jt=insertNode(zt,kt[zt],kt[zt+1],jt);else for(zt=Dt-Vt;zt>=_e;zt-=Vt)jt=insertNode(zt,kt[zt],kt[zt+1],jt);return jt&&equals(jt,jt.next)&&(removeNode(jt),jt=jt.next),jt}function filterPoints(kt,_e){if(!kt)return kt;_e||(_e=kt);let Dt=kt,Vt;do if(Vt=!1,!Dt.steiner&&(equals(Dt,Dt.next)||area$1(Dt.prev,Dt,Dt.next)===0)){if(removeNode(Dt),Dt=_e=Dt.prev,Dt===Dt.next)break;Vt=!0}else Dt=Dt.next;while(Vt||Dt!==_e);return _e}function earcutLinked(kt,_e,Dt,Vt,Gt,zt,jt){if(!kt)return;!jt&&zt&&indexCurve(kt,Vt,Gt,zt);let Ht=kt,Wt,qt;for(;kt.prev!==kt.next;){if(Wt=kt.prev,qt=kt.next,zt?isEarHashed(kt,Vt,Gt,zt):isEar(kt)){_e.push(Wt.i/Dt|0),_e.push(kt.i/Dt|0),_e.push(qt.i/Dt|0),removeNode(kt),kt=qt.next,Ht=qt.next;continue}if(kt=qt,kt===Ht){jt?jt===1?(kt=cureLocalIntersections(filterPoints(kt),_e,Dt),earcutLinked(kt,_e,Dt,Vt,Gt,zt,2)):jt===2&&splitEarcut(kt,_e,Dt,Vt,Gt,zt):earcutLinked(filterPoints(kt),_e,Dt,Vt,Gt,zt,1);break}}}function isEar(kt){const _e=kt.prev,Dt=kt,Vt=kt.next;if(area$1(_e,Dt,Vt)>=0)return!1;const Gt=_e.x,zt=Dt.x,jt=Vt.x,Ht=_e.y,Wt=Dt.y,qt=Vt.y,Xt=Gt<zt?Gt<jt?Gt:jt:zt<jt?zt:jt,Kt=Ht<Wt?Ht<qt?Ht:qt:Wt<qt?Wt:qt,Yt=Gt>zt?Gt>jt?Gt:jt:zt>jt?zt:jt,Zt=Ht>Wt?Ht>qt?Ht:qt:Wt>qt?Wt:qt;let Jt=Vt.next;for(;Jt!==_e;){if(Jt.x>=Xt&&Jt.x<=Yt&&Jt.y>=Kt&&Jt.y<=Zt&&pointInTriangle(Gt,Ht,zt,Wt,jt,qt,Jt.x,Jt.y)&&area$1(Jt.prev,Jt,Jt.next)>=0)return!1;Jt=Jt.next}return!0}function isEarHashed(kt,_e,Dt,Vt){const Gt=kt.prev,zt=kt,jt=kt.next;if(area$1(Gt,zt,jt)>=0)return!1;const Ht=Gt.x,Wt=zt.x,qt=jt.x,Xt=Gt.y,Kt=zt.y,Yt=jt.y,Zt=Ht<Wt?Ht<qt?Ht:qt:Wt<qt?Wt:qt,Jt=Xt<Kt?Xt<Yt?Xt:Yt:Kt<Yt?Kt:Yt,nn=Ht>Wt?Ht>qt?Ht:qt:Wt>qt?Wt:qt,rn=Xt>Kt?Xt>Yt?Xt:Yt:Kt>Yt?Kt:Yt,Qt=zOrder(Zt,Jt,_e,Dt,Vt),en=zOrder(nn,rn,_e,Dt,Vt);let tn=kt.prevZ,sn=kt.nextZ;for(;tn&&tn.z>=Qt&&sn&&sn.z<=en;){if(tn.x>=Zt&&tn.x<=nn&&tn.y>=Jt&&tn.y<=rn&&tn!==Gt&&tn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,tn.x,tn.y)&&area$1(tn.prev,tn,tn.next)>=0||(tn=tn.prevZ,sn.x>=Zt&&sn.x<=nn&&sn.y>=Jt&&sn.y<=rn&&sn!==Gt&&sn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,sn.x,sn.y)&&area$1(sn.prev,sn,sn.next)>=0))return!1;sn=sn.nextZ}for(;tn&&tn.z>=Qt;){if(tn.x>=Zt&&tn.x<=nn&&tn.y>=Jt&&tn.y<=rn&&tn!==Gt&&tn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,tn.x,tn.y)&&area$1(tn.prev,tn,tn.next)>=0)return!1;tn=tn.prevZ}for(;sn&&sn.z<=en;){if(sn.x>=Zt&&sn.x<=nn&&sn.y>=Jt&&sn.y<=rn&&sn!==Gt&&sn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,sn.x,sn.y)&&area$1(sn.prev,sn,sn.next)>=0)return!1;sn=sn.nextZ}return!0}function cureLocalIntersections(kt,_e,Dt){let Vt=kt;do{const Gt=Vt.prev,zt=Vt.next.next;!equals(Gt,zt)&&intersects(Gt,Vt,Vt.next,zt)&&locallyInside(Gt,zt)&&locallyInside(zt,Gt)&&(_e.push(Gt.i/Dt|0),_e.push(Vt.i/Dt|0),_e.push(zt.i/Dt|0),removeNode(Vt),removeNode(Vt.next),Vt=kt=zt),Vt=Vt.next}while(Vt!==kt);return filterPoints(Vt)}function splitEarcut(kt,_e,Dt,Vt,Gt,zt){let jt=kt;do{let Ht=jt.next.next;for(;Ht!==jt.prev;){if(jt.i!==Ht.i&&isValidDiagonal(jt,Ht)){let Wt=splitPolygon(jt,Ht);jt=filterPoints(jt,jt.next),Wt=filterPoints(Wt,Wt.next),earcutLinked(jt,_e,Dt,Vt,Gt,zt,0),earcutLinked(Wt,_e,Dt,Vt,Gt,zt,0);return}Ht=Ht.next}jt=jt.next}while(jt!==kt)}function eliminateHoles(kt,_e,Dt,Vt){const Gt=[];let zt,jt,Ht,Wt,qt;for(zt=0,jt=_e.length;zt<jt;zt++)Ht=_e[zt]*Vt,Wt=zt<jt-1?_e[zt+1]*Vt:kt.length,qt=linkedList(kt,Ht,Wt,Vt,!1),qt===qt.next&&(qt.steiner=!0),Gt.push(getLeftmost(qt));for(Gt.sort(compareX),zt=0;zt<Gt.length;zt++)Dt=eliminateHole(Gt[zt],Dt);return Dt}function compareX(kt,_e){return kt.x-_e.x}function eliminateHole(kt,_e){const Dt=findHoleBridge(kt,_e);if(!Dt)return _e;const Vt=splitPolygon(Dt,kt);return filterPoints(Vt,Vt.next),filterPoints(Dt,Dt.next)}function findHoleBridge(kt,_e){let Dt=_e,Vt=-1/0,Gt;const zt=kt.x,jt=kt.y;do{if(jt<=Dt.y&&jt>=Dt.next.y&&Dt.next.y!==Dt.y){const Yt=Dt.x+(jt-Dt.y)*(Dt.next.x-Dt.x)/(Dt.next.y-Dt.y);if(Yt<=zt&&Yt>Vt&&(Vt=Yt,Gt=Dt.x<Dt.next.x?Dt:Dt.next,Yt===zt))return Gt}Dt=Dt.next}while(Dt!==_e);if(!Gt)return null;const Ht=Gt,Wt=Gt.x,qt=Gt.y;let Xt=1/0,Kt;Dt=Gt;do zt>=Dt.x&&Dt.x>=Wt&&zt!==Dt.x&&pointInTriangle(jt<qt?zt:Vt,jt,Wt,qt,jt<qt?Vt:zt,jt,Dt.x,Dt.y)&&(Kt=Math.abs(jt-Dt.y)/(zt-Dt.x),locallyInside(Dt,kt)&&(Kt<Xt||Kt===Xt&&(Dt.x>Gt.x||Dt.x===Gt.x&§orContainsSector(Gt,Dt)))&&(Gt=Dt,Xt=Kt)),Dt=Dt.next;while(Dt!==Ht);return Gt}function sectorContainsSector(kt,_e){return area$1(kt.prev,kt,_e.prev)<0&&area$1(_e.next,kt,kt.next)<0}function indexCurve(kt,_e,Dt,Vt){let Gt=kt;do Gt.z===0&&(Gt.z=zOrder(Gt.x,Gt.y,_e,Dt,Vt)),Gt.prevZ=Gt.prev,Gt.nextZ=Gt.next,Gt=Gt.next;while(Gt!==kt);Gt.prevZ.nextZ=null,Gt.prevZ=null,sortLinked(Gt)}function sortLinked(kt){let _e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt=1;do{for(Dt=kt,kt=null,zt=null,jt=0;Dt;){for(jt++,Vt=Dt,Ht=0,_e=0;_e<qt&&(Ht++,Vt=Vt.nextZ,!!Vt);_e++);for(Wt=qt;Ht>0||Wt>0&&Vt;)Ht!==0&&(Wt===0||!Vt||Dt.z<=Vt.z)?(Gt=Dt,Dt=Dt.nextZ,Ht--):(Gt=Vt,Vt=Vt.nextZ,Wt--),zt?zt.nextZ=Gt:kt=Gt,Gt.prevZ=zt,zt=Gt;Dt=Vt}zt.nextZ=null,qt*=2}while(jt>1);return kt}function zOrder(kt,_e,Dt,Vt,Gt){return kt=(kt-Dt)*Gt|0,_e=(_e-Vt)*Gt|0,kt=(kt|kt<<8)&16711935,kt=(kt|kt<<4)&252645135,kt=(kt|kt<<2)&858993459,kt=(kt|kt<<1)&1431655765,_e=(_e|_e<<8)&16711935,_e=(_e|_e<<4)&252645135,_e=(_e|_e<<2)&858993459,_e=(_e|_e<<1)&1431655765,kt|_e<<1}function getLeftmost(kt){let _e=kt,Dt=kt;do(_e.x<Dt.x||_e.x===Dt.x&&_e.y<Dt.y)&&(Dt=_e),_e=_e.next;while(_e!==kt);return Dt}function pointInTriangle(kt,_e,Dt,Vt,Gt,zt,jt,Ht){return(Gt-jt)*(_e-Ht)>=(kt-jt)*(zt-Ht)&&(kt-jt)*(Vt-Ht)>=(Dt-jt)*(_e-Ht)&&(Dt-jt)*(zt-Ht)>=(Gt-jt)*(Vt-Ht)}function isValidDiagonal(kt,_e){return kt.next.i!==_e.i&&kt.prev.i!==_e.i&&!intersectsPolygon(kt,_e)&&(locallyInside(kt,_e)&&locallyInside(_e,kt)&&middleInside(kt,_e)&&(area$1(kt.prev,kt,_e.prev)||area$1(kt,_e.prev,_e))||equals(kt,_e)&&area$1(kt.prev,kt,kt.next)>0&&area$1(_e.prev,_e,_e.next)>0)}function area$1(kt,_e,Dt){return(_e.y-kt.y)*(Dt.x-_e.x)-(_e.x-kt.x)*(Dt.y-_e.y)}function equals(kt,_e){return kt.x===_e.x&&kt.y===_e.y}function intersects(kt,_e,Dt,Vt){const Gt=sign(area$1(kt,_e,Dt)),zt=sign(area$1(kt,_e,Vt)),jt=sign(area$1(Dt,Vt,kt)),Ht=sign(area$1(Dt,Vt,_e));return!!(Gt!==zt&&jt!==Ht||Gt===0&&onSegment(kt,Dt,_e)||zt===0&&onSegment(kt,Vt,_e)||jt===0&&onSegment(Dt,kt,Vt)||Ht===0&&onSegment(Dt,_e,Vt))}function onSegment(kt,_e,Dt){return _e.x<=Math.max(kt.x,Dt.x)&&_e.x>=Math.min(kt.x,Dt.x)&&_e.y<=Math.max(kt.y,Dt.y)&&_e.y>=Math.min(kt.y,Dt.y)}function sign(kt){return kt>0?1:kt<0?-1:0}function intersectsPolygon(kt,_e){let Dt=kt;do{if(Dt.i!==kt.i&&Dt.next.i!==kt.i&&Dt.i!==_e.i&&Dt.next.i!==_e.i&&intersects(Dt,Dt.next,kt,_e))return!0;Dt=Dt.next}while(Dt!==kt);return!1}function locallyInside(kt,_e){return area$1(kt.prev,kt,kt.next)<0?area$1(kt,_e,kt.next)>=0&&area$1(kt,kt.prev,_e)>=0:area$1(kt,_e,kt.prev)<0||area$1(kt,kt.next,_e)<0}function middleInside(kt,_e){let Dt=kt,Vt=!1;const Gt=(kt.x+_e.x)/2,zt=(kt.y+_e.y)/2;do Dt.y>zt!=Dt.next.y>zt&&Dt.next.y!==Dt.y&&Gt<(Dt.next.x-Dt.x)*(zt-Dt.y)/(Dt.next.y-Dt.y)+Dt.x&&(Vt=!Vt),Dt=Dt.next;while(Dt!==kt);return Vt}function splitPolygon(kt,_e){const Dt=new Node$2(kt.i,kt.x,kt.y),Vt=new Node$2(_e.i,_e.x,_e.y),Gt=kt.next,zt=_e.prev;return kt.next=_e,_e.prev=kt,Dt.next=Gt,Gt.prev=Dt,Vt.next=Dt,Dt.prev=Vt,zt.next=Vt,Vt.prev=zt,Vt}function insertNode(kt,_e,Dt,Vt){const Gt=new Node$2(kt,_e,Dt);return Vt?(Gt.next=Vt.next,Gt.prev=Vt,Vt.next.prev=Gt,Vt.next=Gt):(Gt.prev=Gt,Gt.next=Gt),Gt}function removeNode(kt){kt.next.prev=kt.prev,kt.prev.next=kt.next,kt.prevZ&&(kt.prevZ.nextZ=kt.nextZ),kt.nextZ&&(kt.nextZ.prevZ=kt.prevZ)}function Node$2(kt,_e,Dt){this.i=kt,this.x=_e,this.y=Dt,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(kt,_e,Dt,Vt){let Gt=0;for(let zt=_e,jt=Dt-Vt;zt<Dt;zt+=Vt)Gt+=(kt[jt]-kt[zt])*(kt[zt+1]+kt[jt+1]),jt=zt;return Gt}class ShapeUtils{static area(_e){const Dt=_e.length;let Vt=0;for(let Gt=Dt-1,zt=0;zt<Dt;Gt=zt++)Vt+=_e[Gt].x*_e[zt].y-_e[zt].x*_e[Gt].y;return Vt*.5}static isClockWise(_e){return ShapeUtils.area(_e)<0}static triangulateShape(_e,Dt){const Vt=[],Gt=[],zt=[];removeDupEndPts(_e),addContour(Vt,_e);let jt=_e.length;Dt.forEach(removeDupEndPts);for(let Wt=0;Wt<Dt.length;Wt++)Gt.push(jt),jt+=Dt[Wt].length,addContour(Vt,Dt[Wt]);const Ht=Earcut.triangulate(Vt,Gt);for(let Wt=0;Wt<Ht.length;Wt+=3)zt.push(Ht.slice(Wt,Wt+3));return zt}}function removeDupEndPts(kt){const _e=kt.length;_e>2&&kt[_e-1].equals(kt[0])&&kt.pop()}function addContour(kt,_e){for(let Dt=0;Dt<_e.length;Dt++)kt.push(_e[Dt].x),kt.push(_e[Dt].y)}class ExtrudeGeometry extends BufferGeometry{constructor(_e=new Shape([new Vector2(.5,.5),new Vector2(-.5,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),Dt={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:_e,options:Dt},_e=Array.isArray(_e)?_e:[_e];const Vt=this,Gt=[],zt=[];for(let Ht=0,Wt=_e.length;Ht<Wt;Ht++){const qt=_e[Ht];jt(qt)}this.setAttribute("position",new Float32BufferAttribute(Gt,3)),this.setAttribute("uv",new Float32BufferAttribute(zt,2)),this.computeVertexNormals();function jt(Ht){const Wt=[],qt=Dt.curveSegments!==void 0?Dt.curveSegments:12,Xt=Dt.steps!==void 0?Dt.steps:1,Kt=Dt.depth!==void 0?Dt.depth:1;let Yt=Dt.bevelEnabled!==void 0?Dt.bevelEnabled:!0,Zt=Dt.bevelThickness!==void 0?Dt.bevelThickness:.2,Jt=Dt.bevelSize!==void 0?Dt.bevelSize:Zt-.1,nn=Dt.bevelOffset!==void 0?Dt.bevelOffset:0,rn=Dt.bevelSegments!==void 0?Dt.bevelSegments:3;const Qt=Dt.extrudePath,en=Dt.UVGenerator!==void 0?Dt.UVGenerator:WorldUVGenerator;let tn,sn=!1,cn,un,hn,fn;Qt&&(tn=Qt.getSpacedPoints(Xt),sn=!0,Yt=!1,cn=Qt.computeFrenetFrames(Xt,!1),un=new Vector3,hn=new Vector3,fn=new Vector3),Yt||(rn=0,Zt=0,Jt=0,nn=0);const pn=Ht.extractPoints(qt);let dn=pn.shape;const mn=pn.holes;if(!ShapeUtils.isClockWise(dn)){dn=dn.reverse();for(let ur=0,Wn=mn.length;ur<Wn;ur++){const or=mn[ur];ShapeUtils.isClockWise(or)&&(mn[ur]=or.reverse())}}const _n=ShapeUtils.triangulateShape(dn,mn),En=dn;for(let ur=0,Wn=mn.length;ur<Wn;ur++){const or=mn[ur];dn=dn.concat(or)}function An(ur,Wn,or){return Wn||console.error("THREE.ExtrudeGeometry: vec does not exist"),ur.clone().addScaledVector(Wn,or)}const Tn=dn.length,Cn=_n.length;function yn(ur,Wn,or){let gr,fr,Un;const In=ur.x-Wn.x,jn=ur.y-Wn.y,er=or.x-ur.x,cr=or.y-ur.y,lr=In*In+jn*jn,Mr=In*cr-jn*er;if(Math.abs(Mr)>Number.EPSILON){const mr=Math.sqrt(lr),wr=Math.sqrt(er*er+cr*cr),Dr=Wn.x-jn/mr,Cr=Wn.y+In/mr,Pr=or.x-cr/wr,Hr=or.y+er/wr,Ir=((Pr-Dr)*cr-(Hr-Cr)*er)/(In*cr-jn*er);gr=Dr+In*Ir-ur.x,fr=Cr+jn*Ir-ur.y;const Fr=gr*gr+fr*fr;if(Fr<=2)return new Vector2(gr,fr);Un=Math.sqrt(Fr/2)}else{let mr=!1;In>Number.EPSILON?er>Number.EPSILON&&(mr=!0):In<-Number.EPSILON?er<-Number.EPSILON&&(mr=!0):Math.sign(jn)===Math.sign(cr)&&(mr=!0),mr?(gr=-jn,fr=In,Un=Math.sqrt(lr)):(gr=In,fr=jn,Un=Math.sqrt(lr/2))}return new Vector2(gr/Un,fr/Un)}const Sn=[];for(let ur=0,Wn=En.length,or=Wn-1,gr=ur+1;ur<Wn;ur++,or++,gr++)or===Wn&&(or=0),gr===Wn&&(gr=0),Sn[ur]=yn(En[ur],En[or],En[gr]);const wn=[];let xn,Rn=Sn.concat();for(let ur=0,Wn=mn.length;ur<Wn;ur++){const or=mn[ur];xn=[];for(let gr=0,fr=or.length,Un=fr-1,In=gr+1;gr<fr;gr++,Un++,In++)Un===fr&&(Un=0),In===fr&&(In=0),xn[gr]=yn(or[gr],or[Un],or[In]);wn.push(xn),Rn=Rn.concat(xn)}for(let ur=0;ur<rn;ur++){const Wn=ur/rn,or=Zt*Math.cos(Wn*Math.PI/2),gr=Jt*Math.sin(Wn*Math.PI/2)+nn;for(let fr=0,Un=En.length;fr<Un;fr++){const In=An(En[fr],Sn[fr],gr);Bn(In.x,In.y,-or)}for(let fr=0,Un=mn.length;fr<Un;fr++){const In=mn[fr];xn=wn[fr];for(let jn=0,er=In.length;jn<er;jn++){const cr=An(In[jn],xn[jn],gr);Bn(cr.x,cr.y,-or)}}}const Ln=Jt+nn;for(let ur=0;ur<Tn;ur++){const Wn=Yt?An(dn[ur],Rn[ur],Ln):dn[ur];sn?(hn.copy(cn.normals[0]).multiplyScalar(Wn.x),un.copy(cn.binormals[0]).multiplyScalar(Wn.y),fn.copy(tn[0]).add(hn).add(un),Bn(fn.x,fn.y,fn.z)):Bn(Wn.x,Wn.y,0)}for(let ur=1;ur<=Xt;ur++)for(let Wn=0;Wn<Tn;Wn++){const or=Yt?An(dn[Wn],Rn[Wn],Ln):dn[Wn];sn?(hn.copy(cn.normals[ur]).multiplyScalar(or.x),un.copy(cn.binormals[ur]).multiplyScalar(or.y),fn.copy(tn[ur]).add(hn).add(un),Bn(fn.x,fn.y,fn.z)):Bn(or.x,or.y,Kt/Xt*ur)}for(let ur=rn-1;ur>=0;ur--){const Wn=ur/rn,or=Zt*Math.cos(Wn*Math.PI/2),gr=Jt*Math.sin(Wn*Math.PI/2)+nn;for(let fr=0,Un=En.length;fr<Un;fr++){const In=An(En[fr],Sn[fr],gr);Bn(In.x,In.y,Kt+or)}for(let fr=0,Un=mn.length;fr<Un;fr++){const In=mn[fr];xn=wn[fr];for(let jn=0,er=In.length;jn<er;jn++){const cr=An(In[jn],xn[jn],gr);sn?Bn(cr.x,cr.y+tn[Xt-1].y,tn[Xt-1].x+or):Bn(cr.x,cr.y,Kt+or)}}}Nn(),Fn();function Nn(){const ur=Gt.length/3;if(Yt){let Wn=0,or=Tn*Wn;for(let gr=0;gr<Cn;gr++){const fr=_n[gr];Hn(fr[2]+or,fr[1]+or,fr[0]+or)}Wn=Xt+rn*2,or=Tn*Wn;for(let gr=0;gr<Cn;gr++){const fr=_n[gr];Hn(fr[0]+or,fr[1]+or,fr[2]+or)}}else{for(let Wn=0;Wn<Cn;Wn++){const or=_n[Wn];Hn(or[2],or[1],or[0])}for(let Wn=0;Wn<Cn;Wn++){const or=_n[Wn];Hn(or[0]+Tn*Xt,or[1]+Tn*Xt,or[2]+Tn*Xt)}}Vt.addGroup(ur,Gt.length/3-ur,0)}function Fn(){const ur=Gt.length/3;let Wn=0;Pn(En,Wn),Wn+=En.length;for(let or=0,gr=mn.length;or<gr;or++){const fr=mn[or];Pn(fr,Wn),Wn+=fr.length}Vt.addGroup(ur,Gt.length/3-ur,1)}function Pn(ur,Wn){let or=ur.length;for(;--or>=0;){const gr=or;let fr=or-1;fr<0&&(fr=ur.length-1);for(let Un=0,In=Xt+rn*2;Un<In;Un++){const jn=Tn*Un,er=Tn*(Un+1),cr=Wn+gr+jn,lr=Wn+fr+jn,Mr=Wn+fr+er,mr=Wn+gr+er;qn(cr,lr,Mr,mr)}}}function Bn(ur,Wn,or){Wt.push(ur),Wt.push(Wn),Wt.push(or)}function Hn(ur,Wn,or){ar(ur),ar(Wn),ar(or);const gr=Gt.length/3,fr=en.generateTopUV(Vt,Gt,gr-3,gr-2,gr-1);zn(fr[0]),zn(fr[1]),zn(fr[2])}function qn(ur,Wn,or,gr){ar(ur),ar(Wn),ar(gr),ar(Wn),ar(or),ar(gr);const fr=Gt.length/3,Un=en.generateSideWallUV(Vt,Gt,fr-6,fr-3,fr-2,fr-1);zn(Un[0]),zn(Un[1]),zn(Un[3]),zn(Un[1]),zn(Un[2]),zn(Un[3])}function ar(ur){Gt.push(Wt[ur*3+0]),Gt.push(Wt[ur*3+1]),Gt.push(Wt[ur*3+2])}function zn(ur){zt.push(ur.x),zt.push(ur.y)}}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON(),Dt=this.parameters.shapes,Vt=this.parameters.options;return toJSON$1(Dt,Vt,_e)}static fromJSON(_e,Dt){const Vt=[];for(let zt=0,jt=_e.shapes.length;zt<jt;zt++){const Ht=Dt[_e.shapes[zt]];Vt.push(Ht)}const Gt=_e.options.extrudePath;return Gt!==void 0&&(_e.options.extrudePath=new Curves[Gt.type]().fromJSON(Gt)),new ExtrudeGeometry(Vt,_e.options)}}const WorldUVGenerator={generateTopUV:function(kt,_e,Dt,Vt,Gt){const zt=_e[Dt*3],jt=_e[Dt*3+1],Ht=_e[Vt*3],Wt=_e[Vt*3+1],qt=_e[Gt*3],Xt=_e[Gt*3+1];return[new Vector2(zt,jt),new Vector2(Ht,Wt),new Vector2(qt,Xt)]},generateSideWallUV:function(kt,_e,Dt,Vt,Gt,zt){const jt=_e[Dt*3],Ht=_e[Dt*3+1],Wt=_e[Dt*3+2],qt=_e[Vt*3],Xt=_e[Vt*3+1],Kt=_e[Vt*3+2],Yt=_e[Gt*3],Zt=_e[Gt*3+1],Jt=_e[Gt*3+2],nn=_e[zt*3],rn=_e[zt*3+1],Qt=_e[zt*3+2];return Math.abs(Ht-Xt)<Math.abs(jt-qt)?[new Vector2(jt,1-Wt),new Vector2(qt,1-Kt),new Vector2(Yt,1-Jt),new Vector2(nn,1-Qt)]:[new Vector2(Ht,1-Wt),new Vector2(Xt,1-Kt),new Vector2(Zt,1-Jt),new Vector2(rn,1-Qt)]}};function toJSON$1(kt,_e,Dt){if(Dt.shapes=[],Array.isArray(kt))for(let Vt=0,Gt=kt.length;Vt<Gt;Vt++){const zt=kt[Vt];Dt.shapes.push(zt.uuid)}else Dt.shapes.push(kt.uuid);return Dt.options=Object.assign({},_e),_e.extrudePath!==void 0&&(Dt.options.extrudePath=_e.extrudePath.toJSON()),Dt}class IcosahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=(1+Math.sqrt(5))/2,Gt=[-1,Vt,0,1,Vt,0,-1,-Vt,0,1,-Vt,0,0,-1,Vt,0,1,Vt,0,-1,-Vt,0,1,-Vt,Vt,0,-1,Vt,0,1,-Vt,0,-1,-Vt,0,1],zt=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(Gt,zt,_e,Dt),this.type="IcosahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new IcosahedronGeometry(_e.radius,_e.detail)}}class OctahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],Gt=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(Vt,Gt,_e,Dt),this.type="OctahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new OctahedronGeometry(_e.radius,_e.detail)}}class RingGeometry extends BufferGeometry{constructor(_e=.5,Dt=1,Vt=32,Gt=1,zt=0,jt=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:_e,outerRadius:Dt,thetaSegments:Vt,phiSegments:Gt,thetaStart:zt,thetaLength:jt},Vt=Math.max(3,Vt),Gt=Math.max(1,Gt);const Ht=[],Wt=[],qt=[],Xt=[];let Kt=_e;const Yt=(Dt-_e)/Gt,Zt=new Vector3,Jt=new Vector2;for(let nn=0;nn<=Gt;nn++){for(let rn=0;rn<=Vt;rn++){const Qt=zt+rn/Vt*jt;Zt.x=Kt*Math.cos(Qt),Zt.y=Kt*Math.sin(Qt),Wt.push(Zt.x,Zt.y,Zt.z),qt.push(0,0,1),Jt.x=(Zt.x/Dt+1)/2,Jt.y=(Zt.y/Dt+1)/2,Xt.push(Jt.x,Jt.y)}Kt+=Yt}for(let nn=0;nn<Gt;nn++){const rn=nn*(Vt+1);for(let Qt=0;Qt<Vt;Qt++){const en=Qt+rn,tn=en,sn=en+Vt+1,cn=en+Vt+2,un=en+1;Ht.push(tn,sn,un),Ht.push(sn,cn,un)}}this.setIndex(Ht),this.setAttribute("position",new Float32BufferAttribute(Wt,3)),this.setAttribute("normal",new Float32BufferAttribute(qt,3)),this.setAttribute("uv",new Float32BufferAttribute(Xt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new RingGeometry(_e.innerRadius,_e.outerRadius,_e.thetaSegments,_e.phiSegments,_e.thetaStart,_e.thetaLength)}}class ShapeGeometry extends BufferGeometry{constructor(_e=new Shape([new Vector2(0,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),Dt=12){super(),this.type="ShapeGeometry",this.parameters={shapes:_e,curveSegments:Dt};const Vt=[],Gt=[],zt=[],jt=[];let Ht=0,Wt=0;if(Array.isArray(_e)===!1)qt(_e);else for(let Xt=0;Xt<_e.length;Xt++)qt(_e[Xt]),this.addGroup(Ht,Wt,Xt),Ht+=Wt,Wt=0;this.setIndex(Vt),this.setAttribute("position",new Float32BufferAttribute(Gt,3)),this.setAttribute("normal",new Float32BufferAttribute(zt,3)),this.setAttribute("uv",new Float32BufferAttribute(jt,2));function qt(Xt){const Kt=Gt.length/3,Yt=Xt.extractPoints(Dt);let Zt=Yt.shape;const Jt=Yt.holes;ShapeUtils.isClockWise(Zt)===!1&&(Zt=Zt.reverse());for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];ShapeUtils.isClockWise(en)===!0&&(Jt[rn]=en.reverse())}const nn=ShapeUtils.triangulateShape(Zt,Jt);for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];Zt=Zt.concat(en)}for(let rn=0,Qt=Zt.length;rn<Qt;rn++){const en=Zt[rn];Gt.push(en.x,en.y,0),zt.push(0,0,1),jt.push(en.x,en.y)}for(let rn=0,Qt=nn.length;rn<Qt;rn++){const en=nn[rn],tn=en[0]+Kt,sn=en[1]+Kt,cn=en[2]+Kt;Vt.push(tn,sn,cn),Wt+=3}}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON(),Dt=this.parameters.shapes;return toJSON(Dt,_e)}static fromJSON(_e,Dt){const Vt=[];for(let Gt=0,zt=_e.shapes.length;Gt<zt;Gt++){const jt=Dt[_e.shapes[Gt]];Vt.push(jt)}return new ShapeGeometry(Vt,_e.curveSegments)}}function toJSON(kt,_e){if(_e.shapes=[],Array.isArray(kt))for(let Dt=0,Vt=kt.length;Dt<Vt;Dt++){const Gt=kt[Dt];_e.shapes.push(Gt.uuid)}else _e.shapes.push(kt.uuid);return _e}class SphereGeometry extends BufferGeometry{constructor(_e=1,Dt=32,Vt=16,Gt=0,zt=Math.PI*2,jt=0,Ht=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:_e,widthSegments:Dt,heightSegments:Vt,phiStart:Gt,phiLength:zt,thetaStart:jt,thetaLength:Ht},Dt=Math.max(3,Math.floor(Dt)),Vt=Math.max(2,Math.floor(Vt));const Wt=Math.min(jt+Ht,Math.PI);let qt=0;const Xt=[],Kt=new Vector3,Yt=new Vector3,Zt=[],Jt=[],nn=[],rn=[];for(let Qt=0;Qt<=Vt;Qt++){const en=[],tn=Qt/Vt;let sn=0;Qt===0&&jt===0?sn=.5/Dt:Qt===Vt&&Wt===Math.PI&&(sn=-.5/Dt);for(let cn=0;cn<=Dt;cn++){const un=cn/Dt;Kt.x=-_e*Math.cos(Gt+un*zt)*Math.sin(jt+tn*Ht),Kt.y=_e*Math.cos(jt+tn*Ht),Kt.z=_e*Math.sin(Gt+un*zt)*Math.sin(jt+tn*Ht),Jt.push(Kt.x,Kt.y,Kt.z),Yt.copy(Kt).normalize(),nn.push(Yt.x,Yt.y,Yt.z),rn.push(un+sn,1-tn),en.push(qt++)}Xt.push(en)}for(let Qt=0;Qt<Vt;Qt++)for(let en=0;en<Dt;en++){const tn=Xt[Qt][en+1],sn=Xt[Qt][en],cn=Xt[Qt+1][en],un=Xt[Qt+1][en+1];(Qt!==0||jt>0)&&Zt.push(tn,sn,un),(Qt!==Vt-1||Wt<Math.PI)&&Zt.push(sn,cn,un)}this.setIndex(Zt),this.setAttribute("position",new Float32BufferAttribute(Jt,3)),this.setAttribute("normal",new Float32BufferAttribute(nn,3)),this.setAttribute("uv",new Float32BufferAttribute(rn,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new SphereGeometry(_e.radius,_e.widthSegments,_e.heightSegments,_e.phiStart,_e.phiLength,_e.thetaStart,_e.thetaLength)}}class TetrahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],Gt=[2,1,0,0,3,2,1,3,0,2,3,1];super(Vt,Gt,_e,Dt),this.type="TetrahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new TetrahedronGeometry(_e.radius,_e.detail)}}class TorusGeometry extends BufferGeometry{constructor(_e=1,Dt=.4,Vt=12,Gt=48,zt=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:_e,tube:Dt,radialSegments:Vt,tubularSegments:Gt,arc:zt},Vt=Math.floor(Vt),Gt=Math.floor(Gt);const jt=[],Ht=[],Wt=[],qt=[],Xt=new Vector3,Kt=new Vector3,Yt=new Vector3;for(let Zt=0;Zt<=Vt;Zt++)for(let Jt=0;Jt<=Gt;Jt++){const nn=Jt/Gt*zt,rn=Zt/Vt*Math.PI*2;Kt.x=(_e+Dt*Math.cos(rn))*Math.cos(nn),Kt.y=(_e+Dt*Math.cos(rn))*Math.sin(nn),Kt.z=Dt*Math.sin(rn),Ht.push(Kt.x,Kt.y,Kt.z),Xt.x=_e*Math.cos(nn),Xt.y=_e*Math.sin(nn),Yt.subVectors(Kt,Xt).normalize(),Wt.push(Yt.x,Yt.y,Yt.z),qt.push(Jt/Gt),qt.push(Zt/Vt)}for(let Zt=1;Zt<=Vt;Zt++)for(let Jt=1;Jt<=Gt;Jt++){const nn=(Gt+1)*Zt+Jt-1,rn=(Gt+1)*(Zt-1)+Jt-1,Qt=(Gt+1)*(Zt-1)+Jt,en=(Gt+1)*Zt+Jt;jt.push(nn,rn,en),jt.push(rn,Qt,en)}this.setIndex(jt),this.setAttribute("position",new Float32BufferAttribute(Ht,3)),this.setAttribute("normal",new Float32BufferAttribute(Wt,3)),this.setAttribute("uv",new Float32BufferAttribute(qt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new TorusGeometry(_e.radius,_e.tube,_e.radialSegments,_e.tubularSegments,_e.arc)}}class TorusKnotGeometry extends BufferGeometry{constructor(_e=1,Dt=.4,Vt=64,Gt=8,zt=2,jt=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:_e,tube:Dt,tubularSegments:Vt,radialSegments:Gt,p:zt,q:jt},Vt=Math.floor(Vt),Gt=Math.floor(Gt);const Ht=[],Wt=[],qt=[],Xt=[],Kt=new Vector3,Yt=new Vector3,Zt=new Vector3,Jt=new Vector3,nn=new Vector3,rn=new Vector3,Qt=new Vector3;for(let tn=0;tn<=Vt;++tn){const sn=tn/Vt*zt*Math.PI*2;en(sn,zt,jt,_e,Zt),en(sn+.01,zt,jt,_e,Jt),rn.subVectors(Jt,Zt),Qt.addVectors(Jt,Zt),nn.crossVectors(rn,Qt),Qt.crossVectors(nn,rn),nn.normalize(),Qt.normalize();for(let cn=0;cn<=Gt;++cn){const un=cn/Gt*Math.PI*2,hn=-Dt*Math.cos(un),fn=Dt*Math.sin(un);Kt.x=Zt.x+(hn*Qt.x+fn*nn.x),Kt.y=Zt.y+(hn*Qt.y+fn*nn.y),Kt.z=Zt.z+(hn*Qt.z+fn*nn.z),Wt.push(Kt.x,Kt.y,Kt.z),Yt.subVectors(Kt,Zt).normalize(),qt.push(Yt.x,Yt.y,Yt.z),Xt.push(tn/Vt),Xt.push(cn/Gt)}}for(let tn=1;tn<=Vt;tn++)for(let sn=1;sn<=Gt;sn++){const cn=(Gt+1)*(tn-1)+(sn-1),un=(Gt+1)*tn+(sn-1),hn=(Gt+1)*tn+sn,fn=(Gt+1)*(tn-1)+sn;Ht.push(cn,un,fn),Ht.push(un,hn,fn)}this.setIndex(Ht),this.setAttribute("position",new Float32BufferAttribute(Wt,3)),this.setAttribute("normal",new Float32BufferAttribute(qt,3)),this.setAttribute("uv",new Float32BufferAttribute(Xt,2));function en(tn,sn,cn,un,hn){const fn=Math.cos(tn),pn=Math.sin(tn),dn=cn/sn*tn,mn=Math.cos(dn);hn.x=un*(2+mn)*.5*fn,hn.y=un*(2+mn)*pn*.5,hn.z=un*Math.sin(dn)*.5}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new TorusKnotGeometry(_e.radius,_e.tube,_e.tubularSegments,_e.radialSegments,_e.p,_e.q)}}class TubeGeometry extends BufferGeometry{constructor(_e=new QuadraticBezierCurve3(new Vector3(-1,-1,0),new Vector3(-1,1,0),new Vector3(1,1,0)),Dt=64,Vt=1,Gt=8,zt=!1){super(),this.type="TubeGeometry",this.parameters={path:_e,tubularSegments:Dt,radius:Vt,radialSegments:Gt,closed:zt};const jt=_e.computeFrenetFrames(Dt,zt);this.tangents=jt.tangents,this.normals=jt.normals,this.binormals=jt.binormals;const Ht=new Vector3,Wt=new Vector3,qt=new Vector2;let Xt=new Vector3;const Kt=[],Yt=[],Zt=[],Jt=[];nn(),this.setIndex(Jt),this.setAttribute("position",new Float32BufferAttribute(Kt,3)),this.setAttribute("normal",new Float32BufferAttribute(Yt,3)),this.setAttribute("uv",new Float32BufferAttribute(Zt,2));function nn(){for(let tn=0;tn<Dt;tn++)rn(tn);rn(zt===!1?Dt:0),en(),Qt()}function rn(tn){Xt=_e.getPointAt(tn/Dt,Xt);const sn=jt.normals[tn],cn=jt.binormals[tn];for(let un=0;un<=Gt;un++){const hn=un/Gt*Math.PI*2,fn=Math.sin(hn),pn=-Math.cos(hn);Wt.x=pn*sn.x+fn*cn.x,Wt.y=pn*sn.y+fn*cn.y,Wt.z=pn*sn.z+fn*cn.z,Wt.normalize(),Yt.push(Wt.x,Wt.y,Wt.z),Ht.x=Xt.x+Vt*Wt.x,Ht.y=Xt.y+Vt*Wt.y,Ht.z=Xt.z+Vt*Wt.z,Kt.push(Ht.x,Ht.y,Ht.z)}}function Qt(){for(let tn=1;tn<=Dt;tn++)for(let sn=1;sn<=Gt;sn++){const cn=(Gt+1)*(tn-1)+(sn-1),un=(Gt+1)*tn+(sn-1),hn=(Gt+1)*tn+sn,fn=(Gt+1)*(tn-1)+sn;Jt.push(cn,un,fn),Jt.push(un,hn,fn)}}function en(){for(let tn=0;tn<=Dt;tn++)for(let sn=0;sn<=Gt;sn++)qt.x=tn/Dt,qt.y=sn/Gt,Zt.push(qt.x,qt.y)}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON();return _e.path=this.parameters.path.toJSON(),_e}static fromJSON(_e){return new TubeGeometry(new Curves[_e.path.type]().fromJSON(_e.path),_e.tubularSegments,_e.radius,_e.radialSegments,_e.closed)}}class WireframeGeometry extends BufferGeometry{constructor(_e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:_e},_e!==null){const Dt=[],Vt=new Set,Gt=new Vector3,zt=new Vector3;if(_e.index!==null){const jt=_e.attributes.position,Ht=_e.index;let Wt=_e.groups;Wt.length===0&&(Wt=[{start:0,count:Ht.count,materialIndex:0}]);for(let qt=0,Xt=Wt.length;qt<Xt;++qt){const Kt=Wt[qt],Yt=Kt.start,Zt=Kt.count;for(let Jt=Yt,nn=Yt+Zt;Jt<nn;Jt+=3)for(let rn=0;rn<3;rn++){const Qt=Ht.getX(Jt+rn),en=Ht.getX(Jt+(rn+1)%3);Gt.fromBufferAttribute(jt,Qt),zt.fromBufferAttribute(jt,en),isUniqueEdge(Gt,zt,Vt)===!0&&(Dt.push(Gt.x,Gt.y,Gt.z),Dt.push(zt.x,zt.y,zt.z))}}}else{const jt=_e.attributes.position;for(let Ht=0,Wt=jt.count/3;Ht<Wt;Ht++)for(let qt=0;qt<3;qt++){const Xt=3*Ht+qt,Kt=3*Ht+(qt+1)%3;Gt.fromBufferAttribute(jt,Xt),zt.fromBufferAttribute(jt,Kt),isUniqueEdge(Gt,zt,Vt)===!0&&(Dt.push(Gt.x,Gt.y,Gt.z),Dt.push(zt.x,zt.y,zt.z))}}this.setAttribute("position",new Float32BufferAttribute(Dt,3))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}}function isUniqueEdge(kt,_e,Dt){const Vt=`${kt.x},${kt.y},${kt.z}-${_e.x},${_e.y},${_e.z}`,Gt=`${_e.x},${_e.y},${_e.z}-${kt.x},${kt.y},${kt.z}`;return Dt.has(Vt)===!0||Dt.has(Gt)===!0?!1:(Dt.add(Vt),Dt.add(Gt),!0)}var Geometries=Object.freeze({__proto__:null,BoxGeometry,CapsuleGeometry,CircleGeometry,ConeGeometry,CylinderGeometry,DodecahedronGeometry,EdgesGeometry,ExtrudeGeometry,IcosahedronGeometry,LatheGeometry,OctahedronGeometry,PlaneGeometry,PolyhedronGeometry,RingGeometry,ShapeGeometry,SphereGeometry,TetrahedronGeometry,TorusGeometry,TorusKnotGeometry,TubeGeometry,WireframeGeometry});class ShadowMaterial extends Material{constructor(_e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Color$1(0),this.transparent=!0,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.fog=_e.fog,this}}class RawShaderMaterial extends ShaderMaterial{constructor(_e){super(_e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class MeshStandardMaterial extends Material{constructor(_e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Color$1(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.defines={STANDARD:""},this.color.copy(_e.color),this.roughness=_e.roughness,this.metalness=_e.metalness,this.map=_e.map,this.lightMap=_e.lightMap,this.lightMapIntensity=_e.lightMapIntensity,this.aoMap=_e.aoMap,this.aoMapIntensity=_e.aoMapIntensity,this.emissive.copy(_e.emissive),this.emissiveMap=_e.emissiveMap,this.emissiveIntensity=_e.emissiveIntensity,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,this.roughnessMap=_e.roughnessMap,this.metalnessMap=_e.metalnessMap,this.alphaMap=_e.alphaMap,this.envMap=_e.envMap,this.envMapRotation.copy(_e.envMapRotation),this.envMapIntensity=_e.envMapIntensity,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.wireframeLinecap=_e.wireframeLinecap,this.wireframeLinejoin=_e.wireframeLinejoin,this.flatShading=_e.flatShading,this.fog=_e.fog,this}}class MeshPhysicalMaterial extends MeshStandardMaterial{constructor(_e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Vector2(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return clamp$2(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(Dt){this.ior=(1+.4*Dt)/(1-.4*Dt)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Color$1(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Color$1(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Color$1(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(_e)}get anisotropy(){return this._anisotropy}set anisotropy(_e){this._anisotropy>0!=_e>0&&this.version++,this._anisotropy=_e}get clearcoat(){return this._clearcoat}set clearcoat(_e){this._clearcoat>0!=_e>0&&this.version++,this._clearcoat=_e}get iridescence(){return this._iridescence}set iridescence(_e){this._iridescence>0!=_e>0&&this.version++,this._iridescence=_e}get sheen(){return this._sheen}set sheen(_e){this._sheen>0!=_e>0&&this.version++,this._sheen=_e}get transmission(){return this._transmission}set transmission(_e){this._transmission>0!=_e>0&&this.version++,this._transmission=_e}copy(_e){return super.copy(_e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=_e.anisotropy,this.anisotropyRotation=_e.anisotropyRotation,this.anisotropyMap=_e.anisotropyMap,this.clearcoat=_e.clearcoat,this.clearcoatMap=_e.clearcoatMap,this.clearcoatRoughness=_e.clearcoatRoughness,this.clearcoatRoughnessMap=_e.clearcoatRoughnessMap,this.clearcoatNormalMap=_e.clearcoatNormalMap,this.clearcoatNormalScale.copy(_e.clearcoatNormalScale),this.ior=_e.ior,this.iridescence=_e.iridescence,this.iridescenceMap=_e.iridescenceMap,this.iridescenceIOR=_e.iridescenceIOR,this.iridescenceThicknessRange=[..._e.iridescenceThicknessRange],this.iridescenceThicknessMap=_e.iridescenceThicknessMap,this.sheen=_e.sheen,this.sheenColor.copy(_e.sheenColor),this.sheenColorMap=_e.sheenColorMap,this.sheenRoughness=_e.sheenRoughness,this.sheenRoughnessMap=_e.sheenRoughnessMap,this.transmission=_e.transmission,this.transmissionMap=_e.transmissionMap,this.thickness=_e.thickness,this.thicknessMap=_e.thicknessMap,this.attenuationDistance=_e.attenuationDistance,this.attenuationColor.copy(_e.attenuationColor),this.specularIntensity=_e.specularIntensity,this.specularIntensityMap=_e.specularIntensityMap,this.specularColor.copy(_e.specularColor),this.specularColorMap=_e.specularColorMap,this}}class MeshPhongMaterial extends Material{constructor(_e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Color$1(16777215),this.specular=new Color$1(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.combine=MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.specular.copy(_e.specular),this.shininess=_e.shininess,this.map=_e.map,this.lightMap=_e.lightMap,this.lightMapIntensity=_e.lightMapIntensity,this.aoMap=_e.aoMap,this.aoMapIntensity=_e.aoMapIntensity,this.emissive.copy(_e.emissive),this.emissiveMap=_e.emissiveMap,this.emissiveIntensity=_e.emissiveIntensity,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,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.flatShading=_e.flatShading,this.fog=_e.fog,this}}class MeshToonMaterial extends Material{constructor(_e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Color$1(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=_e.gradientMap,this.lightMap=_e.lightMap,this.lightMapIntensity=_e.lightMapIntensity,this.aoMap=_e.aoMap,this.aoMapIntensity=_e.aoMapIntensity,this.emissive.copy(_e.emissive),this.emissiveMap=_e.emissiveMap,this.emissiveIntensity=_e.emissiveIntensity,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,this.alphaMap=_e.alphaMap,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.wireframeLinecap=_e.wireframeLinecap,this.wireframeLinejoin=_e.wireframeLinejoin,this.fog=_e.fog,this}}class MeshNormalMaterial extends Material{constructor(_e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(_e)}copy(_e){return super.copy(_e),this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.flatShading=_e.flatShading,this}}class MeshLambertMaterial extends Material{constructor(_e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Color$1(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.combine=MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.emissive.copy(_e.emissive),this.emissiveMap=_e.emissiveMap,this.emissiveIntensity=_e.emissiveIntensity,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,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.flatShading=_e.flatShading,this.fog=_e.fog,this}}class MeshMatcapMaterial extends Material{constructor(_e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Color$1(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.defines={MATCAP:""},this.color.copy(_e.color),this.matcap=_e.matcap,this.map=_e.map,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,this.alphaMap=_e.alphaMap,this.flatShading=_e.flatShading,this.fog=_e.fog,this}}class LineDashedMaterial extends LineBasicMaterial{constructor(_e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(_e)}copy(_e){return super.copy(_e),this.scale=_e.scale,this.dashSize=_e.dashSize,this.gapSize=_e.gapSize,this}}function convertArray(kt,_e,Dt){return!kt||!Dt&&kt.constructor===_e?kt:typeof _e.BYTES_PER_ELEMENT=="number"?new _e(kt):Array.prototype.slice.call(kt)}function isTypedArray(kt){return ArrayBuffer.isView(kt)&&!(kt instanceof DataView)}function getKeyframeOrder(kt){function _e(Gt,zt){return kt[Gt]-kt[zt]}const Dt=kt.length,Vt=new Array(Dt);for(let Gt=0;Gt!==Dt;++Gt)Vt[Gt]=Gt;return Vt.sort(_e),Vt}function sortedArray(kt,_e,Dt){const Vt=kt.length,Gt=new kt.constructor(Vt);for(let zt=0,jt=0;jt!==Vt;++zt){const Ht=Dt[zt]*_e;for(let Wt=0;Wt!==_e;++Wt)Gt[jt++]=kt[Ht+Wt]}return Gt}function flattenJSON(kt,_e,Dt,Vt){let Gt=1,zt=kt[0];for(;zt!==void 0&&zt[Vt]===void 0;)zt=kt[Gt++];if(zt===void 0)return;let jt=zt[Vt];if(jt!==void 0)if(Array.isArray(jt))do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),Dt.push.apply(Dt,jt)),zt=kt[Gt++];while(zt!==void 0);else if(jt.toArray!==void 0)do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),jt.toArray(Dt,Dt.length)),zt=kt[Gt++];while(zt!==void 0);else do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),Dt.push(jt)),zt=kt[Gt++];while(zt!==void 0)}function subclip(kt,_e,Dt,Vt,Gt=30){const zt=kt.clone();zt.name=_e;const jt=[];for(let Wt=0;Wt<zt.tracks.length;++Wt){const qt=zt.tracks[Wt],Xt=qt.getValueSize(),Kt=[],Yt=[];for(let Zt=0;Zt<qt.times.length;++Zt){const Jt=qt.times[Zt]*Gt;if(!(Jt<Dt||Jt>=Vt)){Kt.push(qt.times[Zt]);for(let nn=0;nn<Xt;++nn)Yt.push(qt.values[Zt*Xt+nn])}}Kt.length!==0&&(qt.times=convertArray(Kt,qt.times.constructor),qt.values=convertArray(Yt,qt.values.constructor),jt.push(qt))}zt.tracks=jt;let Ht=1/0;for(let Wt=0;Wt<zt.tracks.length;++Wt)Ht>zt.tracks[Wt].times[0]&&(Ht=zt.tracks[Wt].times[0]);for(let Wt=0;Wt<zt.tracks.length;++Wt)zt.tracks[Wt].shift(-1*Ht);return zt.resetDuration(),zt}function makeClipAdditive(kt,_e=0,Dt=kt,Vt=30){Vt<=0&&(Vt=30);const Gt=Dt.tracks.length,zt=_e/Vt;for(let jt=0;jt<Gt;++jt){const Ht=Dt.tracks[jt],Wt=Ht.ValueTypeName;if(Wt==="bool"||Wt==="string")continue;const qt=kt.tracks.find(function(Qt){return Qt.name===Ht.name&&Qt.ValueTypeName===Wt});if(qt===void 0)continue;let Xt=0;const Kt=Ht.getValueSize();Ht.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(Xt=Kt/3);let Yt=0;const Zt=qt.getValueSize();qt.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(Yt=Zt/3);const Jt=Ht.times.length-1;let nn;if(zt<=Ht.times[0]){const Qt=Xt,en=Kt-Xt;nn=Ht.values.slice(Qt,en)}else if(zt>=Ht.times[Jt]){const Qt=Jt*Kt+Xt,en=Qt+Kt-Xt;nn=Ht.values.slice(Qt,en)}else{const Qt=Ht.createInterpolant(),en=Xt,tn=Kt-Xt;Qt.evaluate(zt),nn=Qt.resultBuffer.slice(en,tn)}Wt==="quaternion"&&new Quaternion().fromArray(nn).normalize().conjugate().toArray(nn);const rn=qt.times.length;for(let Qt=0;Qt<rn;++Qt){const en=Qt*Zt+Yt;if(Wt==="quaternion")Quaternion.multiplyQuaternionsFlat(qt.values,en,nn,0,qt.values,en);else{const tn=Zt-Yt*2;for(let sn=0;sn<tn;++sn)qt.values[en+sn]-=nn[sn]}}}return kt.blendMode=AdditiveAnimationBlendMode,kt}const AnimationUtils={convertArray,isTypedArray,getKeyframeOrder,sortedArray,flattenJSON,subclip,makeClipAdditive};class Interpolant{constructor(_e,Dt,Vt,Gt){this.parameterPositions=_e,this._cachedIndex=0,this.resultBuffer=Gt!==void 0?Gt:new Dt.constructor(Vt),this.sampleValues=Dt,this.valueSize=Vt,this.settings=null,this.DefaultSettings_={}}evaluate(_e){const Dt=this.parameterPositions;let Vt=this._cachedIndex,Gt=Dt[Vt],zt=Dt[Vt-1];e:{t:{let jt;n:{r:if(!(_e<Gt)){for(let Ht=Vt+2;;){if(Gt===void 0){if(_e<zt)break r;return Vt=Dt.length,this._cachedIndex=Vt,this.copySampleValue_(Vt-1)}if(Vt===Ht)break;if(zt=Gt,Gt=Dt[++Vt],_e<Gt)break t}jt=Dt.length;break n}if(!(_e>=zt)){const Ht=Dt[1];_e<Ht&&(Vt=2,zt=Ht);for(let Wt=Vt-2;;){if(zt===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Vt===Wt)break;if(Gt=zt,zt=Dt[--Vt-1],_e>=zt)break t}jt=Vt,Vt=0;break n}break e}for(;Vt<jt;){const Ht=Vt+jt>>>1;_e<Dt[Ht]?jt=Ht:Vt=Ht+1}if(Gt=Dt[Vt],zt=Dt[Vt-1],zt===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Gt===void 0)return Vt=Dt.length,this._cachedIndex=Vt,this.copySampleValue_(Vt-1)}this._cachedIndex=Vt,this.intervalChanged_(Vt,zt,Gt)}return this.interpolate_(Vt,zt,_e,Gt)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(_e){const Dt=this.resultBuffer,Vt=this.sampleValues,Gt=this.valueSize,zt=_e*Gt;for(let jt=0;jt!==Gt;++jt)Dt[jt]=Vt[zt+jt];return Dt}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class CubicInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding}}intervalChanged_(_e,Dt,Vt){const Gt=this.parameterPositions;let zt=_e-2,jt=_e+1,Ht=Gt[zt],Wt=Gt[jt];if(Ht===void 0)switch(this.getSettings_().endingStart){case ZeroSlopeEnding:zt=_e,Ht=2*Dt-Vt;break;case WrapAroundEnding:zt=Gt.length-2,Ht=Dt+Gt[zt]-Gt[zt+1];break;default:zt=_e,Ht=Vt}if(Wt===void 0)switch(this.getSettings_().endingEnd){case ZeroSlopeEnding:jt=_e,Wt=2*Vt-Dt;break;case WrapAroundEnding:jt=1,Wt=Vt+Gt[1]-Gt[0];break;default:jt=_e-1,Wt=Dt}const qt=(Vt-Dt)*.5,Xt=this.valueSize;this._weightPrev=qt/(Dt-Ht),this._weightNext=qt/(Wt-Vt),this._offsetPrev=zt*Xt,this._offsetNext=jt*Xt}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=_e*Ht,qt=Wt-Ht,Xt=this._offsetPrev,Kt=this._offsetNext,Yt=this._weightPrev,Zt=this._weightNext,Jt=(Vt-Dt)/(Gt-Dt),nn=Jt*Jt,rn=nn*Jt,Qt=-Yt*rn+2*Yt*nn-Yt*Jt,en=(1+Yt)*rn+(-1.5-2*Yt)*nn+(-.5+Yt)*Jt+1,tn=(-1-Zt)*rn+(1.5+Zt)*nn+.5*Jt,sn=Zt*rn-Zt*nn;for(let cn=0;cn!==Ht;++cn)zt[cn]=Qt*jt[Xt+cn]+en*jt[qt+cn]+tn*jt[Wt+cn]+sn*jt[Kt+cn];return zt}}class LinearInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=_e*Ht,qt=Wt-Ht,Xt=(Vt-Dt)/(Gt-Dt),Kt=1-Xt;for(let Yt=0;Yt!==Ht;++Yt)zt[Yt]=jt[qt+Yt]*Kt+jt[Wt+Yt]*Xt;return zt}}class DiscreteInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e){return this.copySampleValue_(_e-1)}}class KeyframeTrack{constructor(_e,Dt,Vt,Gt){if(_e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(Dt===void 0||Dt.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+_e);this.name=_e,this.times=convertArray(Dt,this.TimeBufferType),this.values=convertArray(Vt,this.ValueBufferType),this.setInterpolation(Gt||this.DefaultInterpolation)}static toJSON(_e){const Dt=_e.constructor;let Vt;if(Dt.toJSON!==this.toJSON)Vt=Dt.toJSON(_e);else{Vt={name:_e.name,times:convertArray(_e.times,Array),values:convertArray(_e.values,Array)};const Gt=_e.getInterpolation();Gt!==_e.DefaultInterpolation&&(Vt.interpolation=Gt)}return Vt.type=_e.ValueTypeName,Vt}InterpolantFactoryMethodDiscrete(_e){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),_e)}InterpolantFactoryMethodLinear(_e){return new LinearInterpolant(this.times,this.values,this.getValueSize(),_e)}InterpolantFactoryMethodSmooth(_e){return new CubicInterpolant(this.times,this.values,this.getValueSize(),_e)}setInterpolation(_e){let Dt;switch(_e){case InterpolateDiscrete:Dt=this.InterpolantFactoryMethodDiscrete;break;case InterpolateLinear:Dt=this.InterpolantFactoryMethodLinear;break;case InterpolateSmooth:Dt=this.InterpolantFactoryMethodSmooth;break}if(Dt===void 0){const Vt="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(_e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(Vt);return console.warn("THREE.KeyframeTrack:",Vt),this}return this.createInterpolant=Dt,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return InterpolateSmooth}}getValueSize(){return this.values.length/this.times.length}shift(_e){if(_e!==0){const Dt=this.times;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt)Dt[Vt]+=_e}return this}scale(_e){if(_e!==1){const Dt=this.times;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt)Dt[Vt]*=_e}return this}trim(_e,Dt){const Vt=this.times,Gt=Vt.length;let zt=0,jt=Gt-1;for(;zt!==Gt&&Vt[zt]<_e;)++zt;for(;jt!==-1&&Vt[jt]>Dt;)--jt;if(++jt,zt!==0||jt!==Gt){zt>=jt&&(jt=Math.max(jt,1),zt=jt-1);const Ht=this.getValueSize();this.times=Vt.slice(zt,jt),this.values=this.values.slice(zt*Ht,jt*Ht)}return this}validate(){let _e=!0;const Dt=this.getValueSize();Dt-Math.floor(Dt)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),_e=!1);const Vt=this.times,Gt=this.values,zt=Vt.length;zt===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),_e=!1);let jt=null;for(let Ht=0;Ht!==zt;Ht++){const Wt=Vt[Ht];if(typeof Wt=="number"&&isNaN(Wt)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,Ht,Wt),_e=!1;break}if(jt!==null&&jt>Wt){console.error("THREE.KeyframeTrack: Out of order keys.",this,Ht,Wt,jt),_e=!1;break}jt=Wt}if(Gt!==void 0&&isTypedArray(Gt))for(let Ht=0,Wt=Gt.length;Ht!==Wt;++Ht){const qt=Gt[Ht];if(isNaN(qt)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,Ht,qt),_e=!1;break}}return _e}optimize(){const _e=this.times.slice(),Dt=this.values.slice(),Vt=this.getValueSize(),Gt=this.getInterpolation()===InterpolateSmooth,zt=_e.length-1;let jt=1;for(let Ht=1;Ht<zt;++Ht){let Wt=!1;const qt=_e[Ht],Xt=_e[Ht+1];if(qt!==Xt&&(Ht!==1||qt!==_e[0]))if(Gt)Wt=!0;else{const Kt=Ht*Vt,Yt=Kt-Vt,Zt=Kt+Vt;for(let Jt=0;Jt!==Vt;++Jt){const nn=Dt[Kt+Jt];if(nn!==Dt[Yt+Jt]||nn!==Dt[Zt+Jt]){Wt=!0;break}}}if(Wt){if(Ht!==jt){_e[jt]=_e[Ht];const Kt=Ht*Vt,Yt=jt*Vt;for(let Zt=0;Zt!==Vt;++Zt)Dt[Yt+Zt]=Dt[Kt+Zt]}++jt}}if(zt>0){_e[jt]=_e[zt];for(let Ht=zt*Vt,Wt=jt*Vt,qt=0;qt!==Vt;++qt)Dt[Wt+qt]=Dt[Ht+qt];++jt}return jt!==_e.length?(this.times=_e.slice(0,jt),this.values=Dt.slice(0,jt*Vt)):(this.times=_e,this.values=Dt),this}clone(){const _e=this.times.slice(),Dt=this.values.slice(),Vt=this.constructor,Gt=new Vt(this.name,_e,Dt);return Gt.createInterpolant=this.createInterpolant,Gt}}KeyframeTrack.prototype.TimeBufferType=Float32Array;KeyframeTrack.prototype.ValueBufferType=Float32Array;KeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;class BooleanKeyframeTrack extends KeyframeTrack{}BooleanKeyframeTrack.prototype.ValueTypeName="bool";BooleanKeyframeTrack.prototype.ValueBufferType=Array;BooleanKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class ColorKeyframeTrack extends KeyframeTrack{}ColorKeyframeTrack.prototype.ValueTypeName="color";class NumberKeyframeTrack extends KeyframeTrack{}NumberKeyframeTrack.prototype.ValueTypeName="number";class QuaternionLinearInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=(Vt-Dt)/(Gt-Dt);let qt=_e*Ht;for(let Xt=qt+Ht;qt!==Xt;qt+=4)Quaternion.slerpFlat(zt,0,jt,qt-Ht,jt,qt,Wt);return zt}}class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(_e){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),_e)}}QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion";QuaternionKeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class StringKeyframeTrack extends KeyframeTrack{}StringKeyframeTrack.prototype.ValueTypeName="string";StringKeyframeTrack.prototype.ValueBufferType=Array;StringKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0;StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class VectorKeyframeTrack extends KeyframeTrack{}VectorKeyframeTrack.prototype.ValueTypeName="vector";class AnimationClip{constructor(_e="",Dt=-1,Vt=[],Gt=NormalAnimationBlendMode){this.name=_e,this.tracks=Vt,this.duration=Dt,this.blendMode=Gt,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}static parse(_e){const Dt=[],Vt=_e.tracks,Gt=1/(_e.fps||1);for(let jt=0,Ht=Vt.length;jt!==Ht;++jt)Dt.push(parseKeyframeTrack(Vt[jt]).scale(Gt));const zt=new this(_e.name,_e.duration,Dt,_e.blendMode);return zt.uuid=_e.uuid,zt}static toJSON(_e){const Dt=[],Vt=_e.tracks,Gt={name:_e.name,duration:_e.duration,tracks:Dt,uuid:_e.uuid,blendMode:_e.blendMode};for(let zt=0,jt=Vt.length;zt!==jt;++zt)Dt.push(KeyframeTrack.toJSON(Vt[zt]));return Gt}static CreateFromMorphTargetSequence(_e,Dt,Vt,Gt){const zt=Dt.length,jt=[];for(let Ht=0;Ht<zt;Ht++){let Wt=[],qt=[];Wt.push((Ht+zt-1)%zt,Ht,(Ht+1)%zt),qt.push(0,1,0);const Xt=getKeyframeOrder(Wt);Wt=sortedArray(Wt,1,Xt),qt=sortedArray(qt,1,Xt),!Gt&&Wt[0]===0&&(Wt.push(zt),qt.push(qt[0])),jt.push(new NumberKeyframeTrack(".morphTargetInfluences["+Dt[Ht].name+"]",Wt,qt).scale(1/Vt))}return new this(_e,-1,jt)}static findByName(_e,Dt){let Vt=_e;if(!Array.isArray(_e)){const Gt=_e;Vt=Gt.geometry&&Gt.geometry.animations||Gt.animations}for(let Gt=0;Gt<Vt.length;Gt++)if(Vt[Gt].name===Dt)return Vt[Gt];return null}static CreateClipsFromMorphTargetSequences(_e,Dt,Vt){const Gt={},zt=/^([\w-]*?)([\d]+)$/;for(let Ht=0,Wt=_e.length;Ht<Wt;Ht++){const qt=_e[Ht],Xt=qt.name.match(zt);if(Xt&&Xt.length>1){const Kt=Xt[1];let Yt=Gt[Kt];Yt||(Gt[Kt]=Yt=[]),Yt.push(qt)}}const jt=[];for(const Ht in Gt)jt.push(this.CreateFromMorphTargetSequence(Ht,Gt[Ht],Dt,Vt));return jt}static parseAnimation(_e,Dt){if(!_e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const Vt=function(Kt,Yt,Zt,Jt,nn){if(Zt.length!==0){const rn=[],Qt=[];flattenJSON(Zt,rn,Qt,Jt),rn.length!==0&&nn.push(new Kt(Yt,rn,Qt))}},Gt=[],zt=_e.name||"default",jt=_e.fps||30,Ht=_e.blendMode;let Wt=_e.length||-1;const qt=_e.hierarchy||[];for(let Kt=0;Kt<qt.length;Kt++){const Yt=qt[Kt].keys;if(!(!Yt||Yt.length===0))if(Yt[0].morphTargets){const Zt={};let Jt;for(Jt=0;Jt<Yt.length;Jt++)if(Yt[Jt].morphTargets)for(let nn=0;nn<Yt[Jt].morphTargets.length;nn++)Zt[Yt[Jt].morphTargets[nn]]=-1;for(const nn in Zt){const rn=[],Qt=[];for(let en=0;en!==Yt[Jt].morphTargets.length;++en){const tn=Yt[Jt];rn.push(tn.time),Qt.push(tn.morphTarget===nn?1:0)}Gt.push(new NumberKeyframeTrack(".morphTargetInfluence["+nn+"]",rn,Qt))}Wt=Zt.length*jt}else{const Zt=".bones["+Dt[Kt].name+"]";Vt(VectorKeyframeTrack,Zt+".position",Yt,"pos",Gt),Vt(QuaternionKeyframeTrack,Zt+".quaternion",Yt,"rot",Gt),Vt(VectorKeyframeTrack,Zt+".scale",Yt,"scl",Gt)}}return Gt.length===0?null:new this(zt,Wt,Gt,Ht)}resetDuration(){const _e=this.tracks;let Dt=0;for(let Vt=0,Gt=_e.length;Vt!==Gt;++Vt){const zt=this.tracks[Vt];Dt=Math.max(Dt,zt.times[zt.times.length-1])}return this.duration=Dt,this}trim(){for(let _e=0;_e<this.tracks.length;_e++)this.tracks[_e].trim(0,this.duration);return this}validate(){let _e=!0;for(let Dt=0;Dt<this.tracks.length;Dt++)_e=_e&&this.tracks[Dt].validate();return _e}optimize(){for(let _e=0;_e<this.tracks.length;_e++)this.tracks[_e].optimize();return this}clone(){const _e=[];for(let Dt=0;Dt<this.tracks.length;Dt++)_e.push(this.tracks[Dt].clone());return new this.constructor(this.name,this.duration,_e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function getTrackTypeForValueTypeName(kt){switch(kt.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return VectorKeyframeTrack;case"color":return ColorKeyframeTrack;case"quaternion":return QuaternionKeyframeTrack;case"bool":case"boolean":return BooleanKeyframeTrack;case"string":return StringKeyframeTrack}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+kt)}function parseKeyframeTrack(kt){if(kt.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const _e=getTrackTypeForValueTypeName(kt.type);if(kt.times===void 0){const Dt=[],Vt=[];flattenJSON(kt.keys,Dt,Vt,"value"),kt.times=Dt,kt.values=Vt}return _e.parse!==void 0?_e.parse(kt):new _e(kt.name,kt.times,kt.values,kt.interpolation)}const Cache={enabled:!1,files:{},add:function(kt,_e){this.enabled!==!1&&(this.files[kt]=_e)},get:function(kt){if(this.enabled!==!1)return this.files[kt]},remove:function(kt){delete this.files[kt]},clear:function(){this.files={}}};class LoadingManager{constructor(_e,Dt,Vt){const Gt=this;let zt=!1,jt=0,Ht=0,Wt;const qt=[];this.onStart=void 0,this.onLoad=_e,this.onProgress=Dt,this.onError=Vt,this.itemStart=function(Xt){Ht++,zt===!1&&Gt.onStart!==void 0&&Gt.onStart(Xt,jt,Ht),zt=!0},this.itemEnd=function(Xt){jt++,Gt.onProgress!==void 0&&Gt.onProgress(Xt,jt,Ht),jt===Ht&&(zt=!1,Gt.onLoad!==void 0&&Gt.onLoad())},this.itemError=function(Xt){Gt.onError!==void 0&&Gt.onError(Xt)},this.resolveURL=function(Xt){return Wt?Wt(Xt):Xt},this.setURLModifier=function(Xt){return Wt=Xt,this},this.addHandler=function(Xt,Kt){return qt.push(Xt,Kt),this},this.removeHandler=function(Xt){const Kt=qt.indexOf(Xt);return Kt!==-1&&qt.splice(Kt,2),this},this.getHandler=function(Xt){for(let Kt=0,Yt=qt.length;Kt<Yt;Kt+=2){const Zt=qt[Kt],Jt=qt[Kt+1];if(Zt.global&&(Zt.lastIndex=0),Zt.test(Xt))return Jt}return null}}}const DefaultLoadingManager=new LoadingManager;class Loader{constructor(_e){this.manager=_e!==void 0?_e:DefaultLoadingManager,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(_e,Dt){const Vt=this;return new Promise(function(Gt,zt){Vt.load(_e,Gt,Dt,zt)})}parse(){}setCrossOrigin(_e){return this.crossOrigin=_e,this}setWithCredentials(_e){return this.withCredentials=_e,this}setPath(_e){return this.path=_e,this}setResourcePath(_e){return this.resourcePath=_e,this}setRequestHeader(_e){return this.requestHeader=_e,this}}Loader.DEFAULT_MATERIAL_NAME="__DEFAULT";const loading={};class HttpError extends Error{constructor(_e,Dt){super(_e),this.response=Dt}}class FileLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){_e===void 0&&(_e=""),this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=Cache.get(_e);if(zt!==void 0)return this.manager.itemStart(_e),setTimeout(()=>{Dt&&Dt(zt),this.manager.itemEnd(_e)},0),zt;if(loading[_e]!==void 0){loading[_e].push({onLoad:Dt,onProgress:Vt,onError:Gt});return}loading[_e]=[],loading[_e].push({onLoad:Dt,onProgress:Vt,onError:Gt});const jt=new Request(_e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),Ht=this.mimeType,Wt=this.responseType;fetch(jt).then(qt=>{if(qt.status===200||qt.status===0){if(qt.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||qt.body===void 0||qt.body.getReader===void 0)return qt;const Xt=loading[_e],Kt=qt.body.getReader(),Yt=qt.headers.get("Content-Length")||qt.headers.get("X-File-Size"),Zt=Yt?parseInt(Yt):0,Jt=Zt!==0;let nn=0;const rn=new ReadableStream({start(Qt){en();function en(){Kt.read().then(({done:tn,value:sn})=>{if(tn)Qt.close();else{nn+=sn.byteLength;const cn=new ProgressEvent("progress",{lengthComputable:Jt,loaded:nn,total:Zt});for(let un=0,hn=Xt.length;un<hn;un++){const fn=Xt[un];fn.onProgress&&fn.onProgress(cn)}Qt.enqueue(sn),en()}})}}});return new Response(rn)}else throw new HttpError(`fetch for "${qt.url}" responded with ${qt.status}: ${qt.statusText}`,qt)}).then(qt=>{switch(Wt){case"arraybuffer":return qt.arrayBuffer();case"blob":return qt.blob();case"document":return qt.text().then(Xt=>new DOMParser().parseFromString(Xt,Ht));case"json":return qt.json();default:if(Ht===void 0)return qt.text();{const Kt=/charset="?([^;"\s]*)"?/i.exec(Ht),Yt=Kt&&Kt[1]?Kt[1].toLowerCase():void 0,Zt=new TextDecoder(Yt);return qt.arrayBuffer().then(Jt=>Zt.decode(Jt))}}}).then(qt=>{Cache.add(_e,qt);const Xt=loading[_e];delete loading[_e];for(let Kt=0,Yt=Xt.length;Kt<Yt;Kt++){const Zt=Xt[Kt];Zt.onLoad&&Zt.onLoad(qt)}}).catch(qt=>{const Xt=loading[_e];if(Xt===void 0)throw this.manager.itemError(_e),qt;delete loading[_e];for(let Kt=0,Yt=Xt.length;Kt<Yt;Kt++){const Zt=Xt[Kt];Zt.onError&&Zt.onError(qt)}this.manager.itemError(_e)}).finally(()=>{this.manager.itemEnd(_e)}),this.manager.itemStart(_e)}setResponseType(_e){return this.responseType=_e,this}setMimeType(_e){return this.mimeType=_e,this}}class AnimationLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(this.manager);jt.setPath(this.path),jt.setRequestHeader(this.requestHeader),jt.setWithCredentials(this.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt=[];for(let Vt=0;Vt<_e.length;Vt++){const Gt=AnimationClip.parse(_e[Vt]);Dt.push(Gt)}return Dt}}class CompressedTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=[],Ht=new CompressedTexture,Wt=new FileLoader(this.manager);Wt.setPath(this.path),Wt.setResponseType("arraybuffer"),Wt.setRequestHeader(this.requestHeader),Wt.setWithCredentials(zt.withCredentials);let qt=0;function Xt(Kt){Wt.load(_e[Kt],function(Yt){const Zt=zt.parse(Yt,!0);jt[Kt]={width:Zt.width,height:Zt.height,format:Zt.format,mipmaps:Zt.mipmaps},qt+=1,qt===6&&(Zt.mipmapCount===1&&(Ht.minFilter=LinearFilter),Ht.image=jt,Ht.format=Zt.format,Ht.needsUpdate=!0,Dt&&Dt(Ht))},Vt,Gt)}if(Array.isArray(_e))for(let Kt=0,Yt=_e.length;Kt<Yt;++Kt)Xt(Kt);else Wt.load(_e,function(Kt){const Yt=zt.parse(Kt,!0);if(Yt.isCubemap){const Zt=Yt.mipmaps.length/Yt.mipmapCount;for(let Jt=0;Jt<Zt;Jt++){jt[Jt]={mipmaps:[]};for(let nn=0;nn<Yt.mipmapCount;nn++)jt[Jt].mipmaps.push(Yt.mipmaps[Jt*Yt.mipmapCount+nn]),jt[Jt].format=Yt.format,jt[Jt].width=Yt.width,jt[Jt].height=Yt.height}Ht.image=jt}else Ht.image.width=Yt.width,Ht.image.height=Yt.height,Ht.mipmaps=Yt.mipmaps;Yt.mipmapCount===1&&(Ht.minFilter=LinearFilter),Ht.format=Yt.format,Ht.needsUpdate=!0,Dt&&Dt(Ht)},Vt,Gt);return Ht}}class ImageLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=this,jt=Cache.get(_e);if(jt!==void 0)return zt.manager.itemStart(_e),setTimeout(function(){Dt&&Dt(jt),zt.manager.itemEnd(_e)},0),jt;const Ht=createElementNS("img");function Wt(){Xt(),Cache.add(_e,this),Dt&&Dt(this),zt.manager.itemEnd(_e)}function qt(Kt){Xt(),Gt&&Gt(Kt),zt.manager.itemError(_e),zt.manager.itemEnd(_e)}function Xt(){Ht.removeEventListener("load",Wt,!1),Ht.removeEventListener("error",qt,!1)}return Ht.addEventListener("load",Wt,!1),Ht.addEventListener("error",qt,!1),_e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(Ht.crossOrigin=this.crossOrigin),zt.manager.itemStart(_e),Ht.src=_e,Ht}}class CubeTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=new CubeTexture;zt.colorSpace=SRGBColorSpace$1;const jt=new ImageLoader(this.manager);jt.setCrossOrigin(this.crossOrigin),jt.setPath(this.path);let Ht=0;function Wt(qt){jt.load(_e[qt],function(Xt){zt.images[qt]=Xt,Ht++,Ht===6&&(zt.needsUpdate=!0,Dt&&Dt(zt))},void 0,Gt)}for(let qt=0;qt<_e.length;++qt)Wt(qt);return zt}}class DataTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new DataTexture,Ht=new FileLoader(this.manager);return Ht.setResponseType("arraybuffer"),Ht.setRequestHeader(this.requestHeader),Ht.setPath(this.path),Ht.setWithCredentials(zt.withCredentials),Ht.load(_e,function(Wt){let qt;try{qt=zt.parse(Wt)}catch(Xt){if(Gt!==void 0)Gt(Xt);else{console.error(Xt);return}}qt.image!==void 0?jt.image=qt.image:qt.data!==void 0&&(jt.image.width=qt.width,jt.image.height=qt.height,jt.image.data=qt.data),jt.wrapS=qt.wrapS!==void 0?qt.wrapS:ClampToEdgeWrapping,jt.wrapT=qt.wrapT!==void 0?qt.wrapT:ClampToEdgeWrapping,jt.magFilter=qt.magFilter!==void 0?qt.magFilter:LinearFilter,jt.minFilter=qt.minFilter!==void 0?qt.minFilter:LinearFilter,jt.anisotropy=qt.anisotropy!==void 0?qt.anisotropy:1,qt.colorSpace!==void 0&&(jt.colorSpace=qt.colorSpace),qt.flipY!==void 0&&(jt.flipY=qt.flipY),qt.format!==void 0&&(jt.format=qt.format),qt.type!==void 0&&(jt.type=qt.type),qt.mipmaps!==void 0&&(jt.mipmaps=qt.mipmaps,jt.minFilter=LinearMipmapLinearFilter),qt.mipmapCount===1&&(jt.minFilter=LinearFilter),qt.generateMipmaps!==void 0&&(jt.generateMipmaps=qt.generateMipmaps),jt.needsUpdate=!0,Dt&&Dt(jt,qt)},Vt,Gt),jt}}class TextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=new Texture,jt=new ImageLoader(this.manager);return jt.setCrossOrigin(this.crossOrigin),jt.setPath(this.path),jt.load(_e,function(Ht){zt.image=Ht,zt.needsUpdate=!0,Dt!==void 0&&Dt(zt)},Vt,Gt),zt}}class Light extends Object3D{constructor(_e,Dt=1){super(),this.isLight=!0,this.type="Light",this.color=new Color$1(_e),this.intensity=Dt}dispose(){}copy(_e,Dt){return super.copy(_e,Dt),this.color.copy(_e.color),this.intensity=_e.intensity,this}toJSON(_e){const Dt=super.toJSON(_e);return Dt.object.color=this.color.getHex(),Dt.object.intensity=this.intensity,this.groundColor!==void 0&&(Dt.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(Dt.object.distance=this.distance),this.angle!==void 0&&(Dt.object.angle=this.angle),this.decay!==void 0&&(Dt.object.decay=this.decay),this.penumbra!==void 0&&(Dt.object.penumbra=this.penumbra),this.shadow!==void 0&&(Dt.object.shadow=this.shadow.toJSON()),Dt}}class HemisphereLight extends Light{constructor(_e,Dt,Vt){super(_e,Vt),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Color$1(Dt)}copy(_e,Dt){return super.copy(_e,Dt),this.groundColor.copy(_e.groundColor),this}}const _projScreenMatrix$1=new Matrix4,_lightPositionWorld$1=new Vector3,_lookTarget$1=new Vector3;class LightShadow{constructor(_e){this.camera=_e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vector2(512,512),this.map=null,this.mapPass=null,this.matrix=new Matrix4,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Frustum,this._frameExtents=new Vector2(1,1),this._viewportCount=1,this._viewports=[new Vector4(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(_e){const Dt=this.camera,Vt=this.matrix;_lightPositionWorld$1.setFromMatrixPosition(_e.matrixWorld),Dt.position.copy(_lightPositionWorld$1),_lookTarget$1.setFromMatrixPosition(_e.target.matrixWorld),Dt.lookAt(_lookTarget$1),Dt.updateMatrixWorld(),_projScreenMatrix$1.multiplyMatrices(Dt.projectionMatrix,Dt.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix$1),Vt.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),Vt.multiply(_projScreenMatrix$1)}getViewport(_e){return this._viewports[_e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(_e){return this.camera=_e.camera.clone(),this.bias=_e.bias,this.radius=_e.radius,this.mapSize.copy(_e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const _e={};return this.bias!==0&&(_e.bias=this.bias),this.normalBias!==0&&(_e.normalBias=this.normalBias),this.radius!==1&&(_e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(_e.mapSize=this.mapSize.toArray()),_e.camera=this.camera.toJSON(!1).object,delete _e.camera.matrix,_e}}class SpotLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(_e){const Dt=this.camera,Vt=RAD2DEG*2*_e.angle*this.focus,Gt=this.mapSize.width/this.mapSize.height,zt=_e.distance||Dt.far;(Vt!==Dt.fov||Gt!==Dt.aspect||zt!==Dt.far)&&(Dt.fov=Vt,Dt.aspect=Gt,Dt.far=zt,Dt.updateProjectionMatrix()),super.updateMatrices(_e)}copy(_e){return super.copy(_e),this.focus=_e.focus,this}}class SpotLight extends Light{constructor(_e,Dt,Vt=0,Gt=Math.PI/3,zt=0,jt=2){super(_e,Dt),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.distance=Vt,this.angle=Gt,this.penumbra=zt,this.decay=jt,this.map=null,this.shadow=new SpotLightShadow}get power(){return this.intensity*Math.PI}set power(_e){this.intensity=_e/Math.PI}dispose(){this.shadow.dispose()}copy(_e,Dt){return super.copy(_e,Dt),this.distance=_e.distance,this.angle=_e.angle,this.penumbra=_e.penumbra,this.decay=_e.decay,this.target=_e.target.clone(),this.shadow=_e.shadow.clone(),this}}const _projScreenMatrix=new Matrix4,_lightPositionWorld=new Vector3,_lookTarget=new Vector3;class PointLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Vector2(4,2),this._viewportCount=6,this._viewports=[new Vector4(2,1,1,1),new Vector4(0,1,1,1),new Vector4(3,1,1,1),new Vector4(1,1,1,1),new Vector4(3,0,1,1),new Vector4(1,0,1,1)],this._cubeDirections=[new Vector3(1,0,0),new Vector3(-1,0,0),new Vector3(0,0,1),new Vector3(0,0,-1),new Vector3(0,1,0),new Vector3(0,-1,0)],this._cubeUps=[new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,0,1),new Vector3(0,0,-1)]}updateMatrices(_e,Dt=0){const Vt=this.camera,Gt=this.matrix,zt=_e.distance||Vt.far;zt!==Vt.far&&(Vt.far=zt,Vt.updateProjectionMatrix()),_lightPositionWorld.setFromMatrixPosition(_e.matrixWorld),Vt.position.copy(_lightPositionWorld),_lookTarget.copy(Vt.position),_lookTarget.add(this._cubeDirections[Dt]),Vt.up.copy(this._cubeUps[Dt]),Vt.lookAt(_lookTarget),Vt.updateMatrixWorld(),Gt.makeTranslation(-_lightPositionWorld.x,-_lightPositionWorld.y,-_lightPositionWorld.z),_projScreenMatrix.multiplyMatrices(Vt.projectionMatrix,Vt.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix)}}class PointLight extends Light{constructor(_e,Dt,Vt=0,Gt=2){super(_e,Dt),this.isPointLight=!0,this.type="PointLight",this.distance=Vt,this.decay=Gt,this.shadow=new PointLightShadow}get power(){return this.intensity*4*Math.PI}set power(_e){this.intensity=_e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(_e,Dt){return super.copy(_e,Dt),this.distance=_e.distance,this.decay=_e.decay,this.shadow=_e.shadow.clone(),this}}class DirectionalLightShadow extends LightShadow{constructor(){super(new OrthographicCamera(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class DirectionalLight extends Light{constructor(_e,Dt){super(_e,Dt),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.shadow=new DirectionalLightShadow}dispose(){this.shadow.dispose()}copy(_e){return super.copy(_e),this.target=_e.target.clone(),this.shadow=_e.shadow.clone(),this}}class AmbientLight extends Light{constructor(_e,Dt){super(_e,Dt),this.isAmbientLight=!0,this.type="AmbientLight"}}class RectAreaLight extends Light{constructor(_e,Dt,Vt=10,Gt=10){super(_e,Dt),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=Vt,this.height=Gt}get power(){return this.intensity*this.width*this.height*Math.PI}set power(_e){this.intensity=_e/(this.width*this.height*Math.PI)}copy(_e){return super.copy(_e),this.width=_e.width,this.height=_e.height,this}toJSON(_e){const Dt=super.toJSON(_e);return Dt.object.width=this.width,Dt.object.height=this.height,Dt}}class SphericalHarmonics3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let _e=0;_e<9;_e++)this.coefficients.push(new Vector3)}set(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].copy(_e[Dt]);return this}zero(){for(let _e=0;_e<9;_e++)this.coefficients[_e].set(0,0,0);return this}getAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z,jt=this.coefficients;return Dt.copy(jt[0]).multiplyScalar(.282095),Dt.addScaledVector(jt[1],.488603*Gt),Dt.addScaledVector(jt[2],.488603*zt),Dt.addScaledVector(jt[3],.488603*Vt),Dt.addScaledVector(jt[4],1.092548*(Vt*Gt)),Dt.addScaledVector(jt[5],1.092548*(Gt*zt)),Dt.addScaledVector(jt[6],.315392*(3*zt*zt-1)),Dt.addScaledVector(jt[7],1.092548*(Vt*zt)),Dt.addScaledVector(jt[8],.546274*(Vt*Vt-Gt*Gt)),Dt}getIrradianceAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z,jt=this.coefficients;return Dt.copy(jt[0]).multiplyScalar(.886227),Dt.addScaledVector(jt[1],2*.511664*Gt),Dt.addScaledVector(jt[2],2*.511664*zt),Dt.addScaledVector(jt[3],2*.511664*Vt),Dt.addScaledVector(jt[4],2*.429043*Vt*Gt),Dt.addScaledVector(jt[5],2*.429043*Gt*zt),Dt.addScaledVector(jt[6],.743125*zt*zt-.247708),Dt.addScaledVector(jt[7],2*.429043*Vt*zt),Dt.addScaledVector(jt[8],.429043*(Vt*Vt-Gt*Gt)),Dt}add(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].add(_e.coefficients[Dt]);return this}addScaledSH(_e,Dt){for(let Vt=0;Vt<9;Vt++)this.coefficients[Vt].addScaledVector(_e.coefficients[Vt],Dt);return this}scale(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].multiplyScalar(_e);return this}lerp(_e,Dt){for(let Vt=0;Vt<9;Vt++)this.coefficients[Vt].lerp(_e.coefficients[Vt],Dt);return this}equals(_e){for(let Dt=0;Dt<9;Dt++)if(!this.coefficients[Dt].equals(_e.coefficients[Dt]))return!1;return!0}copy(_e){return this.set(_e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(_e,Dt=0){const Vt=this.coefficients;for(let Gt=0;Gt<9;Gt++)Vt[Gt].fromArray(_e,Dt+Gt*3);return this}toArray(_e=[],Dt=0){const Vt=this.coefficients;for(let Gt=0;Gt<9;Gt++)Vt[Gt].toArray(_e,Dt+Gt*3);return _e}static getBasisAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z;Dt[0]=.282095,Dt[1]=.488603*Gt,Dt[2]=.488603*zt,Dt[3]=.488603*Vt,Dt[4]=1.092548*Vt*Gt,Dt[5]=1.092548*Gt*zt,Dt[6]=.315392*(3*zt*zt-1),Dt[7]=1.092548*Vt*zt,Dt[8]=.546274*(Vt*Vt-Gt*Gt)}}class LightProbe extends Light{constructor(_e=new SphericalHarmonics3,Dt=1){super(void 0,Dt),this.isLightProbe=!0,this.sh=_e}copy(_e){return super.copy(_e),this.sh.copy(_e.sh),this}fromJSON(_e){return this.intensity=_e.intensity,this.sh.fromArray(_e.sh),this}toJSON(_e){const Dt=super.toJSON(_e);return Dt.object.sh=this.sh.toArray(),Dt}}class MaterialLoader extends Loader{constructor(_e){super(_e),this.textures={}}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(zt.manager);jt.setPath(zt.path),jt.setRequestHeader(zt.requestHeader),jt.setWithCredentials(zt.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt=this.textures;function Vt(zt){return Dt[zt]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",zt),Dt[zt]}const Gt=MaterialLoader.createMaterialFromType(_e.type);if(_e.uuid!==void 0&&(Gt.uuid=_e.uuid),_e.name!==void 0&&(Gt.name=_e.name),_e.color!==void 0&&Gt.color!==void 0&&Gt.color.setHex(_e.color),_e.roughness!==void 0&&(Gt.roughness=_e.roughness),_e.metalness!==void 0&&(Gt.metalness=_e.metalness),_e.sheen!==void 0&&(Gt.sheen=_e.sheen),_e.sheenColor!==void 0&&(Gt.sheenColor=new Color$1().setHex(_e.sheenColor)),_e.sheenRoughness!==void 0&&(Gt.sheenRoughness=_e.sheenRoughness),_e.emissive!==void 0&&Gt.emissive!==void 0&&Gt.emissive.setHex(_e.emissive),_e.specular!==void 0&&Gt.specular!==void 0&&Gt.specular.setHex(_e.specular),_e.specularIntensity!==void 0&&(Gt.specularIntensity=_e.specularIntensity),_e.specularColor!==void 0&&Gt.specularColor!==void 0&&Gt.specularColor.setHex(_e.specularColor),_e.shininess!==void 0&&(Gt.shininess=_e.shininess),_e.clearcoat!==void 0&&(Gt.clearcoat=_e.clearcoat),_e.clearcoatRoughness!==void 0&&(Gt.clearcoatRoughness=_e.clearcoatRoughness),_e.iridescence!==void 0&&(Gt.iridescence=_e.iridescence),_e.iridescenceIOR!==void 0&&(Gt.iridescenceIOR=_e.iridescenceIOR),_e.iridescenceThicknessRange!==void 0&&(Gt.iridescenceThicknessRange=_e.iridescenceThicknessRange),_e.transmission!==void 0&&(Gt.transmission=_e.transmission),_e.thickness!==void 0&&(Gt.thickness=_e.thickness),_e.attenuationDistance!==void 0&&(Gt.attenuationDistance=_e.attenuationDistance),_e.attenuationColor!==void 0&&Gt.attenuationColor!==void 0&&Gt.attenuationColor.setHex(_e.attenuationColor),_e.anisotropy!==void 0&&(Gt.anisotropy=_e.anisotropy),_e.anisotropyRotation!==void 0&&(Gt.anisotropyRotation=_e.anisotropyRotation),_e.fog!==void 0&&(Gt.fog=_e.fog),_e.flatShading!==void 0&&(Gt.flatShading=_e.flatShading),_e.blending!==void 0&&(Gt.blending=_e.blending),_e.combine!==void 0&&(Gt.combine=_e.combine),_e.side!==void 0&&(Gt.side=_e.side),_e.shadowSide!==void 0&&(Gt.shadowSide=_e.shadowSide),_e.opacity!==void 0&&(Gt.opacity=_e.opacity),_e.transparent!==void 0&&(Gt.transparent=_e.transparent),_e.alphaTest!==void 0&&(Gt.alphaTest=_e.alphaTest),_e.alphaHash!==void 0&&(Gt.alphaHash=_e.alphaHash),_e.depthFunc!==void 0&&(Gt.depthFunc=_e.depthFunc),_e.depthTest!==void 0&&(Gt.depthTest=_e.depthTest),_e.depthWrite!==void 0&&(Gt.depthWrite=_e.depthWrite),_e.colorWrite!==void 0&&(Gt.colorWrite=_e.colorWrite),_e.blendSrc!==void 0&&(Gt.blendSrc=_e.blendSrc),_e.blendDst!==void 0&&(Gt.blendDst=_e.blendDst),_e.blendEquation!==void 0&&(Gt.blendEquation=_e.blendEquation),_e.blendSrcAlpha!==void 0&&(Gt.blendSrcAlpha=_e.blendSrcAlpha),_e.blendDstAlpha!==void 0&&(Gt.blendDstAlpha=_e.blendDstAlpha),_e.blendEquationAlpha!==void 0&&(Gt.blendEquationAlpha=_e.blendEquationAlpha),_e.blendColor!==void 0&&Gt.blendColor!==void 0&&Gt.blendColor.setHex(_e.blendColor),_e.blendAlpha!==void 0&&(Gt.blendAlpha=_e.blendAlpha),_e.stencilWriteMask!==void 0&&(Gt.stencilWriteMask=_e.stencilWriteMask),_e.stencilFunc!==void 0&&(Gt.stencilFunc=_e.stencilFunc),_e.stencilRef!==void 0&&(Gt.stencilRef=_e.stencilRef),_e.stencilFuncMask!==void 0&&(Gt.stencilFuncMask=_e.stencilFuncMask),_e.stencilFail!==void 0&&(Gt.stencilFail=_e.stencilFail),_e.stencilZFail!==void 0&&(Gt.stencilZFail=_e.stencilZFail),_e.stencilZPass!==void 0&&(Gt.stencilZPass=_e.stencilZPass),_e.stencilWrite!==void 0&&(Gt.stencilWrite=_e.stencilWrite),_e.wireframe!==void 0&&(Gt.wireframe=_e.wireframe),_e.wireframeLinewidth!==void 0&&(Gt.wireframeLinewidth=_e.wireframeLinewidth),_e.wireframeLinecap!==void 0&&(Gt.wireframeLinecap=_e.wireframeLinecap),_e.wireframeLinejoin!==void 0&&(Gt.wireframeLinejoin=_e.wireframeLinejoin),_e.rotation!==void 0&&(Gt.rotation=_e.rotation),_e.linewidth!==void 0&&(Gt.linewidth=_e.linewidth),_e.dashSize!==void 0&&(Gt.dashSize=_e.dashSize),_e.gapSize!==void 0&&(Gt.gapSize=_e.gapSize),_e.scale!==void 0&&(Gt.scale=_e.scale),_e.polygonOffset!==void 0&&(Gt.polygonOffset=_e.polygonOffset),_e.polygonOffsetFactor!==void 0&&(Gt.polygonOffsetFactor=_e.polygonOffsetFactor),_e.polygonOffsetUnits!==void 0&&(Gt.polygonOffsetUnits=_e.polygonOffsetUnits),_e.dithering!==void 0&&(Gt.dithering=_e.dithering),_e.alphaToCoverage!==void 0&&(Gt.alphaToCoverage=_e.alphaToCoverage),_e.premultipliedAlpha!==void 0&&(Gt.premultipliedAlpha=_e.premultipliedAlpha),_e.forceSinglePass!==void 0&&(Gt.forceSinglePass=_e.forceSinglePass),_e.visible!==void 0&&(Gt.visible=_e.visible),_e.toneMapped!==void 0&&(Gt.toneMapped=_e.toneMapped),_e.userData!==void 0&&(Gt.userData=_e.userData),_e.vertexColors!==void 0&&(typeof _e.vertexColors=="number"?Gt.vertexColors=_e.vertexColors>0:Gt.vertexColors=_e.vertexColors),_e.uniforms!==void 0)for(const zt in _e.uniforms){const jt=_e.uniforms[zt];switch(Gt.uniforms[zt]={},jt.type){case"t":Gt.uniforms[zt].value=Vt(jt.value);break;case"c":Gt.uniforms[zt].value=new Color$1().setHex(jt.value);break;case"v2":Gt.uniforms[zt].value=new Vector2().fromArray(jt.value);break;case"v3":Gt.uniforms[zt].value=new Vector3().fromArray(jt.value);break;case"v4":Gt.uniforms[zt].value=new Vector4().fromArray(jt.value);break;case"m3":Gt.uniforms[zt].value=new Matrix3().fromArray(jt.value);break;case"m4":Gt.uniforms[zt].value=new Matrix4().fromArray(jt.value);break;default:Gt.uniforms[zt].value=jt.value}}if(_e.defines!==void 0&&(Gt.defines=_e.defines),_e.vertexShader!==void 0&&(Gt.vertexShader=_e.vertexShader),_e.fragmentShader!==void 0&&(Gt.fragmentShader=_e.fragmentShader),_e.glslVersion!==void 0&&(Gt.glslVersion=_e.glslVersion),_e.extensions!==void 0)for(const zt in _e.extensions)Gt.extensions[zt]=_e.extensions[zt];if(_e.lights!==void 0&&(Gt.lights=_e.lights),_e.clipping!==void 0&&(Gt.clipping=_e.clipping),_e.size!==void 0&&(Gt.size=_e.size),_e.sizeAttenuation!==void 0&&(Gt.sizeAttenuation=_e.sizeAttenuation),_e.map!==void 0&&(Gt.map=Vt(_e.map)),_e.matcap!==void 0&&(Gt.matcap=Vt(_e.matcap)),_e.alphaMap!==void 0&&(Gt.alphaMap=Vt(_e.alphaMap)),_e.bumpMap!==void 0&&(Gt.bumpMap=Vt(_e.bumpMap)),_e.bumpScale!==void 0&&(Gt.bumpScale=_e.bumpScale),_e.normalMap!==void 0&&(Gt.normalMap=Vt(_e.normalMap)),_e.normalMapType!==void 0&&(Gt.normalMapType=_e.normalMapType),_e.normalScale!==void 0){let zt=_e.normalScale;Array.isArray(zt)===!1&&(zt=[zt,zt]),Gt.normalScale=new Vector2().fromArray(zt)}return _e.displacementMap!==void 0&&(Gt.displacementMap=Vt(_e.displacementMap)),_e.displacementScale!==void 0&&(Gt.displacementScale=_e.displacementScale),_e.displacementBias!==void 0&&(Gt.displacementBias=_e.displacementBias),_e.roughnessMap!==void 0&&(Gt.roughnessMap=Vt(_e.roughnessMap)),_e.metalnessMap!==void 0&&(Gt.metalnessMap=Vt(_e.metalnessMap)),_e.emissiveMap!==void 0&&(Gt.emissiveMap=Vt(_e.emissiveMap)),_e.emissiveIntensity!==void 0&&(Gt.emissiveIntensity=_e.emissiveIntensity),_e.specularMap!==void 0&&(Gt.specularMap=Vt(_e.specularMap)),_e.specularIntensityMap!==void 0&&(Gt.specularIntensityMap=Vt(_e.specularIntensityMap)),_e.specularColorMap!==void 0&&(Gt.specularColorMap=Vt(_e.specularColorMap)),_e.envMap!==void 0&&(Gt.envMap=Vt(_e.envMap)),_e.envMapRotation!==void 0&&Gt.envMapRotation.fromArray(_e.envMapRotation),_e.envMapIntensity!==void 0&&(Gt.envMapIntensity=_e.envMapIntensity),_e.reflectivity!==void 0&&(Gt.reflectivity=_e.reflectivity),_e.refractionRatio!==void 0&&(Gt.refractionRatio=_e.refractionRatio),_e.lightMap!==void 0&&(Gt.lightMap=Vt(_e.lightMap)),_e.lightMapIntensity!==void 0&&(Gt.lightMapIntensity=_e.lightMapIntensity),_e.aoMap!==void 0&&(Gt.aoMap=Vt(_e.aoMap)),_e.aoMapIntensity!==void 0&&(Gt.aoMapIntensity=_e.aoMapIntensity),_e.gradientMap!==void 0&&(Gt.gradientMap=Vt(_e.gradientMap)),_e.clearcoatMap!==void 0&&(Gt.clearcoatMap=Vt(_e.clearcoatMap)),_e.clearcoatRoughnessMap!==void 0&&(Gt.clearcoatRoughnessMap=Vt(_e.clearcoatRoughnessMap)),_e.clearcoatNormalMap!==void 0&&(Gt.clearcoatNormalMap=Vt(_e.clearcoatNormalMap)),_e.clearcoatNormalScale!==void 0&&(Gt.clearcoatNormalScale=new Vector2().fromArray(_e.clearcoatNormalScale)),_e.iridescenceMap!==void 0&&(Gt.iridescenceMap=Vt(_e.iridescenceMap)),_e.iridescenceThicknessMap!==void 0&&(Gt.iridescenceThicknessMap=Vt(_e.iridescenceThicknessMap)),_e.transmissionMap!==void 0&&(Gt.transmissionMap=Vt(_e.transmissionMap)),_e.thicknessMap!==void 0&&(Gt.thicknessMap=Vt(_e.thicknessMap)),_e.anisotropyMap!==void 0&&(Gt.anisotropyMap=Vt(_e.anisotropyMap)),_e.sheenColorMap!==void 0&&(Gt.sheenColorMap=Vt(_e.sheenColorMap)),_e.sheenRoughnessMap!==void 0&&(Gt.sheenRoughnessMap=Vt(_e.sheenRoughnessMap)),Gt}setTextures(_e){return this.textures=_e,this}static createMaterialFromType(_e){const Dt={ShadowMaterial,SpriteMaterial,RawShaderMaterial,ShaderMaterial,PointsMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshPhongMaterial,MeshToonMaterial,MeshNormalMaterial,MeshLambertMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshBasicMaterial,MeshMatcapMaterial,LineDashedMaterial,LineBasicMaterial,Material};return new Dt[_e]}}class LoaderUtils{static decodeText(_e){if(typeof TextDecoder<"u")return new TextDecoder().decode(_e);let Dt="";for(let Vt=0,Gt=_e.length;Vt<Gt;Vt++)Dt+=String.fromCharCode(_e[Vt]);try{return decodeURIComponent(escape(Dt))}catch{return Dt}}static extractUrlBase(_e){const Dt=_e.lastIndexOf("/");return Dt===-1?"./":_e.slice(0,Dt+1)}static resolveURL(_e,Dt){return typeof _e!="string"||_e===""?"":(/^https?:\/\//i.test(Dt)&&/^\//.test(_e)&&(Dt=Dt.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(_e)||/^data:.*,.*$/i.test(_e)||/^blob:.*$/i.test(_e)?_e:Dt+_e)}}class InstancedBufferGeometry extends BufferGeometry{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(_e){return super.copy(_e),this.instanceCount=_e.instanceCount,this}toJSON(){const _e=super.toJSON();return _e.instanceCount=this.instanceCount,_e.isInstancedBufferGeometry=!0,_e}}class BufferGeometryLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(zt.manager);jt.setPath(zt.path),jt.setRequestHeader(zt.requestHeader),jt.setWithCredentials(zt.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt={},Vt={};function Gt(Zt,Jt){if(Dt[Jt]!==void 0)return Dt[Jt];const rn=Zt.interleavedBuffers[Jt],Qt=zt(Zt,rn.buffer),en=getTypedArray(rn.type,Qt),tn=new InterleavedBuffer(en,rn.stride);return tn.uuid=rn.uuid,Dt[Jt]=tn,tn}function zt(Zt,Jt){if(Vt[Jt]!==void 0)return Vt[Jt];const rn=Zt.arrayBuffers[Jt],Qt=new Uint32Array(rn).buffer;return Vt[Jt]=Qt,Qt}const jt=_e.isInstancedBufferGeometry?new InstancedBufferGeometry:new BufferGeometry,Ht=_e.data.index;if(Ht!==void 0){const Zt=getTypedArray(Ht.type,Ht.array);jt.setIndex(new BufferAttribute(Zt,1))}const Wt=_e.data.attributes;for(const Zt in Wt){const Jt=Wt[Zt];let nn;if(Jt.isInterleavedBufferAttribute){const rn=Gt(_e.data,Jt.data);nn=new InterleavedBufferAttribute(rn,Jt.itemSize,Jt.offset,Jt.normalized)}else{const rn=getTypedArray(Jt.type,Jt.array),Qt=Jt.isInstancedBufferAttribute?InstancedBufferAttribute:BufferAttribute;nn=new Qt(rn,Jt.itemSize,Jt.normalized)}Jt.name!==void 0&&(nn.name=Jt.name),Jt.usage!==void 0&&nn.setUsage(Jt.usage),jt.setAttribute(Zt,nn)}const qt=_e.data.morphAttributes;if(qt)for(const Zt in qt){const Jt=qt[Zt],nn=[];for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];let tn;if(en.isInterleavedBufferAttribute){const sn=Gt(_e.data,en.data);tn=new InterleavedBufferAttribute(sn,en.itemSize,en.offset,en.normalized)}else{const sn=getTypedArray(en.type,en.array);tn=new BufferAttribute(sn,en.itemSize,en.normalized)}en.name!==void 0&&(tn.name=en.name),nn.push(tn)}jt.morphAttributes[Zt]=nn}_e.data.morphTargetsRelative&&(jt.morphTargetsRelative=!0);const Kt=_e.data.groups||_e.data.drawcalls||_e.data.offsets;if(Kt!==void 0)for(let Zt=0,Jt=Kt.length;Zt!==Jt;++Zt){const nn=Kt[Zt];jt.addGroup(nn.start,nn.count,nn.materialIndex)}const Yt=_e.data.boundingSphere;if(Yt!==void 0){const Zt=new Vector3;Yt.center!==void 0&&Zt.fromArray(Yt.center),jt.boundingSphere=new Sphere(Zt,Yt.radius)}return _e.name&&(jt.name=_e.name),_e.userData&&(jt.userData=_e.userData),jt}}class ObjectLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=this.path===""?LoaderUtils.extractUrlBase(_e):this.path;this.resourcePath=this.resourcePath||jt;const Ht=new FileLoader(this.manager);Ht.setPath(this.path),Ht.setRequestHeader(this.requestHeader),Ht.setWithCredentials(this.withCredentials),Ht.load(_e,function(Wt){let qt=null;try{qt=JSON.parse(Wt)}catch(Kt){Gt!==void 0&&Gt(Kt),console.error("THREE:ObjectLoader: Can't parse "+_e+".",Kt.message);return}const Xt=qt.metadata;if(Xt===void 0||Xt.type===void 0||Xt.type.toLowerCase()==="geometry"){Gt!==void 0&&Gt(new Error("THREE.ObjectLoader: Can't load "+_e)),console.error("THREE.ObjectLoader: Can't load "+_e);return}zt.parse(qt,Dt)},Vt,Gt)}async loadAsync(_e,Dt){const Vt=this,Gt=this.path===""?LoaderUtils.extractUrlBase(_e):this.path;this.resourcePath=this.resourcePath||Gt;const zt=new FileLoader(this.manager);zt.setPath(this.path),zt.setRequestHeader(this.requestHeader),zt.setWithCredentials(this.withCredentials);const jt=await zt.loadAsync(_e,Dt),Ht=JSON.parse(jt),Wt=Ht.metadata;if(Wt===void 0||Wt.type===void 0||Wt.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+_e);return await Vt.parseAsync(Ht)}parse(_e,Dt){const Vt=this.parseAnimations(_e.animations),Gt=this.parseShapes(_e.shapes),zt=this.parseGeometries(_e.geometries,Gt),jt=this.parseImages(_e.images,function(){Dt!==void 0&&Dt(qt)}),Ht=this.parseTextures(_e.textures,jt),Wt=this.parseMaterials(_e.materials,Ht),qt=this.parseObject(_e.object,zt,Wt,Ht,Vt),Xt=this.parseSkeletons(_e.skeletons,qt);if(this.bindSkeletons(qt,Xt),Dt!==void 0){let Kt=!1;for(const Yt in jt)if(jt[Yt].data instanceof HTMLImageElement){Kt=!0;break}Kt===!1&&Dt(qt)}return qt}async parseAsync(_e){const Dt=this.parseAnimations(_e.animations),Vt=this.parseShapes(_e.shapes),Gt=this.parseGeometries(_e.geometries,Vt),zt=await this.parseImagesAsync(_e.images),jt=this.parseTextures(_e.textures,zt),Ht=this.parseMaterials(_e.materials,jt),Wt=this.parseObject(_e.object,Gt,Ht,jt,Dt),qt=this.parseSkeletons(_e.skeletons,Wt);return this.bindSkeletons(Wt,qt),Wt}parseShapes(_e){const Dt={};if(_e!==void 0)for(let Vt=0,Gt=_e.length;Vt<Gt;Vt++){const zt=new Shape().fromJSON(_e[Vt]);Dt[zt.uuid]=zt}return Dt}parseSkeletons(_e,Dt){const Vt={},Gt={};if(Dt.traverse(function(zt){zt.isBone&&(Gt[zt.uuid]=zt)}),_e!==void 0)for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=new Skeleton().fromJSON(_e[zt],Gt);Vt[Ht.uuid]=Ht}return Vt}parseGeometries(_e,Dt){const Vt={};if(_e!==void 0){const Gt=new BufferGeometryLoader;for(let zt=0,jt=_e.length;zt<jt;zt++){let Ht;const Wt=_e[zt];switch(Wt.type){case"BufferGeometry":case"InstancedBufferGeometry":Ht=Gt.parse(Wt);break;default:Wt.type in Geometries?Ht=Geometries[Wt.type].fromJSON(Wt,Dt):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${Wt.type}"`)}Ht.uuid=Wt.uuid,Wt.name!==void 0&&(Ht.name=Wt.name),Wt.userData!==void 0&&(Ht.userData=Wt.userData),Vt[Wt.uuid]=Ht}}return Vt}parseMaterials(_e,Dt){const Vt={},Gt={};if(_e!==void 0){const zt=new MaterialLoader;zt.setTextures(Dt);for(let jt=0,Ht=_e.length;jt<Ht;jt++){const Wt=_e[jt];Vt[Wt.uuid]===void 0&&(Vt[Wt.uuid]=zt.parse(Wt)),Gt[Wt.uuid]=Vt[Wt.uuid]}}return Gt}parseAnimations(_e){const Dt={};if(_e!==void 0)for(let Vt=0;Vt<_e.length;Vt++){const Gt=_e[Vt],zt=AnimationClip.parse(Gt);Dt[zt.uuid]=zt}return Dt}parseImages(_e,Dt){const Vt=this,Gt={};let zt;function jt(Wt){return Vt.manager.itemStart(Wt),zt.load(Wt,function(){Vt.manager.itemEnd(Wt)},void 0,function(){Vt.manager.itemError(Wt),Vt.manager.itemEnd(Wt)})}function Ht(Wt){if(typeof Wt=="string"){const qt=Wt,Xt=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(qt)?qt:Vt.resourcePath+qt;return jt(Xt)}else return Wt.data?{data:getTypedArray(Wt.type,Wt.data),width:Wt.width,height:Wt.height}:null}if(_e!==void 0&&_e.length>0){const Wt=new LoadingManager(Dt);zt=new ImageLoader(Wt),zt.setCrossOrigin(this.crossOrigin);for(let qt=0,Xt=_e.length;qt<Xt;qt++){const Kt=_e[qt],Yt=Kt.url;if(Array.isArray(Yt)){const Zt=[];for(let Jt=0,nn=Yt.length;Jt<nn;Jt++){const rn=Yt[Jt],Qt=Ht(rn);Qt!==null&&(Qt instanceof HTMLImageElement?Zt.push(Qt):Zt.push(new DataTexture(Qt.data,Qt.width,Qt.height)))}Gt[Kt.uuid]=new Source(Zt)}else{const Zt=Ht(Kt.url);Gt[Kt.uuid]=new Source(Zt)}}}return Gt}async parseImagesAsync(_e){const Dt=this,Vt={};let Gt;async function zt(jt){if(typeof jt=="string"){const Ht=jt,Wt=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(Ht)?Ht:Dt.resourcePath+Ht;return await Gt.loadAsync(Wt)}else return jt.data?{data:getTypedArray(jt.type,jt.data),width:jt.width,height:jt.height}:null}if(_e!==void 0&&_e.length>0){Gt=new ImageLoader(this.manager),Gt.setCrossOrigin(this.crossOrigin);for(let jt=0,Ht=_e.length;jt<Ht;jt++){const Wt=_e[jt],qt=Wt.url;if(Array.isArray(qt)){const Xt=[];for(let Kt=0,Yt=qt.length;Kt<Yt;Kt++){const Zt=qt[Kt],Jt=await zt(Zt);Jt!==null&&(Jt instanceof HTMLImageElement?Xt.push(Jt):Xt.push(new DataTexture(Jt.data,Jt.width,Jt.height)))}Vt[Wt.uuid]=new Source(Xt)}else{const Xt=await zt(Wt.url);Vt[Wt.uuid]=new Source(Xt)}}}return Vt}parseTextures(_e,Dt){function Vt(zt,jt){return typeof zt=="number"?zt:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",zt),jt[zt])}const Gt={};if(_e!==void 0)for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=_e[zt];Ht.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',Ht.uuid),Dt[Ht.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",Ht.image);const Wt=Dt[Ht.image],qt=Wt.data;let Xt;Array.isArray(qt)?(Xt=new CubeTexture,qt.length===6&&(Xt.needsUpdate=!0)):(qt&&qt.data?Xt=new DataTexture:Xt=new Texture,qt&&(Xt.needsUpdate=!0)),Xt.source=Wt,Xt.uuid=Ht.uuid,Ht.name!==void 0&&(Xt.name=Ht.name),Ht.mapping!==void 0&&(Xt.mapping=Vt(Ht.mapping,TEXTURE_MAPPING)),Ht.channel!==void 0&&(Xt.channel=Ht.channel),Ht.offset!==void 0&&Xt.offset.fromArray(Ht.offset),Ht.repeat!==void 0&&Xt.repeat.fromArray(Ht.repeat),Ht.center!==void 0&&Xt.center.fromArray(Ht.center),Ht.rotation!==void 0&&(Xt.rotation=Ht.rotation),Ht.wrap!==void 0&&(Xt.wrapS=Vt(Ht.wrap[0],TEXTURE_WRAPPING),Xt.wrapT=Vt(Ht.wrap[1],TEXTURE_WRAPPING)),Ht.format!==void 0&&(Xt.format=Ht.format),Ht.internalFormat!==void 0&&(Xt.internalFormat=Ht.internalFormat),Ht.type!==void 0&&(Xt.type=Ht.type),Ht.colorSpace!==void 0&&(Xt.colorSpace=Ht.colorSpace),Ht.minFilter!==void 0&&(Xt.minFilter=Vt(Ht.minFilter,TEXTURE_FILTER)),Ht.magFilter!==void 0&&(Xt.magFilter=Vt(Ht.magFilter,TEXTURE_FILTER)),Ht.anisotropy!==void 0&&(Xt.anisotropy=Ht.anisotropy),Ht.flipY!==void 0&&(Xt.flipY=Ht.flipY),Ht.generateMipmaps!==void 0&&(Xt.generateMipmaps=Ht.generateMipmaps),Ht.premultiplyAlpha!==void 0&&(Xt.premultiplyAlpha=Ht.premultiplyAlpha),Ht.unpackAlignment!==void 0&&(Xt.unpackAlignment=Ht.unpackAlignment),Ht.compareFunction!==void 0&&(Xt.compareFunction=Ht.compareFunction),Ht.userData!==void 0&&(Xt.userData=Ht.userData),Gt[Ht.uuid]=Xt}return Gt}parseObject(_e,Dt,Vt,Gt,zt){let jt;function Ht(Yt){return Dt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",Yt),Dt[Yt]}function Wt(Yt){if(Yt!==void 0){if(Array.isArray(Yt)){const Zt=[];for(let Jt=0,nn=Yt.length;Jt<nn;Jt++){const rn=Yt[Jt];Vt[rn]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",rn),Zt.push(Vt[rn])}return Zt}return Vt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",Yt),Vt[Yt]}}function qt(Yt){return Gt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",Yt),Gt[Yt]}let Xt,Kt;switch(_e.type){case"Scene":jt=new Scene,_e.background!==void 0&&(Number.isInteger(_e.background)?jt.background=new Color$1(_e.background):jt.background=qt(_e.background)),_e.environment!==void 0&&(jt.environment=qt(_e.environment)),_e.fog!==void 0&&(_e.fog.type==="Fog"?jt.fog=new Fog(_e.fog.color,_e.fog.near,_e.fog.far):_e.fog.type==="FogExp2"&&(jt.fog=new FogExp2(_e.fog.color,_e.fog.density)),_e.fog.name!==""&&(jt.fog.name=_e.fog.name)),_e.backgroundBlurriness!==void 0&&(jt.backgroundBlurriness=_e.backgroundBlurriness),_e.backgroundIntensity!==void 0&&(jt.backgroundIntensity=_e.backgroundIntensity),_e.backgroundRotation!==void 0&&jt.backgroundRotation.fromArray(_e.backgroundRotation),_e.environmentIntensity!==void 0&&(jt.environmentIntensity=_e.environmentIntensity),_e.environmentRotation!==void 0&&jt.environmentRotation.fromArray(_e.environmentRotation);break;case"PerspectiveCamera":jt=new PerspectiveCamera(_e.fov,_e.aspect,_e.near,_e.far),_e.focus!==void 0&&(jt.focus=_e.focus),_e.zoom!==void 0&&(jt.zoom=_e.zoom),_e.filmGauge!==void 0&&(jt.filmGauge=_e.filmGauge),_e.filmOffset!==void 0&&(jt.filmOffset=_e.filmOffset),_e.view!==void 0&&(jt.view=Object.assign({},_e.view));break;case"OrthographicCamera":jt=new OrthographicCamera(_e.left,_e.right,_e.top,_e.bottom,_e.near,_e.far),_e.zoom!==void 0&&(jt.zoom=_e.zoom),_e.view!==void 0&&(jt.view=Object.assign({},_e.view));break;case"AmbientLight":jt=new AmbientLight(_e.color,_e.intensity);break;case"DirectionalLight":jt=new DirectionalLight(_e.color,_e.intensity);break;case"PointLight":jt=new PointLight(_e.color,_e.intensity,_e.distance,_e.decay);break;case"RectAreaLight":jt=new RectAreaLight(_e.color,_e.intensity,_e.width,_e.height);break;case"SpotLight":jt=new SpotLight(_e.color,_e.intensity,_e.distance,_e.angle,_e.penumbra,_e.decay);break;case"HemisphereLight":jt=new HemisphereLight(_e.color,_e.groundColor,_e.intensity);break;case"LightProbe":jt=new LightProbe().fromJSON(_e);break;case"SkinnedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new SkinnedMesh(Xt,Kt),_e.bindMode!==void 0&&(jt.bindMode=_e.bindMode),_e.bindMatrix!==void 0&&jt.bindMatrix.fromArray(_e.bindMatrix),_e.skeleton!==void 0&&(jt.skeleton=_e.skeleton);break;case"Mesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new Mesh(Xt,Kt);break;case"InstancedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material);const Yt=_e.count,Zt=_e.instanceMatrix,Jt=_e.instanceColor;jt=new InstancedMesh(Xt,Kt,Yt),jt.instanceMatrix=new InstancedBufferAttribute(new Float32Array(Zt.array),16),Jt!==void 0&&(jt.instanceColor=new InstancedBufferAttribute(new Float32Array(Jt.array),Jt.itemSize));break;case"BatchedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new BatchedMesh(_e.maxGeometryCount,_e.maxVertexCount,_e.maxIndexCount,Kt),jt.geometry=Xt,jt.perObjectFrustumCulled=_e.perObjectFrustumCulled,jt.sortObjects=_e.sortObjects,jt._drawRanges=_e.drawRanges,jt._reservedRanges=_e.reservedRanges,jt._visibility=_e.visibility,jt._active=_e.active,jt._bounds=_e.bounds.map(nn=>{const rn=new Box3;rn.min.fromArray(nn.boxMin),rn.max.fromArray(nn.boxMax);const Qt=new Sphere;return Qt.radius=nn.sphereRadius,Qt.center.fromArray(nn.sphereCenter),{boxInitialized:nn.boxInitialized,box:rn,sphereInitialized:nn.sphereInitialized,sphere:Qt}}),jt._maxGeometryCount=_e.maxGeometryCount,jt._maxVertexCount=_e.maxVertexCount,jt._maxIndexCount=_e.maxIndexCount,jt._geometryInitialized=_e.geometryInitialized,jt._geometryCount=_e.geometryCount,jt._matricesTexture=qt(_e.matricesTexture.uuid);break;case"LOD":jt=new LOD;break;case"Line":jt=new Line(Ht(_e.geometry),Wt(_e.material));break;case"LineLoop":jt=new LineLoop(Ht(_e.geometry),Wt(_e.material));break;case"LineSegments":jt=new LineSegments(Ht(_e.geometry),Wt(_e.material));break;case"PointCloud":case"Points":jt=new Points(Ht(_e.geometry),Wt(_e.material));break;case"Sprite":jt=new Sprite(Wt(_e.material));break;case"Group":jt=new Group;break;case"Bone":jt=new Bone;break;default:jt=new Object3D}if(jt.uuid=_e.uuid,_e.name!==void 0&&(jt.name=_e.name),_e.matrix!==void 0?(jt.matrix.fromArray(_e.matrix),_e.matrixAutoUpdate!==void 0&&(jt.matrixAutoUpdate=_e.matrixAutoUpdate),jt.matrixAutoUpdate&&jt.matrix.decompose(jt.position,jt.quaternion,jt.scale)):(_e.position!==void 0&&jt.position.fromArray(_e.position),_e.rotation!==void 0&&jt.rotation.fromArray(_e.rotation),_e.quaternion!==void 0&&jt.quaternion.fromArray(_e.quaternion),_e.scale!==void 0&&jt.scale.fromArray(_e.scale)),_e.up!==void 0&&jt.up.fromArray(_e.up),_e.castShadow!==void 0&&(jt.castShadow=_e.castShadow),_e.receiveShadow!==void 0&&(jt.receiveShadow=_e.receiveShadow),_e.shadow&&(_e.shadow.bias!==void 0&&(jt.shadow.bias=_e.shadow.bias),_e.shadow.normalBias!==void 0&&(jt.shadow.normalBias=_e.shadow.normalBias),_e.shadow.radius!==void 0&&(jt.shadow.radius=_e.shadow.radius),_e.shadow.mapSize!==void 0&&jt.shadow.mapSize.fromArray(_e.shadow.mapSize),_e.shadow.camera!==void 0&&(jt.shadow.camera=this.parseObject(_e.shadow.camera))),_e.visible!==void 0&&(jt.visible=_e.visible),_e.frustumCulled!==void 0&&(jt.frustumCulled=_e.frustumCulled),_e.renderOrder!==void 0&&(jt.renderOrder=_e.renderOrder),_e.userData!==void 0&&(jt.userData=_e.userData),_e.layers!==void 0&&(jt.layers.mask=_e.layers),_e.children!==void 0){const Yt=_e.children;for(let Zt=0;Zt<Yt.length;Zt++)jt.add(this.parseObject(Yt[Zt],Dt,Vt,Gt,zt))}if(_e.animations!==void 0){const Yt=_e.animations;for(let Zt=0;Zt<Yt.length;Zt++){const Jt=Yt[Zt];jt.animations.push(zt[Jt])}}if(_e.type==="LOD"){_e.autoUpdate!==void 0&&(jt.autoUpdate=_e.autoUpdate);const Yt=_e.levels;for(let Zt=0;Zt<Yt.length;Zt++){const Jt=Yt[Zt],nn=jt.getObjectByProperty("uuid",Jt.object);nn!==void 0&&jt.addLevel(nn,Jt.distance,Jt.hysteresis)}}return jt}bindSkeletons(_e,Dt){Object.keys(Dt).length!==0&&_e.traverse(function(Vt){if(Vt.isSkinnedMesh===!0&&Vt.skeleton!==void 0){const Gt=Dt[Vt.skeleton];Gt===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",Vt.skeleton):Vt.bind(Gt,Vt.bindMatrix)}})}}const TEXTURE_MAPPING={UVMapping,CubeReflectionMapping,CubeRefractionMapping,EquirectangularReflectionMapping,EquirectangularRefractionMapping,CubeUVReflectionMapping},TEXTURE_WRAPPING={RepeatWrapping,ClampToEdgeWrapping,MirroredRepeatWrapping},TEXTURE_FILTER={NearestFilter,NearestMipmapNearestFilter,NearestMipmapLinearFilter,LinearFilter,LinearMipmapNearestFilter,LinearMipmapLinearFilter};class ImageBitmapLoader extends Loader{constructor(_e){super(_e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(_e){return this.options=_e,this}load(_e,Dt,Vt,Gt){_e===void 0&&(_e=""),this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=this,jt=Cache.get(_e);if(jt!==void 0){if(zt.manager.itemStart(_e),jt.then){jt.then(qt=>{Dt&&Dt(qt),zt.manager.itemEnd(_e)}).catch(qt=>{Gt&&Gt(qt)});return}return setTimeout(function(){Dt&&Dt(jt),zt.manager.itemEnd(_e)},0),jt}const Ht={};Ht.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",Ht.headers=this.requestHeader;const Wt=fetch(_e,Ht).then(function(qt){return qt.blob()}).then(function(qt){return createImageBitmap(qt,Object.assign(zt.options,{colorSpaceConversion:"none"}))}).then(function(qt){return Cache.add(_e,qt),Dt&&Dt(qt),zt.manager.itemEnd(_e),qt}).catch(function(qt){Gt&&Gt(qt),Cache.remove(_e),zt.manager.itemError(_e),zt.manager.itemEnd(_e)});Cache.add(_e,Wt),zt.manager.itemStart(_e)}}let _context;class AudioContext{static getContext(){return _context===void 0&&(_context=new(window.AudioContext||window.webkitAudioContext)),_context}static setContext(_e){_context=_e}}class AudioLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(this.manager);jt.setResponseType("arraybuffer"),jt.setPath(this.path),jt.setRequestHeader(this.requestHeader),jt.setWithCredentials(this.withCredentials),jt.load(_e,function(Wt){try{const qt=Wt.slice(0);AudioContext.getContext().decodeAudioData(qt,function(Kt){Dt(Kt)}).catch(Ht)}catch(qt){Ht(qt)}},Vt,Gt);function Ht(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}}}const _eyeRight=new Matrix4,_eyeLeft=new Matrix4,_projectionMatrix=new Matrix4;class StereoCamera{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(_e){const Dt=this._cache;if(Dt.focus!==_e.focus||Dt.fov!==_e.fov||Dt.aspect!==_e.aspect*this.aspect||Dt.near!==_e.near||Dt.far!==_e.far||Dt.zoom!==_e.zoom||Dt.eyeSep!==this.eyeSep){Dt.focus=_e.focus,Dt.fov=_e.fov,Dt.aspect=_e.aspect*this.aspect,Dt.near=_e.near,Dt.far=_e.far,Dt.zoom=_e.zoom,Dt.eyeSep=this.eyeSep,_projectionMatrix.copy(_e.projectionMatrix);const Gt=Dt.eyeSep/2,zt=Gt*Dt.near/Dt.focus,jt=Dt.near*Math.tan(DEG2RAD$1*Dt.fov*.5)/Dt.zoom;let Ht,Wt;_eyeLeft.elements[12]=-Gt,_eyeRight.elements[12]=Gt,Ht=-jt*Dt.aspect+zt,Wt=jt*Dt.aspect+zt,_projectionMatrix.elements[0]=2*Dt.near/(Wt-Ht),_projectionMatrix.elements[8]=(Wt+Ht)/(Wt-Ht),this.cameraL.projectionMatrix.copy(_projectionMatrix),Ht=-jt*Dt.aspect-zt,Wt=jt*Dt.aspect-zt,_projectionMatrix.elements[0]=2*Dt.near/(Wt-Ht),_projectionMatrix.elements[8]=(Wt+Ht)/(Wt-Ht),this.cameraR.projectionMatrix.copy(_projectionMatrix)}this.cameraL.matrixWorld.copy(_e.matrixWorld).multiply(_eyeLeft),this.cameraR.matrixWorld.copy(_e.matrixWorld).multiply(_eyeRight)}}class Clock{constructor(_e=!0){this.autoStart=_e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let _e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const Dt=now();_e=(Dt-this.oldTime)/1e3,this.oldTime=Dt,this.elapsedTime+=_e}return _e}}function now(){return(typeof performance>"u"?Date:performance).now()}const _position$1=new Vector3,_quaternion$1=new Quaternion,_scale$1=new Vector3,_orientation$1=new Vector3;class AudioListener extends Object3D{constructor(){super(),this.type="AudioListener",this.context=AudioContext.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Clock}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(_e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=_e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(_e){return this.gain.gain.setTargetAtTime(_e,this.context.currentTime,.01),this}updateMatrixWorld(_e){super.updateMatrixWorld(_e);const Dt=this.context.listener,Vt=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(_position$1,_quaternion$1,_scale$1),_orientation$1.set(0,0,-1).applyQuaternion(_quaternion$1),Dt.positionX){const Gt=this.context.currentTime+this.timeDelta;Dt.positionX.linearRampToValueAtTime(_position$1.x,Gt),Dt.positionY.linearRampToValueAtTime(_position$1.y,Gt),Dt.positionZ.linearRampToValueAtTime(_position$1.z,Gt),Dt.forwardX.linearRampToValueAtTime(_orientation$1.x,Gt),Dt.forwardY.linearRampToValueAtTime(_orientation$1.y,Gt),Dt.forwardZ.linearRampToValueAtTime(_orientation$1.z,Gt),Dt.upX.linearRampToValueAtTime(Vt.x,Gt),Dt.upY.linearRampToValueAtTime(Vt.y,Gt),Dt.upZ.linearRampToValueAtTime(Vt.z,Gt)}else Dt.setPosition(_position$1.x,_position$1.y,_position$1.z),Dt.setOrientation(_orientation$1.x,_orientation$1.y,_orientation$1.z,Vt.x,Vt.y,Vt.z)}}class Audio extends Object3D{constructor(_e){super(),this.type="Audio",this.listener=_e,this.context=_e.context,this.gain=this.context.createGain(),this.gain.connect(_e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(_e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=_e,this.connect(),this}setMediaElementSource(_e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(_e),this.connect(),this}setMediaStreamSource(_e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(_e),this.connect(),this}setBuffer(_e){return this.buffer=_e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(_e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+_e;const Dt=this.context.createBufferSource();return Dt.buffer=this.buffer,Dt.loop=this.loop,Dt.loopStart=this.loopStart,Dt.loopEnd=this.loopEnd,Dt.onended=this.onEnded.bind(this),Dt.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=Dt,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let _e=1,Dt=this.filters.length;_e<Dt;_e++)this.filters[_e-1].connect(this.filters[_e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let _e=1,Dt=this.filters.length;_e<Dt;_e++)this.filters[_e-1].disconnect(this.filters[_e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(_e){return _e||(_e=[]),this._connected===!0?(this.disconnect(),this.filters=_e.slice(),this.connect()):this.filters=_e.slice(),this}setDetune(_e){return this.detune=_e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(_e){return this.setFilters(_e?[_e]:[])}setPlaybackRate(_e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=_e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(_e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=_e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(_e){return this.loopStart=_e,this}setLoopEnd(_e){return this.loopEnd=_e,this}getVolume(){return this.gain.gain.value}setVolume(_e){return this.gain.gain.setTargetAtTime(_e,this.context.currentTime,.01),this}}const _position=new Vector3,_quaternion=new Quaternion,_scale=new Vector3,_orientation=new Vector3;class PositionalAudio extends Audio{constructor(_e){super(_e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(_e){return this.panner.refDistance=_e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(_e){return this.panner.rolloffFactor=_e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(_e){return this.panner.distanceModel=_e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(_e){return this.panner.maxDistance=_e,this}setDirectionalCone(_e,Dt,Vt){return this.panner.coneInnerAngle=_e,this.panner.coneOuterAngle=Dt,this.panner.coneOuterGain=Vt,this}updateMatrixWorld(_e){if(super.updateMatrixWorld(_e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(_position,_quaternion,_scale),_orientation.set(0,0,1).applyQuaternion(_quaternion);const Dt=this.panner;if(Dt.positionX){const Vt=this.context.currentTime+this.listener.timeDelta;Dt.positionX.linearRampToValueAtTime(_position.x,Vt),Dt.positionY.linearRampToValueAtTime(_position.y,Vt),Dt.positionZ.linearRampToValueAtTime(_position.z,Vt),Dt.orientationX.linearRampToValueAtTime(_orientation.x,Vt),Dt.orientationY.linearRampToValueAtTime(_orientation.y,Vt),Dt.orientationZ.linearRampToValueAtTime(_orientation.z,Vt)}else Dt.setPosition(_position.x,_position.y,_position.z),Dt.setOrientation(_orientation.x,_orientation.y,_orientation.z)}}class AudioAnalyser{constructor(_e,Dt=2048){this.analyser=_e.context.createAnalyser(),this.analyser.fftSize=Dt,this.data=new Uint8Array(this.analyser.frequencyBinCount),_e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let _e=0;const Dt=this.getFrequencyData();for(let Vt=0;Vt<Dt.length;Vt++)_e+=Dt[Vt];return _e/Dt.length}}class PropertyMixer{constructor(_e,Dt,Vt){this.binding=_e,this.valueSize=Vt;let Gt,zt,jt;switch(Dt){case"quaternion":Gt=this._slerp,zt=this._slerpAdditive,jt=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(Vt*6),this._workIndex=5;break;case"string":case"bool":Gt=this._select,zt=this._select,jt=this._setAdditiveIdentityOther,this.buffer=new Array(Vt*5);break;default:Gt=this._lerp,zt=this._lerpAdditive,jt=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(Vt*5)}this._mixBufferRegion=Gt,this._mixBufferRegionAdditive=zt,this._setIdentity=jt,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(_e,Dt){const Vt=this.buffer,Gt=this.valueSize,zt=_e*Gt+Gt;let jt=this.cumulativeWeight;if(jt===0){for(let Ht=0;Ht!==Gt;++Ht)Vt[zt+Ht]=Vt[Ht];jt=Dt}else{jt+=Dt;const Ht=Dt/jt;this._mixBufferRegion(Vt,zt,0,Ht,Gt)}this.cumulativeWeight=jt}accumulateAdditive(_e){const Dt=this.buffer,Vt=this.valueSize,Gt=Vt*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(Dt,Gt,0,_e,Vt),this.cumulativeWeightAdditive+=_e}apply(_e){const Dt=this.valueSize,Vt=this.buffer,Gt=_e*Dt+Dt,zt=this.cumulativeWeight,jt=this.cumulativeWeightAdditive,Ht=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,zt<1){const Wt=Dt*this._origIndex;this._mixBufferRegion(Vt,Gt,Wt,1-zt,Dt)}jt>0&&this._mixBufferRegionAdditive(Vt,Gt,this._addIndex*Dt,1,Dt);for(let Wt=Dt,qt=Dt+Dt;Wt!==qt;++Wt)if(Vt[Wt]!==Vt[Wt+Dt]){Ht.setValue(Vt,Gt);break}}saveOriginalState(){const _e=this.binding,Dt=this.buffer,Vt=this.valueSize,Gt=Vt*this._origIndex;_e.getValue(Dt,Gt);for(let zt=Vt,jt=Gt;zt!==jt;++zt)Dt[zt]=Dt[Gt+zt%Vt];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const _e=this.valueSize*3;this.binding.setValue(this.buffer,_e)}_setAdditiveIdentityNumeric(){const _e=this._addIndex*this.valueSize,Dt=_e+this.valueSize;for(let Vt=_e;Vt<Dt;Vt++)this.buffer[Vt]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const _e=this._origIndex*this.valueSize,Dt=this._addIndex*this.valueSize;for(let Vt=0;Vt<this.valueSize;Vt++)this.buffer[Dt+Vt]=this.buffer[_e+Vt]}_select(_e,Dt,Vt,Gt,zt){if(Gt>=.5)for(let jt=0;jt!==zt;++jt)_e[Dt+jt]=_e[Vt+jt]}_slerp(_e,Dt,Vt,Gt){Quaternion.slerpFlat(_e,Dt,_e,Dt,_e,Vt,Gt)}_slerpAdditive(_e,Dt,Vt,Gt,zt){const jt=this._workIndex*zt;Quaternion.multiplyQuaternionsFlat(_e,jt,_e,Dt,_e,Vt),Quaternion.slerpFlat(_e,Dt,_e,Dt,_e,jt,Gt)}_lerp(_e,Dt,Vt,Gt,zt){const jt=1-Gt;for(let Ht=0;Ht!==zt;++Ht){const Wt=Dt+Ht;_e[Wt]=_e[Wt]*jt+_e[Vt+Ht]*Gt}}_lerpAdditive(_e,Dt,Vt,Gt,zt){for(let jt=0;jt!==zt;++jt){const Ht=Dt+jt;_e[Ht]=_e[Ht]+_e[Vt+jt]*Gt}}}const _RESERVED_CHARS_RE="\\[\\]\\.:\\/",_reservedRe=new RegExp("["+_RESERVED_CHARS_RE+"]","g"),_wordChar="[^"+_RESERVED_CHARS_RE+"]",_wordCharOrDot="[^"+_RESERVED_CHARS_RE.replace("\\.","")+"]",_directoryRe=/((?:WC+[\/:])*)/.source.replace("WC",_wordChar),_nodeRe=/(WCOD+)?/.source.replace("WCOD",_wordCharOrDot),_objectRe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_wordChar),_propertyRe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_wordChar),_trackRe=new RegExp("^"+_directoryRe+_nodeRe+_objectRe+_propertyRe+"$"),_supportedObjectNames=["material","materials","bones","map"];class Composite{constructor(_e,Dt,Vt){const Gt=Vt||PropertyBinding.parseTrackName(Dt);this._targetGroup=_e,this._bindings=_e.subscribe_(Dt,Gt)}getValue(_e,Dt){this.bind();const Vt=this._targetGroup.nCachedObjects_,Gt=this._bindings[Vt];Gt!==void 0&&Gt.getValue(_e,Dt)}setValue(_e,Dt){const Vt=this._bindings;for(let Gt=this._targetGroup.nCachedObjects_,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt].setValue(_e,Dt)}bind(){const _e=this._bindings;for(let Dt=this._targetGroup.nCachedObjects_,Vt=_e.length;Dt!==Vt;++Dt)_e[Dt].bind()}unbind(){const _e=this._bindings;for(let Dt=this._targetGroup.nCachedObjects_,Vt=_e.length;Dt!==Vt;++Dt)_e[Dt].unbind()}}class PropertyBinding{constructor(_e,Dt,Vt){this.path=Dt,this.parsedPath=Vt||PropertyBinding.parseTrackName(Dt),this.node=PropertyBinding.findNode(_e,this.parsedPath.nodeName),this.rootNode=_e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(_e,Dt,Vt){return _e&&_e.isAnimationObjectGroup?new PropertyBinding.Composite(_e,Dt,Vt):new PropertyBinding(_e,Dt,Vt)}static sanitizeNodeName(_e){return _e.replace(/\s/g,"_").replace(_reservedRe,"")}static parseTrackName(_e){const Dt=_trackRe.exec(_e);if(Dt===null)throw new Error("PropertyBinding: Cannot parse trackName: "+_e);const Vt={nodeName:Dt[2],objectName:Dt[3],objectIndex:Dt[4],propertyName:Dt[5],propertyIndex:Dt[6]},Gt=Vt.nodeName&&Vt.nodeName.lastIndexOf(".");if(Gt!==void 0&&Gt!==-1){const zt=Vt.nodeName.substring(Gt+1);_supportedObjectNames.indexOf(zt)!==-1&&(Vt.nodeName=Vt.nodeName.substring(0,Gt),Vt.objectName=zt)}if(Vt.propertyName===null||Vt.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+_e);return Vt}static findNode(_e,Dt){if(Dt===void 0||Dt===""||Dt==="."||Dt===-1||Dt===_e.name||Dt===_e.uuid)return _e;if(_e.skeleton){const Vt=_e.skeleton.getBoneByName(Dt);if(Vt!==void 0)return Vt}if(_e.children){const Vt=function(zt){for(let jt=0;jt<zt.length;jt++){const Ht=zt[jt];if(Ht.name===Dt||Ht.uuid===Dt)return Ht;const Wt=Vt(Ht.children);if(Wt)return Wt}return null},Gt=Vt(_e.children);if(Gt)return Gt}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(_e,Dt){_e[Dt]=this.targetObject[this.propertyName]}_getValue_array(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)_e[Dt++]=Vt[Gt]}_getValue_arrayElement(_e,Dt){_e[Dt]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(_e,Dt){this.resolvedProperty.toArray(_e,Dt)}_setValue_direct(_e,Dt){this.targetObject[this.propertyName]=_e[Dt]}_setValue_direct_setNeedsUpdate(_e,Dt){this.targetObject[this.propertyName]=_e[Dt],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(_e,Dt){this.targetObject[this.propertyName]=_e[Dt],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++]}_setValue_array_setNeedsUpdate(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt]}_setValue_arrayElement_setNeedsUpdate(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(_e,Dt){this.resolvedProperty.fromArray(_e,Dt)}_setValue_fromArray_setNeedsUpdate(_e,Dt){this.resolvedProperty.fromArray(_e,Dt),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(_e,Dt){this.resolvedProperty.fromArray(_e,Dt),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(_e,Dt){this.bind(),this.getValue(_e,Dt)}_setValue_unbound(_e,Dt){this.bind(),this.setValue(_e,Dt)}bind(){let _e=this.node;const Dt=this.parsedPath,Vt=Dt.objectName,Gt=Dt.propertyName;let zt=Dt.propertyIndex;if(_e||(_e=PropertyBinding.findNode(this.rootNode,Dt.nodeName),this.node=_e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!_e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(Vt){let qt=Dt.objectIndex;switch(Vt){case"materials":if(!_e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!_e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}_e=_e.material.materials;break;case"bones":if(!_e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}_e=_e.skeleton.bones;for(let Xt=0;Xt<_e.length;Xt++)if(_e[Xt].name===qt){qt=Xt;break}break;case"map":if("map"in _e){_e=_e.map;break}if(!_e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!_e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}_e=_e.material.map;break;default:if(_e[Vt]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}_e=_e[Vt]}if(qt!==void 0){if(_e[qt]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,_e);return}_e=_e[qt]}}const jt=_e[Gt];if(jt===void 0){const qt=Dt.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+qt+"."+Gt+" but it wasn't found.",_e);return}let Ht=this.Versioning.None;this.targetObject=_e,_e.needsUpdate!==void 0?Ht=this.Versioning.NeedsUpdate:_e.matrixWorldNeedsUpdate!==void 0&&(Ht=this.Versioning.MatrixWorldNeedsUpdate);let Wt=this.BindingType.Direct;if(zt!==void 0){if(Gt==="morphTargetInfluences"){if(!_e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!_e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}_e.morphTargetDictionary[zt]!==void 0&&(zt=_e.morphTargetDictionary[zt])}Wt=this.BindingType.ArrayElement,this.resolvedProperty=jt,this.propertyIndex=zt}else jt.fromArray!==void 0&&jt.toArray!==void 0?(Wt=this.BindingType.HasFromToArray,this.resolvedProperty=jt):Array.isArray(jt)?(Wt=this.BindingType.EntireArray,this.resolvedProperty=jt):this.propertyName=Gt;this.getValue=this.GetterByBindingType[Wt],this.setValue=this.SetterByBindingTypeAndVersioning[Wt][Ht]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}PropertyBinding.Composite=Composite;PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray];PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class AnimationObjectGroup{constructor(){this.isAnimationObjectGroup=!0,this.uuid=generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const _e={};this._indicesByUUID=_e;for(let Vt=0,Gt=arguments.length;Vt!==Gt;++Vt)_e[arguments[Vt].uuid]=Vt;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const Dt=this;this.stats={objects:{get total(){return Dt._objects.length},get inUse(){return this.total-Dt.nCachedObjects_}},get bindingsPerObject(){return Dt._bindings.length}}}add(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._paths,Gt=this._parsedPaths,zt=this._bindings,jt=zt.length;let Ht,Wt=_e.length,qt=this.nCachedObjects_;for(let Xt=0,Kt=arguments.length;Xt!==Kt;++Xt){const Yt=arguments[Xt],Zt=Yt.uuid;let Jt=Dt[Zt];if(Jt===void 0){Jt=Wt++,Dt[Zt]=Jt,_e.push(Yt);for(let nn=0,rn=jt;nn!==rn;++nn)zt[nn].push(new PropertyBinding(Yt,Vt[nn],Gt[nn]))}else if(Jt<qt){Ht=_e[Jt];const nn=--qt,rn=_e[nn];Dt[rn.uuid]=Jt,_e[Jt]=rn,Dt[Zt]=nn,_e[nn]=Yt;for(let Qt=0,en=jt;Qt!==en;++Qt){const tn=zt[Qt],sn=tn[nn];let cn=tn[Jt];tn[Jt]=sn,cn===void 0&&(cn=new PropertyBinding(Yt,Vt[Qt],Gt[Qt])),tn[nn]=cn}}else _e[Jt]!==Ht&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=qt}remove(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._bindings,Gt=Vt.length;let zt=this.nCachedObjects_;for(let jt=0,Ht=arguments.length;jt!==Ht;++jt){const Wt=arguments[jt],qt=Wt.uuid,Xt=Dt[qt];if(Xt!==void 0&&Xt>=zt){const Kt=zt++,Yt=_e[Kt];Dt[Yt.uuid]=Xt,_e[Xt]=Yt,Dt[qt]=Kt,_e[Kt]=Wt;for(let Zt=0,Jt=Gt;Zt!==Jt;++Zt){const nn=Vt[Zt],rn=nn[Kt],Qt=nn[Xt];nn[Xt]=rn,nn[Kt]=Qt}}}this.nCachedObjects_=zt}uncache(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._bindings,Gt=Vt.length;let zt=this.nCachedObjects_,jt=_e.length;for(let Ht=0,Wt=arguments.length;Ht!==Wt;++Ht){const qt=arguments[Ht],Xt=qt.uuid,Kt=Dt[Xt];if(Kt!==void 0)if(delete Dt[Xt],Kt<zt){const Yt=--zt,Zt=_e[Yt],Jt=--jt,nn=_e[Jt];Dt[Zt.uuid]=Kt,_e[Kt]=Zt,Dt[nn.uuid]=Yt,_e[Yt]=nn,_e.pop();for(let rn=0,Qt=Gt;rn!==Qt;++rn){const en=Vt[rn],tn=en[Yt],sn=en[Jt];en[Kt]=tn,en[Yt]=sn,en.pop()}}else{const Yt=--jt,Zt=_e[Yt];Yt>0&&(Dt[Zt.uuid]=Kt),_e[Kt]=Zt,_e.pop();for(let Jt=0,nn=Gt;Jt!==nn;++Jt){const rn=Vt[Jt];rn[Kt]=rn[Yt],rn.pop()}}}this.nCachedObjects_=zt}subscribe_(_e,Dt){const Vt=this._bindingsIndicesByPath;let Gt=Vt[_e];const zt=this._bindings;if(Gt!==void 0)return zt[Gt];const jt=this._paths,Ht=this._parsedPaths,Wt=this._objects,qt=Wt.length,Xt=this.nCachedObjects_,Kt=new Array(qt);Gt=zt.length,Vt[_e]=Gt,jt.push(_e),Ht.push(Dt),zt.push(Kt);for(let Yt=Xt,Zt=Wt.length;Yt!==Zt;++Yt){const Jt=Wt[Yt];Kt[Yt]=new PropertyBinding(Jt,_e,Dt)}return Kt}unsubscribe_(_e){const Dt=this._bindingsIndicesByPath,Vt=Dt[_e];if(Vt!==void 0){const Gt=this._paths,zt=this._parsedPaths,jt=this._bindings,Ht=jt.length-1,Wt=jt[Ht],qt=_e[Ht];Dt[qt]=Vt,jt[Vt]=Wt,jt.pop(),zt[Vt]=zt[Ht],zt.pop(),Gt[Vt]=Gt[Ht],Gt.pop()}}}class AnimationAction{constructor(_e,Dt,Vt=null,Gt=Dt.blendMode){this._mixer=_e,this._clip=Dt,this._localRoot=Vt,this.blendMode=Gt;const zt=Dt.tracks,jt=zt.length,Ht=new Array(jt),Wt={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding};for(let qt=0;qt!==jt;++qt){const Xt=zt[qt].createInterpolant(null);Ht[qt]=Xt,Xt.settings=Wt}this._interpolantSettings=Wt,this._interpolants=Ht,this._propertyBindings=new Array(jt),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=LoopRepeat$1,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(_e){return this._startTime=_e,this}setLoop(_e,Dt){return this.loop=_e,this.repetitions=Dt,this}setEffectiveWeight(_e){return this.weight=_e,this._effectiveWeight=this.enabled?_e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(_e){return this._scheduleFading(_e,0,1)}fadeOut(_e){return this._scheduleFading(_e,1,0)}crossFadeFrom(_e,Dt,Vt){if(_e.fadeOut(Dt),this.fadeIn(Dt),Vt){const Gt=this._clip.duration,zt=_e._clip.duration,jt=zt/Gt,Ht=Gt/zt;_e.warp(1,jt,Dt),this.warp(Ht,1,Dt)}return this}crossFadeTo(_e,Dt,Vt){return _e.crossFadeFrom(this,Dt,Vt)}stopFading(){const _e=this._weightInterpolant;return _e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(_e)),this}setEffectiveTimeScale(_e){return this.timeScale=_e,this._effectiveTimeScale=this.paused?0:_e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(_e){return this.timeScale=this._clip.duration/_e,this.stopWarping()}syncWith(_e){return this.time=_e.time,this.timeScale=_e.timeScale,this.stopWarping()}halt(_e){return this.warp(this._effectiveTimeScale,0,_e)}warp(_e,Dt,Vt){const Gt=this._mixer,zt=Gt.time,jt=this.timeScale;let Ht=this._timeScaleInterpolant;Ht===null&&(Ht=Gt._lendControlInterpolant(),this._timeScaleInterpolant=Ht);const Wt=Ht.parameterPositions,qt=Ht.sampleValues;return Wt[0]=zt,Wt[1]=zt+Vt,qt[0]=_e/jt,qt[1]=Dt/jt,this}stopWarping(){const _e=this._timeScaleInterpolant;return _e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(_e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(_e,Dt,Vt,Gt){if(!this.enabled){this._updateWeight(_e);return}const zt=this._startTime;if(zt!==null){const Wt=(_e-zt)*Vt;Wt<0||Vt===0?Dt=0:(this._startTime=null,Dt=Vt*Wt)}Dt*=this._updateTimeScale(_e);const jt=this._updateTime(Dt),Ht=this._updateWeight(_e);if(Ht>0){const Wt=this._interpolants,qt=this._propertyBindings;switch(this.blendMode){case AdditiveAnimationBlendMode:for(let Xt=0,Kt=Wt.length;Xt!==Kt;++Xt)Wt[Xt].evaluate(jt),qt[Xt].accumulateAdditive(Ht);break;case NormalAnimationBlendMode:default:for(let Xt=0,Kt=Wt.length;Xt!==Kt;++Xt)Wt[Xt].evaluate(jt),qt[Xt].accumulate(Gt,Ht)}}}_updateWeight(_e){let Dt=0;if(this.enabled){Dt=this.weight;const Vt=this._weightInterpolant;if(Vt!==null){const Gt=Vt.evaluate(_e)[0];Dt*=Gt,_e>Vt.parameterPositions[1]&&(this.stopFading(),Gt===0&&(this.enabled=!1))}}return this._effectiveWeight=Dt,Dt}_updateTimeScale(_e){let Dt=0;if(!this.paused){Dt=this.timeScale;const Vt=this._timeScaleInterpolant;if(Vt!==null){const Gt=Vt.evaluate(_e)[0];Dt*=Gt,_e>Vt.parameterPositions[1]&&(this.stopWarping(),Dt===0?this.paused=!0:this.timeScale=Dt)}}return this._effectiveTimeScale=Dt,Dt}_updateTime(_e){const Dt=this._clip.duration,Vt=this.loop;let Gt=this.time+_e,zt=this._loopCount;const jt=Vt===LoopPingPong;if(_e===0)return zt===-1?Gt:jt&&(zt&1)===1?Dt-Gt:Gt;if(Vt===LoopOnce$1){zt===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(Gt>=Dt)Gt=Dt;else if(Gt<0)Gt=0;else{this.time=Gt;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=Gt,this._mixer.dispatchEvent({type:"finished",action:this,direction:_e<0?-1:1})}}else{if(zt===-1&&(_e>=0?(zt=0,this._setEndings(!0,this.repetitions===0,jt)):this._setEndings(this.repetitions===0,!0,jt)),Gt>=Dt||Gt<0){const Ht=Math.floor(Gt/Dt);Gt-=Dt*Ht,zt+=Math.abs(Ht);const Wt=this.repetitions-zt;if(Wt<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,Gt=_e>0?Dt:0,this.time=Gt,this._mixer.dispatchEvent({type:"finished",action:this,direction:_e>0?1:-1});else{if(Wt===1){const qt=_e<0;this._setEndings(qt,!qt,jt)}else this._setEndings(!1,!1,jt);this._loopCount=zt,this.time=Gt,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:Ht})}}else this.time=Gt;if(jt&&(zt&1)===1)return Dt-Gt}return Gt}_setEndings(_e,Dt,Vt){const Gt=this._interpolantSettings;Vt?(Gt.endingStart=ZeroSlopeEnding,Gt.endingEnd=ZeroSlopeEnding):(_e?Gt.endingStart=this.zeroSlopeAtStart?ZeroSlopeEnding:ZeroCurvatureEnding:Gt.endingStart=WrapAroundEnding,Dt?Gt.endingEnd=this.zeroSlopeAtEnd?ZeroSlopeEnding:ZeroCurvatureEnding:Gt.endingEnd=WrapAroundEnding)}_scheduleFading(_e,Dt,Vt){const Gt=this._mixer,zt=Gt.time;let jt=this._weightInterpolant;jt===null&&(jt=Gt._lendControlInterpolant(),this._weightInterpolant=jt);const Ht=jt.parameterPositions,Wt=jt.sampleValues;return Ht[0]=zt,Wt[0]=Dt,Ht[1]=zt+_e,Wt[1]=Vt,this}}const _controlInterpolantsResultBuffer=new Float32Array(1);class AnimationMixer extends EventDispatcher$2{constructor(_e){super(),this._root=_e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(_e,Dt){const Vt=_e._localRoot||this._root,Gt=_e._clip.tracks,zt=Gt.length,jt=_e._propertyBindings,Ht=_e._interpolants,Wt=Vt.uuid,qt=this._bindingsByRootAndName;let Xt=qt[Wt];Xt===void 0&&(Xt={},qt[Wt]=Xt);for(let Kt=0;Kt!==zt;++Kt){const Yt=Gt[Kt],Zt=Yt.name;let Jt=Xt[Zt];if(Jt!==void 0)++Jt.referenceCount,jt[Kt]=Jt;else{if(Jt=jt[Kt],Jt!==void 0){Jt._cacheIndex===null&&(++Jt.referenceCount,this._addInactiveBinding(Jt,Wt,Zt));continue}const nn=Dt&&Dt._propertyBindings[Kt].binding.parsedPath;Jt=new PropertyMixer(PropertyBinding.create(Vt,Zt,nn),Yt.ValueTypeName,Yt.getValueSize()),++Jt.referenceCount,this._addInactiveBinding(Jt,Wt,Zt),jt[Kt]=Jt}Ht[Kt].resultBuffer=Jt.buffer}}_activateAction(_e){if(!this._isActiveAction(_e)){if(_e._cacheIndex===null){const Vt=(_e._localRoot||this._root).uuid,Gt=_e._clip.uuid,zt=this._actionsByClip[Gt];this._bindAction(_e,zt&&zt.knownActions[0]),this._addInactiveAction(_e,Gt,Vt)}const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];zt.useCount++===0&&(this._lendBinding(zt),zt.saveOriginalState())}this._lendAction(_e)}}_deactivateAction(_e){if(this._isActiveAction(_e)){const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];--zt.useCount===0&&(zt.restoreOriginalState(),this._takeBackBinding(zt))}this._takeBackAction(_e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const _e=this;this.stats={actions:{get total(){return _e._actions.length},get inUse(){return _e._nActiveActions}},bindings:{get total(){return _e._bindings.length},get inUse(){return _e._nActiveBindings}},controlInterpolants:{get total(){return _e._controlInterpolants.length},get inUse(){return _e._nActiveControlInterpolants}}}}_isActiveAction(_e){const Dt=_e._cacheIndex;return Dt!==null&&Dt<this._nActiveActions}_addInactiveAction(_e,Dt,Vt){const Gt=this._actions,zt=this._actionsByClip;let jt=zt[Dt];if(jt===void 0)jt={knownActions:[_e],actionByRoot:{}},_e._byClipCacheIndex=0,zt[Dt]=jt;else{const Ht=jt.knownActions;_e._byClipCacheIndex=Ht.length,Ht.push(_e)}_e._cacheIndex=Gt.length,Gt.push(_e),jt.actionByRoot[Vt]=_e}_removeInactiveAction(_e){const Dt=this._actions,Vt=Dt[Dt.length-1],Gt=_e._cacheIndex;Vt._cacheIndex=Gt,Dt[Gt]=Vt,Dt.pop(),_e._cacheIndex=null;const zt=_e._clip.uuid,jt=this._actionsByClip,Ht=jt[zt],Wt=Ht.knownActions,qt=Wt[Wt.length-1],Xt=_e._byClipCacheIndex;qt._byClipCacheIndex=Xt,Wt[Xt]=qt,Wt.pop(),_e._byClipCacheIndex=null;const Kt=Ht.actionByRoot,Yt=(_e._localRoot||this._root).uuid;delete Kt[Yt],Wt.length===0&&delete jt[zt],this._removeInactiveBindingsForAction(_e)}_removeInactiveBindingsForAction(_e){const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];--zt.referenceCount===0&&this._removeInactiveBinding(zt)}}_lendAction(_e){const Dt=this._actions,Vt=_e._cacheIndex,Gt=this._nActiveActions++,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_takeBackAction(_e){const Dt=this._actions,Vt=_e._cacheIndex,Gt=--this._nActiveActions,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_addInactiveBinding(_e,Dt,Vt){const Gt=this._bindingsByRootAndName,zt=this._bindings;let jt=Gt[Dt];jt===void 0&&(jt={},Gt[Dt]=jt),jt[Vt]=_e,_e._cacheIndex=zt.length,zt.push(_e)}_removeInactiveBinding(_e){const Dt=this._bindings,Vt=_e.binding,Gt=Vt.rootNode.uuid,zt=Vt.path,jt=this._bindingsByRootAndName,Ht=jt[Gt],Wt=Dt[Dt.length-1],qt=_e._cacheIndex;Wt._cacheIndex=qt,Dt[qt]=Wt,Dt.pop(),delete Ht[zt],Object.keys(Ht).length===0&&delete jt[Gt]}_lendBinding(_e){const Dt=this._bindings,Vt=_e._cacheIndex,Gt=this._nActiveBindings++,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_takeBackBinding(_e){const Dt=this._bindings,Vt=_e._cacheIndex,Gt=--this._nActiveBindings,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_lendControlInterpolant(){const _e=this._controlInterpolants,Dt=this._nActiveControlInterpolants++;let Vt=_e[Dt];return Vt===void 0&&(Vt=new LinearInterpolant(new Float32Array(2),new Float32Array(2),1,_controlInterpolantsResultBuffer),Vt.__cacheIndex=Dt,_e[Dt]=Vt),Vt}_takeBackControlInterpolant(_e){const Dt=this._controlInterpolants,Vt=_e.__cacheIndex,Gt=--this._nActiveControlInterpolants,zt=Dt[Gt];_e.__cacheIndex=Gt,Dt[Gt]=_e,zt.__cacheIndex=Vt,Dt[Vt]=zt}clipAction(_e,Dt,Vt){const Gt=Dt||this._root,zt=Gt.uuid;let jt=typeof _e=="string"?AnimationClip.findByName(Gt,_e):_e;const Ht=jt!==null?jt.uuid:_e,Wt=this._actionsByClip[Ht];let qt=null;if(Vt===void 0&&(jt!==null?Vt=jt.blendMode:Vt=NormalAnimationBlendMode),Wt!==void 0){const Kt=Wt.actionByRoot[zt];if(Kt!==void 0&&Kt.blendMode===Vt)return Kt;qt=Wt.knownActions[0],jt===null&&(jt=qt._clip)}if(jt===null)return null;const Xt=new AnimationAction(this,jt,Dt,Vt);return this._bindAction(Xt,qt),this._addInactiveAction(Xt,Ht,zt),Xt}existingAction(_e,Dt){const Vt=Dt||this._root,Gt=Vt.uuid,zt=typeof _e=="string"?AnimationClip.findByName(Vt,_e):_e,jt=zt?zt.uuid:_e,Ht=this._actionsByClip[jt];return Ht!==void 0&&Ht.actionByRoot[Gt]||null}stopAllAction(){const _e=this._actions,Dt=this._nActiveActions;for(let Vt=Dt-1;Vt>=0;--Vt)_e[Vt].stop();return this}update(_e){_e*=this.timeScale;const Dt=this._actions,Vt=this._nActiveActions,Gt=this.time+=_e,zt=Math.sign(_e),jt=this._accuIndex^=1;for(let qt=0;qt!==Vt;++qt)Dt[qt]._update(Gt,_e,zt,jt);const Ht=this._bindings,Wt=this._nActiveBindings;for(let qt=0;qt!==Wt;++qt)Ht[qt].apply(jt);return this}setTime(_e){this.time=0;for(let Dt=0;Dt<this._actions.length;Dt++)this._actions[Dt].time=0;return this.update(_e)}getRoot(){return this._root}uncacheClip(_e){const Dt=this._actions,Vt=_e.uuid,Gt=this._actionsByClip,zt=Gt[Vt];if(zt!==void 0){const jt=zt.knownActions;for(let Ht=0,Wt=jt.length;Ht!==Wt;++Ht){const qt=jt[Ht];this._deactivateAction(qt);const Xt=qt._cacheIndex,Kt=Dt[Dt.length-1];qt._cacheIndex=null,qt._byClipCacheIndex=null,Kt._cacheIndex=Xt,Dt[Xt]=Kt,Dt.pop(),this._removeInactiveBindingsForAction(qt)}delete Gt[Vt]}}uncacheRoot(_e){const Dt=_e.uuid,Vt=this._actionsByClip;for(const jt in Vt){const Ht=Vt[jt].actionByRoot,Wt=Ht[Dt];Wt!==void 0&&(this._deactivateAction(Wt),this._removeInactiveAction(Wt))}const Gt=this._bindingsByRootAndName,zt=Gt[Dt];if(zt!==void 0)for(const jt in zt){const Ht=zt[jt];Ht.restoreOriginalState(),this._removeInactiveBinding(Ht)}}uncacheAction(_e,Dt){const Vt=this.existingAction(_e,Dt);Vt!==null&&(this._deactivateAction(Vt),this._removeInactiveAction(Vt))}}class Uniform{constructor(_e){this.value=_e}clone(){return new Uniform(this.value.clone===void 0?this.value:this.value.clone())}}let _id=0;class UniformsGroup extends EventDispatcher$2{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:_id++}),this.name="",this.usage=StaticDrawUsage,this.uniforms=[]}add(_e){return this.uniforms.push(_e),this}remove(_e){const Dt=this.uniforms.indexOf(_e);return Dt!==-1&&this.uniforms.splice(Dt,1),this}setName(_e){return this.name=_e,this}setUsage(_e){return this.usage=_e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(_e){this.name=_e.name,this.usage=_e.usage;const Dt=_e.uniforms;this.uniforms.length=0;for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++){const zt=Array.isArray(Dt[Vt])?Dt[Vt]:[Dt[Vt]];for(let jt=0;jt<zt.length;jt++)this.uniforms.push(zt[jt].clone())}return this}clone(){return new this.constructor().copy(this)}}class InstancedInterleavedBuffer extends InterleavedBuffer{constructor(_e,Dt,Vt=1){super(_e,Dt),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=Vt}copy(_e){return super.copy(_e),this.meshPerAttribute=_e.meshPerAttribute,this}clone(_e){const Dt=super.clone(_e);return Dt.meshPerAttribute=this.meshPerAttribute,Dt}toJSON(_e){const Dt=super.toJSON(_e);return Dt.isInstancedInterleavedBuffer=!0,Dt.meshPerAttribute=this.meshPerAttribute,Dt}}class GLBufferAttribute{constructor(_e,Dt,Vt,Gt,zt){this.isGLBufferAttribute=!0,this.name="",this.buffer=_e,this.type=Dt,this.itemSize=Vt,this.elementSize=Gt,this.count=zt,this.version=0}set needsUpdate(_e){_e===!0&&this.version++}setBuffer(_e){return this.buffer=_e,this}setType(_e,Dt){return this.type=_e,this.elementSize=Dt,this}setItemSize(_e){return this.itemSize=_e,this}setCount(_e){return this.count=_e,this}}const _matrix=new Matrix4;class Raycaster{constructor(_e,Dt,Vt=0,Gt=1/0){this.ray=new Ray(_e,Dt),this.near=Vt,this.far=Gt,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(_e,Dt){this.ray.set(_e,Dt)}setFromCamera(_e,Dt){Dt.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(Dt.matrixWorld),this.ray.direction.set(_e.x,_e.y,.5).unproject(Dt).sub(this.ray.origin).normalize(),this.camera=Dt):Dt.isOrthographicCamera?(this.ray.origin.set(_e.x,_e.y,(Dt.near+Dt.far)/(Dt.near-Dt.far)).unproject(Dt),this.ray.direction.set(0,0,-1).transformDirection(Dt.matrixWorld),this.camera=Dt):console.error("THREE.Raycaster: Unsupported camera type: "+Dt.type)}setFromXRController(_e){return _matrix.identity().extractRotation(_e.matrixWorld),this.ray.origin.setFromMatrixPosition(_e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_matrix),this}intersectObject(_e,Dt=!0,Vt=[]){return intersect(_e,this,Vt,Dt),Vt.sort(ascSort),Vt}intersectObjects(_e,Dt=!0,Vt=[]){for(let Gt=0,zt=_e.length;Gt<zt;Gt++)intersect(_e[Gt],this,Vt,Dt);return Vt.sort(ascSort),Vt}}function ascSort(kt,_e){return kt.distance-_e.distance}function intersect(kt,_e,Dt,Vt){if(kt.layers.test(_e.layers)&&kt.raycast(_e,Dt),Vt===!0){const Gt=kt.children;for(let zt=0,jt=Gt.length;zt<jt;zt++)intersect(Gt[zt],_e,Dt,!0)}}class Spherical{constructor(_e=1,Dt=0,Vt=0){return this.radius=_e,this.phi=Dt,this.theta=Vt,this}set(_e,Dt,Vt){return this.radius=_e,this.phi=Dt,this.theta=Vt,this}copy(_e){return this.radius=_e.radius,this.phi=_e.phi,this.theta=_e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(_e){return this.setFromCartesianCoords(_e.x,_e.y,_e.z)}setFromCartesianCoords(_e,Dt,Vt){return this.radius=Math.sqrt(_e*_e+Dt*Dt+Vt*Vt),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(_e,Vt),this.phi=Math.acos(clamp$2(Dt/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Cylindrical{constructor(_e=1,Dt=0,Vt=0){return this.radius=_e,this.theta=Dt,this.y=Vt,this}set(_e,Dt,Vt){return this.radius=_e,this.theta=Dt,this.y=Vt,this}copy(_e){return this.radius=_e.radius,this.theta=_e.theta,this.y=_e.y,this}setFromVector3(_e){return this.setFromCartesianCoords(_e.x,_e.y,_e.z)}setFromCartesianCoords(_e,Dt,Vt){return this.radius=Math.sqrt(_e*_e+Vt*Vt),this.theta=Math.atan2(_e,Vt),this.y=Dt,this}clone(){return new this.constructor().copy(this)}}const _vector$4=new Vector2;class Box2{constructor(_e=new Vector2(1/0,1/0),Dt=new Vector2(-1/0,-1/0)){this.isBox2=!0,this.min=_e,this.max=Dt}set(_e,Dt){return this.min.copy(_e),this.max.copy(Dt),this}setFromPoints(_e){this.makeEmpty();for(let Dt=0,Vt=_e.length;Dt<Vt;Dt++)this.expandByPoint(_e[Dt]);return this}setFromCenterAndSize(_e,Dt){const Vt=_vector$4.copy(Dt).multiplyScalar(.5);return this.min.copy(_e).sub(Vt),this.max.copy(_e).add(Vt),this}clone(){return new this.constructor().copy(this)}copy(_e){return this.min.copy(_e.min),this.max.copy(_e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(_e){return this.isEmpty()?_e.set(0,0):_e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(_e){return this.isEmpty()?_e.set(0,0):_e.subVectors(this.max,this.min)}expandByPoint(_e){return this.min.min(_e),this.max.max(_e),this}expandByVector(_e){return this.min.sub(_e),this.max.add(_e),this}expandByScalar(_e){return this.min.addScalar(-_e),this.max.addScalar(_e),this}containsPoint(_e){return!(_e.x<this.min.x||_e.x>this.max.x||_e.y<this.min.y||_e.y>this.max.y)}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}getParameter(_e,Dt){return Dt.set((_e.x-this.min.x)/(this.max.x-this.min.x),(_e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(_e){return!(_e.max.x<this.min.x||_e.min.x>this.max.x||_e.max.y<this.min.y||_e.min.y>this.max.y)}clampPoint(_e,Dt){return Dt.copy(_e).clamp(this.min,this.max)}distanceToPoint(_e){return this.clampPoint(_e,_vector$4).distanceTo(_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}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)}}const _startP=new Vector3,_startEnd=new Vector3;class Line3{constructor(_e=new Vector3,Dt=new Vector3){this.start=_e,this.end=Dt}set(_e,Dt){return this.start.copy(_e),this.end.copy(Dt),this}copy(_e){return this.start.copy(_e.start),this.end.copy(_e.end),this}getCenter(_e){return _e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(_e){return _e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(_e,Dt){return this.delta(Dt).multiplyScalar(_e).add(this.start)}closestPointToPointParameter(_e,Dt){_startP.subVectors(_e,this.start),_startEnd.subVectors(this.end,this.start);const Vt=_startEnd.dot(_startEnd);let zt=_startEnd.dot(_startP)/Vt;return Dt&&(zt=clamp$2(zt,0,1)),zt}closestPointToPoint(_e,Dt,Vt){const Gt=this.closestPointToPointParameter(_e,Dt);return this.delta(Vt).multiplyScalar(Gt).add(this.start)}applyMatrix4(_e){return this.start.applyMatrix4(_e),this.end.applyMatrix4(_e),this}equals(_e){return _e.start.equals(this.start)&&_e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const _vector$3=new Vector3;class SpotLightHelper extends Object3D{constructor(_e,Dt){super(),this.light=_e,this.matrixAutoUpdate=!1,this.color=Dt,this.type="SpotLightHelper";const Vt=new BufferGeometry,Gt=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let jt=0,Ht=1,Wt=32;jt<Wt;jt++,Ht++){const qt=jt/Wt*Math.PI*2,Xt=Ht/Wt*Math.PI*2;Gt.push(Math.cos(qt),Math.sin(qt),1,Math.cos(Xt),Math.sin(Xt),1)}Vt.setAttribute("position",new Float32BufferAttribute(Gt,3));const zt=new LineBasicMaterial({fog:!1,toneMapped:!1});this.cone=new LineSegments(Vt,zt),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const _e=this.light.distance?this.light.distance:1e3,Dt=_e*Math.tan(this.light.angle);this.cone.scale.set(Dt,Dt,_e),_vector$3.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(_vector$3),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const _vector$2=new Vector3,_boneMatrix=new Matrix4,_matrixWorldInv=new Matrix4;class SkeletonHelper extends LineSegments{constructor(_e){const Dt=getBoneList(_e),Vt=new BufferGeometry,Gt=[],zt=[],jt=new Color$1(0,0,1),Ht=new Color$1(0,1,0);for(let qt=0;qt<Dt.length;qt++){const Xt=Dt[qt];Xt.parent&&Xt.parent.isBone&&(Gt.push(0,0,0),Gt.push(0,0,0),zt.push(jt.r,jt.g,jt.b),zt.push(Ht.r,Ht.g,Ht.b))}Vt.setAttribute("position",new Float32BufferAttribute(Gt,3)),Vt.setAttribute("color",new Float32BufferAttribute(zt,3));const Wt=new LineBasicMaterial({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(Vt,Wt),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=_e,this.bones=Dt,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(_e){const Dt=this.bones,Vt=this.geometry,Gt=Vt.getAttribute("position");_matrixWorldInv.copy(this.root.matrixWorld).invert();for(let zt=0,jt=0;zt<Dt.length;zt++){const Ht=Dt[zt];Ht.parent&&Ht.parent.isBone&&(_boneMatrix.multiplyMatrices(_matrixWorldInv,Ht.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),Gt.setXYZ(jt,_vector$2.x,_vector$2.y,_vector$2.z),_boneMatrix.multiplyMatrices(_matrixWorldInv,Ht.parent.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),Gt.setXYZ(jt+1,_vector$2.x,_vector$2.y,_vector$2.z),jt+=2)}Vt.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(_e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function getBoneList(kt){const _e=[];kt.isBone===!0&&_e.push(kt);for(let Dt=0;Dt<kt.children.length;Dt++)_e.push.apply(_e,getBoneList(kt.children[Dt]));return _e}class PointLightHelper extends Mesh{constructor(_e,Dt,Vt){const Gt=new SphereGeometry(Dt,4,2),zt=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1});super(Gt,zt),this.light=_e,this.color=Vt,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const _vector$1=new Vector3,_color1=new Color$1,_color2=new Color$1;class HemisphereLightHelper extends Object3D{constructor(_e,Dt,Vt){super(),this.light=_e,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.color=Vt,this.type="HemisphereLightHelper";const Gt=new OctahedronGeometry(Dt);Gt.rotateY(Math.PI*.5),this.material=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const zt=Gt.getAttribute("position"),jt=new Float32Array(zt.count*3);Gt.setAttribute("color",new BufferAttribute(jt,3)),this.add(new Mesh(Gt,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const _e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const Dt=_e.geometry.getAttribute("color");_color1.copy(this.light.color),_color2.copy(this.light.groundColor);for(let Vt=0,Gt=Dt.count;Vt<Gt;Vt++){const zt=Vt<Gt/2?_color1:_color2;Dt.setXYZ(Vt,zt.r,zt.g,zt.b)}Dt.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),_e.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate())}}class GridHelper extends LineSegments{constructor(_e=10,Dt=10,Vt=4473924,Gt=8947848){Vt=new Color$1(Vt),Gt=new Color$1(Gt);const zt=Dt/2,jt=_e/Dt,Ht=_e/2,Wt=[],qt=[];for(let Yt=0,Zt=0,Jt=-Ht;Yt<=Dt;Yt++,Jt+=jt){Wt.push(-Ht,0,Jt,Ht,0,Jt),Wt.push(Jt,0,-Ht,Jt,0,Ht);const nn=Yt===zt?Vt:Gt;nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3}const Xt=new BufferGeometry;Xt.setAttribute("position",new Float32BufferAttribute(Wt,3)),Xt.setAttribute("color",new Float32BufferAttribute(qt,3));const Kt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(Xt,Kt),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class PolarGridHelper extends LineSegments{constructor(_e=10,Dt=16,Vt=8,Gt=64,zt=4473924,jt=8947848){zt=new Color$1(zt),jt=new Color$1(jt);const Ht=[],Wt=[];if(Dt>1)for(let Kt=0;Kt<Dt;Kt++){const Yt=Kt/Dt*(Math.PI*2),Zt=Math.sin(Yt)*_e,Jt=Math.cos(Yt)*_e;Ht.push(0,0,0),Ht.push(Zt,0,Jt);const nn=Kt&1?zt:jt;Wt.push(nn.r,nn.g,nn.b),Wt.push(nn.r,nn.g,nn.b)}for(let Kt=0;Kt<Vt;Kt++){const Yt=Kt&1?zt:jt,Zt=_e-_e/Vt*Kt;for(let Jt=0;Jt<Gt;Jt++){let nn=Jt/Gt*(Math.PI*2),rn=Math.sin(nn)*Zt,Qt=Math.cos(nn)*Zt;Ht.push(rn,0,Qt),Wt.push(Yt.r,Yt.g,Yt.b),nn=(Jt+1)/Gt*(Math.PI*2),rn=Math.sin(nn)*Zt,Qt=Math.cos(nn)*Zt,Ht.push(rn,0,Qt),Wt.push(Yt.r,Yt.g,Yt.b)}}const qt=new BufferGeometry;qt.setAttribute("position",new Float32BufferAttribute(Ht,3)),qt.setAttribute("color",new Float32BufferAttribute(Wt,3));const Xt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(qt,Xt),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const _v1=new Vector3,_v2$5=new Vector3,_v3=new Vector3;class DirectionalLightHelper extends Object3D{constructor(_e,Dt,Vt){super(),this.light=_e,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.color=Vt,this.type="DirectionalLightHelper",Dt===void 0&&(Dt=1);let Gt=new BufferGeometry;Gt.setAttribute("position",new Float32BufferAttribute([-Dt,Dt,0,Dt,Dt,0,Dt,-Dt,0,-Dt,-Dt,0,-Dt,Dt,0],3));const zt=new LineBasicMaterial({fog:!1,toneMapped:!1});this.lightPlane=new Line(Gt,zt),this.add(this.lightPlane),Gt=new BufferGeometry,Gt.setAttribute("position",new Float32BufferAttribute([0,0,0,0,0,1],3)),this.targetLine=new Line(Gt,zt),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),_v1.setFromMatrixPosition(this.light.matrixWorld),_v2$5.setFromMatrixPosition(this.light.target.matrixWorld),_v3.subVectors(_v2$5,_v1),this.lightPlane.lookAt(_v2$5),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(_v2$5),this.targetLine.scale.z=_v3.length()}}const _vector=new Vector3,_camera=new Camera;class CameraHelper extends LineSegments{constructor(_e){const Dt=new BufferGeometry,Vt=new LineBasicMaterial({color:16777215,vertexColors:!0,toneMapped:!1}),Gt=[],zt=[],jt={};Ht("n1","n2"),Ht("n2","n4"),Ht("n4","n3"),Ht("n3","n1"),Ht("f1","f2"),Ht("f2","f4"),Ht("f4","f3"),Ht("f3","f1"),Ht("n1","f1"),Ht("n2","f2"),Ht("n3","f3"),Ht("n4","f4"),Ht("p","n1"),Ht("p","n2"),Ht("p","n3"),Ht("p","n4"),Ht("u1","u2"),Ht("u2","u3"),Ht("u3","u1"),Ht("c","t"),Ht("p","c"),Ht("cn1","cn2"),Ht("cn3","cn4"),Ht("cf1","cf2"),Ht("cf3","cf4");function Ht(Jt,nn){Wt(Jt),Wt(nn)}function Wt(Jt){Gt.push(0,0,0),zt.push(0,0,0),jt[Jt]===void 0&&(jt[Jt]=[]),jt[Jt].push(Gt.length/3-1)}Dt.setAttribute("position",new Float32BufferAttribute(Gt,3)),Dt.setAttribute("color",new Float32BufferAttribute(zt,3)),super(Dt,Vt),this.type="CameraHelper",this.camera=_e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=jt,this.update();const qt=new Color$1(16755200),Xt=new Color$1(16711680),Kt=new Color$1(43775),Yt=new Color$1(16777215),Zt=new Color$1(3355443);this.setColors(qt,Xt,Kt,Yt,Zt)}setColors(_e,Dt,Vt,Gt,zt){const Ht=this.geometry.getAttribute("color");Ht.setXYZ(0,_e.r,_e.g,_e.b),Ht.setXYZ(1,_e.r,_e.g,_e.b),Ht.setXYZ(2,_e.r,_e.g,_e.b),Ht.setXYZ(3,_e.r,_e.g,_e.b),Ht.setXYZ(4,_e.r,_e.g,_e.b),Ht.setXYZ(5,_e.r,_e.g,_e.b),Ht.setXYZ(6,_e.r,_e.g,_e.b),Ht.setXYZ(7,_e.r,_e.g,_e.b),Ht.setXYZ(8,_e.r,_e.g,_e.b),Ht.setXYZ(9,_e.r,_e.g,_e.b),Ht.setXYZ(10,_e.r,_e.g,_e.b),Ht.setXYZ(11,_e.r,_e.g,_e.b),Ht.setXYZ(12,_e.r,_e.g,_e.b),Ht.setXYZ(13,_e.r,_e.g,_e.b),Ht.setXYZ(14,_e.r,_e.g,_e.b),Ht.setXYZ(15,_e.r,_e.g,_e.b),Ht.setXYZ(16,_e.r,_e.g,_e.b),Ht.setXYZ(17,_e.r,_e.g,_e.b),Ht.setXYZ(18,_e.r,_e.g,_e.b),Ht.setXYZ(19,_e.r,_e.g,_e.b),Ht.setXYZ(20,_e.r,_e.g,_e.b),Ht.setXYZ(21,_e.r,_e.g,_e.b),Ht.setXYZ(22,_e.r,_e.g,_e.b),Ht.setXYZ(23,_e.r,_e.g,_e.b),Ht.setXYZ(24,Dt.r,Dt.g,Dt.b),Ht.setXYZ(25,Dt.r,Dt.g,Dt.b),Ht.setXYZ(26,Dt.r,Dt.g,Dt.b),Ht.setXYZ(27,Dt.r,Dt.g,Dt.b),Ht.setXYZ(28,Dt.r,Dt.g,Dt.b),Ht.setXYZ(29,Dt.r,Dt.g,Dt.b),Ht.setXYZ(30,Dt.r,Dt.g,Dt.b),Ht.setXYZ(31,Dt.r,Dt.g,Dt.b),Ht.setXYZ(32,Vt.r,Vt.g,Vt.b),Ht.setXYZ(33,Vt.r,Vt.g,Vt.b),Ht.setXYZ(34,Vt.r,Vt.g,Vt.b),Ht.setXYZ(35,Vt.r,Vt.g,Vt.b),Ht.setXYZ(36,Vt.r,Vt.g,Vt.b),Ht.setXYZ(37,Vt.r,Vt.g,Vt.b),Ht.setXYZ(38,Gt.r,Gt.g,Gt.b),Ht.setXYZ(39,Gt.r,Gt.g,Gt.b),Ht.setXYZ(40,zt.r,zt.g,zt.b),Ht.setXYZ(41,zt.r,zt.g,zt.b),Ht.setXYZ(42,zt.r,zt.g,zt.b),Ht.setXYZ(43,zt.r,zt.g,zt.b),Ht.setXYZ(44,zt.r,zt.g,zt.b),Ht.setXYZ(45,zt.r,zt.g,zt.b),Ht.setXYZ(46,zt.r,zt.g,zt.b),Ht.setXYZ(47,zt.r,zt.g,zt.b),Ht.setXYZ(48,zt.r,zt.g,zt.b),Ht.setXYZ(49,zt.r,zt.g,zt.b),Ht.needsUpdate=!0}update(){const _e=this.geometry,Dt=this.pointMap,Vt=1,Gt=1;_camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),setPoint("c",Dt,_e,_camera,0,0,-1),setPoint("t",Dt,_e,_camera,0,0,1),setPoint("n1",Dt,_e,_camera,-Vt,-Gt,-1),setPoint("n2",Dt,_e,_camera,Vt,-Gt,-1),setPoint("n3",Dt,_e,_camera,-Vt,Gt,-1),setPoint("n4",Dt,_e,_camera,Vt,Gt,-1),setPoint("f1",Dt,_e,_camera,-Vt,-Gt,1),setPoint("f2",Dt,_e,_camera,Vt,-Gt,1),setPoint("f3",Dt,_e,_camera,-Vt,Gt,1),setPoint("f4",Dt,_e,_camera,Vt,Gt,1),setPoint("u1",Dt,_e,_camera,Vt*.7,Gt*1.1,-1),setPoint("u2",Dt,_e,_camera,-Vt*.7,Gt*1.1,-1),setPoint("u3",Dt,_e,_camera,0,Gt*2,-1),setPoint("cf1",Dt,_e,_camera,-Vt,0,1),setPoint("cf2",Dt,_e,_camera,Vt,0,1),setPoint("cf3",Dt,_e,_camera,0,-Gt,1),setPoint("cf4",Dt,_e,_camera,0,Gt,1),setPoint("cn1",Dt,_e,_camera,-Vt,0,-1),setPoint("cn2",Dt,_e,_camera,Vt,0,-1),setPoint("cn3",Dt,_e,_camera,0,-Gt,-1),setPoint("cn4",Dt,_e,_camera,0,Gt,-1),_e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function setPoint(kt,_e,Dt,Vt,Gt,zt,jt){_vector.set(Gt,zt,jt).unproject(Vt);const Ht=_e[kt];if(Ht!==void 0){const Wt=Dt.getAttribute("position");for(let qt=0,Xt=Ht.length;qt<Xt;qt++)Wt.setXYZ(Ht[qt],_vector.x,_vector.y,_vector.z)}}const _box=new Box3;class BoxHelper extends LineSegments{constructor(_e,Dt=16776960){const Vt=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Gt=new Float32Array(8*3),zt=new BufferGeometry;zt.setIndex(new BufferAttribute(Vt,1)),zt.setAttribute("position",new BufferAttribute(Gt,3)),super(zt,new LineBasicMaterial({color:Dt,toneMapped:!1})),this.object=_e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(_e){if(_e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&_box.setFromObject(this.object),_box.isEmpty())return;const Dt=_box.min,Vt=_box.max,Gt=this.geometry.attributes.position,zt=Gt.array;zt[0]=Vt.x,zt[1]=Vt.y,zt[2]=Vt.z,zt[3]=Dt.x,zt[4]=Vt.y,zt[5]=Vt.z,zt[6]=Dt.x,zt[7]=Dt.y,zt[8]=Vt.z,zt[9]=Vt.x,zt[10]=Dt.y,zt[11]=Vt.z,zt[12]=Vt.x,zt[13]=Vt.y,zt[14]=Dt.z,zt[15]=Dt.x,zt[16]=Vt.y,zt[17]=Dt.z,zt[18]=Dt.x,zt[19]=Dt.y,zt[20]=Dt.z,zt[21]=Vt.x,zt[22]=Dt.y,zt[23]=Dt.z,Gt.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(_e){return this.object=_e,this.update(),this}copy(_e,Dt){return super.copy(_e,Dt),this.object=_e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Box3Helper extends LineSegments{constructor(_e,Dt=16776960){const Vt=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Gt=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],zt=new BufferGeometry;zt.setIndex(new BufferAttribute(Vt,1)),zt.setAttribute("position",new Float32BufferAttribute(Gt,3)),super(zt,new LineBasicMaterial({color:Dt,toneMapped:!1})),this.box=_e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(_e){const Dt=this.box;Dt.isEmpty()||(Dt.getCenter(this.position),Dt.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(_e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class PlaneHelper extends Line{constructor(_e,Dt=1,Vt=16776960){const Gt=Vt,zt=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],jt=new BufferGeometry;jt.setAttribute("position",new Float32BufferAttribute(zt,3)),jt.computeBoundingSphere(),super(jt,new LineBasicMaterial({color:Gt,toneMapped:!1})),this.type="PlaneHelper",this.plane=_e,this.size=Dt;const Ht=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],Wt=new BufferGeometry;Wt.setAttribute("position",new Float32BufferAttribute(Ht,3)),Wt.computeBoundingSphere(),this.add(new Mesh(Wt,new MeshBasicMaterial({color:Gt,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(_e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(_e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const _axis=new Vector3;let _lineGeometry,_coneGeometry;class ArrowHelper extends Object3D{constructor(_e=new Vector3(0,0,1),Dt=new Vector3(0,0,0),Vt=1,Gt=16776960,zt=Vt*.2,jt=zt*.2){super(),this.type="ArrowHelper",_lineGeometry===void 0&&(_lineGeometry=new BufferGeometry,_lineGeometry.setAttribute("position",new Float32BufferAttribute([0,0,0,0,1,0],3)),_coneGeometry=new CylinderGeometry(0,.5,1,5,1),_coneGeometry.translate(0,-.5,0)),this.position.copy(Dt),this.line=new Line(_lineGeometry,new LineBasicMaterial({color:Gt,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Mesh(_coneGeometry,new MeshBasicMaterial({color:Gt,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(_e),this.setLength(Vt,zt,jt)}setDirection(_e){if(_e.y>.99999)this.quaternion.set(0,0,0,1);else if(_e.y<-.99999)this.quaternion.set(1,0,0,0);else{_axis.set(_e.z,0,-_e.x).normalize();const Dt=Math.acos(_e.y);this.quaternion.setFromAxisAngle(_axis,Dt)}}setLength(_e,Dt=_e*.2,Vt=Dt*.2){this.line.scale.set(1,Math.max(1e-4,_e-Dt),1),this.line.updateMatrix(),this.cone.scale.set(Vt,Dt,Vt),this.cone.position.y=_e,this.cone.updateMatrix()}setColor(_e){this.line.material.color.set(_e),this.cone.material.color.set(_e)}copy(_e){return super.copy(_e,!1),this.line.copy(_e.line),this.cone.copy(_e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class AxesHelper extends LineSegments{constructor(_e=1){const Dt=[0,0,0,_e,0,0,0,0,0,0,_e,0,0,0,0,0,0,_e],Vt=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],Gt=new BufferGeometry;Gt.setAttribute("position",new Float32BufferAttribute(Dt,3)),Gt.setAttribute("color",new Float32BufferAttribute(Vt,3));const zt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(Gt,zt),this.type="AxesHelper"}setColors(_e,Dt,Vt){const Gt=new Color$1,zt=this.geometry.attributes.color.array;return Gt.set(_e),Gt.toArray(zt,0),Gt.toArray(zt,3),Gt.set(Dt),Gt.toArray(zt,6),Gt.toArray(zt,9),Gt.set(Vt),Gt.toArray(zt,12),Gt.toArray(zt,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ShapePath{constructor(){this.type="ShapePath",this.color=new Color$1,this.subPaths=[],this.currentPath=null}moveTo(_e,Dt){return this.currentPath=new Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(_e,Dt),this}lineTo(_e,Dt){return this.currentPath.lineTo(_e,Dt),this}quadraticCurveTo(_e,Dt,Vt,Gt){return this.currentPath.quadraticCurveTo(_e,Dt,Vt,Gt),this}bezierCurveTo(_e,Dt,Vt,Gt,zt,jt){return this.currentPath.bezierCurveTo(_e,Dt,Vt,Gt,zt,jt),this}splineThru(_e){return this.currentPath.splineThru(_e),this}toShapes(_e){function Dt(Qt){const en=[];for(let tn=0,sn=Qt.length;tn<sn;tn++){const cn=Qt[tn],un=new Shape;un.curves=cn.curves,en.push(un)}return en}function Vt(Qt,en){const tn=en.length;let sn=!1;for(let cn=tn-1,un=0;un<tn;cn=un++){let hn=en[cn],fn=en[un],pn=fn.x-hn.x,dn=fn.y-hn.y;if(Math.abs(dn)>Number.EPSILON){if(dn<0&&(hn=en[un],pn=-pn,fn=en[cn],dn=-dn),Qt.y<hn.y||Qt.y>fn.y)continue;if(Qt.y===hn.y){if(Qt.x===hn.x)return!0}else{const mn=dn*(Qt.x-hn.x)-pn*(Qt.y-hn.y);if(mn===0)return!0;if(mn<0)continue;sn=!sn}}else{if(Qt.y!==hn.y)continue;if(fn.x<=Qt.x&&Qt.x<=hn.x||hn.x<=Qt.x&&Qt.x<=fn.x)return!0}}return sn}const Gt=ShapeUtils.isClockWise,zt=this.subPaths;if(zt.length===0)return[];let jt,Ht,Wt;const qt=[];if(zt.length===1)return Ht=zt[0],Wt=new Shape,Wt.curves=Ht.curves,qt.push(Wt),qt;let Xt=!Gt(zt[0].getPoints());Xt=_e?!Xt:Xt;const Kt=[],Yt=[];let Zt=[],Jt=0,nn;Yt[Jt]=void 0,Zt[Jt]=[];for(let Qt=0,en=zt.length;Qt<en;Qt++)Ht=zt[Qt],nn=Ht.getPoints(),jt=Gt(nn),jt=_e?!jt:jt,jt?(!Xt&&Yt[Jt]&&Jt++,Yt[Jt]={s:new Shape,p:nn},Yt[Jt].s.curves=Ht.curves,Xt&&Jt++,Zt[Jt]=[]):Zt[Jt].push({h:Ht,p:nn[0]});if(!Yt[0])return Dt(zt);if(Yt.length>1){let Qt=!1,en=0;for(let tn=0,sn=Yt.length;tn<sn;tn++)Kt[tn]=[];for(let tn=0,sn=Yt.length;tn<sn;tn++){const cn=Zt[tn];for(let un=0;un<cn.length;un++){const hn=cn[un];let fn=!0;for(let pn=0;pn<Yt.length;pn++)Vt(hn.p,Yt[pn].p)&&(tn!==pn&&en++,fn?(fn=!1,Kt[pn].push(hn)):Qt=!0);fn&&Kt[tn].push(hn)}}en>0&&Qt===!1&&(Zt=Kt)}let rn;for(let Qt=0,en=Yt.length;Qt<en;Qt++){Wt=Yt[Qt].s,qt.push(Wt),rn=Zt[Qt];for(let tn=0,sn=rn.length;tn<sn;tn++)Wt.holes.push(rn[tn].h)}return qt}}class WebGLMultipleRenderTargets extends WebGLRenderTarget{constructor(_e=1,Dt=1,Vt=1,Gt={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(_e,Dt,{...Gt,count:Vt}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:REVISION}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=REVISION);const THREE$1=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping,AddEquation,AddOperation,AdditiveAnimationBlendMode,AdditiveBlending,AgXToneMapping,AlphaFormat,AlwaysCompare,AlwaysDepth,AlwaysStencilFunc,AmbientLight,AnimationAction,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrayCamera,ArrowHelper,AttachedBindMode,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BackSide,BasicDepthPacking,BasicShadowMap,BatchedMesh,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxGeometry,BoxHelper,BufferAttribute,BufferGeometry,BufferGeometryLoader,ByteType,Cache,Camera,CameraHelper,CanvasTexture,CapsuleGeometry,CatmullRomCurve3,CineonToneMapping,CircleGeometry,ClampToEdgeWrapping,Clock,Color:Color$1,ColorKeyframeTrack,ColorManagement,CompressedArrayTexture,CompressedCubeTexture,CompressedTexture,CompressedTextureLoader,ConeGeometry,ConstantAlphaFactor,ConstantColorFactor,CubeCamera,CubeReflectionMapping,CubeRefractionMapping,CubeTexture,CubeTextureLoader,CubeUVReflectionMapping,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceBack,CullFaceFront,CullFaceFrontBack,CullFaceNone,Curve,CurvePath,CustomBlending,CustomToneMapping,CylinderGeometry,Cylindrical,Data3DTexture,DataArrayTexture,DataTexture,DataTextureLoader,DataUtils,DecrementStencilOp,DecrementWrapStencilOp,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DepthTexture,DetachedBindMode,DirectionalLight,DirectionalLightHelper,DiscreteInterpolant,DisplayP3ColorSpace,DodecahedronGeometry,DoubleSide,DstAlphaFactor,DstColorFactor,DynamicCopyUsage,DynamicDrawUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,EqualCompare,EqualDepth,EqualStencilFunc,EquirectangularReflectionMapping,EquirectangularRefractionMapping,Euler,EventDispatcher:EventDispatcher$2,ExtrudeGeometry,FileLoader,Float16BufferAttribute,Float32BufferAttribute,FloatType,Fog,FogExp2,FramebufferTexture,FrontSide,Frustum,GLBufferAttribute,GLSL1,GLSL3,GreaterCompare,GreaterDepth,GreaterEqualCompare,GreaterEqualDepth,GreaterEqualStencilFunc,GreaterStencilFunc,GridHelper,Group,HalfFloatType,HemisphereLight,HemisphereLightHelper,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,IncrementStencilOp,IncrementWrapStencilOp,InstancedBufferAttribute,InstancedBufferGeometry,InstancedInterleavedBuffer,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,IntType,InterleavedBuffer,InterleavedBufferAttribute,Interpolant,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InvertStencilOp,KeepStencilOp,KeyframeTrack,LOD,LatheGeometry,Layers,LessCompare,LessDepth,LessEqualCompare,LessEqualDepth,LessEqualStencilFunc,LessStencilFunc,Light,LightProbe,Line,Line3,LineBasicMaterial,LineCurve,LineCurve3,LineDashedMaterial,LineLoop,LineSegments,LinearDisplayP3ColorSpace,LinearFilter,LinearInterpolant,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,LinearSRGBColorSpace:LinearSRGBColorSpace$1,LinearToneMapping,LinearTransfer,Loader,LoaderUtils,LoadingManager,LoopOnce:LoopOnce$1,LoopPingPong,LoopRepeat:LoopRepeat$1,LuminanceAlphaFormat,LuminanceFormat,MOUSE,Material,MaterialLoader,MathUtils,Matrix3,Matrix4,MaxEquation,Mesh,MeshBasicMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshLambertMaterial,MeshMatcapMaterial,MeshNormalMaterial,MeshPhongMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshToonMaterial,MinEquation,MirroredRepeatWrapping,MixOperation,MultiplyBlending,MultiplyOperation,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,NeutralToneMapping,NeverCompare,NeverDepth,NeverStencilFunc,NoBlending,NoColorSpace,NoToneMapping,NormalAnimationBlendMode,NormalBlending,NotEqualCompare,NotEqualDepth,NotEqualStencilFunc,NumberKeyframeTrack,Object3D,ObjectLoader,ObjectSpaceNormalMap,OctahedronGeometry,OneFactor,OneMinusConstantAlphaFactor,OneMinusConstantColorFactor,OneMinusDstAlphaFactor,OneMinusDstColorFactor,OneMinusSrcAlphaFactor,OneMinusSrcColorFactor,OrthographicCamera,P3Primaries,PCFShadowMap,PCFSoftShadowMap,PMREMGenerator,Path,PerspectiveCamera,Plane,PlaneGeometry,PlaneHelper,PointLight,PointLightHelper,Points,PointsMaterial,PolarGridHelper,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,Quaternion,QuaternionKeyframeTrack,QuaternionLinearInterpolant,RED_GREEN_RGTC2_Format,RED_RGTC1_Format,REVISION,RGBADepthPacking,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_BPTC_SIGNED_Format,RGB_BPTC_UNSIGNED_Format,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,RawShaderMaterial,Ray,Raycaster,Rec709Primaries,RectAreaLight,RedFormat,RedIntegerFormat,ReinhardToneMapping,RenderTarget,RepeatWrapping,ReplaceStencilOp,ReverseSubtractEquation,RingGeometry,SIGNED_RED_GREEN_RGTC2_Format,SIGNED_RED_RGTC1_Format,SRGBColorSpace:SRGBColorSpace$1,SRGBTransfer,Scene,ShaderChunk,ShaderLib,ShaderMaterial,ShadowMaterial,Shape,ShapeGeometry,ShapePath,ShapeUtils,ShortType,Skeleton,SkeletonHelper,SkinnedMesh,Source,Sphere,SphereGeometry,Spherical,SphericalHarmonics3,SplineCurve,SpotLight,SpotLightHelper,Sprite,SpriteMaterial,SrcAlphaFactor,SrcAlphaSaturateFactor,SrcColorFactor,StaticCopyUsage,StaticDrawUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,SubtractEquation,SubtractiveBlending,TOUCH,TangentSpaceNormalMap,TetrahedronGeometry,Texture,TextureLoader,TorusGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeGeometry,UVMapping,Uint16BufferAttribute,Uint32BufferAttribute,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,UniformsLib,UniformsUtils,UnsignedByteType,UnsignedInt248Type,UnsignedInt5999Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VSMShadowMap,Vector2,Vector3,Vector4,VectorKeyframeTrack,VideoTexture,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGLCoordinateSystem,WebGLCubeRenderTarget,WebGLMultipleRenderTargets,WebGLRenderTarget,WebGLRenderer,WebGLUtils,WebGPUCoordinateSystem,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroFactor,ZeroSlopeEnding,ZeroStencilOp,createCanvasElement},Symbol.toStringTag,{value:"Module"})),hotspotIdPrefix="rd",hotspotIdSeparator="_";function generateHotspotAbsoluteID(kt,_e){return`${hotspotIdPrefix}${hotspotIdSeparator}${kt}${hotspotIdSeparator}${_e}`}async function wait(kt){return LOGGER.info({title:`Waiting for ${kt}ms`}),new Promise((_e,Dt)=>{setTimeout(()=>{_e(!0)},kt)})}function compareObjects(kt,_e){if(kt===null||_e===null)return!1;for(let Dt in kt)if(kt.hasOwnProperty(Dt)&&_e.hasOwnProperty(Dt)&&kt[Dt]!==_e[Dt])return!1;return Object.keys(kt).length===Object.keys(_e).length}const capitalize$1=kt=>kt&&kt[0].toUpperCase()+kt.slice(1)||"",mobileCheck=function(){let kt=!1;return function(_e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(_e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(_e.substr(0,4)))&&(kt=!0)}(navigator.userAgent||navigator.vendor||window.opera),kt};function isIpadOS(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function tabletCheck(){const kt=navigator.userAgent.toLowerCase(),_e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(kt);return _e||isIpadOS()}function touchDeviceCheck(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function getJSONFromEndpoint(kt){let _e={data:null,report:"",success:!1};try{const Vt=await(await fetch(kt)).text();_e.data=JSON.parse(Vt),_e.success=!0,_e.report="Successfully fetched JSON data."}catch(Dt){_e.report=Dt,_e.success=!1}return _e}const addVector=(kt,_e)=>new Vector3(kt[0]+_e[0],kt[1]+_e[1],kt[2]+_e[2]),Vec3ToArr=kt=>[kt.x,kt.y,kt.z],ArrToVec3=kt=>new Vector3(kt[0],kt[1],kt[2]),numberWithCommas=kt=>kt.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),findMeshAndCloneMatFromScene=(kt,_e,Dt=!0)=>{let Vt=[];const Gt=kt.coreSceneStore.getState().sceneSettings.outOfStock_EmissiveColor,zt=kt.coreSceneStore.getState().sceneSettings.outOfStock_EmissiveIntensity;return _e.traverse(jt=>{jt.isMesh&&(jt.material.userData.cloned?jt.material.userData.inStock!==Dt&&(Dt?(jt.material.emissive.set(new Color$1(255,255,255)),jt.material.emissiveIntensity=0):(jt.material.emissive.set(new Color$1(Gt.r,Gt.g,Gt.b)),jt.material.emissiveIntensity=zt),jt.material.userData.inStock=Dt):(jt.material=jt.material.clone(),jt.material.userData.inStock=Dt,jt.material.userData.cloned=!0,Dt?(jt.material.emissive.set(new Color$1(255,255,255)),jt.material.emissiveIntensity=0):(jt.material.emissive.set(new Color$1(Gt.r,Gt.g,Gt.b)),jt.material.emissiveIntensity=zt)),Vt.push(jt))}),Vt},filterArrWithCondition=(kt,_e)=>{let Dt=0,Vt=[];for(let Gt=0;Gt<kt.length;Gt++){const zt=kt[Gt];_e(zt)?kt[Dt++]=zt:Vt.push(kt[Gt])}return kt.length=Dt,Vt},degToRad=kt=>kt*Math.PI/180,resolveAssetUrl=kt=>{if(!kt)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(kt))return kt;let Vt=kt;return Vt=Vt.replaceAll("<@all-projects@>",ALL_PROJECTS_ASSET_DATA_ROOT_URL),Vt=Vt.replaceAll("<@generic-project@>",GENERIC_PROJECT_ASSET_DATA_ROOT_URL),Vt};function componentToHex(kt){let _e=kt.toString(16);return _e.length==1?"0"+_e:_e}function rgbToHex(kt,_e,Dt){return"#"+componentToHex(kt)+componentToHex(_e)+componentToHex(Dt)}function getUrlParameterByName(kt,_e=window.location.search){const Dt=new URLSearchParams(_e);return Object.fromEntries(Dt.entries())[kt]}function _dispose3(kt){kt.geometry&&kt.geometry.dispose(),kt.material&&(Array.isArray(kt.material)?kt.material.forEach(_e=>_e.dispose()):kt.material.dispose()),kt.texture&&kt.texture.dispose()}function dispose3(kt){kt.traverse(_e=>{_dispose3(_e)}),_dispose3(kt)}const findVariantForGUID=(kt,_e)=>{const Dt=kt.attachmentStore.getState().attachmentSystem,Gt=kt.itemStore.getState().itemsSpawned[_e];let zt=Dt.currentStructure.getNodeByGUID(_e);if(!zt)return;let jt="";if(zt.overrideVariant)jt=zt.overrideVariant,kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0);else{const Ht=Dt.globalVariants;if(!Ht||Ht.Count<=0)return;let Wt=[];Object.keys(Ht).map((qt,Xt)=>{Wt.push(Ht[qt])}),Gt.itemData.looks?.map(qt=>{Wt.includes(qt)&&(jt=qt)}),jt||(jt=Gt.itemData.looks[0])}return jt};function hasCommonElement(kt,_e){for(let Dt of kt)if(_e.includes(Dt))return!0;return!1}const InfoDrawer=({stores:kt,open:_e,dismissDrawer:Dt})=>{const Vt=kt.uiSceneStore(Ht=>Ht.CORE_API),Gt=kt.uiSceneStore(Ht=>Ht.isScreenPortrait),zt=reactExports.useRef(null),jt=kt.infoStore(Ht=>Ht.infoObject);return reactExports.useEffect(()=>{Vt.isMobile&&kt.uiSceneStore.setState({dialogPopupOpen:_e});const Ht=async()=>{const Wt=await kt.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics();if(_e){const qt=new EpigraphPanelOpenedEvent(Wt,!0,"info-panel","button");kt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qt)}else{const qt=new EpigraphPanelClosedEvent(Wt,!0,"info-panel","button");kt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qt)}};kt?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics&&Ht()},[_e]),reactExports.useEffect(()=>{const{current:Ht}=zt;if(!Ht)return;const Wt=()=>{Dt()};return Ht.addEventListener("drawerClosed",Wt),()=>{Ht.removeEventListener("drawerClosed",Wt)}},[zt]),jsxRuntimeExports.jsx(BottomDrawer,{stores:kt,ref:zt,id:"bottomDrawer",open:`${_e}`,"initial-screen-coverage":"0%",children:jsxRuntimeExports.jsx("div",{tabIndex:_e&&Gt?0:-1,"aria-hidden":!_e||!Gt,className:"infoDrawer epigraphDrawer",slot:"bottom-drawer-content",children:jsxRuntimeExports.jsxs("div",{className:"drawerContent",children:[jsxRuntimeExports.jsxs("a",{href:jt?.productPageUrl,className:"categoryLink",role:"button","aria-label":"Link to Product",target:"_blank",style:jt?.productPageUrl?{pointerEvents:"all"}:{pointerEvents:"none"},children:[jsxRuntimeExports.jsxs("h2",{className:"categoryTitle",children:[jt?.productCategory?.label,jt.subheading&&jsxRuntimeExports.jsx("div",{className:"modalSubHeading",children:jt.subheading})]}),jt.productPageUrl&&jsxRuntimeExports.jsx("img",{alt:"Open Product Page",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/OpenTab.svg",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{className:"infoDrawerImageContainer",children:jsxRuntimeExports.jsx("img",{className:"itemImage",alt:jt?.title?"An image of "+jt.title:"A placeholder image used in the Information Modal","aria-label":jt?.title?"An image of "+jt.title:"A placeholder image used in the Information Modal",src:jt?.thumbnails?.high?Vt.getResolvedAssetUrl(jt.thumbnails.high):"https://placehold.co/150",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("h2",{className:"itemTitle",children:jt.title}),jsxRuntimeExports.jsx("pre",{className:"itemDescription",children:jt.description}),jt.boundingBoxSize?jsxRuntimeExports.jsxs("p",{className:"infoModalDimensions",children:[jt.boundingBoxSize.x.toFixed(1),"” W x"," ",jt.boundingBoxSize.y.toFixed(1),"” D x"," ",jt.boundingBoxSize.z.toFixed(1),"” H"]}):"",jsxRuntimeExports.jsx("div",{className:"infoModalActions",children:jt.price&&jsxRuntimeExports.jsxs("button",{className:"item-price",disabled:!0,children:["$",numberWithCommas(parseFloat(jt.price).toFixed(2))]})})]})})})},UtilityMenuButton=({stores:kt,buttonAction:_e,buttonLabel:Dt,hoverLabel:Vt,icon:Gt,activeCondition:zt})=>{const[jt,Ht]=reactExports.useState(zt),Wt=kt.uiSceneStore(Kt=>Kt.dialogPopupOpen),qt=kt.uiSceneStore(Kt=>Kt.isScreenPortrait),Xt=kt.cartStore(Kt=>Kt.previewCartModalOpen);return reactExports.useEffect(()=>(Ht(zt),()=>{}),[zt]),jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:!Wt&&(qt&&!Xt||!qt)?0:-1,"aria-hidden":Wt||qt&&Xt,className:jt!==void 0&&jt?"shellButtonContainer active":"shellButtonContainer","aria-label":Dt,onClick:()=>{_e()},children:[jsxRuntimeExports.jsxs("div",{className:"buttonContent",children:[jsxRuntimeExports.jsx("img",{className:"button",src:Gt,alt:"An icon indicating "+Dt+" action.",onError:Kt=>{Kt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:Dt})]}),jsxRuntimeExports.jsx("div",{className:"hoverDescriptor",children:jsxRuntimeExports.jsx("span",{children:Vt})})]})},UtilityMenu=({stores:kt,handleShareButtonTrigger:_e,handleSaveButtonTrigger:Dt,handleRestartButtonClick:Vt,handleShowHotspots:Gt,handleDimensionClick:zt,handleInstructionButtonClick:jt,utilityMenuVisible:Ht,hotspotsVisibility:Wt,viewInYourSpaceMenuBtnVisible:qt,restartMenuBtnVisible:Xt,saveMenuBtnVisible:Kt,hotspotsMenuBtnVisible:Yt,instructionsMenuBtnVisible:Zt,dimensionsMenuBtnVisible:Jt,shareMenuBtnVisible:nn,dimensionsVisible:rn,position:Qt,CORE_API:en})=>{const[tn,sn]=reactExports.useState("bottom"),cn=kt.productDataStore(fn=>fn.assetsData),un=kt.coreSceneStore(fn=>fn.sceneSettings),hn={ar:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",restart:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Restart.svg",save:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/save.svg",share:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Share.svg",dimensions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Ruler.svg",hotspots:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Eye.svg",instructions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Info.svg"};return reactExports.useEffect(()=>{switch(Qt){case"top":sn("top");break;case"bottom":sn("bottom");break;case"left":sn("left");break;case"right":sn("right");break}return()=>{}},[Qt]),jsxRuntimeExports.jsx("div",{className:"shellCanvasContainerParent",id:tn,children:jsxRuntimeExports.jsxs("div",{className:(Ht&&(nn||qt||Xt||Jt||Yt||Zt))==!0?"shellCanvasContainer":"shellCanvasContainer shellCanvasContainerInactive",children:[qt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{en.viewInYourSpace()},buttonLabel:un.textSettings.arButtonLabel,hoverLabel:un.textSettings.arHoverLabel,icon:cn?.icons?.utilityMenu?.viewInYourSpace?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.viewInYourSpace):hn.ar}),Xt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Vt()},buttonLabel:un.textSettings.restartButtonLabel,hoverLabel:un.textSettings.restartHoverLabel,icon:cn?.icons?.utilityMenu?.restart?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.restart):hn.restart}),Kt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Dt()},buttonLabel:un.textSettings.saveButtonLabel,hoverLabel:un.textSettings.saveHoverLabel,icon:cn?.icons?.utilityMenu?.save?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.save):hn.save}),nn&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{_e()},buttonLabel:un.textSettings.shareButtonLabel,hoverLabel:un.textSettings.shareHoverLabel,icon:cn?.icons?.utilityMenu?.share?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.share):hn.share}),Jt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{zt()},buttonLabel:un.textSettings.sizeButtonLabel,hoverLabel:un.textSettings.sizeHoverLabel,icon:cn?.icons?.utilityMenu?.dimensions?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.dimensions):hn.dimensions,activeCondition:rn}),Yt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Gt()},buttonLabel:un.textSettings.hotspotsButtonLabel,hoverLabel:un.textSettings.hotspotsHoverLabel,icon:cn?.icons?.utilityMenu?.hotspots?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.hotspots):hn.hotspots,activeCondition:Wt}),Zt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{jt()},buttonLabel:un.textSettings.instructionsButtonLabel,hoverLabel:un.textSettings.instructionsHoverLabel,icon:cn?.icons?.utilityMenu?.instructions?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.instructions):hn.instructions})]})})};function makeTypeChecker(kt){return _e=>!!_e.type&&_e.type.tabsRole===kt}const isTab=makeTypeChecker("Tab"),isTabList=makeTypeChecker("TabList"),isTabPanel=makeTypeChecker("TabPanel");function isTabChild(kt){return isTab(kt)||isTabList(kt)||isTabPanel(kt)}function deepMap(kt,_e){return reactExports.Children.map(kt,Dt=>Dt===null?null:isTabChild(Dt)?_e(Dt):Dt.props&&Dt.props.children&&typeof Dt.props.children=="object"?reactExports.cloneElement(Dt,{...Dt.props,children:deepMap(Dt.props.children,_e)}):Dt)}function deepForEach(kt,_e){return reactExports.Children.forEach(kt,Dt=>{Dt!==null&&(isTab(Dt)||isTabPanel(Dt)?_e(Dt):Dt.props&&Dt.props.children&&typeof Dt.props.children=="object"&&(isTabList(Dt)&&_e(Dt),deepForEach(Dt.props.children,_e)))})}function r$2(kt){var _e,Dt,Vt="";if(typeof kt=="string"||typeof kt=="number")Vt+=kt;else if(typeof kt=="object")if(Array.isArray(kt)){var Gt=kt.length;for(_e=0;_e<Gt;_e++)kt[_e]&&(Dt=r$2(kt[_e]))&&(Vt&&(Vt+=" "),Vt+=Dt)}else for(Dt in kt)kt[Dt]&&(Vt&&(Vt+=" "),Vt+=Dt);return Vt}function clsx(){for(var kt,_e,Dt=0,Vt="",Gt=arguments.length;Dt<Gt;Dt++)(kt=arguments[Dt])&&(_e=r$2(kt))&&(Vt&&(Vt+=" "),Vt+=_e);return Vt}function getTabsCount(kt){let _e=0;return deepForEach(kt,Dt=>{isTab(Dt)&&_e++}),_e}function isNode(kt){return kt&&"getAttribute"in kt}function isTabNode(kt){return isNode(kt)&&kt.getAttribute("data-rttab")}function isTabDisabled(kt){return isNode(kt)&&kt.getAttribute("aria-disabled")==="true"}let canUseActiveElement;function determineCanUseActiveElement(kt){const _e=kt||(typeof window<"u"?window:void 0);try{canUseActiveElement=!!(typeof _e<"u"&&_e.document&&_e.document.activeElement)}catch{canUseActiveElement=!1}}const defaultProps$4={className:"react-tabs",focus:!1},UncontrolledTabs=kt=>{let _e=reactExports.useRef([]),Dt=reactExports.useRef([]);const Vt=reactExports.useRef();function Gt(_n,En){if(_n<0||_n>=qt())return;const{onSelect:An,selectedIndex:Tn}=kt;An(_n,Tn,En)}function zt(_n){const En=qt();for(let An=_n+1;An<En;An++)if(!isTabDisabled(Xt(An)))return An;for(let An=0;An<_n;An++)if(!isTabDisabled(Xt(An)))return An;return _n}function jt(_n){let En=_n;for(;En--;)if(!isTabDisabled(Xt(En)))return En;for(En=qt();En-- >_n;)if(!isTabDisabled(Xt(En)))return En;return _n}function Ht(){const _n=qt();for(let En=0;En<_n;En++)if(!isTabDisabled(Xt(En)))return En;return null}function Wt(){let _n=qt();for(;_n--;)if(!isTabDisabled(Xt(_n)))return _n;return null}function qt(){const{children:_n}=kt;return getTabsCount(_n)}function Xt(_n){return _e.current[`tabs-${_n}`]}function Kt(){let _n=0;const{children:En,disabledTabClassName:An,focus:Tn,forceRenderTabPanel:Cn,selectedIndex:yn,selectedTabClassName:Sn,selectedTabPanelClassName:wn,environment:xn}=kt;Dt.current=Dt.current||[];let Rn=Dt.current.length-qt();const Ln=reactExports.useId();for(;Rn++<0;)Dt.current.push(`${Ln}${Dt.current.length}`);return deepMap(En,Nn=>{let Fn=Nn;if(isTabList(Nn)){let Pn=0,Bn=!1;canUseActiveElement==null&&determineCanUseActiveElement(xn);const Hn=xn||(typeof window<"u"?window:void 0);canUseActiveElement&&Hn&&(Bn=React.Children.toArray(Nn.props.children).filter(isTab).some((qn,ar)=>Hn.document.activeElement===Xt(ar))),Fn=reactExports.cloneElement(Nn,{children:deepMap(Nn.props.children,qn=>{const ar=`tabs-${Pn}`,zn=yn===Pn,ur={tabRef:Wn=>{_e.current[ar]=Wn},id:Dt.current[Pn],selected:zn,focus:zn&&(Tn||Bn)};return Sn&&(ur.selectedClassName=Sn),An&&(ur.disabledClassName=An),Pn++,reactExports.cloneElement(qn,ur)})})}else if(isTabPanel(Nn)){const Pn={id:Dt.current[_n],selected:yn===_n};Cn&&(Pn.forceRender=Cn),wn&&(Pn.selectedClassName=wn),_n++,Fn=reactExports.cloneElement(Nn,Pn)}return Fn})}function Yt(_n){const{direction:En,disableUpDownKeys:An,disableLeftRightKeys:Tn}=kt;if(Jt(_n.target)){let{selectedIndex:Cn}=kt,yn=!1,Sn=!1;(_n.code==="Space"||_n.keyCode===32||_n.code==="Enter"||_n.keyCode===13)&&(yn=!0,Sn=!1,Zt(_n)),!Tn&&(_n.keyCode===37||_n.code==="ArrowLeft")||!An&&(_n.keyCode===38||_n.code==="ArrowUp")?(En==="rtl"?Cn=zt(Cn):Cn=jt(Cn),yn=!0,Sn=!0):!Tn&&(_n.keyCode===39||_n.code==="ArrowRight")||!An&&(_n.keyCode===40||_n.code==="ArrowDown")?(En==="rtl"?Cn=jt(Cn):Cn=zt(Cn),yn=!0,Sn=!0):_n.keyCode===35||_n.code==="End"?(Cn=Wt(),yn=!0,Sn=!0):(_n.keyCode===36||_n.code==="Home")&&(Cn=Ht(),yn=!0,Sn=!0),yn&&_n.preventDefault(),Sn&&Gt(Cn,_n)}}function Zt(_n){let En=_n.target;do if(Jt(En)){if(isTabDisabled(En))return;const An=[].slice.call(En.parentNode.children).filter(isTabNode).indexOf(En);Gt(An,_n);return}while((En=En.parentNode)!=null)}function Jt(_n){if(!isTabNode(_n))return!1;let En=_n.parentElement;do{if(En===Vt.current)return!0;if(En.getAttribute("data-rttabs"))break;En=En.parentElement}while(En);return!1}const{children:nn,className:rn,disabledTabClassName:Qt,domRef:en,focus:tn,forceRenderTabPanel:sn,onSelect:cn,selectedIndex:un,selectedTabClassName:hn,selectedTabPanelClassName:fn,environment:pn,disableUpDownKeys:dn,disableLeftRightKeys:mn,...vn}={...defaultProps$4,...kt};return React.createElement("div",Object.assign({},vn,{className:clsx(rn),onClick:Zt,onKeyDown:Yt,ref:_n=>{Vt.current=_n,en&&en(_n)},"data-rttabs":!0}),Kt())};UncontrolledTabs.propTypes={};const MODE_CONTROLLED=0,MODE_UNCONTROLLED=1,defaultProps$3={defaultFocus:!1,focusTabOnClick:!0,forceRenderTabPanel:!1,selectedIndex:null,defaultIndex:null,environment:null,disableUpDownKeys:!1,disableLeftRightKeys:!1},getModeFromProps=kt=>kt.selectedIndex===null?MODE_UNCONTROLLED:MODE_CONTROLLED,Tabs=kt=>{const{children:_e,defaultFocus:Dt,defaultIndex:Vt,focusTabOnClick:Gt,onSelect:zt,...jt}={...defaultProps$3,...kt},[Ht,Wt]=reactExports.useState(Dt),[qt]=reactExports.useState(getModeFromProps(jt)),[Xt,Kt]=reactExports.useState(qt===MODE_UNCONTROLLED?Vt||0:null);if(reactExports.useEffect(()=>{Wt(!1)},[]),qt===MODE_UNCONTROLLED){const Jt=getTabsCount(_e);reactExports.useEffect(()=>{if(Xt!=null){const nn=Math.max(0,Jt-1);Kt(Math.min(Xt,nn))}},[Jt])}const Yt=(Jt,nn,rn)=>{typeof zt=="function"&&zt(Jt,nn,rn)===!1||(Gt&&Wt(!0),qt===MODE_UNCONTROLLED&&Kt(Jt))};let Zt={...kt,...jt};return Zt.focus=Ht,Zt.onSelect=Yt,Xt!=null&&(Zt.selectedIndex=Xt),delete Zt.defaultFocus,delete Zt.defaultIndex,delete Zt.focusTabOnClick,React.createElement(UncontrolledTabs,Zt,_e)};Tabs.propTypes={};Tabs.tabsRole="Tabs";const defaultProps$2={className:"react-tabs__tab-list"},TabList=kt=>{const{children:_e,className:Dt,...Vt}={...defaultProps$2,...kt};return React.createElement("ul",Object.assign({},Vt,{className:clsx(Dt),role:"tablist"}),_e)};TabList.tabsRole="TabList";TabList.propTypes={};const DEFAULT_CLASS$1="react-tabs__tab",defaultProps$1={className:DEFAULT_CLASS$1,disabledClassName:`${DEFAULT_CLASS$1}--disabled`,focus:!1,id:null,selected:!1,selectedClassName:`${DEFAULT_CLASS$1}--selected`},Tab$1=kt=>{let _e=reactExports.useRef();const{children:Dt,className:Vt,disabled:Gt,disabledClassName:zt,focus:jt,id:Ht,selected:Wt,selectedClassName:qt,tabIndex:Xt,tabRef:Kt,...Yt}={...defaultProps$1,...kt};return reactExports.useEffect(()=>{Wt&&jt&&_e.current.focus()},[Wt,jt]),React.createElement("li",Object.assign({},Yt,{className:clsx(Vt,{[qt]:Wt,[zt]:Gt}),ref:Zt=>{_e.current=Zt,Kt&&Kt(Zt)},role:"tab",id:`tab${Ht}`,"aria-selected":Wt?"true":"false","aria-disabled":Gt?"true":"false","aria-controls":`panel${Ht}`,tabIndex:Xt||(Wt?"0":null),"data-rttab":!0}),Dt)};Tab$1.propTypes={};Tab$1.tabsRole="Tab";const DEFAULT_CLASS="react-tabs__tab-panel",defaultProps={className:DEFAULT_CLASS,forceRender:!1,selectedClassName:`${DEFAULT_CLASS}--selected`},TabPanel=kt=>{const{children:_e,className:Dt,forceRender:Vt,id:Gt,selected:zt,selectedClassName:jt,...Ht}={...defaultProps,...kt};return React.createElement("div",Object.assign({},Ht,{className:clsx(Dt,{[jt]:zt}),role:"tabpanel",id:`panel${Gt}`,"aria-labelledby":`tab${Gt}`}),Vt||zt?_e:null)};TabPanel.tabsRole="TabPanel";TabPanel.propTypes={};const ItemCard=({stores:kt,sideMenuOpen:_e,spawnGhosts:Dt,accordionActive:Vt=!0,spawnItem:Gt,removeAllGhosts:zt,isMouseUsed:jt,skuId:Ht,active:Wt})=>{const qt=kt.uiSceneStore(fr=>fr.CORE_API),Xt=kt.infoStore(fr=>fr.infoModalOpen),Kt=reactExports.useRef(null),Yt=kt.infoStore(fr=>fr.populateInfoObject),Zt=kt.uiSceneStore(fr=>fr.dialogPopupOpen),Jt=kt.cartStore(fr=>fr.previewCartModalOpen),nn=kt.infoStore(fr=>fr.updateInfoModalOpen),[rn,Qt]=reactExports.useState("default"),[en,tn]=reactExports.useState(!0),sn=kt.colorStore(fr=>fr.allActiveVariants),cn=kt.productDataStore(fr=>fr.productData),un=kt.itemStore(fr=>fr.fittingSkuIds),[hn,fn]=reactExports.useState(cn[Ht].incrementDecrementControl?cn[Ht].incrementDecrementControl:!1),[pn,dn]=reactExports.useState(cn[Ht]?cn[Ht]:{}),[mn,vn]=reactExports.useState(cn[Ht].name?cn[Ht].name:"Not Set"),[_n,En]=reactExports.useState(cn[Ht].subheading?cn[Ht].subheading:""),[An,Tn]=reactExports.useState(cn[Ht].lookDetails.default.thumbnails.low?cn[Ht].lookDetails.default.thumbnails.low:""),[Cn,yn]=reactExports.useState(cn[Ht].draggableUI!=null?cn[Ht].draggableUI:kt.uiSceneStore.getState().CORE_API.sceneSettings.draggableUI),[Sn,wn]=reactExports.useState(null),[xn,Rn]=reactExports.useState(!1),[Ln,Nn]=reactExports.useState(!1),[Fn,Pn]=reactExports.useState(0),Bn=reactExports.useCallback(()=>{Fn<=0||qt.removeLastItemBySkuId(Ht)},[Fn]),Hn=()=>{let fr=0;const Un=kt.itemStore.getState().itemsSpawned,In=Object.keys(Un);for(let jn=In.length-1;jn>=0;jn--){const er=In[jn];Un[er].itemData.skuID===Ht&&fr++}Pn(fr)};reactExports.useEffect(()=>{Hn()},[]),addCoreEventListener(kt,qt.EVENTS.SCENE.Items_Updated,Hn),reactExports.useEffect(()=>{un.includes(Ht)?Rn(!0):Rn(!1)},[un]),reactExports.useEffect(()=>{Object.keys(cn).length!=0},[cn]),reactExports.useEffect(()=>{pn.looks.length<=1&&tn(!1)},[pn]);const qn=reactExports.useCallback(()=>{const fr=pn.looks;let Un="default";for(const[In,jn]of Object.entries(sn))if(fr.includes(jn)){Un=jn;break}Qt(Un)},[pn,sn]);reactExports.useEffect(()=>{Tn(pn.lookDetails[rn].thumbnails.low)},[pn,rn]),reactExports.useEffect(()=>{en===!0&&qn()},[sn]);const ar=reactExports.useCallback(fr=>{if(fr.stopPropagation(),!(!kt.uiSceneStore.getState().CORE_API.sceneSettings.clickToAddUi&&!hn)){if(xn===!1||Sn){qt.alert({alertMsg:"Unable to add item to the scene.",alertTime:4e3,alertType:"warn",alertLabel:"Action Unavailable"});return}Gt(Ht,!0)}},[xn,Sn]),zn=reactExports.useCallback(async()=>{const fr=qt.sceneSettings?.showDependencyOnHover;if(fr===void 0||fr===!1)return;let Un=qt.getSpawningRequirementForSkuID(Ht);if(Un.length<=0)return;let In="";const jn=await qt.getCartItemsAsync();let er=!1;if(jn.cartItems.map(cr=>{Un.includes(cr.skuID)&&(er=!0)}),Un.includes("Root")&&Un.length==1&&(er=!0,Un=[]),er)In="No space available to spawn the item.";else{In=`This item requires a dependency to be added to the scene first.
|
|
3936
|
+
}`;class WebXRDepthSensing{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(_e,Dt,Vt){if(this.texture===null){const Gt=new Texture,zt=_e.properties.get(Gt);zt.__webglTexture=Dt.texture,(Dt.depthNear!=Vt.depthNear||Dt.depthFar!=Vt.depthFar)&&(this.depthNear=Dt.depthNear,this.depthFar=Dt.depthFar),this.texture=Gt}}render(_e,Dt){if(this.texture!==null){if(this.mesh===null){const Vt=Dt.cameras[0].viewport,Gt=new ShaderMaterial({vertexShader:_occlusion_vertex,fragmentShader:_occlusion_fragment,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Vt.z},depthHeight:{value:Vt.w}}});this.mesh=new Mesh(new PlaneGeometry(20,20),Gt)}_e.render(this.mesh,Dt)}}reset(){this.texture=null,this.mesh=null}}class WebXRManager extends EventDispatcher$2{constructor(_e,Dt){super();const Vt=this;let Gt=null,zt=1,jt=null,Ht="local-floor",Wt=1,qt=null,Xt=null,Kt=null,Yt=null,Zt=null,Jt=null;const nn=new WebXRDepthSensing,rn=Dt.getContextAttributes();let Qt=null,en=null;const tn=[],sn=[],cn=new Vector2;let un=null;const hn=new PerspectiveCamera;hn.layers.enable(1),hn.viewport=new Vector4;const fn=new PerspectiveCamera;fn.layers.enable(2),fn.viewport=new Vector4;const pn=[hn,fn],dn=new ArrayCamera;dn.layers.enable(1),dn.layers.enable(2);let mn=null,vn=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Nn){let Fn=tn[Nn];return Fn===void 0&&(Fn=new WebXRController,tn[Nn]=Fn),Fn.getTargetRaySpace()},this.getControllerGrip=function(Nn){let Fn=tn[Nn];return Fn===void 0&&(Fn=new WebXRController,tn[Nn]=Fn),Fn.getGripSpace()},this.getHand=function(Nn){let Fn=tn[Nn];return Fn===void 0&&(Fn=new WebXRController,tn[Nn]=Fn),Fn.getHandSpace()};function _n(Nn){const Fn=sn.indexOf(Nn.inputSource);if(Fn===-1)return;const Pn=tn[Fn];Pn!==void 0&&(Pn.update(Nn.inputSource,Nn.frame,qt||jt),Pn.dispatchEvent({type:Nn.type,data:Nn.inputSource}))}function En(){Gt.removeEventListener("select",_n),Gt.removeEventListener("selectstart",_n),Gt.removeEventListener("selectend",_n),Gt.removeEventListener("squeeze",_n),Gt.removeEventListener("squeezestart",_n),Gt.removeEventListener("squeezeend",_n),Gt.removeEventListener("end",En),Gt.removeEventListener("inputsourceschange",An);for(let Nn=0;Nn<tn.length;Nn++){const Fn=sn[Nn];Fn!==null&&(sn[Nn]=null,tn[Nn].disconnect(Fn))}mn=null,vn=null,nn.reset(),_e.setRenderTarget(Qt),Zt=null,Yt=null,Kt=null,Gt=null,en=null,Ln.stop(),Vt.isPresenting=!1,_e.setPixelRatio(un),_e.setSize(cn.width,cn.height,!1),Vt.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Nn){zt=Nn,Vt.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Nn){Ht=Nn,Vt.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return qt||jt},this.setReferenceSpace=function(Nn){qt=Nn},this.getBaseLayer=function(){return Yt!==null?Yt:Zt},this.getBinding=function(){return Kt},this.getFrame=function(){return Jt},this.getSession=function(){return Gt},this.setSession=async function(Nn){if(Gt=Nn,Gt!==null){if(Qt=_e.getRenderTarget(),Gt.addEventListener("select",_n),Gt.addEventListener("selectstart",_n),Gt.addEventListener("selectend",_n),Gt.addEventListener("squeeze",_n),Gt.addEventListener("squeezestart",_n),Gt.addEventListener("squeezeend",_n),Gt.addEventListener("end",En),Gt.addEventListener("inputsourceschange",An),rn.xrCompatible!==!0&&await Dt.makeXRCompatible(),un=_e.getPixelRatio(),_e.getSize(cn),Gt.renderState.layers===void 0){const Fn={antialias:rn.antialias,alpha:!0,depth:rn.depth,stencil:rn.stencil,framebufferScaleFactor:zt};Zt=new XRWebGLLayer(Gt,Dt,Fn),Gt.updateRenderState({baseLayer:Zt}),_e.setPixelRatio(1),_e.setSize(Zt.framebufferWidth,Zt.framebufferHeight,!1),en=new WebGLRenderTarget(Zt.framebufferWidth,Zt.framebufferHeight,{format:RGBAFormat,type:UnsignedByteType,colorSpace:_e.outputColorSpace,stencilBuffer:rn.stencil})}else{let Fn=null,Pn=null,Bn=null;rn.depth&&(Bn=rn.stencil?Dt.DEPTH24_STENCIL8:Dt.DEPTH_COMPONENT24,Fn=rn.stencil?DepthStencilFormat:DepthFormat,Pn=rn.stencil?UnsignedInt248Type:UnsignedIntType);const Hn={colorFormat:Dt.RGBA8,depthFormat:Bn,scaleFactor:zt};Kt=new XRWebGLBinding(Gt,Dt),Yt=Kt.createProjectionLayer(Hn),Gt.updateRenderState({layers:[Yt]}),_e.setPixelRatio(1),_e.setSize(Yt.textureWidth,Yt.textureHeight,!1),en=new WebGLRenderTarget(Yt.textureWidth,Yt.textureHeight,{format:RGBAFormat,type:UnsignedByteType,depthTexture:new DepthTexture(Yt.textureWidth,Yt.textureHeight,Pn,void 0,void 0,void 0,void 0,void 0,void 0,Fn),stencilBuffer:rn.stencil,colorSpace:_e.outputColorSpace,samples:rn.antialias?4:0});const qn=_e.properties.get(en);qn.__ignoreDepthValues=Yt.ignoreDepthValues}en.isXRRenderTarget=!0,this.setFoveation(Wt),qt=null,jt=await Gt.requestReferenceSpace(Ht),Ln.setContext(Gt),Ln.start(),Vt.isPresenting=!0,Vt.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Gt!==null)return Gt.environmentBlendMode};function An(Nn){for(let Fn=0;Fn<Nn.removed.length;Fn++){const Pn=Nn.removed[Fn],Bn=sn.indexOf(Pn);Bn>=0&&(sn[Bn]=null,tn[Bn].disconnect(Pn))}for(let Fn=0;Fn<Nn.added.length;Fn++){const Pn=Nn.added[Fn];let Bn=sn.indexOf(Pn);if(Bn===-1){for(let qn=0;qn<tn.length;qn++)if(qn>=sn.length){sn.push(Pn),Bn=qn;break}else if(sn[qn]===null){sn[qn]=Pn,Bn=qn;break}if(Bn===-1)break}const Hn=tn[Bn];Hn&&Hn.connect(Pn)}}const Tn=new Vector3,Cn=new Vector3;function yn(Nn,Fn,Pn){Tn.setFromMatrixPosition(Fn.matrixWorld),Cn.setFromMatrixPosition(Pn.matrixWorld);const Bn=Tn.distanceTo(Cn),Hn=Fn.projectionMatrix.elements,qn=Pn.projectionMatrix.elements,ar=Hn[14]/(Hn[10]-1),zn=Hn[14]/(Hn[10]+1),ur=(Hn[9]+1)/Hn[5],Wn=(Hn[9]-1)/Hn[5],or=(Hn[8]-1)/Hn[0],gr=(qn[8]+1)/qn[0],fr=ar*or,Un=ar*gr,In=Bn/(-or+gr),jn=In*-or;Fn.matrixWorld.decompose(Nn.position,Nn.quaternion,Nn.scale),Nn.translateX(jn),Nn.translateZ(In),Nn.matrixWorld.compose(Nn.position,Nn.quaternion,Nn.scale),Nn.matrixWorldInverse.copy(Nn.matrixWorld).invert();const er=ar+In,cr=zn+In,lr=fr-jn,Mr=Un+(Bn-jn),mr=ur*zn/cr*er,wr=Wn*zn/cr*er;Nn.projectionMatrix.makePerspective(lr,Mr,mr,wr,er,cr),Nn.projectionMatrixInverse.copy(Nn.projectionMatrix).invert()}function Sn(Nn,Fn){Fn===null?Nn.matrixWorld.copy(Nn.matrix):Nn.matrixWorld.multiplyMatrices(Fn.matrixWorld,Nn.matrix),Nn.matrixWorldInverse.copy(Nn.matrixWorld).invert()}this.updateCamera=function(Nn){if(Gt===null)return;nn.texture!==null&&(Nn.near=nn.depthNear,Nn.far=nn.depthFar),dn.near=fn.near=hn.near=Nn.near,dn.far=fn.far=hn.far=Nn.far,(mn!==dn.near||vn!==dn.far)&&(Gt.updateRenderState({depthNear:dn.near,depthFar:dn.far}),mn=dn.near,vn=dn.far,hn.near=mn,hn.far=vn,fn.near=mn,fn.far=vn,hn.updateProjectionMatrix(),fn.updateProjectionMatrix(),Nn.updateProjectionMatrix());const Fn=Nn.parent,Pn=dn.cameras;Sn(dn,Fn);for(let Bn=0;Bn<Pn.length;Bn++)Sn(Pn[Bn],Fn);Pn.length===2?yn(dn,hn,fn):dn.projectionMatrix.copy(hn.projectionMatrix),wn(Nn,dn,Fn)};function wn(Nn,Fn,Pn){Pn===null?Nn.matrix.copy(Fn.matrixWorld):(Nn.matrix.copy(Pn.matrixWorld),Nn.matrix.invert(),Nn.matrix.multiply(Fn.matrixWorld)),Nn.matrix.decompose(Nn.position,Nn.quaternion,Nn.scale),Nn.updateMatrixWorld(!0),Nn.projectionMatrix.copy(Fn.projectionMatrix),Nn.projectionMatrixInverse.copy(Fn.projectionMatrixInverse),Nn.isPerspectiveCamera&&(Nn.fov=RAD2DEG*2*Math.atan(1/Nn.projectionMatrix.elements[5]),Nn.zoom=1)}this.getCamera=function(){return dn},this.getFoveation=function(){if(!(Yt===null&&Zt===null))return Wt},this.setFoveation=function(Nn){Wt=Nn,Yt!==null&&(Yt.fixedFoveation=Nn),Zt!==null&&Zt.fixedFoveation!==void 0&&(Zt.fixedFoveation=Nn)},this.hasDepthSensing=function(){return nn.texture!==null};let xn=null;function Rn(Nn,Fn){if(Xt=Fn.getViewerPose(qt||jt),Jt=Fn,Xt!==null){const Pn=Xt.views;Zt!==null&&(_e.setRenderTargetFramebuffer(en,Zt.framebuffer),_e.setRenderTarget(en));let Bn=!1;Pn.length!==dn.cameras.length&&(dn.cameras.length=0,Bn=!0);for(let qn=0;qn<Pn.length;qn++){const ar=Pn[qn];let zn=null;if(Zt!==null)zn=Zt.getViewport(ar);else{const Wn=Kt.getViewSubImage(Yt,ar);zn=Wn.viewport,qn===0&&(_e.setRenderTargetTextures(en,Wn.colorTexture,Yt.ignoreDepthValues?void 0:Wn.depthStencilTexture),_e.setRenderTarget(en))}let ur=pn[qn];ur===void 0&&(ur=new PerspectiveCamera,ur.layers.enable(qn),ur.viewport=new Vector4,pn[qn]=ur),ur.matrix.fromArray(ar.transform.matrix),ur.matrix.decompose(ur.position,ur.quaternion,ur.scale),ur.projectionMatrix.fromArray(ar.projectionMatrix),ur.projectionMatrixInverse.copy(ur.projectionMatrix).invert(),ur.viewport.set(zn.x,zn.y,zn.width,zn.height),qn===0&&(dn.matrix.copy(ur.matrix),dn.matrix.decompose(dn.position,dn.quaternion,dn.scale)),Bn===!0&&dn.cameras.push(ur)}const Hn=Gt.enabledFeatures;if(Hn&&Hn.includes("depth-sensing")){const qn=Kt.getDepthInformation(Pn[0]);qn&&qn.isValid&&qn.texture&&nn.init(_e,qn,Gt.renderState)}}for(let Pn=0;Pn<tn.length;Pn++){const Bn=sn[Pn],Hn=tn[Pn];Bn!==null&&Hn!==void 0&&Hn.update(Bn,Fn,qt||jt)}nn.render(_e,dn),xn&&xn(Nn,Fn),Fn.detectedPlanes&&Vt.dispatchEvent({type:"planesdetected",data:Fn}),Jt=null}const Ln=new WebGLAnimation;Ln.setAnimationLoop(Rn),this.setAnimationLoop=function(Nn){xn=Nn},this.dispose=function(){}}}const _e1=new Euler,_m1=new Matrix4;function WebGLMaterials(kt,_e){function Dt(rn,Qt){rn.matrixAutoUpdate===!0&&rn.updateMatrix(),Qt.value.copy(rn.matrix)}function Vt(rn,Qt){Qt.color.getRGB(rn.fogColor.value,getUnlitUniformColorSpace(kt)),Qt.isFog?(rn.fogNear.value=Qt.near,rn.fogFar.value=Qt.far):Qt.isFogExp2&&(rn.fogDensity.value=Qt.density)}function Gt(rn,Qt,en,tn,sn){Qt.isMeshBasicMaterial||Qt.isMeshLambertMaterial?zt(rn,Qt):Qt.isMeshToonMaterial?(zt(rn,Qt),Kt(rn,Qt)):Qt.isMeshPhongMaterial?(zt(rn,Qt),Xt(rn,Qt)):Qt.isMeshStandardMaterial?(zt(rn,Qt),Yt(rn,Qt),Qt.isMeshPhysicalMaterial&&Zt(rn,Qt,sn)):Qt.isMeshMatcapMaterial?(zt(rn,Qt),Jt(rn,Qt)):Qt.isMeshDepthMaterial?zt(rn,Qt):Qt.isMeshDistanceMaterial?(zt(rn,Qt),nn(rn,Qt)):Qt.isMeshNormalMaterial?zt(rn,Qt):Qt.isLineBasicMaterial?(jt(rn,Qt),Qt.isLineDashedMaterial&&Ht(rn,Qt)):Qt.isPointsMaterial?Wt(rn,Qt,en,tn):Qt.isSpriteMaterial?qt(rn,Qt):Qt.isShadowMaterial?(rn.color.value.copy(Qt.color),rn.opacity.value=Qt.opacity):Qt.isShaderMaterial&&(Qt.uniformsNeedUpdate=!1)}function zt(rn,Qt){rn.opacity.value=Qt.opacity,Qt.color&&rn.diffuse.value.copy(Qt.color),Qt.emissive&&rn.emissive.value.copy(Qt.emissive).multiplyScalar(Qt.emissiveIntensity),Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.bumpMap&&(rn.bumpMap.value=Qt.bumpMap,Dt(Qt.bumpMap,rn.bumpMapTransform),rn.bumpScale.value=Qt.bumpScale,Qt.side===BackSide&&(rn.bumpScale.value*=-1)),Qt.normalMap&&(rn.normalMap.value=Qt.normalMap,Dt(Qt.normalMap,rn.normalMapTransform),rn.normalScale.value.copy(Qt.normalScale),Qt.side===BackSide&&rn.normalScale.value.negate()),Qt.displacementMap&&(rn.displacementMap.value=Qt.displacementMap,Dt(Qt.displacementMap,rn.displacementMapTransform),rn.displacementScale.value=Qt.displacementScale,rn.displacementBias.value=Qt.displacementBias),Qt.emissiveMap&&(rn.emissiveMap.value=Qt.emissiveMap,Dt(Qt.emissiveMap,rn.emissiveMapTransform)),Qt.specularMap&&(rn.specularMap.value=Qt.specularMap,Dt(Qt.specularMap,rn.specularMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest);const en=_e.get(Qt),tn=en.envMap,sn=en.envMapRotation;if(tn&&(rn.envMap.value=tn,_e1.copy(sn),_e1.x*=-1,_e1.y*=-1,_e1.z*=-1,tn.isCubeTexture&&tn.isRenderTargetTexture===!1&&(_e1.y*=-1,_e1.z*=-1),rn.envMapRotation.value.setFromMatrix4(_m1.makeRotationFromEuler(_e1)),rn.flipEnvMap.value=tn.isCubeTexture&&tn.isRenderTargetTexture===!1?-1:1,rn.reflectivity.value=Qt.reflectivity,rn.ior.value=Qt.ior,rn.refractionRatio.value=Qt.refractionRatio),Qt.lightMap){rn.lightMap.value=Qt.lightMap;const cn=kt._useLegacyLights===!0?Math.PI:1;rn.lightMapIntensity.value=Qt.lightMapIntensity*cn,Dt(Qt.lightMap,rn.lightMapTransform)}Qt.aoMap&&(rn.aoMap.value=Qt.aoMap,rn.aoMapIntensity.value=Qt.aoMapIntensity,Dt(Qt.aoMap,rn.aoMapTransform))}function jt(rn,Qt){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform))}function Ht(rn,Qt){rn.dashSize.value=Qt.dashSize,rn.totalSize.value=Qt.dashSize+Qt.gapSize,rn.scale.value=Qt.scale}function Wt(rn,Qt,en,tn){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,rn.size.value=Qt.size*en,rn.scale.value=tn*.5,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.uvTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest)}function qt(rn,Qt){rn.diffuse.value.copy(Qt.color),rn.opacity.value=Qt.opacity,rn.rotation.value=Qt.rotation,Qt.map&&(rn.map.value=Qt.map,Dt(Qt.map,rn.mapTransform)),Qt.alphaMap&&(rn.alphaMap.value=Qt.alphaMap,Dt(Qt.alphaMap,rn.alphaMapTransform)),Qt.alphaTest>0&&(rn.alphaTest.value=Qt.alphaTest)}function Xt(rn,Qt){rn.specular.value.copy(Qt.specular),rn.shininess.value=Math.max(Qt.shininess,1e-4)}function Kt(rn,Qt){Qt.gradientMap&&(rn.gradientMap.value=Qt.gradientMap)}function Yt(rn,Qt){rn.metalness.value=Qt.metalness,Qt.metalnessMap&&(rn.metalnessMap.value=Qt.metalnessMap,Dt(Qt.metalnessMap,rn.metalnessMapTransform)),rn.roughness.value=Qt.roughness,Qt.roughnessMap&&(rn.roughnessMap.value=Qt.roughnessMap,Dt(Qt.roughnessMap,rn.roughnessMapTransform)),Qt.envMap&&(rn.envMapIntensity.value=Qt.envMapIntensity)}function Zt(rn,Qt,en){rn.ior.value=Qt.ior,Qt.sheen>0&&(rn.sheenColor.value.copy(Qt.sheenColor).multiplyScalar(Qt.sheen),rn.sheenRoughness.value=Qt.sheenRoughness,Qt.sheenColorMap&&(rn.sheenColorMap.value=Qt.sheenColorMap,Dt(Qt.sheenColorMap,rn.sheenColorMapTransform)),Qt.sheenRoughnessMap&&(rn.sheenRoughnessMap.value=Qt.sheenRoughnessMap,Dt(Qt.sheenRoughnessMap,rn.sheenRoughnessMapTransform))),Qt.clearcoat>0&&(rn.clearcoat.value=Qt.clearcoat,rn.clearcoatRoughness.value=Qt.clearcoatRoughness,Qt.clearcoatMap&&(rn.clearcoatMap.value=Qt.clearcoatMap,Dt(Qt.clearcoatMap,rn.clearcoatMapTransform)),Qt.clearcoatRoughnessMap&&(rn.clearcoatRoughnessMap.value=Qt.clearcoatRoughnessMap,Dt(Qt.clearcoatRoughnessMap,rn.clearcoatRoughnessMapTransform)),Qt.clearcoatNormalMap&&(rn.clearcoatNormalMap.value=Qt.clearcoatNormalMap,Dt(Qt.clearcoatNormalMap,rn.clearcoatNormalMapTransform),rn.clearcoatNormalScale.value.copy(Qt.clearcoatNormalScale),Qt.side===BackSide&&rn.clearcoatNormalScale.value.negate())),Qt.iridescence>0&&(rn.iridescence.value=Qt.iridescence,rn.iridescenceIOR.value=Qt.iridescenceIOR,rn.iridescenceThicknessMinimum.value=Qt.iridescenceThicknessRange[0],rn.iridescenceThicknessMaximum.value=Qt.iridescenceThicknessRange[1],Qt.iridescenceMap&&(rn.iridescenceMap.value=Qt.iridescenceMap,Dt(Qt.iridescenceMap,rn.iridescenceMapTransform)),Qt.iridescenceThicknessMap&&(rn.iridescenceThicknessMap.value=Qt.iridescenceThicknessMap,Dt(Qt.iridescenceThicknessMap,rn.iridescenceThicknessMapTransform))),Qt.transmission>0&&(rn.transmission.value=Qt.transmission,rn.transmissionSamplerMap.value=en.texture,rn.transmissionSamplerSize.value.set(en.width,en.height),Qt.transmissionMap&&(rn.transmissionMap.value=Qt.transmissionMap,Dt(Qt.transmissionMap,rn.transmissionMapTransform)),rn.thickness.value=Qt.thickness,Qt.thicknessMap&&(rn.thicknessMap.value=Qt.thicknessMap,Dt(Qt.thicknessMap,rn.thicknessMapTransform)),rn.attenuationDistance.value=Qt.attenuationDistance,rn.attenuationColor.value.copy(Qt.attenuationColor)),Qt.anisotropy>0&&(rn.anisotropyVector.value.set(Qt.anisotropy*Math.cos(Qt.anisotropyRotation),Qt.anisotropy*Math.sin(Qt.anisotropyRotation)),Qt.anisotropyMap&&(rn.anisotropyMap.value=Qt.anisotropyMap,Dt(Qt.anisotropyMap,rn.anisotropyMapTransform))),rn.specularIntensity.value=Qt.specularIntensity,rn.specularColor.value.copy(Qt.specularColor),Qt.specularColorMap&&(rn.specularColorMap.value=Qt.specularColorMap,Dt(Qt.specularColorMap,rn.specularColorMapTransform)),Qt.specularIntensityMap&&(rn.specularIntensityMap.value=Qt.specularIntensityMap,Dt(Qt.specularIntensityMap,rn.specularIntensityMapTransform))}function Jt(rn,Qt){Qt.matcap&&(rn.matcap.value=Qt.matcap)}function nn(rn,Qt){const en=_e.get(Qt).light;rn.referencePosition.value.setFromMatrixPosition(en.matrixWorld),rn.nearDistance.value=en.shadow.camera.near,rn.farDistance.value=en.shadow.camera.far}return{refreshFogUniforms:Vt,refreshMaterialUniforms:Gt}}function WebGLUniformsGroups(kt,_e,Dt,Vt){let Gt={},zt={},jt=[];const Ht=kt.getParameter(kt.MAX_UNIFORM_BUFFER_BINDINGS);function Wt(en,tn){const sn=tn.program;Vt.uniformBlockBinding(en,sn)}function qt(en,tn){let sn=Gt[en.id];sn===void 0&&(Jt(en),sn=Xt(en),Gt[en.id]=sn,en.addEventListener("dispose",rn));const cn=tn.program;Vt.updateUBOMapping(en,cn);const un=_e.render.frame;zt[en.id]!==un&&(Yt(en),zt[en.id]=un)}function Xt(en){const tn=Kt();en.__bindingPointIndex=tn;const sn=kt.createBuffer(),cn=en.__size,un=en.usage;return kt.bindBuffer(kt.UNIFORM_BUFFER,sn),kt.bufferData(kt.UNIFORM_BUFFER,cn,un),kt.bindBuffer(kt.UNIFORM_BUFFER,null),kt.bindBufferBase(kt.UNIFORM_BUFFER,tn,sn),sn}function Kt(){for(let en=0;en<Ht;en++)if(jt.indexOf(en)===-1)return jt.push(en),en;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function Yt(en){const tn=Gt[en.id],sn=en.uniforms,cn=en.__cache;kt.bindBuffer(kt.UNIFORM_BUFFER,tn);for(let un=0,hn=sn.length;un<hn;un++){const fn=Array.isArray(sn[un])?sn[un]:[sn[un]];for(let pn=0,dn=fn.length;pn<dn;pn++){const mn=fn[pn];if(Zt(mn,un,pn,cn)===!0){const vn=mn.__offset,_n=Array.isArray(mn.value)?mn.value:[mn.value];let En=0;for(let An=0;An<_n.length;An++){const Tn=_n[An],Cn=nn(Tn);typeof Tn=="number"||typeof Tn=="boolean"?(mn.__data[0]=Tn,kt.bufferSubData(kt.UNIFORM_BUFFER,vn+En,mn.__data)):Tn.isMatrix3?(mn.__data[0]=Tn.elements[0],mn.__data[1]=Tn.elements[1],mn.__data[2]=Tn.elements[2],mn.__data[3]=0,mn.__data[4]=Tn.elements[3],mn.__data[5]=Tn.elements[4],mn.__data[6]=Tn.elements[5],mn.__data[7]=0,mn.__data[8]=Tn.elements[6],mn.__data[9]=Tn.elements[7],mn.__data[10]=Tn.elements[8],mn.__data[11]=0):(Tn.toArray(mn.__data,En),En+=Cn.storage/Float32Array.BYTES_PER_ELEMENT)}kt.bufferSubData(kt.UNIFORM_BUFFER,vn,mn.__data)}}}kt.bindBuffer(kt.UNIFORM_BUFFER,null)}function Zt(en,tn,sn,cn){const un=en.value,hn=tn+"_"+sn;if(cn[hn]===void 0)return typeof un=="number"||typeof un=="boolean"?cn[hn]=un:cn[hn]=un.clone(),!0;{const fn=cn[hn];if(typeof un=="number"||typeof un=="boolean"){if(fn!==un)return cn[hn]=un,!0}else if(fn.equals(un)===!1)return fn.copy(un),!0}return!1}function Jt(en){const tn=en.uniforms;let sn=0;const cn=16;for(let hn=0,fn=tn.length;hn<fn;hn++){const pn=Array.isArray(tn[hn])?tn[hn]:[tn[hn]];for(let dn=0,mn=pn.length;dn<mn;dn++){const vn=pn[dn],_n=Array.isArray(vn.value)?vn.value:[vn.value];for(let En=0,An=_n.length;En<An;En++){const Tn=_n[En],Cn=nn(Tn),yn=sn%cn;yn!==0&&cn-yn<Cn.boundary&&(sn+=cn-yn),vn.__data=new Float32Array(Cn.storage/Float32Array.BYTES_PER_ELEMENT),vn.__offset=sn,sn+=Cn.storage}}}const un=sn%cn;return un>0&&(sn+=cn-un),en.__size=sn,en.__cache={},this}function nn(en){const tn={boundary:0,storage:0};return typeof en=="number"||typeof en=="boolean"?(tn.boundary=4,tn.storage=4):en.isVector2?(tn.boundary=8,tn.storage=8):en.isVector3||en.isColor?(tn.boundary=16,tn.storage=12):en.isVector4?(tn.boundary=16,tn.storage=16):en.isMatrix3?(tn.boundary=48,tn.storage=48):en.isMatrix4?(tn.boundary=64,tn.storage=64):en.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",en),tn}function rn(en){const tn=en.target;tn.removeEventListener("dispose",rn);const sn=jt.indexOf(tn.__bindingPointIndex);jt.splice(sn,1),kt.deleteBuffer(Gt[tn.id]),delete Gt[tn.id],delete zt[tn.id]}function Qt(){for(const en in Gt)kt.deleteBuffer(Gt[en]);jt=[],Gt={},zt={}}return{bind:Wt,update:qt,dispose:Qt}}class WebGLRenderer{constructor(_e={}){const{canvas:Dt=createCanvasElement(),context:Vt=null,depth:Gt=!0,stencil:zt=!1,alpha:jt=!1,antialias:Ht=!1,premultipliedAlpha:Wt=!0,preserveDrawingBuffer:qt=!1,powerPreference:Xt="default",failIfMajorPerformanceCaveat:Kt=!1}=_e;this.isWebGLRenderer=!0;let Yt;if(Vt!==null){if(typeof WebGLRenderingContext<"u"&&Vt instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");Yt=Vt.getContextAttributes().alpha}else Yt=jt;const Zt=new Uint32Array(4),Jt=new Int32Array(4);let nn=null,rn=null;const Qt=[],en=[];this.domElement=Dt,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=SRGBColorSpace$1,this._useLegacyLights=!1,this.toneMapping=NoToneMapping,this.toneMappingExposure=1;const tn=this;let sn=!1,cn=0,un=0,hn=null,fn=-1,pn=null;const dn=new Vector4,mn=new Vector4;let vn=null;const _n=new Color$1(0);let En=0,An=Dt.width,Tn=Dt.height,Cn=1,yn=null,Sn=null;const wn=new Vector4(0,0,An,Tn),xn=new Vector4(0,0,An,Tn);let Rn=!1;const Ln=new Frustum;let Nn=!1,Fn=!1;const Pn=new Matrix4,Bn=new Vector2,Hn=new Vector3,qn={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ar(){return hn===null?Cn:1}let zn=Vt;function ur(On,Gn){const tr=Dt.getContext(On,Gn);return tr!==null?tr:null}try{const On={alpha:!0,depth:Gt,stencil:zt,antialias:Ht,premultipliedAlpha:Wt,preserveDrawingBuffer:qt,powerPreference:Xt,failIfMajorPerformanceCaveat:Kt};if("setAttribute"in Dt&&Dt.setAttribute("data-engine",`three.js r${REVISION}`),Dt.addEventListener("webglcontextlost",Nr,!1),Dt.addEventListener("webglcontextrestored",yr,!1),Dt.addEventListener("webglcontextcreationerror",zr,!1),zn===null){const Gn="webgl2";if(zn=ur(Gn,On),zn===null)throw ur(Gn)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(On){throw console.error("THREE.WebGLRenderer: "+On.message),On}let Wn,or,gr,fr,Un,In,jn,er,cr,lr,Mr,mr,wr,Dr,Cr,Pr,Hr,Ir,Fr,os,ss,Jr,cs,fs;function Ur(){Wn=new WebGLExtensions(zn),Wn.init(),or=new WebGLCapabilities(zn,Wn,_e),Jr=new WebGLUtils(zn,Wn),gr=new WebGLState(zn),fr=new WebGLInfo(zn),Un=new WebGLProperties,In=new WebGLTextures(zn,Wn,gr,Un,or,Jr,fr),jn=new WebGLCubeMaps(tn),er=new WebGLCubeUVMaps(tn),cr=new WebGLAttributes(zn),cs=new WebGLBindingStates(zn,cr),lr=new WebGLGeometries(zn,cr,fr,cs),Mr=new WebGLObjects(zn,lr,cr,fr),Fr=new WebGLMorphtargets(zn,or,In),Pr=new WebGLClipping(Un),mr=new WebGLPrograms(tn,jn,er,Wn,or,cs,Pr),wr=new WebGLMaterials(tn,Un),Dr=new WebGLRenderLists,Cr=new WebGLRenderStates(Wn),Ir=new WebGLBackground(tn,jn,er,gr,Mr,Yt,Wt),Hr=new WebGLShadowMap(tn,Mr,or),fs=new WebGLUniformsGroups(zn,fr,or,gr),os=new WebGLBufferRenderer(zn,Wn,fr),ss=new WebGLIndexedBufferRenderer(zn,Wn,fr),fr.programs=mr.programs,tn.capabilities=or,tn.extensions=Wn,tn.properties=Un,tn.renderLists=Dr,tn.shadowMap=Hr,tn.state=gr,tn.info=fr}Ur();const ir=new WebXRManager(tn,zn);this.xr=ir,this.getContext=function(){return zn},this.getContextAttributes=function(){return zn.getContextAttributes()},this.forceContextLoss=function(){const On=Wn.get("WEBGL_lose_context");On&&On.loseContext()},this.forceContextRestore=function(){const On=Wn.get("WEBGL_lose_context");On&&On.restoreContext()},this.getPixelRatio=function(){return Cn},this.setPixelRatio=function(On){On!==void 0&&(Cn=On,this.setSize(An,Tn,!1))},this.getSize=function(On){return On.set(An,Tn)},this.setSize=function(On,Gn,tr=!0){if(ir.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}An=On,Tn=Gn,Dt.width=Math.floor(On*Cn),Dt.height=Math.floor(Gn*Cn),tr===!0&&(Dt.style.width=On+"px",Dt.style.height=Gn+"px"),this.setViewport(0,0,On,Gn)},this.getDrawingBufferSize=function(On){return On.set(An*Cn,Tn*Cn).floor()},this.setDrawingBufferSize=function(On,Gn,tr){An=On,Tn=Gn,Cn=tr,Dt.width=Math.floor(On*tr),Dt.height=Math.floor(Gn*tr),this.setViewport(0,0,On,Gn)},this.getCurrentViewport=function(On){return On.copy(dn)},this.getViewport=function(On){return On.copy(wn)},this.setViewport=function(On,Gn,tr,nr){On.isVector4?wn.set(On.x,On.y,On.z,On.w):wn.set(On,Gn,tr,nr),gr.viewport(dn.copy(wn).multiplyScalar(Cn).round())},this.getScissor=function(On){return On.copy(xn)},this.setScissor=function(On,Gn,tr,nr){On.isVector4?xn.set(On.x,On.y,On.z,On.w):xn.set(On,Gn,tr,nr),gr.scissor(mn.copy(xn).multiplyScalar(Cn).round())},this.getScissorTest=function(){return Rn},this.setScissorTest=function(On){gr.setScissorTest(Rn=On)},this.setOpaqueSort=function(On){yn=On},this.setTransparentSort=function(On){Sn=On},this.getClearColor=function(On){return On.copy(Ir.getClearColor())},this.setClearColor=function(){Ir.setClearColor.apply(Ir,arguments)},this.getClearAlpha=function(){return Ir.getClearAlpha()},this.setClearAlpha=function(){Ir.setClearAlpha.apply(Ir,arguments)},this.clear=function(On=!0,Gn=!0,tr=!0){let nr=0;if(On){let sr=!1;if(hn!==null){const pr=hn.texture.format;sr=pr===RGBAIntegerFormat||pr===RGIntegerFormat||pr===RedIntegerFormat}if(sr){const pr=hn.texture.type,_r=pr===UnsignedByteType||pr===UnsignedIntType||pr===UnsignedShortType||pr===UnsignedInt248Type||pr===UnsignedShort4444Type||pr===UnsignedShort5551Type,xr=Ir.getClearColor(),Tr=Ir.getClearAlpha(),br=xr.r,$r=xr.g,Rr=xr.b;_r?(Zt[0]=br,Zt[1]=$r,Zt[2]=Rr,Zt[3]=Tr,zn.clearBufferuiv(zn.COLOR,0,Zt)):(Jt[0]=br,Jt[1]=$r,Jt[2]=Rr,Jt[3]=Tr,zn.clearBufferiv(zn.COLOR,0,Jt))}else nr|=zn.COLOR_BUFFER_BIT}Gn&&(nr|=zn.DEPTH_BUFFER_BIT),tr&&(nr|=zn.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),zn.clear(nr)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){Dt.removeEventListener("webglcontextlost",Nr,!1),Dt.removeEventListener("webglcontextrestored",yr,!1),Dt.removeEventListener("webglcontextcreationerror",zr,!1),Dr.dispose(),Cr.dispose(),Un.dispose(),jn.dispose(),er.dispose(),Mr.dispose(),cs.dispose(),fs.dispose(),mr.dispose(),ir.dispose(),ir.removeEventListener("sessionstart",zs),ir.removeEventListener("sessionend",js),ro.stop()};function Nr(On){On.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),sn=!0}function yr(){console.log("THREE.WebGLRenderer: Context Restored."),sn=!1;const On=fr.autoReset,Gn=Hr.enabled,tr=Hr.autoUpdate,nr=Hr.needsUpdate,sr=Hr.type;Ur(),fr.autoReset=On,Hr.enabled=Gn,Hr.autoUpdate=tr,Hr.needsUpdate=nr,Hr.type=sr}function zr(On){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",On.statusMessage)}function Zr(On){const Gn=On.target;Gn.removeEventListener("dispose",Zr),gs(Gn)}function gs(On){bs(On),Un.remove(On)}function bs(On){const Gn=Un.get(On).programs;Gn!==void 0&&(Gn.forEach(function(tr){mr.releaseProgram(tr)}),On.isShaderMaterial&&mr.releaseShaderCache(On))}this.renderBufferDirect=function(On,Gn,tr,nr,sr,pr){Gn===null&&(Gn=qn);const _r=sr.isMesh&&sr.matrixWorld.determinant()<0,xr=Ls(On,Gn,tr,nr,sr);gr.setMaterial(nr,_r);let Tr=tr.index,br=1;if(nr.wireframe===!0){if(Tr=lr.getWireframeAttribute(tr),Tr===void 0)return;br=2}const $r=tr.drawRange,Rr=tr.attributes.position;let kr=$r.start*br,Xr=($r.start+$r.count)*br;pr!==null&&(kr=Math.max(kr,pr.start*br),Xr=Math.min(Xr,(pr.start+pr.count)*br)),Tr!==null?(kr=Math.max(kr,0),Xr=Math.min(Xr,Tr.count)):Rr!=null&&(kr=Math.max(kr,0),Xr=Math.min(Xr,Rr.count));const jr=Xr-kr;if(jr<0||jr===1/0)return;cs.setup(sr,nr,xr,tr,Tr);let es,qr=os;if(Tr!==null&&(es=cr.get(Tr),qr=ss,qr.setIndex(es)),sr.isMesh)nr.wireframe===!0?(gr.setLineWidth(nr.wireframeLinewidth*ar()),qr.setMode(zn.LINES)):qr.setMode(zn.TRIANGLES);else if(sr.isLine){let Lr=nr.linewidth;Lr===void 0&&(Lr=1),gr.setLineWidth(Lr*ar()),sr.isLineSegments?qr.setMode(zn.LINES):sr.isLineLoop?qr.setMode(zn.LINE_LOOP):qr.setMode(zn.LINE_STRIP)}else sr.isPoints?qr.setMode(zn.POINTS):sr.isSprite&&qr.setMode(zn.TRIANGLES);if(sr.isBatchedMesh)qr.renderMultiDraw(sr._multiDrawStarts,sr._multiDrawCounts,sr._multiDrawCount);else if(sr.isInstancedMesh)qr.renderInstances(kr,jr,sr.count);else if(tr.isInstancedBufferGeometry){const Lr=tr._maxInstanceCount!==void 0?tr._maxInstanceCount:1/0,_i=Math.min(tr.instanceCount,Lr);qr.renderInstances(kr,jr,_i)}else qr.render(kr,jr)};function Ts(On,Gn,tr){On.transparent===!0&&On.side===DoubleSide&&On.forceSinglePass===!1?(On.side=BackSide,On.needsUpdate=!0,Us(On,Gn,tr),On.side=FrontSide,On.needsUpdate=!0,Us(On,Gn,tr),On.side=DoubleSide):Us(On,Gn,tr)}this.compile=function(On,Gn,tr=null){tr===null&&(tr=On),rn=Cr.get(tr),rn.init(),en.push(rn),tr.traverseVisible(function(sr){sr.isLight&&sr.layers.test(Gn.layers)&&(rn.pushLight(sr),sr.castShadow&&rn.pushShadow(sr))}),On!==tr&&On.traverseVisible(function(sr){sr.isLight&&sr.layers.test(Gn.layers)&&(rn.pushLight(sr),sr.castShadow&&rn.pushShadow(sr))}),rn.setupLights(tn._useLegacyLights);const nr=new Set;return On.traverse(function(sr){const pr=sr.material;if(pr)if(Array.isArray(pr))for(let _r=0;_r<pr.length;_r++){const xr=pr[_r];Ts(xr,tr,sr),nr.add(xr)}else Ts(pr,tr,sr),nr.add(pr)}),en.pop(),rn=null,nr},this.compileAsync=function(On,Gn,tr=null){const nr=this.compile(On,Gn,tr);return new Promise(sr=>{function pr(){if(nr.forEach(function(_r){Un.get(_r).currentProgram.isReady()&&nr.delete(_r)}),nr.size===0){sr(On);return}setTimeout(pr,10)}Wn.get("KHR_parallel_shader_compile")!==null?pr():setTimeout(pr,10)})};let Ps=null;function vs(On){Ps&&Ps(On)}function zs(){ro.stop()}function js(){ro.start()}const ro=new WebGLAnimation;ro.setAnimationLoop(vs),typeof self<"u"&&ro.setContext(self),this.setAnimationLoop=function(On){Ps=On,ir.setAnimationLoop(On),On===null?ro.stop():ro.start()},ir.addEventListener("sessionstart",zs),ir.addEventListener("sessionend",js),this.render=function(On,Gn){if(Gn!==void 0&&Gn.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(sn===!0)return;On.matrixWorldAutoUpdate===!0&&On.updateMatrixWorld(),Gn.parent===null&&Gn.matrixWorldAutoUpdate===!0&&Gn.updateMatrixWorld(),ir.enabled===!0&&ir.isPresenting===!0&&(ir.cameraAutoUpdate===!0&&ir.updateCamera(Gn),Gn=ir.getCamera()),On.isScene===!0&&On.onBeforeRender(tn,On,Gn,hn),rn=Cr.get(On,en.length),rn.init(),en.push(rn),Pn.multiplyMatrices(Gn.projectionMatrix,Gn.matrixWorldInverse),Ln.setFromProjectionMatrix(Pn),Fn=this.localClippingEnabled,Nn=Pr.init(this.clippingPlanes,Fn),nn=Dr.get(On,Qt.length),nn.init(),Qt.push(nn),Bo(On,Gn,0,tn.sortObjects),nn.finish(),tn.sortObjects===!0&&nn.sort(yn,Sn),this.info.render.frame++,Nn===!0&&Pr.beginShadows();const tr=rn.state.shadowsArray;if(Hr.render(tr,On,Gn),Nn===!0&&Pr.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ir.enabled===!1||ir.isPresenting===!1||ir.hasDepthSensing()===!1)&&Ir.render(nn,On),rn.setupLights(tn._useLegacyLights),Gn.isArrayCamera){const nr=Gn.cameras;for(let sr=0,pr=nr.length;sr<pr;sr++){const _r=nr[sr];Uo(nn,On,_r,_r.viewport)}}else Uo(nn,On,Gn);hn!==null&&(In.updateMultisampleRenderTarget(hn),In.updateRenderTargetMipmap(hn)),On.isScene===!0&&On.onAfterRender(tn,On,Gn),cs.resetDefaultState(),fn=-1,pn=null,en.pop(),en.length>0?rn=en[en.length-1]:rn=null,Qt.pop(),Qt.length>0?nn=Qt[Qt.length-1]:nn=null};function Bo(On,Gn,tr,nr){if(On.visible===!1)return;if(On.layers.test(Gn.layers)){if(On.isGroup)tr=On.renderOrder;else if(On.isLOD)On.autoUpdate===!0&&On.update(Gn);else if(On.isLight)rn.pushLight(On),On.castShadow&&rn.pushShadow(On);else if(On.isSprite){if(!On.frustumCulled||Ln.intersectsSprite(On)){nr&&Hn.setFromMatrixPosition(On.matrixWorld).applyMatrix4(Pn);const _r=Mr.update(On),xr=On.material;xr.visible&&nn.push(On,_r,xr,tr,Hn.z,null)}}else if((On.isMesh||On.isLine||On.isPoints)&&(!On.frustumCulled||Ln.intersectsObject(On))){const _r=Mr.update(On),xr=On.material;if(nr&&(On.boundingSphere!==void 0?(On.boundingSphere===null&&On.computeBoundingSphere(),Hn.copy(On.boundingSphere.center)):(_r.boundingSphere===null&&_r.computeBoundingSphere(),Hn.copy(_r.boundingSphere.center)),Hn.applyMatrix4(On.matrixWorld).applyMatrix4(Pn)),Array.isArray(xr)){const Tr=_r.groups;for(let br=0,$r=Tr.length;br<$r;br++){const Rr=Tr[br],kr=xr[Rr.materialIndex];kr&&kr.visible&&nn.push(On,_r,kr,tr,Hn.z,Rr)}}else xr.visible&&nn.push(On,_r,xr,tr,Hn.z,null)}}const pr=On.children;for(let _r=0,xr=pr.length;_r<xr;_r++)Bo(pr[_r],Gn,tr,nr)}function Uo(On,Gn,tr,nr){const sr=On.opaque,pr=On.transmissive,_r=On.transparent;rn.setupLightsView(tr),Nn===!0&&Pr.setGlobalState(tn.clippingPlanes,tr),pr.length>0&&lo(sr,pr,Gn,tr),nr&&gr.viewport(dn.copy(nr)),sr.length>0&&co(sr,Gn,tr),pr.length>0&&co(pr,Gn,tr),_r.length>0&&co(_r,Gn,tr),gr.buffers.depth.setTest(!0),gr.buffers.depth.setMask(!0),gr.buffers.color.setMask(!0),gr.setPolygonOffset(!1)}function lo(On,Gn,tr,nr){if((tr.isScene===!0?tr.overrideMaterial:null)!==null)return;if(rn.state.transmissionRenderTarget===null){rn.state.transmissionRenderTarget=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:Wn.has("EXT_color_buffer_half_float")||Wn.has("EXT_color_buffer_float")?HalfFloatType:UnsignedByteType,minFilter:LinearMipmapLinearFilter,samples:4,stencilBuffer:zt});const br=Un.get(rn.state.transmissionRenderTarget);br.__isTransmissionRenderTarget=!0}const pr=rn.state.transmissionRenderTarget;tn.getDrawingBufferSize(Bn),pr.setSize(Bn.x,Bn.y);const _r=tn.getRenderTarget();tn.setRenderTarget(pr),tn.getClearColor(_n),En=tn.getClearAlpha(),En<1&&tn.setClearColor(16777215,.5),tn.clear();const xr=tn.toneMapping;tn.toneMapping=NoToneMapping,co(On,tr,nr),In.updateMultisampleRenderTarget(pr),In.updateRenderTargetMipmap(pr);let Tr=!1;for(let br=0,$r=Gn.length;br<$r;br++){const Rr=Gn[br],kr=Rr.object,Xr=Rr.geometry,jr=Rr.material,es=Rr.group;if(jr.side===DoubleSide&&kr.layers.test(nr.layers)){const qr=jr.side;jr.side=BackSide,jr.needsUpdate=!0,uo(kr,tr,nr,Xr,jr,es),jr.side=qr,jr.needsUpdate=!0,Tr=!0}}Tr===!0&&(In.updateMultisampleRenderTarget(pr),In.updateRenderTargetMipmap(pr)),tn.setRenderTarget(_r),tn.setClearColor(_n,En),tn.toneMapping=xr}function co(On,Gn,tr){const nr=Gn.isScene===!0?Gn.overrideMaterial:null;for(let sr=0,pr=On.length;sr<pr;sr++){const _r=On[sr],xr=_r.object,Tr=_r.geometry,br=nr===null?_r.material:nr,$r=_r.group;xr.layers.test(tr.layers)&&uo(xr,Gn,tr,Tr,br,$r)}}function uo(On,Gn,tr,nr,sr,pr){On.onBeforeRender(tn,Gn,tr,nr,sr,pr),On.modelViewMatrix.multiplyMatrices(tr.matrixWorldInverse,On.matrixWorld),On.normalMatrix.getNormalMatrix(On.modelViewMatrix),sr.onBeforeRender(tn,Gn,tr,nr,On,pr),sr.transparent===!0&&sr.side===DoubleSide&&sr.forceSinglePass===!1?(sr.side=BackSide,sr.needsUpdate=!0,tn.renderBufferDirect(tr,Gn,nr,sr,On,pr),sr.side=FrontSide,sr.needsUpdate=!0,tn.renderBufferDirect(tr,Gn,nr,sr,On,pr),sr.side=DoubleSide):tn.renderBufferDirect(tr,Gn,nr,sr,On,pr),On.onAfterRender(tn,Gn,tr,nr,sr,pr)}function Us(On,Gn,tr){Gn.isScene!==!0&&(Gn=qn);const nr=Un.get(On),sr=rn.state.lights,pr=rn.state.shadowsArray,_r=sr.state.version,xr=mr.getParameters(On,sr.state,pr,Gn,tr),Tr=mr.getProgramCacheKey(xr);let br=nr.programs;nr.environment=On.isMeshStandardMaterial?Gn.environment:null,nr.fog=Gn.fog,nr.envMap=(On.isMeshStandardMaterial?er:jn).get(On.envMap||nr.environment),nr.envMapRotation=nr.environment!==null&&On.envMap===null?Gn.environmentRotation:On.envMapRotation,br===void 0&&(On.addEventListener("dispose",Zr),br=new Map,nr.programs=br);let $r=br.get(Tr);if($r!==void 0){if(nr.currentProgram===$r&&nr.lightsStateVersion===_r)return Is(On,xr),$r}else xr.uniforms=mr.getUniforms(On),On.onBuild(tr,xr,tn),On.onBeforeCompile(xr,tn),$r=mr.acquireProgram(xr,Tr),br.set(Tr,$r),nr.uniforms=xr.uniforms;const Rr=nr.uniforms;return(!On.isShaderMaterial&&!On.isRawShaderMaterial||On.clipping===!0)&&(Rr.clippingPlanes=Pr.uniform),Is(On,xr),nr.needsLights=$n(On),nr.lightsStateVersion=_r,nr.needsLights&&(Rr.ambientLightColor.value=sr.state.ambient,Rr.lightProbe.value=sr.state.probe,Rr.directionalLights.value=sr.state.directional,Rr.directionalLightShadows.value=sr.state.directionalShadow,Rr.spotLights.value=sr.state.spot,Rr.spotLightShadows.value=sr.state.spotShadow,Rr.rectAreaLights.value=sr.state.rectArea,Rr.ltc_1.value=sr.state.rectAreaLTC1,Rr.ltc_2.value=sr.state.rectAreaLTC2,Rr.pointLights.value=sr.state.point,Rr.pointLightShadows.value=sr.state.pointShadow,Rr.hemisphereLights.value=sr.state.hemi,Rr.directionalShadowMap.value=sr.state.directionalShadowMap,Rr.directionalShadowMatrix.value=sr.state.directionalShadowMatrix,Rr.spotShadowMap.value=sr.state.spotShadowMap,Rr.spotLightMatrix.value=sr.state.spotLightMatrix,Rr.spotLightMap.value=sr.state.spotLightMap,Rr.pointShadowMap.value=sr.state.pointShadowMap,Rr.pointShadowMatrix.value=sr.state.pointShadowMatrix),nr.currentProgram=$r,nr.uniformsList=null,$r}function Ar(On){if(On.uniformsList===null){const Gn=On.currentProgram.getUniforms();On.uniformsList=WebGLUniforms.seqWithValue(Gn.seq,On.uniforms)}return On.uniformsList}function Is(On,Gn){const tr=Un.get(On);tr.outputColorSpace=Gn.outputColorSpace,tr.batching=Gn.batching,tr.instancing=Gn.instancing,tr.instancingColor=Gn.instancingColor,tr.instancingMorph=Gn.instancingMorph,tr.skinning=Gn.skinning,tr.morphTargets=Gn.morphTargets,tr.morphNormals=Gn.morphNormals,tr.morphColors=Gn.morphColors,tr.morphTargetsCount=Gn.morphTargetsCount,tr.numClippingPlanes=Gn.numClippingPlanes,tr.numIntersection=Gn.numClipIntersection,tr.vertexAlphas=Gn.vertexAlphas,tr.vertexTangents=Gn.vertexTangents,tr.toneMapping=Gn.toneMapping}function Ls(On,Gn,tr,nr,sr){Gn.isScene!==!0&&(Gn=qn),In.resetTextureUnits();const pr=Gn.fog,_r=nr.isMeshStandardMaterial?Gn.environment:null,xr=hn===null?tn.outputColorSpace:hn.isXRRenderTarget===!0?hn.texture.colorSpace:LinearSRGBColorSpace$1,Tr=(nr.isMeshStandardMaterial?er:jn).get(nr.envMap||_r),br=nr.vertexColors===!0&&!!tr.attributes.color&&tr.attributes.color.itemSize===4,$r=!!tr.attributes.tangent&&(!!nr.normalMap||nr.anisotropy>0),Rr=!!tr.morphAttributes.position,kr=!!tr.morphAttributes.normal,Xr=!!tr.morphAttributes.color;let jr=NoToneMapping;nr.toneMapped&&(hn===null||hn.isXRRenderTarget===!0)&&(jr=tn.toneMapping);const es=tr.morphAttributes.position||tr.morphAttributes.normal||tr.morphAttributes.color,qr=es!==void 0?es.length:0,Lr=Un.get(nr),_i=rn.state.lights;if(Nn===!0&&(Fn===!0||On!==pn)){const _s=On===pn&&nr.id===fn;Pr.setState(nr,On,_s)}let Wr=!1;nr.version===Lr.__version?(Lr.needsLights&&Lr.lightsStateVersion!==_i.state.version||Lr.outputColorSpace!==xr||sr.isBatchedMesh&&Lr.batching===!1||!sr.isBatchedMesh&&Lr.batching===!0||sr.isInstancedMesh&&Lr.instancing===!1||!sr.isInstancedMesh&&Lr.instancing===!0||sr.isSkinnedMesh&&Lr.skinning===!1||!sr.isSkinnedMesh&&Lr.skinning===!0||sr.isInstancedMesh&&Lr.instancingColor===!0&&sr.instanceColor===null||sr.isInstancedMesh&&Lr.instancingColor===!1&&sr.instanceColor!==null||sr.isInstancedMesh&&Lr.instancingMorph===!0&&sr.morphTexture===null||sr.isInstancedMesh&&Lr.instancingMorph===!1&&sr.morphTexture!==null||Lr.envMap!==Tr||nr.fog===!0&&Lr.fog!==pr||Lr.numClippingPlanes!==void 0&&(Lr.numClippingPlanes!==Pr.numPlanes||Lr.numIntersection!==Pr.numIntersection)||Lr.vertexAlphas!==br||Lr.vertexTangents!==$r||Lr.morphTargets!==Rr||Lr.morphNormals!==kr||Lr.morphColors!==Xr||Lr.toneMapping!==jr||Lr.morphTargetsCount!==qr)&&(Wr=!0):(Wr=!0,Lr.__version=nr.version);let hs=Lr.currentProgram;Wr===!0&&(hs=Us(nr,Gn,sr));let ts=!1,ys=!1,Ns=!1;const us=hs.getUniforms(),Cs=Lr.uniforms;if(gr.useProgram(hs.program)&&(ts=!0,ys=!0,Ns=!0),nr.id!==fn&&(fn=nr.id,ys=!0),ts||pn!==On){us.setValue(zn,"projectionMatrix",On.projectionMatrix),us.setValue(zn,"viewMatrix",On.matrixWorldInverse);const _s=us.map.cameraPosition;_s!==void 0&&_s.setValue(zn,Hn.setFromMatrixPosition(On.matrixWorld)),or.logarithmicDepthBuffer&&us.setValue(zn,"logDepthBufFC",2/(Math.log(On.far+1)/Math.LN2)),(nr.isMeshPhongMaterial||nr.isMeshToonMaterial||nr.isMeshLambertMaterial||nr.isMeshBasicMaterial||nr.isMeshStandardMaterial||nr.isShaderMaterial)&&us.setValue(zn,"isOrthographic",On.isOrthographicCamera===!0),pn!==On&&(pn=On,ys=!0,Ns=!0)}if(sr.isSkinnedMesh){us.setOptional(zn,sr,"bindMatrix"),us.setOptional(zn,sr,"bindMatrixInverse");const _s=sr.skeleton;_s&&(_s.boneTexture===null&&_s.computeBoneTexture(),us.setValue(zn,"boneTexture",_s.boneTexture,In))}sr.isBatchedMesh&&(us.setOptional(zn,sr,"batchingTexture"),us.setValue(zn,"batchingTexture",sr._matricesTexture,In));const ds=tr.morphAttributes;if((ds.position!==void 0||ds.normal!==void 0||ds.color!==void 0)&&Fr.update(sr,tr,hs),(ys||Lr.receiveShadow!==sr.receiveShadow)&&(Lr.receiveShadow=sr.receiveShadow,us.setValue(zn,"receiveShadow",sr.receiveShadow)),nr.isMeshGouraudMaterial&&nr.envMap!==null&&(Cs.envMap.value=Tr,Cs.flipEnvMap.value=Tr.isCubeTexture&&Tr.isRenderTargetTexture===!1?-1:1),nr.isMeshStandardMaterial&&nr.envMap===null&&Gn.environment!==null&&(Cs.envMapIntensity.value=Gn.environmentIntensity),ys&&(us.setValue(zn,"toneMappingExposure",tn.toneMappingExposure),Lr.needsLights&&kn(Cs,Ns),pr&&nr.fog===!0&&wr.refreshFogUniforms(Cs,pr),wr.refreshMaterialUniforms(Cs,nr,Cn,Tn,rn.state.transmissionRenderTarget),WebGLUniforms.upload(zn,Ar(Lr),Cs,In)),nr.isShaderMaterial&&nr.uniformsNeedUpdate===!0&&(WebGLUniforms.upload(zn,Ar(Lr),Cs,In),nr.uniformsNeedUpdate=!1),nr.isSpriteMaterial&&us.setValue(zn,"center",sr.center),us.setValue(zn,"modelViewMatrix",sr.modelViewMatrix),us.setValue(zn,"normalMatrix",sr.normalMatrix),us.setValue(zn,"modelMatrix",sr.matrixWorld),nr.isShaderMaterial||nr.isRawShaderMaterial){const _s=nr.uniformsGroups;for(let ms=0,ps=_s.length;ms<ps;ms++){const ws=_s[ms];fs.update(ws,hs),fs.bind(ws,hs)}}return hs}function kn(On,Gn){On.ambientLightColor.needsUpdate=Gn,On.lightProbe.needsUpdate=Gn,On.directionalLights.needsUpdate=Gn,On.directionalLightShadows.needsUpdate=Gn,On.pointLights.needsUpdate=Gn,On.pointLightShadows.needsUpdate=Gn,On.spotLights.needsUpdate=Gn,On.spotLightShadows.needsUpdate=Gn,On.rectAreaLights.needsUpdate=Gn,On.hemisphereLights.needsUpdate=Gn}function $n(On){return On.isMeshLambertMaterial||On.isMeshToonMaterial||On.isMeshPhongMaterial||On.isMeshStandardMaterial||On.isShadowMaterial||On.isShaderMaterial&&On.lights===!0}this.getActiveCubeFace=function(){return cn},this.getActiveMipmapLevel=function(){return un},this.getRenderTarget=function(){return hn},this.setRenderTargetTextures=function(On,Gn,tr){Un.get(On.texture).__webglTexture=Gn,Un.get(On.depthTexture).__webglTexture=tr;const nr=Un.get(On);nr.__hasExternalTextures=!0,nr.__autoAllocateDepthBuffer=tr===void 0,nr.__autoAllocateDepthBuffer||Wn.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),nr.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(On,Gn){const tr=Un.get(On);tr.__webglFramebuffer=Gn,tr.__useDefaultFramebuffer=Gn===void 0},this.setRenderTarget=function(On,Gn=0,tr=0){hn=On,cn=Gn,un=tr;let nr=!0,sr=null,pr=!1,_r=!1;if(On){const Tr=Un.get(On);Tr.__useDefaultFramebuffer!==void 0?(gr.bindFramebuffer(zn.FRAMEBUFFER,null),nr=!1):Tr.__webglFramebuffer===void 0?In.setupRenderTarget(On):Tr.__hasExternalTextures&&In.rebindTextures(On,Un.get(On.texture).__webglTexture,Un.get(On.depthTexture).__webglTexture);const br=On.texture;(br.isData3DTexture||br.isDataArrayTexture||br.isCompressedArrayTexture)&&(_r=!0);const $r=Un.get(On).__webglFramebuffer;On.isWebGLCubeRenderTarget?(Array.isArray($r[Gn])?sr=$r[Gn][tr]:sr=$r[Gn],pr=!0):On.samples>0&&In.useMultisampledRTT(On)===!1?sr=Un.get(On).__webglMultisampledFramebuffer:Array.isArray($r)?sr=$r[tr]:sr=$r,dn.copy(On.viewport),mn.copy(On.scissor),vn=On.scissorTest}else dn.copy(wn).multiplyScalar(Cn).floor(),mn.copy(xn).multiplyScalar(Cn).floor(),vn=Rn;if(gr.bindFramebuffer(zn.FRAMEBUFFER,sr)&&nr&&gr.drawBuffers(On,sr),gr.viewport(dn),gr.scissor(mn),gr.setScissorTest(vn),pr){const Tr=Un.get(On.texture);zn.framebufferTexture2D(zn.FRAMEBUFFER,zn.COLOR_ATTACHMENT0,zn.TEXTURE_CUBE_MAP_POSITIVE_X+Gn,Tr.__webglTexture,tr)}else if(_r){const Tr=Un.get(On.texture),br=Gn||0;zn.framebufferTextureLayer(zn.FRAMEBUFFER,zn.COLOR_ATTACHMENT0,Tr.__webglTexture,tr||0,br)}fn=-1},this.readRenderTargetPixels=function(On,Gn,tr,nr,sr,pr,_r){if(!(On&&On.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let xr=Un.get(On).__webglFramebuffer;if(On.isWebGLCubeRenderTarget&&_r!==void 0&&(xr=xr[_r]),xr){gr.bindFramebuffer(zn.FRAMEBUFFER,xr);try{const Tr=On.texture,br=Tr.format,$r=Tr.type;if(br!==RGBAFormat&&Jr.convert(br)!==zn.getParameter(zn.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Rr=$r===HalfFloatType&&(Wn.has("EXT_color_buffer_half_float")||Wn.has("EXT_color_buffer_float"));if($r!==UnsignedByteType&&Jr.convert($r)!==zn.getParameter(zn.IMPLEMENTATION_COLOR_READ_TYPE)&&$r!==FloatType&&!Rr){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Gn>=0&&Gn<=On.width-nr&&tr>=0&&tr<=On.height-sr&&zn.readPixels(Gn,tr,nr,sr,Jr.convert(br),Jr.convert($r),pr)}finally{const Tr=hn!==null?Un.get(hn).__webglFramebuffer:null;gr.bindFramebuffer(zn.FRAMEBUFFER,Tr)}}},this.copyFramebufferToTexture=function(On,Gn,tr=0){const nr=Math.pow(2,-tr),sr=Math.floor(Gn.image.width*nr),pr=Math.floor(Gn.image.height*nr);In.setTexture2D(Gn,0),zn.copyTexSubImage2D(zn.TEXTURE_2D,tr,0,0,On.x,On.y,sr,pr),gr.unbindTexture()},this.copyTextureToTexture=function(On,Gn,tr,nr=0){const sr=Gn.image.width,pr=Gn.image.height,_r=Jr.convert(tr.format),xr=Jr.convert(tr.type);In.setTexture2D(tr,0),zn.pixelStorei(zn.UNPACK_FLIP_Y_WEBGL,tr.flipY),zn.pixelStorei(zn.UNPACK_PREMULTIPLY_ALPHA_WEBGL,tr.premultiplyAlpha),zn.pixelStorei(zn.UNPACK_ALIGNMENT,tr.unpackAlignment),Gn.isDataTexture?zn.texSubImage2D(zn.TEXTURE_2D,nr,On.x,On.y,sr,pr,_r,xr,Gn.image.data):Gn.isCompressedTexture?zn.compressedTexSubImage2D(zn.TEXTURE_2D,nr,On.x,On.y,Gn.mipmaps[0].width,Gn.mipmaps[0].height,_r,Gn.mipmaps[0].data):zn.texSubImage2D(zn.TEXTURE_2D,nr,On.x,On.y,_r,xr,Gn.image),nr===0&&tr.generateMipmaps&&zn.generateMipmap(zn.TEXTURE_2D),gr.unbindTexture()},this.copyTextureToTexture3D=function(On,Gn,tr,nr,sr=0){const pr=Math.round(On.max.x-On.min.x),_r=Math.round(On.max.y-On.min.y),xr=On.max.z-On.min.z+1,Tr=Jr.convert(nr.format),br=Jr.convert(nr.type);let $r;if(nr.isData3DTexture)In.setTexture3D(nr,0),$r=zn.TEXTURE_3D;else if(nr.isDataArrayTexture||nr.isCompressedArrayTexture)In.setTexture2DArray(nr,0),$r=zn.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}zn.pixelStorei(zn.UNPACK_FLIP_Y_WEBGL,nr.flipY),zn.pixelStorei(zn.UNPACK_PREMULTIPLY_ALPHA_WEBGL,nr.premultiplyAlpha),zn.pixelStorei(zn.UNPACK_ALIGNMENT,nr.unpackAlignment);const Rr=zn.getParameter(zn.UNPACK_ROW_LENGTH),kr=zn.getParameter(zn.UNPACK_IMAGE_HEIGHT),Xr=zn.getParameter(zn.UNPACK_SKIP_PIXELS),jr=zn.getParameter(zn.UNPACK_SKIP_ROWS),es=zn.getParameter(zn.UNPACK_SKIP_IMAGES),qr=tr.isCompressedTexture?tr.mipmaps[sr]:tr.image;zn.pixelStorei(zn.UNPACK_ROW_LENGTH,qr.width),zn.pixelStorei(zn.UNPACK_IMAGE_HEIGHT,qr.height),zn.pixelStorei(zn.UNPACK_SKIP_PIXELS,On.min.x),zn.pixelStorei(zn.UNPACK_SKIP_ROWS,On.min.y),zn.pixelStorei(zn.UNPACK_SKIP_IMAGES,On.min.z),tr.isDataTexture||tr.isData3DTexture?zn.texSubImage3D($r,sr,Gn.x,Gn.y,Gn.z,pr,_r,xr,Tr,br,qr.data):nr.isCompressedArrayTexture?zn.compressedTexSubImage3D($r,sr,Gn.x,Gn.y,Gn.z,pr,_r,xr,Tr,qr.data):zn.texSubImage3D($r,sr,Gn.x,Gn.y,Gn.z,pr,_r,xr,Tr,br,qr),zn.pixelStorei(zn.UNPACK_ROW_LENGTH,Rr),zn.pixelStorei(zn.UNPACK_IMAGE_HEIGHT,kr),zn.pixelStorei(zn.UNPACK_SKIP_PIXELS,Xr),zn.pixelStorei(zn.UNPACK_SKIP_ROWS,jr),zn.pixelStorei(zn.UNPACK_SKIP_IMAGES,es),sr===0&&nr.generateMipmaps&&zn.generateMipmap($r),gr.unbindTexture()},this.initTexture=function(On){On.isCubeTexture?In.setTextureCube(On,0):On.isData3DTexture?In.setTexture3D(On,0):On.isDataArrayTexture||On.isCompressedArrayTexture?In.setTexture2DArray(On,0):In.setTexture2D(On,0),gr.unbindTexture()},this.resetState=function(){cn=0,un=0,hn=null,gr.reset(),cs.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(_e){this._outputColorSpace=_e;const Dt=this.getContext();Dt.drawingBufferColorSpace=_e===DisplayP3ColorSpace?"display-p3":"srgb",Dt.unpackColorSpace=ColorManagement.workingColorSpace===LinearDisplayP3ColorSpace?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(_e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=_e}}class FogExp2{constructor(_e,Dt=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color$1(_e),this.density=Dt}clone(){return new FogExp2(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Fog{constructor(_e,Dt=1,Vt=1e3){this.isFog=!0,this.name="",this.color=new Color$1(_e),this.near=Dt,this.far=Vt}clone(){return new Fog(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(_e,Dt){return super.copy(_e,Dt),_e.background!==null&&(this.background=_e.background.clone()),_e.environment!==null&&(this.environment=_e.environment.clone()),_e.fog!==null&&(this.fog=_e.fog.clone()),this.backgroundBlurriness=_e.backgroundBlurriness,this.backgroundIntensity=_e.backgroundIntensity,this.backgroundRotation.copy(_e.backgroundRotation),this.environmentIntensity=_e.environmentIntensity,this.environmentRotation.copy(_e.environmentRotation),_e.overrideMaterial!==null&&(this.overrideMaterial=_e.overrideMaterial.clone()),this.matrixAutoUpdate=_e.matrixAutoUpdate,this}toJSON(_e){const Dt=super.toJSON(_e);return this.fog!==null&&(Dt.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(Dt.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(Dt.object.backgroundIntensity=this.backgroundIntensity),Dt.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(Dt.object.environmentIntensity=this.environmentIntensity),Dt.object.environmentRotation=this.environmentRotation.toArray(),Dt}}class InterleavedBuffer{constructor(_e,Dt){this.isInterleavedBuffer=!0,this.array=_e,this.stride=Dt,this.count=_e!==void 0?_e.length/Dt:0,this.usage=StaticDrawUsage,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=generateUUID()}onUploadCallback(){}set needsUpdate(_e){_e===!0&&this.version++}get updateRange(){return warnOnce("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(_e){return this.usage=_e,this}addUpdateRange(_e,Dt){this.updateRanges.push({start:_e,count:Dt})}clearUpdateRanges(){this.updateRanges.length=0}copy(_e){return this.array=new _e.array.constructor(_e.array),this.count=_e.count,this.stride=_e.stride,this.usage=_e.usage,this}copyAt(_e,Dt,Vt){_e*=this.stride,Vt*=Dt.stride;for(let Gt=0,zt=this.stride;Gt<zt;Gt++)this.array[_e+Gt]=Dt.array[Vt+Gt];return this}set(_e,Dt=0){return this.array.set(_e,Dt),this}clone(_e){_e.arrayBuffers===void 0&&(_e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=generateUUID()),_e.arrayBuffers[this.array.buffer._uuid]===void 0&&(_e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const Dt=new this.array.constructor(_e.arrayBuffers[this.array.buffer._uuid]),Vt=new this.constructor(Dt,this.stride);return Vt.setUsage(this.usage),Vt}onUpload(_e){return this.onUploadCallback=_e,this}toJSON(_e){return _e.arrayBuffers===void 0&&(_e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=generateUUID()),_e.arrayBuffers[this.array.buffer._uuid]===void 0&&(_e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const _vector$6=new Vector3;class InterleavedBufferAttribute{constructor(_e,Dt,Vt,Gt=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=_e,this.itemSize=Dt,this.offset=Vt,this.normalized=Gt}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(_e){this.data.needsUpdate=_e}applyMatrix4(_e){for(let Dt=0,Vt=this.data.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.applyMatrix4(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}applyNormalMatrix(_e){for(let Dt=0,Vt=this.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.applyNormalMatrix(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}transformDirection(_e){for(let Dt=0,Vt=this.count;Dt<Vt;Dt++)_vector$6.fromBufferAttribute(this,Dt),_vector$6.transformDirection(_e),this.setXYZ(Dt,_vector$6.x,_vector$6.y,_vector$6.z);return this}getComponent(_e,Dt){let Vt=this.array[_e*this.data.stride+this.offset+Dt];return this.normalized&&(Vt=denormalize(Vt,this.array)),Vt}setComponent(_e,Dt,Vt){return this.normalized&&(Vt=normalize(Vt,this.array)),this.data.array[_e*this.data.stride+this.offset+Dt]=Vt,this}setX(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset]=Dt,this}setY(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+1]=Dt,this}setZ(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+2]=Dt,this}setW(_e,Dt){return this.normalized&&(Dt=normalize(Dt,this.array)),this.data.array[_e*this.data.stride+this.offset+3]=Dt,this}getX(_e){let Dt=this.data.array[_e*this.data.stride+this.offset];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getY(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+1];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getZ(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+2];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}getW(_e){let Dt=this.data.array[_e*this.data.stride+this.offset+3];return this.normalized&&(Dt=denormalize(Dt,this.array)),Dt}setXY(_e,Dt,Vt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this}setXYZ(_e,Dt,Vt,Gt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array),Gt=normalize(Gt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this.data.array[_e+2]=Gt,this}setXYZW(_e,Dt,Vt,Gt,zt){return _e=_e*this.data.stride+this.offset,this.normalized&&(Dt=normalize(Dt,this.array),Vt=normalize(Vt,this.array),Gt=normalize(Gt,this.array),zt=normalize(zt,this.array)),this.data.array[_e+0]=Dt,this.data.array[_e+1]=Vt,this.data.array[_e+2]=Gt,this.data.array[_e+3]=zt,this}clone(_e){if(_e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const Dt=[];for(let Vt=0;Vt<this.count;Vt++){const Gt=Vt*this.data.stride+this.offset;for(let zt=0;zt<this.itemSize;zt++)Dt.push(this.data.array[Gt+zt])}return new BufferAttribute(new this.array.constructor(Dt),this.itemSize,this.normalized)}else return _e.interleavedBuffers===void 0&&(_e.interleavedBuffers={}),_e.interleavedBuffers[this.data.uuid]===void 0&&(_e.interleavedBuffers[this.data.uuid]=this.data.clone(_e)),new InterleavedBufferAttribute(_e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(_e){if(_e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const Dt=[];for(let Vt=0;Vt<this.count;Vt++){const Gt=Vt*this.data.stride+this.offset;for(let zt=0;zt<this.itemSize;zt++)Dt.push(this.data.array[Gt+zt])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Dt,normalized:this.normalized}}else return _e.interleavedBuffers===void 0&&(_e.interleavedBuffers={}),_e.interleavedBuffers[this.data.uuid]===void 0&&(_e.interleavedBuffers[this.data.uuid]=this.data.toJSON(_e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class SpriteMaterial extends Material{constructor(_e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Color$1(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.map=_e.map,this.alphaMap=_e.alphaMap,this.rotation=_e.rotation,this.sizeAttenuation=_e.sizeAttenuation,this.fog=_e.fog,this}}let _geometry;const _intersectPoint=new Vector3,_worldScale=new Vector3,_mvPosition=new Vector3,_alignedPosition=new Vector2,_rotatedPosition=new Vector2,_viewWorldMatrix=new Matrix4,_vA=new Vector3,_vB=new Vector3,_vC=new Vector3,_uvA=new Vector2,_uvB=new Vector2,_uvC=new Vector2;class Sprite extends Object3D{constructor(_e=new SpriteMaterial){if(super(),this.isSprite=!0,this.type="Sprite",_geometry===void 0){_geometry=new BufferGeometry;const Dt=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),Vt=new InterleavedBuffer(Dt,5);_geometry.setIndex([0,1,2,0,2,3]),_geometry.setAttribute("position",new InterleavedBufferAttribute(Vt,3,0,!1)),_geometry.setAttribute("uv",new InterleavedBufferAttribute(Vt,2,3,!1))}this.geometry=_geometry,this.material=_e,this.center=new Vector2(.5,.5)}raycast(_e,Dt){_e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),_worldScale.setFromMatrixScale(this.matrixWorld),_viewWorldMatrix.copy(_e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(_e.camera.matrixWorldInverse,this.matrixWorld),_mvPosition.setFromMatrixPosition(this.modelViewMatrix),_e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&_worldScale.multiplyScalar(-_mvPosition.z);const Vt=this.material.rotation;let Gt,zt;Vt!==0&&(zt=Math.cos(Vt),Gt=Math.sin(Vt));const jt=this.center;transformVertex(_vA.set(-.5,-.5,0),_mvPosition,jt,_worldScale,Gt,zt),transformVertex(_vB.set(.5,-.5,0),_mvPosition,jt,_worldScale,Gt,zt),transformVertex(_vC.set(.5,.5,0),_mvPosition,jt,_worldScale,Gt,zt),_uvA.set(0,0),_uvB.set(1,0),_uvC.set(1,1);let Ht=_e.ray.intersectTriangle(_vA,_vB,_vC,!1,_intersectPoint);if(Ht===null&&(transformVertex(_vB.set(-.5,.5,0),_mvPosition,jt,_worldScale,Gt,zt),_uvB.set(0,1),Ht=_e.ray.intersectTriangle(_vA,_vC,_vB,!1,_intersectPoint),Ht===null))return;const Wt=_e.ray.origin.distanceTo(_intersectPoint);Wt<_e.near||Wt>_e.far||Dt.push({distance:Wt,point:_intersectPoint.clone(),uv:Triangle.getInterpolation(_intersectPoint,_vA,_vB,_vC,_uvA,_uvB,_uvC,new Vector2),face:null,object:this})}copy(_e,Dt){return super.copy(_e,Dt),_e.center!==void 0&&this.center.copy(_e.center),this.material=_e.material,this}}function transformVertex(kt,_e,Dt,Vt,Gt,zt){_alignedPosition.subVectors(kt,Dt).addScalar(.5).multiply(Vt),Gt!==void 0?(_rotatedPosition.x=zt*_alignedPosition.x-Gt*_alignedPosition.y,_rotatedPosition.y=Gt*_alignedPosition.x+zt*_alignedPosition.y):_rotatedPosition.copy(_alignedPosition),kt.copy(_e),kt.x+=_rotatedPosition.x,kt.y+=_rotatedPosition.y,kt.applyMatrix4(_viewWorldMatrix)}const _v1$2=new Vector3,_v2$1=new Vector3;class LOD extends Object3D{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(_e){super.copy(_e,!1);const Dt=_e.levels;for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++){const zt=Dt[Vt];this.addLevel(zt.object.clone(),zt.distance,zt.hysteresis)}return this.autoUpdate=_e.autoUpdate,this}addLevel(_e,Dt=0,Vt=0){Dt=Math.abs(Dt);const Gt=this.levels;let zt;for(zt=0;zt<Gt.length&&!(Dt<Gt[zt].distance);zt++);return Gt.splice(zt,0,{distance:Dt,hysteresis:Vt,object:_e}),this.add(_e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(_e){const Dt=this.levels;if(Dt.length>0){let Vt,Gt;for(Vt=1,Gt=Dt.length;Vt<Gt;Vt++){let zt=Dt[Vt].distance;if(Dt[Vt].object.visible&&(zt-=zt*Dt[Vt].hysteresis),_e<zt)break}return Dt[Vt-1].object}return null}raycast(_e,Dt){if(this.levels.length>0){_v1$2.setFromMatrixPosition(this.matrixWorld);const Gt=_e.ray.origin.distanceTo(_v1$2);this.getObjectForDistance(Gt).raycast(_e,Dt)}}update(_e){const Dt=this.levels;if(Dt.length>1){_v1$2.setFromMatrixPosition(_e.matrixWorld),_v2$1.setFromMatrixPosition(this.matrixWorld);const Vt=_v1$2.distanceTo(_v2$1)/_e.zoom;Dt[0].object.visible=!0;let Gt,zt;for(Gt=1,zt=Dt.length;Gt<zt;Gt++){let jt=Dt[Gt].distance;if(Dt[Gt].object.visible&&(jt-=jt*Dt[Gt].hysteresis),Vt>=jt)Dt[Gt-1].object.visible=!1,Dt[Gt].object.visible=!0;else break}for(this._currentLevel=Gt-1;Gt<zt;Gt++)Dt[Gt].object.visible=!1}}toJSON(_e){const Dt=super.toJSON(_e);this.autoUpdate===!1&&(Dt.object.autoUpdate=!1),Dt.object.levels=[];const Vt=this.levels;for(let Gt=0,zt=Vt.length;Gt<zt;Gt++){const jt=Vt[Gt];Dt.object.levels.push({object:jt.object.uuid,distance:jt.distance,hysteresis:jt.hysteresis})}return Dt}}const _basePosition=new Vector3,_skinIndex=new Vector4,_skinWeight=new Vector4,_vector3=new Vector3,_matrix4=new Matrix4,_vertex=new Vector3,_sphere$4=new Sphere,_inverseMatrix$2=new Matrix4,_ray$2=new Ray;class SkinnedMesh extends Mesh{constructor(_e,Dt){super(_e,Dt),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=AttachedBindMode,this.bindMatrix=new Matrix4,this.bindMatrixInverse=new Matrix4,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const _e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Box3),this.boundingBox.makeEmpty();const Dt=_e.getAttribute("position");for(let Vt=0;Vt<Dt.count;Vt++)this.getVertexPosition(Vt,_vertex),this.boundingBox.expandByPoint(_vertex)}computeBoundingSphere(){const _e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Sphere),this.boundingSphere.makeEmpty();const Dt=_e.getAttribute("position");for(let Vt=0;Vt<Dt.count;Vt++)this.getVertexPosition(Vt,_vertex),this.boundingSphere.expandByPoint(_vertex)}copy(_e,Dt){return super.copy(_e,Dt),this.bindMode=_e.bindMode,this.bindMatrix.copy(_e.bindMatrix),this.bindMatrixInverse.copy(_e.bindMatrixInverse),this.skeleton=_e.skeleton,_e.boundingBox!==null&&(this.boundingBox=_e.boundingBox.clone()),_e.boundingSphere!==null&&(this.boundingSphere=_e.boundingSphere.clone()),this}raycast(_e,Dt){const Vt=this.material,Gt=this.matrixWorld;Vt!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_sphere$4.copy(this.boundingSphere),_sphere$4.applyMatrix4(Gt),_e.ray.intersectsSphere(_sphere$4)!==!1&&(_inverseMatrix$2.copy(Gt).invert(),_ray$2.copy(_e.ray).applyMatrix4(_inverseMatrix$2),!(this.boundingBox!==null&&_ray$2.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(_e,Dt,_ray$2)))}getVertexPosition(_e,Dt){return super.getVertexPosition(_e,Dt),this.applyBoneTransform(_e,Dt),Dt}bind(_e,Dt){this.skeleton=_e,Dt===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),Dt=this.matrixWorld),this.bindMatrix.copy(Dt),this.bindMatrixInverse.copy(Dt).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const _e=new Vector4,Dt=this.geometry.attributes.skinWeight;for(let Vt=0,Gt=Dt.count;Vt<Gt;Vt++){_e.fromBufferAttribute(Dt,Vt);const zt=1/_e.manhattanLength();zt!==1/0?_e.multiplyScalar(zt):_e.set(1,0,0,0),Dt.setXYZW(Vt,_e.x,_e.y,_e.z,_e.w)}}updateMatrixWorld(_e){super.updateMatrixWorld(_e),this.bindMode===AttachedBindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===DetachedBindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(_e,Dt){const Vt=this.skeleton,Gt=this.geometry;_skinIndex.fromBufferAttribute(Gt.attributes.skinIndex,_e),_skinWeight.fromBufferAttribute(Gt.attributes.skinWeight,_e),_basePosition.copy(Dt).applyMatrix4(this.bindMatrix),Dt.set(0,0,0);for(let zt=0;zt<4;zt++){const jt=_skinWeight.getComponent(zt);if(jt!==0){const Ht=_skinIndex.getComponent(zt);_matrix4.multiplyMatrices(Vt.bones[Ht].matrixWorld,Vt.boneInverses[Ht]),Dt.addScaledVector(_vector3.copy(_basePosition).applyMatrix4(_matrix4),jt)}}return Dt.applyMatrix4(this.bindMatrixInverse)}}class Bone extends Object3D{constructor(){super(),this.isBone=!0,this.type="Bone"}}class DataTexture extends Texture{constructor(_e=null,Dt=1,Vt=1,Gt,zt,jt,Ht,Wt,qt=NearestFilter,Xt=NearestFilter,Kt,Yt){super(null,jt,Ht,Wt,qt,Xt,Gt,zt,Kt,Yt),this.isDataTexture=!0,this.image={data:_e,width:Dt,height:Vt},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const _offsetMatrix=new Matrix4,_identityMatrix$1=new Matrix4;class Skeleton{constructor(_e=[],Dt=[]){this.uuid=generateUUID(),this.bones=_e.slice(0),this.boneInverses=Dt,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const _e=this.bones,Dt=this.boneInverses;if(this.boneMatrices=new Float32Array(_e.length*16),Dt.length===0)this.calculateInverses();else if(_e.length!==Dt.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let Vt=0,Gt=this.bones.length;Vt<Gt;Vt++)this.boneInverses.push(new Matrix4)}}calculateInverses(){this.boneInverses.length=0;for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=new Matrix4;this.bones[_e]&&Vt.copy(this.bones[_e].matrixWorld).invert(),this.boneInverses.push(Vt)}}pose(){for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=this.bones[_e];Vt&&Vt.matrixWorld.copy(this.boneInverses[_e]).invert()}for(let _e=0,Dt=this.bones.length;_e<Dt;_e++){const Vt=this.bones[_e];Vt&&(Vt.parent&&Vt.parent.isBone?(Vt.matrix.copy(Vt.parent.matrixWorld).invert(),Vt.matrix.multiply(Vt.matrixWorld)):Vt.matrix.copy(Vt.matrixWorld),Vt.matrix.decompose(Vt.position,Vt.quaternion,Vt.scale))}}update(){const _e=this.bones,Dt=this.boneInverses,Vt=this.boneMatrices,Gt=this.boneTexture;for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=_e[zt]?_e[zt].matrixWorld:_identityMatrix$1;_offsetMatrix.multiplyMatrices(Ht,Dt[zt]),_offsetMatrix.toArray(Vt,zt*16)}Gt!==null&&(Gt.needsUpdate=!0)}clone(){return new Skeleton(this.bones,this.boneInverses)}computeBoneTexture(){let _e=Math.sqrt(this.bones.length*4);_e=Math.ceil(_e/4)*4,_e=Math.max(_e,4);const Dt=new Float32Array(_e*_e*4);Dt.set(this.boneMatrices);const Vt=new DataTexture(Dt,_e,_e,RGBAFormat,FloatType);return Vt.needsUpdate=!0,this.boneMatrices=Dt,this.boneTexture=Vt,this}getBoneByName(_e){for(let Dt=0,Vt=this.bones.length;Dt<Vt;Dt++){const Gt=this.bones[Dt];if(Gt.name===_e)return Gt}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(_e,Dt){this.uuid=_e.uuid;for(let Vt=0,Gt=_e.bones.length;Vt<Gt;Vt++){const zt=_e.bones[Vt];let jt=Dt[zt];jt===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",zt),jt=new Bone),this.bones.push(jt),this.boneInverses.push(new Matrix4().fromArray(_e.boneInverses[Vt]))}return this.init(),this}toJSON(){const _e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};_e.uuid=this.uuid;const Dt=this.bones,Vt=this.boneInverses;for(let Gt=0,zt=Dt.length;Gt<zt;Gt++){const jt=Dt[Gt];_e.bones.push(jt.uuid);const Ht=Vt[Gt];_e.boneInverses.push(Ht.toArray())}return _e}}class InstancedBufferAttribute extends BufferAttribute{constructor(_e,Dt,Vt,Gt=1){super(_e,Dt,Vt),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=Gt}copy(_e){return super.copy(_e),this.meshPerAttribute=_e.meshPerAttribute,this}toJSON(){const _e=super.toJSON();return _e.meshPerAttribute=this.meshPerAttribute,_e.isInstancedBufferAttribute=!0,_e}}const _instanceLocalMatrix=new Matrix4,_instanceWorldMatrix=new Matrix4,_instanceIntersects=[],_box3=new Box3,_identity=new Matrix4,_mesh$1=new Mesh,_sphere$3=new Sphere;class InstancedMesh extends Mesh{constructor(_e,Dt,Vt){super(_e,Dt),this.isInstancedMesh=!0,this.instanceMatrix=new InstancedBufferAttribute(new Float32Array(Vt*16),16),this.instanceColor=null,this.morphTexture=null,this.count=Vt,this.boundingBox=null,this.boundingSphere=null;for(let Gt=0;Gt<Vt;Gt++)this.setMatrixAt(Gt,_identity)}computeBoundingBox(){const _e=this.geometry,Dt=this.count;this.boundingBox===null&&(this.boundingBox=new Box3),_e.boundingBox===null&&_e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let Vt=0;Vt<Dt;Vt++)this.getMatrixAt(Vt,_instanceLocalMatrix),_box3.copy(_e.boundingBox).applyMatrix4(_instanceLocalMatrix),this.boundingBox.union(_box3)}computeBoundingSphere(){const _e=this.geometry,Dt=this.count;this.boundingSphere===null&&(this.boundingSphere=new Sphere),_e.boundingSphere===null&&_e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let Vt=0;Vt<Dt;Vt++)this.getMatrixAt(Vt,_instanceLocalMatrix),_sphere$3.copy(_e.boundingSphere).applyMatrix4(_instanceLocalMatrix),this.boundingSphere.union(_sphere$3)}copy(_e,Dt){return super.copy(_e,Dt),this.instanceMatrix.copy(_e.instanceMatrix),_e.morphTexture!==null&&(this.morphTexture=_e.morphTexture.clone()),_e.instanceColor!==null&&(this.instanceColor=_e.instanceColor.clone()),this.count=_e.count,_e.boundingBox!==null&&(this.boundingBox=_e.boundingBox.clone()),_e.boundingSphere!==null&&(this.boundingSphere=_e.boundingSphere.clone()),this}getColorAt(_e,Dt){Dt.fromArray(this.instanceColor.array,_e*3)}getMatrixAt(_e,Dt){Dt.fromArray(this.instanceMatrix.array,_e*16)}getMorphAt(_e,Dt){const Vt=Dt.morphTargetInfluences,Gt=this.morphTexture.source.data.data,zt=Vt.length+1,jt=_e*zt+1;for(let Ht=0;Ht<Vt.length;Ht++)Vt[Ht]=Gt[jt+Ht]}raycast(_e,Dt){const Vt=this.matrixWorld,Gt=this.count;if(_mesh$1.geometry=this.geometry,_mesh$1.material=this.material,_mesh$1.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),_sphere$3.copy(this.boundingSphere),_sphere$3.applyMatrix4(Vt),_e.ray.intersectsSphere(_sphere$3)!==!1))for(let zt=0;zt<Gt;zt++){this.getMatrixAt(zt,_instanceLocalMatrix),_instanceWorldMatrix.multiplyMatrices(Vt,_instanceLocalMatrix),_mesh$1.matrixWorld=_instanceWorldMatrix,_mesh$1.raycast(_e,_instanceIntersects);for(let jt=0,Ht=_instanceIntersects.length;jt<Ht;jt++){const Wt=_instanceIntersects[jt];Wt.instanceId=zt,Wt.object=this,Dt.push(Wt)}_instanceIntersects.length=0}}setColorAt(_e,Dt){this.instanceColor===null&&(this.instanceColor=new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count*3),3)),Dt.toArray(this.instanceColor.array,_e*3)}setMatrixAt(_e,Dt){Dt.toArray(this.instanceMatrix.array,_e*16)}setMorphAt(_e,Dt){const Vt=Dt.morphTargetInfluences,Gt=Vt.length+1;this.morphTexture===null&&(this.morphTexture=new DataTexture(new Float32Array(Gt*this.count),Gt,this.count,RedFormat,FloatType));const zt=this.morphTexture.source.data.data;let jt=0;for(let qt=0;qt<Vt.length;qt++)jt+=Vt[qt];const Ht=this.geometry.morphTargetsRelative?1:1-jt,Wt=Gt*_e;zt[Wt]=Ht,zt.set(Vt,Wt+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function sortOpaque(kt,_e){return kt.z-_e.z}function sortTransparent(kt,_e){return _e.z-kt.z}class MultiDrawRenderList{constructor(){this.index=0,this.pool=[],this.list=[]}push(_e,Dt){const Vt=this.pool,Gt=this.list;this.index>=Vt.length&&Vt.push({start:-1,count:-1,z:-1});const zt=Vt[this.index];Gt.push(zt),this.index++,zt.start=_e.start,zt.count=_e.count,zt.z=Dt}reset(){this.list.length=0,this.index=0}}const ID_ATTR_NAME="batchId",_matrix$1=new Matrix4,_invMatrixWorld=new Matrix4,_identityMatrix$2=new Matrix4,_projScreenMatrix$2=new Matrix4,_frustum=new Frustum,_box$1=new Box3,_sphere$2=new Sphere,_vector$5=new Vector3,_renderList=new MultiDrawRenderList,_mesh=new Mesh,_batchIntersects=[];function copyAttributeData(kt,_e,Dt=0){const Vt=_e.itemSize;if(kt.isInterleavedBufferAttribute||kt.array.constructor!==_e.array.constructor){const Gt=kt.count;for(let zt=0;zt<Gt;zt++)for(let jt=0;jt<Vt;jt++)_e.setComponent(zt+Dt,jt,kt.getComponent(zt,jt))}else _e.array.set(kt.array,Dt*Vt);_e.needsUpdate=!0}class BatchedMesh extends Mesh{get maxGeometryCount(){return this._maxGeometryCount}constructor(_e,Dt,Vt=Dt*2,Gt){super(new BufferGeometry,Gt),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=_e,this._maxVertexCount=Dt,this._maxIndexCount=Vt,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(_e),this._multiDrawStarts=new Int32Array(_e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let _e=Math.sqrt(this._maxGeometryCount*4);_e=Math.ceil(_e/4)*4,_e=Math.max(_e,4);const Dt=new Float32Array(_e*_e*4),Vt=new DataTexture(Dt,_e,_e,RGBAFormat,FloatType);this._matricesTexture=Vt}_initializeGeometry(_e){const Dt=this.geometry,Vt=this._maxVertexCount,Gt=this._maxGeometryCount,zt=this._maxIndexCount;if(this._geometryInitialized===!1){for(const Ht in _e.attributes){const Wt=_e.getAttribute(Ht),{array:qt,itemSize:Xt,normalized:Kt}=Wt,Yt=new qt.constructor(Vt*Xt),Zt=new BufferAttribute(Yt,Xt,Kt);Dt.setAttribute(Ht,Zt)}if(_e.getIndex()!==null){const Ht=Vt>65536?new Uint32Array(zt):new Uint16Array(zt);Dt.setIndex(new BufferAttribute(Ht,1))}const jt=Gt>65536?new Uint32Array(Vt):new Uint16Array(Vt);Dt.setAttribute(ID_ATTR_NAME,new BufferAttribute(jt,1)),this._geometryInitialized=!0}}_validateGeometry(_e){if(_e.getAttribute(ID_ATTR_NAME))throw new Error(`BatchedMesh: Geometry cannot use attribute "${ID_ATTR_NAME}"`);const Dt=this.geometry;if(!!_e.getIndex()!=!!Dt.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const Vt in Dt.attributes){if(Vt===ID_ATTR_NAME)continue;if(!_e.hasAttribute(Vt))throw new Error(`BatchedMesh: Added geometry missing "${Vt}". All geometries must have consistent attributes.`);const Gt=_e.getAttribute(Vt),zt=Dt.getAttribute(Vt);if(Gt.itemSize!==zt.itemSize||Gt.normalized!==zt.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(_e){return this.customSort=_e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Box3);const _e=this._geometryCount,Dt=this.boundingBox,Vt=this._active;Dt.makeEmpty();for(let Gt=0;Gt<_e;Gt++)Vt[Gt]!==!1&&(this.getMatrixAt(Gt,_matrix$1),this.getBoundingBoxAt(Gt,_box$1).applyMatrix4(_matrix$1),Dt.union(_box$1))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Sphere);const _e=this._geometryCount,Dt=this.boundingSphere,Vt=this._active;Dt.makeEmpty();for(let Gt=0;Gt<_e;Gt++)Vt[Gt]!==!1&&(this.getMatrixAt(Gt,_matrix$1),this.getBoundingSphereAt(Gt,_sphere$2).applyMatrix4(_matrix$1),Dt.union(_sphere$2))}addGeometry(_e,Dt=-1,Vt=-1){if(this._initializeGeometry(_e),this._validateGeometry(_e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const Gt={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let zt=null;const jt=this._reservedRanges,Ht=this._drawRanges,Wt=this._bounds;this._geometryCount!==0&&(zt=jt[jt.length-1]),Dt===-1?Gt.vertexCount=_e.getAttribute("position").count:Gt.vertexCount=Dt,zt===null?Gt.vertexStart=0:Gt.vertexStart=zt.vertexStart+zt.vertexCount;const qt=_e.getIndex(),Xt=qt!==null;if(Xt&&(Vt===-1?Gt.indexCount=qt.count:Gt.indexCount=Vt,zt===null?Gt.indexStart=0:Gt.indexStart=zt.indexStart+zt.indexCount),Gt.indexStart!==-1&&Gt.indexStart+Gt.indexCount>this._maxIndexCount||Gt.vertexStart+Gt.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const Kt=this._visibility,Yt=this._active,Zt=this._matricesTexture,Jt=this._matricesTexture.image.data;Kt.push(!0),Yt.push(!0);const nn=this._geometryCount;this._geometryCount++,_identityMatrix$2.toArray(Jt,nn*16),Zt.needsUpdate=!0,jt.push(Gt),Ht.push({start:Xt?Gt.indexStart:Gt.vertexStart,count:-1}),Wt.push({boxInitialized:!1,box:new Box3,sphereInitialized:!1,sphere:new Sphere});const rn=this.geometry.getAttribute(ID_ATTR_NAME);for(let Qt=0;Qt<Gt.vertexCount;Qt++)rn.setX(Gt.vertexStart+Qt,nn);return rn.needsUpdate=!0,this.setGeometryAt(nn,_e),nn}setGeometryAt(_e,Dt){if(_e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(Dt);const Vt=this.geometry,Gt=Vt.getIndex()!==null,zt=Vt.getIndex(),jt=Dt.getIndex(),Ht=this._reservedRanges[_e];if(Gt&&jt.count>Ht.indexCount||Dt.attributes.position.count>Ht.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const Wt=Ht.vertexStart,qt=Ht.vertexCount;for(const Zt in Vt.attributes){if(Zt===ID_ATTR_NAME)continue;const Jt=Dt.getAttribute(Zt),nn=Vt.getAttribute(Zt);copyAttributeData(Jt,nn,Wt);const rn=Jt.itemSize;for(let Qt=Jt.count,en=qt;Qt<en;Qt++){const tn=Wt+Qt;for(let sn=0;sn<rn;sn++)nn.setComponent(tn,sn,0)}nn.needsUpdate=!0,nn.addUpdateRange(Wt*rn,qt*rn)}if(Gt){const Zt=Ht.indexStart;for(let Jt=0;Jt<jt.count;Jt++)zt.setX(Zt+Jt,Wt+jt.getX(Jt));for(let Jt=jt.count,nn=Ht.indexCount;Jt<nn;Jt++)zt.setX(Zt+Jt,Wt);zt.needsUpdate=!0,zt.addUpdateRange(Zt,Ht.indexCount)}const Xt=this._bounds[_e];Dt.boundingBox!==null?(Xt.box.copy(Dt.boundingBox),Xt.boxInitialized=!0):Xt.boxInitialized=!1,Dt.boundingSphere!==null?(Xt.sphere.copy(Dt.boundingSphere),Xt.sphereInitialized=!0):Xt.sphereInitialized=!1;const Kt=this._drawRanges[_e],Yt=Dt.getAttribute("position");return Kt.count=Gt?jt.count:Yt.count,this._visibilityChanged=!0,_e}deleteGeometry(_e){const Dt=this._active;return _e>=Dt.length||Dt[_e]===!1?this:(Dt[_e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(_e,Dt){if(this._active[_e]===!1)return null;const Gt=this._bounds[_e],zt=Gt.box,jt=this.geometry;if(Gt.boxInitialized===!1){zt.makeEmpty();const Ht=jt.index,Wt=jt.attributes.position,qt=this._drawRanges[_e];for(let Xt=qt.start,Kt=qt.start+qt.count;Xt<Kt;Xt++){let Yt=Xt;Ht&&(Yt=Ht.getX(Yt)),zt.expandByPoint(_vector$5.fromBufferAttribute(Wt,Yt))}Gt.boxInitialized=!0}return Dt.copy(zt),Dt}getBoundingSphereAt(_e,Dt){if(this._active[_e]===!1)return null;const Gt=this._bounds[_e],zt=Gt.sphere,jt=this.geometry;if(Gt.sphereInitialized===!1){zt.makeEmpty(),this.getBoundingBoxAt(_e,_box$1),_box$1.getCenter(zt.center);const Ht=jt.index,Wt=jt.attributes.position,qt=this._drawRanges[_e];let Xt=0;for(let Kt=qt.start,Yt=qt.start+qt.count;Kt<Yt;Kt++){let Zt=Kt;Ht&&(Zt=Ht.getX(Zt)),_vector$5.fromBufferAttribute(Wt,Zt),Xt=Math.max(Xt,zt.center.distanceToSquared(_vector$5))}zt.radius=Math.sqrt(Xt),Gt.sphereInitialized=!0}return Dt.copy(zt),Dt}setMatrixAt(_e,Dt){const Vt=this._active,Gt=this._matricesTexture,zt=this._matricesTexture.image.data,jt=this._geometryCount;return _e>=jt||Vt[_e]===!1?this:(Dt.toArray(zt,_e*16),Gt.needsUpdate=!0,this)}getMatrixAt(_e,Dt){const Vt=this._active,Gt=this._matricesTexture.image.data,zt=this._geometryCount;return _e>=zt||Vt[_e]===!1?null:Dt.fromArray(Gt,_e*16)}setVisibleAt(_e,Dt){const Vt=this._visibility,Gt=this._active,zt=this._geometryCount;return _e>=zt||Gt[_e]===!1||Vt[_e]===Dt?this:(Vt[_e]=Dt,this._visibilityChanged=!0,this)}getVisibleAt(_e){const Dt=this._visibility,Vt=this._active,Gt=this._geometryCount;return _e>=Gt||Vt[_e]===!1?!1:Dt[_e]}raycast(_e,Dt){const Vt=this._visibility,Gt=this._active,zt=this._drawRanges,jt=this._geometryCount,Ht=this.matrixWorld,Wt=this.geometry;_mesh.material=this.material,_mesh.geometry.index=Wt.index,_mesh.geometry.attributes=Wt.attributes,_mesh.geometry.boundingBox===null&&(_mesh.geometry.boundingBox=new Box3),_mesh.geometry.boundingSphere===null&&(_mesh.geometry.boundingSphere=new Sphere);for(let qt=0;qt<jt;qt++){if(!Vt[qt]||!Gt[qt])continue;const Xt=zt[qt];_mesh.geometry.setDrawRange(Xt.start,Xt.count),this.getMatrixAt(qt,_mesh.matrixWorld).premultiply(Ht),this.getBoundingBoxAt(qt,_mesh.geometry.boundingBox),this.getBoundingSphereAt(qt,_mesh.geometry.boundingSphere),_mesh.raycast(_e,_batchIntersects);for(let Kt=0,Yt=_batchIntersects.length;Kt<Yt;Kt++){const Zt=_batchIntersects[Kt];Zt.object=this,Zt.batchId=qt,Dt.push(Zt)}_batchIntersects.length=0}_mesh.material=null,_mesh.geometry.index=null,_mesh.geometry.attributes={},_mesh.geometry.setDrawRange(0,1/0)}copy(_e){return super.copy(_e),this.geometry=_e.geometry.clone(),this.perObjectFrustumCulled=_e.perObjectFrustumCulled,this.sortObjects=_e.sortObjects,this.boundingBox=_e.boundingBox!==null?_e.boundingBox.clone():null,this.boundingSphere=_e.boundingSphere!==null?_e.boundingSphere.clone():null,this._drawRanges=_e._drawRanges.map(Dt=>({...Dt})),this._reservedRanges=_e._reservedRanges.map(Dt=>({...Dt})),this._visibility=_e._visibility.slice(),this._active=_e._active.slice(),this._bounds=_e._bounds.map(Dt=>({boxInitialized:Dt.boxInitialized,box:Dt.box.clone(),sphereInitialized:Dt.sphereInitialized,sphere:Dt.sphere.clone()})),this._maxGeometryCount=_e._maxGeometryCount,this._maxVertexCount=_e._maxVertexCount,this._maxIndexCount=_e._maxIndexCount,this._geometryInitialized=_e._geometryInitialized,this._geometryCount=_e._geometryCount,this._multiDrawCounts=_e._multiDrawCounts.slice(),this._multiDrawStarts=_e._multiDrawStarts.slice(),this._matricesTexture=_e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(_e,Dt,Vt,Gt,zt){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const jt=Gt.getIndex(),Ht=jt===null?1:jt.array.BYTES_PER_ELEMENT,Wt=this._active,qt=this._visibility,Xt=this._multiDrawStarts,Kt=this._multiDrawCounts,Yt=this._drawRanges,Zt=this.perObjectFrustumCulled;Zt&&(_projScreenMatrix$2.multiplyMatrices(Vt.projectionMatrix,Vt.matrixWorldInverse).multiply(this.matrixWorld),_frustum.setFromProjectionMatrix(_projScreenMatrix$2,_e.coordinateSystem));let Jt=0;if(this.sortObjects){_invMatrixWorld.copy(this.matrixWorld).invert(),_vector$5.setFromMatrixPosition(Vt.matrixWorld).applyMatrix4(_invMatrixWorld);for(let Qt=0,en=qt.length;Qt<en;Qt++)if(qt[Qt]&&Wt[Qt]){this.getMatrixAt(Qt,_matrix$1),this.getBoundingSphereAt(Qt,_sphere$2).applyMatrix4(_matrix$1);let tn=!1;if(Zt&&(tn=!_frustum.intersectsSphere(_sphere$2)),!tn){const sn=_vector$5.distanceTo(_sphere$2.center);_renderList.push(Yt[Qt],sn)}}const nn=_renderList.list,rn=this.customSort;rn===null?nn.sort(zt.transparent?sortTransparent:sortOpaque):rn.call(this,nn,Vt);for(let Qt=0,en=nn.length;Qt<en;Qt++){const tn=nn[Qt];Xt[Jt]=tn.start*Ht,Kt[Jt]=tn.count,Jt++}_renderList.reset()}else for(let nn=0,rn=qt.length;nn<rn;nn++)if(qt[nn]&&Wt[nn]){let Qt=!1;if(Zt&&(this.getMatrixAt(nn,_matrix$1),this.getBoundingSphereAt(nn,_sphere$2).applyMatrix4(_matrix$1),Qt=!_frustum.intersectsSphere(_sphere$2)),!Qt){const en=Yt[nn];Xt[Jt]=en.start*Ht,Kt[Jt]=en.count,Jt++}}this._multiDrawCount=Jt,this._visibilityChanged=!1}onBeforeShadow(_e,Dt,Vt,Gt,zt,jt){this.onBeforeRender(_e,null,Gt,zt,jt)}}class LineBasicMaterial extends Material{constructor(_e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color$1(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.map=_e.map,this.linewidth=_e.linewidth,this.linecap=_e.linecap,this.linejoin=_e.linejoin,this.fog=_e.fog,this}}const _start$1=new Vector3,_end$1=new Vector3,_inverseMatrix$1=new Matrix4,_ray$1=new Ray,_sphere$1=new Sphere;class Line extends Object3D{constructor(_e=new BufferGeometry,Dt=new LineBasicMaterial){super(),this.isLine=!0,this.type="Line",this.geometry=_e,this.material=Dt,this.updateMorphTargets()}copy(_e,Dt){return super.copy(_e,Dt),this.material=Array.isArray(_e.material)?_e.material.slice():_e.material,this.geometry=_e.geometry,this}computeLineDistances(){const _e=this.geometry;if(_e.index===null){const Dt=_e.attributes.position,Vt=[0];for(let Gt=1,zt=Dt.count;Gt<zt;Gt++)_start$1.fromBufferAttribute(Dt,Gt-1),_end$1.fromBufferAttribute(Dt,Gt),Vt[Gt]=Vt[Gt-1],Vt[Gt]+=_start$1.distanceTo(_end$1);_e.setAttribute("lineDistance",new Float32BufferAttribute(Vt,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(_e,Dt){const Vt=this.geometry,Gt=this.matrixWorld,zt=_e.params.Line.threshold,jt=Vt.drawRange;if(Vt.boundingSphere===null&&Vt.computeBoundingSphere(),_sphere$1.copy(Vt.boundingSphere),_sphere$1.applyMatrix4(Gt),_sphere$1.radius+=zt,_e.ray.intersectsSphere(_sphere$1)===!1)return;_inverseMatrix$1.copy(Gt).invert(),_ray$1.copy(_e.ray).applyMatrix4(_inverseMatrix$1);const Ht=zt/((this.scale.x+this.scale.y+this.scale.z)/3),Wt=Ht*Ht,qt=new Vector3,Xt=new Vector3,Kt=new Vector3,Yt=new Vector3,Zt=this.isLineSegments?2:1,Jt=Vt.index,rn=Vt.attributes.position;if(Jt!==null){const Qt=Math.max(0,jt.start),en=Math.min(Jt.count,jt.start+jt.count);for(let tn=Qt,sn=en-1;tn<sn;tn+=Zt){const cn=Jt.getX(tn),un=Jt.getX(tn+1);if(qt.fromBufferAttribute(rn,cn),Xt.fromBufferAttribute(rn,un),_ray$1.distanceSqToSegment(qt,Xt,Yt,Kt)>Wt)continue;Yt.applyMatrix4(this.matrixWorld);const fn=_e.ray.origin.distanceTo(Yt);fn<_e.near||fn>_e.far||Dt.push({distance:fn,point:Kt.clone().applyMatrix4(this.matrixWorld),index:tn,face:null,faceIndex:null,object:this})}}else{const Qt=Math.max(0,jt.start),en=Math.min(rn.count,jt.start+jt.count);for(let tn=Qt,sn=en-1;tn<sn;tn+=Zt){if(qt.fromBufferAttribute(rn,tn),Xt.fromBufferAttribute(rn,tn+1),_ray$1.distanceSqToSegment(qt,Xt,Yt,Kt)>Wt)continue;Yt.applyMatrix4(this.matrixWorld);const un=_e.ray.origin.distanceTo(Yt);un<_e.near||un>_e.far||Dt.push({distance:un,point:Kt.clone().applyMatrix4(this.matrixWorld),index:tn,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const Dt=this.geometry.morphAttributes,Vt=Object.keys(Dt);if(Vt.length>0){const Gt=Dt[Vt[0]];if(Gt!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let zt=0,jt=Gt.length;zt<jt;zt++){const Ht=Gt[zt].name||String(zt);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Ht]=zt}}}}}const _start=new Vector3,_end=new Vector3;class LineSegments extends Line{constructor(_e,Dt){super(_e,Dt),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const _e=this.geometry;if(_e.index===null){const Dt=_e.attributes.position,Vt=[];for(let Gt=0,zt=Dt.count;Gt<zt;Gt+=2)_start.fromBufferAttribute(Dt,Gt),_end.fromBufferAttribute(Dt,Gt+1),Vt[Gt]=Gt===0?0:Vt[Gt-1],Vt[Gt+1]=Vt[Gt]+_start.distanceTo(_end);_e.setAttribute("lineDistance",new Float32BufferAttribute(Vt,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class LineLoop extends Line{constructor(_e,Dt){super(_e,Dt),this.isLineLoop=!0,this.type="LineLoop"}}class PointsMaterial extends Material{constructor(_e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color$1(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.map=_e.map,this.alphaMap=_e.alphaMap,this.size=_e.size,this.sizeAttenuation=_e.sizeAttenuation,this.fog=_e.fog,this}}const _inverseMatrix=new Matrix4,_ray=new Ray,_sphere$7=new Sphere,_position$2=new Vector3;class Points extends Object3D{constructor(_e=new BufferGeometry,Dt=new PointsMaterial){super(),this.isPoints=!0,this.type="Points",this.geometry=_e,this.material=Dt,this.updateMorphTargets()}copy(_e,Dt){return super.copy(_e,Dt),this.material=Array.isArray(_e.material)?_e.material.slice():_e.material,this.geometry=_e.geometry,this}raycast(_e,Dt){const Vt=this.geometry,Gt=this.matrixWorld,zt=_e.params.Points.threshold,jt=Vt.drawRange;if(Vt.boundingSphere===null&&Vt.computeBoundingSphere(),_sphere$7.copy(Vt.boundingSphere),_sphere$7.applyMatrix4(Gt),_sphere$7.radius+=zt,_e.ray.intersectsSphere(_sphere$7)===!1)return;_inverseMatrix.copy(Gt).invert(),_ray.copy(_e.ray).applyMatrix4(_inverseMatrix);const Ht=zt/((this.scale.x+this.scale.y+this.scale.z)/3),Wt=Ht*Ht,qt=Vt.index,Kt=Vt.attributes.position;if(qt!==null){const Yt=Math.max(0,jt.start),Zt=Math.min(qt.count,jt.start+jt.count);for(let Jt=Yt,nn=Zt;Jt<nn;Jt++){const rn=qt.getX(Jt);_position$2.fromBufferAttribute(Kt,rn),testPoint(_position$2,rn,Wt,Gt,_e,Dt,this)}}else{const Yt=Math.max(0,jt.start),Zt=Math.min(Kt.count,jt.start+jt.count);for(let Jt=Yt,nn=Zt;Jt<nn;Jt++)_position$2.fromBufferAttribute(Kt,Jt),testPoint(_position$2,Jt,Wt,Gt,_e,Dt,this)}}updateMorphTargets(){const Dt=this.geometry.morphAttributes,Vt=Object.keys(Dt);if(Vt.length>0){const Gt=Dt[Vt[0]];if(Gt!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let zt=0,jt=Gt.length;zt<jt;zt++){const Ht=Gt[zt].name||String(zt);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Ht]=zt}}}}}function testPoint(kt,_e,Dt,Vt,Gt,zt,jt){const Ht=_ray.distanceSqToPoint(kt);if(Ht<Dt){const Wt=new Vector3;_ray.closestPointToPoint(kt,Wt),Wt.applyMatrix4(Vt);const qt=Gt.ray.origin.distanceTo(Wt);if(qt<Gt.near||qt>Gt.far)return;zt.push({distance:qt,distanceToRay:Math.sqrt(Ht),point:Wt,index:_e,face:null,object:jt})}}class VideoTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt){super(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt),this.isVideoTexture=!0,this.minFilter=jt!==void 0?jt:LinearFilter,this.magFilter=zt!==void 0?zt:LinearFilter,this.generateMipmaps=!1;const Xt=this;function Kt(){Xt.needsUpdate=!0,_e.requestVideoFrameCallback(Kt)}"requestVideoFrameCallback"in _e&&_e.requestVideoFrameCallback(Kt)}clone(){return new this.constructor(this.image).copy(this)}update(){const _e=this.image;"requestVideoFrameCallback"in _e===!1&&_e.readyState>=_e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class FramebufferTexture extends Texture{constructor(_e,Dt){super({width:_e,height:Dt}),this.isFramebufferTexture=!0,this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.generateMipmaps=!1,this.needsUpdate=!0}}class CompressedTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt,Xt,Kt,Yt){super(null,jt,Ht,Wt,qt,Xt,Gt,zt,Kt,Yt),this.isCompressedTexture=!0,this.image={width:Dt,height:Vt},this.mipmaps=_e,this.flipY=!1,this.generateMipmaps=!1}}class CompressedArrayTexture extends CompressedTexture{constructor(_e,Dt,Vt,Gt,zt,jt){super(_e,Dt,Vt,zt,jt),this.isCompressedArrayTexture=!0,this.image.depth=Gt,this.wrapR=ClampToEdgeWrapping}}class CompressedCubeTexture extends CompressedTexture{constructor(_e,Dt,Vt){super(void 0,_e[0].width,_e[0].height,Dt,Vt,CubeReflectionMapping),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=_e}}class CanvasTexture extends Texture{constructor(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt){super(_e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Curve{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(_e,Dt){const Vt=this.getUtoTmapping(_e);return this.getPoint(Vt,Dt)}getPoints(_e=5){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPoint(Vt/_e));return Dt}getSpacedPoints(_e=5){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPointAt(Vt/_e));return Dt}getLength(){const _e=this.getLengths();return _e[_e.length-1]}getLengths(_e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===_e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const Dt=[];let Vt,Gt=this.getPoint(0),zt=0;Dt.push(0);for(let jt=1;jt<=_e;jt++)Vt=this.getPoint(jt/_e),zt+=Vt.distanceTo(Gt),Dt.push(zt),Gt=Vt;return this.cacheArcLengths=Dt,Dt}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(_e,Dt){const Vt=this.getLengths();let Gt=0;const zt=Vt.length;let jt;Dt?jt=Dt:jt=_e*Vt[zt-1];let Ht=0,Wt=zt-1,qt;for(;Ht<=Wt;)if(Gt=Math.floor(Ht+(Wt-Ht)/2),qt=Vt[Gt]-jt,qt<0)Ht=Gt+1;else if(qt>0)Wt=Gt-1;else{Wt=Gt;break}if(Gt=Wt,Vt[Gt]===jt)return Gt/(zt-1);const Xt=Vt[Gt],Yt=Vt[Gt+1]-Xt,Zt=(jt-Xt)/Yt;return(Gt+Zt)/(zt-1)}getTangent(_e,Dt){let Gt=_e-1e-4,zt=_e+1e-4;Gt<0&&(Gt=0),zt>1&&(zt=1);const jt=this.getPoint(Gt),Ht=this.getPoint(zt),Wt=Dt||(jt.isVector2?new Vector2:new Vector3);return Wt.copy(Ht).sub(jt).normalize(),Wt}getTangentAt(_e,Dt){const Vt=this.getUtoTmapping(_e);return this.getTangent(Vt,Dt)}computeFrenetFrames(_e,Dt){const Vt=new Vector3,Gt=[],zt=[],jt=[],Ht=new Vector3,Wt=new Matrix4;for(let Zt=0;Zt<=_e;Zt++){const Jt=Zt/_e;Gt[Zt]=this.getTangentAt(Jt,new Vector3)}zt[0]=new Vector3,jt[0]=new Vector3;let qt=Number.MAX_VALUE;const Xt=Math.abs(Gt[0].x),Kt=Math.abs(Gt[0].y),Yt=Math.abs(Gt[0].z);Xt<=qt&&(qt=Xt,Vt.set(1,0,0)),Kt<=qt&&(qt=Kt,Vt.set(0,1,0)),Yt<=qt&&Vt.set(0,0,1),Ht.crossVectors(Gt[0],Vt).normalize(),zt[0].crossVectors(Gt[0],Ht),jt[0].crossVectors(Gt[0],zt[0]);for(let Zt=1;Zt<=_e;Zt++){if(zt[Zt]=zt[Zt-1].clone(),jt[Zt]=jt[Zt-1].clone(),Ht.crossVectors(Gt[Zt-1],Gt[Zt]),Ht.length()>Number.EPSILON){Ht.normalize();const Jt=Math.acos(clamp$2(Gt[Zt-1].dot(Gt[Zt]),-1,1));zt[Zt].applyMatrix4(Wt.makeRotationAxis(Ht,Jt))}jt[Zt].crossVectors(Gt[Zt],zt[Zt])}if(Dt===!0){let Zt=Math.acos(clamp$2(zt[0].dot(zt[_e]),-1,1));Zt/=_e,Gt[0].dot(Ht.crossVectors(zt[0],zt[_e]))>0&&(Zt=-Zt);for(let Jt=1;Jt<=_e;Jt++)zt[Jt].applyMatrix4(Wt.makeRotationAxis(Gt[Jt],Zt*Jt)),jt[Jt].crossVectors(Gt[Jt],zt[Jt])}return{tangents:Gt,normals:zt,binormals:jt}}clone(){return new this.constructor().copy(this)}copy(_e){return this.arcLengthDivisions=_e.arcLengthDivisions,this}toJSON(){const _e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return _e.arcLengthDivisions=this.arcLengthDivisions,_e.type=this.type,_e}fromJSON(_e){return this.arcLengthDivisions=_e.arcLengthDivisions,this}}class EllipseCurve extends Curve{constructor(_e=0,Dt=0,Vt=1,Gt=1,zt=0,jt=Math.PI*2,Ht=!1,Wt=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=_e,this.aY=Dt,this.xRadius=Vt,this.yRadius=Gt,this.aStartAngle=zt,this.aEndAngle=jt,this.aClockwise=Ht,this.aRotation=Wt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=Math.PI*2;let zt=this.aEndAngle-this.aStartAngle;const jt=Math.abs(zt)<Number.EPSILON;for(;zt<0;)zt+=Gt;for(;zt>Gt;)zt-=Gt;zt<Number.EPSILON&&(jt?zt=0:zt=Gt),this.aClockwise===!0&&!jt&&(zt===Gt?zt=-Gt:zt=zt-Gt);const Ht=this.aStartAngle+_e*zt;let Wt=this.aX+this.xRadius*Math.cos(Ht),qt=this.aY+this.yRadius*Math.sin(Ht);if(this.aRotation!==0){const Xt=Math.cos(this.aRotation),Kt=Math.sin(this.aRotation),Yt=Wt-this.aX,Zt=qt-this.aY;Wt=Yt*Xt-Zt*Kt+this.aX,qt=Yt*Kt+Zt*Xt+this.aY}return Vt.set(Wt,qt)}copy(_e){return super.copy(_e),this.aX=_e.aX,this.aY=_e.aY,this.xRadius=_e.xRadius,this.yRadius=_e.yRadius,this.aStartAngle=_e.aStartAngle,this.aEndAngle=_e.aEndAngle,this.aClockwise=_e.aClockwise,this.aRotation=_e.aRotation,this}toJSON(){const _e=super.toJSON();return _e.aX=this.aX,_e.aY=this.aY,_e.xRadius=this.xRadius,_e.yRadius=this.yRadius,_e.aStartAngle=this.aStartAngle,_e.aEndAngle=this.aEndAngle,_e.aClockwise=this.aClockwise,_e.aRotation=this.aRotation,_e}fromJSON(_e){return super.fromJSON(_e),this.aX=_e.aX,this.aY=_e.aY,this.xRadius=_e.xRadius,this.yRadius=_e.yRadius,this.aStartAngle=_e.aStartAngle,this.aEndAngle=_e.aEndAngle,this.aClockwise=_e.aClockwise,this.aRotation=_e.aRotation,this}}class ArcCurve extends EllipseCurve{constructor(_e,Dt,Vt,Gt,zt,jt){super(_e,Dt,Vt,Vt,Gt,zt,jt),this.isArcCurve=!0,this.type="ArcCurve"}}function CubicPoly(){let kt=0,_e=0,Dt=0,Vt=0;function Gt(zt,jt,Ht,Wt){kt=zt,_e=Ht,Dt=-3*zt+3*jt-2*Ht-Wt,Vt=2*zt-2*jt+Ht+Wt}return{initCatmullRom:function(zt,jt,Ht,Wt,qt){Gt(jt,Ht,qt*(Ht-zt),qt*(Wt-jt))},initNonuniformCatmullRom:function(zt,jt,Ht,Wt,qt,Xt,Kt){let Yt=(jt-zt)/qt-(Ht-zt)/(qt+Xt)+(Ht-jt)/Xt,Zt=(Ht-jt)/Xt-(Wt-jt)/(Xt+Kt)+(Wt-Ht)/Kt;Yt*=Xt,Zt*=Xt,Gt(jt,Ht,Yt,Zt)},calc:function(zt){const jt=zt*zt,Ht=jt*zt;return kt+_e*zt+Dt*jt+Vt*Ht}}}const tmp=new Vector3,px=new CubicPoly,py=new CubicPoly,pz=new CubicPoly;class CatmullRomCurve3 extends Curve{constructor(_e=[],Dt=!1,Vt="centripetal",Gt=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=_e,this.closed=Dt,this.curveType=Vt,this.tension=Gt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.points,zt=Gt.length,jt=(zt-(this.closed?0:1))*_e;let Ht=Math.floor(jt),Wt=jt-Ht;this.closed?Ht+=Ht>0?0:(Math.floor(Math.abs(Ht)/zt)+1)*zt:Wt===0&&Ht===zt-1&&(Ht=zt-2,Wt=1);let qt,Xt;this.closed||Ht>0?qt=Gt[(Ht-1)%zt]:(tmp.subVectors(Gt[0],Gt[1]).add(Gt[0]),qt=tmp);const Kt=Gt[Ht%zt],Yt=Gt[(Ht+1)%zt];if(this.closed||Ht+2<zt?Xt=Gt[(Ht+2)%zt]:(tmp.subVectors(Gt[zt-1],Gt[zt-2]).add(Gt[zt-1]),Xt=tmp),this.curveType==="centripetal"||this.curveType==="chordal"){const Zt=this.curveType==="chordal"?.5:.25;let Jt=Math.pow(qt.distanceToSquared(Kt),Zt),nn=Math.pow(Kt.distanceToSquared(Yt),Zt),rn=Math.pow(Yt.distanceToSquared(Xt),Zt);nn<1e-4&&(nn=1),Jt<1e-4&&(Jt=nn),rn<1e-4&&(rn=nn),px.initNonuniformCatmullRom(qt.x,Kt.x,Yt.x,Xt.x,Jt,nn,rn),py.initNonuniformCatmullRom(qt.y,Kt.y,Yt.y,Xt.y,Jt,nn,rn),pz.initNonuniformCatmullRom(qt.z,Kt.z,Yt.z,Xt.z,Jt,nn,rn)}else this.curveType==="catmullrom"&&(px.initCatmullRom(qt.x,Kt.x,Yt.x,Xt.x,this.tension),py.initCatmullRom(qt.y,Kt.y,Yt.y,Xt.y,this.tension),pz.initCatmullRom(qt.z,Kt.z,Yt.z,Xt.z,this.tension));return Vt.set(px.calc(Wt),py.calc(Wt),pz.calc(Wt)),Vt}copy(_e){super.copy(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(Gt.clone())}return this.closed=_e.closed,this.curveType=_e.curveType,this.tension=_e.tension,this}toJSON(){const _e=super.toJSON();_e.points=[];for(let Dt=0,Vt=this.points.length;Dt<Vt;Dt++){const Gt=this.points[Dt];_e.points.push(Gt.toArray())}return _e.closed=this.closed,_e.curveType=this.curveType,_e.tension=this.tension,_e}fromJSON(_e){super.fromJSON(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(new Vector3().fromArray(Gt))}return this.closed=_e.closed,this.curveType=_e.curveType,this.tension=_e.tension,this}}function CatmullRom(kt,_e,Dt,Vt,Gt){const zt=(Vt-_e)*.5,jt=(Gt-Dt)*.5,Ht=kt*kt,Wt=kt*Ht;return(2*Dt-2*Vt+zt+jt)*Wt+(-3*Dt+3*Vt-2*zt-jt)*Ht+zt*kt+Dt}function QuadraticBezierP0(kt,_e){const Dt=1-kt;return Dt*Dt*_e}function QuadraticBezierP1(kt,_e){return 2*(1-kt)*kt*_e}function QuadraticBezierP2(kt,_e){return kt*kt*_e}function QuadraticBezier(kt,_e,Dt,Vt){return QuadraticBezierP0(kt,_e)+QuadraticBezierP1(kt,Dt)+QuadraticBezierP2(kt,Vt)}function CubicBezierP0(kt,_e){const Dt=1-kt;return Dt*Dt*Dt*_e}function CubicBezierP1(kt,_e){const Dt=1-kt;return 3*Dt*Dt*kt*_e}function CubicBezierP2(kt,_e){return 3*(1-kt)*kt*kt*_e}function CubicBezierP3(kt,_e){return kt*kt*kt*_e}function CubicBezier(kt,_e,Dt,Vt,Gt){return CubicBezierP0(kt,_e)+CubicBezierP1(kt,Dt)+CubicBezierP2(kt,Vt)+CubicBezierP3(kt,Gt)}class CubicBezierCurve extends Curve{constructor(_e=new Vector2,Dt=new Vector2,Vt=new Vector2,Gt=new Vector2){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=_e,this.v1=Dt,this.v2=Vt,this.v3=Gt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2,Ht=this.v3;return Vt.set(CubicBezier(_e,Gt.x,zt.x,jt.x,Ht.x),CubicBezier(_e,Gt.y,zt.y,jt.y,Ht.y)),Vt}copy(_e){return super.copy(_e),this.v0.copy(_e.v0),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this.v3.copy(_e.v3),this}toJSON(){const _e=super.toJSON();return _e.v0=this.v0.toArray(),_e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e.v3=this.v3.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v0.fromArray(_e.v0),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this.v3.fromArray(_e.v3),this}}class CubicBezierCurve3 extends Curve{constructor(_e=new Vector3,Dt=new Vector3,Vt=new Vector3,Gt=new Vector3){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=_e,this.v1=Dt,this.v2=Vt,this.v3=Gt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2,Ht=this.v3;return Vt.set(CubicBezier(_e,Gt.x,zt.x,jt.x,Ht.x),CubicBezier(_e,Gt.y,zt.y,jt.y,Ht.y),CubicBezier(_e,Gt.z,zt.z,jt.z,Ht.z)),Vt}copy(_e){return super.copy(_e),this.v0.copy(_e.v0),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this.v3.copy(_e.v3),this}toJSON(){const _e=super.toJSON();return _e.v0=this.v0.toArray(),_e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e.v3=this.v3.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v0.fromArray(_e.v0),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this.v3.fromArray(_e.v3),this}}class LineCurve extends Curve{constructor(_e=new Vector2,Dt=new Vector2){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=_e,this.v2=Dt}getPoint(_e,Dt=new Vector2){const Vt=Dt;return _e===1?Vt.copy(this.v2):(Vt.copy(this.v2).sub(this.v1),Vt.multiplyScalar(_e).add(this.v1)),Vt}getPointAt(_e,Dt){return this.getPoint(_e,Dt)}getTangent(_e,Dt=new Vector2){return Dt.subVectors(this.v2,this.v1).normalize()}getTangentAt(_e,Dt){return this.getTangent(_e,Dt)}copy(_e){return super.copy(_e),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this}toJSON(){const _e=super.toJSON();return _e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this}}class LineCurve3 extends Curve{constructor(_e=new Vector3,Dt=new Vector3){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=_e,this.v2=Dt}getPoint(_e,Dt=new Vector3){const Vt=Dt;return _e===1?Vt.copy(this.v2):(Vt.copy(this.v2).sub(this.v1),Vt.multiplyScalar(_e).add(this.v1)),Vt}getPointAt(_e,Dt){return this.getPoint(_e,Dt)}getTangent(_e,Dt=new Vector3){return Dt.subVectors(this.v2,this.v1).normalize()}getTangentAt(_e,Dt){return this.getTangent(_e,Dt)}copy(_e){return super.copy(_e),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this}toJSON(){const _e=super.toJSON();return _e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this}}class QuadraticBezierCurve extends Curve{constructor(_e=new Vector2,Dt=new Vector2,Vt=new Vector2){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=_e,this.v1=Dt,this.v2=Vt}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2;return Vt.set(QuadraticBezier(_e,Gt.x,zt.x,jt.x),QuadraticBezier(_e,Gt.y,zt.y,jt.y)),Vt}copy(_e){return super.copy(_e),this.v0.copy(_e.v0),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this}toJSON(){const _e=super.toJSON();return _e.v0=this.v0.toArray(),_e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v0.fromArray(_e.v0),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this}}class QuadraticBezierCurve3 extends Curve{constructor(_e=new Vector3,Dt=new Vector3,Vt=new Vector3){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=_e,this.v1=Dt,this.v2=Vt}getPoint(_e,Dt=new Vector3){const Vt=Dt,Gt=this.v0,zt=this.v1,jt=this.v2;return Vt.set(QuadraticBezier(_e,Gt.x,zt.x,jt.x),QuadraticBezier(_e,Gt.y,zt.y,jt.y),QuadraticBezier(_e,Gt.z,zt.z,jt.z)),Vt}copy(_e){return super.copy(_e),this.v0.copy(_e.v0),this.v1.copy(_e.v1),this.v2.copy(_e.v2),this}toJSON(){const _e=super.toJSON();return _e.v0=this.v0.toArray(),_e.v1=this.v1.toArray(),_e.v2=this.v2.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.v0.fromArray(_e.v0),this.v1.fromArray(_e.v1),this.v2.fromArray(_e.v2),this}}class SplineCurve extends Curve{constructor(_e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=_e}getPoint(_e,Dt=new Vector2){const Vt=Dt,Gt=this.points,zt=(Gt.length-1)*_e,jt=Math.floor(zt),Ht=zt-jt,Wt=Gt[jt===0?jt:jt-1],qt=Gt[jt],Xt=Gt[jt>Gt.length-2?Gt.length-1:jt+1],Kt=Gt[jt>Gt.length-3?Gt.length-1:jt+2];return Vt.set(CatmullRom(Ht,Wt.x,qt.x,Xt.x,Kt.x),CatmullRom(Ht,Wt.y,qt.y,Xt.y,Kt.y)),Vt}copy(_e){super.copy(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(Gt.clone())}return this}toJSON(){const _e=super.toJSON();_e.points=[];for(let Dt=0,Vt=this.points.length;Dt<Vt;Dt++){const Gt=this.points[Dt];_e.points.push(Gt.toArray())}return _e}fromJSON(_e){super.fromJSON(_e),this.points=[];for(let Dt=0,Vt=_e.points.length;Dt<Vt;Dt++){const Gt=_e.points[Dt];this.points.push(new Vector2().fromArray(Gt))}return this}}var Curves=Object.freeze({__proto__:null,ArcCurve,CatmullRomCurve3,CubicBezierCurve,CubicBezierCurve3,EllipseCurve,LineCurve,LineCurve3,QuadraticBezierCurve,QuadraticBezierCurve3,SplineCurve});class CurvePath extends Curve{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(_e){this.curves.push(_e)}closePath(){const _e=this.curves[0].getPoint(0),Dt=this.curves[this.curves.length-1].getPoint(1);if(!_e.equals(Dt)){const Vt=_e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Curves[Vt](Dt,_e))}return this}getPoint(_e,Dt){const Vt=_e*this.getLength(),Gt=this.getCurveLengths();let zt=0;for(;zt<Gt.length;){if(Gt[zt]>=Vt){const jt=Gt[zt]-Vt,Ht=this.curves[zt],Wt=Ht.getLength(),qt=Wt===0?0:1-jt/Wt;return Ht.getPointAt(qt,Dt)}zt++}return null}getLength(){const _e=this.getCurveLengths();return _e[_e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const _e=[];let Dt=0;for(let Vt=0,Gt=this.curves.length;Vt<Gt;Vt++)Dt+=this.curves[Vt].getLength(),_e.push(Dt);return this.cacheLengths=_e,_e}getSpacedPoints(_e=40){const Dt=[];for(let Vt=0;Vt<=_e;Vt++)Dt.push(this.getPoint(Vt/_e));return this.autoClose&&Dt.push(Dt[0]),Dt}getPoints(_e=12){const Dt=[];let Vt;for(let Gt=0,zt=this.curves;Gt<zt.length;Gt++){const jt=zt[Gt],Ht=jt.isEllipseCurve?_e*2:jt.isLineCurve||jt.isLineCurve3?1:jt.isSplineCurve?_e*jt.points.length:_e,Wt=jt.getPoints(Ht);for(let qt=0;qt<Wt.length;qt++){const Xt=Wt[qt];Vt&&Vt.equals(Xt)||(Dt.push(Xt),Vt=Xt)}}return this.autoClose&&Dt.length>1&&!Dt[Dt.length-1].equals(Dt[0])&&Dt.push(Dt[0]),Dt}copy(_e){super.copy(_e),this.curves=[];for(let Dt=0,Vt=_e.curves.length;Dt<Vt;Dt++){const Gt=_e.curves[Dt];this.curves.push(Gt.clone())}return this.autoClose=_e.autoClose,this}toJSON(){const _e=super.toJSON();_e.autoClose=this.autoClose,_e.curves=[];for(let Dt=0,Vt=this.curves.length;Dt<Vt;Dt++){const Gt=this.curves[Dt];_e.curves.push(Gt.toJSON())}return _e}fromJSON(_e){super.fromJSON(_e),this.autoClose=_e.autoClose,this.curves=[];for(let Dt=0,Vt=_e.curves.length;Dt<Vt;Dt++){const Gt=_e.curves[Dt];this.curves.push(new Curves[Gt.type]().fromJSON(Gt))}return this}}class Path extends CurvePath{constructor(_e){super(),this.type="Path",this.currentPoint=new Vector2,_e&&this.setFromPoints(_e)}setFromPoints(_e){this.moveTo(_e[0].x,_e[0].y);for(let Dt=1,Vt=_e.length;Dt<Vt;Dt++)this.lineTo(_e[Dt].x,_e[Dt].y);return this}moveTo(_e,Dt){return this.currentPoint.set(_e,Dt),this}lineTo(_e,Dt){const Vt=new LineCurve(this.currentPoint.clone(),new Vector2(_e,Dt));return this.curves.push(Vt),this.currentPoint.set(_e,Dt),this}quadraticCurveTo(_e,Dt,Vt,Gt){const zt=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(_e,Dt),new Vector2(Vt,Gt));return this.curves.push(zt),this.currentPoint.set(Vt,Gt),this}bezierCurveTo(_e,Dt,Vt,Gt,zt,jt){const Ht=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(_e,Dt),new Vector2(Vt,Gt),new Vector2(zt,jt));return this.curves.push(Ht),this.currentPoint.set(zt,jt),this}splineThru(_e){const Dt=[this.currentPoint.clone()].concat(_e),Vt=new SplineCurve(Dt);return this.curves.push(Vt),this.currentPoint.copy(_e[_e.length-1]),this}arc(_e,Dt,Vt,Gt,zt,jt){const Ht=this.currentPoint.x,Wt=this.currentPoint.y;return this.absarc(_e+Ht,Dt+Wt,Vt,Gt,zt,jt),this}absarc(_e,Dt,Vt,Gt,zt,jt){return this.absellipse(_e,Dt,Vt,Vt,Gt,zt,jt),this}ellipse(_e,Dt,Vt,Gt,zt,jt,Ht,Wt){const qt=this.currentPoint.x,Xt=this.currentPoint.y;return this.absellipse(_e+qt,Dt+Xt,Vt,Gt,zt,jt,Ht,Wt),this}absellipse(_e,Dt,Vt,Gt,zt,jt,Ht,Wt){const qt=new EllipseCurve(_e,Dt,Vt,Gt,zt,jt,Ht,Wt);if(this.curves.length>0){const Kt=qt.getPoint(0);Kt.equals(this.currentPoint)||this.lineTo(Kt.x,Kt.y)}this.curves.push(qt);const Xt=qt.getPoint(1);return this.currentPoint.copy(Xt),this}copy(_e){return super.copy(_e),this.currentPoint.copy(_e.currentPoint),this}toJSON(){const _e=super.toJSON();return _e.currentPoint=this.currentPoint.toArray(),_e}fromJSON(_e){return super.fromJSON(_e),this.currentPoint.fromArray(_e.currentPoint),this}}class LatheGeometry extends BufferGeometry{constructor(_e=[new Vector2(0,-.5),new Vector2(.5,0),new Vector2(0,.5)],Dt=12,Vt=0,Gt=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:_e,segments:Dt,phiStart:Vt,phiLength:Gt},Dt=Math.floor(Dt),Gt=clamp$2(Gt,0,Math.PI*2);const zt=[],jt=[],Ht=[],Wt=[],qt=[],Xt=1/Dt,Kt=new Vector3,Yt=new Vector2,Zt=new Vector3,Jt=new Vector3,nn=new Vector3;let rn=0,Qt=0;for(let en=0;en<=_e.length-1;en++)switch(en){case 0:rn=_e[en+1].x-_e[en].x,Qt=_e[en+1].y-_e[en].y,Zt.x=Qt*1,Zt.y=-rn,Zt.z=Qt*0,nn.copy(Zt),Zt.normalize(),Wt.push(Zt.x,Zt.y,Zt.z);break;case _e.length-1:Wt.push(nn.x,nn.y,nn.z);break;default:rn=_e[en+1].x-_e[en].x,Qt=_e[en+1].y-_e[en].y,Zt.x=Qt*1,Zt.y=-rn,Zt.z=Qt*0,Jt.copy(Zt),Zt.x+=nn.x,Zt.y+=nn.y,Zt.z+=nn.z,Zt.normalize(),Wt.push(Zt.x,Zt.y,Zt.z),nn.copy(Jt)}for(let en=0;en<=Dt;en++){const tn=Vt+en*Xt*Gt,sn=Math.sin(tn),cn=Math.cos(tn);for(let un=0;un<=_e.length-1;un++){Kt.x=_e[un].x*sn,Kt.y=_e[un].y,Kt.z=_e[un].x*cn,jt.push(Kt.x,Kt.y,Kt.z),Yt.x=en/Dt,Yt.y=un/(_e.length-1),Ht.push(Yt.x,Yt.y);const hn=Wt[3*un+0]*sn,fn=Wt[3*un+1],pn=Wt[3*un+0]*cn;qt.push(hn,fn,pn)}}for(let en=0;en<Dt;en++)for(let tn=0;tn<_e.length-1;tn++){const sn=tn+en*_e.length,cn=sn,un=sn+_e.length,hn=sn+_e.length+1,fn=sn+1;zt.push(cn,un,fn),zt.push(hn,fn,un)}this.setIndex(zt),this.setAttribute("position",new Float32BufferAttribute(jt,3)),this.setAttribute("uv",new Float32BufferAttribute(Ht,2)),this.setAttribute("normal",new Float32BufferAttribute(qt,3))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new LatheGeometry(_e.points,_e.segments,_e.phiStart,_e.phiLength)}}class CapsuleGeometry extends LatheGeometry{constructor(_e=1,Dt=1,Vt=4,Gt=8){const zt=new Path;zt.absarc(0,-Dt/2,_e,Math.PI*1.5,0),zt.absarc(0,Dt/2,_e,0,Math.PI*.5),super(zt.getPoints(Vt),Gt),this.type="CapsuleGeometry",this.parameters={radius:_e,length:Dt,capSegments:Vt,radialSegments:Gt}}static fromJSON(_e){return new CapsuleGeometry(_e.radius,_e.length,_e.capSegments,_e.radialSegments)}}class CircleGeometry extends BufferGeometry{constructor(_e=1,Dt=32,Vt=0,Gt=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:_e,segments:Dt,thetaStart:Vt,thetaLength:Gt},Dt=Math.max(3,Dt);const zt=[],jt=[],Ht=[],Wt=[],qt=new Vector3,Xt=new Vector2;jt.push(0,0,0),Ht.push(0,0,1),Wt.push(.5,.5);for(let Kt=0,Yt=3;Kt<=Dt;Kt++,Yt+=3){const Zt=Vt+Kt/Dt*Gt;qt.x=_e*Math.cos(Zt),qt.y=_e*Math.sin(Zt),jt.push(qt.x,qt.y,qt.z),Ht.push(0,0,1),Xt.x=(jt[Yt]/_e+1)/2,Xt.y=(jt[Yt+1]/_e+1)/2,Wt.push(Xt.x,Xt.y)}for(let Kt=1;Kt<=Dt;Kt++)zt.push(Kt,Kt+1,0);this.setIndex(zt),this.setAttribute("position",new Float32BufferAttribute(jt,3)),this.setAttribute("normal",new Float32BufferAttribute(Ht,3)),this.setAttribute("uv",new Float32BufferAttribute(Wt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new CircleGeometry(_e.radius,_e.segments,_e.thetaStart,_e.thetaLength)}}class CylinderGeometry extends BufferGeometry{constructor(_e=1,Dt=1,Vt=1,Gt=32,zt=1,jt=!1,Ht=0,Wt=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:_e,radiusBottom:Dt,height:Vt,radialSegments:Gt,heightSegments:zt,openEnded:jt,thetaStart:Ht,thetaLength:Wt};const qt=this;Gt=Math.floor(Gt),zt=Math.floor(zt);const Xt=[],Kt=[],Yt=[],Zt=[];let Jt=0;const nn=[],rn=Vt/2;let Qt=0;en(),jt===!1&&(_e>0&&tn(!0),Dt>0&&tn(!1)),this.setIndex(Xt),this.setAttribute("position",new Float32BufferAttribute(Kt,3)),this.setAttribute("normal",new Float32BufferAttribute(Yt,3)),this.setAttribute("uv",new Float32BufferAttribute(Zt,2));function en(){const sn=new Vector3,cn=new Vector3;let un=0;const hn=(Dt-_e)/Vt;for(let fn=0;fn<=zt;fn++){const pn=[],dn=fn/zt,mn=dn*(Dt-_e)+_e;for(let vn=0;vn<=Gt;vn++){const _n=vn/Gt,En=_n*Wt+Ht,An=Math.sin(En),Tn=Math.cos(En);cn.x=mn*An,cn.y=-dn*Vt+rn,cn.z=mn*Tn,Kt.push(cn.x,cn.y,cn.z),sn.set(An,hn,Tn).normalize(),Yt.push(sn.x,sn.y,sn.z),Zt.push(_n,1-dn),pn.push(Jt++)}nn.push(pn)}for(let fn=0;fn<Gt;fn++)for(let pn=0;pn<zt;pn++){const dn=nn[pn][fn],mn=nn[pn+1][fn],vn=nn[pn+1][fn+1],_n=nn[pn][fn+1];Xt.push(dn,mn,_n),Xt.push(mn,vn,_n),un+=6}qt.addGroup(Qt,un,0),Qt+=un}function tn(sn){const cn=Jt,un=new Vector2,hn=new Vector3;let fn=0;const pn=sn===!0?_e:Dt,dn=sn===!0?1:-1;for(let vn=1;vn<=Gt;vn++)Kt.push(0,rn*dn,0),Yt.push(0,dn,0),Zt.push(.5,.5),Jt++;const mn=Jt;for(let vn=0;vn<=Gt;vn++){const En=vn/Gt*Wt+Ht,An=Math.cos(En),Tn=Math.sin(En);hn.x=pn*Tn,hn.y=rn*dn,hn.z=pn*An,Kt.push(hn.x,hn.y,hn.z),Yt.push(0,dn,0),un.x=An*.5+.5,un.y=Tn*.5*dn+.5,Zt.push(un.x,un.y),Jt++}for(let vn=0;vn<Gt;vn++){const _n=cn+vn,En=mn+vn;sn===!0?Xt.push(En,En+1,_n):Xt.push(En+1,En,_n),fn+=3}qt.addGroup(Qt,fn,sn===!0?1:2),Qt+=fn}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new CylinderGeometry(_e.radiusTop,_e.radiusBottom,_e.height,_e.radialSegments,_e.heightSegments,_e.openEnded,_e.thetaStart,_e.thetaLength)}}class ConeGeometry extends CylinderGeometry{constructor(_e=1,Dt=1,Vt=32,Gt=1,zt=!1,jt=0,Ht=Math.PI*2){super(0,_e,Dt,Vt,Gt,zt,jt,Ht),this.type="ConeGeometry",this.parameters={radius:_e,height:Dt,radialSegments:Vt,heightSegments:Gt,openEnded:zt,thetaStart:jt,thetaLength:Ht}}static fromJSON(_e){return new ConeGeometry(_e.radius,_e.height,_e.radialSegments,_e.heightSegments,_e.openEnded,_e.thetaStart,_e.thetaLength)}}class PolyhedronGeometry extends BufferGeometry{constructor(_e=[],Dt=[],Vt=1,Gt=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:_e,indices:Dt,radius:Vt,detail:Gt};const zt=[],jt=[];Ht(Gt),qt(Vt),Xt(),this.setAttribute("position",new Float32BufferAttribute(zt,3)),this.setAttribute("normal",new Float32BufferAttribute(zt.slice(),3)),this.setAttribute("uv",new Float32BufferAttribute(jt,2)),Gt===0?this.computeVertexNormals():this.normalizeNormals();function Ht(en){const tn=new Vector3,sn=new Vector3,cn=new Vector3;for(let un=0;un<Dt.length;un+=3)Zt(Dt[un+0],tn),Zt(Dt[un+1],sn),Zt(Dt[un+2],cn),Wt(tn,sn,cn,en)}function Wt(en,tn,sn,cn){const un=cn+1,hn=[];for(let fn=0;fn<=un;fn++){hn[fn]=[];const pn=en.clone().lerp(sn,fn/un),dn=tn.clone().lerp(sn,fn/un),mn=un-fn;for(let vn=0;vn<=mn;vn++)vn===0&&fn===un?hn[fn][vn]=pn:hn[fn][vn]=pn.clone().lerp(dn,vn/mn)}for(let fn=0;fn<un;fn++)for(let pn=0;pn<2*(un-fn)-1;pn++){const dn=Math.floor(pn/2);pn%2===0?(Yt(hn[fn][dn+1]),Yt(hn[fn+1][dn]),Yt(hn[fn][dn])):(Yt(hn[fn][dn+1]),Yt(hn[fn+1][dn+1]),Yt(hn[fn+1][dn]))}}function qt(en){const tn=new Vector3;for(let sn=0;sn<zt.length;sn+=3)tn.x=zt[sn+0],tn.y=zt[sn+1],tn.z=zt[sn+2],tn.normalize().multiplyScalar(en),zt[sn+0]=tn.x,zt[sn+1]=tn.y,zt[sn+2]=tn.z}function Xt(){const en=new Vector3;for(let tn=0;tn<zt.length;tn+=3){en.x=zt[tn+0],en.y=zt[tn+1],en.z=zt[tn+2];const sn=rn(en)/2/Math.PI+.5,cn=Qt(en)/Math.PI+.5;jt.push(sn,1-cn)}Jt(),Kt()}function Kt(){for(let en=0;en<jt.length;en+=6){const tn=jt[en+0],sn=jt[en+2],cn=jt[en+4],un=Math.max(tn,sn,cn),hn=Math.min(tn,sn,cn);un>.9&&hn<.1&&(tn<.2&&(jt[en+0]+=1),sn<.2&&(jt[en+2]+=1),cn<.2&&(jt[en+4]+=1))}}function Yt(en){zt.push(en.x,en.y,en.z)}function Zt(en,tn){const sn=en*3;tn.x=_e[sn+0],tn.y=_e[sn+1],tn.z=_e[sn+2]}function Jt(){const en=new Vector3,tn=new Vector3,sn=new Vector3,cn=new Vector3,un=new Vector2,hn=new Vector2,fn=new Vector2;for(let pn=0,dn=0;pn<zt.length;pn+=9,dn+=6){en.set(zt[pn+0],zt[pn+1],zt[pn+2]),tn.set(zt[pn+3],zt[pn+4],zt[pn+5]),sn.set(zt[pn+6],zt[pn+7],zt[pn+8]),un.set(jt[dn+0],jt[dn+1]),hn.set(jt[dn+2],jt[dn+3]),fn.set(jt[dn+4],jt[dn+5]),cn.copy(en).add(tn).add(sn).divideScalar(3);const mn=rn(cn);nn(un,dn+0,en,mn),nn(hn,dn+2,tn,mn),nn(fn,dn+4,sn,mn)}}function nn(en,tn,sn,cn){cn<0&&en.x===1&&(jt[tn]=en.x-1),sn.x===0&&sn.z===0&&(jt[tn]=cn/2/Math.PI+.5)}function rn(en){return Math.atan2(en.z,-en.x)}function Qt(en){return Math.atan2(-en.y,Math.sqrt(en.x*en.x+en.z*en.z))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new PolyhedronGeometry(_e.vertices,_e.indices,_e.radius,_e.details)}}class DodecahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=(1+Math.sqrt(5))/2,Gt=1/Vt,zt=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-Gt,-Vt,0,-Gt,Vt,0,Gt,-Vt,0,Gt,Vt,-Gt,-Vt,0,-Gt,Vt,0,Gt,-Vt,0,Gt,Vt,0,-Vt,0,-Gt,Vt,0,-Gt,-Vt,0,Gt,Vt,0,Gt],jt=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(zt,jt,_e,Dt),this.type="DodecahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new DodecahedronGeometry(_e.radius,_e.detail)}}const _v0=new Vector3,_v1$1=new Vector3,_normal=new Vector3,_triangle=new Triangle;class EdgesGeometry extends BufferGeometry{constructor(_e=null,Dt=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:_e,thresholdAngle:Dt},_e!==null){const Gt=Math.pow(10,4),zt=Math.cos(DEG2RAD$1*Dt),jt=_e.getIndex(),Ht=_e.getAttribute("position"),Wt=jt?jt.count:Ht.count,qt=[0,0,0],Xt=["a","b","c"],Kt=new Array(3),Yt={},Zt=[];for(let Jt=0;Jt<Wt;Jt+=3){jt?(qt[0]=jt.getX(Jt),qt[1]=jt.getX(Jt+1),qt[2]=jt.getX(Jt+2)):(qt[0]=Jt,qt[1]=Jt+1,qt[2]=Jt+2);const{a:nn,b:rn,c:Qt}=_triangle;if(nn.fromBufferAttribute(Ht,qt[0]),rn.fromBufferAttribute(Ht,qt[1]),Qt.fromBufferAttribute(Ht,qt[2]),_triangle.getNormal(_normal),Kt[0]=`${Math.round(nn.x*Gt)},${Math.round(nn.y*Gt)},${Math.round(nn.z*Gt)}`,Kt[1]=`${Math.round(rn.x*Gt)},${Math.round(rn.y*Gt)},${Math.round(rn.z*Gt)}`,Kt[2]=`${Math.round(Qt.x*Gt)},${Math.round(Qt.y*Gt)},${Math.round(Qt.z*Gt)}`,!(Kt[0]===Kt[1]||Kt[1]===Kt[2]||Kt[2]===Kt[0]))for(let en=0;en<3;en++){const tn=(en+1)%3,sn=Kt[en],cn=Kt[tn],un=_triangle[Xt[en]],hn=_triangle[Xt[tn]],fn=`${sn}_${cn}`,pn=`${cn}_${sn}`;pn in Yt&&Yt[pn]?(_normal.dot(Yt[pn].normal)<=zt&&(Zt.push(un.x,un.y,un.z),Zt.push(hn.x,hn.y,hn.z)),Yt[pn]=null):fn in Yt||(Yt[fn]={index0:qt[en],index1:qt[tn],normal:_normal.clone()})}}for(const Jt in Yt)if(Yt[Jt]){const{index0:nn,index1:rn}=Yt[Jt];_v0.fromBufferAttribute(Ht,nn),_v1$1.fromBufferAttribute(Ht,rn),Zt.push(_v0.x,_v0.y,_v0.z),Zt.push(_v1$1.x,_v1$1.y,_v1$1.z)}this.setAttribute("position",new Float32BufferAttribute(Zt,3))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}}class Shape extends Path{constructor(_e){super(_e),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(_e){const Dt=[];for(let Vt=0,Gt=this.holes.length;Vt<Gt;Vt++)Dt[Vt]=this.holes[Vt].getPoints(_e);return Dt}extractPoints(_e){return{shape:this.getPoints(_e),holes:this.getPointsHoles(_e)}}copy(_e){super.copy(_e),this.holes=[];for(let Dt=0,Vt=_e.holes.length;Dt<Vt;Dt++){const Gt=_e.holes[Dt];this.holes.push(Gt.clone())}return this}toJSON(){const _e=super.toJSON();_e.uuid=this.uuid,_e.holes=[];for(let Dt=0,Vt=this.holes.length;Dt<Vt;Dt++){const Gt=this.holes[Dt];_e.holes.push(Gt.toJSON())}return _e}fromJSON(_e){super.fromJSON(_e),this.uuid=_e.uuid,this.holes=[];for(let Dt=0,Vt=_e.holes.length;Dt<Vt;Dt++){const Gt=_e.holes[Dt];this.holes.push(new Path().fromJSON(Gt))}return this}}const Earcut={triangulate:function(kt,_e,Dt=2){const Vt=_e&&_e.length,Gt=Vt?_e[0]*Dt:kt.length;let zt=linkedList(kt,0,Gt,Dt,!0);const jt=[];if(!zt||zt.next===zt.prev)return jt;let Ht,Wt,qt,Xt,Kt,Yt,Zt;if(Vt&&(zt=eliminateHoles(kt,_e,zt,Dt)),kt.length>80*Dt){Ht=qt=kt[0],Wt=Xt=kt[1];for(let Jt=Dt;Jt<Gt;Jt+=Dt)Kt=kt[Jt],Yt=kt[Jt+1],Kt<Ht&&(Ht=Kt),Yt<Wt&&(Wt=Yt),Kt>qt&&(qt=Kt),Yt>Xt&&(Xt=Yt);Zt=Math.max(qt-Ht,Xt-Wt),Zt=Zt!==0?32767/Zt:0}return earcutLinked(zt,jt,Dt,Ht,Wt,Zt,0),jt}};function linkedList(kt,_e,Dt,Vt,Gt){let zt,jt;if(Gt===signedArea(kt,_e,Dt,Vt)>0)for(zt=_e;zt<Dt;zt+=Vt)jt=insertNode(zt,kt[zt],kt[zt+1],jt);else for(zt=Dt-Vt;zt>=_e;zt-=Vt)jt=insertNode(zt,kt[zt],kt[zt+1],jt);return jt&&equals(jt,jt.next)&&(removeNode(jt),jt=jt.next),jt}function filterPoints(kt,_e){if(!kt)return kt;_e||(_e=kt);let Dt=kt,Vt;do if(Vt=!1,!Dt.steiner&&(equals(Dt,Dt.next)||area$1(Dt.prev,Dt,Dt.next)===0)){if(removeNode(Dt),Dt=_e=Dt.prev,Dt===Dt.next)break;Vt=!0}else Dt=Dt.next;while(Vt||Dt!==_e);return _e}function earcutLinked(kt,_e,Dt,Vt,Gt,zt,jt){if(!kt)return;!jt&&zt&&indexCurve(kt,Vt,Gt,zt);let Ht=kt,Wt,qt;for(;kt.prev!==kt.next;){if(Wt=kt.prev,qt=kt.next,zt?isEarHashed(kt,Vt,Gt,zt):isEar(kt)){_e.push(Wt.i/Dt|0),_e.push(kt.i/Dt|0),_e.push(qt.i/Dt|0),removeNode(kt),kt=qt.next,Ht=qt.next;continue}if(kt=qt,kt===Ht){jt?jt===1?(kt=cureLocalIntersections(filterPoints(kt),_e,Dt),earcutLinked(kt,_e,Dt,Vt,Gt,zt,2)):jt===2&&splitEarcut(kt,_e,Dt,Vt,Gt,zt):earcutLinked(filterPoints(kt),_e,Dt,Vt,Gt,zt,1);break}}}function isEar(kt){const _e=kt.prev,Dt=kt,Vt=kt.next;if(area$1(_e,Dt,Vt)>=0)return!1;const Gt=_e.x,zt=Dt.x,jt=Vt.x,Ht=_e.y,Wt=Dt.y,qt=Vt.y,Xt=Gt<zt?Gt<jt?Gt:jt:zt<jt?zt:jt,Kt=Ht<Wt?Ht<qt?Ht:qt:Wt<qt?Wt:qt,Yt=Gt>zt?Gt>jt?Gt:jt:zt>jt?zt:jt,Zt=Ht>Wt?Ht>qt?Ht:qt:Wt>qt?Wt:qt;let Jt=Vt.next;for(;Jt!==_e;){if(Jt.x>=Xt&&Jt.x<=Yt&&Jt.y>=Kt&&Jt.y<=Zt&&pointInTriangle(Gt,Ht,zt,Wt,jt,qt,Jt.x,Jt.y)&&area$1(Jt.prev,Jt,Jt.next)>=0)return!1;Jt=Jt.next}return!0}function isEarHashed(kt,_e,Dt,Vt){const Gt=kt.prev,zt=kt,jt=kt.next;if(area$1(Gt,zt,jt)>=0)return!1;const Ht=Gt.x,Wt=zt.x,qt=jt.x,Xt=Gt.y,Kt=zt.y,Yt=jt.y,Zt=Ht<Wt?Ht<qt?Ht:qt:Wt<qt?Wt:qt,Jt=Xt<Kt?Xt<Yt?Xt:Yt:Kt<Yt?Kt:Yt,nn=Ht>Wt?Ht>qt?Ht:qt:Wt>qt?Wt:qt,rn=Xt>Kt?Xt>Yt?Xt:Yt:Kt>Yt?Kt:Yt,Qt=zOrder(Zt,Jt,_e,Dt,Vt),en=zOrder(nn,rn,_e,Dt,Vt);let tn=kt.prevZ,sn=kt.nextZ;for(;tn&&tn.z>=Qt&&sn&&sn.z<=en;){if(tn.x>=Zt&&tn.x<=nn&&tn.y>=Jt&&tn.y<=rn&&tn!==Gt&&tn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,tn.x,tn.y)&&area$1(tn.prev,tn,tn.next)>=0||(tn=tn.prevZ,sn.x>=Zt&&sn.x<=nn&&sn.y>=Jt&&sn.y<=rn&&sn!==Gt&&sn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,sn.x,sn.y)&&area$1(sn.prev,sn,sn.next)>=0))return!1;sn=sn.nextZ}for(;tn&&tn.z>=Qt;){if(tn.x>=Zt&&tn.x<=nn&&tn.y>=Jt&&tn.y<=rn&&tn!==Gt&&tn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,tn.x,tn.y)&&area$1(tn.prev,tn,tn.next)>=0)return!1;tn=tn.prevZ}for(;sn&&sn.z<=en;){if(sn.x>=Zt&&sn.x<=nn&&sn.y>=Jt&&sn.y<=rn&&sn!==Gt&&sn!==jt&&pointInTriangle(Ht,Xt,Wt,Kt,qt,Yt,sn.x,sn.y)&&area$1(sn.prev,sn,sn.next)>=0)return!1;sn=sn.nextZ}return!0}function cureLocalIntersections(kt,_e,Dt){let Vt=kt;do{const Gt=Vt.prev,zt=Vt.next.next;!equals(Gt,zt)&&intersects(Gt,Vt,Vt.next,zt)&&locallyInside(Gt,zt)&&locallyInside(zt,Gt)&&(_e.push(Gt.i/Dt|0),_e.push(Vt.i/Dt|0),_e.push(zt.i/Dt|0),removeNode(Vt),removeNode(Vt.next),Vt=kt=zt),Vt=Vt.next}while(Vt!==kt);return filterPoints(Vt)}function splitEarcut(kt,_e,Dt,Vt,Gt,zt){let jt=kt;do{let Ht=jt.next.next;for(;Ht!==jt.prev;){if(jt.i!==Ht.i&&isValidDiagonal(jt,Ht)){let Wt=splitPolygon(jt,Ht);jt=filterPoints(jt,jt.next),Wt=filterPoints(Wt,Wt.next),earcutLinked(jt,_e,Dt,Vt,Gt,zt,0),earcutLinked(Wt,_e,Dt,Vt,Gt,zt,0);return}Ht=Ht.next}jt=jt.next}while(jt!==kt)}function eliminateHoles(kt,_e,Dt,Vt){const Gt=[];let zt,jt,Ht,Wt,qt;for(zt=0,jt=_e.length;zt<jt;zt++)Ht=_e[zt]*Vt,Wt=zt<jt-1?_e[zt+1]*Vt:kt.length,qt=linkedList(kt,Ht,Wt,Vt,!1),qt===qt.next&&(qt.steiner=!0),Gt.push(getLeftmost(qt));for(Gt.sort(compareX),zt=0;zt<Gt.length;zt++)Dt=eliminateHole(Gt[zt],Dt);return Dt}function compareX(kt,_e){return kt.x-_e.x}function eliminateHole(kt,_e){const Dt=findHoleBridge(kt,_e);if(!Dt)return _e;const Vt=splitPolygon(Dt,kt);return filterPoints(Vt,Vt.next),filterPoints(Dt,Dt.next)}function findHoleBridge(kt,_e){let Dt=_e,Vt=-1/0,Gt;const zt=kt.x,jt=kt.y;do{if(jt<=Dt.y&&jt>=Dt.next.y&&Dt.next.y!==Dt.y){const Yt=Dt.x+(jt-Dt.y)*(Dt.next.x-Dt.x)/(Dt.next.y-Dt.y);if(Yt<=zt&&Yt>Vt&&(Vt=Yt,Gt=Dt.x<Dt.next.x?Dt:Dt.next,Yt===zt))return Gt}Dt=Dt.next}while(Dt!==_e);if(!Gt)return null;const Ht=Gt,Wt=Gt.x,qt=Gt.y;let Xt=1/0,Kt;Dt=Gt;do zt>=Dt.x&&Dt.x>=Wt&&zt!==Dt.x&&pointInTriangle(jt<qt?zt:Vt,jt,Wt,qt,jt<qt?Vt:zt,jt,Dt.x,Dt.y)&&(Kt=Math.abs(jt-Dt.y)/(zt-Dt.x),locallyInside(Dt,kt)&&(Kt<Xt||Kt===Xt&&(Dt.x>Gt.x||Dt.x===Gt.x&§orContainsSector(Gt,Dt)))&&(Gt=Dt,Xt=Kt)),Dt=Dt.next;while(Dt!==Ht);return Gt}function sectorContainsSector(kt,_e){return area$1(kt.prev,kt,_e.prev)<0&&area$1(_e.next,kt,kt.next)<0}function indexCurve(kt,_e,Dt,Vt){let Gt=kt;do Gt.z===0&&(Gt.z=zOrder(Gt.x,Gt.y,_e,Dt,Vt)),Gt.prevZ=Gt.prev,Gt.nextZ=Gt.next,Gt=Gt.next;while(Gt!==kt);Gt.prevZ.nextZ=null,Gt.prevZ=null,sortLinked(Gt)}function sortLinked(kt){let _e,Dt,Vt,Gt,zt,jt,Ht,Wt,qt=1;do{for(Dt=kt,kt=null,zt=null,jt=0;Dt;){for(jt++,Vt=Dt,Ht=0,_e=0;_e<qt&&(Ht++,Vt=Vt.nextZ,!!Vt);_e++);for(Wt=qt;Ht>0||Wt>0&&Vt;)Ht!==0&&(Wt===0||!Vt||Dt.z<=Vt.z)?(Gt=Dt,Dt=Dt.nextZ,Ht--):(Gt=Vt,Vt=Vt.nextZ,Wt--),zt?zt.nextZ=Gt:kt=Gt,Gt.prevZ=zt,zt=Gt;Dt=Vt}zt.nextZ=null,qt*=2}while(jt>1);return kt}function zOrder(kt,_e,Dt,Vt,Gt){return kt=(kt-Dt)*Gt|0,_e=(_e-Vt)*Gt|0,kt=(kt|kt<<8)&16711935,kt=(kt|kt<<4)&252645135,kt=(kt|kt<<2)&858993459,kt=(kt|kt<<1)&1431655765,_e=(_e|_e<<8)&16711935,_e=(_e|_e<<4)&252645135,_e=(_e|_e<<2)&858993459,_e=(_e|_e<<1)&1431655765,kt|_e<<1}function getLeftmost(kt){let _e=kt,Dt=kt;do(_e.x<Dt.x||_e.x===Dt.x&&_e.y<Dt.y)&&(Dt=_e),_e=_e.next;while(_e!==kt);return Dt}function pointInTriangle(kt,_e,Dt,Vt,Gt,zt,jt,Ht){return(Gt-jt)*(_e-Ht)>=(kt-jt)*(zt-Ht)&&(kt-jt)*(Vt-Ht)>=(Dt-jt)*(_e-Ht)&&(Dt-jt)*(zt-Ht)>=(Gt-jt)*(Vt-Ht)}function isValidDiagonal(kt,_e){return kt.next.i!==_e.i&&kt.prev.i!==_e.i&&!intersectsPolygon(kt,_e)&&(locallyInside(kt,_e)&&locallyInside(_e,kt)&&middleInside(kt,_e)&&(area$1(kt.prev,kt,_e.prev)||area$1(kt,_e.prev,_e))||equals(kt,_e)&&area$1(kt.prev,kt,kt.next)>0&&area$1(_e.prev,_e,_e.next)>0)}function area$1(kt,_e,Dt){return(_e.y-kt.y)*(Dt.x-_e.x)-(_e.x-kt.x)*(Dt.y-_e.y)}function equals(kt,_e){return kt.x===_e.x&&kt.y===_e.y}function intersects(kt,_e,Dt,Vt){const Gt=sign(area$1(kt,_e,Dt)),zt=sign(area$1(kt,_e,Vt)),jt=sign(area$1(Dt,Vt,kt)),Ht=sign(area$1(Dt,Vt,_e));return!!(Gt!==zt&&jt!==Ht||Gt===0&&onSegment(kt,Dt,_e)||zt===0&&onSegment(kt,Vt,_e)||jt===0&&onSegment(Dt,kt,Vt)||Ht===0&&onSegment(Dt,_e,Vt))}function onSegment(kt,_e,Dt){return _e.x<=Math.max(kt.x,Dt.x)&&_e.x>=Math.min(kt.x,Dt.x)&&_e.y<=Math.max(kt.y,Dt.y)&&_e.y>=Math.min(kt.y,Dt.y)}function sign(kt){return kt>0?1:kt<0?-1:0}function intersectsPolygon(kt,_e){let Dt=kt;do{if(Dt.i!==kt.i&&Dt.next.i!==kt.i&&Dt.i!==_e.i&&Dt.next.i!==_e.i&&intersects(Dt,Dt.next,kt,_e))return!0;Dt=Dt.next}while(Dt!==kt);return!1}function locallyInside(kt,_e){return area$1(kt.prev,kt,kt.next)<0?area$1(kt,_e,kt.next)>=0&&area$1(kt,kt.prev,_e)>=0:area$1(kt,_e,kt.prev)<0||area$1(kt,kt.next,_e)<0}function middleInside(kt,_e){let Dt=kt,Vt=!1;const Gt=(kt.x+_e.x)/2,zt=(kt.y+_e.y)/2;do Dt.y>zt!=Dt.next.y>zt&&Dt.next.y!==Dt.y&&Gt<(Dt.next.x-Dt.x)*(zt-Dt.y)/(Dt.next.y-Dt.y)+Dt.x&&(Vt=!Vt),Dt=Dt.next;while(Dt!==kt);return Vt}function splitPolygon(kt,_e){const Dt=new Node$2(kt.i,kt.x,kt.y),Vt=new Node$2(_e.i,_e.x,_e.y),Gt=kt.next,zt=_e.prev;return kt.next=_e,_e.prev=kt,Dt.next=Gt,Gt.prev=Dt,Vt.next=Dt,Dt.prev=Vt,zt.next=Vt,Vt.prev=zt,Vt}function insertNode(kt,_e,Dt,Vt){const Gt=new Node$2(kt,_e,Dt);return Vt?(Gt.next=Vt.next,Gt.prev=Vt,Vt.next.prev=Gt,Vt.next=Gt):(Gt.prev=Gt,Gt.next=Gt),Gt}function removeNode(kt){kt.next.prev=kt.prev,kt.prev.next=kt.next,kt.prevZ&&(kt.prevZ.nextZ=kt.nextZ),kt.nextZ&&(kt.nextZ.prevZ=kt.prevZ)}function Node$2(kt,_e,Dt){this.i=kt,this.x=_e,this.y=Dt,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(kt,_e,Dt,Vt){let Gt=0;for(let zt=_e,jt=Dt-Vt;zt<Dt;zt+=Vt)Gt+=(kt[jt]-kt[zt])*(kt[zt+1]+kt[jt+1]),jt=zt;return Gt}class ShapeUtils{static area(_e){const Dt=_e.length;let Vt=0;for(let Gt=Dt-1,zt=0;zt<Dt;Gt=zt++)Vt+=_e[Gt].x*_e[zt].y-_e[zt].x*_e[Gt].y;return Vt*.5}static isClockWise(_e){return ShapeUtils.area(_e)<0}static triangulateShape(_e,Dt){const Vt=[],Gt=[],zt=[];removeDupEndPts(_e),addContour(Vt,_e);let jt=_e.length;Dt.forEach(removeDupEndPts);for(let Wt=0;Wt<Dt.length;Wt++)Gt.push(jt),jt+=Dt[Wt].length,addContour(Vt,Dt[Wt]);const Ht=Earcut.triangulate(Vt,Gt);for(let Wt=0;Wt<Ht.length;Wt+=3)zt.push(Ht.slice(Wt,Wt+3));return zt}}function removeDupEndPts(kt){const _e=kt.length;_e>2&&kt[_e-1].equals(kt[0])&&kt.pop()}function addContour(kt,_e){for(let Dt=0;Dt<_e.length;Dt++)kt.push(_e[Dt].x),kt.push(_e[Dt].y)}class ExtrudeGeometry extends BufferGeometry{constructor(_e=new Shape([new Vector2(.5,.5),new Vector2(-.5,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),Dt={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:_e,options:Dt},_e=Array.isArray(_e)?_e:[_e];const Vt=this,Gt=[],zt=[];for(let Ht=0,Wt=_e.length;Ht<Wt;Ht++){const qt=_e[Ht];jt(qt)}this.setAttribute("position",new Float32BufferAttribute(Gt,3)),this.setAttribute("uv",new Float32BufferAttribute(zt,2)),this.computeVertexNormals();function jt(Ht){const Wt=[],qt=Dt.curveSegments!==void 0?Dt.curveSegments:12,Xt=Dt.steps!==void 0?Dt.steps:1,Kt=Dt.depth!==void 0?Dt.depth:1;let Yt=Dt.bevelEnabled!==void 0?Dt.bevelEnabled:!0,Zt=Dt.bevelThickness!==void 0?Dt.bevelThickness:.2,Jt=Dt.bevelSize!==void 0?Dt.bevelSize:Zt-.1,nn=Dt.bevelOffset!==void 0?Dt.bevelOffset:0,rn=Dt.bevelSegments!==void 0?Dt.bevelSegments:3;const Qt=Dt.extrudePath,en=Dt.UVGenerator!==void 0?Dt.UVGenerator:WorldUVGenerator;let tn,sn=!1,cn,un,hn,fn;Qt&&(tn=Qt.getSpacedPoints(Xt),sn=!0,Yt=!1,cn=Qt.computeFrenetFrames(Xt,!1),un=new Vector3,hn=new Vector3,fn=new Vector3),Yt||(rn=0,Zt=0,Jt=0,nn=0);const pn=Ht.extractPoints(qt);let dn=pn.shape;const mn=pn.holes;if(!ShapeUtils.isClockWise(dn)){dn=dn.reverse();for(let ur=0,Wn=mn.length;ur<Wn;ur++){const or=mn[ur];ShapeUtils.isClockWise(or)&&(mn[ur]=or.reverse())}}const _n=ShapeUtils.triangulateShape(dn,mn),En=dn;for(let ur=0,Wn=mn.length;ur<Wn;ur++){const or=mn[ur];dn=dn.concat(or)}function An(ur,Wn,or){return Wn||console.error("THREE.ExtrudeGeometry: vec does not exist"),ur.clone().addScaledVector(Wn,or)}const Tn=dn.length,Cn=_n.length;function yn(ur,Wn,or){let gr,fr,Un;const In=ur.x-Wn.x,jn=ur.y-Wn.y,er=or.x-ur.x,cr=or.y-ur.y,lr=In*In+jn*jn,Mr=In*cr-jn*er;if(Math.abs(Mr)>Number.EPSILON){const mr=Math.sqrt(lr),wr=Math.sqrt(er*er+cr*cr),Dr=Wn.x-jn/mr,Cr=Wn.y+In/mr,Pr=or.x-cr/wr,Hr=or.y+er/wr,Ir=((Pr-Dr)*cr-(Hr-Cr)*er)/(In*cr-jn*er);gr=Dr+In*Ir-ur.x,fr=Cr+jn*Ir-ur.y;const Fr=gr*gr+fr*fr;if(Fr<=2)return new Vector2(gr,fr);Un=Math.sqrt(Fr/2)}else{let mr=!1;In>Number.EPSILON?er>Number.EPSILON&&(mr=!0):In<-Number.EPSILON?er<-Number.EPSILON&&(mr=!0):Math.sign(jn)===Math.sign(cr)&&(mr=!0),mr?(gr=-jn,fr=In,Un=Math.sqrt(lr)):(gr=In,fr=jn,Un=Math.sqrt(lr/2))}return new Vector2(gr/Un,fr/Un)}const Sn=[];for(let ur=0,Wn=En.length,or=Wn-1,gr=ur+1;ur<Wn;ur++,or++,gr++)or===Wn&&(or=0),gr===Wn&&(gr=0),Sn[ur]=yn(En[ur],En[or],En[gr]);const wn=[];let xn,Rn=Sn.concat();for(let ur=0,Wn=mn.length;ur<Wn;ur++){const or=mn[ur];xn=[];for(let gr=0,fr=or.length,Un=fr-1,In=gr+1;gr<fr;gr++,Un++,In++)Un===fr&&(Un=0),In===fr&&(In=0),xn[gr]=yn(or[gr],or[Un],or[In]);wn.push(xn),Rn=Rn.concat(xn)}for(let ur=0;ur<rn;ur++){const Wn=ur/rn,or=Zt*Math.cos(Wn*Math.PI/2),gr=Jt*Math.sin(Wn*Math.PI/2)+nn;for(let fr=0,Un=En.length;fr<Un;fr++){const In=An(En[fr],Sn[fr],gr);Bn(In.x,In.y,-or)}for(let fr=0,Un=mn.length;fr<Un;fr++){const In=mn[fr];xn=wn[fr];for(let jn=0,er=In.length;jn<er;jn++){const cr=An(In[jn],xn[jn],gr);Bn(cr.x,cr.y,-or)}}}const Ln=Jt+nn;for(let ur=0;ur<Tn;ur++){const Wn=Yt?An(dn[ur],Rn[ur],Ln):dn[ur];sn?(hn.copy(cn.normals[0]).multiplyScalar(Wn.x),un.copy(cn.binormals[0]).multiplyScalar(Wn.y),fn.copy(tn[0]).add(hn).add(un),Bn(fn.x,fn.y,fn.z)):Bn(Wn.x,Wn.y,0)}for(let ur=1;ur<=Xt;ur++)for(let Wn=0;Wn<Tn;Wn++){const or=Yt?An(dn[Wn],Rn[Wn],Ln):dn[Wn];sn?(hn.copy(cn.normals[ur]).multiplyScalar(or.x),un.copy(cn.binormals[ur]).multiplyScalar(or.y),fn.copy(tn[ur]).add(hn).add(un),Bn(fn.x,fn.y,fn.z)):Bn(or.x,or.y,Kt/Xt*ur)}for(let ur=rn-1;ur>=0;ur--){const Wn=ur/rn,or=Zt*Math.cos(Wn*Math.PI/2),gr=Jt*Math.sin(Wn*Math.PI/2)+nn;for(let fr=0,Un=En.length;fr<Un;fr++){const In=An(En[fr],Sn[fr],gr);Bn(In.x,In.y,Kt+or)}for(let fr=0,Un=mn.length;fr<Un;fr++){const In=mn[fr];xn=wn[fr];for(let jn=0,er=In.length;jn<er;jn++){const cr=An(In[jn],xn[jn],gr);sn?Bn(cr.x,cr.y+tn[Xt-1].y,tn[Xt-1].x+or):Bn(cr.x,cr.y,Kt+or)}}}Nn(),Fn();function Nn(){const ur=Gt.length/3;if(Yt){let Wn=0,or=Tn*Wn;for(let gr=0;gr<Cn;gr++){const fr=_n[gr];Hn(fr[2]+or,fr[1]+or,fr[0]+or)}Wn=Xt+rn*2,or=Tn*Wn;for(let gr=0;gr<Cn;gr++){const fr=_n[gr];Hn(fr[0]+or,fr[1]+or,fr[2]+or)}}else{for(let Wn=0;Wn<Cn;Wn++){const or=_n[Wn];Hn(or[2],or[1],or[0])}for(let Wn=0;Wn<Cn;Wn++){const or=_n[Wn];Hn(or[0]+Tn*Xt,or[1]+Tn*Xt,or[2]+Tn*Xt)}}Vt.addGroup(ur,Gt.length/3-ur,0)}function Fn(){const ur=Gt.length/3;let Wn=0;Pn(En,Wn),Wn+=En.length;for(let or=0,gr=mn.length;or<gr;or++){const fr=mn[or];Pn(fr,Wn),Wn+=fr.length}Vt.addGroup(ur,Gt.length/3-ur,1)}function Pn(ur,Wn){let or=ur.length;for(;--or>=0;){const gr=or;let fr=or-1;fr<0&&(fr=ur.length-1);for(let Un=0,In=Xt+rn*2;Un<In;Un++){const jn=Tn*Un,er=Tn*(Un+1),cr=Wn+gr+jn,lr=Wn+fr+jn,Mr=Wn+fr+er,mr=Wn+gr+er;qn(cr,lr,Mr,mr)}}}function Bn(ur,Wn,or){Wt.push(ur),Wt.push(Wn),Wt.push(or)}function Hn(ur,Wn,or){ar(ur),ar(Wn),ar(or);const gr=Gt.length/3,fr=en.generateTopUV(Vt,Gt,gr-3,gr-2,gr-1);zn(fr[0]),zn(fr[1]),zn(fr[2])}function qn(ur,Wn,or,gr){ar(ur),ar(Wn),ar(gr),ar(Wn),ar(or),ar(gr);const fr=Gt.length/3,Un=en.generateSideWallUV(Vt,Gt,fr-6,fr-3,fr-2,fr-1);zn(Un[0]),zn(Un[1]),zn(Un[3]),zn(Un[1]),zn(Un[2]),zn(Un[3])}function ar(ur){Gt.push(Wt[ur*3+0]),Gt.push(Wt[ur*3+1]),Gt.push(Wt[ur*3+2])}function zn(ur){zt.push(ur.x),zt.push(ur.y)}}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON(),Dt=this.parameters.shapes,Vt=this.parameters.options;return toJSON$1(Dt,Vt,_e)}static fromJSON(_e,Dt){const Vt=[];for(let zt=0,jt=_e.shapes.length;zt<jt;zt++){const Ht=Dt[_e.shapes[zt]];Vt.push(Ht)}const Gt=_e.options.extrudePath;return Gt!==void 0&&(_e.options.extrudePath=new Curves[Gt.type]().fromJSON(Gt)),new ExtrudeGeometry(Vt,_e.options)}}const WorldUVGenerator={generateTopUV:function(kt,_e,Dt,Vt,Gt){const zt=_e[Dt*3],jt=_e[Dt*3+1],Ht=_e[Vt*3],Wt=_e[Vt*3+1],qt=_e[Gt*3],Xt=_e[Gt*3+1];return[new Vector2(zt,jt),new Vector2(Ht,Wt),new Vector2(qt,Xt)]},generateSideWallUV:function(kt,_e,Dt,Vt,Gt,zt){const jt=_e[Dt*3],Ht=_e[Dt*3+1],Wt=_e[Dt*3+2],qt=_e[Vt*3],Xt=_e[Vt*3+1],Kt=_e[Vt*3+2],Yt=_e[Gt*3],Zt=_e[Gt*3+1],Jt=_e[Gt*3+2],nn=_e[zt*3],rn=_e[zt*3+1],Qt=_e[zt*3+2];return Math.abs(Ht-Xt)<Math.abs(jt-qt)?[new Vector2(jt,1-Wt),new Vector2(qt,1-Kt),new Vector2(Yt,1-Jt),new Vector2(nn,1-Qt)]:[new Vector2(Ht,1-Wt),new Vector2(Xt,1-Kt),new Vector2(Zt,1-Jt),new Vector2(rn,1-Qt)]}};function toJSON$1(kt,_e,Dt){if(Dt.shapes=[],Array.isArray(kt))for(let Vt=0,Gt=kt.length;Vt<Gt;Vt++){const zt=kt[Vt];Dt.shapes.push(zt.uuid)}else Dt.shapes.push(kt.uuid);return Dt.options=Object.assign({},_e),_e.extrudePath!==void 0&&(Dt.options.extrudePath=_e.extrudePath.toJSON()),Dt}class IcosahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=(1+Math.sqrt(5))/2,Gt=[-1,Vt,0,1,Vt,0,-1,-Vt,0,1,-Vt,0,0,-1,Vt,0,1,Vt,0,-1,-Vt,0,1,-Vt,Vt,0,-1,Vt,0,1,-Vt,0,-1,-Vt,0,1],zt=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(Gt,zt,_e,Dt),this.type="IcosahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new IcosahedronGeometry(_e.radius,_e.detail)}}class OctahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],Gt=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(Vt,Gt,_e,Dt),this.type="OctahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new OctahedronGeometry(_e.radius,_e.detail)}}class RingGeometry extends BufferGeometry{constructor(_e=.5,Dt=1,Vt=32,Gt=1,zt=0,jt=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:_e,outerRadius:Dt,thetaSegments:Vt,phiSegments:Gt,thetaStart:zt,thetaLength:jt},Vt=Math.max(3,Vt),Gt=Math.max(1,Gt);const Ht=[],Wt=[],qt=[],Xt=[];let Kt=_e;const Yt=(Dt-_e)/Gt,Zt=new Vector3,Jt=new Vector2;for(let nn=0;nn<=Gt;nn++){for(let rn=0;rn<=Vt;rn++){const Qt=zt+rn/Vt*jt;Zt.x=Kt*Math.cos(Qt),Zt.y=Kt*Math.sin(Qt),Wt.push(Zt.x,Zt.y,Zt.z),qt.push(0,0,1),Jt.x=(Zt.x/Dt+1)/2,Jt.y=(Zt.y/Dt+1)/2,Xt.push(Jt.x,Jt.y)}Kt+=Yt}for(let nn=0;nn<Gt;nn++){const rn=nn*(Vt+1);for(let Qt=0;Qt<Vt;Qt++){const en=Qt+rn,tn=en,sn=en+Vt+1,cn=en+Vt+2,un=en+1;Ht.push(tn,sn,un),Ht.push(sn,cn,un)}}this.setIndex(Ht),this.setAttribute("position",new Float32BufferAttribute(Wt,3)),this.setAttribute("normal",new Float32BufferAttribute(qt,3)),this.setAttribute("uv",new Float32BufferAttribute(Xt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new RingGeometry(_e.innerRadius,_e.outerRadius,_e.thetaSegments,_e.phiSegments,_e.thetaStart,_e.thetaLength)}}class ShapeGeometry extends BufferGeometry{constructor(_e=new Shape([new Vector2(0,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),Dt=12){super(),this.type="ShapeGeometry",this.parameters={shapes:_e,curveSegments:Dt};const Vt=[],Gt=[],zt=[],jt=[];let Ht=0,Wt=0;if(Array.isArray(_e)===!1)qt(_e);else for(let Xt=0;Xt<_e.length;Xt++)qt(_e[Xt]),this.addGroup(Ht,Wt,Xt),Ht+=Wt,Wt=0;this.setIndex(Vt),this.setAttribute("position",new Float32BufferAttribute(Gt,3)),this.setAttribute("normal",new Float32BufferAttribute(zt,3)),this.setAttribute("uv",new Float32BufferAttribute(jt,2));function qt(Xt){const Kt=Gt.length/3,Yt=Xt.extractPoints(Dt);let Zt=Yt.shape;const Jt=Yt.holes;ShapeUtils.isClockWise(Zt)===!1&&(Zt=Zt.reverse());for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];ShapeUtils.isClockWise(en)===!0&&(Jt[rn]=en.reverse())}const nn=ShapeUtils.triangulateShape(Zt,Jt);for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];Zt=Zt.concat(en)}for(let rn=0,Qt=Zt.length;rn<Qt;rn++){const en=Zt[rn];Gt.push(en.x,en.y,0),zt.push(0,0,1),jt.push(en.x,en.y)}for(let rn=0,Qt=nn.length;rn<Qt;rn++){const en=nn[rn],tn=en[0]+Kt,sn=en[1]+Kt,cn=en[2]+Kt;Vt.push(tn,sn,cn),Wt+=3}}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON(),Dt=this.parameters.shapes;return toJSON(Dt,_e)}static fromJSON(_e,Dt){const Vt=[];for(let Gt=0,zt=_e.shapes.length;Gt<zt;Gt++){const jt=Dt[_e.shapes[Gt]];Vt.push(jt)}return new ShapeGeometry(Vt,_e.curveSegments)}}function toJSON(kt,_e){if(_e.shapes=[],Array.isArray(kt))for(let Dt=0,Vt=kt.length;Dt<Vt;Dt++){const Gt=kt[Dt];_e.shapes.push(Gt.uuid)}else _e.shapes.push(kt.uuid);return _e}class SphereGeometry extends BufferGeometry{constructor(_e=1,Dt=32,Vt=16,Gt=0,zt=Math.PI*2,jt=0,Ht=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:_e,widthSegments:Dt,heightSegments:Vt,phiStart:Gt,phiLength:zt,thetaStart:jt,thetaLength:Ht},Dt=Math.max(3,Math.floor(Dt)),Vt=Math.max(2,Math.floor(Vt));const Wt=Math.min(jt+Ht,Math.PI);let qt=0;const Xt=[],Kt=new Vector3,Yt=new Vector3,Zt=[],Jt=[],nn=[],rn=[];for(let Qt=0;Qt<=Vt;Qt++){const en=[],tn=Qt/Vt;let sn=0;Qt===0&&jt===0?sn=.5/Dt:Qt===Vt&&Wt===Math.PI&&(sn=-.5/Dt);for(let cn=0;cn<=Dt;cn++){const un=cn/Dt;Kt.x=-_e*Math.cos(Gt+un*zt)*Math.sin(jt+tn*Ht),Kt.y=_e*Math.cos(jt+tn*Ht),Kt.z=_e*Math.sin(Gt+un*zt)*Math.sin(jt+tn*Ht),Jt.push(Kt.x,Kt.y,Kt.z),Yt.copy(Kt).normalize(),nn.push(Yt.x,Yt.y,Yt.z),rn.push(un+sn,1-tn),en.push(qt++)}Xt.push(en)}for(let Qt=0;Qt<Vt;Qt++)for(let en=0;en<Dt;en++){const tn=Xt[Qt][en+1],sn=Xt[Qt][en],cn=Xt[Qt+1][en],un=Xt[Qt+1][en+1];(Qt!==0||jt>0)&&Zt.push(tn,sn,un),(Qt!==Vt-1||Wt<Math.PI)&&Zt.push(sn,cn,un)}this.setIndex(Zt),this.setAttribute("position",new Float32BufferAttribute(Jt,3)),this.setAttribute("normal",new Float32BufferAttribute(nn,3)),this.setAttribute("uv",new Float32BufferAttribute(rn,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new SphereGeometry(_e.radius,_e.widthSegments,_e.heightSegments,_e.phiStart,_e.phiLength,_e.thetaStart,_e.thetaLength)}}class TetrahedronGeometry extends PolyhedronGeometry{constructor(_e=1,Dt=0){const Vt=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],Gt=[2,1,0,0,3,2,1,3,0,2,3,1];super(Vt,Gt,_e,Dt),this.type="TetrahedronGeometry",this.parameters={radius:_e,detail:Dt}}static fromJSON(_e){return new TetrahedronGeometry(_e.radius,_e.detail)}}class TorusGeometry extends BufferGeometry{constructor(_e=1,Dt=.4,Vt=12,Gt=48,zt=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:_e,tube:Dt,radialSegments:Vt,tubularSegments:Gt,arc:zt},Vt=Math.floor(Vt),Gt=Math.floor(Gt);const jt=[],Ht=[],Wt=[],qt=[],Xt=new Vector3,Kt=new Vector3,Yt=new Vector3;for(let Zt=0;Zt<=Vt;Zt++)for(let Jt=0;Jt<=Gt;Jt++){const nn=Jt/Gt*zt,rn=Zt/Vt*Math.PI*2;Kt.x=(_e+Dt*Math.cos(rn))*Math.cos(nn),Kt.y=(_e+Dt*Math.cos(rn))*Math.sin(nn),Kt.z=Dt*Math.sin(rn),Ht.push(Kt.x,Kt.y,Kt.z),Xt.x=_e*Math.cos(nn),Xt.y=_e*Math.sin(nn),Yt.subVectors(Kt,Xt).normalize(),Wt.push(Yt.x,Yt.y,Yt.z),qt.push(Jt/Gt),qt.push(Zt/Vt)}for(let Zt=1;Zt<=Vt;Zt++)for(let Jt=1;Jt<=Gt;Jt++){const nn=(Gt+1)*Zt+Jt-1,rn=(Gt+1)*(Zt-1)+Jt-1,Qt=(Gt+1)*(Zt-1)+Jt,en=(Gt+1)*Zt+Jt;jt.push(nn,rn,en),jt.push(rn,Qt,en)}this.setIndex(jt),this.setAttribute("position",new Float32BufferAttribute(Ht,3)),this.setAttribute("normal",new Float32BufferAttribute(Wt,3)),this.setAttribute("uv",new Float32BufferAttribute(qt,2))}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new TorusGeometry(_e.radius,_e.tube,_e.radialSegments,_e.tubularSegments,_e.arc)}}class TorusKnotGeometry extends BufferGeometry{constructor(_e=1,Dt=.4,Vt=64,Gt=8,zt=2,jt=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:_e,tube:Dt,tubularSegments:Vt,radialSegments:Gt,p:zt,q:jt},Vt=Math.floor(Vt),Gt=Math.floor(Gt);const Ht=[],Wt=[],qt=[],Xt=[],Kt=new Vector3,Yt=new Vector3,Zt=new Vector3,Jt=new Vector3,nn=new Vector3,rn=new Vector3,Qt=new Vector3;for(let tn=0;tn<=Vt;++tn){const sn=tn/Vt*zt*Math.PI*2;en(sn,zt,jt,_e,Zt),en(sn+.01,zt,jt,_e,Jt),rn.subVectors(Jt,Zt),Qt.addVectors(Jt,Zt),nn.crossVectors(rn,Qt),Qt.crossVectors(nn,rn),nn.normalize(),Qt.normalize();for(let cn=0;cn<=Gt;++cn){const un=cn/Gt*Math.PI*2,hn=-Dt*Math.cos(un),fn=Dt*Math.sin(un);Kt.x=Zt.x+(hn*Qt.x+fn*nn.x),Kt.y=Zt.y+(hn*Qt.y+fn*nn.y),Kt.z=Zt.z+(hn*Qt.z+fn*nn.z),Wt.push(Kt.x,Kt.y,Kt.z),Yt.subVectors(Kt,Zt).normalize(),qt.push(Yt.x,Yt.y,Yt.z),Xt.push(tn/Vt),Xt.push(cn/Gt)}}for(let tn=1;tn<=Vt;tn++)for(let sn=1;sn<=Gt;sn++){const cn=(Gt+1)*(tn-1)+(sn-1),un=(Gt+1)*tn+(sn-1),hn=(Gt+1)*tn+sn,fn=(Gt+1)*(tn-1)+sn;Ht.push(cn,un,fn),Ht.push(un,hn,fn)}this.setIndex(Ht),this.setAttribute("position",new Float32BufferAttribute(Wt,3)),this.setAttribute("normal",new Float32BufferAttribute(qt,3)),this.setAttribute("uv",new Float32BufferAttribute(Xt,2));function en(tn,sn,cn,un,hn){const fn=Math.cos(tn),pn=Math.sin(tn),dn=cn/sn*tn,mn=Math.cos(dn);hn.x=un*(2+mn)*.5*fn,hn.y=un*(2+mn)*pn*.5,hn.z=un*Math.sin(dn)*.5}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}static fromJSON(_e){return new TorusKnotGeometry(_e.radius,_e.tube,_e.tubularSegments,_e.radialSegments,_e.p,_e.q)}}class TubeGeometry extends BufferGeometry{constructor(_e=new QuadraticBezierCurve3(new Vector3(-1,-1,0),new Vector3(-1,1,0),new Vector3(1,1,0)),Dt=64,Vt=1,Gt=8,zt=!1){super(),this.type="TubeGeometry",this.parameters={path:_e,tubularSegments:Dt,radius:Vt,radialSegments:Gt,closed:zt};const jt=_e.computeFrenetFrames(Dt,zt);this.tangents=jt.tangents,this.normals=jt.normals,this.binormals=jt.binormals;const Ht=new Vector3,Wt=new Vector3,qt=new Vector2;let Xt=new Vector3;const Kt=[],Yt=[],Zt=[],Jt=[];nn(),this.setIndex(Jt),this.setAttribute("position",new Float32BufferAttribute(Kt,3)),this.setAttribute("normal",new Float32BufferAttribute(Yt,3)),this.setAttribute("uv",new Float32BufferAttribute(Zt,2));function nn(){for(let tn=0;tn<Dt;tn++)rn(tn);rn(zt===!1?Dt:0),en(),Qt()}function rn(tn){Xt=_e.getPointAt(tn/Dt,Xt);const sn=jt.normals[tn],cn=jt.binormals[tn];for(let un=0;un<=Gt;un++){const hn=un/Gt*Math.PI*2,fn=Math.sin(hn),pn=-Math.cos(hn);Wt.x=pn*sn.x+fn*cn.x,Wt.y=pn*sn.y+fn*cn.y,Wt.z=pn*sn.z+fn*cn.z,Wt.normalize(),Yt.push(Wt.x,Wt.y,Wt.z),Ht.x=Xt.x+Vt*Wt.x,Ht.y=Xt.y+Vt*Wt.y,Ht.z=Xt.z+Vt*Wt.z,Kt.push(Ht.x,Ht.y,Ht.z)}}function Qt(){for(let tn=1;tn<=Dt;tn++)for(let sn=1;sn<=Gt;sn++){const cn=(Gt+1)*(tn-1)+(sn-1),un=(Gt+1)*tn+(sn-1),hn=(Gt+1)*tn+sn,fn=(Gt+1)*(tn-1)+sn;Jt.push(cn,un,fn),Jt.push(un,hn,fn)}}function en(){for(let tn=0;tn<=Dt;tn++)for(let sn=0;sn<=Gt;sn++)qt.x=tn/Dt,qt.y=sn/Gt,Zt.push(qt.x,qt.y)}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}toJSON(){const _e=super.toJSON();return _e.path=this.parameters.path.toJSON(),_e}static fromJSON(_e){return new TubeGeometry(new Curves[_e.path.type]().fromJSON(_e.path),_e.tubularSegments,_e.radius,_e.radialSegments,_e.closed)}}class WireframeGeometry extends BufferGeometry{constructor(_e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:_e},_e!==null){const Dt=[],Vt=new Set,Gt=new Vector3,zt=new Vector3;if(_e.index!==null){const jt=_e.attributes.position,Ht=_e.index;let Wt=_e.groups;Wt.length===0&&(Wt=[{start:0,count:Ht.count,materialIndex:0}]);for(let qt=0,Xt=Wt.length;qt<Xt;++qt){const Kt=Wt[qt],Yt=Kt.start,Zt=Kt.count;for(let Jt=Yt,nn=Yt+Zt;Jt<nn;Jt+=3)for(let rn=0;rn<3;rn++){const Qt=Ht.getX(Jt+rn),en=Ht.getX(Jt+(rn+1)%3);Gt.fromBufferAttribute(jt,Qt),zt.fromBufferAttribute(jt,en),isUniqueEdge(Gt,zt,Vt)===!0&&(Dt.push(Gt.x,Gt.y,Gt.z),Dt.push(zt.x,zt.y,zt.z))}}}else{const jt=_e.attributes.position;for(let Ht=0,Wt=jt.count/3;Ht<Wt;Ht++)for(let qt=0;qt<3;qt++){const Xt=3*Ht+qt,Kt=3*Ht+(qt+1)%3;Gt.fromBufferAttribute(jt,Xt),zt.fromBufferAttribute(jt,Kt),isUniqueEdge(Gt,zt,Vt)===!0&&(Dt.push(Gt.x,Gt.y,Gt.z),Dt.push(zt.x,zt.y,zt.z))}}this.setAttribute("position",new Float32BufferAttribute(Dt,3))}}copy(_e){return super.copy(_e),this.parameters=Object.assign({},_e.parameters),this}}function isUniqueEdge(kt,_e,Dt){const Vt=`${kt.x},${kt.y},${kt.z}-${_e.x},${_e.y},${_e.z}`,Gt=`${_e.x},${_e.y},${_e.z}-${kt.x},${kt.y},${kt.z}`;return Dt.has(Vt)===!0||Dt.has(Gt)===!0?!1:(Dt.add(Vt),Dt.add(Gt),!0)}var Geometries=Object.freeze({__proto__:null,BoxGeometry,CapsuleGeometry,CircleGeometry,ConeGeometry,CylinderGeometry,DodecahedronGeometry,EdgesGeometry,ExtrudeGeometry,IcosahedronGeometry,LatheGeometry,OctahedronGeometry,PlaneGeometry,PolyhedronGeometry,RingGeometry,ShapeGeometry,SphereGeometry,TetrahedronGeometry,TorusGeometry,TorusKnotGeometry,TubeGeometry,WireframeGeometry});class ShadowMaterial extends Material{constructor(_e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Color$1(0),this.transparent=!0,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.fog=_e.fog,this}}class RawShaderMaterial extends ShaderMaterial{constructor(_e){super(_e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class MeshStandardMaterial extends Material{constructor(_e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Color$1(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.defines={STANDARD:""},this.color.copy(_e.color),this.roughness=_e.roughness,this.metalness=_e.metalness,this.map=_e.map,this.lightMap=_e.lightMap,this.lightMapIntensity=_e.lightMapIntensity,this.aoMap=_e.aoMap,this.aoMapIntensity=_e.aoMapIntensity,this.emissive.copy(_e.emissive),this.emissiveMap=_e.emissiveMap,this.emissiveIntensity=_e.emissiveIntensity,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,this.roughnessMap=_e.roughnessMap,this.metalnessMap=_e.metalnessMap,this.alphaMap=_e.alphaMap,this.envMap=_e.envMap,this.envMapRotation.copy(_e.envMapRotation),this.envMapIntensity=_e.envMapIntensity,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.wireframeLinecap=_e.wireframeLinecap,this.wireframeLinejoin=_e.wireframeLinejoin,this.flatShading=_e.flatShading,this.fog=_e.fog,this}}class MeshPhysicalMaterial extends MeshStandardMaterial{constructor(_e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Vector2(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return clamp$2(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(Dt){this.ior=(1+.4*Dt)/(1-.4*Dt)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Color$1(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Color$1(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Color$1(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(_e)}get anisotropy(){return this._anisotropy}set anisotropy(_e){this._anisotropy>0!=_e>0&&this.version++,this._anisotropy=_e}get clearcoat(){return this._clearcoat}set clearcoat(_e){this._clearcoat>0!=_e>0&&this.version++,this._clearcoat=_e}get iridescence(){return this._iridescence}set iridescence(_e){this._iridescence>0!=_e>0&&this.version++,this._iridescence=_e}get sheen(){return this._sheen}set sheen(_e){this._sheen>0!=_e>0&&this.version++,this._sheen=_e}get transmission(){return this._transmission}set transmission(_e){this._transmission>0!=_e>0&&this.version++,this._transmission=_e}copy(_e){return super.copy(_e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=_e.anisotropy,this.anisotropyRotation=_e.anisotropyRotation,this.anisotropyMap=_e.anisotropyMap,this.clearcoat=_e.clearcoat,this.clearcoatMap=_e.clearcoatMap,this.clearcoatRoughness=_e.clearcoatRoughness,this.clearcoatRoughnessMap=_e.clearcoatRoughnessMap,this.clearcoatNormalMap=_e.clearcoatNormalMap,this.clearcoatNormalScale.copy(_e.clearcoatNormalScale),this.ior=_e.ior,this.iridescence=_e.iridescence,this.iridescenceMap=_e.iridescenceMap,this.iridescenceIOR=_e.iridescenceIOR,this.iridescenceThicknessRange=[..._e.iridescenceThicknessRange],this.iridescenceThicknessMap=_e.iridescenceThicknessMap,this.sheen=_e.sheen,this.sheenColor.copy(_e.sheenColor),this.sheenColorMap=_e.sheenColorMap,this.sheenRoughness=_e.sheenRoughness,this.sheenRoughnessMap=_e.sheenRoughnessMap,this.transmission=_e.transmission,this.transmissionMap=_e.transmissionMap,this.thickness=_e.thickness,this.thicknessMap=_e.thicknessMap,this.attenuationDistance=_e.attenuationDistance,this.attenuationColor.copy(_e.attenuationColor),this.specularIntensity=_e.specularIntensity,this.specularIntensityMap=_e.specularIntensityMap,this.specularColor.copy(_e.specularColor),this.specularColorMap=_e.specularColorMap,this}}class MeshPhongMaterial extends Material{constructor(_e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Color$1(16777215),this.specular=new Color$1(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.combine=MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.color.copy(_e.color),this.specular.copy(_e.specular),this.shininess=_e.shininess,this.map=_e.map,this.lightMap=_e.lightMap,this.lightMapIntensity=_e.lightMapIntensity,this.aoMap=_e.aoMap,this.aoMapIntensity=_e.aoMapIntensity,this.emissive.copy(_e.emissive),this.emissiveMap=_e.emissiveMap,this.emissiveIntensity=_e.emissiveIntensity,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,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.flatShading=_e.flatShading,this.fog=_e.fog,this}}class MeshToonMaterial extends Material{constructor(_e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Color$1(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=_e.gradientMap,this.lightMap=_e.lightMap,this.lightMapIntensity=_e.lightMapIntensity,this.aoMap=_e.aoMap,this.aoMapIntensity=_e.aoMapIntensity,this.emissive.copy(_e.emissive),this.emissiveMap=_e.emissiveMap,this.emissiveIntensity=_e.emissiveIntensity,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,this.alphaMap=_e.alphaMap,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.wireframeLinecap=_e.wireframeLinecap,this.wireframeLinejoin=_e.wireframeLinejoin,this.fog=_e.fog,this}}class MeshNormalMaterial extends Material{constructor(_e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(_e)}copy(_e){return super.copy(_e),this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,this.wireframe=_e.wireframe,this.wireframeLinewidth=_e.wireframeLinewidth,this.flatShading=_e.flatShading,this}}class MeshLambertMaterial extends Material{constructor(_e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Color$1(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color$1(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.combine=MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.emissive.copy(_e.emissive),this.emissiveMap=_e.emissiveMap,this.emissiveIntensity=_e.emissiveIntensity,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,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.flatShading=_e.flatShading,this.fog=_e.fog,this}}class MeshMatcapMaterial extends Material{constructor(_e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Color$1(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TangentSpaceNormalMap,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(_e)}copy(_e){return super.copy(_e),this.defines={MATCAP:""},this.color.copy(_e.color),this.matcap=_e.matcap,this.map=_e.map,this.bumpMap=_e.bumpMap,this.bumpScale=_e.bumpScale,this.normalMap=_e.normalMap,this.normalMapType=_e.normalMapType,this.normalScale.copy(_e.normalScale),this.displacementMap=_e.displacementMap,this.displacementScale=_e.displacementScale,this.displacementBias=_e.displacementBias,this.alphaMap=_e.alphaMap,this.flatShading=_e.flatShading,this.fog=_e.fog,this}}class LineDashedMaterial extends LineBasicMaterial{constructor(_e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(_e)}copy(_e){return super.copy(_e),this.scale=_e.scale,this.dashSize=_e.dashSize,this.gapSize=_e.gapSize,this}}function convertArray(kt,_e,Dt){return!kt||!Dt&&kt.constructor===_e?kt:typeof _e.BYTES_PER_ELEMENT=="number"?new _e(kt):Array.prototype.slice.call(kt)}function isTypedArray(kt){return ArrayBuffer.isView(kt)&&!(kt instanceof DataView)}function getKeyframeOrder(kt){function _e(Gt,zt){return kt[Gt]-kt[zt]}const Dt=kt.length,Vt=new Array(Dt);for(let Gt=0;Gt!==Dt;++Gt)Vt[Gt]=Gt;return Vt.sort(_e),Vt}function sortedArray(kt,_e,Dt){const Vt=kt.length,Gt=new kt.constructor(Vt);for(let zt=0,jt=0;jt!==Vt;++zt){const Ht=Dt[zt]*_e;for(let Wt=0;Wt!==_e;++Wt)Gt[jt++]=kt[Ht+Wt]}return Gt}function flattenJSON(kt,_e,Dt,Vt){let Gt=1,zt=kt[0];for(;zt!==void 0&&zt[Vt]===void 0;)zt=kt[Gt++];if(zt===void 0)return;let jt=zt[Vt];if(jt!==void 0)if(Array.isArray(jt))do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),Dt.push.apply(Dt,jt)),zt=kt[Gt++];while(zt!==void 0);else if(jt.toArray!==void 0)do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),jt.toArray(Dt,Dt.length)),zt=kt[Gt++];while(zt!==void 0);else do jt=zt[Vt],jt!==void 0&&(_e.push(zt.time),Dt.push(jt)),zt=kt[Gt++];while(zt!==void 0)}function subclip(kt,_e,Dt,Vt,Gt=30){const zt=kt.clone();zt.name=_e;const jt=[];for(let Wt=0;Wt<zt.tracks.length;++Wt){const qt=zt.tracks[Wt],Xt=qt.getValueSize(),Kt=[],Yt=[];for(let Zt=0;Zt<qt.times.length;++Zt){const Jt=qt.times[Zt]*Gt;if(!(Jt<Dt||Jt>=Vt)){Kt.push(qt.times[Zt]);for(let nn=0;nn<Xt;++nn)Yt.push(qt.values[Zt*Xt+nn])}}Kt.length!==0&&(qt.times=convertArray(Kt,qt.times.constructor),qt.values=convertArray(Yt,qt.values.constructor),jt.push(qt))}zt.tracks=jt;let Ht=1/0;for(let Wt=0;Wt<zt.tracks.length;++Wt)Ht>zt.tracks[Wt].times[0]&&(Ht=zt.tracks[Wt].times[0]);for(let Wt=0;Wt<zt.tracks.length;++Wt)zt.tracks[Wt].shift(-1*Ht);return zt.resetDuration(),zt}function makeClipAdditive(kt,_e=0,Dt=kt,Vt=30){Vt<=0&&(Vt=30);const Gt=Dt.tracks.length,zt=_e/Vt;for(let jt=0;jt<Gt;++jt){const Ht=Dt.tracks[jt],Wt=Ht.ValueTypeName;if(Wt==="bool"||Wt==="string")continue;const qt=kt.tracks.find(function(Qt){return Qt.name===Ht.name&&Qt.ValueTypeName===Wt});if(qt===void 0)continue;let Xt=0;const Kt=Ht.getValueSize();Ht.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(Xt=Kt/3);let Yt=0;const Zt=qt.getValueSize();qt.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(Yt=Zt/3);const Jt=Ht.times.length-1;let nn;if(zt<=Ht.times[0]){const Qt=Xt,en=Kt-Xt;nn=Ht.values.slice(Qt,en)}else if(zt>=Ht.times[Jt]){const Qt=Jt*Kt+Xt,en=Qt+Kt-Xt;nn=Ht.values.slice(Qt,en)}else{const Qt=Ht.createInterpolant(),en=Xt,tn=Kt-Xt;Qt.evaluate(zt),nn=Qt.resultBuffer.slice(en,tn)}Wt==="quaternion"&&new Quaternion().fromArray(nn).normalize().conjugate().toArray(nn);const rn=qt.times.length;for(let Qt=0;Qt<rn;++Qt){const en=Qt*Zt+Yt;if(Wt==="quaternion")Quaternion.multiplyQuaternionsFlat(qt.values,en,nn,0,qt.values,en);else{const tn=Zt-Yt*2;for(let sn=0;sn<tn;++sn)qt.values[en+sn]-=nn[sn]}}}return kt.blendMode=AdditiveAnimationBlendMode,kt}const AnimationUtils={convertArray,isTypedArray,getKeyframeOrder,sortedArray,flattenJSON,subclip,makeClipAdditive};class Interpolant{constructor(_e,Dt,Vt,Gt){this.parameterPositions=_e,this._cachedIndex=0,this.resultBuffer=Gt!==void 0?Gt:new Dt.constructor(Vt),this.sampleValues=Dt,this.valueSize=Vt,this.settings=null,this.DefaultSettings_={}}evaluate(_e){const Dt=this.parameterPositions;let Vt=this._cachedIndex,Gt=Dt[Vt],zt=Dt[Vt-1];e:{t:{let jt;n:{r:if(!(_e<Gt)){for(let Ht=Vt+2;;){if(Gt===void 0){if(_e<zt)break r;return Vt=Dt.length,this._cachedIndex=Vt,this.copySampleValue_(Vt-1)}if(Vt===Ht)break;if(zt=Gt,Gt=Dt[++Vt],_e<Gt)break t}jt=Dt.length;break n}if(!(_e>=zt)){const Ht=Dt[1];_e<Ht&&(Vt=2,zt=Ht);for(let Wt=Vt-2;;){if(zt===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Vt===Wt)break;if(Gt=zt,zt=Dt[--Vt-1],_e>=zt)break t}jt=Vt,Vt=0;break n}break e}for(;Vt<jt;){const Ht=Vt+jt>>>1;_e<Dt[Ht]?jt=Ht:Vt=Ht+1}if(Gt=Dt[Vt],zt=Dt[Vt-1],zt===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Gt===void 0)return Vt=Dt.length,this._cachedIndex=Vt,this.copySampleValue_(Vt-1)}this._cachedIndex=Vt,this.intervalChanged_(Vt,zt,Gt)}return this.interpolate_(Vt,zt,_e,Gt)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(_e){const Dt=this.resultBuffer,Vt=this.sampleValues,Gt=this.valueSize,zt=_e*Gt;for(let jt=0;jt!==Gt;++jt)Dt[jt]=Vt[zt+jt];return Dt}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class CubicInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding}}intervalChanged_(_e,Dt,Vt){const Gt=this.parameterPositions;let zt=_e-2,jt=_e+1,Ht=Gt[zt],Wt=Gt[jt];if(Ht===void 0)switch(this.getSettings_().endingStart){case ZeroSlopeEnding:zt=_e,Ht=2*Dt-Vt;break;case WrapAroundEnding:zt=Gt.length-2,Ht=Dt+Gt[zt]-Gt[zt+1];break;default:zt=_e,Ht=Vt}if(Wt===void 0)switch(this.getSettings_().endingEnd){case ZeroSlopeEnding:jt=_e,Wt=2*Vt-Dt;break;case WrapAroundEnding:jt=1,Wt=Vt+Gt[1]-Gt[0];break;default:jt=_e-1,Wt=Dt}const qt=(Vt-Dt)*.5,Xt=this.valueSize;this._weightPrev=qt/(Dt-Ht),this._weightNext=qt/(Wt-Vt),this._offsetPrev=zt*Xt,this._offsetNext=jt*Xt}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=_e*Ht,qt=Wt-Ht,Xt=this._offsetPrev,Kt=this._offsetNext,Yt=this._weightPrev,Zt=this._weightNext,Jt=(Vt-Dt)/(Gt-Dt),nn=Jt*Jt,rn=nn*Jt,Qt=-Yt*rn+2*Yt*nn-Yt*Jt,en=(1+Yt)*rn+(-1.5-2*Yt)*nn+(-.5+Yt)*Jt+1,tn=(-1-Zt)*rn+(1.5+Zt)*nn+.5*Jt,sn=Zt*rn-Zt*nn;for(let cn=0;cn!==Ht;++cn)zt[cn]=Qt*jt[Xt+cn]+en*jt[qt+cn]+tn*jt[Wt+cn]+sn*jt[Kt+cn];return zt}}class LinearInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=_e*Ht,qt=Wt-Ht,Xt=(Vt-Dt)/(Gt-Dt),Kt=1-Xt;for(let Yt=0;Yt!==Ht;++Yt)zt[Yt]=jt[qt+Yt]*Kt+jt[Wt+Yt]*Xt;return zt}}class DiscreteInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e){return this.copySampleValue_(_e-1)}}class KeyframeTrack{constructor(_e,Dt,Vt,Gt){if(_e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(Dt===void 0||Dt.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+_e);this.name=_e,this.times=convertArray(Dt,this.TimeBufferType),this.values=convertArray(Vt,this.ValueBufferType),this.setInterpolation(Gt||this.DefaultInterpolation)}static toJSON(_e){const Dt=_e.constructor;let Vt;if(Dt.toJSON!==this.toJSON)Vt=Dt.toJSON(_e);else{Vt={name:_e.name,times:convertArray(_e.times,Array),values:convertArray(_e.values,Array)};const Gt=_e.getInterpolation();Gt!==_e.DefaultInterpolation&&(Vt.interpolation=Gt)}return Vt.type=_e.ValueTypeName,Vt}InterpolantFactoryMethodDiscrete(_e){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),_e)}InterpolantFactoryMethodLinear(_e){return new LinearInterpolant(this.times,this.values,this.getValueSize(),_e)}InterpolantFactoryMethodSmooth(_e){return new CubicInterpolant(this.times,this.values,this.getValueSize(),_e)}setInterpolation(_e){let Dt;switch(_e){case InterpolateDiscrete:Dt=this.InterpolantFactoryMethodDiscrete;break;case InterpolateLinear:Dt=this.InterpolantFactoryMethodLinear;break;case InterpolateSmooth:Dt=this.InterpolantFactoryMethodSmooth;break}if(Dt===void 0){const Vt="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(_e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(Vt);return console.warn("THREE.KeyframeTrack:",Vt),this}return this.createInterpolant=Dt,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return InterpolateSmooth}}getValueSize(){return this.values.length/this.times.length}shift(_e){if(_e!==0){const Dt=this.times;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt)Dt[Vt]+=_e}return this}scale(_e){if(_e!==1){const Dt=this.times;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt)Dt[Vt]*=_e}return this}trim(_e,Dt){const Vt=this.times,Gt=Vt.length;let zt=0,jt=Gt-1;for(;zt!==Gt&&Vt[zt]<_e;)++zt;for(;jt!==-1&&Vt[jt]>Dt;)--jt;if(++jt,zt!==0||jt!==Gt){zt>=jt&&(jt=Math.max(jt,1),zt=jt-1);const Ht=this.getValueSize();this.times=Vt.slice(zt,jt),this.values=this.values.slice(zt*Ht,jt*Ht)}return this}validate(){let _e=!0;const Dt=this.getValueSize();Dt-Math.floor(Dt)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),_e=!1);const Vt=this.times,Gt=this.values,zt=Vt.length;zt===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),_e=!1);let jt=null;for(let Ht=0;Ht!==zt;Ht++){const Wt=Vt[Ht];if(typeof Wt=="number"&&isNaN(Wt)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,Ht,Wt),_e=!1;break}if(jt!==null&&jt>Wt){console.error("THREE.KeyframeTrack: Out of order keys.",this,Ht,Wt,jt),_e=!1;break}jt=Wt}if(Gt!==void 0&&isTypedArray(Gt))for(let Ht=0,Wt=Gt.length;Ht!==Wt;++Ht){const qt=Gt[Ht];if(isNaN(qt)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,Ht,qt),_e=!1;break}}return _e}optimize(){const _e=this.times.slice(),Dt=this.values.slice(),Vt=this.getValueSize(),Gt=this.getInterpolation()===InterpolateSmooth,zt=_e.length-1;let jt=1;for(let Ht=1;Ht<zt;++Ht){let Wt=!1;const qt=_e[Ht],Xt=_e[Ht+1];if(qt!==Xt&&(Ht!==1||qt!==_e[0]))if(Gt)Wt=!0;else{const Kt=Ht*Vt,Yt=Kt-Vt,Zt=Kt+Vt;for(let Jt=0;Jt!==Vt;++Jt){const nn=Dt[Kt+Jt];if(nn!==Dt[Yt+Jt]||nn!==Dt[Zt+Jt]){Wt=!0;break}}}if(Wt){if(Ht!==jt){_e[jt]=_e[Ht];const Kt=Ht*Vt,Yt=jt*Vt;for(let Zt=0;Zt!==Vt;++Zt)Dt[Yt+Zt]=Dt[Kt+Zt]}++jt}}if(zt>0){_e[jt]=_e[zt];for(let Ht=zt*Vt,Wt=jt*Vt,qt=0;qt!==Vt;++qt)Dt[Wt+qt]=Dt[Ht+qt];++jt}return jt!==_e.length?(this.times=_e.slice(0,jt),this.values=Dt.slice(0,jt*Vt)):(this.times=_e,this.values=Dt),this}clone(){const _e=this.times.slice(),Dt=this.values.slice(),Vt=this.constructor,Gt=new Vt(this.name,_e,Dt);return Gt.createInterpolant=this.createInterpolant,Gt}}KeyframeTrack.prototype.TimeBufferType=Float32Array;KeyframeTrack.prototype.ValueBufferType=Float32Array;KeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;class BooleanKeyframeTrack extends KeyframeTrack{}BooleanKeyframeTrack.prototype.ValueTypeName="bool";BooleanKeyframeTrack.prototype.ValueBufferType=Array;BooleanKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class ColorKeyframeTrack extends KeyframeTrack{}ColorKeyframeTrack.prototype.ValueTypeName="color";class NumberKeyframeTrack extends KeyframeTrack{}NumberKeyframeTrack.prototype.ValueTypeName="number";class QuaternionLinearInterpolant extends Interpolant{constructor(_e,Dt,Vt,Gt){super(_e,Dt,Vt,Gt)}interpolate_(_e,Dt,Vt,Gt){const zt=this.resultBuffer,jt=this.sampleValues,Ht=this.valueSize,Wt=(Vt-Dt)/(Gt-Dt);let qt=_e*Ht;for(let Xt=qt+Ht;qt!==Xt;qt+=4)Quaternion.slerpFlat(zt,0,jt,qt-Ht,jt,qt,Wt);return zt}}class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(_e){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),_e)}}QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion";QuaternionKeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class StringKeyframeTrack extends KeyframeTrack{}StringKeyframeTrack.prototype.ValueTypeName="string";StringKeyframeTrack.prototype.ValueBufferType=Array;StringKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0;StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class VectorKeyframeTrack extends KeyframeTrack{}VectorKeyframeTrack.prototype.ValueTypeName="vector";class AnimationClip{constructor(_e="",Dt=-1,Vt=[],Gt=NormalAnimationBlendMode){this.name=_e,this.tracks=Vt,this.duration=Dt,this.blendMode=Gt,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}static parse(_e){const Dt=[],Vt=_e.tracks,Gt=1/(_e.fps||1);for(let jt=0,Ht=Vt.length;jt!==Ht;++jt)Dt.push(parseKeyframeTrack(Vt[jt]).scale(Gt));const zt=new this(_e.name,_e.duration,Dt,_e.blendMode);return zt.uuid=_e.uuid,zt}static toJSON(_e){const Dt=[],Vt=_e.tracks,Gt={name:_e.name,duration:_e.duration,tracks:Dt,uuid:_e.uuid,blendMode:_e.blendMode};for(let zt=0,jt=Vt.length;zt!==jt;++zt)Dt.push(KeyframeTrack.toJSON(Vt[zt]));return Gt}static CreateFromMorphTargetSequence(_e,Dt,Vt,Gt){const zt=Dt.length,jt=[];for(let Ht=0;Ht<zt;Ht++){let Wt=[],qt=[];Wt.push((Ht+zt-1)%zt,Ht,(Ht+1)%zt),qt.push(0,1,0);const Xt=getKeyframeOrder(Wt);Wt=sortedArray(Wt,1,Xt),qt=sortedArray(qt,1,Xt),!Gt&&Wt[0]===0&&(Wt.push(zt),qt.push(qt[0])),jt.push(new NumberKeyframeTrack(".morphTargetInfluences["+Dt[Ht].name+"]",Wt,qt).scale(1/Vt))}return new this(_e,-1,jt)}static findByName(_e,Dt){let Vt=_e;if(!Array.isArray(_e)){const Gt=_e;Vt=Gt.geometry&&Gt.geometry.animations||Gt.animations}for(let Gt=0;Gt<Vt.length;Gt++)if(Vt[Gt].name===Dt)return Vt[Gt];return null}static CreateClipsFromMorphTargetSequences(_e,Dt,Vt){const Gt={},zt=/^([\w-]*?)([\d]+)$/;for(let Ht=0,Wt=_e.length;Ht<Wt;Ht++){const qt=_e[Ht],Xt=qt.name.match(zt);if(Xt&&Xt.length>1){const Kt=Xt[1];let Yt=Gt[Kt];Yt||(Gt[Kt]=Yt=[]),Yt.push(qt)}}const jt=[];for(const Ht in Gt)jt.push(this.CreateFromMorphTargetSequence(Ht,Gt[Ht],Dt,Vt));return jt}static parseAnimation(_e,Dt){if(!_e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const Vt=function(Kt,Yt,Zt,Jt,nn){if(Zt.length!==0){const rn=[],Qt=[];flattenJSON(Zt,rn,Qt,Jt),rn.length!==0&&nn.push(new Kt(Yt,rn,Qt))}},Gt=[],zt=_e.name||"default",jt=_e.fps||30,Ht=_e.blendMode;let Wt=_e.length||-1;const qt=_e.hierarchy||[];for(let Kt=0;Kt<qt.length;Kt++){const Yt=qt[Kt].keys;if(!(!Yt||Yt.length===0))if(Yt[0].morphTargets){const Zt={};let Jt;for(Jt=0;Jt<Yt.length;Jt++)if(Yt[Jt].morphTargets)for(let nn=0;nn<Yt[Jt].morphTargets.length;nn++)Zt[Yt[Jt].morphTargets[nn]]=-1;for(const nn in Zt){const rn=[],Qt=[];for(let en=0;en!==Yt[Jt].morphTargets.length;++en){const tn=Yt[Jt];rn.push(tn.time),Qt.push(tn.morphTarget===nn?1:0)}Gt.push(new NumberKeyframeTrack(".morphTargetInfluence["+nn+"]",rn,Qt))}Wt=Zt.length*jt}else{const Zt=".bones["+Dt[Kt].name+"]";Vt(VectorKeyframeTrack,Zt+".position",Yt,"pos",Gt),Vt(QuaternionKeyframeTrack,Zt+".quaternion",Yt,"rot",Gt),Vt(VectorKeyframeTrack,Zt+".scale",Yt,"scl",Gt)}}return Gt.length===0?null:new this(zt,Wt,Gt,Ht)}resetDuration(){const _e=this.tracks;let Dt=0;for(let Vt=0,Gt=_e.length;Vt!==Gt;++Vt){const zt=this.tracks[Vt];Dt=Math.max(Dt,zt.times[zt.times.length-1])}return this.duration=Dt,this}trim(){for(let _e=0;_e<this.tracks.length;_e++)this.tracks[_e].trim(0,this.duration);return this}validate(){let _e=!0;for(let Dt=0;Dt<this.tracks.length;Dt++)_e=_e&&this.tracks[Dt].validate();return _e}optimize(){for(let _e=0;_e<this.tracks.length;_e++)this.tracks[_e].optimize();return this}clone(){const _e=[];for(let Dt=0;Dt<this.tracks.length;Dt++)_e.push(this.tracks[Dt].clone());return new this.constructor(this.name,this.duration,_e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function getTrackTypeForValueTypeName(kt){switch(kt.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return VectorKeyframeTrack;case"color":return ColorKeyframeTrack;case"quaternion":return QuaternionKeyframeTrack;case"bool":case"boolean":return BooleanKeyframeTrack;case"string":return StringKeyframeTrack}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+kt)}function parseKeyframeTrack(kt){if(kt.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const _e=getTrackTypeForValueTypeName(kt.type);if(kt.times===void 0){const Dt=[],Vt=[];flattenJSON(kt.keys,Dt,Vt,"value"),kt.times=Dt,kt.values=Vt}return _e.parse!==void 0?_e.parse(kt):new _e(kt.name,kt.times,kt.values,kt.interpolation)}const Cache={enabled:!1,files:{},add:function(kt,_e){this.enabled!==!1&&(this.files[kt]=_e)},get:function(kt){if(this.enabled!==!1)return this.files[kt]},remove:function(kt){delete this.files[kt]},clear:function(){this.files={}}};class LoadingManager{constructor(_e,Dt,Vt){const Gt=this;let zt=!1,jt=0,Ht=0,Wt;const qt=[];this.onStart=void 0,this.onLoad=_e,this.onProgress=Dt,this.onError=Vt,this.itemStart=function(Xt){Ht++,zt===!1&&Gt.onStart!==void 0&&Gt.onStart(Xt,jt,Ht),zt=!0},this.itemEnd=function(Xt){jt++,Gt.onProgress!==void 0&&Gt.onProgress(Xt,jt,Ht),jt===Ht&&(zt=!1,Gt.onLoad!==void 0&&Gt.onLoad())},this.itemError=function(Xt){Gt.onError!==void 0&&Gt.onError(Xt)},this.resolveURL=function(Xt){return Wt?Wt(Xt):Xt},this.setURLModifier=function(Xt){return Wt=Xt,this},this.addHandler=function(Xt,Kt){return qt.push(Xt,Kt),this},this.removeHandler=function(Xt){const Kt=qt.indexOf(Xt);return Kt!==-1&&qt.splice(Kt,2),this},this.getHandler=function(Xt){for(let Kt=0,Yt=qt.length;Kt<Yt;Kt+=2){const Zt=qt[Kt],Jt=qt[Kt+1];if(Zt.global&&(Zt.lastIndex=0),Zt.test(Xt))return Jt}return null}}}const DefaultLoadingManager=new LoadingManager;class Loader{constructor(_e){this.manager=_e!==void 0?_e:DefaultLoadingManager,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(_e,Dt){const Vt=this;return new Promise(function(Gt,zt){Vt.load(_e,Gt,Dt,zt)})}parse(){}setCrossOrigin(_e){return this.crossOrigin=_e,this}setWithCredentials(_e){return this.withCredentials=_e,this}setPath(_e){return this.path=_e,this}setResourcePath(_e){return this.resourcePath=_e,this}setRequestHeader(_e){return this.requestHeader=_e,this}}Loader.DEFAULT_MATERIAL_NAME="__DEFAULT";const loading={};class HttpError extends Error{constructor(_e,Dt){super(_e),this.response=Dt}}class FileLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){_e===void 0&&(_e=""),this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=Cache.get(_e);if(zt!==void 0)return this.manager.itemStart(_e),setTimeout(()=>{Dt&&Dt(zt),this.manager.itemEnd(_e)},0),zt;if(loading[_e]!==void 0){loading[_e].push({onLoad:Dt,onProgress:Vt,onError:Gt});return}loading[_e]=[],loading[_e].push({onLoad:Dt,onProgress:Vt,onError:Gt});const jt=new Request(_e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),Ht=this.mimeType,Wt=this.responseType;fetch(jt).then(qt=>{if(qt.status===200||qt.status===0){if(qt.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||qt.body===void 0||qt.body.getReader===void 0)return qt;const Xt=loading[_e],Kt=qt.body.getReader(),Yt=qt.headers.get("Content-Length")||qt.headers.get("X-File-Size"),Zt=Yt?parseInt(Yt):0,Jt=Zt!==0;let nn=0;const rn=new ReadableStream({start(Qt){en();function en(){Kt.read().then(({done:tn,value:sn})=>{if(tn)Qt.close();else{nn+=sn.byteLength;const cn=new ProgressEvent("progress",{lengthComputable:Jt,loaded:nn,total:Zt});for(let un=0,hn=Xt.length;un<hn;un++){const fn=Xt[un];fn.onProgress&&fn.onProgress(cn)}Qt.enqueue(sn),en()}})}}});return new Response(rn)}else throw new HttpError(`fetch for "${qt.url}" responded with ${qt.status}: ${qt.statusText}`,qt)}).then(qt=>{switch(Wt){case"arraybuffer":return qt.arrayBuffer();case"blob":return qt.blob();case"document":return qt.text().then(Xt=>new DOMParser().parseFromString(Xt,Ht));case"json":return qt.json();default:if(Ht===void 0)return qt.text();{const Kt=/charset="?([^;"\s]*)"?/i.exec(Ht),Yt=Kt&&Kt[1]?Kt[1].toLowerCase():void 0,Zt=new TextDecoder(Yt);return qt.arrayBuffer().then(Jt=>Zt.decode(Jt))}}}).then(qt=>{Cache.add(_e,qt);const Xt=loading[_e];delete loading[_e];for(let Kt=0,Yt=Xt.length;Kt<Yt;Kt++){const Zt=Xt[Kt];Zt.onLoad&&Zt.onLoad(qt)}}).catch(qt=>{const Xt=loading[_e];if(Xt===void 0)throw this.manager.itemError(_e),qt;delete loading[_e];for(let Kt=0,Yt=Xt.length;Kt<Yt;Kt++){const Zt=Xt[Kt];Zt.onError&&Zt.onError(qt)}this.manager.itemError(_e)}).finally(()=>{this.manager.itemEnd(_e)}),this.manager.itemStart(_e)}setResponseType(_e){return this.responseType=_e,this}setMimeType(_e){return this.mimeType=_e,this}}class AnimationLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(this.manager);jt.setPath(this.path),jt.setRequestHeader(this.requestHeader),jt.setWithCredentials(this.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt=[];for(let Vt=0;Vt<_e.length;Vt++){const Gt=AnimationClip.parse(_e[Vt]);Dt.push(Gt)}return Dt}}class CompressedTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=[],Ht=new CompressedTexture,Wt=new FileLoader(this.manager);Wt.setPath(this.path),Wt.setResponseType("arraybuffer"),Wt.setRequestHeader(this.requestHeader),Wt.setWithCredentials(zt.withCredentials);let qt=0;function Xt(Kt){Wt.load(_e[Kt],function(Yt){const Zt=zt.parse(Yt,!0);jt[Kt]={width:Zt.width,height:Zt.height,format:Zt.format,mipmaps:Zt.mipmaps},qt+=1,qt===6&&(Zt.mipmapCount===1&&(Ht.minFilter=LinearFilter),Ht.image=jt,Ht.format=Zt.format,Ht.needsUpdate=!0,Dt&&Dt(Ht))},Vt,Gt)}if(Array.isArray(_e))for(let Kt=0,Yt=_e.length;Kt<Yt;++Kt)Xt(Kt);else Wt.load(_e,function(Kt){const Yt=zt.parse(Kt,!0);if(Yt.isCubemap){const Zt=Yt.mipmaps.length/Yt.mipmapCount;for(let Jt=0;Jt<Zt;Jt++){jt[Jt]={mipmaps:[]};for(let nn=0;nn<Yt.mipmapCount;nn++)jt[Jt].mipmaps.push(Yt.mipmaps[Jt*Yt.mipmapCount+nn]),jt[Jt].format=Yt.format,jt[Jt].width=Yt.width,jt[Jt].height=Yt.height}Ht.image=jt}else Ht.image.width=Yt.width,Ht.image.height=Yt.height,Ht.mipmaps=Yt.mipmaps;Yt.mipmapCount===1&&(Ht.minFilter=LinearFilter),Ht.format=Yt.format,Ht.needsUpdate=!0,Dt&&Dt(Ht)},Vt,Gt);return Ht}}class ImageLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=this,jt=Cache.get(_e);if(jt!==void 0)return zt.manager.itemStart(_e),setTimeout(function(){Dt&&Dt(jt),zt.manager.itemEnd(_e)},0),jt;const Ht=createElementNS("img");function Wt(){Xt(),Cache.add(_e,this),Dt&&Dt(this),zt.manager.itemEnd(_e)}function qt(Kt){Xt(),Gt&&Gt(Kt),zt.manager.itemError(_e),zt.manager.itemEnd(_e)}function Xt(){Ht.removeEventListener("load",Wt,!1),Ht.removeEventListener("error",qt,!1)}return Ht.addEventListener("load",Wt,!1),Ht.addEventListener("error",qt,!1),_e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(Ht.crossOrigin=this.crossOrigin),zt.manager.itemStart(_e),Ht.src=_e,Ht}}class CubeTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=new CubeTexture;zt.colorSpace=SRGBColorSpace$1;const jt=new ImageLoader(this.manager);jt.setCrossOrigin(this.crossOrigin),jt.setPath(this.path);let Ht=0;function Wt(qt){jt.load(_e[qt],function(Xt){zt.images[qt]=Xt,Ht++,Ht===6&&(zt.needsUpdate=!0,Dt&&Dt(zt))},void 0,Gt)}for(let qt=0;qt<_e.length;++qt)Wt(qt);return zt}}class DataTextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new DataTexture,Ht=new FileLoader(this.manager);return Ht.setResponseType("arraybuffer"),Ht.setRequestHeader(this.requestHeader),Ht.setPath(this.path),Ht.setWithCredentials(zt.withCredentials),Ht.load(_e,function(Wt){let qt;try{qt=zt.parse(Wt)}catch(Xt){if(Gt!==void 0)Gt(Xt);else{console.error(Xt);return}}qt.image!==void 0?jt.image=qt.image:qt.data!==void 0&&(jt.image.width=qt.width,jt.image.height=qt.height,jt.image.data=qt.data),jt.wrapS=qt.wrapS!==void 0?qt.wrapS:ClampToEdgeWrapping,jt.wrapT=qt.wrapT!==void 0?qt.wrapT:ClampToEdgeWrapping,jt.magFilter=qt.magFilter!==void 0?qt.magFilter:LinearFilter,jt.minFilter=qt.minFilter!==void 0?qt.minFilter:LinearFilter,jt.anisotropy=qt.anisotropy!==void 0?qt.anisotropy:1,qt.colorSpace!==void 0&&(jt.colorSpace=qt.colorSpace),qt.flipY!==void 0&&(jt.flipY=qt.flipY),qt.format!==void 0&&(jt.format=qt.format),qt.type!==void 0&&(jt.type=qt.type),qt.mipmaps!==void 0&&(jt.mipmaps=qt.mipmaps,jt.minFilter=LinearMipmapLinearFilter),qt.mipmapCount===1&&(jt.minFilter=LinearFilter),qt.generateMipmaps!==void 0&&(jt.generateMipmaps=qt.generateMipmaps),jt.needsUpdate=!0,Dt&&Dt(jt,qt)},Vt,Gt),jt}}class TextureLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=new Texture,jt=new ImageLoader(this.manager);return jt.setCrossOrigin(this.crossOrigin),jt.setPath(this.path),jt.load(_e,function(Ht){zt.image=Ht,zt.needsUpdate=!0,Dt!==void 0&&Dt(zt)},Vt,Gt),zt}}class Light extends Object3D{constructor(_e,Dt=1){super(),this.isLight=!0,this.type="Light",this.color=new Color$1(_e),this.intensity=Dt}dispose(){}copy(_e,Dt){return super.copy(_e,Dt),this.color.copy(_e.color),this.intensity=_e.intensity,this}toJSON(_e){const Dt=super.toJSON(_e);return Dt.object.color=this.color.getHex(),Dt.object.intensity=this.intensity,this.groundColor!==void 0&&(Dt.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(Dt.object.distance=this.distance),this.angle!==void 0&&(Dt.object.angle=this.angle),this.decay!==void 0&&(Dt.object.decay=this.decay),this.penumbra!==void 0&&(Dt.object.penumbra=this.penumbra),this.shadow!==void 0&&(Dt.object.shadow=this.shadow.toJSON()),Dt}}class HemisphereLight extends Light{constructor(_e,Dt,Vt){super(_e,Vt),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Color$1(Dt)}copy(_e,Dt){return super.copy(_e,Dt),this.groundColor.copy(_e.groundColor),this}}const _projScreenMatrix$1=new Matrix4,_lightPositionWorld$1=new Vector3,_lookTarget$1=new Vector3;class LightShadow{constructor(_e){this.camera=_e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vector2(512,512),this.map=null,this.mapPass=null,this.matrix=new Matrix4,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Frustum,this._frameExtents=new Vector2(1,1),this._viewportCount=1,this._viewports=[new Vector4(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(_e){const Dt=this.camera,Vt=this.matrix;_lightPositionWorld$1.setFromMatrixPosition(_e.matrixWorld),Dt.position.copy(_lightPositionWorld$1),_lookTarget$1.setFromMatrixPosition(_e.target.matrixWorld),Dt.lookAt(_lookTarget$1),Dt.updateMatrixWorld(),_projScreenMatrix$1.multiplyMatrices(Dt.projectionMatrix,Dt.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix$1),Vt.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),Vt.multiply(_projScreenMatrix$1)}getViewport(_e){return this._viewports[_e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(_e){return this.camera=_e.camera.clone(),this.bias=_e.bias,this.radius=_e.radius,this.mapSize.copy(_e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const _e={};return this.bias!==0&&(_e.bias=this.bias),this.normalBias!==0&&(_e.normalBias=this.normalBias),this.radius!==1&&(_e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(_e.mapSize=this.mapSize.toArray()),_e.camera=this.camera.toJSON(!1).object,delete _e.camera.matrix,_e}}class SpotLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(_e){const Dt=this.camera,Vt=RAD2DEG*2*_e.angle*this.focus,Gt=this.mapSize.width/this.mapSize.height,zt=_e.distance||Dt.far;(Vt!==Dt.fov||Gt!==Dt.aspect||zt!==Dt.far)&&(Dt.fov=Vt,Dt.aspect=Gt,Dt.far=zt,Dt.updateProjectionMatrix()),super.updateMatrices(_e)}copy(_e){return super.copy(_e),this.focus=_e.focus,this}}class SpotLight extends Light{constructor(_e,Dt,Vt=0,Gt=Math.PI/3,zt=0,jt=2){super(_e,Dt),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.distance=Vt,this.angle=Gt,this.penumbra=zt,this.decay=jt,this.map=null,this.shadow=new SpotLightShadow}get power(){return this.intensity*Math.PI}set power(_e){this.intensity=_e/Math.PI}dispose(){this.shadow.dispose()}copy(_e,Dt){return super.copy(_e,Dt),this.distance=_e.distance,this.angle=_e.angle,this.penumbra=_e.penumbra,this.decay=_e.decay,this.target=_e.target.clone(),this.shadow=_e.shadow.clone(),this}}const _projScreenMatrix=new Matrix4,_lightPositionWorld=new Vector3,_lookTarget=new Vector3;class PointLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Vector2(4,2),this._viewportCount=6,this._viewports=[new Vector4(2,1,1,1),new Vector4(0,1,1,1),new Vector4(3,1,1,1),new Vector4(1,1,1,1),new Vector4(3,0,1,1),new Vector4(1,0,1,1)],this._cubeDirections=[new Vector3(1,0,0),new Vector3(-1,0,0),new Vector3(0,0,1),new Vector3(0,0,-1),new Vector3(0,1,0),new Vector3(0,-1,0)],this._cubeUps=[new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,0,1),new Vector3(0,0,-1)]}updateMatrices(_e,Dt=0){const Vt=this.camera,Gt=this.matrix,zt=_e.distance||Vt.far;zt!==Vt.far&&(Vt.far=zt,Vt.updateProjectionMatrix()),_lightPositionWorld.setFromMatrixPosition(_e.matrixWorld),Vt.position.copy(_lightPositionWorld),_lookTarget.copy(Vt.position),_lookTarget.add(this._cubeDirections[Dt]),Vt.up.copy(this._cubeUps[Dt]),Vt.lookAt(_lookTarget),Vt.updateMatrixWorld(),Gt.makeTranslation(-_lightPositionWorld.x,-_lightPositionWorld.y,-_lightPositionWorld.z),_projScreenMatrix.multiplyMatrices(Vt.projectionMatrix,Vt.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_projScreenMatrix)}}class PointLight extends Light{constructor(_e,Dt,Vt=0,Gt=2){super(_e,Dt),this.isPointLight=!0,this.type="PointLight",this.distance=Vt,this.decay=Gt,this.shadow=new PointLightShadow}get power(){return this.intensity*4*Math.PI}set power(_e){this.intensity=_e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(_e,Dt){return super.copy(_e,Dt),this.distance=_e.distance,this.decay=_e.decay,this.shadow=_e.shadow.clone(),this}}class DirectionalLightShadow extends LightShadow{constructor(){super(new OrthographicCamera(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class DirectionalLight extends Light{constructor(_e,Dt){super(_e,Dt),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.shadow=new DirectionalLightShadow}dispose(){this.shadow.dispose()}copy(_e){return super.copy(_e),this.target=_e.target.clone(),this.shadow=_e.shadow.clone(),this}}class AmbientLight extends Light{constructor(_e,Dt){super(_e,Dt),this.isAmbientLight=!0,this.type="AmbientLight"}}class RectAreaLight extends Light{constructor(_e,Dt,Vt=10,Gt=10){super(_e,Dt),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=Vt,this.height=Gt}get power(){return this.intensity*this.width*this.height*Math.PI}set power(_e){this.intensity=_e/(this.width*this.height*Math.PI)}copy(_e){return super.copy(_e),this.width=_e.width,this.height=_e.height,this}toJSON(_e){const Dt=super.toJSON(_e);return Dt.object.width=this.width,Dt.object.height=this.height,Dt}}class SphericalHarmonics3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let _e=0;_e<9;_e++)this.coefficients.push(new Vector3)}set(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].copy(_e[Dt]);return this}zero(){for(let _e=0;_e<9;_e++)this.coefficients[_e].set(0,0,0);return this}getAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z,jt=this.coefficients;return Dt.copy(jt[0]).multiplyScalar(.282095),Dt.addScaledVector(jt[1],.488603*Gt),Dt.addScaledVector(jt[2],.488603*zt),Dt.addScaledVector(jt[3],.488603*Vt),Dt.addScaledVector(jt[4],1.092548*(Vt*Gt)),Dt.addScaledVector(jt[5],1.092548*(Gt*zt)),Dt.addScaledVector(jt[6],.315392*(3*zt*zt-1)),Dt.addScaledVector(jt[7],1.092548*(Vt*zt)),Dt.addScaledVector(jt[8],.546274*(Vt*Vt-Gt*Gt)),Dt}getIrradianceAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z,jt=this.coefficients;return Dt.copy(jt[0]).multiplyScalar(.886227),Dt.addScaledVector(jt[1],2*.511664*Gt),Dt.addScaledVector(jt[2],2*.511664*zt),Dt.addScaledVector(jt[3],2*.511664*Vt),Dt.addScaledVector(jt[4],2*.429043*Vt*Gt),Dt.addScaledVector(jt[5],2*.429043*Gt*zt),Dt.addScaledVector(jt[6],.743125*zt*zt-.247708),Dt.addScaledVector(jt[7],2*.429043*Vt*zt),Dt.addScaledVector(jt[8],.429043*(Vt*Vt-Gt*Gt)),Dt}add(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].add(_e.coefficients[Dt]);return this}addScaledSH(_e,Dt){for(let Vt=0;Vt<9;Vt++)this.coefficients[Vt].addScaledVector(_e.coefficients[Vt],Dt);return this}scale(_e){for(let Dt=0;Dt<9;Dt++)this.coefficients[Dt].multiplyScalar(_e);return this}lerp(_e,Dt){for(let Vt=0;Vt<9;Vt++)this.coefficients[Vt].lerp(_e.coefficients[Vt],Dt);return this}equals(_e){for(let Dt=0;Dt<9;Dt++)if(!this.coefficients[Dt].equals(_e.coefficients[Dt]))return!1;return!0}copy(_e){return this.set(_e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(_e,Dt=0){const Vt=this.coefficients;for(let Gt=0;Gt<9;Gt++)Vt[Gt].fromArray(_e,Dt+Gt*3);return this}toArray(_e=[],Dt=0){const Vt=this.coefficients;for(let Gt=0;Gt<9;Gt++)Vt[Gt].toArray(_e,Dt+Gt*3);return _e}static getBasisAt(_e,Dt){const Vt=_e.x,Gt=_e.y,zt=_e.z;Dt[0]=.282095,Dt[1]=.488603*Gt,Dt[2]=.488603*zt,Dt[3]=.488603*Vt,Dt[4]=1.092548*Vt*Gt,Dt[5]=1.092548*Gt*zt,Dt[6]=.315392*(3*zt*zt-1),Dt[7]=1.092548*Vt*zt,Dt[8]=.546274*(Vt*Vt-Gt*Gt)}}class LightProbe extends Light{constructor(_e=new SphericalHarmonics3,Dt=1){super(void 0,Dt),this.isLightProbe=!0,this.sh=_e}copy(_e){return super.copy(_e),this.sh.copy(_e.sh),this}fromJSON(_e){return this.intensity=_e.intensity,this.sh.fromArray(_e.sh),this}toJSON(_e){const Dt=super.toJSON(_e);return Dt.object.sh=this.sh.toArray(),Dt}}class MaterialLoader extends Loader{constructor(_e){super(_e),this.textures={}}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(zt.manager);jt.setPath(zt.path),jt.setRequestHeader(zt.requestHeader),jt.setWithCredentials(zt.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt=this.textures;function Vt(zt){return Dt[zt]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",zt),Dt[zt]}const Gt=MaterialLoader.createMaterialFromType(_e.type);if(_e.uuid!==void 0&&(Gt.uuid=_e.uuid),_e.name!==void 0&&(Gt.name=_e.name),_e.color!==void 0&&Gt.color!==void 0&&Gt.color.setHex(_e.color),_e.roughness!==void 0&&(Gt.roughness=_e.roughness),_e.metalness!==void 0&&(Gt.metalness=_e.metalness),_e.sheen!==void 0&&(Gt.sheen=_e.sheen),_e.sheenColor!==void 0&&(Gt.sheenColor=new Color$1().setHex(_e.sheenColor)),_e.sheenRoughness!==void 0&&(Gt.sheenRoughness=_e.sheenRoughness),_e.emissive!==void 0&&Gt.emissive!==void 0&&Gt.emissive.setHex(_e.emissive),_e.specular!==void 0&&Gt.specular!==void 0&&Gt.specular.setHex(_e.specular),_e.specularIntensity!==void 0&&(Gt.specularIntensity=_e.specularIntensity),_e.specularColor!==void 0&&Gt.specularColor!==void 0&&Gt.specularColor.setHex(_e.specularColor),_e.shininess!==void 0&&(Gt.shininess=_e.shininess),_e.clearcoat!==void 0&&(Gt.clearcoat=_e.clearcoat),_e.clearcoatRoughness!==void 0&&(Gt.clearcoatRoughness=_e.clearcoatRoughness),_e.iridescence!==void 0&&(Gt.iridescence=_e.iridescence),_e.iridescenceIOR!==void 0&&(Gt.iridescenceIOR=_e.iridescenceIOR),_e.iridescenceThicknessRange!==void 0&&(Gt.iridescenceThicknessRange=_e.iridescenceThicknessRange),_e.transmission!==void 0&&(Gt.transmission=_e.transmission),_e.thickness!==void 0&&(Gt.thickness=_e.thickness),_e.attenuationDistance!==void 0&&(Gt.attenuationDistance=_e.attenuationDistance),_e.attenuationColor!==void 0&&Gt.attenuationColor!==void 0&&Gt.attenuationColor.setHex(_e.attenuationColor),_e.anisotropy!==void 0&&(Gt.anisotropy=_e.anisotropy),_e.anisotropyRotation!==void 0&&(Gt.anisotropyRotation=_e.anisotropyRotation),_e.fog!==void 0&&(Gt.fog=_e.fog),_e.flatShading!==void 0&&(Gt.flatShading=_e.flatShading),_e.blending!==void 0&&(Gt.blending=_e.blending),_e.combine!==void 0&&(Gt.combine=_e.combine),_e.side!==void 0&&(Gt.side=_e.side),_e.shadowSide!==void 0&&(Gt.shadowSide=_e.shadowSide),_e.opacity!==void 0&&(Gt.opacity=_e.opacity),_e.transparent!==void 0&&(Gt.transparent=_e.transparent),_e.alphaTest!==void 0&&(Gt.alphaTest=_e.alphaTest),_e.alphaHash!==void 0&&(Gt.alphaHash=_e.alphaHash),_e.depthFunc!==void 0&&(Gt.depthFunc=_e.depthFunc),_e.depthTest!==void 0&&(Gt.depthTest=_e.depthTest),_e.depthWrite!==void 0&&(Gt.depthWrite=_e.depthWrite),_e.colorWrite!==void 0&&(Gt.colorWrite=_e.colorWrite),_e.blendSrc!==void 0&&(Gt.blendSrc=_e.blendSrc),_e.blendDst!==void 0&&(Gt.blendDst=_e.blendDst),_e.blendEquation!==void 0&&(Gt.blendEquation=_e.blendEquation),_e.blendSrcAlpha!==void 0&&(Gt.blendSrcAlpha=_e.blendSrcAlpha),_e.blendDstAlpha!==void 0&&(Gt.blendDstAlpha=_e.blendDstAlpha),_e.blendEquationAlpha!==void 0&&(Gt.blendEquationAlpha=_e.blendEquationAlpha),_e.blendColor!==void 0&&Gt.blendColor!==void 0&&Gt.blendColor.setHex(_e.blendColor),_e.blendAlpha!==void 0&&(Gt.blendAlpha=_e.blendAlpha),_e.stencilWriteMask!==void 0&&(Gt.stencilWriteMask=_e.stencilWriteMask),_e.stencilFunc!==void 0&&(Gt.stencilFunc=_e.stencilFunc),_e.stencilRef!==void 0&&(Gt.stencilRef=_e.stencilRef),_e.stencilFuncMask!==void 0&&(Gt.stencilFuncMask=_e.stencilFuncMask),_e.stencilFail!==void 0&&(Gt.stencilFail=_e.stencilFail),_e.stencilZFail!==void 0&&(Gt.stencilZFail=_e.stencilZFail),_e.stencilZPass!==void 0&&(Gt.stencilZPass=_e.stencilZPass),_e.stencilWrite!==void 0&&(Gt.stencilWrite=_e.stencilWrite),_e.wireframe!==void 0&&(Gt.wireframe=_e.wireframe),_e.wireframeLinewidth!==void 0&&(Gt.wireframeLinewidth=_e.wireframeLinewidth),_e.wireframeLinecap!==void 0&&(Gt.wireframeLinecap=_e.wireframeLinecap),_e.wireframeLinejoin!==void 0&&(Gt.wireframeLinejoin=_e.wireframeLinejoin),_e.rotation!==void 0&&(Gt.rotation=_e.rotation),_e.linewidth!==void 0&&(Gt.linewidth=_e.linewidth),_e.dashSize!==void 0&&(Gt.dashSize=_e.dashSize),_e.gapSize!==void 0&&(Gt.gapSize=_e.gapSize),_e.scale!==void 0&&(Gt.scale=_e.scale),_e.polygonOffset!==void 0&&(Gt.polygonOffset=_e.polygonOffset),_e.polygonOffsetFactor!==void 0&&(Gt.polygonOffsetFactor=_e.polygonOffsetFactor),_e.polygonOffsetUnits!==void 0&&(Gt.polygonOffsetUnits=_e.polygonOffsetUnits),_e.dithering!==void 0&&(Gt.dithering=_e.dithering),_e.alphaToCoverage!==void 0&&(Gt.alphaToCoverage=_e.alphaToCoverage),_e.premultipliedAlpha!==void 0&&(Gt.premultipliedAlpha=_e.premultipliedAlpha),_e.forceSinglePass!==void 0&&(Gt.forceSinglePass=_e.forceSinglePass),_e.visible!==void 0&&(Gt.visible=_e.visible),_e.toneMapped!==void 0&&(Gt.toneMapped=_e.toneMapped),_e.userData!==void 0&&(Gt.userData=_e.userData),_e.vertexColors!==void 0&&(typeof _e.vertexColors=="number"?Gt.vertexColors=_e.vertexColors>0:Gt.vertexColors=_e.vertexColors),_e.uniforms!==void 0)for(const zt in _e.uniforms){const jt=_e.uniforms[zt];switch(Gt.uniforms[zt]={},jt.type){case"t":Gt.uniforms[zt].value=Vt(jt.value);break;case"c":Gt.uniforms[zt].value=new Color$1().setHex(jt.value);break;case"v2":Gt.uniforms[zt].value=new Vector2().fromArray(jt.value);break;case"v3":Gt.uniforms[zt].value=new Vector3().fromArray(jt.value);break;case"v4":Gt.uniforms[zt].value=new Vector4().fromArray(jt.value);break;case"m3":Gt.uniforms[zt].value=new Matrix3().fromArray(jt.value);break;case"m4":Gt.uniforms[zt].value=new Matrix4().fromArray(jt.value);break;default:Gt.uniforms[zt].value=jt.value}}if(_e.defines!==void 0&&(Gt.defines=_e.defines),_e.vertexShader!==void 0&&(Gt.vertexShader=_e.vertexShader),_e.fragmentShader!==void 0&&(Gt.fragmentShader=_e.fragmentShader),_e.glslVersion!==void 0&&(Gt.glslVersion=_e.glslVersion),_e.extensions!==void 0)for(const zt in _e.extensions)Gt.extensions[zt]=_e.extensions[zt];if(_e.lights!==void 0&&(Gt.lights=_e.lights),_e.clipping!==void 0&&(Gt.clipping=_e.clipping),_e.size!==void 0&&(Gt.size=_e.size),_e.sizeAttenuation!==void 0&&(Gt.sizeAttenuation=_e.sizeAttenuation),_e.map!==void 0&&(Gt.map=Vt(_e.map)),_e.matcap!==void 0&&(Gt.matcap=Vt(_e.matcap)),_e.alphaMap!==void 0&&(Gt.alphaMap=Vt(_e.alphaMap)),_e.bumpMap!==void 0&&(Gt.bumpMap=Vt(_e.bumpMap)),_e.bumpScale!==void 0&&(Gt.bumpScale=_e.bumpScale),_e.normalMap!==void 0&&(Gt.normalMap=Vt(_e.normalMap)),_e.normalMapType!==void 0&&(Gt.normalMapType=_e.normalMapType),_e.normalScale!==void 0){let zt=_e.normalScale;Array.isArray(zt)===!1&&(zt=[zt,zt]),Gt.normalScale=new Vector2().fromArray(zt)}return _e.displacementMap!==void 0&&(Gt.displacementMap=Vt(_e.displacementMap)),_e.displacementScale!==void 0&&(Gt.displacementScale=_e.displacementScale),_e.displacementBias!==void 0&&(Gt.displacementBias=_e.displacementBias),_e.roughnessMap!==void 0&&(Gt.roughnessMap=Vt(_e.roughnessMap)),_e.metalnessMap!==void 0&&(Gt.metalnessMap=Vt(_e.metalnessMap)),_e.emissiveMap!==void 0&&(Gt.emissiveMap=Vt(_e.emissiveMap)),_e.emissiveIntensity!==void 0&&(Gt.emissiveIntensity=_e.emissiveIntensity),_e.specularMap!==void 0&&(Gt.specularMap=Vt(_e.specularMap)),_e.specularIntensityMap!==void 0&&(Gt.specularIntensityMap=Vt(_e.specularIntensityMap)),_e.specularColorMap!==void 0&&(Gt.specularColorMap=Vt(_e.specularColorMap)),_e.envMap!==void 0&&(Gt.envMap=Vt(_e.envMap)),_e.envMapRotation!==void 0&&Gt.envMapRotation.fromArray(_e.envMapRotation),_e.envMapIntensity!==void 0&&(Gt.envMapIntensity=_e.envMapIntensity),_e.reflectivity!==void 0&&(Gt.reflectivity=_e.reflectivity),_e.refractionRatio!==void 0&&(Gt.refractionRatio=_e.refractionRatio),_e.lightMap!==void 0&&(Gt.lightMap=Vt(_e.lightMap)),_e.lightMapIntensity!==void 0&&(Gt.lightMapIntensity=_e.lightMapIntensity),_e.aoMap!==void 0&&(Gt.aoMap=Vt(_e.aoMap)),_e.aoMapIntensity!==void 0&&(Gt.aoMapIntensity=_e.aoMapIntensity),_e.gradientMap!==void 0&&(Gt.gradientMap=Vt(_e.gradientMap)),_e.clearcoatMap!==void 0&&(Gt.clearcoatMap=Vt(_e.clearcoatMap)),_e.clearcoatRoughnessMap!==void 0&&(Gt.clearcoatRoughnessMap=Vt(_e.clearcoatRoughnessMap)),_e.clearcoatNormalMap!==void 0&&(Gt.clearcoatNormalMap=Vt(_e.clearcoatNormalMap)),_e.clearcoatNormalScale!==void 0&&(Gt.clearcoatNormalScale=new Vector2().fromArray(_e.clearcoatNormalScale)),_e.iridescenceMap!==void 0&&(Gt.iridescenceMap=Vt(_e.iridescenceMap)),_e.iridescenceThicknessMap!==void 0&&(Gt.iridescenceThicknessMap=Vt(_e.iridescenceThicknessMap)),_e.transmissionMap!==void 0&&(Gt.transmissionMap=Vt(_e.transmissionMap)),_e.thicknessMap!==void 0&&(Gt.thicknessMap=Vt(_e.thicknessMap)),_e.anisotropyMap!==void 0&&(Gt.anisotropyMap=Vt(_e.anisotropyMap)),_e.sheenColorMap!==void 0&&(Gt.sheenColorMap=Vt(_e.sheenColorMap)),_e.sheenRoughnessMap!==void 0&&(Gt.sheenRoughnessMap=Vt(_e.sheenRoughnessMap)),Gt}setTextures(_e){return this.textures=_e,this}static createMaterialFromType(_e){const Dt={ShadowMaterial,SpriteMaterial,RawShaderMaterial,ShaderMaterial,PointsMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshPhongMaterial,MeshToonMaterial,MeshNormalMaterial,MeshLambertMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshBasicMaterial,MeshMatcapMaterial,LineDashedMaterial,LineBasicMaterial,Material};return new Dt[_e]}}class LoaderUtils{static decodeText(_e){if(typeof TextDecoder<"u")return new TextDecoder().decode(_e);let Dt="";for(let Vt=0,Gt=_e.length;Vt<Gt;Vt++)Dt+=String.fromCharCode(_e[Vt]);try{return decodeURIComponent(escape(Dt))}catch{return Dt}}static extractUrlBase(_e){const Dt=_e.lastIndexOf("/");return Dt===-1?"./":_e.slice(0,Dt+1)}static resolveURL(_e,Dt){return typeof _e!="string"||_e===""?"":(/^https?:\/\//i.test(Dt)&&/^\//.test(_e)&&(Dt=Dt.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(_e)||/^data:.*,.*$/i.test(_e)||/^blob:.*$/i.test(_e)?_e:Dt+_e)}}class InstancedBufferGeometry extends BufferGeometry{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(_e){return super.copy(_e),this.instanceCount=_e.instanceCount,this}toJSON(){const _e=super.toJSON();return _e.instanceCount=this.instanceCount,_e.isInstancedBufferGeometry=!0,_e}}class BufferGeometryLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(zt.manager);jt.setPath(zt.path),jt.setRequestHeader(zt.requestHeader),jt.setWithCredentials(zt.withCredentials),jt.load(_e,function(Ht){try{Dt(zt.parse(JSON.parse(Ht)))}catch(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}},Vt,Gt)}parse(_e){const Dt={},Vt={};function Gt(Zt,Jt){if(Dt[Jt]!==void 0)return Dt[Jt];const rn=Zt.interleavedBuffers[Jt],Qt=zt(Zt,rn.buffer),en=getTypedArray(rn.type,Qt),tn=new InterleavedBuffer(en,rn.stride);return tn.uuid=rn.uuid,Dt[Jt]=tn,tn}function zt(Zt,Jt){if(Vt[Jt]!==void 0)return Vt[Jt];const rn=Zt.arrayBuffers[Jt],Qt=new Uint32Array(rn).buffer;return Vt[Jt]=Qt,Qt}const jt=_e.isInstancedBufferGeometry?new InstancedBufferGeometry:new BufferGeometry,Ht=_e.data.index;if(Ht!==void 0){const Zt=getTypedArray(Ht.type,Ht.array);jt.setIndex(new BufferAttribute(Zt,1))}const Wt=_e.data.attributes;for(const Zt in Wt){const Jt=Wt[Zt];let nn;if(Jt.isInterleavedBufferAttribute){const rn=Gt(_e.data,Jt.data);nn=new InterleavedBufferAttribute(rn,Jt.itemSize,Jt.offset,Jt.normalized)}else{const rn=getTypedArray(Jt.type,Jt.array),Qt=Jt.isInstancedBufferAttribute?InstancedBufferAttribute:BufferAttribute;nn=new Qt(rn,Jt.itemSize,Jt.normalized)}Jt.name!==void 0&&(nn.name=Jt.name),Jt.usage!==void 0&&nn.setUsage(Jt.usage),jt.setAttribute(Zt,nn)}const qt=_e.data.morphAttributes;if(qt)for(const Zt in qt){const Jt=qt[Zt],nn=[];for(let rn=0,Qt=Jt.length;rn<Qt;rn++){const en=Jt[rn];let tn;if(en.isInterleavedBufferAttribute){const sn=Gt(_e.data,en.data);tn=new InterleavedBufferAttribute(sn,en.itemSize,en.offset,en.normalized)}else{const sn=getTypedArray(en.type,en.array);tn=new BufferAttribute(sn,en.itemSize,en.normalized)}en.name!==void 0&&(tn.name=en.name),nn.push(tn)}jt.morphAttributes[Zt]=nn}_e.data.morphTargetsRelative&&(jt.morphTargetsRelative=!0);const Kt=_e.data.groups||_e.data.drawcalls||_e.data.offsets;if(Kt!==void 0)for(let Zt=0,Jt=Kt.length;Zt!==Jt;++Zt){const nn=Kt[Zt];jt.addGroup(nn.start,nn.count,nn.materialIndex)}const Yt=_e.data.boundingSphere;if(Yt!==void 0){const Zt=new Vector3;Yt.center!==void 0&&Zt.fromArray(Yt.center),jt.boundingSphere=new Sphere(Zt,Yt.radius)}return _e.name&&(jt.name=_e.name),_e.userData&&(jt.userData=_e.userData),jt}}class ObjectLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=this.path===""?LoaderUtils.extractUrlBase(_e):this.path;this.resourcePath=this.resourcePath||jt;const Ht=new FileLoader(this.manager);Ht.setPath(this.path),Ht.setRequestHeader(this.requestHeader),Ht.setWithCredentials(this.withCredentials),Ht.load(_e,function(Wt){let qt=null;try{qt=JSON.parse(Wt)}catch(Kt){Gt!==void 0&&Gt(Kt),console.error("THREE:ObjectLoader: Can't parse "+_e+".",Kt.message);return}const Xt=qt.metadata;if(Xt===void 0||Xt.type===void 0||Xt.type.toLowerCase()==="geometry"){Gt!==void 0&&Gt(new Error("THREE.ObjectLoader: Can't load "+_e)),console.error("THREE.ObjectLoader: Can't load "+_e);return}zt.parse(qt,Dt)},Vt,Gt)}async loadAsync(_e,Dt){const Vt=this,Gt=this.path===""?LoaderUtils.extractUrlBase(_e):this.path;this.resourcePath=this.resourcePath||Gt;const zt=new FileLoader(this.manager);zt.setPath(this.path),zt.setRequestHeader(this.requestHeader),zt.setWithCredentials(this.withCredentials);const jt=await zt.loadAsync(_e,Dt),Ht=JSON.parse(jt),Wt=Ht.metadata;if(Wt===void 0||Wt.type===void 0||Wt.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+_e);return await Vt.parseAsync(Ht)}parse(_e,Dt){const Vt=this.parseAnimations(_e.animations),Gt=this.parseShapes(_e.shapes),zt=this.parseGeometries(_e.geometries,Gt),jt=this.parseImages(_e.images,function(){Dt!==void 0&&Dt(qt)}),Ht=this.parseTextures(_e.textures,jt),Wt=this.parseMaterials(_e.materials,Ht),qt=this.parseObject(_e.object,zt,Wt,Ht,Vt),Xt=this.parseSkeletons(_e.skeletons,qt);if(this.bindSkeletons(qt,Xt),Dt!==void 0){let Kt=!1;for(const Yt in jt)if(jt[Yt].data instanceof HTMLImageElement){Kt=!0;break}Kt===!1&&Dt(qt)}return qt}async parseAsync(_e){const Dt=this.parseAnimations(_e.animations),Vt=this.parseShapes(_e.shapes),Gt=this.parseGeometries(_e.geometries,Vt),zt=await this.parseImagesAsync(_e.images),jt=this.parseTextures(_e.textures,zt),Ht=this.parseMaterials(_e.materials,jt),Wt=this.parseObject(_e.object,Gt,Ht,jt,Dt),qt=this.parseSkeletons(_e.skeletons,Wt);return this.bindSkeletons(Wt,qt),Wt}parseShapes(_e){const Dt={};if(_e!==void 0)for(let Vt=0,Gt=_e.length;Vt<Gt;Vt++){const zt=new Shape().fromJSON(_e[Vt]);Dt[zt.uuid]=zt}return Dt}parseSkeletons(_e,Dt){const Vt={},Gt={};if(Dt.traverse(function(zt){zt.isBone&&(Gt[zt.uuid]=zt)}),_e!==void 0)for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=new Skeleton().fromJSON(_e[zt],Gt);Vt[Ht.uuid]=Ht}return Vt}parseGeometries(_e,Dt){const Vt={};if(_e!==void 0){const Gt=new BufferGeometryLoader;for(let zt=0,jt=_e.length;zt<jt;zt++){let Ht;const Wt=_e[zt];switch(Wt.type){case"BufferGeometry":case"InstancedBufferGeometry":Ht=Gt.parse(Wt);break;default:Wt.type in Geometries?Ht=Geometries[Wt.type].fromJSON(Wt,Dt):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${Wt.type}"`)}Ht.uuid=Wt.uuid,Wt.name!==void 0&&(Ht.name=Wt.name),Wt.userData!==void 0&&(Ht.userData=Wt.userData),Vt[Wt.uuid]=Ht}}return Vt}parseMaterials(_e,Dt){const Vt={},Gt={};if(_e!==void 0){const zt=new MaterialLoader;zt.setTextures(Dt);for(let jt=0,Ht=_e.length;jt<Ht;jt++){const Wt=_e[jt];Vt[Wt.uuid]===void 0&&(Vt[Wt.uuid]=zt.parse(Wt)),Gt[Wt.uuid]=Vt[Wt.uuid]}}return Gt}parseAnimations(_e){const Dt={};if(_e!==void 0)for(let Vt=0;Vt<_e.length;Vt++){const Gt=_e[Vt],zt=AnimationClip.parse(Gt);Dt[zt.uuid]=zt}return Dt}parseImages(_e,Dt){const Vt=this,Gt={};let zt;function jt(Wt){return Vt.manager.itemStart(Wt),zt.load(Wt,function(){Vt.manager.itemEnd(Wt)},void 0,function(){Vt.manager.itemError(Wt),Vt.manager.itemEnd(Wt)})}function Ht(Wt){if(typeof Wt=="string"){const qt=Wt,Xt=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(qt)?qt:Vt.resourcePath+qt;return jt(Xt)}else return Wt.data?{data:getTypedArray(Wt.type,Wt.data),width:Wt.width,height:Wt.height}:null}if(_e!==void 0&&_e.length>0){const Wt=new LoadingManager(Dt);zt=new ImageLoader(Wt),zt.setCrossOrigin(this.crossOrigin);for(let qt=0,Xt=_e.length;qt<Xt;qt++){const Kt=_e[qt],Yt=Kt.url;if(Array.isArray(Yt)){const Zt=[];for(let Jt=0,nn=Yt.length;Jt<nn;Jt++){const rn=Yt[Jt],Qt=Ht(rn);Qt!==null&&(Qt instanceof HTMLImageElement?Zt.push(Qt):Zt.push(new DataTexture(Qt.data,Qt.width,Qt.height)))}Gt[Kt.uuid]=new Source(Zt)}else{const Zt=Ht(Kt.url);Gt[Kt.uuid]=new Source(Zt)}}}return Gt}async parseImagesAsync(_e){const Dt=this,Vt={};let Gt;async function zt(jt){if(typeof jt=="string"){const Ht=jt,Wt=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(Ht)?Ht:Dt.resourcePath+Ht;return await Gt.loadAsync(Wt)}else return jt.data?{data:getTypedArray(jt.type,jt.data),width:jt.width,height:jt.height}:null}if(_e!==void 0&&_e.length>0){Gt=new ImageLoader(this.manager),Gt.setCrossOrigin(this.crossOrigin);for(let jt=0,Ht=_e.length;jt<Ht;jt++){const Wt=_e[jt],qt=Wt.url;if(Array.isArray(qt)){const Xt=[];for(let Kt=0,Yt=qt.length;Kt<Yt;Kt++){const Zt=qt[Kt],Jt=await zt(Zt);Jt!==null&&(Jt instanceof HTMLImageElement?Xt.push(Jt):Xt.push(new DataTexture(Jt.data,Jt.width,Jt.height)))}Vt[Wt.uuid]=new Source(Xt)}else{const Xt=await zt(Wt.url);Vt[Wt.uuid]=new Source(Xt)}}}return Vt}parseTextures(_e,Dt){function Vt(zt,jt){return typeof zt=="number"?zt:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",zt),jt[zt])}const Gt={};if(_e!==void 0)for(let zt=0,jt=_e.length;zt<jt;zt++){const Ht=_e[zt];Ht.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',Ht.uuid),Dt[Ht.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",Ht.image);const Wt=Dt[Ht.image],qt=Wt.data;let Xt;Array.isArray(qt)?(Xt=new CubeTexture,qt.length===6&&(Xt.needsUpdate=!0)):(qt&&qt.data?Xt=new DataTexture:Xt=new Texture,qt&&(Xt.needsUpdate=!0)),Xt.source=Wt,Xt.uuid=Ht.uuid,Ht.name!==void 0&&(Xt.name=Ht.name),Ht.mapping!==void 0&&(Xt.mapping=Vt(Ht.mapping,TEXTURE_MAPPING)),Ht.channel!==void 0&&(Xt.channel=Ht.channel),Ht.offset!==void 0&&Xt.offset.fromArray(Ht.offset),Ht.repeat!==void 0&&Xt.repeat.fromArray(Ht.repeat),Ht.center!==void 0&&Xt.center.fromArray(Ht.center),Ht.rotation!==void 0&&(Xt.rotation=Ht.rotation),Ht.wrap!==void 0&&(Xt.wrapS=Vt(Ht.wrap[0],TEXTURE_WRAPPING),Xt.wrapT=Vt(Ht.wrap[1],TEXTURE_WRAPPING)),Ht.format!==void 0&&(Xt.format=Ht.format),Ht.internalFormat!==void 0&&(Xt.internalFormat=Ht.internalFormat),Ht.type!==void 0&&(Xt.type=Ht.type),Ht.colorSpace!==void 0&&(Xt.colorSpace=Ht.colorSpace),Ht.minFilter!==void 0&&(Xt.minFilter=Vt(Ht.minFilter,TEXTURE_FILTER)),Ht.magFilter!==void 0&&(Xt.magFilter=Vt(Ht.magFilter,TEXTURE_FILTER)),Ht.anisotropy!==void 0&&(Xt.anisotropy=Ht.anisotropy),Ht.flipY!==void 0&&(Xt.flipY=Ht.flipY),Ht.generateMipmaps!==void 0&&(Xt.generateMipmaps=Ht.generateMipmaps),Ht.premultiplyAlpha!==void 0&&(Xt.premultiplyAlpha=Ht.premultiplyAlpha),Ht.unpackAlignment!==void 0&&(Xt.unpackAlignment=Ht.unpackAlignment),Ht.compareFunction!==void 0&&(Xt.compareFunction=Ht.compareFunction),Ht.userData!==void 0&&(Xt.userData=Ht.userData),Gt[Ht.uuid]=Xt}return Gt}parseObject(_e,Dt,Vt,Gt,zt){let jt;function Ht(Yt){return Dt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",Yt),Dt[Yt]}function Wt(Yt){if(Yt!==void 0){if(Array.isArray(Yt)){const Zt=[];for(let Jt=0,nn=Yt.length;Jt<nn;Jt++){const rn=Yt[Jt];Vt[rn]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",rn),Zt.push(Vt[rn])}return Zt}return Vt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",Yt),Vt[Yt]}}function qt(Yt){return Gt[Yt]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",Yt),Gt[Yt]}let Xt,Kt;switch(_e.type){case"Scene":jt=new Scene,_e.background!==void 0&&(Number.isInteger(_e.background)?jt.background=new Color$1(_e.background):jt.background=qt(_e.background)),_e.environment!==void 0&&(jt.environment=qt(_e.environment)),_e.fog!==void 0&&(_e.fog.type==="Fog"?jt.fog=new Fog(_e.fog.color,_e.fog.near,_e.fog.far):_e.fog.type==="FogExp2"&&(jt.fog=new FogExp2(_e.fog.color,_e.fog.density)),_e.fog.name!==""&&(jt.fog.name=_e.fog.name)),_e.backgroundBlurriness!==void 0&&(jt.backgroundBlurriness=_e.backgroundBlurriness),_e.backgroundIntensity!==void 0&&(jt.backgroundIntensity=_e.backgroundIntensity),_e.backgroundRotation!==void 0&&jt.backgroundRotation.fromArray(_e.backgroundRotation),_e.environmentIntensity!==void 0&&(jt.environmentIntensity=_e.environmentIntensity),_e.environmentRotation!==void 0&&jt.environmentRotation.fromArray(_e.environmentRotation);break;case"PerspectiveCamera":jt=new PerspectiveCamera(_e.fov,_e.aspect,_e.near,_e.far),_e.focus!==void 0&&(jt.focus=_e.focus),_e.zoom!==void 0&&(jt.zoom=_e.zoom),_e.filmGauge!==void 0&&(jt.filmGauge=_e.filmGauge),_e.filmOffset!==void 0&&(jt.filmOffset=_e.filmOffset),_e.view!==void 0&&(jt.view=Object.assign({},_e.view));break;case"OrthographicCamera":jt=new OrthographicCamera(_e.left,_e.right,_e.top,_e.bottom,_e.near,_e.far),_e.zoom!==void 0&&(jt.zoom=_e.zoom),_e.view!==void 0&&(jt.view=Object.assign({},_e.view));break;case"AmbientLight":jt=new AmbientLight(_e.color,_e.intensity);break;case"DirectionalLight":jt=new DirectionalLight(_e.color,_e.intensity);break;case"PointLight":jt=new PointLight(_e.color,_e.intensity,_e.distance,_e.decay);break;case"RectAreaLight":jt=new RectAreaLight(_e.color,_e.intensity,_e.width,_e.height);break;case"SpotLight":jt=new SpotLight(_e.color,_e.intensity,_e.distance,_e.angle,_e.penumbra,_e.decay);break;case"HemisphereLight":jt=new HemisphereLight(_e.color,_e.groundColor,_e.intensity);break;case"LightProbe":jt=new LightProbe().fromJSON(_e);break;case"SkinnedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new SkinnedMesh(Xt,Kt),_e.bindMode!==void 0&&(jt.bindMode=_e.bindMode),_e.bindMatrix!==void 0&&jt.bindMatrix.fromArray(_e.bindMatrix),_e.skeleton!==void 0&&(jt.skeleton=_e.skeleton);break;case"Mesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new Mesh(Xt,Kt);break;case"InstancedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material);const Yt=_e.count,Zt=_e.instanceMatrix,Jt=_e.instanceColor;jt=new InstancedMesh(Xt,Kt,Yt),jt.instanceMatrix=new InstancedBufferAttribute(new Float32Array(Zt.array),16),Jt!==void 0&&(jt.instanceColor=new InstancedBufferAttribute(new Float32Array(Jt.array),Jt.itemSize));break;case"BatchedMesh":Xt=Ht(_e.geometry),Kt=Wt(_e.material),jt=new BatchedMesh(_e.maxGeometryCount,_e.maxVertexCount,_e.maxIndexCount,Kt),jt.geometry=Xt,jt.perObjectFrustumCulled=_e.perObjectFrustumCulled,jt.sortObjects=_e.sortObjects,jt._drawRanges=_e.drawRanges,jt._reservedRanges=_e.reservedRanges,jt._visibility=_e.visibility,jt._active=_e.active,jt._bounds=_e.bounds.map(nn=>{const rn=new Box3;rn.min.fromArray(nn.boxMin),rn.max.fromArray(nn.boxMax);const Qt=new Sphere;return Qt.radius=nn.sphereRadius,Qt.center.fromArray(nn.sphereCenter),{boxInitialized:nn.boxInitialized,box:rn,sphereInitialized:nn.sphereInitialized,sphere:Qt}}),jt._maxGeometryCount=_e.maxGeometryCount,jt._maxVertexCount=_e.maxVertexCount,jt._maxIndexCount=_e.maxIndexCount,jt._geometryInitialized=_e.geometryInitialized,jt._geometryCount=_e.geometryCount,jt._matricesTexture=qt(_e.matricesTexture.uuid);break;case"LOD":jt=new LOD;break;case"Line":jt=new Line(Ht(_e.geometry),Wt(_e.material));break;case"LineLoop":jt=new LineLoop(Ht(_e.geometry),Wt(_e.material));break;case"LineSegments":jt=new LineSegments(Ht(_e.geometry),Wt(_e.material));break;case"PointCloud":case"Points":jt=new Points(Ht(_e.geometry),Wt(_e.material));break;case"Sprite":jt=new Sprite(Wt(_e.material));break;case"Group":jt=new Group;break;case"Bone":jt=new Bone;break;default:jt=new Object3D}if(jt.uuid=_e.uuid,_e.name!==void 0&&(jt.name=_e.name),_e.matrix!==void 0?(jt.matrix.fromArray(_e.matrix),_e.matrixAutoUpdate!==void 0&&(jt.matrixAutoUpdate=_e.matrixAutoUpdate),jt.matrixAutoUpdate&&jt.matrix.decompose(jt.position,jt.quaternion,jt.scale)):(_e.position!==void 0&&jt.position.fromArray(_e.position),_e.rotation!==void 0&&jt.rotation.fromArray(_e.rotation),_e.quaternion!==void 0&&jt.quaternion.fromArray(_e.quaternion),_e.scale!==void 0&&jt.scale.fromArray(_e.scale)),_e.up!==void 0&&jt.up.fromArray(_e.up),_e.castShadow!==void 0&&(jt.castShadow=_e.castShadow),_e.receiveShadow!==void 0&&(jt.receiveShadow=_e.receiveShadow),_e.shadow&&(_e.shadow.bias!==void 0&&(jt.shadow.bias=_e.shadow.bias),_e.shadow.normalBias!==void 0&&(jt.shadow.normalBias=_e.shadow.normalBias),_e.shadow.radius!==void 0&&(jt.shadow.radius=_e.shadow.radius),_e.shadow.mapSize!==void 0&&jt.shadow.mapSize.fromArray(_e.shadow.mapSize),_e.shadow.camera!==void 0&&(jt.shadow.camera=this.parseObject(_e.shadow.camera))),_e.visible!==void 0&&(jt.visible=_e.visible),_e.frustumCulled!==void 0&&(jt.frustumCulled=_e.frustumCulled),_e.renderOrder!==void 0&&(jt.renderOrder=_e.renderOrder),_e.userData!==void 0&&(jt.userData=_e.userData),_e.layers!==void 0&&(jt.layers.mask=_e.layers),_e.children!==void 0){const Yt=_e.children;for(let Zt=0;Zt<Yt.length;Zt++)jt.add(this.parseObject(Yt[Zt],Dt,Vt,Gt,zt))}if(_e.animations!==void 0){const Yt=_e.animations;for(let Zt=0;Zt<Yt.length;Zt++){const Jt=Yt[Zt];jt.animations.push(zt[Jt])}}if(_e.type==="LOD"){_e.autoUpdate!==void 0&&(jt.autoUpdate=_e.autoUpdate);const Yt=_e.levels;for(let Zt=0;Zt<Yt.length;Zt++){const Jt=Yt[Zt],nn=jt.getObjectByProperty("uuid",Jt.object);nn!==void 0&&jt.addLevel(nn,Jt.distance,Jt.hysteresis)}}return jt}bindSkeletons(_e,Dt){Object.keys(Dt).length!==0&&_e.traverse(function(Vt){if(Vt.isSkinnedMesh===!0&&Vt.skeleton!==void 0){const Gt=Dt[Vt.skeleton];Gt===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",Vt.skeleton):Vt.bind(Gt,Vt.bindMatrix)}})}}const TEXTURE_MAPPING={UVMapping,CubeReflectionMapping,CubeRefractionMapping,EquirectangularReflectionMapping,EquirectangularRefractionMapping,CubeUVReflectionMapping},TEXTURE_WRAPPING={RepeatWrapping,ClampToEdgeWrapping,MirroredRepeatWrapping},TEXTURE_FILTER={NearestFilter,NearestMipmapNearestFilter,NearestMipmapLinearFilter,LinearFilter,LinearMipmapNearestFilter,LinearMipmapLinearFilter};class ImageBitmapLoader extends Loader{constructor(_e){super(_e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(_e){return this.options=_e,this}load(_e,Dt,Vt,Gt){_e===void 0&&(_e=""),this.path!==void 0&&(_e=this.path+_e),_e=this.manager.resolveURL(_e);const zt=this,jt=Cache.get(_e);if(jt!==void 0){if(zt.manager.itemStart(_e),jt.then){jt.then(qt=>{Dt&&Dt(qt),zt.manager.itemEnd(_e)}).catch(qt=>{Gt&&Gt(qt)});return}return setTimeout(function(){Dt&&Dt(jt),zt.manager.itemEnd(_e)},0),jt}const Ht={};Ht.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",Ht.headers=this.requestHeader;const Wt=fetch(_e,Ht).then(function(qt){return qt.blob()}).then(function(qt){return createImageBitmap(qt,Object.assign(zt.options,{colorSpaceConversion:"none"}))}).then(function(qt){return Cache.add(_e,qt),Dt&&Dt(qt),zt.manager.itemEnd(_e),qt}).catch(function(qt){Gt&&Gt(qt),Cache.remove(_e),zt.manager.itemError(_e),zt.manager.itemEnd(_e)});Cache.add(_e,Wt),zt.manager.itemStart(_e)}}let _context;class AudioContext{static getContext(){return _context===void 0&&(_context=new(window.AudioContext||window.webkitAudioContext)),_context}static setContext(_e){_context=_e}}class AudioLoader extends Loader{constructor(_e){super(_e)}load(_e,Dt,Vt,Gt){const zt=this,jt=new FileLoader(this.manager);jt.setResponseType("arraybuffer"),jt.setPath(this.path),jt.setRequestHeader(this.requestHeader),jt.setWithCredentials(this.withCredentials),jt.load(_e,function(Wt){try{const qt=Wt.slice(0);AudioContext.getContext().decodeAudioData(qt,function(Kt){Dt(Kt)}).catch(Ht)}catch(qt){Ht(qt)}},Vt,Gt);function Ht(Wt){Gt?Gt(Wt):console.error(Wt),zt.manager.itemError(_e)}}}const _eyeRight=new Matrix4,_eyeLeft=new Matrix4,_projectionMatrix=new Matrix4;class StereoCamera{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(_e){const Dt=this._cache;if(Dt.focus!==_e.focus||Dt.fov!==_e.fov||Dt.aspect!==_e.aspect*this.aspect||Dt.near!==_e.near||Dt.far!==_e.far||Dt.zoom!==_e.zoom||Dt.eyeSep!==this.eyeSep){Dt.focus=_e.focus,Dt.fov=_e.fov,Dt.aspect=_e.aspect*this.aspect,Dt.near=_e.near,Dt.far=_e.far,Dt.zoom=_e.zoom,Dt.eyeSep=this.eyeSep,_projectionMatrix.copy(_e.projectionMatrix);const Gt=Dt.eyeSep/2,zt=Gt*Dt.near/Dt.focus,jt=Dt.near*Math.tan(DEG2RAD$1*Dt.fov*.5)/Dt.zoom;let Ht,Wt;_eyeLeft.elements[12]=-Gt,_eyeRight.elements[12]=Gt,Ht=-jt*Dt.aspect+zt,Wt=jt*Dt.aspect+zt,_projectionMatrix.elements[0]=2*Dt.near/(Wt-Ht),_projectionMatrix.elements[8]=(Wt+Ht)/(Wt-Ht),this.cameraL.projectionMatrix.copy(_projectionMatrix),Ht=-jt*Dt.aspect-zt,Wt=jt*Dt.aspect-zt,_projectionMatrix.elements[0]=2*Dt.near/(Wt-Ht),_projectionMatrix.elements[8]=(Wt+Ht)/(Wt-Ht),this.cameraR.projectionMatrix.copy(_projectionMatrix)}this.cameraL.matrixWorld.copy(_e.matrixWorld).multiply(_eyeLeft),this.cameraR.matrixWorld.copy(_e.matrixWorld).multiply(_eyeRight)}}class Clock{constructor(_e=!0){this.autoStart=_e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let _e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const Dt=now();_e=(Dt-this.oldTime)/1e3,this.oldTime=Dt,this.elapsedTime+=_e}return _e}}function now(){return(typeof performance>"u"?Date:performance).now()}const _position$1=new Vector3,_quaternion$1=new Quaternion,_scale$1=new Vector3,_orientation$1=new Vector3;class AudioListener extends Object3D{constructor(){super(),this.type="AudioListener",this.context=AudioContext.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Clock}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(_e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=_e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(_e){return this.gain.gain.setTargetAtTime(_e,this.context.currentTime,.01),this}updateMatrixWorld(_e){super.updateMatrixWorld(_e);const Dt=this.context.listener,Vt=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(_position$1,_quaternion$1,_scale$1),_orientation$1.set(0,0,-1).applyQuaternion(_quaternion$1),Dt.positionX){const Gt=this.context.currentTime+this.timeDelta;Dt.positionX.linearRampToValueAtTime(_position$1.x,Gt),Dt.positionY.linearRampToValueAtTime(_position$1.y,Gt),Dt.positionZ.linearRampToValueAtTime(_position$1.z,Gt),Dt.forwardX.linearRampToValueAtTime(_orientation$1.x,Gt),Dt.forwardY.linearRampToValueAtTime(_orientation$1.y,Gt),Dt.forwardZ.linearRampToValueAtTime(_orientation$1.z,Gt),Dt.upX.linearRampToValueAtTime(Vt.x,Gt),Dt.upY.linearRampToValueAtTime(Vt.y,Gt),Dt.upZ.linearRampToValueAtTime(Vt.z,Gt)}else Dt.setPosition(_position$1.x,_position$1.y,_position$1.z),Dt.setOrientation(_orientation$1.x,_orientation$1.y,_orientation$1.z,Vt.x,Vt.y,Vt.z)}}class Audio extends Object3D{constructor(_e){super(),this.type="Audio",this.listener=_e,this.context=_e.context,this.gain=this.context.createGain(),this.gain.connect(_e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(_e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=_e,this.connect(),this}setMediaElementSource(_e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(_e),this.connect(),this}setMediaStreamSource(_e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(_e),this.connect(),this}setBuffer(_e){return this.buffer=_e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(_e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+_e;const Dt=this.context.createBufferSource();return Dt.buffer=this.buffer,Dt.loop=this.loop,Dt.loopStart=this.loopStart,Dt.loopEnd=this.loopEnd,Dt.onended=this.onEnded.bind(this),Dt.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=Dt,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let _e=1,Dt=this.filters.length;_e<Dt;_e++)this.filters[_e-1].connect(this.filters[_e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let _e=1,Dt=this.filters.length;_e<Dt;_e++)this.filters[_e-1].disconnect(this.filters[_e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(_e){return _e||(_e=[]),this._connected===!0?(this.disconnect(),this.filters=_e.slice(),this.connect()):this.filters=_e.slice(),this}setDetune(_e){return this.detune=_e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(_e){return this.setFilters(_e?[_e]:[])}setPlaybackRate(_e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=_e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(_e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=_e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(_e){return this.loopStart=_e,this}setLoopEnd(_e){return this.loopEnd=_e,this}getVolume(){return this.gain.gain.value}setVolume(_e){return this.gain.gain.setTargetAtTime(_e,this.context.currentTime,.01),this}}const _position=new Vector3,_quaternion=new Quaternion,_scale=new Vector3,_orientation=new Vector3;class PositionalAudio extends Audio{constructor(_e){super(_e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(_e){return this.panner.refDistance=_e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(_e){return this.panner.rolloffFactor=_e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(_e){return this.panner.distanceModel=_e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(_e){return this.panner.maxDistance=_e,this}setDirectionalCone(_e,Dt,Vt){return this.panner.coneInnerAngle=_e,this.panner.coneOuterAngle=Dt,this.panner.coneOuterGain=Vt,this}updateMatrixWorld(_e){if(super.updateMatrixWorld(_e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(_position,_quaternion,_scale),_orientation.set(0,0,1).applyQuaternion(_quaternion);const Dt=this.panner;if(Dt.positionX){const Vt=this.context.currentTime+this.listener.timeDelta;Dt.positionX.linearRampToValueAtTime(_position.x,Vt),Dt.positionY.linearRampToValueAtTime(_position.y,Vt),Dt.positionZ.linearRampToValueAtTime(_position.z,Vt),Dt.orientationX.linearRampToValueAtTime(_orientation.x,Vt),Dt.orientationY.linearRampToValueAtTime(_orientation.y,Vt),Dt.orientationZ.linearRampToValueAtTime(_orientation.z,Vt)}else Dt.setPosition(_position.x,_position.y,_position.z),Dt.setOrientation(_orientation.x,_orientation.y,_orientation.z)}}class AudioAnalyser{constructor(_e,Dt=2048){this.analyser=_e.context.createAnalyser(),this.analyser.fftSize=Dt,this.data=new Uint8Array(this.analyser.frequencyBinCount),_e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let _e=0;const Dt=this.getFrequencyData();for(let Vt=0;Vt<Dt.length;Vt++)_e+=Dt[Vt];return _e/Dt.length}}class PropertyMixer{constructor(_e,Dt,Vt){this.binding=_e,this.valueSize=Vt;let Gt,zt,jt;switch(Dt){case"quaternion":Gt=this._slerp,zt=this._slerpAdditive,jt=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(Vt*6),this._workIndex=5;break;case"string":case"bool":Gt=this._select,zt=this._select,jt=this._setAdditiveIdentityOther,this.buffer=new Array(Vt*5);break;default:Gt=this._lerp,zt=this._lerpAdditive,jt=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(Vt*5)}this._mixBufferRegion=Gt,this._mixBufferRegionAdditive=zt,this._setIdentity=jt,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(_e,Dt){const Vt=this.buffer,Gt=this.valueSize,zt=_e*Gt+Gt;let jt=this.cumulativeWeight;if(jt===0){for(let Ht=0;Ht!==Gt;++Ht)Vt[zt+Ht]=Vt[Ht];jt=Dt}else{jt+=Dt;const Ht=Dt/jt;this._mixBufferRegion(Vt,zt,0,Ht,Gt)}this.cumulativeWeight=jt}accumulateAdditive(_e){const Dt=this.buffer,Vt=this.valueSize,Gt=Vt*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(Dt,Gt,0,_e,Vt),this.cumulativeWeightAdditive+=_e}apply(_e){const Dt=this.valueSize,Vt=this.buffer,Gt=_e*Dt+Dt,zt=this.cumulativeWeight,jt=this.cumulativeWeightAdditive,Ht=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,zt<1){const Wt=Dt*this._origIndex;this._mixBufferRegion(Vt,Gt,Wt,1-zt,Dt)}jt>0&&this._mixBufferRegionAdditive(Vt,Gt,this._addIndex*Dt,1,Dt);for(let Wt=Dt,qt=Dt+Dt;Wt!==qt;++Wt)if(Vt[Wt]!==Vt[Wt+Dt]){Ht.setValue(Vt,Gt);break}}saveOriginalState(){const _e=this.binding,Dt=this.buffer,Vt=this.valueSize,Gt=Vt*this._origIndex;_e.getValue(Dt,Gt);for(let zt=Vt,jt=Gt;zt!==jt;++zt)Dt[zt]=Dt[Gt+zt%Vt];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const _e=this.valueSize*3;this.binding.setValue(this.buffer,_e)}_setAdditiveIdentityNumeric(){const _e=this._addIndex*this.valueSize,Dt=_e+this.valueSize;for(let Vt=_e;Vt<Dt;Vt++)this.buffer[Vt]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const _e=this._origIndex*this.valueSize,Dt=this._addIndex*this.valueSize;for(let Vt=0;Vt<this.valueSize;Vt++)this.buffer[Dt+Vt]=this.buffer[_e+Vt]}_select(_e,Dt,Vt,Gt,zt){if(Gt>=.5)for(let jt=0;jt!==zt;++jt)_e[Dt+jt]=_e[Vt+jt]}_slerp(_e,Dt,Vt,Gt){Quaternion.slerpFlat(_e,Dt,_e,Dt,_e,Vt,Gt)}_slerpAdditive(_e,Dt,Vt,Gt,zt){const jt=this._workIndex*zt;Quaternion.multiplyQuaternionsFlat(_e,jt,_e,Dt,_e,Vt),Quaternion.slerpFlat(_e,Dt,_e,Dt,_e,jt,Gt)}_lerp(_e,Dt,Vt,Gt,zt){const jt=1-Gt;for(let Ht=0;Ht!==zt;++Ht){const Wt=Dt+Ht;_e[Wt]=_e[Wt]*jt+_e[Vt+Ht]*Gt}}_lerpAdditive(_e,Dt,Vt,Gt,zt){for(let jt=0;jt!==zt;++jt){const Ht=Dt+jt;_e[Ht]=_e[Ht]+_e[Vt+jt]*Gt}}}const _RESERVED_CHARS_RE="\\[\\]\\.:\\/",_reservedRe=new RegExp("["+_RESERVED_CHARS_RE+"]","g"),_wordChar="[^"+_RESERVED_CHARS_RE+"]",_wordCharOrDot="[^"+_RESERVED_CHARS_RE.replace("\\.","")+"]",_directoryRe=/((?:WC+[\/:])*)/.source.replace("WC",_wordChar),_nodeRe=/(WCOD+)?/.source.replace("WCOD",_wordCharOrDot),_objectRe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_wordChar),_propertyRe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_wordChar),_trackRe=new RegExp("^"+_directoryRe+_nodeRe+_objectRe+_propertyRe+"$"),_supportedObjectNames=["material","materials","bones","map"];class Composite{constructor(_e,Dt,Vt){const Gt=Vt||PropertyBinding.parseTrackName(Dt);this._targetGroup=_e,this._bindings=_e.subscribe_(Dt,Gt)}getValue(_e,Dt){this.bind();const Vt=this._targetGroup.nCachedObjects_,Gt=this._bindings[Vt];Gt!==void 0&&Gt.getValue(_e,Dt)}setValue(_e,Dt){const Vt=this._bindings;for(let Gt=this._targetGroup.nCachedObjects_,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt].setValue(_e,Dt)}bind(){const _e=this._bindings;for(let Dt=this._targetGroup.nCachedObjects_,Vt=_e.length;Dt!==Vt;++Dt)_e[Dt].bind()}unbind(){const _e=this._bindings;for(let Dt=this._targetGroup.nCachedObjects_,Vt=_e.length;Dt!==Vt;++Dt)_e[Dt].unbind()}}class PropertyBinding{constructor(_e,Dt,Vt){this.path=Dt,this.parsedPath=Vt||PropertyBinding.parseTrackName(Dt),this.node=PropertyBinding.findNode(_e,this.parsedPath.nodeName),this.rootNode=_e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(_e,Dt,Vt){return _e&&_e.isAnimationObjectGroup?new PropertyBinding.Composite(_e,Dt,Vt):new PropertyBinding(_e,Dt,Vt)}static sanitizeNodeName(_e){return _e.replace(/\s/g,"_").replace(_reservedRe,"")}static parseTrackName(_e){const Dt=_trackRe.exec(_e);if(Dt===null)throw new Error("PropertyBinding: Cannot parse trackName: "+_e);const Vt={nodeName:Dt[2],objectName:Dt[3],objectIndex:Dt[4],propertyName:Dt[5],propertyIndex:Dt[6]},Gt=Vt.nodeName&&Vt.nodeName.lastIndexOf(".");if(Gt!==void 0&&Gt!==-1){const zt=Vt.nodeName.substring(Gt+1);_supportedObjectNames.indexOf(zt)!==-1&&(Vt.nodeName=Vt.nodeName.substring(0,Gt),Vt.objectName=zt)}if(Vt.propertyName===null||Vt.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+_e);return Vt}static findNode(_e,Dt){if(Dt===void 0||Dt===""||Dt==="."||Dt===-1||Dt===_e.name||Dt===_e.uuid)return _e;if(_e.skeleton){const Vt=_e.skeleton.getBoneByName(Dt);if(Vt!==void 0)return Vt}if(_e.children){const Vt=function(zt){for(let jt=0;jt<zt.length;jt++){const Ht=zt[jt];if(Ht.name===Dt||Ht.uuid===Dt)return Ht;const Wt=Vt(Ht.children);if(Wt)return Wt}return null},Gt=Vt(_e.children);if(Gt)return Gt}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(_e,Dt){_e[Dt]=this.targetObject[this.propertyName]}_getValue_array(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)_e[Dt++]=Vt[Gt]}_getValue_arrayElement(_e,Dt){_e[Dt]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(_e,Dt){this.resolvedProperty.toArray(_e,Dt)}_setValue_direct(_e,Dt){this.targetObject[this.propertyName]=_e[Dt]}_setValue_direct_setNeedsUpdate(_e,Dt){this.targetObject[this.propertyName]=_e[Dt],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(_e,Dt){this.targetObject[this.propertyName]=_e[Dt],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++]}_setValue_array_setNeedsUpdate(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(_e,Dt){const Vt=this.resolvedProperty;for(let Gt=0,zt=Vt.length;Gt!==zt;++Gt)Vt[Gt]=_e[Dt++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt]}_setValue_arrayElement_setNeedsUpdate(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(_e,Dt){this.resolvedProperty[this.propertyIndex]=_e[Dt],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(_e,Dt){this.resolvedProperty.fromArray(_e,Dt)}_setValue_fromArray_setNeedsUpdate(_e,Dt){this.resolvedProperty.fromArray(_e,Dt),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(_e,Dt){this.resolvedProperty.fromArray(_e,Dt),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(_e,Dt){this.bind(),this.getValue(_e,Dt)}_setValue_unbound(_e,Dt){this.bind(),this.setValue(_e,Dt)}bind(){let _e=this.node;const Dt=this.parsedPath,Vt=Dt.objectName,Gt=Dt.propertyName;let zt=Dt.propertyIndex;if(_e||(_e=PropertyBinding.findNode(this.rootNode,Dt.nodeName),this.node=_e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!_e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(Vt){let qt=Dt.objectIndex;switch(Vt){case"materials":if(!_e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!_e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}_e=_e.material.materials;break;case"bones":if(!_e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}_e=_e.skeleton.bones;for(let Xt=0;Xt<_e.length;Xt++)if(_e[Xt].name===qt){qt=Xt;break}break;case"map":if("map"in _e){_e=_e.map;break}if(!_e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!_e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}_e=_e.material.map;break;default:if(_e[Vt]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}_e=_e[Vt]}if(qt!==void 0){if(_e[qt]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,_e);return}_e=_e[qt]}}const jt=_e[Gt];if(jt===void 0){const qt=Dt.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+qt+"."+Gt+" but it wasn't found.",_e);return}let Ht=this.Versioning.None;this.targetObject=_e,_e.needsUpdate!==void 0?Ht=this.Versioning.NeedsUpdate:_e.matrixWorldNeedsUpdate!==void 0&&(Ht=this.Versioning.MatrixWorldNeedsUpdate);let Wt=this.BindingType.Direct;if(zt!==void 0){if(Gt==="morphTargetInfluences"){if(!_e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!_e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}_e.morphTargetDictionary[zt]!==void 0&&(zt=_e.morphTargetDictionary[zt])}Wt=this.BindingType.ArrayElement,this.resolvedProperty=jt,this.propertyIndex=zt}else jt.fromArray!==void 0&&jt.toArray!==void 0?(Wt=this.BindingType.HasFromToArray,this.resolvedProperty=jt):Array.isArray(jt)?(Wt=this.BindingType.EntireArray,this.resolvedProperty=jt):this.propertyName=Gt;this.getValue=this.GetterByBindingType[Wt],this.setValue=this.SetterByBindingTypeAndVersioning[Wt][Ht]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}PropertyBinding.Composite=Composite;PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray];PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class AnimationObjectGroup{constructor(){this.isAnimationObjectGroup=!0,this.uuid=generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const _e={};this._indicesByUUID=_e;for(let Vt=0,Gt=arguments.length;Vt!==Gt;++Vt)_e[arguments[Vt].uuid]=Vt;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const Dt=this;this.stats={objects:{get total(){return Dt._objects.length},get inUse(){return this.total-Dt.nCachedObjects_}},get bindingsPerObject(){return Dt._bindings.length}}}add(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._paths,Gt=this._parsedPaths,zt=this._bindings,jt=zt.length;let Ht,Wt=_e.length,qt=this.nCachedObjects_;for(let Xt=0,Kt=arguments.length;Xt!==Kt;++Xt){const Yt=arguments[Xt],Zt=Yt.uuid;let Jt=Dt[Zt];if(Jt===void 0){Jt=Wt++,Dt[Zt]=Jt,_e.push(Yt);for(let nn=0,rn=jt;nn!==rn;++nn)zt[nn].push(new PropertyBinding(Yt,Vt[nn],Gt[nn]))}else if(Jt<qt){Ht=_e[Jt];const nn=--qt,rn=_e[nn];Dt[rn.uuid]=Jt,_e[Jt]=rn,Dt[Zt]=nn,_e[nn]=Yt;for(let Qt=0,en=jt;Qt!==en;++Qt){const tn=zt[Qt],sn=tn[nn];let cn=tn[Jt];tn[Jt]=sn,cn===void 0&&(cn=new PropertyBinding(Yt,Vt[Qt],Gt[Qt])),tn[nn]=cn}}else _e[Jt]!==Ht&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=qt}remove(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._bindings,Gt=Vt.length;let zt=this.nCachedObjects_;for(let jt=0,Ht=arguments.length;jt!==Ht;++jt){const Wt=arguments[jt],qt=Wt.uuid,Xt=Dt[qt];if(Xt!==void 0&&Xt>=zt){const Kt=zt++,Yt=_e[Kt];Dt[Yt.uuid]=Xt,_e[Xt]=Yt,Dt[qt]=Kt,_e[Kt]=Wt;for(let Zt=0,Jt=Gt;Zt!==Jt;++Zt){const nn=Vt[Zt],rn=nn[Kt],Qt=nn[Xt];nn[Xt]=rn,nn[Kt]=Qt}}}this.nCachedObjects_=zt}uncache(){const _e=this._objects,Dt=this._indicesByUUID,Vt=this._bindings,Gt=Vt.length;let zt=this.nCachedObjects_,jt=_e.length;for(let Ht=0,Wt=arguments.length;Ht!==Wt;++Ht){const qt=arguments[Ht],Xt=qt.uuid,Kt=Dt[Xt];if(Kt!==void 0)if(delete Dt[Xt],Kt<zt){const Yt=--zt,Zt=_e[Yt],Jt=--jt,nn=_e[Jt];Dt[Zt.uuid]=Kt,_e[Kt]=Zt,Dt[nn.uuid]=Yt,_e[Yt]=nn,_e.pop();for(let rn=0,Qt=Gt;rn!==Qt;++rn){const en=Vt[rn],tn=en[Yt],sn=en[Jt];en[Kt]=tn,en[Yt]=sn,en.pop()}}else{const Yt=--jt,Zt=_e[Yt];Yt>0&&(Dt[Zt.uuid]=Kt),_e[Kt]=Zt,_e.pop();for(let Jt=0,nn=Gt;Jt!==nn;++Jt){const rn=Vt[Jt];rn[Kt]=rn[Yt],rn.pop()}}}this.nCachedObjects_=zt}subscribe_(_e,Dt){const Vt=this._bindingsIndicesByPath;let Gt=Vt[_e];const zt=this._bindings;if(Gt!==void 0)return zt[Gt];const jt=this._paths,Ht=this._parsedPaths,Wt=this._objects,qt=Wt.length,Xt=this.nCachedObjects_,Kt=new Array(qt);Gt=zt.length,Vt[_e]=Gt,jt.push(_e),Ht.push(Dt),zt.push(Kt);for(let Yt=Xt,Zt=Wt.length;Yt!==Zt;++Yt){const Jt=Wt[Yt];Kt[Yt]=new PropertyBinding(Jt,_e,Dt)}return Kt}unsubscribe_(_e){const Dt=this._bindingsIndicesByPath,Vt=Dt[_e];if(Vt!==void 0){const Gt=this._paths,zt=this._parsedPaths,jt=this._bindings,Ht=jt.length-1,Wt=jt[Ht],qt=_e[Ht];Dt[qt]=Vt,jt[Vt]=Wt,jt.pop(),zt[Vt]=zt[Ht],zt.pop(),Gt[Vt]=Gt[Ht],Gt.pop()}}}class AnimationAction{constructor(_e,Dt,Vt=null,Gt=Dt.blendMode){this._mixer=_e,this._clip=Dt,this._localRoot=Vt,this.blendMode=Gt;const zt=Dt.tracks,jt=zt.length,Ht=new Array(jt),Wt={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding};for(let qt=0;qt!==jt;++qt){const Xt=zt[qt].createInterpolant(null);Ht[qt]=Xt,Xt.settings=Wt}this._interpolantSettings=Wt,this._interpolants=Ht,this._propertyBindings=new Array(jt),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=LoopRepeat$1,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(_e){return this._startTime=_e,this}setLoop(_e,Dt){return this.loop=_e,this.repetitions=Dt,this}setEffectiveWeight(_e){return this.weight=_e,this._effectiveWeight=this.enabled?_e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(_e){return this._scheduleFading(_e,0,1)}fadeOut(_e){return this._scheduleFading(_e,1,0)}crossFadeFrom(_e,Dt,Vt){if(_e.fadeOut(Dt),this.fadeIn(Dt),Vt){const Gt=this._clip.duration,zt=_e._clip.duration,jt=zt/Gt,Ht=Gt/zt;_e.warp(1,jt,Dt),this.warp(Ht,1,Dt)}return this}crossFadeTo(_e,Dt,Vt){return _e.crossFadeFrom(this,Dt,Vt)}stopFading(){const _e=this._weightInterpolant;return _e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(_e)),this}setEffectiveTimeScale(_e){return this.timeScale=_e,this._effectiveTimeScale=this.paused?0:_e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(_e){return this.timeScale=this._clip.duration/_e,this.stopWarping()}syncWith(_e){return this.time=_e.time,this.timeScale=_e.timeScale,this.stopWarping()}halt(_e){return this.warp(this._effectiveTimeScale,0,_e)}warp(_e,Dt,Vt){const Gt=this._mixer,zt=Gt.time,jt=this.timeScale;let Ht=this._timeScaleInterpolant;Ht===null&&(Ht=Gt._lendControlInterpolant(),this._timeScaleInterpolant=Ht);const Wt=Ht.parameterPositions,qt=Ht.sampleValues;return Wt[0]=zt,Wt[1]=zt+Vt,qt[0]=_e/jt,qt[1]=Dt/jt,this}stopWarping(){const _e=this._timeScaleInterpolant;return _e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(_e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(_e,Dt,Vt,Gt){if(!this.enabled){this._updateWeight(_e);return}const zt=this._startTime;if(zt!==null){const Wt=(_e-zt)*Vt;Wt<0||Vt===0?Dt=0:(this._startTime=null,Dt=Vt*Wt)}Dt*=this._updateTimeScale(_e);const jt=this._updateTime(Dt),Ht=this._updateWeight(_e);if(Ht>0){const Wt=this._interpolants,qt=this._propertyBindings;switch(this.blendMode){case AdditiveAnimationBlendMode:for(let Xt=0,Kt=Wt.length;Xt!==Kt;++Xt)Wt[Xt].evaluate(jt),qt[Xt].accumulateAdditive(Ht);break;case NormalAnimationBlendMode:default:for(let Xt=0,Kt=Wt.length;Xt!==Kt;++Xt)Wt[Xt].evaluate(jt),qt[Xt].accumulate(Gt,Ht)}}}_updateWeight(_e){let Dt=0;if(this.enabled){Dt=this.weight;const Vt=this._weightInterpolant;if(Vt!==null){const Gt=Vt.evaluate(_e)[0];Dt*=Gt,_e>Vt.parameterPositions[1]&&(this.stopFading(),Gt===0&&(this.enabled=!1))}}return this._effectiveWeight=Dt,Dt}_updateTimeScale(_e){let Dt=0;if(!this.paused){Dt=this.timeScale;const Vt=this._timeScaleInterpolant;if(Vt!==null){const Gt=Vt.evaluate(_e)[0];Dt*=Gt,_e>Vt.parameterPositions[1]&&(this.stopWarping(),Dt===0?this.paused=!0:this.timeScale=Dt)}}return this._effectiveTimeScale=Dt,Dt}_updateTime(_e){const Dt=this._clip.duration,Vt=this.loop;let Gt=this.time+_e,zt=this._loopCount;const jt=Vt===LoopPingPong;if(_e===0)return zt===-1?Gt:jt&&(zt&1)===1?Dt-Gt:Gt;if(Vt===LoopOnce$1){zt===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(Gt>=Dt)Gt=Dt;else if(Gt<0)Gt=0;else{this.time=Gt;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=Gt,this._mixer.dispatchEvent({type:"finished",action:this,direction:_e<0?-1:1})}}else{if(zt===-1&&(_e>=0?(zt=0,this._setEndings(!0,this.repetitions===0,jt)):this._setEndings(this.repetitions===0,!0,jt)),Gt>=Dt||Gt<0){const Ht=Math.floor(Gt/Dt);Gt-=Dt*Ht,zt+=Math.abs(Ht);const Wt=this.repetitions-zt;if(Wt<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,Gt=_e>0?Dt:0,this.time=Gt,this._mixer.dispatchEvent({type:"finished",action:this,direction:_e>0?1:-1});else{if(Wt===1){const qt=_e<0;this._setEndings(qt,!qt,jt)}else this._setEndings(!1,!1,jt);this._loopCount=zt,this.time=Gt,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:Ht})}}else this.time=Gt;if(jt&&(zt&1)===1)return Dt-Gt}return Gt}_setEndings(_e,Dt,Vt){const Gt=this._interpolantSettings;Vt?(Gt.endingStart=ZeroSlopeEnding,Gt.endingEnd=ZeroSlopeEnding):(_e?Gt.endingStart=this.zeroSlopeAtStart?ZeroSlopeEnding:ZeroCurvatureEnding:Gt.endingStart=WrapAroundEnding,Dt?Gt.endingEnd=this.zeroSlopeAtEnd?ZeroSlopeEnding:ZeroCurvatureEnding:Gt.endingEnd=WrapAroundEnding)}_scheduleFading(_e,Dt,Vt){const Gt=this._mixer,zt=Gt.time;let jt=this._weightInterpolant;jt===null&&(jt=Gt._lendControlInterpolant(),this._weightInterpolant=jt);const Ht=jt.parameterPositions,Wt=jt.sampleValues;return Ht[0]=zt,Wt[0]=Dt,Ht[1]=zt+_e,Wt[1]=Vt,this}}const _controlInterpolantsResultBuffer=new Float32Array(1);class AnimationMixer extends EventDispatcher$2{constructor(_e){super(),this._root=_e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(_e,Dt){const Vt=_e._localRoot||this._root,Gt=_e._clip.tracks,zt=Gt.length,jt=_e._propertyBindings,Ht=_e._interpolants,Wt=Vt.uuid,qt=this._bindingsByRootAndName;let Xt=qt[Wt];Xt===void 0&&(Xt={},qt[Wt]=Xt);for(let Kt=0;Kt!==zt;++Kt){const Yt=Gt[Kt],Zt=Yt.name;let Jt=Xt[Zt];if(Jt!==void 0)++Jt.referenceCount,jt[Kt]=Jt;else{if(Jt=jt[Kt],Jt!==void 0){Jt._cacheIndex===null&&(++Jt.referenceCount,this._addInactiveBinding(Jt,Wt,Zt));continue}const nn=Dt&&Dt._propertyBindings[Kt].binding.parsedPath;Jt=new PropertyMixer(PropertyBinding.create(Vt,Zt,nn),Yt.ValueTypeName,Yt.getValueSize()),++Jt.referenceCount,this._addInactiveBinding(Jt,Wt,Zt),jt[Kt]=Jt}Ht[Kt].resultBuffer=Jt.buffer}}_activateAction(_e){if(!this._isActiveAction(_e)){if(_e._cacheIndex===null){const Vt=(_e._localRoot||this._root).uuid,Gt=_e._clip.uuid,zt=this._actionsByClip[Gt];this._bindAction(_e,zt&&zt.knownActions[0]),this._addInactiveAction(_e,Gt,Vt)}const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];zt.useCount++===0&&(this._lendBinding(zt),zt.saveOriginalState())}this._lendAction(_e)}}_deactivateAction(_e){if(this._isActiveAction(_e)){const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];--zt.useCount===0&&(zt.restoreOriginalState(),this._takeBackBinding(zt))}this._takeBackAction(_e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const _e=this;this.stats={actions:{get total(){return _e._actions.length},get inUse(){return _e._nActiveActions}},bindings:{get total(){return _e._bindings.length},get inUse(){return _e._nActiveBindings}},controlInterpolants:{get total(){return _e._controlInterpolants.length},get inUse(){return _e._nActiveControlInterpolants}}}}_isActiveAction(_e){const Dt=_e._cacheIndex;return Dt!==null&&Dt<this._nActiveActions}_addInactiveAction(_e,Dt,Vt){const Gt=this._actions,zt=this._actionsByClip;let jt=zt[Dt];if(jt===void 0)jt={knownActions:[_e],actionByRoot:{}},_e._byClipCacheIndex=0,zt[Dt]=jt;else{const Ht=jt.knownActions;_e._byClipCacheIndex=Ht.length,Ht.push(_e)}_e._cacheIndex=Gt.length,Gt.push(_e),jt.actionByRoot[Vt]=_e}_removeInactiveAction(_e){const Dt=this._actions,Vt=Dt[Dt.length-1],Gt=_e._cacheIndex;Vt._cacheIndex=Gt,Dt[Gt]=Vt,Dt.pop(),_e._cacheIndex=null;const zt=_e._clip.uuid,jt=this._actionsByClip,Ht=jt[zt],Wt=Ht.knownActions,qt=Wt[Wt.length-1],Xt=_e._byClipCacheIndex;qt._byClipCacheIndex=Xt,Wt[Xt]=qt,Wt.pop(),_e._byClipCacheIndex=null;const Kt=Ht.actionByRoot,Yt=(_e._localRoot||this._root).uuid;delete Kt[Yt],Wt.length===0&&delete jt[zt],this._removeInactiveBindingsForAction(_e)}_removeInactiveBindingsForAction(_e){const Dt=_e._propertyBindings;for(let Vt=0,Gt=Dt.length;Vt!==Gt;++Vt){const zt=Dt[Vt];--zt.referenceCount===0&&this._removeInactiveBinding(zt)}}_lendAction(_e){const Dt=this._actions,Vt=_e._cacheIndex,Gt=this._nActiveActions++,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_takeBackAction(_e){const Dt=this._actions,Vt=_e._cacheIndex,Gt=--this._nActiveActions,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_addInactiveBinding(_e,Dt,Vt){const Gt=this._bindingsByRootAndName,zt=this._bindings;let jt=Gt[Dt];jt===void 0&&(jt={},Gt[Dt]=jt),jt[Vt]=_e,_e._cacheIndex=zt.length,zt.push(_e)}_removeInactiveBinding(_e){const Dt=this._bindings,Vt=_e.binding,Gt=Vt.rootNode.uuid,zt=Vt.path,jt=this._bindingsByRootAndName,Ht=jt[Gt],Wt=Dt[Dt.length-1],qt=_e._cacheIndex;Wt._cacheIndex=qt,Dt[qt]=Wt,Dt.pop(),delete Ht[zt],Object.keys(Ht).length===0&&delete jt[Gt]}_lendBinding(_e){const Dt=this._bindings,Vt=_e._cacheIndex,Gt=this._nActiveBindings++,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_takeBackBinding(_e){const Dt=this._bindings,Vt=_e._cacheIndex,Gt=--this._nActiveBindings,zt=Dt[Gt];_e._cacheIndex=Gt,Dt[Gt]=_e,zt._cacheIndex=Vt,Dt[Vt]=zt}_lendControlInterpolant(){const _e=this._controlInterpolants,Dt=this._nActiveControlInterpolants++;let Vt=_e[Dt];return Vt===void 0&&(Vt=new LinearInterpolant(new Float32Array(2),new Float32Array(2),1,_controlInterpolantsResultBuffer),Vt.__cacheIndex=Dt,_e[Dt]=Vt),Vt}_takeBackControlInterpolant(_e){const Dt=this._controlInterpolants,Vt=_e.__cacheIndex,Gt=--this._nActiveControlInterpolants,zt=Dt[Gt];_e.__cacheIndex=Gt,Dt[Gt]=_e,zt.__cacheIndex=Vt,Dt[Vt]=zt}clipAction(_e,Dt,Vt){const Gt=Dt||this._root,zt=Gt.uuid;let jt=typeof _e=="string"?AnimationClip.findByName(Gt,_e):_e;const Ht=jt!==null?jt.uuid:_e,Wt=this._actionsByClip[Ht];let qt=null;if(Vt===void 0&&(jt!==null?Vt=jt.blendMode:Vt=NormalAnimationBlendMode),Wt!==void 0){const Kt=Wt.actionByRoot[zt];if(Kt!==void 0&&Kt.blendMode===Vt)return Kt;qt=Wt.knownActions[0],jt===null&&(jt=qt._clip)}if(jt===null)return null;const Xt=new AnimationAction(this,jt,Dt,Vt);return this._bindAction(Xt,qt),this._addInactiveAction(Xt,Ht,zt),Xt}existingAction(_e,Dt){const Vt=Dt||this._root,Gt=Vt.uuid,zt=typeof _e=="string"?AnimationClip.findByName(Vt,_e):_e,jt=zt?zt.uuid:_e,Ht=this._actionsByClip[jt];return Ht!==void 0&&Ht.actionByRoot[Gt]||null}stopAllAction(){const _e=this._actions,Dt=this._nActiveActions;for(let Vt=Dt-1;Vt>=0;--Vt)_e[Vt].stop();return this}update(_e){_e*=this.timeScale;const Dt=this._actions,Vt=this._nActiveActions,Gt=this.time+=_e,zt=Math.sign(_e),jt=this._accuIndex^=1;for(let qt=0;qt!==Vt;++qt)Dt[qt]._update(Gt,_e,zt,jt);const Ht=this._bindings,Wt=this._nActiveBindings;for(let qt=0;qt!==Wt;++qt)Ht[qt].apply(jt);return this}setTime(_e){this.time=0;for(let Dt=0;Dt<this._actions.length;Dt++)this._actions[Dt].time=0;return this.update(_e)}getRoot(){return this._root}uncacheClip(_e){const Dt=this._actions,Vt=_e.uuid,Gt=this._actionsByClip,zt=Gt[Vt];if(zt!==void 0){const jt=zt.knownActions;for(let Ht=0,Wt=jt.length;Ht!==Wt;++Ht){const qt=jt[Ht];this._deactivateAction(qt);const Xt=qt._cacheIndex,Kt=Dt[Dt.length-1];qt._cacheIndex=null,qt._byClipCacheIndex=null,Kt._cacheIndex=Xt,Dt[Xt]=Kt,Dt.pop(),this._removeInactiveBindingsForAction(qt)}delete Gt[Vt]}}uncacheRoot(_e){const Dt=_e.uuid,Vt=this._actionsByClip;for(const jt in Vt){const Ht=Vt[jt].actionByRoot,Wt=Ht[Dt];Wt!==void 0&&(this._deactivateAction(Wt),this._removeInactiveAction(Wt))}const Gt=this._bindingsByRootAndName,zt=Gt[Dt];if(zt!==void 0)for(const jt in zt){const Ht=zt[jt];Ht.restoreOriginalState(),this._removeInactiveBinding(Ht)}}uncacheAction(_e,Dt){const Vt=this.existingAction(_e,Dt);Vt!==null&&(this._deactivateAction(Vt),this._removeInactiveAction(Vt))}}class Uniform{constructor(_e){this.value=_e}clone(){return new Uniform(this.value.clone===void 0?this.value:this.value.clone())}}let _id=0;class UniformsGroup extends EventDispatcher$2{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:_id++}),this.name="",this.usage=StaticDrawUsage,this.uniforms=[]}add(_e){return this.uniforms.push(_e),this}remove(_e){const Dt=this.uniforms.indexOf(_e);return Dt!==-1&&this.uniforms.splice(Dt,1),this}setName(_e){return this.name=_e,this}setUsage(_e){return this.usage=_e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(_e){this.name=_e.name,this.usage=_e.usage;const Dt=_e.uniforms;this.uniforms.length=0;for(let Vt=0,Gt=Dt.length;Vt<Gt;Vt++){const zt=Array.isArray(Dt[Vt])?Dt[Vt]:[Dt[Vt]];for(let jt=0;jt<zt.length;jt++)this.uniforms.push(zt[jt].clone())}return this}clone(){return new this.constructor().copy(this)}}class InstancedInterleavedBuffer extends InterleavedBuffer{constructor(_e,Dt,Vt=1){super(_e,Dt),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=Vt}copy(_e){return super.copy(_e),this.meshPerAttribute=_e.meshPerAttribute,this}clone(_e){const Dt=super.clone(_e);return Dt.meshPerAttribute=this.meshPerAttribute,Dt}toJSON(_e){const Dt=super.toJSON(_e);return Dt.isInstancedInterleavedBuffer=!0,Dt.meshPerAttribute=this.meshPerAttribute,Dt}}class GLBufferAttribute{constructor(_e,Dt,Vt,Gt,zt){this.isGLBufferAttribute=!0,this.name="",this.buffer=_e,this.type=Dt,this.itemSize=Vt,this.elementSize=Gt,this.count=zt,this.version=0}set needsUpdate(_e){_e===!0&&this.version++}setBuffer(_e){return this.buffer=_e,this}setType(_e,Dt){return this.type=_e,this.elementSize=Dt,this}setItemSize(_e){return this.itemSize=_e,this}setCount(_e){return this.count=_e,this}}const _matrix=new Matrix4;class Raycaster{constructor(_e,Dt,Vt=0,Gt=1/0){this.ray=new Ray(_e,Dt),this.near=Vt,this.far=Gt,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(_e,Dt){this.ray.set(_e,Dt)}setFromCamera(_e,Dt){Dt.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(Dt.matrixWorld),this.ray.direction.set(_e.x,_e.y,.5).unproject(Dt).sub(this.ray.origin).normalize(),this.camera=Dt):Dt.isOrthographicCamera?(this.ray.origin.set(_e.x,_e.y,(Dt.near+Dt.far)/(Dt.near-Dt.far)).unproject(Dt),this.ray.direction.set(0,0,-1).transformDirection(Dt.matrixWorld),this.camera=Dt):console.error("THREE.Raycaster: Unsupported camera type: "+Dt.type)}setFromXRController(_e){return _matrix.identity().extractRotation(_e.matrixWorld),this.ray.origin.setFromMatrixPosition(_e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_matrix),this}intersectObject(_e,Dt=!0,Vt=[]){return intersect(_e,this,Vt,Dt),Vt.sort(ascSort),Vt}intersectObjects(_e,Dt=!0,Vt=[]){for(let Gt=0,zt=_e.length;Gt<zt;Gt++)intersect(_e[Gt],this,Vt,Dt);return Vt.sort(ascSort),Vt}}function ascSort(kt,_e){return kt.distance-_e.distance}function intersect(kt,_e,Dt,Vt){if(kt.layers.test(_e.layers)&&kt.raycast(_e,Dt),Vt===!0){const Gt=kt.children;for(let zt=0,jt=Gt.length;zt<jt;zt++)intersect(Gt[zt],_e,Dt,!0)}}class Spherical{constructor(_e=1,Dt=0,Vt=0){return this.radius=_e,this.phi=Dt,this.theta=Vt,this}set(_e,Dt,Vt){return this.radius=_e,this.phi=Dt,this.theta=Vt,this}copy(_e){return this.radius=_e.radius,this.phi=_e.phi,this.theta=_e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(_e){return this.setFromCartesianCoords(_e.x,_e.y,_e.z)}setFromCartesianCoords(_e,Dt,Vt){return this.radius=Math.sqrt(_e*_e+Dt*Dt+Vt*Vt),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(_e,Vt),this.phi=Math.acos(clamp$2(Dt/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Cylindrical{constructor(_e=1,Dt=0,Vt=0){return this.radius=_e,this.theta=Dt,this.y=Vt,this}set(_e,Dt,Vt){return this.radius=_e,this.theta=Dt,this.y=Vt,this}copy(_e){return this.radius=_e.radius,this.theta=_e.theta,this.y=_e.y,this}setFromVector3(_e){return this.setFromCartesianCoords(_e.x,_e.y,_e.z)}setFromCartesianCoords(_e,Dt,Vt){return this.radius=Math.sqrt(_e*_e+Vt*Vt),this.theta=Math.atan2(_e,Vt),this.y=Dt,this}clone(){return new this.constructor().copy(this)}}const _vector$4=new Vector2;class Box2{constructor(_e=new Vector2(1/0,1/0),Dt=new Vector2(-1/0,-1/0)){this.isBox2=!0,this.min=_e,this.max=Dt}set(_e,Dt){return this.min.copy(_e),this.max.copy(Dt),this}setFromPoints(_e){this.makeEmpty();for(let Dt=0,Vt=_e.length;Dt<Vt;Dt++)this.expandByPoint(_e[Dt]);return this}setFromCenterAndSize(_e,Dt){const Vt=_vector$4.copy(Dt).multiplyScalar(.5);return this.min.copy(_e).sub(Vt),this.max.copy(_e).add(Vt),this}clone(){return new this.constructor().copy(this)}copy(_e){return this.min.copy(_e.min),this.max.copy(_e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(_e){return this.isEmpty()?_e.set(0,0):_e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(_e){return this.isEmpty()?_e.set(0,0):_e.subVectors(this.max,this.min)}expandByPoint(_e){return this.min.min(_e),this.max.max(_e),this}expandByVector(_e){return this.min.sub(_e),this.max.add(_e),this}expandByScalar(_e){return this.min.addScalar(-_e),this.max.addScalar(_e),this}containsPoint(_e){return!(_e.x<this.min.x||_e.x>this.max.x||_e.y<this.min.y||_e.y>this.max.y)}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}getParameter(_e,Dt){return Dt.set((_e.x-this.min.x)/(this.max.x-this.min.x),(_e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(_e){return!(_e.max.x<this.min.x||_e.min.x>this.max.x||_e.max.y<this.min.y||_e.min.y>this.max.y)}clampPoint(_e,Dt){return Dt.copy(_e).clamp(this.min,this.max)}distanceToPoint(_e){return this.clampPoint(_e,_vector$4).distanceTo(_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}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)}}const _startP=new Vector3,_startEnd=new Vector3;class Line3{constructor(_e=new Vector3,Dt=new Vector3){this.start=_e,this.end=Dt}set(_e,Dt){return this.start.copy(_e),this.end.copy(Dt),this}copy(_e){return this.start.copy(_e.start),this.end.copy(_e.end),this}getCenter(_e){return _e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(_e){return _e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(_e,Dt){return this.delta(Dt).multiplyScalar(_e).add(this.start)}closestPointToPointParameter(_e,Dt){_startP.subVectors(_e,this.start),_startEnd.subVectors(this.end,this.start);const Vt=_startEnd.dot(_startEnd);let zt=_startEnd.dot(_startP)/Vt;return Dt&&(zt=clamp$2(zt,0,1)),zt}closestPointToPoint(_e,Dt,Vt){const Gt=this.closestPointToPointParameter(_e,Dt);return this.delta(Vt).multiplyScalar(Gt).add(this.start)}applyMatrix4(_e){return this.start.applyMatrix4(_e),this.end.applyMatrix4(_e),this}equals(_e){return _e.start.equals(this.start)&&_e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const _vector$3=new Vector3;class SpotLightHelper extends Object3D{constructor(_e,Dt){super(),this.light=_e,this.matrixAutoUpdate=!1,this.color=Dt,this.type="SpotLightHelper";const Vt=new BufferGeometry,Gt=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let jt=0,Ht=1,Wt=32;jt<Wt;jt++,Ht++){const qt=jt/Wt*Math.PI*2,Xt=Ht/Wt*Math.PI*2;Gt.push(Math.cos(qt),Math.sin(qt),1,Math.cos(Xt),Math.sin(Xt),1)}Vt.setAttribute("position",new Float32BufferAttribute(Gt,3));const zt=new LineBasicMaterial({fog:!1,toneMapped:!1});this.cone=new LineSegments(Vt,zt),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const _e=this.light.distance?this.light.distance:1e3,Dt=_e*Math.tan(this.light.angle);this.cone.scale.set(Dt,Dt,_e),_vector$3.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(_vector$3),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const _vector$2=new Vector3,_boneMatrix=new Matrix4,_matrixWorldInv=new Matrix4;class SkeletonHelper extends LineSegments{constructor(_e){const Dt=getBoneList(_e),Vt=new BufferGeometry,Gt=[],zt=[],jt=new Color$1(0,0,1),Ht=new Color$1(0,1,0);for(let qt=0;qt<Dt.length;qt++){const Xt=Dt[qt];Xt.parent&&Xt.parent.isBone&&(Gt.push(0,0,0),Gt.push(0,0,0),zt.push(jt.r,jt.g,jt.b),zt.push(Ht.r,Ht.g,Ht.b))}Vt.setAttribute("position",new Float32BufferAttribute(Gt,3)),Vt.setAttribute("color",new Float32BufferAttribute(zt,3));const Wt=new LineBasicMaterial({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(Vt,Wt),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=_e,this.bones=Dt,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(_e){const Dt=this.bones,Vt=this.geometry,Gt=Vt.getAttribute("position");_matrixWorldInv.copy(this.root.matrixWorld).invert();for(let zt=0,jt=0;zt<Dt.length;zt++){const Ht=Dt[zt];Ht.parent&&Ht.parent.isBone&&(_boneMatrix.multiplyMatrices(_matrixWorldInv,Ht.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),Gt.setXYZ(jt,_vector$2.x,_vector$2.y,_vector$2.z),_boneMatrix.multiplyMatrices(_matrixWorldInv,Ht.parent.matrixWorld),_vector$2.setFromMatrixPosition(_boneMatrix),Gt.setXYZ(jt+1,_vector$2.x,_vector$2.y,_vector$2.z),jt+=2)}Vt.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(_e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function getBoneList(kt){const _e=[];kt.isBone===!0&&_e.push(kt);for(let Dt=0;Dt<kt.children.length;Dt++)_e.push.apply(_e,getBoneList(kt.children[Dt]));return _e}class PointLightHelper extends Mesh{constructor(_e,Dt,Vt){const Gt=new SphereGeometry(Dt,4,2),zt=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1});super(Gt,zt),this.light=_e,this.color=Vt,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const _vector$1=new Vector3,_color1=new Color$1,_color2=new Color$1;class HemisphereLightHelper extends Object3D{constructor(_e,Dt,Vt){super(),this.light=_e,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.color=Vt,this.type="HemisphereLightHelper";const Gt=new OctahedronGeometry(Dt);Gt.rotateY(Math.PI*.5),this.material=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const zt=Gt.getAttribute("position"),jt=new Float32Array(zt.count*3);Gt.setAttribute("color",new BufferAttribute(jt,3)),this.add(new Mesh(Gt,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const _e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const Dt=_e.geometry.getAttribute("color");_color1.copy(this.light.color),_color2.copy(this.light.groundColor);for(let Vt=0,Gt=Dt.count;Vt<Gt;Vt++){const zt=Vt<Gt/2?_color1:_color2;Dt.setXYZ(Vt,zt.r,zt.g,zt.b)}Dt.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),_e.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate())}}class GridHelper extends LineSegments{constructor(_e=10,Dt=10,Vt=4473924,Gt=8947848){Vt=new Color$1(Vt),Gt=new Color$1(Gt);const zt=Dt/2,jt=_e/Dt,Ht=_e/2,Wt=[],qt=[];for(let Yt=0,Zt=0,Jt=-Ht;Yt<=Dt;Yt++,Jt+=jt){Wt.push(-Ht,0,Jt,Ht,0,Jt),Wt.push(Jt,0,-Ht,Jt,0,Ht);const nn=Yt===zt?Vt:Gt;nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3,nn.toArray(qt,Zt),Zt+=3}const Xt=new BufferGeometry;Xt.setAttribute("position",new Float32BufferAttribute(Wt,3)),Xt.setAttribute("color",new Float32BufferAttribute(qt,3));const Kt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(Xt,Kt),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class PolarGridHelper extends LineSegments{constructor(_e=10,Dt=16,Vt=8,Gt=64,zt=4473924,jt=8947848){zt=new Color$1(zt),jt=new Color$1(jt);const Ht=[],Wt=[];if(Dt>1)for(let Kt=0;Kt<Dt;Kt++){const Yt=Kt/Dt*(Math.PI*2),Zt=Math.sin(Yt)*_e,Jt=Math.cos(Yt)*_e;Ht.push(0,0,0),Ht.push(Zt,0,Jt);const nn=Kt&1?zt:jt;Wt.push(nn.r,nn.g,nn.b),Wt.push(nn.r,nn.g,nn.b)}for(let Kt=0;Kt<Vt;Kt++){const Yt=Kt&1?zt:jt,Zt=_e-_e/Vt*Kt;for(let Jt=0;Jt<Gt;Jt++){let nn=Jt/Gt*(Math.PI*2),rn=Math.sin(nn)*Zt,Qt=Math.cos(nn)*Zt;Ht.push(rn,0,Qt),Wt.push(Yt.r,Yt.g,Yt.b),nn=(Jt+1)/Gt*(Math.PI*2),rn=Math.sin(nn)*Zt,Qt=Math.cos(nn)*Zt,Ht.push(rn,0,Qt),Wt.push(Yt.r,Yt.g,Yt.b)}}const qt=new BufferGeometry;qt.setAttribute("position",new Float32BufferAttribute(Ht,3)),qt.setAttribute("color",new Float32BufferAttribute(Wt,3));const Xt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(qt,Xt),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const _v1=new Vector3,_v2$5=new Vector3,_v3=new Vector3;class DirectionalLightHelper extends Object3D{constructor(_e,Dt,Vt){super(),this.light=_e,this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.color=Vt,this.type="DirectionalLightHelper",Dt===void 0&&(Dt=1);let Gt=new BufferGeometry;Gt.setAttribute("position",new Float32BufferAttribute([-Dt,Dt,0,Dt,Dt,0,Dt,-Dt,0,-Dt,-Dt,0,-Dt,Dt,0],3));const zt=new LineBasicMaterial({fog:!1,toneMapped:!1});this.lightPlane=new Line(Gt,zt),this.add(this.lightPlane),Gt=new BufferGeometry,Gt.setAttribute("position",new Float32BufferAttribute([0,0,0,0,0,1],3)),this.targetLine=new Line(Gt,zt),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),_v1.setFromMatrixPosition(this.light.matrixWorld),_v2$5.setFromMatrixPosition(this.light.target.matrixWorld),_v3.subVectors(_v2$5,_v1),this.lightPlane.lookAt(_v2$5),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(_v2$5),this.targetLine.scale.z=_v3.length()}}const _vector=new Vector3,_camera=new Camera;class CameraHelper extends LineSegments{constructor(_e){const Dt=new BufferGeometry,Vt=new LineBasicMaterial({color:16777215,vertexColors:!0,toneMapped:!1}),Gt=[],zt=[],jt={};Ht("n1","n2"),Ht("n2","n4"),Ht("n4","n3"),Ht("n3","n1"),Ht("f1","f2"),Ht("f2","f4"),Ht("f4","f3"),Ht("f3","f1"),Ht("n1","f1"),Ht("n2","f2"),Ht("n3","f3"),Ht("n4","f4"),Ht("p","n1"),Ht("p","n2"),Ht("p","n3"),Ht("p","n4"),Ht("u1","u2"),Ht("u2","u3"),Ht("u3","u1"),Ht("c","t"),Ht("p","c"),Ht("cn1","cn2"),Ht("cn3","cn4"),Ht("cf1","cf2"),Ht("cf3","cf4");function Ht(Jt,nn){Wt(Jt),Wt(nn)}function Wt(Jt){Gt.push(0,0,0),zt.push(0,0,0),jt[Jt]===void 0&&(jt[Jt]=[]),jt[Jt].push(Gt.length/3-1)}Dt.setAttribute("position",new Float32BufferAttribute(Gt,3)),Dt.setAttribute("color",new Float32BufferAttribute(zt,3)),super(Dt,Vt),this.type="CameraHelper",this.camera=_e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=_e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=jt,this.update();const qt=new Color$1(16755200),Xt=new Color$1(16711680),Kt=new Color$1(43775),Yt=new Color$1(16777215),Zt=new Color$1(3355443);this.setColors(qt,Xt,Kt,Yt,Zt)}setColors(_e,Dt,Vt,Gt,zt){const Ht=this.geometry.getAttribute("color");Ht.setXYZ(0,_e.r,_e.g,_e.b),Ht.setXYZ(1,_e.r,_e.g,_e.b),Ht.setXYZ(2,_e.r,_e.g,_e.b),Ht.setXYZ(3,_e.r,_e.g,_e.b),Ht.setXYZ(4,_e.r,_e.g,_e.b),Ht.setXYZ(5,_e.r,_e.g,_e.b),Ht.setXYZ(6,_e.r,_e.g,_e.b),Ht.setXYZ(7,_e.r,_e.g,_e.b),Ht.setXYZ(8,_e.r,_e.g,_e.b),Ht.setXYZ(9,_e.r,_e.g,_e.b),Ht.setXYZ(10,_e.r,_e.g,_e.b),Ht.setXYZ(11,_e.r,_e.g,_e.b),Ht.setXYZ(12,_e.r,_e.g,_e.b),Ht.setXYZ(13,_e.r,_e.g,_e.b),Ht.setXYZ(14,_e.r,_e.g,_e.b),Ht.setXYZ(15,_e.r,_e.g,_e.b),Ht.setXYZ(16,_e.r,_e.g,_e.b),Ht.setXYZ(17,_e.r,_e.g,_e.b),Ht.setXYZ(18,_e.r,_e.g,_e.b),Ht.setXYZ(19,_e.r,_e.g,_e.b),Ht.setXYZ(20,_e.r,_e.g,_e.b),Ht.setXYZ(21,_e.r,_e.g,_e.b),Ht.setXYZ(22,_e.r,_e.g,_e.b),Ht.setXYZ(23,_e.r,_e.g,_e.b),Ht.setXYZ(24,Dt.r,Dt.g,Dt.b),Ht.setXYZ(25,Dt.r,Dt.g,Dt.b),Ht.setXYZ(26,Dt.r,Dt.g,Dt.b),Ht.setXYZ(27,Dt.r,Dt.g,Dt.b),Ht.setXYZ(28,Dt.r,Dt.g,Dt.b),Ht.setXYZ(29,Dt.r,Dt.g,Dt.b),Ht.setXYZ(30,Dt.r,Dt.g,Dt.b),Ht.setXYZ(31,Dt.r,Dt.g,Dt.b),Ht.setXYZ(32,Vt.r,Vt.g,Vt.b),Ht.setXYZ(33,Vt.r,Vt.g,Vt.b),Ht.setXYZ(34,Vt.r,Vt.g,Vt.b),Ht.setXYZ(35,Vt.r,Vt.g,Vt.b),Ht.setXYZ(36,Vt.r,Vt.g,Vt.b),Ht.setXYZ(37,Vt.r,Vt.g,Vt.b),Ht.setXYZ(38,Gt.r,Gt.g,Gt.b),Ht.setXYZ(39,Gt.r,Gt.g,Gt.b),Ht.setXYZ(40,zt.r,zt.g,zt.b),Ht.setXYZ(41,zt.r,zt.g,zt.b),Ht.setXYZ(42,zt.r,zt.g,zt.b),Ht.setXYZ(43,zt.r,zt.g,zt.b),Ht.setXYZ(44,zt.r,zt.g,zt.b),Ht.setXYZ(45,zt.r,zt.g,zt.b),Ht.setXYZ(46,zt.r,zt.g,zt.b),Ht.setXYZ(47,zt.r,zt.g,zt.b),Ht.setXYZ(48,zt.r,zt.g,zt.b),Ht.setXYZ(49,zt.r,zt.g,zt.b),Ht.needsUpdate=!0}update(){const _e=this.geometry,Dt=this.pointMap,Vt=1,Gt=1;_camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),setPoint("c",Dt,_e,_camera,0,0,-1),setPoint("t",Dt,_e,_camera,0,0,1),setPoint("n1",Dt,_e,_camera,-Vt,-Gt,-1),setPoint("n2",Dt,_e,_camera,Vt,-Gt,-1),setPoint("n3",Dt,_e,_camera,-Vt,Gt,-1),setPoint("n4",Dt,_e,_camera,Vt,Gt,-1),setPoint("f1",Dt,_e,_camera,-Vt,-Gt,1),setPoint("f2",Dt,_e,_camera,Vt,-Gt,1),setPoint("f3",Dt,_e,_camera,-Vt,Gt,1),setPoint("f4",Dt,_e,_camera,Vt,Gt,1),setPoint("u1",Dt,_e,_camera,Vt*.7,Gt*1.1,-1),setPoint("u2",Dt,_e,_camera,-Vt*.7,Gt*1.1,-1),setPoint("u3",Dt,_e,_camera,0,Gt*2,-1),setPoint("cf1",Dt,_e,_camera,-Vt,0,1),setPoint("cf2",Dt,_e,_camera,Vt,0,1),setPoint("cf3",Dt,_e,_camera,0,-Gt,1),setPoint("cf4",Dt,_e,_camera,0,Gt,1),setPoint("cn1",Dt,_e,_camera,-Vt,0,-1),setPoint("cn2",Dt,_e,_camera,Vt,0,-1),setPoint("cn3",Dt,_e,_camera,0,-Gt,-1),setPoint("cn4",Dt,_e,_camera,0,Gt,-1),_e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function setPoint(kt,_e,Dt,Vt,Gt,zt,jt){_vector.set(Gt,zt,jt).unproject(Vt);const Ht=_e[kt];if(Ht!==void 0){const Wt=Dt.getAttribute("position");for(let qt=0,Xt=Ht.length;qt<Xt;qt++)Wt.setXYZ(Ht[qt],_vector.x,_vector.y,_vector.z)}}const _box=new Box3;class BoxHelper extends LineSegments{constructor(_e,Dt=16776960){const Vt=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Gt=new Float32Array(8*3),zt=new BufferGeometry;zt.setIndex(new BufferAttribute(Vt,1)),zt.setAttribute("position",new BufferAttribute(Gt,3)),super(zt,new LineBasicMaterial({color:Dt,toneMapped:!1})),this.object=_e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(_e){if(_e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&_box.setFromObject(this.object),_box.isEmpty())return;const Dt=_box.min,Vt=_box.max,Gt=this.geometry.attributes.position,zt=Gt.array;zt[0]=Vt.x,zt[1]=Vt.y,zt[2]=Vt.z,zt[3]=Dt.x,zt[4]=Vt.y,zt[5]=Vt.z,zt[6]=Dt.x,zt[7]=Dt.y,zt[8]=Vt.z,zt[9]=Vt.x,zt[10]=Dt.y,zt[11]=Vt.z,zt[12]=Vt.x,zt[13]=Vt.y,zt[14]=Dt.z,zt[15]=Dt.x,zt[16]=Vt.y,zt[17]=Dt.z,zt[18]=Dt.x,zt[19]=Dt.y,zt[20]=Dt.z,zt[21]=Vt.x,zt[22]=Dt.y,zt[23]=Dt.z,Gt.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(_e){return this.object=_e,this.update(),this}copy(_e,Dt){return super.copy(_e,Dt),this.object=_e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Box3Helper extends LineSegments{constructor(_e,Dt=16776960){const Vt=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Gt=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],zt=new BufferGeometry;zt.setIndex(new BufferAttribute(Vt,1)),zt.setAttribute("position",new Float32BufferAttribute(Gt,3)),super(zt,new LineBasicMaterial({color:Dt,toneMapped:!1})),this.box=_e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(_e){const Dt=this.box;Dt.isEmpty()||(Dt.getCenter(this.position),Dt.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(_e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class PlaneHelper extends Line{constructor(_e,Dt=1,Vt=16776960){const Gt=Vt,zt=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],jt=new BufferGeometry;jt.setAttribute("position",new Float32BufferAttribute(zt,3)),jt.computeBoundingSphere(),super(jt,new LineBasicMaterial({color:Gt,toneMapped:!1})),this.type="PlaneHelper",this.plane=_e,this.size=Dt;const Ht=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],Wt=new BufferGeometry;Wt.setAttribute("position",new Float32BufferAttribute(Ht,3)),Wt.computeBoundingSphere(),this.add(new Mesh(Wt,new MeshBasicMaterial({color:Gt,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(_e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(_e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const _axis=new Vector3;let _lineGeometry,_coneGeometry;class ArrowHelper extends Object3D{constructor(_e=new Vector3(0,0,1),Dt=new Vector3(0,0,0),Vt=1,Gt=16776960,zt=Vt*.2,jt=zt*.2){super(),this.type="ArrowHelper",_lineGeometry===void 0&&(_lineGeometry=new BufferGeometry,_lineGeometry.setAttribute("position",new Float32BufferAttribute([0,0,0,0,1,0],3)),_coneGeometry=new CylinderGeometry(0,.5,1,5,1),_coneGeometry.translate(0,-.5,0)),this.position.copy(Dt),this.line=new Line(_lineGeometry,new LineBasicMaterial({color:Gt,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Mesh(_coneGeometry,new MeshBasicMaterial({color:Gt,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(_e),this.setLength(Vt,zt,jt)}setDirection(_e){if(_e.y>.99999)this.quaternion.set(0,0,0,1);else if(_e.y<-.99999)this.quaternion.set(1,0,0,0);else{_axis.set(_e.z,0,-_e.x).normalize();const Dt=Math.acos(_e.y);this.quaternion.setFromAxisAngle(_axis,Dt)}}setLength(_e,Dt=_e*.2,Vt=Dt*.2){this.line.scale.set(1,Math.max(1e-4,_e-Dt),1),this.line.updateMatrix(),this.cone.scale.set(Vt,Dt,Vt),this.cone.position.y=_e,this.cone.updateMatrix()}setColor(_e){this.line.material.color.set(_e),this.cone.material.color.set(_e)}copy(_e){return super.copy(_e,!1),this.line.copy(_e.line),this.cone.copy(_e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class AxesHelper extends LineSegments{constructor(_e=1){const Dt=[0,0,0,_e,0,0,0,0,0,0,_e,0,0,0,0,0,0,_e],Vt=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],Gt=new BufferGeometry;Gt.setAttribute("position",new Float32BufferAttribute(Dt,3)),Gt.setAttribute("color",new Float32BufferAttribute(Vt,3));const zt=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(Gt,zt),this.type="AxesHelper"}setColors(_e,Dt,Vt){const Gt=new Color$1,zt=this.geometry.attributes.color.array;return Gt.set(_e),Gt.toArray(zt,0),Gt.toArray(zt,3),Gt.set(Dt),Gt.toArray(zt,6),Gt.toArray(zt,9),Gt.set(Vt),Gt.toArray(zt,12),Gt.toArray(zt,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ShapePath{constructor(){this.type="ShapePath",this.color=new Color$1,this.subPaths=[],this.currentPath=null}moveTo(_e,Dt){return this.currentPath=new Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(_e,Dt),this}lineTo(_e,Dt){return this.currentPath.lineTo(_e,Dt),this}quadraticCurveTo(_e,Dt,Vt,Gt){return this.currentPath.quadraticCurveTo(_e,Dt,Vt,Gt),this}bezierCurveTo(_e,Dt,Vt,Gt,zt,jt){return this.currentPath.bezierCurveTo(_e,Dt,Vt,Gt,zt,jt),this}splineThru(_e){return this.currentPath.splineThru(_e),this}toShapes(_e){function Dt(Qt){const en=[];for(let tn=0,sn=Qt.length;tn<sn;tn++){const cn=Qt[tn],un=new Shape;un.curves=cn.curves,en.push(un)}return en}function Vt(Qt,en){const tn=en.length;let sn=!1;for(let cn=tn-1,un=0;un<tn;cn=un++){let hn=en[cn],fn=en[un],pn=fn.x-hn.x,dn=fn.y-hn.y;if(Math.abs(dn)>Number.EPSILON){if(dn<0&&(hn=en[un],pn=-pn,fn=en[cn],dn=-dn),Qt.y<hn.y||Qt.y>fn.y)continue;if(Qt.y===hn.y){if(Qt.x===hn.x)return!0}else{const mn=dn*(Qt.x-hn.x)-pn*(Qt.y-hn.y);if(mn===0)return!0;if(mn<0)continue;sn=!sn}}else{if(Qt.y!==hn.y)continue;if(fn.x<=Qt.x&&Qt.x<=hn.x||hn.x<=Qt.x&&Qt.x<=fn.x)return!0}}return sn}const Gt=ShapeUtils.isClockWise,zt=this.subPaths;if(zt.length===0)return[];let jt,Ht,Wt;const qt=[];if(zt.length===1)return Ht=zt[0],Wt=new Shape,Wt.curves=Ht.curves,qt.push(Wt),qt;let Xt=!Gt(zt[0].getPoints());Xt=_e?!Xt:Xt;const Kt=[],Yt=[];let Zt=[],Jt=0,nn;Yt[Jt]=void 0,Zt[Jt]=[];for(let Qt=0,en=zt.length;Qt<en;Qt++)Ht=zt[Qt],nn=Ht.getPoints(),jt=Gt(nn),jt=_e?!jt:jt,jt?(!Xt&&Yt[Jt]&&Jt++,Yt[Jt]={s:new Shape,p:nn},Yt[Jt].s.curves=Ht.curves,Xt&&Jt++,Zt[Jt]=[]):Zt[Jt].push({h:Ht,p:nn[0]});if(!Yt[0])return Dt(zt);if(Yt.length>1){let Qt=!1,en=0;for(let tn=0,sn=Yt.length;tn<sn;tn++)Kt[tn]=[];for(let tn=0,sn=Yt.length;tn<sn;tn++){const cn=Zt[tn];for(let un=0;un<cn.length;un++){const hn=cn[un];let fn=!0;for(let pn=0;pn<Yt.length;pn++)Vt(hn.p,Yt[pn].p)&&(tn!==pn&&en++,fn?(fn=!1,Kt[pn].push(hn)):Qt=!0);fn&&Kt[tn].push(hn)}}en>0&&Qt===!1&&(Zt=Kt)}let rn;for(let Qt=0,en=Yt.length;Qt<en;Qt++){Wt=Yt[Qt].s,qt.push(Wt),rn=Zt[Qt];for(let tn=0,sn=rn.length;tn<sn;tn++)Wt.holes.push(rn[tn].h)}return qt}}class WebGLMultipleRenderTargets extends WebGLRenderTarget{constructor(_e=1,Dt=1,Vt=1,Gt={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(_e,Dt,{...Gt,count:Vt}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:REVISION}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=REVISION);const THREE$1=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping,AddEquation,AddOperation,AdditiveAnimationBlendMode,AdditiveBlending,AgXToneMapping,AlphaFormat,AlwaysCompare,AlwaysDepth,AlwaysStencilFunc,AmbientLight,AnimationAction,AnimationClip,AnimationLoader,AnimationMixer,AnimationObjectGroup,AnimationUtils,ArcCurve,ArrayCamera,ArrowHelper,AttachedBindMode,Audio,AudioAnalyser,AudioContext,AudioListener,AudioLoader,AxesHelper,BackSide,BasicDepthPacking,BasicShadowMap,BatchedMesh,Bone,BooleanKeyframeTrack,Box2,Box3,Box3Helper,BoxGeometry,BoxHelper,BufferAttribute,BufferGeometry,BufferGeometryLoader,ByteType,Cache,Camera,CameraHelper,CanvasTexture,CapsuleGeometry,CatmullRomCurve3,CineonToneMapping,CircleGeometry,ClampToEdgeWrapping,Clock,Color:Color$1,ColorKeyframeTrack,ColorManagement,CompressedArrayTexture,CompressedCubeTexture,CompressedTexture,CompressedTextureLoader,ConeGeometry,ConstantAlphaFactor,ConstantColorFactor,CubeCamera,CubeReflectionMapping,CubeRefractionMapping,CubeTexture,CubeTextureLoader,CubeUVReflectionMapping,CubicBezierCurve,CubicBezierCurve3,CubicInterpolant,CullFaceBack,CullFaceFront,CullFaceFrontBack,CullFaceNone,Curve,CurvePath,CustomBlending,CustomToneMapping,CylinderGeometry,Cylindrical,Data3DTexture,DataArrayTexture,DataTexture,DataTextureLoader,DataUtils,DecrementStencilOp,DecrementWrapStencilOp,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DepthTexture,DetachedBindMode,DirectionalLight,DirectionalLightHelper,DiscreteInterpolant,DisplayP3ColorSpace,DodecahedronGeometry,DoubleSide,DstAlphaFactor,DstColorFactor,DynamicCopyUsage,DynamicDrawUsage,DynamicReadUsage,EdgesGeometry,EllipseCurve,EqualCompare,EqualDepth,EqualStencilFunc,EquirectangularReflectionMapping,EquirectangularRefractionMapping,Euler,EventDispatcher:EventDispatcher$2,ExtrudeGeometry,FileLoader,Float16BufferAttribute,Float32BufferAttribute,FloatType,Fog,FogExp2,FramebufferTexture,FrontSide,Frustum,GLBufferAttribute,GLSL1,GLSL3,GreaterCompare,GreaterDepth,GreaterEqualCompare,GreaterEqualDepth,GreaterEqualStencilFunc,GreaterStencilFunc,GridHelper,Group,HalfFloatType,HemisphereLight,HemisphereLightHelper,IcosahedronGeometry,ImageBitmapLoader,ImageLoader,ImageUtils,IncrementStencilOp,IncrementWrapStencilOp,InstancedBufferAttribute,InstancedBufferGeometry,InstancedInterleavedBuffer,InstancedMesh,Int16BufferAttribute,Int32BufferAttribute,Int8BufferAttribute,IntType,InterleavedBuffer,InterleavedBufferAttribute,Interpolant,InterpolateDiscrete,InterpolateLinear,InterpolateSmooth,InvertStencilOp,KeepStencilOp,KeyframeTrack,LOD,LatheGeometry,Layers,LessCompare,LessDepth,LessEqualCompare,LessEqualDepth,LessEqualStencilFunc,LessStencilFunc,Light,LightProbe,Line,Line3,LineBasicMaterial,LineCurve,LineCurve3,LineDashedMaterial,LineLoop,LineSegments,LinearDisplayP3ColorSpace,LinearFilter,LinearInterpolant,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,LinearSRGBColorSpace:LinearSRGBColorSpace$1,LinearToneMapping,LinearTransfer,Loader,LoaderUtils,LoadingManager,LoopOnce:LoopOnce$1,LoopPingPong,LoopRepeat:LoopRepeat$1,LuminanceAlphaFormat,LuminanceFormat,MOUSE,Material,MaterialLoader,MathUtils,Matrix3,Matrix4,MaxEquation,Mesh,MeshBasicMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshLambertMaterial,MeshMatcapMaterial,MeshNormalMaterial,MeshPhongMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshToonMaterial,MinEquation,MirroredRepeatWrapping,MixOperation,MultiplyBlending,MultiplyOperation,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,NeutralToneMapping,NeverCompare,NeverDepth,NeverStencilFunc,NoBlending,NoColorSpace,NoToneMapping,NormalAnimationBlendMode,NormalBlending,NotEqualCompare,NotEqualDepth,NotEqualStencilFunc,NumberKeyframeTrack,Object3D,ObjectLoader,ObjectSpaceNormalMap,OctahedronGeometry,OneFactor,OneMinusConstantAlphaFactor,OneMinusConstantColorFactor,OneMinusDstAlphaFactor,OneMinusDstColorFactor,OneMinusSrcAlphaFactor,OneMinusSrcColorFactor,OrthographicCamera,P3Primaries,PCFShadowMap,PCFSoftShadowMap,PMREMGenerator,Path,PerspectiveCamera,Plane,PlaneGeometry,PlaneHelper,PointLight,PointLightHelper,Points,PointsMaterial,PolarGridHelper,PolyhedronGeometry,PositionalAudio,PropertyBinding,PropertyMixer,QuadraticBezierCurve,QuadraticBezierCurve3,Quaternion,QuaternionKeyframeTrack,QuaternionLinearInterpolant,RED_GREEN_RGTC2_Format,RED_RGTC1_Format,REVISION,RGBADepthPacking,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_BPTC_SIGNED_Format,RGB_BPTC_UNSIGNED_Format,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,RawShaderMaterial,Ray,Raycaster,Rec709Primaries,RectAreaLight,RedFormat,RedIntegerFormat,ReinhardToneMapping,RenderTarget,RepeatWrapping,ReplaceStencilOp,ReverseSubtractEquation,RingGeometry,SIGNED_RED_GREEN_RGTC2_Format,SIGNED_RED_RGTC1_Format,SRGBColorSpace:SRGBColorSpace$1,SRGBTransfer,Scene,ShaderChunk,ShaderLib,ShaderMaterial,ShadowMaterial,Shape,ShapeGeometry,ShapePath,ShapeUtils,ShortType,Skeleton,SkeletonHelper,SkinnedMesh,Source,Sphere,SphereGeometry,Spherical,SphericalHarmonics3,SplineCurve,SpotLight,SpotLightHelper,Sprite,SpriteMaterial,SrcAlphaFactor,SrcAlphaSaturateFactor,SrcColorFactor,StaticCopyUsage,StaticDrawUsage,StaticReadUsage,StereoCamera,StreamCopyUsage,StreamDrawUsage,StreamReadUsage,StringKeyframeTrack,SubtractEquation,SubtractiveBlending,TOUCH,TangentSpaceNormalMap,TetrahedronGeometry,Texture,TextureLoader,TorusGeometry,TorusKnotGeometry,Triangle,TriangleFanDrawMode,TriangleStripDrawMode,TrianglesDrawMode,TubeGeometry,UVMapping,Uint16BufferAttribute,Uint32BufferAttribute,Uint8BufferAttribute,Uint8ClampedBufferAttribute,Uniform,UniformsGroup,UniformsLib,UniformsUtils,UnsignedByteType,UnsignedInt248Type,UnsignedInt5999Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VSMShadowMap,Vector2,Vector3,Vector4,VectorKeyframeTrack,VideoTexture,WebGL3DRenderTarget,WebGLArrayRenderTarget,WebGLCoordinateSystem,WebGLCubeRenderTarget,WebGLMultipleRenderTargets,WebGLRenderTarget,WebGLRenderer,WebGLUtils,WebGPUCoordinateSystem,WireframeGeometry,WrapAroundEnding,ZeroCurvatureEnding,ZeroFactor,ZeroSlopeEnding,ZeroStencilOp,createCanvasElement},Symbol.toStringTag,{value:"Module"})),hotspotIdPrefix="rd",hotspotIdSeparator="_";function generateHotspotAbsoluteID(kt,_e){return`${hotspotIdPrefix}${hotspotIdSeparator}${kt}${hotspotIdSeparator}${_e}`}async function wait(kt){return LOGGER.info({title:`Waiting for ${kt}ms`}),new Promise((_e,Dt)=>{setTimeout(()=>{_e(!0)},kt)})}function compareObjects(kt,_e){if(kt===null||_e===null)return!1;for(let Dt in kt)if(kt.hasOwnProperty(Dt)&&_e.hasOwnProperty(Dt)&&kt[Dt]!==_e[Dt])return!1;return Object.keys(kt).length===Object.keys(_e).length}const capitalize$1=kt=>kt&&kt[0].toUpperCase()+kt.slice(1)||"",mobileCheck=function(){let kt=!1;return function(_e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(_e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(_e.substr(0,4)))&&(kt=!0)}(navigator.userAgent||navigator.vendor||window.opera),kt};function isIpadOS(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function tabletCheck(){const kt=navigator.userAgent.toLowerCase(),_e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(kt);return _e||isIpadOS()}function touchDeviceCheck(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function getJSONFromEndpoint(kt){let _e={data:null,report:"",success:!1};try{const Vt=await(await fetch(kt)).text();_e.data=JSON.parse(Vt),_e.success=!0,_e.report="Successfully fetched JSON data."}catch(Dt){_e.report=Dt,_e.success=!1}return _e}const addVector=(kt,_e)=>new Vector3(kt[0]+_e[0],kt[1]+_e[1],kt[2]+_e[2]),Vec3ToArr=kt=>[kt.x,kt.y,kt.z],ArrToVec3=kt=>new Vector3(kt[0],kt[1],kt[2]),numberWithCommas=kt=>kt.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),findMeshAndCloneMatFromScene=(kt,_e,Dt=!0)=>{let Vt=[];const Gt=kt.coreSceneStore.getState().sceneSettings.outOfStock_EmissiveColor,zt=kt.coreSceneStore.getState().sceneSettings.outOfStock_EmissiveIntensity;return _e.traverse(jt=>{jt.isMesh&&(jt.material.userData.cloned?jt.material.userData.inStock!==Dt&&(Dt?(jt.material.emissive.set(new Color$1(255,255,255)),jt.material.emissiveIntensity=0):(jt.material.emissive.set(new Color$1(Gt.r,Gt.g,Gt.b)),jt.material.emissiveIntensity=zt),jt.material.userData.inStock=Dt):(jt.material=jt.material.clone(),jt.material.userData.inStock=Dt,jt.material.userData.cloned=!0,Dt?(jt.material.emissive.set(new Color$1(255,255,255)),jt.material.emissiveIntensity=0):(jt.material.emissive.set(new Color$1(Gt.r,Gt.g,Gt.b)),jt.material.emissiveIntensity=zt)),Vt.push(jt))}),Vt},filterArrWithCondition=(kt,_e)=>{let Dt=0,Vt=[];for(let Gt=0;Gt<kt.length;Gt++){const zt=kt[Gt];_e(zt)?kt[Dt++]=zt:Vt.push(kt[Gt])}return kt.length=Dt,Vt},degToRad=kt=>kt*Math.PI/180,resolveAssetUrl=kt=>{if(!kt)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(kt))return kt;let Vt=kt;return Vt=Vt.replaceAll("<@all-projects@>",ALL_PROJECTS_ASSET_DATA_ROOT_URL),Vt=Vt.replaceAll("<@generic-project@>",GENERIC_PROJECT_ASSET_DATA_ROOT_URL),Vt};function componentToHex(kt){let _e=kt.toString(16);return _e.length==1?"0"+_e:_e}function rgbToHex(kt,_e,Dt){return"#"+componentToHex(kt)+componentToHex(_e)+componentToHex(Dt)}function getUrlParameterByName(kt,_e=window.location.search){const Dt=new URLSearchParams(_e);return Object.fromEntries(Dt.entries())[kt]}function _dispose3(kt){kt.geometry&&kt.geometry.dispose(),kt.material&&(Array.isArray(kt.material)?kt.material.forEach(_e=>_e.dispose()):kt.material.dispose()),kt.texture&&kt.texture.dispose()}function dispose3(kt){kt.traverse(_e=>{_dispose3(_e)}),_dispose3(kt)}const findVariantForGUID=(kt,_e)=>{const Dt=kt.attachmentStore.getState().attachmentSystem,Gt=kt.itemStore.getState().itemsSpawned[_e];let zt=Dt.currentStructure.getNodeByGUID(_e);if(!zt)return;let jt="";if(zt.overrideVariant)jt=zt.overrideVariant,kt.coreSceneStore.getState().CORE_API.fireEvent(kt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0);else{const Ht=Dt.globalVariants;if(!Ht||Ht.Count<=0)return;let Wt=[];Object.keys(Ht).map((qt,Xt)=>{Wt.push(Ht[qt])}),Gt.itemData.looks?.map(qt=>{Wt.includes(qt)&&(jt=qt)}),jt||(jt=Gt.itemData.looks[0])}return jt};function hasCommonElement(kt,_e){for(let Dt of kt)if(_e.includes(Dt))return!0;return!1}const InfoDrawer=({stores:kt,open:_e,dismissDrawer:Dt})=>{const Vt=kt.uiSceneStore(Ht=>Ht.CORE_API),Gt=kt.uiSceneStore(Ht=>Ht.isScreenPortrait),zt=reactExports.useRef(null),jt=kt.infoStore(Ht=>Ht.infoObject);return reactExports.useEffect(()=>{Vt.isMobile&&kt.uiSceneStore.setState({dialogPopupOpen:_e});const Ht=async()=>{const Wt=await kt.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics();if(_e){const qt=new O$2(Wt,!0,"info-panel","button");kt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qt)}else{const qt=new G$3(Wt,!0,"info-panel","button");kt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qt)}};kt?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics&&Ht()},[_e]),reactExports.useEffect(()=>{const{current:Ht}=zt;if(!Ht)return;const Wt=()=>{Dt()};return Ht.addEventListener("drawerClosed",Wt),()=>{Ht.removeEventListener("drawerClosed",Wt)}},[zt]),jsxRuntimeExports.jsx(BottomDrawer,{stores:kt,ref:zt,id:"bottomDrawer",open:`${_e}`,"initial-screen-coverage":"0%",children:jsxRuntimeExports.jsx("div",{tabIndex:_e&&Gt?0:-1,"aria-hidden":!_e||!Gt,className:"infoDrawer epigraphDrawer",slot:"bottom-drawer-content",children:jsxRuntimeExports.jsxs("div",{className:"drawerContent",children:[jsxRuntimeExports.jsxs("a",{href:jt?.productPageUrl,className:"categoryLink",role:"button","aria-label":"Link to Product",target:"_blank",style:jt?.productPageUrl?{pointerEvents:"all"}:{pointerEvents:"none"},children:[jsxRuntimeExports.jsxs("h2",{className:"categoryTitle",children:[jt?.productCategory?.label,jt.subheading&&jsxRuntimeExports.jsx("div",{className:"modalSubHeading",children:jt.subheading})]}),jt.productPageUrl&&jsxRuntimeExports.jsx("img",{alt:"Open Product Page",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/OpenTab.svg",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{className:"infoDrawerImageContainer",children:jsxRuntimeExports.jsx("img",{className:"itemImage",alt:jt?.title?"An image of "+jt.title:"A placeholder image used in the Information Modal","aria-label":jt?.title?"An image of "+jt.title:"A placeholder image used in the Information Modal",src:jt?.thumbnails?.high?Vt.getResolvedAssetUrl(jt.thumbnails.high):"https://placehold.co/150",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("h2",{className:"itemTitle",children:jt.title}),jsxRuntimeExports.jsx("pre",{className:"itemDescription",children:jt.description}),jt.boundingBoxSize?jsxRuntimeExports.jsxs("p",{className:"infoModalDimensions",children:[jt.boundingBoxSize.x.toFixed(1),"” W x"," ",jt.boundingBoxSize.y.toFixed(1),"” D x"," ",jt.boundingBoxSize.z.toFixed(1),"” H"]}):"",jsxRuntimeExports.jsx("div",{className:"infoModalActions",children:jt.price&&jsxRuntimeExports.jsxs("button",{className:"item-price",disabled:!0,children:["$",numberWithCommas(parseFloat(jt.price).toFixed(2))]})})]})})})},UtilityMenuButton=({stores:kt,buttonAction:_e,buttonLabel:Dt,hoverLabel:Vt,icon:Gt,activeCondition:zt})=>{const[jt,Ht]=reactExports.useState(zt),Wt=kt.uiSceneStore(Kt=>Kt.dialogPopupOpen),qt=kt.uiSceneStore(Kt=>Kt.isScreenPortrait),Xt=kt.cartStore(Kt=>Kt.previewCartModalOpen);return reactExports.useEffect(()=>(Ht(zt),()=>{}),[zt]),jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:!Wt&&(qt&&!Xt||!qt)?0:-1,"aria-hidden":Wt||qt&&Xt,className:jt!==void 0&&jt?"shellButtonContainer active":"shellButtonContainer","aria-label":Dt,onClick:()=>{_e()},children:[jsxRuntimeExports.jsxs("div",{className:"buttonContent",children:[jsxRuntimeExports.jsx("img",{className:"button",src:Gt,alt:"An icon indicating "+Dt+" action.",onError:Kt=>{Kt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:Dt})]}),jsxRuntimeExports.jsx("div",{className:"hoverDescriptor",children:jsxRuntimeExports.jsx("span",{children:Vt})})]})},UtilityMenu=({stores:kt,handleShareButtonTrigger:_e,handleSaveButtonTrigger:Dt,handleRestartButtonClick:Vt,handleShowHotspots:Gt,handleDimensionClick:zt,handleInstructionButtonClick:jt,utilityMenuVisible:Ht,hotspotsVisibility:Wt,viewInYourSpaceMenuBtnVisible:qt,restartMenuBtnVisible:Xt,saveMenuBtnVisible:Kt,hotspotsMenuBtnVisible:Yt,instructionsMenuBtnVisible:Zt,dimensionsMenuBtnVisible:Jt,shareMenuBtnVisible:nn,dimensionsVisible:rn,position:Qt,CORE_API:en})=>{const[tn,sn]=reactExports.useState("bottom"),cn=kt.productDataStore(fn=>fn.assetsData),un=kt.coreSceneStore(fn=>fn.sceneSettings),hn={ar:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",restart:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Restart.svg",save:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/save.svg",share:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Share.svg",dimensions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Ruler.svg",hotspots:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Eye.svg",instructions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Info.svg"};return reactExports.useEffect(()=>{switch(Qt){case"top":sn("top");break;case"bottom":sn("bottom");break;case"left":sn("left");break;case"right":sn("right");break}return()=>{}},[Qt]),jsxRuntimeExports.jsx("div",{className:"shellCanvasContainerParent",id:tn,children:jsxRuntimeExports.jsxs("div",{className:(Ht&&(nn||qt||Xt||Jt||Yt||Zt))==!0?"shellCanvasContainer":"shellCanvasContainer shellCanvasContainerInactive",children:[qt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{en.viewInYourSpace()},buttonLabel:un.textSettings.arButtonLabel,hoverLabel:un.textSettings.arHoverLabel,icon:cn?.icons?.utilityMenu?.viewInYourSpace?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.viewInYourSpace):hn.ar}),Xt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Vt()},buttonLabel:un.textSettings.restartButtonLabel,hoverLabel:un.textSettings.restartHoverLabel,icon:cn?.icons?.utilityMenu?.restart?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.restart):hn.restart}),Kt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Dt()},buttonLabel:un.textSettings.saveButtonLabel,hoverLabel:un.textSettings.saveHoverLabel,icon:cn?.icons?.utilityMenu?.save?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.save):hn.save}),nn&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{_e()},buttonLabel:un.textSettings.shareButtonLabel,hoverLabel:un.textSettings.shareHoverLabel,icon:cn?.icons?.utilityMenu?.share?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.share):hn.share}),Jt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{zt()},buttonLabel:un.textSettings.sizeButtonLabel,hoverLabel:un.textSettings.sizeHoverLabel,icon:cn?.icons?.utilityMenu?.dimensions?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.dimensions):hn.dimensions,activeCondition:rn}),Yt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{Gt()},buttonLabel:un.textSettings.hotspotsButtonLabel,hoverLabel:un.textSettings.hotspotsHoverLabel,icon:cn?.icons?.utilityMenu?.hotspots?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.hotspots):hn.hotspots,activeCondition:Wt}),Zt&&jsxRuntimeExports.jsx(UtilityMenuButton,{stores:kt,buttonAction:()=>{jt()},buttonLabel:un.textSettings.instructionsButtonLabel,hoverLabel:un.textSettings.instructionsHoverLabel,icon:cn?.icons?.utilityMenu?.instructions?en.getResolvedAssetUrl(cn?.icons?.utilityMenu?.instructions):hn.instructions})]})})};function makeTypeChecker(kt){return _e=>!!_e.type&&_e.type.tabsRole===kt}const isTab=makeTypeChecker("Tab"),isTabList=makeTypeChecker("TabList"),isTabPanel=makeTypeChecker("TabPanel");function isTabChild(kt){return isTab(kt)||isTabList(kt)||isTabPanel(kt)}function deepMap(kt,_e){return reactExports.Children.map(kt,Dt=>Dt===null?null:isTabChild(Dt)?_e(Dt):Dt.props&&Dt.props.children&&typeof Dt.props.children=="object"?reactExports.cloneElement(Dt,{...Dt.props,children:deepMap(Dt.props.children,_e)}):Dt)}function deepForEach(kt,_e){return reactExports.Children.forEach(kt,Dt=>{Dt!==null&&(isTab(Dt)||isTabPanel(Dt)?_e(Dt):Dt.props&&Dt.props.children&&typeof Dt.props.children=="object"&&(isTabList(Dt)&&_e(Dt),deepForEach(Dt.props.children,_e)))})}function r$2(kt){var _e,Dt,Vt="";if(typeof kt=="string"||typeof kt=="number")Vt+=kt;else if(typeof kt=="object")if(Array.isArray(kt)){var Gt=kt.length;for(_e=0;_e<Gt;_e++)kt[_e]&&(Dt=r$2(kt[_e]))&&(Vt&&(Vt+=" "),Vt+=Dt)}else for(Dt in kt)kt[Dt]&&(Vt&&(Vt+=" "),Vt+=Dt);return Vt}function clsx(){for(var kt,_e,Dt=0,Vt="",Gt=arguments.length;Dt<Gt;Dt++)(kt=arguments[Dt])&&(_e=r$2(kt))&&(Vt&&(Vt+=" "),Vt+=_e);return Vt}function getTabsCount(kt){let _e=0;return deepForEach(kt,Dt=>{isTab(Dt)&&_e++}),_e}function isNode(kt){return kt&&"getAttribute"in kt}function isTabNode(kt){return isNode(kt)&&kt.getAttribute("data-rttab")}function isTabDisabled(kt){return isNode(kt)&&kt.getAttribute("aria-disabled")==="true"}let canUseActiveElement;function determineCanUseActiveElement(kt){const _e=kt||(typeof window<"u"?window:void 0);try{canUseActiveElement=!!(typeof _e<"u"&&_e.document&&_e.document.activeElement)}catch{canUseActiveElement=!1}}const defaultProps$4={className:"react-tabs",focus:!1},UncontrolledTabs=kt=>{let _e=reactExports.useRef([]),Dt=reactExports.useRef([]);const Vt=reactExports.useRef();function Gt(_n,En){if(_n<0||_n>=qt())return;const{onSelect:An,selectedIndex:Tn}=kt;An(_n,Tn,En)}function zt(_n){const En=qt();for(let An=_n+1;An<En;An++)if(!isTabDisabled(Xt(An)))return An;for(let An=0;An<_n;An++)if(!isTabDisabled(Xt(An)))return An;return _n}function jt(_n){let En=_n;for(;En--;)if(!isTabDisabled(Xt(En)))return En;for(En=qt();En-- >_n;)if(!isTabDisabled(Xt(En)))return En;return _n}function Ht(){const _n=qt();for(let En=0;En<_n;En++)if(!isTabDisabled(Xt(En)))return En;return null}function Wt(){let _n=qt();for(;_n--;)if(!isTabDisabled(Xt(_n)))return _n;return null}function qt(){const{children:_n}=kt;return getTabsCount(_n)}function Xt(_n){return _e.current[`tabs-${_n}`]}function Kt(){let _n=0;const{children:En,disabledTabClassName:An,focus:Tn,forceRenderTabPanel:Cn,selectedIndex:yn,selectedTabClassName:Sn,selectedTabPanelClassName:wn,environment:xn}=kt;Dt.current=Dt.current||[];let Rn=Dt.current.length-qt();const Ln=reactExports.useId();for(;Rn++<0;)Dt.current.push(`${Ln}${Dt.current.length}`);return deepMap(En,Nn=>{let Fn=Nn;if(isTabList(Nn)){let Pn=0,Bn=!1;canUseActiveElement==null&&determineCanUseActiveElement(xn);const Hn=xn||(typeof window<"u"?window:void 0);canUseActiveElement&&Hn&&(Bn=React.Children.toArray(Nn.props.children).filter(isTab).some((qn,ar)=>Hn.document.activeElement===Xt(ar))),Fn=reactExports.cloneElement(Nn,{children:deepMap(Nn.props.children,qn=>{const ar=`tabs-${Pn}`,zn=yn===Pn,ur={tabRef:Wn=>{_e.current[ar]=Wn},id:Dt.current[Pn],selected:zn,focus:zn&&(Tn||Bn)};return Sn&&(ur.selectedClassName=Sn),An&&(ur.disabledClassName=An),Pn++,reactExports.cloneElement(qn,ur)})})}else if(isTabPanel(Nn)){const Pn={id:Dt.current[_n],selected:yn===_n};Cn&&(Pn.forceRender=Cn),wn&&(Pn.selectedClassName=wn),_n++,Fn=reactExports.cloneElement(Nn,Pn)}return Fn})}function Yt(_n){const{direction:En,disableUpDownKeys:An,disableLeftRightKeys:Tn}=kt;if(Jt(_n.target)){let{selectedIndex:Cn}=kt,yn=!1,Sn=!1;(_n.code==="Space"||_n.keyCode===32||_n.code==="Enter"||_n.keyCode===13)&&(yn=!0,Sn=!1,Zt(_n)),!Tn&&(_n.keyCode===37||_n.code==="ArrowLeft")||!An&&(_n.keyCode===38||_n.code==="ArrowUp")?(En==="rtl"?Cn=zt(Cn):Cn=jt(Cn),yn=!0,Sn=!0):!Tn&&(_n.keyCode===39||_n.code==="ArrowRight")||!An&&(_n.keyCode===40||_n.code==="ArrowDown")?(En==="rtl"?Cn=jt(Cn):Cn=zt(Cn),yn=!0,Sn=!0):_n.keyCode===35||_n.code==="End"?(Cn=Wt(),yn=!0,Sn=!0):(_n.keyCode===36||_n.code==="Home")&&(Cn=Ht(),yn=!0,Sn=!0),yn&&_n.preventDefault(),Sn&&Gt(Cn,_n)}}function Zt(_n){let En=_n.target;do if(Jt(En)){if(isTabDisabled(En))return;const An=[].slice.call(En.parentNode.children).filter(isTabNode).indexOf(En);Gt(An,_n);return}while((En=En.parentNode)!=null)}function Jt(_n){if(!isTabNode(_n))return!1;let En=_n.parentElement;do{if(En===Vt.current)return!0;if(En.getAttribute("data-rttabs"))break;En=En.parentElement}while(En);return!1}const{children:nn,className:rn,disabledTabClassName:Qt,domRef:en,focus:tn,forceRenderTabPanel:sn,onSelect:cn,selectedIndex:un,selectedTabClassName:hn,selectedTabPanelClassName:fn,environment:pn,disableUpDownKeys:dn,disableLeftRightKeys:mn,...vn}={...defaultProps$4,...kt};return React.createElement("div",Object.assign({},vn,{className:clsx(rn),onClick:Zt,onKeyDown:Yt,ref:_n=>{Vt.current=_n,en&&en(_n)},"data-rttabs":!0}),Kt())};UncontrolledTabs.propTypes={};const MODE_CONTROLLED=0,MODE_UNCONTROLLED=1,defaultProps$3={defaultFocus:!1,focusTabOnClick:!0,forceRenderTabPanel:!1,selectedIndex:null,defaultIndex:null,environment:null,disableUpDownKeys:!1,disableLeftRightKeys:!1},getModeFromProps=kt=>kt.selectedIndex===null?MODE_UNCONTROLLED:MODE_CONTROLLED,Tabs=kt=>{const{children:_e,defaultFocus:Dt,defaultIndex:Vt,focusTabOnClick:Gt,onSelect:zt,...jt}={...defaultProps$3,...kt},[Ht,Wt]=reactExports.useState(Dt),[qt]=reactExports.useState(getModeFromProps(jt)),[Xt,Kt]=reactExports.useState(qt===MODE_UNCONTROLLED?Vt||0:null);if(reactExports.useEffect(()=>{Wt(!1)},[]),qt===MODE_UNCONTROLLED){const Jt=getTabsCount(_e);reactExports.useEffect(()=>{if(Xt!=null){const nn=Math.max(0,Jt-1);Kt(Math.min(Xt,nn))}},[Jt])}const Yt=(Jt,nn,rn)=>{typeof zt=="function"&&zt(Jt,nn,rn)===!1||(Gt&&Wt(!0),qt===MODE_UNCONTROLLED&&Kt(Jt))};let Zt={...kt,...jt};return Zt.focus=Ht,Zt.onSelect=Yt,Xt!=null&&(Zt.selectedIndex=Xt),delete Zt.defaultFocus,delete Zt.defaultIndex,delete Zt.focusTabOnClick,React.createElement(UncontrolledTabs,Zt,_e)};Tabs.propTypes={};Tabs.tabsRole="Tabs";const defaultProps$2={className:"react-tabs__tab-list"},TabList=kt=>{const{children:_e,className:Dt,...Vt}={...defaultProps$2,...kt};return React.createElement("ul",Object.assign({},Vt,{className:clsx(Dt),role:"tablist"}),_e)};TabList.tabsRole="TabList";TabList.propTypes={};const DEFAULT_CLASS$1="react-tabs__tab",defaultProps$1={className:DEFAULT_CLASS$1,disabledClassName:`${DEFAULT_CLASS$1}--disabled`,focus:!1,id:null,selected:!1,selectedClassName:`${DEFAULT_CLASS$1}--selected`},Tab$1=kt=>{let _e=reactExports.useRef();const{children:Dt,className:Vt,disabled:Gt,disabledClassName:zt,focus:jt,id:Ht,selected:Wt,selectedClassName:qt,tabIndex:Xt,tabRef:Kt,...Yt}={...defaultProps$1,...kt};return reactExports.useEffect(()=>{Wt&&jt&&_e.current.focus()},[Wt,jt]),React.createElement("li",Object.assign({},Yt,{className:clsx(Vt,{[qt]:Wt,[zt]:Gt}),ref:Zt=>{_e.current=Zt,Kt&&Kt(Zt)},role:"tab",id:`tab${Ht}`,"aria-selected":Wt?"true":"false","aria-disabled":Gt?"true":"false","aria-controls":`panel${Ht}`,tabIndex:Xt||(Wt?"0":null),"data-rttab":!0}),Dt)};Tab$1.propTypes={};Tab$1.tabsRole="Tab";const DEFAULT_CLASS="react-tabs__tab-panel",defaultProps={className:DEFAULT_CLASS,forceRender:!1,selectedClassName:`${DEFAULT_CLASS}--selected`},TabPanel=kt=>{const{children:_e,className:Dt,forceRender:Vt,id:Gt,selected:zt,selectedClassName:jt,...Ht}={...defaultProps,...kt};return React.createElement("div",Object.assign({},Ht,{className:clsx(Dt,{[jt]:zt}),role:"tabpanel",id:`panel${Gt}`,"aria-labelledby":`tab${Gt}`}),Vt||zt?_e:null)};TabPanel.tabsRole="TabPanel";TabPanel.propTypes={};const ItemCard=({stores:kt,sideMenuOpen:_e,spawnGhosts:Dt,accordionActive:Vt=!0,spawnItem:Gt,removeAllGhosts:zt,isMouseUsed:jt,skuId:Ht,active:Wt})=>{const qt=kt.uiSceneStore(fr=>fr.CORE_API),Xt=kt.infoStore(fr=>fr.infoModalOpen),Kt=reactExports.useRef(null),Yt=kt.infoStore(fr=>fr.populateInfoObject),Zt=kt.uiSceneStore(fr=>fr.dialogPopupOpen),Jt=kt.cartStore(fr=>fr.previewCartModalOpen),nn=kt.infoStore(fr=>fr.updateInfoModalOpen),[rn,Qt]=reactExports.useState("default"),[en,tn]=reactExports.useState(!0),sn=kt.colorStore(fr=>fr.allActiveVariants),cn=kt.productDataStore(fr=>fr.productData),un=kt.itemStore(fr=>fr.fittingSkuIds),[hn,fn]=reactExports.useState(cn[Ht].incrementDecrementControl?cn[Ht].incrementDecrementControl:!1),[pn,dn]=reactExports.useState(cn[Ht]?cn[Ht]:{}),[mn,vn]=reactExports.useState(cn[Ht].name?cn[Ht].name:"Not Set"),[_n,En]=reactExports.useState(cn[Ht].subheading?cn[Ht].subheading:""),[An,Tn]=reactExports.useState(cn[Ht].lookDetails.default.thumbnails.low?cn[Ht].lookDetails.default.thumbnails.low:""),[Cn,yn]=reactExports.useState(cn[Ht].draggableUI!=null?cn[Ht].draggableUI:kt.uiSceneStore.getState().CORE_API.sceneSettings.draggableUI),[Sn,wn]=reactExports.useState(null),[xn,Rn]=reactExports.useState(!1),[Ln,Nn]=reactExports.useState(!1),[Fn,Pn]=reactExports.useState(0),Bn=reactExports.useCallback(()=>{Fn<=0||qt.removeLastItemBySkuId(Ht)},[Fn]),Hn=()=>{let fr=0;const Un=kt.itemStore.getState().itemsSpawned,In=Object.keys(Un);for(let jn=In.length-1;jn>=0;jn--){const er=In[jn];Un[er].itemData.skuID===Ht&&fr++}Pn(fr)};reactExports.useEffect(()=>{Hn()},[]),addCoreEventListener(kt,qt.EVENTS.SCENE.Items_Updated,Hn),reactExports.useEffect(()=>{un.includes(Ht)?Rn(!0):Rn(!1)},[un]),reactExports.useEffect(()=>{Object.keys(cn).length!=0},[cn]),reactExports.useEffect(()=>{pn.looks.length<=1&&tn(!1)},[pn]);const qn=reactExports.useCallback(()=>{const fr=pn.looks;let Un="default";for(const[In,jn]of Object.entries(sn))if(fr.includes(jn)){Un=jn;break}Qt(Un)},[pn,sn]);reactExports.useEffect(()=>{Tn(pn.lookDetails[rn].thumbnails.low)},[pn,rn]),reactExports.useEffect(()=>{en===!0&&qn()},[sn]);const ar=reactExports.useCallback(fr=>{if(fr.stopPropagation(),!(!kt.uiSceneStore.getState().CORE_API.sceneSettings.clickToAddUi&&!hn)){if(xn===!1||Sn){qt.alert({alertMsg:"Unable to add item to the scene.",alertTime:4e3,alertType:"warn",alertLabel:"Action Unavailable"});return}Gt(Ht,!0)}},[xn,Sn]),zn=reactExports.useCallback(async()=>{const fr=qt.sceneSettings?.showDependencyOnHover;if(fr===void 0||fr===!1)return;let Un=qt.getSpawningRequirementForSkuID(Ht);if(Un.length<=0)return;let In="";const jn=await qt.getCartItemsAsync();let er=!1;if(jn.cartItems.map(cr=>{Un.includes(cr.skuID)&&(er=!0)}),Un.includes("Root")&&Un.length==1&&(er=!0,Un=[]),er)In="No space available to spawn the item.";else{In=`This item requires a dependency to be added to the scene first.
|
|
3937
3937
|
|
|
3938
3938
|
Dependency:
|
|
3939
3939
|
`;for(const cr of Un)In+=`- ${cr}
|
|
3940
3940
|
`}for(const cr of Un)In+=`- ${cr}
|
|
3941
|
-
`;wn(In)},[Sn]),ur=reactExports.useCallback(()=>{qt.isMobile!==!0&&Ln!==!0&&(Nn(!0),!(!kt.uiSceneStore.getState().CORE_API.sceneSettings.clickToAddUi&&!hn)&&(xn===!0?(wn(null),Dt(Ht)):zn()))},[xn,Ln,Sn]),Wn=reactExports.useCallback(()=>{qt.isMobile===!0||(Nn(!1),!kt.uiSceneStore.getState().CORE_API.sceneSettings.clickToAddUi&&!hn)||kt.coreSceneStore.getState().mouseDragging||xn===!0&&zt&&zt()},[xn,Ln]),or=reactExports.useCallback(fr=>{xn!==!1&&(fr.defaultPrevented===!0&&fr.preventDefault(),fr.stopPropagation(),kt.coreSceneStore.setState({pointerDownPos:fr.touches&&fr.touches.length>0?fr.touches[0].clientX-kt.wcRef.offsetLeft:fr.clientX,mouseDragging:!1,mouseDownImgSrc:qt.getResolvedAssetUrl(An),mouseDownSkuID:Ht,moveThreshold:10}))},[xn,An,Cn]),gr=reactExports.useCallback(fr=>{const Un=pn.lookDetails[rn];Un.skuID=Ht,Un.productCategory={id:pn.categoryID,label:pn.categoryLabel},qt.isMobile===!0?(Yt(Un),nn(!0)):(fr.stopPropagation(),xn&&zt&&zt(),Yt(Un),nn(!0))},[xn,rn,pn]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("nav",{role:"none",className:Wt?"imageContainer active":"imageContainer",draggable:!1,children:[hn?jsxRuntimeExports.jsxs("div",{className:"incrementContentContainer",children:[jsxRuntimeExports.jsx("div",{id:"itemCard"+Ht,className:"incrementContentOverlay ".concat(`${(xn===!0||Fn>0)&&Ln===!0?"enabled-item-overlay":"disabled-item-overlay"}`),ref:Kt}),jsxRuntimeExports.jsx("img",{alt:mn,className:"incrementSkuIcon",tabIndex:-1,"aria-hidden":!0,src:qt.getResolvedAssetUrl(An),onError:fr=>{fr.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsxs("div",{className:"incrementDecrementPanel",children:[jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Decrement Button","aria-hidden":!_e||Fn==0||Zt||Xt||Jt||!Vt||!xn,tabIndex:_e&&Fn!==0&&!Zt&&!Xt&&!Jt&&Vt==!0&&xn?0:-1,className:"incrementMinusSign ".concat(`${Fn===0?"incrementSignDisable":""}`),onClick:Bn,onMouseEnter:fr=>Nn(!0),onMouseLeave:fr=>Nn(!1),children:jsxRuntimeExports.jsx("img",{alt:"Decrement",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Minus.svg",onError:fr=>{fr.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("div",{className:"incrementCount",children:Fn}),jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Increment","aria-hidden":!_e||Zt||Xt||Jt||!Vt||!xn,tabIndex:_e&&!Zt&&!Xt&&!Jt&&Vt==!0&&xn?0:-1,className:"incrementPlusSign ".concat(`${xn===!0?"":"incrementSignDisable"}`),onClick:ar,onMouseEnter:ur,onMouseLeave:Wn,children:jsxRuntimeExports.jsx("img",{alt:"Increment",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg",onError:fr=>{fr.target.src="https://placehold.co/150"}})})]}),jsxRuntimeExports.jsx("div",{className:"spawning-requirements-container",hidden:!(xn===!1&&Ln===!0&&Sn),children:jsxRuntimeExports.jsx("p",{className:"spawning-requirements-text",children:Sn})})]}):jsxRuntimeExports.jsxs("div",{className:"contentContainer",role:"button","aria-label":"Add Button",tabIndex:_e&&!Zt&&!Xt&&!Jt&&Vt==!0&&xn?0:-1,"aria-hidden":!_e||Zt||Xt||Jt||!Vt||!xn,style:{pointerEvents:xn?"all":"none"},onFocus:fr=>{jt||ur(fr)},onBlur:fr=>{jt||Wn(fr)},onClick:ar,children:[jsxRuntimeExports.jsx("div",{id:"itemCard"+Ht,className:"contentOverlay ".concat(`${xn===!0&&Ln===!0?"enabled-item-overlay":"disabled-item-overlay"}`),ref:Kt,onTouchStart:or,onMouseEnter:ur,onMouseLeave:Wn,onMouseDown:fr=>{Cn!==!1&&or(fr)},children:jsxRuntimeExports.jsx("img",{alt:"Add "+mn,draggable:!1,className:"addIcon",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg",onError:fr=>{fr.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{className:"product-image product-image-default-state ".concat(`${xn===!1?"product-image-disabled":""}`),draggable:!1,alt:mn,src:qt.getResolvedAssetUrl(An),onError:fr=>{fr.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("div",{className:"spawning-requirements-container",hidden:!(xn===!1&&Ln===!0&&Sn),children:jsxRuntimeExports.jsx("p",{className:"spawning-requirements-text",children:Sn})})]}),jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Info Button","aria-hidden":!_e||Zt||Xt||Jt||!Vt,tabIndex:_e&&!Zt&&!Xt&&!Jt&&Vt==!0?0:-1,className:qt.isMobile?"showAlways itemDetails":"itemDetails",onClick:gr,children:[jsxRuntimeExports.jsx("div",{className:"item-details-icon"}),jsxRuntimeExports.jsxs("div",{className:"item-card-text-parent",children:[mn&&jsxRuntimeExports.jsx("p",{className:"skuName truncate",children:mn}),_n&&jsxRuntimeExports.jsx("p",{className:"skuSubheading",children:_n})]})]})]})})},PreconfigCard=({stores:kt,sideMenuOpen:_e,onClick:Dt,configId:Vt,name:Gt,thumbnailURL:zt,accordionActive:jt})=>{const Ht=kt.uiSceneStore(Jt=>Jt.CORE_API),Wt=kt.infoStore(Jt=>Jt.infoModalOpen),qt=kt.uiSceneStore(Jt=>Jt.dialogPopupOpen),Xt=kt.cartStore(Jt=>Jt.previewCartModalOpen),[Kt,Yt]=reactExports.useState(!1),Zt=reactExports.useCallback(Jt=>{Jt.stopPropagation(),Dt(Vt)},[]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"imageContainer",draggable:!1,children:[jsxRuntimeExports.jsxs("div",{className:zt?"contentContainer preconfig":"contentContainer preconfig contentDisabled",children:[jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Load Preconfiguration Button","aria-hidden":!_e||qt||Wt||Xt||!jt,tabIndex:_e&&!qt&&!Wt&&!Xt&&jt==!0?0:-1,id:"itemCard"+Vt,className:"contentOverlay ".concat(`${Kt===!0?"enabled-item-overlay":"disabled-item-overlay"}`),onClick:Jt=>Zt(Jt),onFocus:()=>Yt(!0),onBlur:()=>Yt(!1),onMouseEnter:()=>Yt(!0),onMouseLeave:()=>Yt(!1),children:jsxRuntimeExports.jsx("img",{alt:"Add "+Gt,draggable:!1,className:"addIcon",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg"})}),jsxRuntimeExports.jsx("img",{className:"product-image product-image-default-state",draggable:!1,alt:Gt,src:zt,tabIndex:-1,"aria-hidden":!0})]}),jsxRuntimeExports.jsx("div",{className:Ht.isMobile?"showAlways itemDetails":"itemDetails",children:jsxRuntimeExports.jsx("p",{className:"truncate",children:Gt})})]})})};function BuildTabItemRow({stores:kt,sideMenuOpen:_e,element:Dt,index:Vt,visible:Gt,elementsLength:zt,spawnGhosts:jt,spawnItem:Ht,removeAllGhosts:Wt,infoModalOpen:qt,isMouseUsed:Xt,setItemAllowed:Kt,activeItems:Yt}){const Zt=kt.coreSceneStore(cn=>cn.sceneSettings),Jt=reactExports.useRef(null),nn=reactExports.useRef(null),rn=kt.uiSceneStore(cn=>cn.dialogPopupOpen),Qt=kt.cartStore(cn=>cn.previewCartModalOpen),[en,tn]=reactExports.useState(!1),sn=reactExports.useCallback(()=>{if(!(!nn.current||!Jt.current)){if(nn.current.style.maxHeight)nn.current.style.maxHeight=null;else{if(Dt.skus.length>0&&nn.current.scrollHeight<100)return;nn.current.style.maxHeight=nn.current.scrollHeight+"px"}Jt.current.classList.toggle("buildUiAccordionActive"),nn.current.classList.toggle("buildUiContentAccordionActive"),tn(!en)}},[Jt,nn,en]);return reactExports.useEffect(()=>{!nn.current||!Jt.current||Vt==0&&sn()},[Jt,nn]),jsxRuntimeExports.jsxs("div",{className:"subContainer topContainer",children:[Zt.accordionInBuildUi?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Toggle Accordion Button",onClick:sn,"aria-hidden":!_e||rn||qt||Qt||!Gt,tabIndex:_e&&!rn&&!qt&&!Qt&&Gt?0:-1,ref:Jt,className:"buildUiAccordion",children:[jsxRuntimeExports.jsx("div",{className:"arrowUp",children:jsxRuntimeExports.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{x:"0.75",y:"0.6875",width:"28.7343",height:"28.7343",rx:"14.3672",stroke:"#CCCCCC",strokeWidth:"0.5"}),jsxRuntimeExports.jsx("path",{d:"M20.5029 12.8984L15.1172 18.2842L9.73145 12.8984",stroke:"#222222",strokeLinecap:"round",strokeLinejoin:"round"})]})}),jsxRuntimeExports.jsx("div",{className:"arrowDown",children:jsxRuntimeExports.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{x:"0.881836",y:"0.957031",width:"28.7343",height:"28.7343",rx:"14.3672",stroke:"#CCCCCC",strokeWidth:"0.5"}),jsxRuntimeExports.jsx("path",{d:"M9.86328 17.4795L15.249 12.0938L20.6347 17.4795",stroke:"#222222",strokeLinecap:"round",strokeLinejoin:"round"})]})}),jsxRuntimeExports.jsx("h4",{children:Dt.label})]}),jsxRuntimeExports.jsx("div",{ref:nn,className:"sidemenuContent buildUiAccordionContent",children:jsxRuntimeExports.jsx("div",{className:"item-grid",children:Dt.skus.map(cn=>jsxRuntimeExports.jsx(ItemCard,{stores:kt,skuId:cn,sideMenuOpen:_e,accordionActive:Gt&&en,categoryID:Dt.categoryID,spawnGhosts:jt,spawnItem:Ht,removeAllGhosts:Wt,modalOpen:qt,isMouseUsed:Xt,categoryDataIndex:Vt,setItemAllowed:Kt,active:Yt.includes(cn)},"itemCardB"+cn))})})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("h4",{className:"subheading",children:Dt.label}),jsxRuntimeExports.jsx("div",{className:"sidemenuContent",children:jsxRuntimeExports.jsx("div",{className:"item-grid",children:Dt.skus.map(cn=>jsxRuntimeExports.jsx(ItemCard,{stores:kt,skuId:cn,sideMenuOpen:_e,categoryID:Dt.categoryID,accordionActive:Gt,spawnGhosts:jt,spawnItem:Ht,removeAllGhosts:Wt,isMouseUsed:Xt,modalOpen:qt,categoryDataIndex:Vt,setItemAllowed:Kt,active:Yt.includes(cn)},"itemCardB"+cn))})})]}),Vt!==zt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""]})}function BuildTabItemRow_PreConfig({stores:kt,sideMenuOpen:_e,index:Dt,elementsLength:Vt,visible:Gt,configsData:zt,infoModalOpen:jt,isMouseUsed:Ht,onClick:Wt,label:qt}){const Xt=kt.coreSceneStore(tn=>tn.sceneSettings),Kt=reactExports.useRef(null),Yt=reactExports.useRef(null),Zt=kt.uiSceneStore(tn=>tn.dialogPopupOpen),Jt=kt.cartStore(tn=>tn.previewCartModalOpen),nn=kt.uiSceneStore(tn=>tn.CORE_API),[rn,Qt]=reactExports.useState(!1),en=reactExports.useCallback(()=>{!Yt.current||!Kt.current||(Kt.current.classList.toggle("buildUiAccordionActive"),Yt.current.classList.toggle("buildUiContentAccordionActive"),Qt(!rn),Yt.current.style.maxHeight?Yt.current.style.maxHeight=null:Yt.current.style.maxHeight=Yt.current.scrollHeight+"px")},[Kt,Yt,rn]);return jsxRuntimeExports.jsxs("div",{className:"subContainer topContainer",children:[Xt.accordionInBuildUi?jsxRuntimeExports.jsxs("nav",{children:[jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Toggle Accordion Button","aria-hidden":!_e||Zt||jt||Jt||!Gt,onClick:en,tabIndex:_e&&!Zt&&!jt&&!Jt&&Gt?0:-1,ref:Kt,className:"buildUiAccordion",children:[jsxRuntimeExports.jsx("div",{className:"arrowUp",children:jsxRuntimeExports.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{x:"0.75",y:"0.6875",width:"28.7343",height:"28.7343",rx:"14.3672",stroke:"#CCCCCC",strokeWidth:"0.5"}),jsxRuntimeExports.jsx("path",{d:"M20.5029 12.8984L15.1172 18.2842L9.73145 12.8984",stroke:"#222222",strokeLinecap:"round",strokeLinejoin:"round"})]})}),jsxRuntimeExports.jsx("div",{className:"arrowDown",children:jsxRuntimeExports.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{x:"0.881836",y:"0.957031",width:"28.7343",height:"28.7343",rx:"14.3672",stroke:"#CCCCCC",strokeWidth:"0.5"}),jsxRuntimeExports.jsx("path",{d:"M9.86328 17.4795L15.249 12.0938L20.6347 17.4795",stroke:"#222222",strokeLinecap:"round",strokeLinejoin:"round"})]})}),jsxRuntimeExports.jsx("h4",{children:qt})]}),jsxRuntimeExports.jsx("div",{ref:Yt,className:"sidemenuContent buildUiAccordionContent",children:jsxRuntimeExports.jsx("div",{className:"item-grid",children:zt.map(tn=>jsxRuntimeExports.jsx(PreconfigCard,{stores:kt,onClick:Wt,sideMenuOpen:_e,accordionActive:Gt&&rn,configId:tn.epgsharedconfigid,name:tn.name,thumbnailURL:nn.getResolvedAssetUrl(tn.thumbnails.low)},"itemCardB"+tn.epgsharedconfigid))})})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("h4",{className:"subheading",children:qt}),jsxRuntimeExports.jsx("div",{className:"sidemenuContent",children:jsxRuntimeExports.jsx("div",{className:"item-grid",children:zt.map(tn=>jsxRuntimeExports.jsx(PreconfigCard,{stores:kt,sideMenuOpen:_e,onClick:Wt,accordionActive:Gt,configId:tn.epgsharedconfigid,name:tn.name,thumbnailURL:nn.getResolvedAssetUrl(tn.thumbnails.low)},"itemCardB"+tn.epgsharedconfigid))})})]}),Dt!==Vt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""]})}function SecondMobileTabsHandler({stores:kt,sideMenuOpen:_e,index:Dt,label:Vt,activeTab:Gt,tabsRef:zt,mobileGrid:jt}){const Ht=reactExports.useCallback(Wt=>{if(jt.current.scrollLeft===Wt)return;let qt,Xt,Kt,Yt=!1;function Zt(Jt){qt===void 0&&(qt=Jt);const nn=Jt-qt;if(Xt!==Jt){const rn=nn/200;jt.current.scrollLeft>Wt?(Kt=(jt.current.scrollLeft-Wt)*Math.min(rn,1),jt.current.scrollLeft-=Kt,jt.current.scrollLeft===Wt&&(Yt=!0)):jt.current.scrollLeft<Wt&&(Kt=(Wt-jt.current.scrollLeft)*Math.min(rn,1),jt.current.scrollLeft+=Kt,jt.current.scrollLeft===Wt&&(Yt=!0))}nn<200&&(Xt=Jt,!Yt&&window.requestAnimationFrame(Zt))}window.requestAnimationFrame(Zt)},[]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("a",{className:Gt===Dt?"mobileTab scrolled":"mobileTab",onClick:()=>Ht(zt.current[Dt].offsetLeft-15),role:"button",tabIndex:_e?0:-1,"aria-hidden":!_e,"aria-label":Vt+" Button",children:Vt})})}function MobileGrid({stores:kt,sideMenuOpen:_e,element:Dt,index:Vt,elementsLength:Gt,spawnGhosts:zt,spawnItem:jt,removeAllGhosts:Ht,infoModalOpen:Wt,setItemAllowed:qt,activeItems:Xt,tabsRef:Kt}){return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("section",{id:`section-${Dt.categoryID}`,className:"mobileGridSection",ref:Yt=>Kt.current[Vt]=Yt,children:Dt.skus.map(Yt=>jsxRuntimeExports.jsx(ItemCard,{stores:kt,skuId:Yt,sideMenuOpen:_e,categoryID:Dt.categoryID,spawnGhosts:zt,spawnItem:jt,removeAllGhosts:Ht,modalOpen:Wt,setItemAllowed:qt,active:Xt.includes(Yt)},"itemCardB"+Yt))},"mobileGridSection"+Vt),Vt!==Gt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""]})}function MobileGrid_PreConfig({stores:kt,sideMenuOpen:_e,index:Dt,elementsLength:Vt,tabsRef:Gt,configsData:zt,onClick:jt}){const Ht=kt.uiSceneStore(Wt=>Wt.CORE_API);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("section",{id:"section-preconfig",className:"mobileGridSection",ref:Wt=>Gt.current[Dt]=Wt,children:[zt.map(Wt=>jsxRuntimeExports.jsx(PreconfigCard,{stores:kt,sideMenuOpen:_e,onClick:jt,configId:Wt.epgsharedconfigid,name:Wt.name,thumbnailURL:Ht.getResolvedAssetUrl(Wt.thumbnails.low)},"itemCardB"+Wt.epgsharedconfigid)),[...Array(5)].map((Wt,qt)=>qt<5-zt.length?jsxRuntimeExports.jsx(PreconfigCard,{stores:kt,sideMenuOpen:_e,onClick:()=>{}},"emptyCard"+qt):null)]},"mobileGridSection"+Dt),Dt!==Vt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""]})}const BuildUI=({stores:kt,sideMenuOpen:_e,visible:Dt,identifier:Vt})=>{const Gt=kt.productDataStore(Tn=>Tn.categoryData),[zt,jt]=reactExports.useState([]),[Ht,Wt]=reactExports.useState(void 0),qt=kt.uiSceneStore(Tn=>Tn.isScreenPortrait),Xt=kt.infoStore(Tn=>Tn.infoModalOpen),[Kt,Yt]=reactExports.useState(0),[Zt,Jt]=reactExports.useState(!1),[nn,rn]=reactExports.useState([]),Qt=kt.infoStore(Tn=>Tn.populateInfoObject),en=kt.infoStore(Tn=>Tn.updateInfoModalOpen),tn=kt.uiSceneStore(Tn=>Tn.CORE_API),sn=kt.itemStore(Tn=>Tn.itemsSpawned),cn=kt.itemStore(Tn=>Tn.defaultSceneItemCount),un=reactExports.useRef(null),[hn,fn]=reactExports.useState(!1);reactExports.useEffect(()=>{const Tn=()=>fn(!0),Cn=()=>fn(!1);return document.addEventListener("mousedown",Tn),document.addEventListener("keydown",Cn),()=>{document.removeEventListener("mousedown",Tn),document.removeEventListener("keydown",Cn)}},[]);const pn=reactExports.useCallback(Tn=>{let Cn=[];for(const[yn,Sn]of Object.entries(Tn))Cn.push(Sn);rn(Cn)},[]);addCoreEventListener(kt,tn.EVENTS.UI.ContextMenu_InfoBtnClicked,Tn=>{const Cn=Tn.itemData.lookDetails[Tn.currentVariant],yn=Cn;yn.price=Cn.price,yn.id=Tn.currentVariant,yn.productCategory={id:Tn.itemData.categoryID,label:Tn.itemData.categoryLabel},Qt(yn),en(!0)}),addCoreEventListener(kt,tn.EVENTS.SCENE.ReplaceableCategory_Updated,pn),reactExports.useEffect(()=>{const Tn=tn.getCurrentItemsInReplaceableCategory();return pn(Tn),()=>{}},[tn]),reactExports.useEffect(()=>{Object.keys(Gt).length!==0&&(jt(Gt.build),Gt.preconfiguration!==void 0&&Gt.preconfiguration.configsData!=null&&Wt(Gt.preconfiguration))},[Gt]);const dn=reactExports.useCallback((Tn,Cn)=>{kt.uiSceneStore.getState().CORE_API.spawnItemBySkuID(Tn,Cn)},[]),mn=reactExports.useCallback(Tn=>{Ht.openConfirmationPopup===!1||Object.keys(sn).length<=cn?kt.uiSceneStore.getState().CORE_API.loadSceneFromConfigurationID(Tn,!1):(kt.uiSceneStore.setState({loadConfigId:Tn}),kt.uiSceneStore.getState().setLoadConfigModalOpen(!0))},[Ht,cn,sn]),vn=reactExports.useCallback(Tn=>{kt.uiSceneStore.getState().CORE_API.spawnGhostsForSkuID(Tn,!1,1)},[]),_n=reactExports.useCallback(Tn=>{Xt||kt.uiSceneStore.getState().CORE_API.removeAllGhosts(Tn)},[Xt]),En=reactExports.useRef([]);reactExports.useEffect(()=>{if(!zt)return;let Tn=zt.length;Ht!==void 0&&(Tn+=1),En.current=En.current.slice(0,Tn)},[zt,Ht]);const An=reactExports.useCallback(()=>{let Tn=-3e3,Cn=-1,yn=zt.length;Ht!==void 0&&(yn+=1);for(let Sn=0;Sn<yn;Sn++){let wn=En.current[Sn].getBoundingClientRect().left;wn<28&&Tn<wn&&(Tn=wn,Cn=Sn)}Cn!==-1&&Yt(Cn)},[En,zt,Ht]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"mobileTabContent",hidden:!Dt,tabIndex:qt?0:-1,"aria-hidden":!qt,children:jsxRuntimeExports.jsxs("div",{className:"scrollSpyTabs",children:[jsxRuntimeExports.jsxs("div",{className:"secondMobileTabs",children:[Object.keys(zt).map((Tn,Cn)=>jsxRuntimeExports.jsx(SecondMobileTabsHandler,{stores:kt,sideMenuOpen:_e,index:Cn,label:zt[Tn].label,activeTab:Kt,tabsRef:En,mobileGrid:un},"mobileTabs"+Tn)),Ht!==void 0&&jsxRuntimeExports.jsx(SecondMobileTabsHandler,{stores:kt,sideMenuOpen:_e,index:zt.length,label:Ht.label,activeTab:Kt,tabsRef:En,mobileGrid:un},"preconfiguration_mobileTabs")]}),jsxRuntimeExports.jsxs("div",{className:"mobileGrid",ref:un,onScroll:An,children:[zt.map((Tn,Cn)=>jsxRuntimeExports.jsx(MobileGrid,{stores:kt,sideMenuOpen:_e,element:Tn,index:Cn,spawnGhosts:vn,spawnItem:dn,removeAllGhosts:_n,infoModalOpen:Xt,setItemAllowed:Jt,activeItems:nn,tabsRef:En,elementsLength:Ht!==void 0?zt.length+1:zt.length},"mobileGrid"+Cn)),Ht!==void 0&&jsxRuntimeExports.jsx(MobileGrid_PreConfig,{stores:kt,sideMenuOpen:_e,onClick:mn,configsData:Ht.configsData,tabsRef:En,index:zt.length,elementsLength:zt.length+1},"preconfiguration_mobileGrid")]})]})}),jsxRuntimeExports.jsxs("div",{className:"container desktop",role:"button",hidden:!Dt,tabIndex:qt?-1:0,"aria-hidden":qt,children:[zt.map((Tn,Cn)=>jsxRuntimeExports.jsx(BuildTabItemRow,{stores:kt,sideMenuOpen:_e,element:Tn,index:Cn,visible:Dt,spawnGhosts:vn,spawnItem:dn,removeAllGhosts:_n,infoModalOpen:Xt,isMouseUsed:hn,setItemAllowed:Jt,activeItems:nn,elementsLength:zt.length},`category_${Tn.categoryID}_${Cn}`)),Ht!==void 0&&jsxRuntimeExports.jsx(BuildTabItemRow_PreConfig,{stores:kt,sideMenuOpen:_e,onClick:mn,visible:Dt,configsData:Ht.configsData,infoModalOpen:Xt,isMouseUsed:hn,label:Ht.label,index:zt.length,elementsLength:zt.length+1},"preconfiguration_desktopCategory")]})]})},handleGlobalVariantSwitch=(kt,_e,Dt)=>{kt.uiSceneStore.getState().CORE_API.switchGlobalVariant(_e,Dt)};function Divider$1(kt,_e){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:kt!==_e.length-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""})}const Color=({stores:kt,visible:_e})=>{const Dt=kt.productDataStore(qt=>qt.categoryData),Vt=kt.colorStore(qt=>qt.allActiveVariants),Gt=kt.uiSceneStore(qt=>qt.materialOverrideExists),zt=kt.uiSceneStore(qt=>qt.CORE_API),jt=kt.cartStore(qt=>qt.previewCartModalOpen),Ht=kt.uiSceneStore(qt=>qt.dialogPopupOpen),Wt=reactExports.useCallback(()=>{kt.uiSceneStore.getState().CORE_API.removeAllVariantOverrides()},[]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"container desktop",role:"button",style:{height:"auto"},hidden:!_e,children:[Gt&&jsxRuntimeExports.jsx("button",{tabIndex:!Ht&&!jt&&Gt&&_e?0:-1,className:"removeAllColorOverridesButton",role:"button","aria-hidden":!Gt||Ht||jt||!_e,"aria-label":"Remove All Overrides Button",onClick:Wt,disabled:!Gt,children:"Remove all overrides"}),Dt.color.map((qt,Xt)=>jsxRuntimeExports.jsxs("div",{className:"subContainer topContainer",children:[jsxRuntimeExports.jsx("h4",{className:"subheading",children:qt.label}),jsxRuntimeExports.jsx("div",{className:"sidemenuContent",children:jsxRuntimeExports.jsx("div",{className:"color-grid color-variants-selection",children:qt.looks.map((Kt,Yt)=>jsxRuntimeExports.jsxs("div",{tabIndex:!Ht&&!jt&&_e?0:-1,onClick:()=>handleGlobalVariantSwitch(kt,qt.id,Kt),role:"button","aria-hidden":Ht||jt||!_e,"aria-label":kt.productDataStore.getState().lookData[Kt]?.label+" Button",className:Vt[qt.id]==Kt?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:Zt=>{Zt.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:kt.productDataStore.getState().lookData[Kt]?.label,className:"contextColorThumbnail",src:zt.getResolvedAssetUrl(kt.productDataStore.getState().lookData[Kt]?.thumbnail),onError:Zt=>{Zt.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsxs("div",{className:"colorDetails",children:[jsxRuntimeExports.jsx("p",{className:"truncate colorDetailsLabel",children:capitalize$1(kt.productDataStore.getState().lookData[Kt]?.label)}),jsxRuntimeExports.jsx("p",{className:"truncate colorDetailsLabel",children:capitalize$1(kt.productDataStore.getState().lookData[Kt]?.accent)})]})]},"Color-"+Yt))})}),jsxRuntimeExports.jsx(Divider$1,{})]},`${qt.label}-${Xt}`))]})})};function scrollToTop(kt,_e,Dt){let Vt=_e.clientHeight,Gt=Vt*Dt;if(kt.current.scrollTop===Gt)return;let zt=null;const jt=500,Ht=kt.current.scrollTop;function Wt(Xt){Vt=_e.clientHeight,Gt=Vt*Dt;let Kt=Gt-Ht;zt||(zt=Xt);const Yt=Xt-zt,Zt=Math.min(Yt/jt,1);kt.current.scrollTop=Ht+Kt*qt(Zt),Zt<1&&window.requestAnimationFrame(Wt)}function qt(Xt){return Xt<.5?2*Xt*Xt:-1+(4-2*Xt)*Xt}window.requestAnimationFrame(Wt)}function CarouselItem({stores:kt,carouselTabKey:_e,hotspotContentRef:Dt,defaultAltText:Vt}){const Gt=reactExports.useRef(null),zt=kt.uiSceneStore(Ht=>Ht.CORE_API),jt=Ht=>{Ht.target.style.width="100%"};return jsxRuntimeExports.jsx(SplideSlide,{children:jsxRuntimeExports.jsxs("div",{className:"carouselTabParent",ref:Gt,children:[_e.type==="img"&&jsxRuntimeExports.jsx("img",{src:zt.getResolvedAssetUrl(_e.link),alt:_e.alt?_e.alt:Vt,onLoad:Ht=>jt(Ht),onError:Ht=>{Ht.target.src="https://placehold.co/150"}}),_e.type==="video"&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("p",{className:"carouselVideoPlaceholderText",children:_e.alt?_e.alt:Vt}),jsxRuntimeExports.jsx("video",{src:zt.getResolvedAssetUrl(_e.link),muted:!0,loop:!0,autoPlay:!0,playsInline:!0,controls:!1,onLoad:Ht=>jt(Ht)})]}),_e.title&&jsxRuntimeExports.jsx("p",{className:"carouselTitle",children:_e.title})]})},"SplideSlide-"+_e.link)}function Tab({stores:kt,sideMenuOpen:_e,tabs:Dt,tabKey:Vt,index:Gt,activeFeatureID:zt}){const[jt,Ht]=reactExports.useState([]),Wt=reactExports.useRef(null),qt=reactExports.useRef(null),Xt=reactExports.useRef(null),Kt=kt.cartStore(en=>en.previewCartModalOpen),Yt=kt.uiSceneStore(en=>en.dialogPopupOpen),[Zt,Jt]=reactExports.useState(!1),nn=reactExports.useCallback(en=>{kt.uiSceneStore.getState().CORE_API.clickHotspot("hotspot3D_"+en,{ignoreUI:!0})},[zt]);reactExports.useEffect(()=>{let en=[],tn=Vt.hotspotData;for(let sn=0;sn<tn.carousel.length;sn++)tn.carousel[sn].type!==""&&tn.carousel[sn].link!==""&&(en=[...en,{...tn.carousel[sn],index:sn}]);Ht(en)},[Vt]),reactExports.useEffect(()=>{const{current:en}=qt;en&&(zt===en.id?(rn(en),Jt(!0)):(Qt(en),Jt(!1)))},[zt]);const rn=reactExports.useCallback(en=>{en.checked=!0,en.nextElementSibling.nextElementSibling.setAttribute("style","max-height: 800px;"),scrollToTop(Dt,en.nextElementSibling,Gt)},[]),Qt=reactExports.useCallback(en=>{en.nextElementSibling.nextElementSibling.setAttribute("style","max-height: 0px;"),en.checked=!1},[]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Vt.hotspotData&&jsxRuntimeExports.jsxs("div",{className:"accordionTab",children:[jsxRuntimeExports.jsx("input",{tabIndex:_e&&!Yt&&!Kt?0:-1,"aria-hidden":!_e||Yt||Kt,type:"checkbox",name:"accordion",id:"rd_"+Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID,defaultChecked:!1,ref:qt,"aria-label":"Toggle Accordion for "+Vt.hotspotData.title,onClick:en=>{nn(Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID,{ignoreUI:!1})}}),jsxRuntimeExports.jsxs("label",{className:"tab-label",htmlFor:"rd_"+Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID,children:[jsxRuntimeExports.jsx("span",{children:Vt.hotspotData.title}),jsxRuntimeExports.jsx("img",{alt:"Open Image for title "+Vt.hotspotData.title,className:"accordion-closed",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg",onError:en=>{en.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("img",{alt:"Close Image for title "+Vt.hotspotData.title,className:"accordion-open",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Minus.svg",onError:en=>{en.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{className:"tab-content",children:jsxRuntimeExports.jsx("div",{className:"hotspot-content",ref:Xt,children:Zt&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ReactQuill$1,{className:"ignore",modules:{toolbar:!1},theme:"bubble",readOnly:!0,value:Vt.hotspotData.description}),jt.length==1&&jt[0].type!=""&&jt[0].link!=""&&jsxRuntimeExports.jsx("ul",{children:jsxRuntimeExports.jsx(CarouselItem,{stores:kt,carouselTabKey:jt[0],index:0,defaultAltText:Vt.itemData.name?Vt.itemData.name:Vt.itemData.skuID,hotspotContentRef:Xt},"carouselTabs_"+Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID+"_0")}),jt.length>1&&jsxRuntimeExports.jsx("div",{className:"carousel",children:jsxRuntimeExports.jsx(Splide2,{options:{perPage:1,preloadPages:3},role:"none",ref:Wt,children:jt.map((en,tn)=>en.type!=""&&en.link!=""&&jsxRuntimeExports.jsx(CarouselItem,{stores:kt,carouselTabKey:en,defaultAltText:Vt.itemData.name?Vt.itemData.name:Vt.itemData.skuID,index:tn,hotspotContentRef:Xt},"carouselTabs_"+Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID+"_"+en.index))})})]})})})]})})}const ProductFeaturesUI=({stores:kt,sideMenuOpen:_e,visible:Dt,identifier:Vt})=>{const Gt=kt.uiSceneStore(qt=>qt.CORE_API),zt=kt.uiSceneStore(qt=>qt.tabSpawnCount),jt=kt.uiSceneStore(qt=>qt.isScreenPortrait),Ht=reactExports.useRef(null),Wt=kt.uiHotspotStore(qt=>qt.activeFeatureID);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{className:"col desktop productFeatureUIDic",hidden:!Dt,tabIndex:Dt&&Vt=="featuresTab-mobile"&&jt||Vt=="featuresTab-desktop"&&!jt?0:-1,"aria-hidden":!Dt||Vt=="featuresTab-mobile"&&!jt||Vt=="featuresTab-desktop"&&jt,children:jsxRuntimeExports.jsxs("div",{className:"tabs",ref:Ht,children:[zt.length==0&&jsxRuntimeExports.jsx("div",{className:"tabEmptyText",children:Gt.sceneSettings.textSettings.featuresTabEmptyText}),zt.map((qt,Xt)=>jsxRuntimeExports.jsx(Tab,{stores:kt,sideMenuOpen:_e,tabs:Ht,activeFeatureID:Wt,tabKey:qt,index:Xt},"tabs_"+qt.itemData.skuID+"_"+qt.hotspotData.hotspotID))]})})})},CartItem=({stores:kt,itemObject:_e})=>{const Dt=kt.uiSceneStore(jt=>jt.CORE_API),Vt=kt.uiSceneStore(jt=>jt.disableCart),[Gt,zt]=reactExports.useState(Dt.sceneSettings.currency);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:_e.countUnavailable=="0"||Vt?"cartItem":"cartItem cartItemOutOfStock",draggable:!1,style:{display:_e?"":"none"},children:[jsxRuntimeExports.jsx("div",{className:"cartItemImage",children:jsxRuntimeExports.jsx("img",{draggable:!1,src:Dt.getResolvedAssetUrl(_e.thumbnails.review?_e.thumbnails.review:_e.thumbnails.low),alt:_e.title,"aria-label":_e.title,onError:jt=>{jt.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsxs("div",{className:"cartItemDetails",children:[jsxRuntimeExports.jsx("h4",{children:_e.title}),_e.subtitle?jsxRuntimeExports.jsx("h5",{children:_e.subtitle}):jsxRuntimeExports.jsx("h5",{children:_e.subheading}),jsxRuntimeExports.jsxs("div",{className:"cartRow",children:[jsxRuntimeExports.jsxs("span",{className:"itemCount",children:[Dt.sceneSettings.textSettings.cartQuantityText,":"," ",_e.count]}),jsxRuntimeExports.jsxs("h3",{className:"itemPrice".concat(Vt===!0?" hide":""),children:[Gt,parseFloat(_e.price).toFixed(2)]}),_e.compareAtPrice!=0&&_e.compareAtPrice>_e.price&&jsxRuntimeExports.jsxs("h3",{className:"itemCompareAtPrice".concat(Vt===!0?" hide":""),children:[Gt,parseFloat(_e.compareAtPrice).toFixed(2)]})]}),_e.actionButton&&jsxRuntimeExports.jsx("span",{className:"actionButton",role:"button","aria-label":"Action Button",onClick:()=>Dt.actionButtonClicked(_e),children:_e.actionButton.text}),jsxRuntimeExports.jsxs("div",{className:"cartRow".concat(Vt===!0||_e.countUnavailable=="0"?" hide":""),tabIndex:Vt===!0||_e.countUnavailable=="0"?-1:0,"aria-hidden":Vt===!0||_e.countUnavailable=="0",children:[jsxRuntimeExports.jsx("img",{className:"cartRowImage",alt:"Info",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Info_red.png",onError:jt=>{jt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsxs("h3",{className:"itemAvailable",children:[_e.countAvailable," IN STOCK"]}),jsxRuntimeExports.jsx("span",{className:"itemCount",children:"- quantities requested not available"})]})]})]})})},PreviewCart=({stores:kt})=>{const _e=kt.cartStore(Xt=>Xt.cart),Dt=kt.cartStore(Xt=>Xt.previewCartModalOpen),Vt=kt.cartStore(Xt=>Xt.togglePreviewCartModal),Gt=kt.uiSceneStore(Xt=>Xt.CORE_API),zt=kt.uiSceneStore(Xt=>Xt.disableCart),jt=kt.uiSceneStore(Xt=>Xt.cartMessage),Ht=kt.uiSceneStore(Xt=>Xt.dialogPopupOpen),Wt=reactExports.useRef(null),qt=reactExports.useCallback(async()=>{await Gt.checkoutAsync()},[]);return reactExports.useEffect(()=>{Wt.current&&Dt&&Wt.current.focus()},[Dt]),reactExports.useEffect(()=>{const Xt=async()=>{const Kt=await kt.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics();if(Dt){const Yt=new EpigraphPanelOpenedEvent(Kt,!0,"preview-cart","button");kt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(Yt)}else{const Yt=new EpigraphPanelClosedEvent(Kt,!0,"preview-cart","button");kt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(Yt)}};kt?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics&&Xt()},[Dt,kt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:Dt?"previewCartModal open":"previewCartModal",tabIndex:!Ht&&Dt?0:-1,"aria-hidden":Ht||!Dt,children:[jsxRuntimeExports.jsxs("div",{className:"previewCartModalChild",children:[jsxRuntimeExports.jsx("div",{role:"button",ref:Wt,className:"closeButton",id:"preview-cart-close-button","aria-label":"Close Button",onClick:()=>{Vt()},children:jsxRuntimeExports.jsx("img",{alt:"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg",onError:Xt=>{Xt.target.src="https://placehold.co/150"}})}),_e.length<=0&&jsxRuntimeExports.jsx("h3",{className:"cartEmptyText",children:"Your cart is currently empty"}),_e.length>0&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("h2",{className:"cartTitle",children:Gt.sceneSettings.textSettings.cartHeadingText}),jsxRuntimeExports.jsx("div",{className:"previewCartContentParentDiv",children:jsxRuntimeExports.jsx("div",{className:"previewCartContent",children:_e.map((Xt,Kt)=>jsxRuntimeExports.jsx(CartItem,{stores:kt,itemObject:Xt,index:Kt},`Cart Item-${Kt}`))})})]})]}),jsxRuntimeExports.jsxs("div",{className:"checkButtonParentDiv".concat(zt===!0?" hide":""),children:[jt&&jsxRuntimeExports.jsx("div",{className:"cartMessageDiv",children:jsxRuntimeExports.jsx("span",{children:jt})}),jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Click to checkout the cart","aria-hidden":!Dt,tabIndex:Dt?0:-1,className:"checkoutButton",onClick:qt,children:jsxRuntimeExports.jsx("span",{children:Gt.sceneSettings.addToCartCTAText})})]})]})})},InfoModal=({stores:kt,visible:_e})=>{const Dt=kt.productDataStore(En=>En.categoryData),Vt=kt.uiSceneStore(En=>En.dialogPopupOpen),Gt=kt.uiSceneStore(En=>En.isScreenPortrait),zt=kt.colorStore(En=>En.allActiveVariants),jt=kt.infoStore(En=>En.infoObject),Ht=kt.infoStore(En=>En.infoModalOpen),Wt=kt.itemStore(En=>En.itemsSpawned),qt=kt.infoStore(En=>En.updateInfoModalOpen),[Xt,Kt]=reactExports.useState(""),[Yt,Zt]=reactExports.useState([]),[Jt,nn]=reactExports.useState(!1),rn=kt.uiSceneStore(En=>En.CORE_API),Qt=kt.productDataStore(En=>En.productData),en=kt.itemStore(En=>En.fittingSkuIds),[tn,sn]=reactExports.useState(!1),[cn,un]=reactExports.useState(0),hn=kt.coreSceneStore(En=>En.sceneSettings),fn=reactExports.useRef(null),pn=reactExports.useCallback(()=>{cn<=0||!jt.skuID||rn.removeLastItemBySkuId(jt.skuID)},[cn,jt]),dn=()=>{if(!Wt||!jt.skuID)return;let En=0;const An=Object.keys(Wt);for(let Tn=An.length-1;Tn>=0;Tn--){const Cn=An[Tn];Wt[Cn].itemData.skuID===jt.skuID&&En++}un(En)};reactExports.useEffect(()=>{dn()},[Wt,jt]),reactExports.useEffect(()=>{Object.keys(Dt).length!=0&&Zt(Dt.build)},[Dt]),reactExports.useEffect(()=>(Kt(zt[Object.keys(zt)[0]]),()=>{}),[zt]),reactExports.useEffect(()=>{en.includes(jt.skuID)?nn(!0):nn(!1)},[en,jt]),reactExports.useEffect(()=>{if(!Qt||!jt.skuID)return;const En=Qt[jt.skuID].incrementDecrementControl?Qt[jt.skuID].incrementDecrementControl:!1;sn(En)},[Qt,jt]);const mn=reactExports.useCallback(()=>{Jt&&rn.spawnGhostsForSkuID(jt.skuID,!1,1)},[jt,Jt]),vn=reactExports.useCallback(()=>{Jt&&rn.removeAllGhosts(jt.skuID)},[jt,Jt]),_n=reactExports.useCallback(()=>{Jt&&rn.spawnItemBySkuID(jt.skuID,!0)},[jt,Jt]);return reactExports.useEffect(()=>{fn.current&&_e&&Ht&&fn.current.focus()},[Ht,_e]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:Ht&&_e?"infoModal open":"infoModal",tabIndex:Ht&&!Gt?0:-1,"aria-hidden":!Ht||Gt,children:[jsxRuntimeExports.jsxs("a",{role:"button","aria-label":"Product Page Link Button","aria-hidden":Vt||!_e||!Ht||!jt?.productPageUrl,tabIndex:!Vt&&_e&&Ht&&jt?.productPageUrl?0:-1,ref:fn,href:jt.productPageUrl,className:"categoryLink",target:"_blank",style:jt?.productPageUrl&&Ht?{pointerEvents:"all"}:{pointerEvents:"none"},children:[jsxRuntimeExports.jsxs("h2",{className:"categoryTitle",children:[jt?.productCategory?.label,jt.subheading&&jsxRuntimeExports.jsx("div",{className:"modalSubHeading",children:jt.subheading})]}),jt.productPageUrl&&jsxRuntimeExports.jsx("img",{alt:"Open Product Page",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/OpenTab.svg",onError:En=>{En.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{role:"button","aria-hidden":Vt||!_e||!Ht,tabIndex:!Vt&&_e&&Ht?0:-1,className:"closeButton","aria-label":"Close Button",onClick:()=>{qt(!1)},children:jsxRuntimeExports.jsx("img",{alt:"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg",onError:En=>{En.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("div",{className:"infoModalImageContainer",children:jt?.thumbnails?.high?jsxRuntimeExports.jsx("img",{alt:jt.title,className:"itemImage","aria-label":jt.title,src:rn.getResolvedAssetUrl(jt.thumbnails.high),onError:En=>{En.target.src="https://placehold.co/150"}}):""}),jsxRuntimeExports.jsxs("div",{className:"infoModalTextContainer",children:[jsxRuntimeExports.jsx("h2",{className:"itemTitle",children:jt.title}),jsxRuntimeExports.jsx("pre",{className:"itemDescription",children:jt.description}),jt.boundingBoxSize?jsxRuntimeExports.jsxs("p",{className:"infoModalDimensions",children:[jt.boundingBoxSize.x.toFixed(1),"” W x"," ",jt.boundingBoxSize.y.toFixed(1),"” D x"," ",jt.boundingBoxSize.z.toFixed(1),"” H"]}):""]}),hn.addFromInfoModal&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:tn?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"infoModalIncrementDecrementParent incrementDecrementPanel",children:[jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Decrement Button","aria-hidden":cn==0||Vt||!Ht,tabIndex:cn!==0&&!Vt&&Ht?0:-1,className:"incrementMinusSign ".concat(`${cn===0?"incrementSignDisable":""}`),onClick:pn,children:jsxRuntimeExports.jsx("img",{alt:"Decrement",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Minus.svg",onError:En=>{En.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("div",{className:"incrementCount",children:cn}),jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Increment Button","aria-hidden":Vt||!Ht||!Jt,tabIndex:!Vt&&Ht&&Jt?0:-1,className:"incrementPlusSign ".concat(`${Jt===!0?"":"incrementSignDisable"}`),onClick:_n,onMouseEnter:mn,onMouseLeave:vn,children:jsxRuntimeExports.jsx("img",{alt:"Increment",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg",onError:En=>{En.target.src="https://placehold.co/150"}})})]})}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Add Button","aria-hidden":!Jt||Vt||!Ht,tabIndex:!Vt&&Ht&&Jt?0:-1,className:"infoModalAddButton ".concat(`${Jt===!0?"enabledInfoModalAddButton":"disabledInfoModalAddButton"}`),onFocus:mn,onBlur:vn,onMouseEnter:mn,onMouseLeave:vn,onClick:_n,children:"Add"})})}),jsxRuntimeExports.jsx("div",{className:"infoModalActions",children:jt.price&&jsxRuntimeExports.jsxs("button",{className:"item-price",disabled:!0,children:["$",numberWithCommas(parseFloat(jt.price).toFixed(2))]})})]})})},handleGlobalGeometryVariantSwitch=(kt,_e,Dt)=>{kt.uiSceneStore.getState().CORE_API.switchGlobalGeometryVariant(_e,Dt)};function Divider(kt,_e){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:kt!==_e.length-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""})}const GeometryVariants=({stores:kt,visible:_e})=>{const Dt=kt.productDataStore(Wt=>Wt.categoryData),Vt=kt.colorStore(Wt=>Wt.allActiveGeometryVariants),Gt=kt.uiSceneStore(Wt=>Wt.CORE_API),zt=kt.uiSceneStore(Wt=>Wt.isScreenPortrait),jt=kt.cartStore(Wt=>Wt.previewCartModalOpen),Ht=kt.uiSceneStore(Wt=>Wt.dialogPopupOpen);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{className:"container desktop",role:"group",style:{height:"auto"},hidden:!_e,tabIndex:_e&&!zt?0:-1,"aria-hidden":!_e||zt,children:Dt.geometryVariants.map((Wt,qt)=>jsxRuntimeExports.jsxs("div",{className:"subContainer topContainer",children:[jsxRuntimeExports.jsx("h4",{className:"subheading",children:Wt.label}),jsxRuntimeExports.jsx("div",{className:"sidemenuContent",children:jsxRuntimeExports.jsx("div",{className:"color-grid geometry-variants-selection",children:Object.keys(Wt.variants).map((Xt,Kt)=>jsxRuntimeExports.jsxs("div",{tabIndex:!Ht&&!jt?0:-1,onClick:()=>handleGlobalGeometryVariantSwitch(kt,Wt.id,Xt),role:"button","aria-hidden":Ht||jt,"aria-label":Wt.variants[Xt].label+" Button",className:Vt[Wt.id]==Xt?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",style:{borderRadius:"0%"},children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:Yt=>{Yt.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:Wt.variants[Xt].label,className:"contextColorThumbnail",src:Gt.getResolvedAssetUrl(Wt.variants[Xt].thumbnail),onError:Yt=>{Yt.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsx("p",{className:"truncate colorDetailsLabel",children:capitalize$1(Wt.variants[Xt].label)})})]},"Color-"+Kt))})}),jsxRuntimeExports.jsx(Divider,{})]},`${Wt.label}-${qt}`))})})},VariantMobile=({stores:kt,sideMenuOpen:_e,sortedVariantsTabOrder:Dt})=>{const Vt=kt.productDataStore(pn=>pn.categoryData),Gt=kt.productDataStore(pn=>pn.lookData),zt=kt.colorStore(pn=>pn.allActiveVariants),jt=kt.uiSceneStore(pn=>pn.isScreenPortrait),Ht=kt.colorStore(pn=>pn.allActiveGeometryVariants),Wt=kt.uiSceneStore(pn=>pn.materialOverrideExists),[qt,Xt]=reactExports.useState(0),[Kt,Yt]=reactExports.useState(0);reactExports.useEffect(()=>{let pn=0;Dt.includes("color")===!0&&(pn+=Vt.color.length),Dt.includes("geometryVariants")===!0&&(pn+=Vt.geometryVariants.length),Yt(pn)},[Vt]);const Zt=(pn,dn,mn)=>{pn.uiSceneStore.getState().CORE_API.switchGlobalGeometryVariant(dn,mn)},Jt=(pn,dn,mn)=>{pn.uiSceneStore.getState().CORE_API.switchGlobalVariant(dn,mn)};function nn({color:pn,index:dn,elementId:mn,allActiveVariants:vn}){return jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:_e?0:-1,"aria-hidden":!_e,"aria-label":Gt[pn]?.label+" Button",onClick:()=>Jt(kt,mn,pn),className:vn[mn]==pn?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:_n=>{_n.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:Gt[pn]?.label,className:"contextColorThumbnail",src:kt.uiSceneStore.getState().CORE_API.getResolvedAssetUrl(Gt[pn]?.thumbnail),onError:_n=>{_n.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsx("p",{className:"truncate-mobile colorDetailsLabel",children:capitalize$1(Gt[pn]?.label)})})]},"Color-"+dn)}function rn({variant:pn,variantId:dn,index:mn,elementId:vn,allActiveGeometryVariants:_n}){return jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:_e?0:-1,"aria-hidden":!_e,"aria-label":pn.label+" Button",onClick:()=>Zt(kt,vn,dn),className:_n[vn]==dn?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:En=>{En.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:pn.label,className:"contextColorThumbnail",src:kt.uiSceneStore.getState().CORE_API.getResolvedAssetUrl(pn.thumbnail),onError:En=>{En.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsx("p",{className:"truncate-mobile colorDetailsLabel",children:capitalize$1(pn.label)})})]},"GeometryVariant-"+mn)}function Qt({variantType:pn,element:dn,allActiveVariants:mn,startIndex:vn}){return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[pn=="color"&&dn.looks.map((_n,En)=>jsxRuntimeExports.jsx(nn,{color:_n,index:En,elementId:dn.id,allActiveVariants:mn},"MobileGridInternal_"+En)),pn=="geometry"&&Object.keys(dn.variants).map((_n,En)=>jsxRuntimeExports.jsx(rn,{variant:dn.variants[_n],index:En,elementId:dn.id,variantId:_n,allActiveGeometryVariants:mn},"MobileGridVariantInternal_"+En))]})}const en=reactExports.useCallback(({index:pn})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:pn!==Kt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):jsxRuntimeExports.jsx("div",{className:"itemGridPlaceholder"})}),[Vt,Kt]),tn=reactExports.useCallback(()=>{kt.uiSceneStore.getState().CORE_API.removeAllVariantOverrides()},[]),sn=reactExports.useCallback(pn=>{if(un.current.scrollLeft===pn)return;let dn,mn,vn,_n=!1;function En(An){dn===void 0&&(dn=An);const Tn=An-dn;if(mn!==An){const Cn=Tn/200;un.current.scrollLeft>pn?(vn=(un.current.scrollLeft-pn)*Math.min(Cn,1),un.current.scrollLeft-=vn,un.current.scrollLeft===pn&&(_n=!0)):un.current.scrollLeft<pn&&(vn=(pn-un.current.scrollLeft)*Math.min(Cn,1),un.current.scrollLeft+=vn,un.current.scrollLeft===pn&&(_n=!0))}Tn<200&&(mn=An,!_n&&window.requestAnimationFrame(En))}window.requestAnimationFrame(En)},[]),cn=reactExports.useRef([]);reactExports.useEffect(()=>{cn.current=cn.current.slice(0,Kt)},[Kt]);const un=reactExports.useRef(null),hn=reactExports.useCallback(({sideMenuOpen:pn,categoryID:dn,label:mn,index:vn,totalLength:_n})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("a",{role:"button",tabIndex:pn?0:-1,"aria-hidden":!pn,"aria-label":mn+" Button",className:qt===vn?"mobileTab scrolled":"mobileTab",onClick:()=>{for(let En=0;En<_n;En++)En===vn&&sn(cn.current[En].offsetLeft)},children:mn})}),[qt,cn]),fn=reactExports.useCallback(()=>{let pn=-3e3,dn=-1;for(let mn=0;mn<Kt;mn++){let vn=cn.current[mn].getBoundingClientRect().left;vn<28&&pn<vn&&(pn=vn,dn=mn)}dn!==-1&&Xt(dn)},[cn,Vt,Kt]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{className:"mobileTabContent",tabIndex:jt?0:-1,"aria-hidden":!jt,children:jsxRuntimeExports.jsxs("div",{className:"scrollSpyTabs",children:[jsxRuntimeExports.jsx("div",{className:"secondMobileTabs",children:Dt.map((pn,dn)=>{if(pn=="color")return Vt.color.map((mn,vn)=>jsxRuntimeExports.jsx(hn,{sideMenuOpen:_e,categoryID:mn.id,label:mn.label,index:dn==0?vn:Dt.includes("geometryVariants")?Vt.geometryVariants.length+vn:vn,totalLength:Kt},"mobileTabsColors"+mn.id));if(pn=="geometryVariants")return Vt.geometryVariants.map((mn,vn)=>jsxRuntimeExports.jsx(hn,{categoryID:mn.id,label:mn.label,index:dn==0?vn:Dt.includes("color")?Vt.color.length+vn:vn,totalLength:Kt},"mobileTabsVariants"+mn.id))})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("div",{className:"mobileGrid mobileGridCenter",ref:un,onScroll:fn,children:jsxRuntimeExports.jsxs("section",{className:"mobileGridSection",children:[Wt&&jsxRuntimeExports.jsxs("button",{role:"button",tabIndex:jt&&Wt&&_e?0:-1,"aria-label":"Remove All Overrides Button","aria-hidden":!jt||!Wt||!_e,onClick:tn,className:"removeAllColorOverridesButton",disabled:!Wt,children:[jsxRuntimeExports.jsx("div",{className:"iconContainer",children:jsxRuntimeExports.jsx("img",{src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/TrashSimple.svg",alt:"Remove",onError:pn=>{pn.target.src="https://placehold.co/150"}})}),"Remove all",jsxRuntimeExports.jsx("br",{}),"overrides"]}),Dt.map((pn,dn)=>{if(pn=="color")return Vt.color.map((mn,vn)=>jsxRuntimeExports.jsxs("section",{className:"mobileGridCategorySection color-variants-selection",id:`section-${mn.categoryID}`,ref:_n=>cn.current[dn==0?vn:Dt.includes("geometryVariants")?Vt.geometryVariants.length+vn:vn]=_n,children:[jsxRuntimeExports.jsx(Qt,{variantType:"color",element:mn,allActiveVariants:zt},`mobileGrid-${mn.categoryID}`),jsxRuntimeExports.jsx(en,{index:dn==0?vn:Dt.includes("geometryVariants")?Vt.geometryVariants.length+vn:vn},"divider"+mn.categoryID)]},`sectionz-${mn.categoryID}-${vn}`));if(pn=="geometryVariants")return Vt.geometryVariants.map((mn,vn)=>jsxRuntimeExports.jsxs("section",{className:"mobileGridCategorySection geometry-variants-selection",id:`section-${mn.id}`,ref:_n=>cn.current[dn==0?vn:Dt.includes("color")?Vt.color.length+vn:vn]=_n,children:[jsxRuntimeExports.jsx(Qt,{variantType:"geometry",element:mn,allActiveVariants:Ht},`mobileGrid-variants-${mn.id}`),jsxRuntimeExports.jsx(en,{index:dn==0?vn:Dt.includes("color")?Vt.color.length+vn:vn},"divider-variants-"+mn.id)]},`sectionz-variants-${mn.id}-${vn}`))})]})})})]})})})},SideMenu=({stores:kt,sideMenuOpen:_e,sideMenuRef:Dt,toggleSideMenuOpen:Vt,configuratorWcRef:Gt,PUBLIC_DESIGN_ASSETS_ENDPOINT:zt,handleSideButtonClick:jt,useTabIcon:Ht,GENERIC_PROJECT_ASSET_DATA_ROOT_URL:Wt,sideMenuState:qt,togglePreviewCartModal:Xt,getItemCount:Kt,currency:Yt})=>{const Zt=kt.productDataStore(un=>un.hotspotsData),Jt=kt.cartStore(un=>un.previewCartModalOpen),nn=kt.uiSceneStore(un=>un.dialogPopupOpen),rn=kt.productDataStore(un=>un.categoryData),Qt=kt.uiSceneStore(un=>un.disableCart),en=kt.uiSceneStore(un=>un.CORE_API),tn=kt.uiSceneStore(un=>un.isScreenPortrait),[sn,cn]=reactExports.useState([]);return reactExports.useEffect(()=>{const un=en.sceneSettings.variantsTabOrder,hn=Object.entries(un);hn.sort(([,pn],[,dn])=>pn.priority-dn.priority);const fn=[];hn.forEach(([pn,dn])=>{dn.enabled&&fn.push(pn)}),cn(fn)},[en]),reactExports.useEffect(()=>{if(!kt.uiSceneStore.getState().CORE_API.isMobile)return;const{current:un}=Dt;!un||Gt.shadowRoot.getElementById("_leftShell")},[_e,Dt]),jsxRuntimeExports.jsxs("div",{className:`sideMenu interactable ${_e===!0?"":"side-menu-collapsed"}`,ref:Dt,children:[jsxRuntimeExports.jsxs("div",{className:_e?"mobileExpandButton sideMenuOpen":"mobileExpandButton",tabIndex:tn?0:-1,"aria-hidden":!tn,children:[jsxRuntimeExports.jsx("span",{children:"Expand Configurator"}),jsxRuntimeExports.jsx("div",{role:"button",tabIndex:!_e&&!nn&&!Jt?0:-1,"aria-hidden":_e||nn||Jt,"aria-label":"Expand Menu",onClick:Vt,children:jsxRuntimeExports.jsx("img",{alt:"Down",src:zt+"/Icon/ArrowDown.svg",onError:un=>{un.target.src="https://placehold.co/150"}})},"expandSideMenuButton")]}),jsxRuntimeExports.jsx("div",{className:_e===!0?"sideMenuTabContainer":"sideMenuTabContainer side-menu-container-hide",tabIndex:tn?0:-1,"aria-hidden":!tn,children:jsxRuntimeExports.jsxs(Tabs,{className:"firstMobileTab",children:[jsxRuntimeExports.jsxs(TabList,{className:"firstMobileTabs","aria-label":"Mobile Tab List",children:[jsxRuntimeExports.jsx(Tab$1,{children:jsxRuntimeExports.jsxs("div",{className:"mobileTab",role:"button",tabIndex:!Jt&&!nn&&_e?0:-1,"aria-hidden":Jt||!_e||nn,"aria-label":"A button to select the "+en.sceneSettings.textSettings.buildTabHeadingText+" Tab",onClick:()=>{jt(0)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Build",src:Wt+"/thumbnails/common-ui/BuildTabIcon.svg",onError:un=>{un.target.src="https://placehold.co/150"}}):"",en.sceneSettings.textSettings.buildTabHeadingText]})}),(rn.color.length>0||rn.geometryVariants.length>0)&&jsxRuntimeExports.jsx(Tab$1,{children:jsxRuntimeExports.jsxs("div",{className:"mobileTab",role:"button",tabIndex:!Jt&&!nn&&_e?0:-1,"aria-hidden":Jt||nn||!_e,"aria-label":en.sceneSettings.textSettings.colorTabHeadingText+" Button",onClick:()=>{jt(1)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Color",src:Wt+"/thumbnails/common-ui/ColorTabIcon.svg",onError:un=>{un.target.src="https://placehold.co/150"}}):"",en.sceneSettings.textSettings.colorTabHeadingText]})}),Object.keys(Zt).length>0&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Tab$1,{children:jsxRuntimeExports.jsxs("div",{className:"mobileTab",role:"button",tabIndex:!Jt&&!nn&&_e?0:-1,"aria-hidden":!_e||nn||Jt,"aria-label":en.sceneSettings.textSettings.featuresTabHeadingText+" Button",onClick:()=>{jt(2)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Features",src:Wt+"/thumbnails/common-ui/ProductFeaturesTabIcon.png",onError:un=>{un.target.src="https://placehold.co/150"}}):"",en.sceneSettings.textSettings.featuresTabHeadingText]})})}),jsxRuntimeExports.jsx("div",{role:"tab",className:"collapse-side-menu-button-parent",children:jsxRuntimeExports.jsx("div",{className:`collapse-side-menu-button ${_e===!0?"":"set-display-none"}`,role:"button",tabIndex:!Jt&&!nn&&_e?0:-1,"aria-hidden":Jt||nn||!_e,"aria-label":"Collapse Menu",onClick:Vt,children:jsxRuntimeExports.jsx("img",{alt:"Down",src:zt+"/Icon/ArrowDown.svg",onError:un=>{un.target.src="https://placehold.co/150"}})},"collapseSideMenuButton")})]}),jsxRuntimeExports.jsx(TabPanel,{children:jsxRuntimeExports.jsx(BuildUI,{stores:kt,sideMenuOpen:_e,identifier:"buildUI-mobile",sideMenuState:0})}),(rn.color.length>0||rn.geometryVariants.length>0)&&jsxRuntimeExports.jsx(TabPanel,{children:jsxRuntimeExports.jsx("div",{className:"variantContainer",children:jsxRuntimeExports.jsx(VariantMobile,{stores:kt,sideMenuOpen:_e,sortedVariantsTabOrder:sn})})}),Object.keys(Zt).length>0&&jsxRuntimeExports.jsx(TabPanel,{children:jsxRuntimeExports.jsx("div",{className:"featuresContainer",children:jsxRuntimeExports.jsx(ProductFeaturesUI,{stores:kt,sideMenuOpen:_e,identifier:"featuresTab-mobile",visible:qt===2})})})]})}),jsxRuntimeExports.jsxs("div",{className:"desktopSideMenu",tabIndex:tn?-1:0,"aria-hidden":tn,role:"group",children:[jsxRuntimeExports.jsxs("nav",{className:"sideMenuTabs",children:[jsxRuntimeExports.jsxs("div",{role:"button","aria-hidden":!_e||nn||Jt,tabIndex:_e&&!nn&&!Jt?0:-1,className:qt===0?"activeSideMenuTab rightTopBarButton button":"inactiveSideMenuTab rightTopBarButton button","aria-label":en.sceneSettings.textSettings.buildTabHeadingText+" Button",onClick:()=>{jt(0)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Build",src:Wt+"BuildTabIcon.png",onError:un=>{un.target.src="https://placehold.co/150"}}):"",jsxRuntimeExports.jsx("span",{children:en.sceneSettings.textSettings.buildTabHeadingText})]}),(rn.color.length>0||rn.geometryVariants.length>0)&&jsxRuntimeExports.jsxs("div",{role:"button","aria-hidden":!_e||nn||Jt,tabIndex:_e&&!nn&&!Jt?0:-1,className:qt===1?"activeSideMenuTab rightTopBarButton button":"inactiveSideMenuTab rightTopBarButton button","aria-label":en.sceneSettings.textSettings.colorTabHeadingText+" Button",onClick:()=>{jt(1)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Color",src:Wt+"/thumbnails/common-ui/ColorTabIcon.svg",onError:un=>{un.target.src="https://placehold.co/150"}}):"",jsxRuntimeExports.jsx("span",{children:en.sceneSettings.textSettings.colorTabHeadingText})]}),Object.keys(Zt).length>0&&jsxRuntimeExports.jsxs("div",{role:"button","aria-label":en.sceneSettings.textSettings.featuresTabHeadingText+" Button","aria-hidden":!_e||nn||Jt,tabIndex:_e&&!nn&&!Jt?0:-1,className:qt===2?"activeSideMenuTab rightTopBarButton button":"inactiveSideMenuTab rightTopBarButton button",onClick:()=>{jt(2)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Features",src:Wt+"/thumbnails/common-ui/ProductFeaturesTabIcon.png",onError:un=>{un.target.src="https://placehold.co/150"}}):"",jsxRuntimeExports.jsx("span",{children:en.sceneSettings.textSettings.featuresTabHeadingText})]})]}),jsxRuntimeExports.jsxs("div",{className:"sideMenuContent",children:[jsxRuntimeExports.jsx(PreviewCart,{stores:kt}),jsxRuntimeExports.jsx(InfoModal,{stores:kt,visible:qt===0}),jsxRuntimeExports.jsx(BuildUI,{stores:kt,sideMenuOpen:!0,identifier:"buildUI-desktop",visible:qt===0}),jsxRuntimeExports.jsx("div",{className:"variantContainer",children:sn.map(un=>{if(un=="color"){if(rn.color.length>0)return jsxRuntimeExports.jsx(Color,{stores:kt,visible:qt===1},"colourTab-desktop")}else if(un=="geometryVariants"&&rn.geometryVariants.length>0)return jsxRuntimeExports.jsx(GeometryVariants,{stores:kt,visible:qt===1},"geometryVariantsTab-desktop")})}),jsxRuntimeExports.jsx(ProductFeaturesUI,{stores:kt,sideMenuOpen:!0,identifier:"featuresTab-desktop",visible:qt===2})]})]}),jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:nn?-1:0,"aria-hidden":nn,id:"preview-cart-button",className:"bottomBar right button","aria-label":"Toggle Preview Cart Button",onClick:()=>{Xt()},children:[jsxRuntimeExports.jsxs("div",{className:"bottomBarChildDiv",children:[jsxRuntimeExports.jsx("span",{children:en.sceneSettings.textSettings.reviewButtonText}),jsxRuntimeExports.jsx("div",{className:"cartNumber",children:Kt()})]}),jsxRuntimeExports.jsx("div",{className:"reviewButtonParentDiv",children:jsxRuntimeExports.jsx("div",{className:"button reviewButton".concat(Qt===!0?" hide":""),children:jsxRuntimeExports.jsxs("div",{className:"cartTotalText",children:[`${Yt}${numberWithCommas(kt.cartStore.getState().cartTotalPrice)}`,kt.cartStore.getState().cartTotalCompareAtPrice!=0&&kt.cartStore.getState().cartTotalCompareAtPrice>kt.cartStore.getState().cartTotalPrice&&jsxRuntimeExports.jsx("strike",{children:`${Yt}${numberWithCommas(kt.cartStore.getState().cartTotalCompareAtPrice)}`})]})})})]}),jsxRuntimeExports.jsx("div",{className:"reviewButtonSibling"})]})},PreviewCartMobile=({stores:kt,previewCartModalOpen:_e,togglePreviewCartModal:Dt,PUBLIC_DESIGN_ASSETS_ENDPOINT:Vt,cart:Gt})=>{const zt=kt.uiSceneStore(Xt=>Xt.disableCart),jt=kt.uiSceneStore(Xt=>Xt.CORE_API),Ht=kt.uiSceneStore(Xt=>Xt.cartMessage),Wt=kt.uiSceneStore(Xt=>Xt.isScreenPortrait),qt=reactExports.useCallback(async()=>{await jt.checkoutAsync()},[]);return jsxRuntimeExports.jsxs("div",{className:_e?"previewCartModal mobile open":"previewCartModal mobile",tabIndex:Wt?0:-1,"aria-hidden":!Wt,children:[jsxRuntimeExports.jsx("div",{className:"closeButton",role:"button",tabIndex:_e?0:-1,"aria-hidden":!_e,"aria-label":"Close Button",id:"preview-cart-close-button",onClick:()=>{Dt()},children:jsxRuntimeExports.jsx("img",{alt:"Close",src:Vt+"/Icon/X.svg",onError:Xt=>{Xt.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("h2",{className:"cartTitle",children:jt.sceneSettings.textSettings.cartHeadingText}),Gt.length>0?jsxRuntimeExports.jsxs("div",{className:"previewCartContentParentDiv",children:[jsxRuntimeExports.jsx("div",{className:"previewCartContent",children:Gt.map(function(Xt,Kt){return jsxRuntimeExports.jsx(CartItem,{stores:kt,itemObject:Xt,index:Kt},`Cart Item - ${Kt}`)})}),jsxRuntimeExports.jsxs("div",{className:"previewCartButtonContainer".concat(zt===!0?" hide":""),children:[Ht&&jsxRuntimeExports.jsx("div",{className:"cartMessageDiv",children:jsxRuntimeExports.jsx("span",{children:Ht})}),jsxRuntimeExports.jsxs("button",{className:"checkoutButton",role:"button",tabIndex:zt?-1:0,"aria-hidden":zt,"aria-label":"Click to checkout the cart",onClick:qt,children:[jsxRuntimeExports.jsx("span",{children:jt.sceneSettings.addToCartCTAText}),jsxRuntimeExports.jsx("img",{alt:"Right",src:Vt+"/Icon/ArrowRight.svg",onError:Xt=>{Xt.target.src="https://placehold.co/150"}})]})]})]}):jsxRuntimeExports.jsx("h3",{className:"cartEmptyText",children:"Your cart is currently empty"})]})},ContextMenuDesktop=({stores:kt,selectedItemData:_e,colors:Dt,colorsCategoryName:Vt})=>{const Gt=kt.uiSceneStore(en=>en.CORE_API),[zt,jt]=reactExports.useState(null),[Ht,Wt]=reactExports.useState(0),[qt,Xt]=reactExports.useState(0),[Kt,Yt]=reactExports.useState(null),Zt=reactExports.useRef(null),Jt=reactExports.useRef(null),nn=kt.uiSceneStore(en=>en.dialogPopupOpen),rn=kt.uiSceneStore(en=>en.isScreenPortrait),Qt=reactExports.useCallback(()=>{Gt.fireEvent(Gt.EVENTS.UI.ContextMenu_InfoBtnClicked,_e)},[_e]);return reactExports.useEffect(()=>{Yt(null),_e&&(Yt({..._e}),_e.overrideVariant?jt(_e.overrideVariant):jt(_e.currentVariant))},[_e]),reactExports.useEffect(()=>{if(!Kt||!Jt.current||!_e||!Zt.current)return;const en=Gt.getCanvasSize();let tn=_e.offsetX+Zt.current.children[0].clientWidth,sn=_e.offsetY+Zt.current.children[0].clientHeight,cn=en.width-tn;cn<0?Wt(_e.offsetX+cn-10):Wt(_e.offsetX);let un=en.height-sn;un<0?Xt(_e.offsetY+un-10):Xt(_e.offsetY),Jt.current.focus()},[Kt,_e,Zt]),jsxRuntimeExports.jsx("div",{ref:Zt,tabIndex:rn?-1:0,"aria-hidden":rn,children:_e!==null&&jsxRuntimeExports.jsx("div",{className:"contextMenuParent interactable",style:{left:Ht+"px",top:qt+"px"},children:jsxRuntimeExports.jsx("div",{className:"contextContentDiv",children:jsxRuntimeExports.jsxs("div",{className:"contextContent",children:[jsxRuntimeExports.jsxs("div",{className:"contextContentChildDiv",children:[jsxRuntimeExports.jsxs("div",{className:"contextNameContent",children:[jsxRuntimeExports.jsx("h3",{children:_e.itemData.name}),jsxRuntimeExports.jsx("img",{ref:Jt,role:"button","aria-hidden":nn,tabIndex:nn?-1:0,className:"infoButton",alt:"Info","aria-label":"Info",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Info.svg",onClick:()=>Qt(),onError:en=>{en.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{role:"button",tabIndex:nn?-1:0,"aria-hidden":nn,"aria-label":"Close",className:"closeContainer closeButton",onClick:()=>Gt.exitSelectedItem(),children:jsxRuntimeExports.jsx("img",{alt:"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg",onError:en=>{en.target.src="https://placehold.co/150"}})})]}),Dt.length>0&&Gt.sceneSettings.disableLocalColorOverride===!1&&jsxRuntimeExports.jsxs("div",{className:"contextColorContent",children:[jsxRuntimeExports.jsxs("span",{className:"colorSwatchTitle",children:["Select ",Vt]}),jsxRuntimeExports.jsx("div",{className:"color-grid color-variants-selection",children:Dt.map((en,tn)=>jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:nn?-1:0,"aria-hidden":nn,"aria-label":"Select "+en.label,onClick:async()=>{await Gt.overrideSelectedItemMaterial(en.id),jt(en.id)},className:zt==en.id?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Checkmark",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:sn=>{sn.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:en.label,className:"contextColorThumbnail",src:Gt.getResolvedAssetUrl(en.thumbnail),onError:sn=>{sn.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsxs("p",{className:"truncate colorDetailsLabel",children:[capitalize$1(en.label),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"redText",children:en.outOfStock?"OUT OF STOCK":jsxRuntimeExports.jsx("br",{})})]})})]},"Color-"+tn))})]}),jsxRuntimeExports.jsxs("div",{className:"contextButtons",children:[Gt.canSelectedItemDrag()&&jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:nn?-1:0,"aria-hidden":nn,"aria-label":"Remove Button",onClick:()=>{Gt.doesSelectedItemHasAttachedDependency()?Gt.triggerItemRemoveModal(_e.itemData.guid):Gt.removeSelectedItem()},children:[jsxRuntimeExports.jsx("img",{src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/TrashSimple.svg",alt:"Remove",onError:en=>{en.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:"Remove"})]}),Gt.canSelectedItemRotate()&&jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Rotate Button",tabIndex:nn?-1:0,"aria-hidden":nn,onClick:()=>Gt.rotateSelectedItem(),children:[jsxRuntimeExports.jsx("img",{alt:"Rotate",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Rotate.svg",onError:en=>{en.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:"Rotate"})]})]})]})})})})},ContextMenuMobile=({stores:kt,selectedItemData:_e,contextMenuDrawerOpen:Dt,dismissContextMenuDrawer:Vt,colors:Gt,colorsCategoryName:zt})=>{const[jt,Ht]=reactExports.useState(Dt),Wt=reactExports.useRef(null),qt=kt.uiSceneStore(Jt=>Jt.CORE_API),Xt=kt.uiSceneStore(Jt=>Jt.isScreenPortrait),[Kt,Yt]=reactExports.useState(null);reactExports.useEffect(()=>{Wt.current&&Wt.current.addEventListener("drawerClosed",()=>{Vt()})},[Wt]),reactExports.useEffect(()=>(Ht(Dt),()=>{}),[Dt]),reactExports.useEffect(()=>{qt.isMobile&&kt.uiSceneStore.setState({dialogPopupOpen:jt})},[jt]),reactExports.useEffect(()=>{!_e||!_e.itemData||(_e.overrideVariant?Yt(_e.overrideVariant):Yt(_e.currentVariant))},[_e]);async function Zt(){qt.doesSelectedItemHasAttachedDependency()?qt.triggerItemRemoveModal(_e.itemData.guid):(await qt.removeSelectedItem(),Vt())}return jsxRuntimeExports.jsx(BottomDrawer,{stores:kt,id:"contextDrawer",ref:Wt,open:`${jt}`,"initial-screen-coverage":"60%",children:jsxRuntimeExports.jsx("div",{className:"contextMenuDrawer epigraphDrawer",slot:"bottom-drawer-content",tabIndex:Xt?0:-1,"aria-hidden":!Xt,children:jsxRuntimeExports.jsxs("div",{className:"contextMenuParent interactable",children:[jsxRuntimeExports.jsx("div",{className:"contextContent",children:_e&&_e.itemData?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{className:"contextContentNameDiv",children:jsxRuntimeExports.jsx("h3",{children:_e.itemData.name})})}):""}),Gt.length>0&&qt.sceneSettings.disableLocalColorOverride===!1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("p",{className:"colorSwatchTitle",children:["Select ",zt]}),jsxRuntimeExports.jsx("div",{className:"color-grid color-variants-selection",children:Gt.map((Jt,nn)=>jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Select "+Jt.label,tabIndex:jt?0:-1,"aria-hidden":!jt,onClick:async()=>{await kt.uiSceneStore.getState().CORE_API.overrideSelectedItemMaterial(Jt.id),Yt(Jt.id)},className:Kt==Jt.id?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsxs("div",{className:"colorThumbnailContainer",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnail",children:jsxRuntimeExports.jsx("img",{alt:Jt.label,className:"colorThumbnailImg",src:qt.getResolvedAssetUrl(Jt.thumbnail),onError:rn=>{rn.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:rn=>{rn.target.src="https://placehold.co/150"}})})]}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsxs("p",{className:"truncate colorDetailsLabel",children:[capitalize$1(Jt.label),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"redText",children:Jt.outOfStock?"OUT OF STOCK":jsxRuntimeExports.jsx("br",{})})]})})]},"Color-"+nn))})]}),jsxRuntimeExports.jsxs("div",{className:"contextButtons",children:[qt.canSelectedItemBeRemoved()&&jsxRuntimeExports.jsxs("button",{role:"button",tabIndex:jt?0:-1,"aria-hidden":!jt,"aria-label":"Remove Button",onClick:()=>Zt(),children:[jsxRuntimeExports.jsx("img",{alt:"Remove",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Trash.svg",onError:Jt=>{Jt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:"Remove"})]}),qt.canSelectedItemRotate()&&jsxRuntimeExports.jsxs("button",{role:"button",tabIndex:jt?0:-1,"aria-hidden":!jt,"aria-label":"Rotate Button",onClick:()=>qt.rotateSelectedItem(),children:[jsxRuntimeExports.jsx("img",{alt:"Rotate",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Rotate.svg",onError:Jt=>{Jt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:"Rotate"})]})]})]})})})},ContextMenu=({stores:kt,selectedItemData:_e,contextMenuOpen:Dt,dismissContextMenuDrawer:Vt})=>{const Gt=kt.uiSceneStore(Zt=>Zt.CORE_API),[zt,jt]=reactExports.useState(!1),[Ht,Wt]=reactExports.useState([]),[qt,Xt]=reactExports.useState(""),Kt=kt.uiSceneStore(Zt=>Zt.inventoryData);reactExports.useEffect(()=>(jt(Dt),()=>{}),[Dt]),reactExports.useEffect(()=>{if(Wt([]),_e===void 0||!_e.itemData||Gt===null)return;const Zt=Gt.getSelectedItemColors(),Jt=Gt.getInventoryInfo()[_e.itemData.skuID];if(Zt.map(rn=>{rn.outOfStock=!1,Jt[rn.id].countAvailable==0&&(rn.outOfStock=!0)}),Wt(Zt),Zt.length===0)return;const nn=Gt.categoryData;nn.color&&nn.color.map(rn=>{rn.looks.map(Qt=>{Qt===Zt[0].id&&Xt(rn.label)})})},[_e]),reactExports.useEffect(()=>{Kt!=null&&Yt(Kt)},[Kt]);const Yt=reactExports.useCallback(Zt=>{const Jt=Gt.getSelectedItemData();if(Jt==null)return;const nn=Gt.getSelectedItemColors(),rn=Zt[Jt.itemData.skuID];nn.map(Qt=>{Qt.outOfStock=!1,rn[Qt.id].countAvailable==0&&(Qt.outOfStock=!0)}),Wt(nn)},[_e]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Gt.isMobile&&window.innerWidth<=768?jsxRuntimeExports.jsx(ContextMenuMobile,{stores:kt,selectedItemData:_e,contextMenuDrawerOpen:zt,dismissContextMenuDrawer:Vt,colors:Ht,colorsCategoryName:qt}):zt&&jsxRuntimeExports.jsx(ContextMenuDesktop,{stores:kt,contextMenuDesktopOpen:zt,selectedItemData:_e,colors:Ht,colorsCategoryName:qt})})},FullScreenModal=reactExports.forwardRef((kt,_e)=>{const Dt=reactExports.useRef(null),Vt=reactExports.useRef(null);reactExports.useEffect(()=>{_e.current&&Vt.current&&Dt.current&&(_e.current.show=Ht=>zt(),_e.current.hide=Ht=>jt(),_e.current.mainContainer=Dt.current,_e.current.closeButton=Vt.current,Gt())},[_e,Vt,Dt]);const Gt=()=>{Vt.current.addEventListener("click",()=>{kt.onExit&&kt.onExit(),jt()})},zt=()=>{Dt.current.classList.add("show"),kt.stores.uiSceneStore.setState({dialogPopupOpen:!0}),Vt.current.focus()},jt=()=>{kt.stores.uiSceneStore.setState({dialogPopupOpen:!1}),Dt.current.classList.remove("show")};return jsxRuntimeExports.jsx("div",{id:kt.id,ref:_e,className:kt.className,children:jsxRuntimeExports.jsx("div",{"aria-hidden":!kt.open,ref:Dt,className:"full-screen-modal-container",children:jsxRuntimeExports.jsxs("div",{className:"modal-content-container",children:[jsxRuntimeExports.jsx("div",{role:"button","aria-hidden":!kt.open,"aria-label":"Close Button",tabIndex:kt.open?0:-1,ref:Vt,className:"close-button",children:jsxRuntimeExports.jsx("img",{alt:"Close",src:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/X.svg",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("slot",{name:"full-screen-dialog-content",children:kt.children})]})})})});var lottie$1={exports:{}};(function(module,exports){typeof navigator<"u"&&function(kt,_e){module.exports=_e()}(commonjsGlobal,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(_e){_useWebWorker=!!_e},getWebWorker=function(){return _useWebWorker},setLocationHref=function(_e){locationHref=_e},getLocationHref=function(){return locationHref};function createTag(kt){return document.createElement(kt)}function extendPrototype(kt,_e){var Dt,Vt=kt.length,Gt;for(Dt=0;Dt<Vt;Dt+=1){Gt=kt[Dt].prototype;for(var zt in Gt)Object.prototype.hasOwnProperty.call(Gt,zt)&&(_e.prototype[zt]=Gt[zt])}}function getDescriptor(kt,_e){return Object.getOwnPropertyDescriptor(kt,_e)}function createProxyFunction(kt){function _e(){}return _e.prototype=kt,_e}var audioControllerFactory=function(){function kt(_e){this.audios=[],this.audioFactory=_e,this._volume=1,this._isMuted=!1}return kt.prototype={addAudio:function(Dt){this.audios.push(Dt)},pause:function(){var Dt,Vt=this.audios.length;for(Dt=0;Dt<Vt;Dt+=1)this.audios[Dt].pause()},resume:function(){var Dt,Vt=this.audios.length;for(Dt=0;Dt<Vt;Dt+=1)this.audios[Dt].resume()},setRate:function(Dt){var Vt,Gt=this.audios.length;for(Vt=0;Vt<Gt;Vt+=1)this.audios[Vt].setRate(Dt)},createAudio:function(Dt){return this.audioFactory?this.audioFactory(Dt):window.Howl?new window.Howl({src:[Dt]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(Dt){this.audioFactory=Dt},setVolume:function(Dt){this._volume=Dt,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var Dt,Vt=this.audios.length;for(Dt=0;Dt<Vt;Dt+=1)this.audios[Dt].volume(this._volume*(this._isMuted?0:1))}},function(){return new kt}}(),createTypedArray=function(){function kt(Dt,Vt){var Gt=0,zt=[],jt;switch(Dt){case"int16":case"uint8c":jt=1;break;default:jt=1.1;break}for(Gt=0;Gt<Vt;Gt+=1)zt.push(jt);return zt}function _e(Dt,Vt){return Dt==="float32"?new Float32Array(Vt):Dt==="int16"?new Int16Array(Vt):Dt==="uint8c"?new Uint8ClampedArray(Vt):kt(Dt,Vt)}return typeof Uint8ClampedArray=="function"&&typeof Float32Array=="function"?_e:kt}();function createSizedArray(kt){return Array.apply(null,{length:kt})}function _typeof$6(kt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$6=function(Dt){return typeof Dt}:_typeof$6=function(Dt){return Dt&&typeof Symbol=="function"&&Dt.constructor===Symbol&&Dt!==Symbol.prototype?"symbol":typeof Dt},_typeof$6(kt)}var subframeEnabled=!0,expressionsPlugin=null,expressionsInterfaces=null,idPrefix$1="",isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),bmPow=Math.pow,bmSqrt=Math.sqrt,bmFloor=Math.floor,bmMax=Math.max,bmMin=Math.min,BMMath={};(function(){var kt=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],_e,Dt=kt.length;for(_e=0;_e<Dt;_e+=1)BMMath[kt[_e]]=Math[kt[_e]]})(),BMMath.random=Math.random,BMMath.abs=function(kt){var _e=_typeof$6(kt);if(_e==="object"&&kt.length){var Dt=createSizedArray(kt.length),Vt,Gt=kt.length;for(Vt=0;Vt<Gt;Vt+=1)Dt[Vt]=Math.abs(kt[Vt]);return Dt}return Math.abs(kt)};var defaultCurveSegments=150,degToRads=Math.PI/180,roundCorner=.5519;function styleDiv(kt){kt.style.position="absolute",kt.style.top=0,kt.style.left=0,kt.style.display="block",kt.style.transformOrigin="0 0",kt.style.webkitTransformOrigin="0 0",kt.style.backfaceVisibility="visible",kt.style.webkitBackfaceVisibility="visible",kt.style.transformStyle="preserve-3d",kt.style.webkitTransformStyle="preserve-3d",kt.style.mozTransformStyle="preserve-3d"}function BMEnterFrameEvent(kt,_e,Dt,Vt){this.type=kt,this.currentTime=_e,this.totalTime=Dt,this.direction=Vt<0?-1:1}function BMCompleteEvent(kt,_e){this.type=kt,this.direction=_e<0?-1:1}function BMCompleteLoopEvent(kt,_e,Dt,Vt){this.type=kt,this.currentLoop=Dt,this.totalLoops=_e,this.direction=Vt<0?-1:1}function BMSegmentStartEvent(kt,_e,Dt){this.type=kt,this.firstFrame=_e,this.totalFrames=Dt}function BMDestroyEvent(kt,_e){this.type=kt,this.target=_e}function BMRenderFrameErrorEvent(kt,_e){this.type="renderFrameError",this.nativeError=kt,this.currentTime=_e}function BMConfigErrorEvent(kt){this.type="configError",this.nativeError=kt}var createElementID=function(){var kt=0;return function(){return kt+=1,idPrefix$1+"__lottie_element_"+kt}}();function HSVtoRGB(kt,_e,Dt){var Vt,Gt,zt,jt,Ht,Wt,qt,Xt;switch(jt=Math.floor(kt*6),Ht=kt*6-jt,Wt=Dt*(1-_e),qt=Dt*(1-Ht*_e),Xt=Dt*(1-(1-Ht)*_e),jt%6){case 0:Vt=Dt,Gt=Xt,zt=Wt;break;case 1:Vt=qt,Gt=Dt,zt=Wt;break;case 2:Vt=Wt,Gt=Dt,zt=Xt;break;case 3:Vt=Wt,Gt=qt,zt=Dt;break;case 4:Vt=Xt,Gt=Wt,zt=Dt;break;case 5:Vt=Dt,Gt=Wt,zt=qt;break}return[Vt,Gt,zt]}function RGBtoHSV(kt,_e,Dt){var Vt=Math.max(kt,_e,Dt),Gt=Math.min(kt,_e,Dt),zt=Vt-Gt,jt,Ht=Vt===0?0:zt/Vt,Wt=Vt/255;switch(Vt){case Gt:jt=0;break;case kt:jt=_e-Dt+zt*(_e<Dt?6:0),jt/=6*zt;break;case _e:jt=Dt-kt+zt*2,jt/=6*zt;break;case Dt:jt=kt-_e+zt*4,jt/=6*zt;break}return[jt,Ht,Wt]}function addSaturationToRGB(kt,_e){var Dt=RGBtoHSV(kt[0]*255,kt[1]*255,kt[2]*255);return Dt[1]+=_e,Dt[1]>1?Dt[1]=1:Dt[1]<=0&&(Dt[1]=0),HSVtoRGB(Dt[0],Dt[1],Dt[2])}function addBrightnessToRGB(kt,_e){var Dt=RGBtoHSV(kt[0]*255,kt[1]*255,kt[2]*255);return Dt[2]+=_e,Dt[2]>1?Dt[2]=1:Dt[2]<0&&(Dt[2]=0),HSVtoRGB(Dt[0],Dt[1],Dt[2])}function addHueToRGB(kt,_e){var Dt=RGBtoHSV(kt[0]*255,kt[1]*255,kt[2]*255);return Dt[0]+=_e/360,Dt[0]>1?Dt[0]-=1:Dt[0]<0&&(Dt[0]+=1),HSVtoRGB(Dt[0],Dt[1],Dt[2])}var rgbToHex=function(){var kt=[],_e,Dt;for(_e=0;_e<256;_e+=1)Dt=_e.toString(16),kt[_e]=Dt.length===1?"0"+Dt:Dt;return function(Vt,Gt,zt){return Vt<0&&(Vt=0),Gt<0&&(Gt=0),zt<0&&(zt=0),"#"+kt[Vt]+kt[Gt]+kt[zt]}}(),setSubframeEnabled=function(_e){subframeEnabled=!!_e},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(_e){expressionsPlugin=_e},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(_e){expressionsInterfaces=_e},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(_e){defaultCurveSegments=_e},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(_e){idPrefix$1=_e};function createNS(kt){return document.createElementNS(svgNS,kt)}function _typeof$5(kt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function(Dt){return typeof Dt}:_typeof$5=function(Dt){return Dt&&typeof Symbol=="function"&&Dt.constructor===Symbol&&Dt!==Symbol.prototype?"symbol":typeof Dt},_typeof$5(kt)}var dataManager=function(){var kt=1,_e=[],Dt,Vt,Gt={onmessage:function(){},postMessage:function(Zt){Dt({data:Zt})}},zt={postMessage:function(Zt){Gt.onmessage({data:Zt})}};function jt(Yt){if(window.Worker&&window.Blob&&getWebWorker()){var Zt=new Blob(["var _workerSelf = self; self.onmessage = ",Yt.toString()],{type:"text/javascript"}),Jt=URL.createObjectURL(Zt);return new Worker(Jt)}return Dt=Yt,Gt}function Ht(){Vt||(Vt=jt(function(Zt){function Jt(){function rn(An,Tn){var Cn,yn,Sn=An.length,wn,xn,Rn,Ln;for(yn=0;yn<Sn;yn+=1)if(Cn=An[yn],"ks"in Cn&&!Cn.completed){if(Cn.completed=!0,Cn.hasMask){var Nn=Cn.masksProperties;for(xn=Nn.length,wn=0;wn<xn;wn+=1)if(Nn[wn].pt.k.i)cn(Nn[wn].pt.k);else for(Ln=Nn[wn].pt.k.length,Rn=0;Rn<Ln;Rn+=1)Nn[wn].pt.k[Rn].s&&cn(Nn[wn].pt.k[Rn].s[0]),Nn[wn].pt.k[Rn].e&&cn(Nn[wn].pt.k[Rn].e[0])}Cn.ty===0?(Cn.layers=tn(Cn.refId,Tn),rn(Cn.layers,Tn)):Cn.ty===4?sn(Cn.shapes):Cn.ty===5&&_n(Cn)}}function Qt(An,Tn){if(An){var Cn=0,yn=An.length;for(Cn=0;Cn<yn;Cn+=1)An[Cn].t===1&&(An[Cn].data.layers=tn(An[Cn].data.refId,Tn),rn(An[Cn].data.layers,Tn))}}function en(An,Tn){for(var Cn=0,yn=Tn.length;Cn<yn;){if(Tn[Cn].id===An)return Tn[Cn];Cn+=1}return null}function tn(An,Tn){var Cn=en(An,Tn);return Cn?Cn.layers.__used?JSON.parse(JSON.stringify(Cn.layers)):(Cn.layers.__used=!0,Cn.layers):null}function sn(An){var Tn,Cn=An.length,yn,Sn;for(Tn=Cn-1;Tn>=0;Tn-=1)if(An[Tn].ty==="sh")if(An[Tn].ks.k.i)cn(An[Tn].ks.k);else for(Sn=An[Tn].ks.k.length,yn=0;yn<Sn;yn+=1)An[Tn].ks.k[yn].s&&cn(An[Tn].ks.k[yn].s[0]),An[Tn].ks.k[yn].e&&cn(An[Tn].ks.k[yn].e[0]);else An[Tn].ty==="gr"&&sn(An[Tn].it)}function cn(An){var Tn,Cn=An.i.length;for(Tn=0;Tn<Cn;Tn+=1)An.i[Tn][0]+=An.v[Tn][0],An.i[Tn][1]+=An.v[Tn][1],An.o[Tn][0]+=An.v[Tn][0],An.o[Tn][1]+=An.v[Tn][1]}function un(An,Tn){var Cn=Tn?Tn.split("."):[100,100,100];return An[0]>Cn[0]?!0:Cn[0]>An[0]?!1:An[1]>Cn[1]?!0:Cn[1]>An[1]?!1:An[2]>Cn[2]?!0:Cn[2]>An[2]?!1:null}var hn=function(){var An=[4,4,14];function Tn(yn){var Sn=yn.t.d;yn.t.d={k:[{s:Sn,t:0}]}}function Cn(yn){var Sn,wn=yn.length;for(Sn=0;Sn<wn;Sn+=1)yn[Sn].ty===5&&Tn(yn[Sn])}return function(yn){if(un(An,yn.v)&&(Cn(yn.layers),yn.assets)){var Sn,wn=yn.assets.length;for(Sn=0;Sn<wn;Sn+=1)yn.assets[Sn].layers&&Cn(yn.assets[Sn].layers)}}}(),fn=function(){var An=[4,7,99];return function(Tn){if(Tn.chars&&!un(An,Tn.v)){var Cn,yn=Tn.chars.length;for(Cn=0;Cn<yn;Cn+=1){var Sn=Tn.chars[Cn];Sn.data&&Sn.data.shapes&&(sn(Sn.data.shapes),Sn.data.ip=0,Sn.data.op=99999,Sn.data.st=0,Sn.data.sr=1,Sn.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},Tn.chars[Cn].t||(Sn.data.shapes.push({ty:"no"}),Sn.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}}(),pn=function(){var An=[5,7,15];function Tn(yn){var Sn=yn.t.p;typeof Sn.a=="number"&&(Sn.a={a:0,k:Sn.a}),typeof Sn.p=="number"&&(Sn.p={a:0,k:Sn.p}),typeof Sn.r=="number"&&(Sn.r={a:0,k:Sn.r})}function Cn(yn){var Sn,wn=yn.length;for(Sn=0;Sn<wn;Sn+=1)yn[Sn].ty===5&&Tn(yn[Sn])}return function(yn){if(un(An,yn.v)&&(Cn(yn.layers),yn.assets)){var Sn,wn=yn.assets.length;for(Sn=0;Sn<wn;Sn+=1)yn.assets[Sn].layers&&Cn(yn.assets[Sn].layers)}}}(),dn=function(){var An=[4,1,9];function Tn(yn){var Sn,wn=yn.length,xn,Rn;for(Sn=0;Sn<wn;Sn+=1)if(yn[Sn].ty==="gr")Tn(yn[Sn].it);else if(yn[Sn].ty==="fl"||yn[Sn].ty==="st")if(yn[Sn].c.k&&yn[Sn].c.k[0].i)for(Rn=yn[Sn].c.k.length,xn=0;xn<Rn;xn+=1)yn[Sn].c.k[xn].s&&(yn[Sn].c.k[xn].s[0]/=255,yn[Sn].c.k[xn].s[1]/=255,yn[Sn].c.k[xn].s[2]/=255,yn[Sn].c.k[xn].s[3]/=255),yn[Sn].c.k[xn].e&&(yn[Sn].c.k[xn].e[0]/=255,yn[Sn].c.k[xn].e[1]/=255,yn[Sn].c.k[xn].e[2]/=255,yn[Sn].c.k[xn].e[3]/=255);else yn[Sn].c.k[0]/=255,yn[Sn].c.k[1]/=255,yn[Sn].c.k[2]/=255,yn[Sn].c.k[3]/=255}function Cn(yn){var Sn,wn=yn.length;for(Sn=0;Sn<wn;Sn+=1)yn[Sn].ty===4&&Tn(yn[Sn].shapes)}return function(yn){if(un(An,yn.v)&&(Cn(yn.layers),yn.assets)){var Sn,wn=yn.assets.length;for(Sn=0;Sn<wn;Sn+=1)yn.assets[Sn].layers&&Cn(yn.assets[Sn].layers)}}}(),mn=function(){var An=[4,4,18];function Tn(yn){var Sn,wn=yn.length,xn,Rn;for(Sn=wn-1;Sn>=0;Sn-=1)if(yn[Sn].ty==="sh")if(yn[Sn].ks.k.i)yn[Sn].ks.k.c=yn[Sn].closed;else for(Rn=yn[Sn].ks.k.length,xn=0;xn<Rn;xn+=1)yn[Sn].ks.k[xn].s&&(yn[Sn].ks.k[xn].s[0].c=yn[Sn].closed),yn[Sn].ks.k[xn].e&&(yn[Sn].ks.k[xn].e[0].c=yn[Sn].closed);else yn[Sn].ty==="gr"&&Tn(yn[Sn].it)}function Cn(yn){var Sn,wn,xn=yn.length,Rn,Ln,Nn,Fn;for(wn=0;wn<xn;wn+=1){if(Sn=yn[wn],Sn.hasMask){var Pn=Sn.masksProperties;for(Ln=Pn.length,Rn=0;Rn<Ln;Rn+=1)if(Pn[Rn].pt.k.i)Pn[Rn].pt.k.c=Pn[Rn].cl;else for(Fn=Pn[Rn].pt.k.length,Nn=0;Nn<Fn;Nn+=1)Pn[Rn].pt.k[Nn].s&&(Pn[Rn].pt.k[Nn].s[0].c=Pn[Rn].cl),Pn[Rn].pt.k[Nn].e&&(Pn[Rn].pt.k[Nn].e[0].c=Pn[Rn].cl)}Sn.ty===4&&Tn(Sn.shapes)}}return function(yn){if(un(An,yn.v)&&(Cn(yn.layers),yn.assets)){var Sn,wn=yn.assets.length;for(Sn=0;Sn<wn;Sn+=1)yn.assets[Sn].layers&&Cn(yn.assets[Sn].layers)}}}();function vn(An){An.__complete||(dn(An),hn(An),fn(An),pn(An),mn(An),rn(An.layers,An.assets),Qt(An.chars,An.assets),An.__complete=!0)}function _n(An){An.t.a.length===0&&"m"in An.t.p}var En={};return En.completeData=vn,En.checkColors=dn,En.checkChars=fn,En.checkPathProperties=pn,En.checkShapes=mn,En.completeLayers=rn,En}if(zt.dataManager||(zt.dataManager=Jt()),zt.assetLoader||(zt.assetLoader=function(){function rn(en){var tn=en.getResponseHeader("content-type");return tn&&en.responseType==="json"&&tn.indexOf("json")!==-1||en.response&&_typeof$5(en.response)==="object"?en.response:en.response&&typeof en.response=="string"?JSON.parse(en.response):en.responseText?JSON.parse(en.responseText):null}function Qt(en,tn,sn,cn){var un,hn=new XMLHttpRequest;try{hn.responseType="json"}catch{}hn.onreadystatechange=function(){if(hn.readyState===4)if(hn.status===200)un=rn(hn),sn(un);else try{un=rn(hn),sn(un)}catch(fn){cn&&cn(fn)}};try{hn.open(["G","E","T"].join(""),en,!0)}catch{hn.open(["G","E","T"].join(""),tn+"/"+en,!0)}hn.send()}return{load:Qt}}()),Zt.data.type==="loadAnimation")zt.assetLoader.load(Zt.data.path,Zt.data.fullPath,function(rn){zt.dataManager.completeData(rn),zt.postMessage({id:Zt.data.id,payload:rn,status:"success"})},function(){zt.postMessage({id:Zt.data.id,status:"error"})});else if(Zt.data.type==="complete"){var nn=Zt.data.animation;zt.dataManager.completeData(nn),zt.postMessage({id:Zt.data.id,payload:nn,status:"success"})}else Zt.data.type==="loadData"&&zt.assetLoader.load(Zt.data.path,Zt.data.fullPath,function(rn){zt.postMessage({id:Zt.data.id,payload:rn,status:"success"})},function(){zt.postMessage({id:Zt.data.id,status:"error"})})}),Vt.onmessage=function(Yt){var Zt=Yt.data,Jt=Zt.id,nn=_e[Jt];_e[Jt]=null,Zt.status==="success"?nn.onComplete(Zt.payload):nn.onError&&nn.onError()})}function Wt(Yt,Zt){kt+=1;var Jt="processId_"+kt;return _e[Jt]={onComplete:Yt,onError:Zt},Jt}function qt(Yt,Zt,Jt){Ht();var nn=Wt(Zt,Jt);Vt.postMessage({type:"loadAnimation",path:Yt,fullPath:window.location.origin+window.location.pathname,id:nn})}function Xt(Yt,Zt,Jt){Ht();var nn=Wt(Zt,Jt);Vt.postMessage({type:"loadData",path:Yt,fullPath:window.location.origin+window.location.pathname,id:nn})}function Kt(Yt,Zt,Jt){Ht();var nn=Wt(Zt,Jt);Vt.postMessage({type:"complete",animation:Yt,id:nn})}return{loadAnimation:qt,loadData:Xt,completeAnimation:Kt}}(),ImagePreloader=function(){var kt=function(){var Qt=createTag("canvas");Qt.width=1,Qt.height=1;var en=Qt.getContext("2d");return en.fillStyle="rgba(0,0,0,0)",en.fillRect(0,0,1,1),Qt}();function _e(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function Dt(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function Vt(Qt,en,tn){var sn="";if(Qt.e)sn=Qt.p;else if(en){var cn=Qt.p;cn.indexOf("images/")!==-1&&(cn=cn.split("/")[1]),sn=en+cn}else sn=tn,sn+=Qt.u?Qt.u:"",sn+=Qt.p;return sn}function Gt(Qt){var en=0,tn=setInterval(function(){var sn=Qt.getBBox();(sn.width||en>500)&&(this._imageLoaded(),clearInterval(tn)),en+=1}.bind(this),50)}function zt(Qt){var en=Vt(Qt,this.assetsPath,this.path),tn=createNS("image");isSafari?this.testImageLoaded(tn):tn.addEventListener("load",this._imageLoaded,!1),tn.addEventListener("error",function(){sn.img=kt,this._imageLoaded()}.bind(this),!1),tn.setAttributeNS("http://www.w3.org/1999/xlink","href",en),this._elementHelper.append?this._elementHelper.append(tn):this._elementHelper.appendChild(tn);var sn={img:tn,assetData:Qt};return sn}function jt(Qt){var en=Vt(Qt,this.assetsPath,this.path),tn=createTag("img");tn.crossOrigin="anonymous",tn.addEventListener("load",this._imageLoaded,!1),tn.addEventListener("error",function(){sn.img=kt,this._imageLoaded()}.bind(this),!1),tn.src=en;var sn={img:tn,assetData:Qt};return sn}function Ht(Qt){var en={assetData:Qt},tn=Vt(Qt,this.assetsPath,this.path);return dataManager.loadData(tn,function(sn){en.img=sn,this._footageLoaded()}.bind(this),function(){en.img={},this._footageLoaded()}.bind(this)),en}function Wt(Qt,en){this.imagesLoadedCb=en;var tn,sn=Qt.length;for(tn=0;tn<sn;tn+=1)Qt[tn].layers||(!Qt[tn].t||Qt[tn].t==="seq"?(this.totalImages+=1,this.images.push(this._createImageData(Qt[tn]))):Qt[tn].t===3&&(this.totalFootages+=1,this.images.push(this.createFootageData(Qt[tn]))))}function qt(Qt){this.path=Qt||""}function Xt(Qt){this.assetsPath=Qt||""}function Kt(Qt){for(var en=0,tn=this.images.length;en<tn;){if(this.images[en].assetData===Qt)return this.images[en].img;en+=1}return null}function Yt(){this.imagesLoadedCb=null,this.images.length=0}function Zt(){return this.totalImages===this.loadedAssets}function Jt(){return this.totalFootages===this.loadedFootagesCount}function nn(Qt,en){Qt==="svg"?(this._elementHelper=en,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}function rn(){this._imageLoaded=_e.bind(this),this._footageLoaded=Dt.bind(this),this.testImageLoaded=Gt.bind(this),this.createFootageData=Ht.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return rn.prototype={loadAssets:Wt,setAssetsPath:Xt,setPath:qt,loadedImages:Zt,loadedFootages:Jt,destroy:Yt,getAsset:Kt,createImgData:jt,createImageData:zt,imageLoaded:_e,footageLoaded:Dt,setCacheType:nn},rn}();function BaseEvent(){}BaseEvent.prototype={triggerEvent:function(_e,Dt){if(this._cbs[_e])for(var Vt=this._cbs[_e],Gt=0;Gt<Vt.length;Gt+=1)Vt[Gt](Dt)},addEventListener:function(_e,Dt){return this._cbs[_e]||(this._cbs[_e]=[]),this._cbs[_e].push(Dt),function(){this.removeEventListener(_e,Dt)}.bind(this)},removeEventListener:function(_e,Dt){if(!Dt)this._cbs[_e]=null;else if(this._cbs[_e]){for(var Vt=0,Gt=this._cbs[_e].length;Vt<Gt;)this._cbs[_e][Vt]===Dt&&(this._cbs[_e].splice(Vt,1),Vt-=1,Gt-=1),Vt+=1;this._cbs[_e].length||(this._cbs[_e]=null)}}};var markerParser=function(){function kt(_e){for(var Dt=_e.split(`\r
|
|
3941
|
+
`;wn(In)},[Sn]),ur=reactExports.useCallback(()=>{qt.isMobile!==!0&&Ln!==!0&&(Nn(!0),!(!kt.uiSceneStore.getState().CORE_API.sceneSettings.clickToAddUi&&!hn)&&(xn===!0?(wn(null),Dt(Ht)):zn()))},[xn,Ln,Sn]),Wn=reactExports.useCallback(()=>{qt.isMobile===!0||(Nn(!1),!kt.uiSceneStore.getState().CORE_API.sceneSettings.clickToAddUi&&!hn)||kt.coreSceneStore.getState().mouseDragging||xn===!0&&zt&&zt()},[xn,Ln]),or=reactExports.useCallback(fr=>{xn!==!1&&(fr.defaultPrevented===!0&&fr.preventDefault(),fr.stopPropagation(),kt.coreSceneStore.setState({pointerDownPos:fr.touches&&fr.touches.length>0?fr.touches[0].clientX-kt.wcRef.offsetLeft:fr.clientX,mouseDragging:!1,mouseDownImgSrc:qt.getResolvedAssetUrl(An),mouseDownSkuID:Ht,moveThreshold:10}))},[xn,An,Cn]),gr=reactExports.useCallback(fr=>{const Un=pn.lookDetails[rn];Un.skuID=Ht,Un.productCategory={id:pn.categoryID,label:pn.categoryLabel},qt.isMobile===!0?(Yt(Un),nn(!0)):(fr.stopPropagation(),xn&&zt&&zt(),Yt(Un),nn(!0))},[xn,rn,pn]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("nav",{role:"none",className:Wt?"imageContainer active":"imageContainer",draggable:!1,children:[hn?jsxRuntimeExports.jsxs("div",{className:"incrementContentContainer",children:[jsxRuntimeExports.jsx("div",{id:"itemCard"+Ht,className:"incrementContentOverlay ".concat(`${(xn===!0||Fn>0)&&Ln===!0?"enabled-item-overlay":"disabled-item-overlay"}`),ref:Kt}),jsxRuntimeExports.jsx("img",{alt:mn,className:"incrementSkuIcon",tabIndex:-1,"aria-hidden":!0,src:qt.getResolvedAssetUrl(An),onError:fr=>{fr.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsxs("div",{className:"incrementDecrementPanel",children:[jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Decrement Button","aria-hidden":!_e||Fn==0||Zt||Xt||Jt||!Vt||!xn,tabIndex:_e&&Fn!==0&&!Zt&&!Xt&&!Jt&&Vt==!0&&xn?0:-1,className:"incrementMinusSign ".concat(`${Fn===0?"incrementSignDisable":""}`),onClick:Bn,onMouseEnter:fr=>Nn(!0),onMouseLeave:fr=>Nn(!1),children:jsxRuntimeExports.jsx("img",{alt:"Decrement",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Minus.svg",onError:fr=>{fr.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("div",{className:"incrementCount",children:Fn}),jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Increment","aria-hidden":!_e||Zt||Xt||Jt||!Vt||!xn,tabIndex:_e&&!Zt&&!Xt&&!Jt&&Vt==!0&&xn?0:-1,className:"incrementPlusSign ".concat(`${xn===!0?"":"incrementSignDisable"}`),onClick:ar,onMouseEnter:ur,onMouseLeave:Wn,children:jsxRuntimeExports.jsx("img",{alt:"Increment",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg",onError:fr=>{fr.target.src="https://placehold.co/150"}})})]}),jsxRuntimeExports.jsx("div",{className:"spawning-requirements-container",hidden:!(xn===!1&&Ln===!0&&Sn),children:jsxRuntimeExports.jsx("p",{className:"spawning-requirements-text",children:Sn})})]}):jsxRuntimeExports.jsxs("div",{className:"contentContainer",role:"button","aria-label":"Add Button",tabIndex:_e&&!Zt&&!Xt&&!Jt&&Vt==!0&&xn?0:-1,"aria-hidden":!_e||Zt||Xt||Jt||!Vt||!xn,style:{pointerEvents:xn?"all":"none"},onFocus:fr=>{jt||ur(fr)},onBlur:fr=>{jt||Wn(fr)},onClick:ar,children:[jsxRuntimeExports.jsx("div",{id:"itemCard"+Ht,className:"contentOverlay ".concat(`${xn===!0&&Ln===!0?"enabled-item-overlay":"disabled-item-overlay"}`),ref:Kt,onTouchStart:or,onMouseEnter:ur,onMouseLeave:Wn,onMouseDown:fr=>{Cn!==!1&&or(fr)},children:jsxRuntimeExports.jsx("img",{alt:"Add "+mn,draggable:!1,className:"addIcon",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg",onError:fr=>{fr.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{className:"product-image product-image-default-state ".concat(`${xn===!1?"product-image-disabled":""}`),draggable:!1,alt:mn,src:qt.getResolvedAssetUrl(An),onError:fr=>{fr.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("div",{className:"spawning-requirements-container",hidden:!(xn===!1&&Ln===!0&&Sn),children:jsxRuntimeExports.jsx("p",{className:"spawning-requirements-text",children:Sn})})]}),jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Info Button","aria-hidden":!_e||Zt||Xt||Jt||!Vt,tabIndex:_e&&!Zt&&!Xt&&!Jt&&Vt==!0?0:-1,className:qt.isMobile?"showAlways itemDetails":"itemDetails",onClick:gr,children:[jsxRuntimeExports.jsx("div",{className:"item-details-icon"}),jsxRuntimeExports.jsxs("div",{className:"item-card-text-parent",children:[mn&&jsxRuntimeExports.jsx("p",{className:"skuName truncate",children:mn}),_n&&jsxRuntimeExports.jsx("p",{className:"skuSubheading",children:_n})]})]})]})})},PreconfigCard=({stores:kt,sideMenuOpen:_e,onClick:Dt,configId:Vt,name:Gt,thumbnailURL:zt,accordionActive:jt})=>{const Ht=kt.uiSceneStore(Jt=>Jt.CORE_API),Wt=kt.infoStore(Jt=>Jt.infoModalOpen),qt=kt.uiSceneStore(Jt=>Jt.dialogPopupOpen),Xt=kt.cartStore(Jt=>Jt.previewCartModalOpen),[Kt,Yt]=reactExports.useState(!1),Zt=reactExports.useCallback(Jt=>{Jt.stopPropagation(),Dt(Vt)},[]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"imageContainer",draggable:!1,children:[jsxRuntimeExports.jsxs("div",{className:zt?"contentContainer preconfig":"contentContainer preconfig contentDisabled",children:[jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Load Preconfiguration Button","aria-hidden":!_e||qt||Wt||Xt||!jt,tabIndex:_e&&!qt&&!Wt&&!Xt&&jt==!0?0:-1,id:"itemCard"+Vt,className:"contentOverlay ".concat(`${Kt===!0?"enabled-item-overlay":"disabled-item-overlay"}`),onClick:Jt=>Zt(Jt),onFocus:()=>Yt(!0),onBlur:()=>Yt(!1),onMouseEnter:()=>Yt(!0),onMouseLeave:()=>Yt(!1),children:jsxRuntimeExports.jsx("img",{alt:"Add "+Gt,draggable:!1,className:"addIcon",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg"})}),jsxRuntimeExports.jsx("img",{className:"product-image product-image-default-state",draggable:!1,alt:Gt,src:zt,tabIndex:-1,"aria-hidden":!0})]}),jsxRuntimeExports.jsx("div",{className:Ht.isMobile?"showAlways itemDetails":"itemDetails",children:jsxRuntimeExports.jsx("p",{className:"truncate",children:Gt})})]})})};function BuildTabItemRow({stores:kt,sideMenuOpen:_e,element:Dt,index:Vt,visible:Gt,elementsLength:zt,spawnGhosts:jt,spawnItem:Ht,removeAllGhosts:Wt,infoModalOpen:qt,isMouseUsed:Xt,setItemAllowed:Kt,activeItems:Yt}){const Zt=kt.coreSceneStore(cn=>cn.sceneSettings),Jt=reactExports.useRef(null),nn=reactExports.useRef(null),rn=kt.uiSceneStore(cn=>cn.dialogPopupOpen),Qt=kt.cartStore(cn=>cn.previewCartModalOpen),[en,tn]=reactExports.useState(!1),sn=reactExports.useCallback(()=>{if(!(!nn.current||!Jt.current)){if(nn.current.style.maxHeight)nn.current.style.maxHeight=null;else{if(Dt.skus.length>0&&nn.current.scrollHeight<100)return;nn.current.style.maxHeight=nn.current.scrollHeight+"px"}Jt.current.classList.toggle("buildUiAccordionActive"),nn.current.classList.toggle("buildUiContentAccordionActive"),tn(!en)}},[Jt,nn,en]);return reactExports.useEffect(()=>{!nn.current||!Jt.current||Vt==0&&sn()},[Jt,nn]),jsxRuntimeExports.jsxs("div",{className:"subContainer topContainer",children:[Zt.accordionInBuildUi?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Toggle Accordion Button",onClick:sn,"aria-hidden":!_e||rn||qt||Qt||!Gt,tabIndex:_e&&!rn&&!qt&&!Qt&&Gt?0:-1,ref:Jt,className:"buildUiAccordion",children:[jsxRuntimeExports.jsx("div",{className:"arrowUp",children:jsxRuntimeExports.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{x:"0.75",y:"0.6875",width:"28.7343",height:"28.7343",rx:"14.3672",stroke:"#CCCCCC",strokeWidth:"0.5"}),jsxRuntimeExports.jsx("path",{d:"M20.5029 12.8984L15.1172 18.2842L9.73145 12.8984",stroke:"#222222",strokeLinecap:"round",strokeLinejoin:"round"})]})}),jsxRuntimeExports.jsx("div",{className:"arrowDown",children:jsxRuntimeExports.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{x:"0.881836",y:"0.957031",width:"28.7343",height:"28.7343",rx:"14.3672",stroke:"#CCCCCC",strokeWidth:"0.5"}),jsxRuntimeExports.jsx("path",{d:"M9.86328 17.4795L15.249 12.0938L20.6347 17.4795",stroke:"#222222",strokeLinecap:"round",strokeLinejoin:"round"})]})}),jsxRuntimeExports.jsx("h4",{children:Dt.label})]}),jsxRuntimeExports.jsx("div",{ref:nn,className:"sidemenuContent buildUiAccordionContent",children:jsxRuntimeExports.jsx("div",{className:"item-grid",children:Dt.skus.map(cn=>jsxRuntimeExports.jsx(ItemCard,{stores:kt,skuId:cn,sideMenuOpen:_e,accordionActive:Gt&&en,categoryID:Dt.categoryID,spawnGhosts:jt,spawnItem:Ht,removeAllGhosts:Wt,modalOpen:qt,isMouseUsed:Xt,categoryDataIndex:Vt,setItemAllowed:Kt,active:Yt.includes(cn)},"itemCardB"+cn))})})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("h4",{className:"subheading",children:Dt.label}),jsxRuntimeExports.jsx("div",{className:"sidemenuContent",children:jsxRuntimeExports.jsx("div",{className:"item-grid",children:Dt.skus.map(cn=>jsxRuntimeExports.jsx(ItemCard,{stores:kt,skuId:cn,sideMenuOpen:_e,categoryID:Dt.categoryID,accordionActive:Gt,spawnGhosts:jt,spawnItem:Ht,removeAllGhosts:Wt,isMouseUsed:Xt,modalOpen:qt,categoryDataIndex:Vt,setItemAllowed:Kt,active:Yt.includes(cn)},"itemCardB"+cn))})})]}),Vt!==zt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""]})}function BuildTabItemRow_PreConfig({stores:kt,sideMenuOpen:_e,index:Dt,elementsLength:Vt,visible:Gt,configsData:zt,infoModalOpen:jt,isMouseUsed:Ht,onClick:Wt,label:qt}){const Xt=kt.coreSceneStore(tn=>tn.sceneSettings),Kt=reactExports.useRef(null),Yt=reactExports.useRef(null),Zt=kt.uiSceneStore(tn=>tn.dialogPopupOpen),Jt=kt.cartStore(tn=>tn.previewCartModalOpen),nn=kt.uiSceneStore(tn=>tn.CORE_API),[rn,Qt]=reactExports.useState(!1),en=reactExports.useCallback(()=>{!Yt.current||!Kt.current||(Kt.current.classList.toggle("buildUiAccordionActive"),Yt.current.classList.toggle("buildUiContentAccordionActive"),Qt(!rn),Yt.current.style.maxHeight?Yt.current.style.maxHeight=null:Yt.current.style.maxHeight=Yt.current.scrollHeight+"px")},[Kt,Yt,rn]);return jsxRuntimeExports.jsxs("div",{className:"subContainer topContainer",children:[Xt.accordionInBuildUi?jsxRuntimeExports.jsxs("nav",{children:[jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Toggle Accordion Button","aria-hidden":!_e||Zt||jt||Jt||!Gt,onClick:en,tabIndex:_e&&!Zt&&!jt&&!Jt&&Gt?0:-1,ref:Kt,className:"buildUiAccordion",children:[jsxRuntimeExports.jsx("div",{className:"arrowUp",children:jsxRuntimeExports.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{x:"0.75",y:"0.6875",width:"28.7343",height:"28.7343",rx:"14.3672",stroke:"#CCCCCC",strokeWidth:"0.5"}),jsxRuntimeExports.jsx("path",{d:"M20.5029 12.8984L15.1172 18.2842L9.73145 12.8984",stroke:"#222222",strokeLinecap:"round",strokeLinejoin:"round"})]})}),jsxRuntimeExports.jsx("div",{className:"arrowDown",children:jsxRuntimeExports.jsxs("svg",{width:"30",height:"30",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{x:"0.881836",y:"0.957031",width:"28.7343",height:"28.7343",rx:"14.3672",stroke:"#CCCCCC",strokeWidth:"0.5"}),jsxRuntimeExports.jsx("path",{d:"M9.86328 17.4795L15.249 12.0938L20.6347 17.4795",stroke:"#222222",strokeLinecap:"round",strokeLinejoin:"round"})]})}),jsxRuntimeExports.jsx("h4",{children:qt})]}),jsxRuntimeExports.jsx("div",{ref:Yt,className:"sidemenuContent buildUiAccordionContent",children:jsxRuntimeExports.jsx("div",{className:"item-grid",children:zt.map(tn=>jsxRuntimeExports.jsx(PreconfigCard,{stores:kt,onClick:Wt,sideMenuOpen:_e,accordionActive:Gt&&rn,configId:tn.epgsharedconfigid,name:tn.name,thumbnailURL:nn.getResolvedAssetUrl(tn.thumbnails.low)},"itemCardB"+tn.epgsharedconfigid))})})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("h4",{className:"subheading",children:qt}),jsxRuntimeExports.jsx("div",{className:"sidemenuContent",children:jsxRuntimeExports.jsx("div",{className:"item-grid",children:zt.map(tn=>jsxRuntimeExports.jsx(PreconfigCard,{stores:kt,sideMenuOpen:_e,onClick:Wt,accordionActive:Gt,configId:tn.epgsharedconfigid,name:tn.name,thumbnailURL:nn.getResolvedAssetUrl(tn.thumbnails.low)},"itemCardB"+tn.epgsharedconfigid))})})]}),Dt!==Vt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""]})}function SecondMobileTabsHandler({stores:kt,sideMenuOpen:_e,index:Dt,label:Vt,activeTab:Gt,tabsRef:zt,mobileGrid:jt}){const Ht=reactExports.useCallback(Wt=>{if(jt.current.scrollLeft===Wt)return;let qt,Xt,Kt,Yt=!1;function Zt(Jt){qt===void 0&&(qt=Jt);const nn=Jt-qt;if(Xt!==Jt){const rn=nn/200;jt.current.scrollLeft>Wt?(Kt=(jt.current.scrollLeft-Wt)*Math.min(rn,1),jt.current.scrollLeft-=Kt,jt.current.scrollLeft===Wt&&(Yt=!0)):jt.current.scrollLeft<Wt&&(Kt=(Wt-jt.current.scrollLeft)*Math.min(rn,1),jt.current.scrollLeft+=Kt,jt.current.scrollLeft===Wt&&(Yt=!0))}nn<200&&(Xt=Jt,!Yt&&window.requestAnimationFrame(Zt))}window.requestAnimationFrame(Zt)},[]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("a",{className:Gt===Dt?"mobileTab scrolled":"mobileTab",onClick:()=>Ht(zt.current[Dt].offsetLeft-15),role:"button",tabIndex:_e?0:-1,"aria-hidden":!_e,"aria-label":Vt+" Button",children:Vt})})}function MobileGrid({stores:kt,sideMenuOpen:_e,element:Dt,index:Vt,elementsLength:Gt,spawnGhosts:zt,spawnItem:jt,removeAllGhosts:Ht,infoModalOpen:Wt,setItemAllowed:qt,activeItems:Xt,tabsRef:Kt}){return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("section",{id:`section-${Dt.categoryID}`,className:"mobileGridSection",ref:Yt=>Kt.current[Vt]=Yt,children:Dt.skus.map(Yt=>jsxRuntimeExports.jsx(ItemCard,{stores:kt,skuId:Yt,sideMenuOpen:_e,categoryID:Dt.categoryID,spawnGhosts:zt,spawnItem:jt,removeAllGhosts:Ht,modalOpen:Wt,setItemAllowed:qt,active:Xt.includes(Yt)},"itemCardB"+Yt))},"mobileGridSection"+Vt),Vt!==Gt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""]})}function MobileGrid_PreConfig({stores:kt,sideMenuOpen:_e,index:Dt,elementsLength:Vt,tabsRef:Gt,configsData:zt,onClick:jt}){const Ht=kt.uiSceneStore(Wt=>Wt.CORE_API);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("section",{id:"section-preconfig",className:"mobileGridSection",ref:Wt=>Gt.current[Dt]=Wt,children:[zt.map(Wt=>jsxRuntimeExports.jsx(PreconfigCard,{stores:kt,sideMenuOpen:_e,onClick:jt,configId:Wt.epgsharedconfigid,name:Wt.name,thumbnailURL:Ht.getResolvedAssetUrl(Wt.thumbnails.low)},"itemCardB"+Wt.epgsharedconfigid)),[...Array(5)].map((Wt,qt)=>qt<5-zt.length?jsxRuntimeExports.jsx(PreconfigCard,{stores:kt,sideMenuOpen:_e,onClick:()=>{}},"emptyCard"+qt):null)]},"mobileGridSection"+Dt),Dt!==Vt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""]})}const BuildUI=({stores:kt,sideMenuOpen:_e,visible:Dt,identifier:Vt})=>{const Gt=kt.productDataStore(Tn=>Tn.categoryData),[zt,jt]=reactExports.useState([]),[Ht,Wt]=reactExports.useState(void 0),qt=kt.uiSceneStore(Tn=>Tn.isScreenPortrait),Xt=kt.infoStore(Tn=>Tn.infoModalOpen),[Kt,Yt]=reactExports.useState(0),[Zt,Jt]=reactExports.useState(!1),[nn,rn]=reactExports.useState([]),Qt=kt.infoStore(Tn=>Tn.populateInfoObject),en=kt.infoStore(Tn=>Tn.updateInfoModalOpen),tn=kt.uiSceneStore(Tn=>Tn.CORE_API),sn=kt.itemStore(Tn=>Tn.itemsSpawned),cn=kt.itemStore(Tn=>Tn.defaultSceneItemCount),un=reactExports.useRef(null),[hn,fn]=reactExports.useState(!1);reactExports.useEffect(()=>{const Tn=()=>fn(!0),Cn=()=>fn(!1);return document.addEventListener("mousedown",Tn),document.addEventListener("keydown",Cn),()=>{document.removeEventListener("mousedown",Tn),document.removeEventListener("keydown",Cn)}},[]);const pn=reactExports.useCallback(Tn=>{let Cn=[];for(const[yn,Sn]of Object.entries(Tn))Cn.push(Sn);rn(Cn)},[]);addCoreEventListener(kt,tn.EVENTS.UI.ContextMenu_InfoBtnClicked,Tn=>{const Cn=Tn.itemData.lookDetails[Tn.currentVariant],yn=Cn;yn.price=Cn.price,yn.id=Tn.currentVariant,yn.productCategory={id:Tn.itemData.categoryID,label:Tn.itemData.categoryLabel},Qt(yn),en(!0)}),addCoreEventListener(kt,tn.EVENTS.SCENE.ReplaceableCategory_Updated,pn),reactExports.useEffect(()=>{const Tn=tn.getCurrentItemsInReplaceableCategory();return pn(Tn),()=>{}},[tn]),reactExports.useEffect(()=>{Object.keys(Gt).length!==0&&(jt(Gt.build),Gt.preconfiguration!==void 0&&Gt.preconfiguration.configsData!=null&&Wt(Gt.preconfiguration))},[Gt]);const dn=reactExports.useCallback((Tn,Cn)=>{kt.uiSceneStore.getState().CORE_API.spawnItemBySkuID(Tn,Cn)},[]),mn=reactExports.useCallback(Tn=>{Ht.openConfirmationPopup===!1||Object.keys(sn).length<=cn?kt.uiSceneStore.getState().CORE_API.loadSceneFromConfigurationID(Tn,!1):(kt.uiSceneStore.setState({loadConfigId:Tn}),kt.uiSceneStore.getState().setLoadConfigModalOpen(!0))},[Ht,cn,sn]),vn=reactExports.useCallback(Tn=>{kt.uiSceneStore.getState().CORE_API.spawnGhostsForSkuID(Tn,!1,1)},[]),_n=reactExports.useCallback(Tn=>{Xt||kt.uiSceneStore.getState().CORE_API.removeAllGhosts(Tn)},[Xt]),En=reactExports.useRef([]);reactExports.useEffect(()=>{if(!zt)return;let Tn=zt.length;Ht!==void 0&&(Tn+=1),En.current=En.current.slice(0,Tn)},[zt,Ht]);const An=reactExports.useCallback(()=>{let Tn=-3e3,Cn=-1,yn=zt.length;Ht!==void 0&&(yn+=1);for(let Sn=0;Sn<yn;Sn++){let wn=En.current[Sn].getBoundingClientRect().left;wn<28&&Tn<wn&&(Tn=wn,Cn=Sn)}Cn!==-1&&Yt(Cn)},[En,zt,Ht]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"mobileTabContent",hidden:!Dt,tabIndex:qt?0:-1,"aria-hidden":!qt,children:jsxRuntimeExports.jsxs("div",{className:"scrollSpyTabs",children:[jsxRuntimeExports.jsxs("div",{className:"secondMobileTabs",children:[Object.keys(zt).map((Tn,Cn)=>jsxRuntimeExports.jsx(SecondMobileTabsHandler,{stores:kt,sideMenuOpen:_e,index:Cn,label:zt[Tn].label,activeTab:Kt,tabsRef:En,mobileGrid:un},"mobileTabs"+Tn)),Ht!==void 0&&jsxRuntimeExports.jsx(SecondMobileTabsHandler,{stores:kt,sideMenuOpen:_e,index:zt.length,label:Ht.label,activeTab:Kt,tabsRef:En,mobileGrid:un},"preconfiguration_mobileTabs")]}),jsxRuntimeExports.jsxs("div",{className:"mobileGrid",ref:un,onScroll:An,children:[zt.map((Tn,Cn)=>jsxRuntimeExports.jsx(MobileGrid,{stores:kt,sideMenuOpen:_e,element:Tn,index:Cn,spawnGhosts:vn,spawnItem:dn,removeAllGhosts:_n,infoModalOpen:Xt,setItemAllowed:Jt,activeItems:nn,tabsRef:En,elementsLength:Ht!==void 0?zt.length+1:zt.length},"mobileGrid"+Cn)),Ht!==void 0&&jsxRuntimeExports.jsx(MobileGrid_PreConfig,{stores:kt,sideMenuOpen:_e,onClick:mn,configsData:Ht.configsData,tabsRef:En,index:zt.length,elementsLength:zt.length+1},"preconfiguration_mobileGrid")]})]})}),jsxRuntimeExports.jsxs("div",{className:"container desktop",role:"button",hidden:!Dt,tabIndex:qt?-1:0,"aria-hidden":qt,children:[zt.map((Tn,Cn)=>jsxRuntimeExports.jsx(BuildTabItemRow,{stores:kt,sideMenuOpen:_e,element:Tn,index:Cn,visible:Dt,spawnGhosts:vn,spawnItem:dn,removeAllGhosts:_n,infoModalOpen:Xt,isMouseUsed:hn,setItemAllowed:Jt,activeItems:nn,elementsLength:zt.length},`category_${Tn.categoryID}_${Cn}`)),Ht!==void 0&&jsxRuntimeExports.jsx(BuildTabItemRow_PreConfig,{stores:kt,sideMenuOpen:_e,onClick:mn,visible:Dt,configsData:Ht.configsData,infoModalOpen:Xt,isMouseUsed:hn,label:Ht.label,index:zt.length,elementsLength:zt.length+1},"preconfiguration_desktopCategory")]})]})},handleGlobalVariantSwitch=(kt,_e,Dt)=>{kt.uiSceneStore.getState().CORE_API.switchGlobalVariant(_e,Dt)};function Divider$1(kt,_e){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:kt!==_e.length-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""})}const Color=({stores:kt,visible:_e})=>{const Dt=kt.productDataStore(qt=>qt.categoryData),Vt=kt.colorStore(qt=>qt.allActiveVariants),Gt=kt.uiSceneStore(qt=>qt.materialOverrideExists),zt=kt.uiSceneStore(qt=>qt.CORE_API),jt=kt.cartStore(qt=>qt.previewCartModalOpen),Ht=kt.uiSceneStore(qt=>qt.dialogPopupOpen),Wt=reactExports.useCallback(()=>{kt.uiSceneStore.getState().CORE_API.removeAllVariantOverrides()},[]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"container desktop",role:"button",style:{height:"auto"},hidden:!_e,children:[Gt&&jsxRuntimeExports.jsx("button",{tabIndex:!Ht&&!jt&&Gt&&_e?0:-1,className:"removeAllColorOverridesButton",role:"button","aria-hidden":!Gt||Ht||jt||!_e,"aria-label":"Remove All Overrides Button",onClick:Wt,disabled:!Gt,children:"Remove all overrides"}),Dt.color.map((qt,Xt)=>jsxRuntimeExports.jsxs("div",{className:"subContainer topContainer",children:[jsxRuntimeExports.jsx("h4",{className:"subheading",children:qt.label}),jsxRuntimeExports.jsx("div",{className:"sidemenuContent",children:jsxRuntimeExports.jsx("div",{className:"color-grid color-variants-selection",children:qt.looks.map((Kt,Yt)=>jsxRuntimeExports.jsxs("div",{tabIndex:!Ht&&!jt&&_e?0:-1,onClick:()=>handleGlobalVariantSwitch(kt,qt.id,Kt),role:"button","aria-hidden":Ht||jt||!_e,"aria-label":kt.productDataStore.getState().lookData[Kt]?.label+" Button",className:Vt[qt.id]==Kt?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:Zt=>{Zt.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:kt.productDataStore.getState().lookData[Kt]?.label,className:"contextColorThumbnail",src:zt.getResolvedAssetUrl(kt.productDataStore.getState().lookData[Kt]?.thumbnail),onError:Zt=>{Zt.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsxs("div",{className:"colorDetails",children:[jsxRuntimeExports.jsx("p",{className:"truncate colorDetailsLabel",children:capitalize$1(kt.productDataStore.getState().lookData[Kt]?.label)}),jsxRuntimeExports.jsx("p",{className:"truncate colorDetailsLabel",children:capitalize$1(kt.productDataStore.getState().lookData[Kt]?.accent)})]})]},"Color-"+Yt))})}),jsxRuntimeExports.jsx(Divider$1,{})]},`${qt.label}-${Xt}`))]})})};function scrollToTop(kt,_e,Dt){let Vt=_e.clientHeight,Gt=Vt*Dt;if(kt.current.scrollTop===Gt)return;let zt=null;const jt=500,Ht=kt.current.scrollTop;function Wt(Xt){Vt=_e.clientHeight,Gt=Vt*Dt;let Kt=Gt-Ht;zt||(zt=Xt);const Yt=Xt-zt,Zt=Math.min(Yt/jt,1);kt.current.scrollTop=Ht+Kt*qt(Zt),Zt<1&&window.requestAnimationFrame(Wt)}function qt(Xt){return Xt<.5?2*Xt*Xt:-1+(4-2*Xt)*Xt}window.requestAnimationFrame(Wt)}function CarouselItem({stores:kt,carouselTabKey:_e,hotspotContentRef:Dt,defaultAltText:Vt}){const Gt=reactExports.useRef(null),zt=kt.uiSceneStore(Ht=>Ht.CORE_API),jt=Ht=>{Ht.target.style.width="100%"};return jsxRuntimeExports.jsx(SplideSlide,{children:jsxRuntimeExports.jsxs("div",{className:"carouselTabParent",ref:Gt,children:[_e.type==="img"&&jsxRuntimeExports.jsx("img",{src:zt.getResolvedAssetUrl(_e.link),alt:_e.alt?_e.alt:Vt,onLoad:Ht=>jt(Ht),onError:Ht=>{Ht.target.src="https://placehold.co/150"}}),_e.type==="video"&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("p",{className:"carouselVideoPlaceholderText",children:_e.alt?_e.alt:Vt}),jsxRuntimeExports.jsx("video",{src:zt.getResolvedAssetUrl(_e.link),muted:!0,loop:!0,autoPlay:!0,playsInline:!0,controls:!1,onLoad:Ht=>jt(Ht)})]}),_e.title&&jsxRuntimeExports.jsx("p",{className:"carouselTitle",children:_e.title})]})},"SplideSlide-"+_e.link)}function Tab({stores:kt,sideMenuOpen:_e,tabs:Dt,tabKey:Vt,index:Gt,activeFeatureID:zt}){const[jt,Ht]=reactExports.useState([]),Wt=reactExports.useRef(null),qt=reactExports.useRef(null),Xt=reactExports.useRef(null),Kt=kt.cartStore(en=>en.previewCartModalOpen),Yt=kt.uiSceneStore(en=>en.dialogPopupOpen),[Zt,Jt]=reactExports.useState(!1),nn=reactExports.useCallback(en=>{kt.uiSceneStore.getState().CORE_API.clickHotspot("hotspot3D_"+en,{ignoreUI:!0})},[zt]);reactExports.useEffect(()=>{let en=[],tn=Vt.hotspotData;for(let sn=0;sn<tn.carousel.length;sn++)tn.carousel[sn].type!==""&&tn.carousel[sn].link!==""&&(en=[...en,{...tn.carousel[sn],index:sn}]);Ht(en)},[Vt]),reactExports.useEffect(()=>{const{current:en}=qt;en&&(zt===en.id?(rn(en),Jt(!0)):(Qt(en),Jt(!1)))},[zt]);const rn=reactExports.useCallback(en=>{en.checked=!0,en.nextElementSibling.nextElementSibling.setAttribute("style","max-height: 800px;"),scrollToTop(Dt,en.nextElementSibling,Gt)},[]),Qt=reactExports.useCallback(en=>{en.nextElementSibling.nextElementSibling.setAttribute("style","max-height: 0px;"),en.checked=!1},[]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Vt.hotspotData&&jsxRuntimeExports.jsxs("div",{className:"accordionTab",children:[jsxRuntimeExports.jsx("input",{tabIndex:_e&&!Yt&&!Kt?0:-1,"aria-hidden":!_e||Yt||Kt,type:"checkbox",name:"accordion",id:"rd_"+Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID,defaultChecked:!1,ref:qt,"aria-label":"Toggle Accordion for "+Vt.hotspotData.title,onClick:en=>{nn(Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID,{ignoreUI:!1})}}),jsxRuntimeExports.jsxs("label",{className:"tab-label",htmlFor:"rd_"+Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID,children:[jsxRuntimeExports.jsx("span",{children:Vt.hotspotData.title}),jsxRuntimeExports.jsx("img",{alt:"Open Image for title "+Vt.hotspotData.title,className:"accordion-closed",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg",onError:en=>{en.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("img",{alt:"Close Image for title "+Vt.hotspotData.title,className:"accordion-open",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Minus.svg",onError:en=>{en.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{className:"tab-content",children:jsxRuntimeExports.jsx("div",{className:"hotspot-content",ref:Xt,children:Zt&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ReactQuill$1,{className:"ignore",modules:{toolbar:!1},theme:"bubble",readOnly:!0,value:Vt.hotspotData.description}),jt.length==1&&jt[0].type!=""&&jt[0].link!=""&&jsxRuntimeExports.jsx("ul",{children:jsxRuntimeExports.jsx(CarouselItem,{stores:kt,carouselTabKey:jt[0],index:0,defaultAltText:Vt.itemData.name?Vt.itemData.name:Vt.itemData.skuID,hotspotContentRef:Xt},"carouselTabs_"+Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID+"_0")}),jt.length>1&&jsxRuntimeExports.jsx("div",{className:"carousel",children:jsxRuntimeExports.jsx(Splide2,{options:{perPage:1,preloadPages:3},role:"none",ref:Wt,children:jt.map((en,tn)=>en.type!=""&&en.link!=""&&jsxRuntimeExports.jsx(CarouselItem,{stores:kt,carouselTabKey:en,defaultAltText:Vt.itemData.name?Vt.itemData.name:Vt.itemData.skuID,index:tn,hotspotContentRef:Xt},"carouselTabs_"+Vt.itemData.skuID+"_"+Vt.hotspotData.hotspotID+"_"+en.index))})})]})})})]})})}const ProductFeaturesUI=({stores:kt,sideMenuOpen:_e,visible:Dt,identifier:Vt})=>{const Gt=kt.uiSceneStore(qt=>qt.CORE_API),zt=kt.uiSceneStore(qt=>qt.tabSpawnCount),jt=kt.uiSceneStore(qt=>qt.isScreenPortrait),Ht=reactExports.useRef(null),Wt=kt.uiHotspotStore(qt=>qt.activeFeatureID);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{className:"col desktop productFeatureUIDic",hidden:!Dt,tabIndex:Dt&&Vt=="featuresTab-mobile"&&jt||Vt=="featuresTab-desktop"&&!jt?0:-1,"aria-hidden":!Dt||Vt=="featuresTab-mobile"&&!jt||Vt=="featuresTab-desktop"&&jt,children:jsxRuntimeExports.jsxs("div",{className:"tabs",ref:Ht,children:[zt.length==0&&jsxRuntimeExports.jsx("div",{className:"tabEmptyText",children:Gt.sceneSettings.textSettings.featuresTabEmptyText}),zt.map((qt,Xt)=>jsxRuntimeExports.jsx(Tab,{stores:kt,sideMenuOpen:_e,tabs:Ht,activeFeatureID:Wt,tabKey:qt,index:Xt},"tabs_"+qt.itemData.skuID+"_"+qt.hotspotData.hotspotID))]})})})},CartItem=({stores:kt,itemObject:_e})=>{const Dt=kt.uiSceneStore(jt=>jt.CORE_API),Vt=kt.uiSceneStore(jt=>jt.disableCart),[Gt,zt]=reactExports.useState(Dt.sceneSettings.currency);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:_e.countUnavailable=="0"||Vt?"cartItem":"cartItem cartItemOutOfStock",draggable:!1,style:{display:_e?"":"none"},children:[jsxRuntimeExports.jsx("div",{className:"cartItemImage",children:jsxRuntimeExports.jsx("img",{draggable:!1,src:Dt.getResolvedAssetUrl(_e.thumbnails.review?_e.thumbnails.review:_e.thumbnails.low),alt:_e.title,"aria-label":_e.title,onError:jt=>{jt.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsxs("div",{className:"cartItemDetails",children:[jsxRuntimeExports.jsx("h4",{children:_e.title}),_e.subtitle?jsxRuntimeExports.jsx("h5",{children:_e.subtitle}):jsxRuntimeExports.jsx("h5",{children:_e.subheading}),jsxRuntimeExports.jsxs("div",{className:"cartRow",children:[jsxRuntimeExports.jsxs("span",{className:"itemCount",children:[Dt.sceneSettings.textSettings.cartQuantityText,":"," ",_e.count]}),jsxRuntimeExports.jsxs("h3",{className:"itemPrice".concat(Vt===!0?" hide":""),children:[Gt,parseFloat(_e.price).toFixed(2)]}),_e.compareAtPrice!=0&&_e.compareAtPrice>_e.price&&jsxRuntimeExports.jsxs("h3",{className:"itemCompareAtPrice".concat(Vt===!0?" hide":""),children:[Gt,parseFloat(_e.compareAtPrice).toFixed(2)]})]}),_e.actionButton&&jsxRuntimeExports.jsx("span",{className:"actionButton",role:"button","aria-label":"Action Button",onClick:()=>Dt.actionButtonClicked(_e),children:_e.actionButton.text}),jsxRuntimeExports.jsxs("div",{className:"cartRow".concat(Vt===!0||_e.countUnavailable=="0"?" hide":""),tabIndex:Vt===!0||_e.countUnavailable=="0"?-1:0,"aria-hidden":Vt===!0||_e.countUnavailable=="0",children:[jsxRuntimeExports.jsx("img",{className:"cartRowImage",alt:"Info",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Info_red.png",onError:jt=>{jt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsxs("h3",{className:"itemAvailable",children:[_e.countAvailable," IN STOCK"]}),jsxRuntimeExports.jsx("span",{className:"itemCount",children:"- quantities requested not available"})]})]})]})})},PreviewCart=({stores:kt})=>{const _e=kt.cartStore(Xt=>Xt.cart),Dt=kt.cartStore(Xt=>Xt.previewCartModalOpen),Vt=kt.cartStore(Xt=>Xt.togglePreviewCartModal),Gt=kt.uiSceneStore(Xt=>Xt.CORE_API),zt=kt.uiSceneStore(Xt=>Xt.disableCart),jt=kt.uiSceneStore(Xt=>Xt.cartMessage),Ht=kt.uiSceneStore(Xt=>Xt.dialogPopupOpen),Wt=reactExports.useRef(null),qt=reactExports.useCallback(async()=>{await Gt.checkoutAsync()},[]);return reactExports.useEffect(()=>{Wt.current&&Dt&&Wt.current.focus()},[Dt]),reactExports.useEffect(()=>{const Xt=async()=>{const Kt=await kt.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics();if(Dt){const Yt=new O$2(Kt,!0,"preview-cart","button");kt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(Yt)}else{const Yt=new G$3(Kt,!0,"preview-cart","button");kt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(Yt)}};kt?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics&&Xt()},[Dt,kt]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:Dt?"previewCartModal open":"previewCartModal",tabIndex:!Ht&&Dt?0:-1,"aria-hidden":Ht||!Dt,children:[jsxRuntimeExports.jsxs("div",{className:"previewCartModalChild",children:[jsxRuntimeExports.jsx("div",{role:"button",ref:Wt,className:"closeButton",id:"preview-cart-close-button","aria-label":"Close Button",onClick:()=>{Vt()},children:jsxRuntimeExports.jsx("img",{alt:"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg",onError:Xt=>{Xt.target.src="https://placehold.co/150"}})}),_e.length<=0&&jsxRuntimeExports.jsx("h3",{className:"cartEmptyText",children:"Your cart is currently empty"}),_e.length>0&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("h2",{className:"cartTitle",children:Gt.sceneSettings.textSettings.cartHeadingText}),jsxRuntimeExports.jsx("div",{className:"previewCartContentParentDiv",children:jsxRuntimeExports.jsx("div",{className:"previewCartContent",children:_e.map((Xt,Kt)=>jsxRuntimeExports.jsx(CartItem,{stores:kt,itemObject:Xt,index:Kt},`Cart Item-${Kt}`))})})]})]}),jsxRuntimeExports.jsxs("div",{className:"checkButtonParentDiv".concat(zt===!0?" hide":""),children:[jt&&jsxRuntimeExports.jsx("div",{className:"cartMessageDiv",children:jsxRuntimeExports.jsx("span",{children:jt})}),jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Click to checkout the cart","aria-hidden":!Dt,tabIndex:Dt?0:-1,className:"checkoutButton",onClick:qt,children:jsxRuntimeExports.jsx("span",{children:Gt.sceneSettings.addToCartCTAText})})]})]})})},InfoModal=({stores:kt,visible:_e})=>{const Dt=kt.productDataStore(En=>En.categoryData),Vt=kt.uiSceneStore(En=>En.dialogPopupOpen),Gt=kt.uiSceneStore(En=>En.isScreenPortrait),zt=kt.colorStore(En=>En.allActiveVariants),jt=kt.infoStore(En=>En.infoObject),Ht=kt.infoStore(En=>En.infoModalOpen),Wt=kt.itemStore(En=>En.itemsSpawned),qt=kt.infoStore(En=>En.updateInfoModalOpen),[Xt,Kt]=reactExports.useState(""),[Yt,Zt]=reactExports.useState([]),[Jt,nn]=reactExports.useState(!1),rn=kt.uiSceneStore(En=>En.CORE_API),Qt=kt.productDataStore(En=>En.productData),en=kt.itemStore(En=>En.fittingSkuIds),[tn,sn]=reactExports.useState(!1),[cn,un]=reactExports.useState(0),hn=kt.coreSceneStore(En=>En.sceneSettings),fn=reactExports.useRef(null),pn=reactExports.useCallback(()=>{cn<=0||!jt.skuID||rn.removeLastItemBySkuId(jt.skuID)},[cn,jt]),dn=()=>{if(!Wt||!jt.skuID)return;let En=0;const An=Object.keys(Wt);for(let Tn=An.length-1;Tn>=0;Tn--){const Cn=An[Tn];Wt[Cn].itemData.skuID===jt.skuID&&En++}un(En)};reactExports.useEffect(()=>{dn()},[Wt,jt]),reactExports.useEffect(()=>{Object.keys(Dt).length!=0&&Zt(Dt.build)},[Dt]),reactExports.useEffect(()=>(Kt(zt[Object.keys(zt)[0]]),()=>{}),[zt]),reactExports.useEffect(()=>{en.includes(jt.skuID)?nn(!0):nn(!1)},[en,jt]),reactExports.useEffect(()=>{if(!Qt||!jt.skuID)return;const En=Qt[jt.skuID].incrementDecrementControl?Qt[jt.skuID].incrementDecrementControl:!1;sn(En)},[Qt,jt]);const mn=reactExports.useCallback(()=>{Jt&&rn.spawnGhostsForSkuID(jt.skuID,!1,1)},[jt,Jt]),vn=reactExports.useCallback(()=>{Jt&&rn.removeAllGhosts(jt.skuID)},[jt,Jt]),_n=reactExports.useCallback(()=>{Jt&&rn.spawnItemBySkuID(jt.skuID,!0)},[jt,Jt]);return reactExports.useEffect(()=>{fn.current&&_e&&Ht&&fn.current.focus()},[Ht,_e]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:Ht&&_e?"infoModal open":"infoModal",tabIndex:Ht&&!Gt?0:-1,"aria-hidden":!Ht||Gt,children:[jsxRuntimeExports.jsxs("a",{role:"button","aria-label":"Product Page Link Button","aria-hidden":Vt||!_e||!Ht||!jt?.productPageUrl,tabIndex:!Vt&&_e&&Ht&&jt?.productPageUrl?0:-1,ref:fn,href:jt.productPageUrl,className:"categoryLink",target:"_blank",style:jt?.productPageUrl&&Ht?{pointerEvents:"all"}:{pointerEvents:"none"},children:[jsxRuntimeExports.jsxs("h2",{className:"categoryTitle",children:[jt?.productCategory?.label,jt.subheading&&jsxRuntimeExports.jsx("div",{className:"modalSubHeading",children:jt.subheading})]}),jt.productPageUrl&&jsxRuntimeExports.jsx("img",{alt:"Open Product Page",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/OpenTab.svg",onError:En=>{En.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{role:"button","aria-hidden":Vt||!_e||!Ht,tabIndex:!Vt&&_e&&Ht?0:-1,className:"closeButton","aria-label":"Close Button",onClick:()=>{qt(!1)},children:jsxRuntimeExports.jsx("img",{alt:"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg",onError:En=>{En.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("div",{className:"infoModalImageContainer",children:jt?.thumbnails?.high?jsxRuntimeExports.jsx("img",{alt:jt.title,className:"itemImage","aria-label":jt.title,src:rn.getResolvedAssetUrl(jt.thumbnails.high),onError:En=>{En.target.src="https://placehold.co/150"}}):""}),jsxRuntimeExports.jsxs("div",{className:"infoModalTextContainer",children:[jsxRuntimeExports.jsx("h2",{className:"itemTitle",children:jt.title}),jsxRuntimeExports.jsx("pre",{className:"itemDescription",children:jt.description}),jt.boundingBoxSize?jsxRuntimeExports.jsxs("p",{className:"infoModalDimensions",children:[jt.boundingBoxSize.x.toFixed(1),"” W x"," ",jt.boundingBoxSize.y.toFixed(1),"” D x"," ",jt.boundingBoxSize.z.toFixed(1),"” H"]}):""]}),hn.addFromInfoModal&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:tn?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"infoModalIncrementDecrementParent incrementDecrementPanel",children:[jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Decrement Button","aria-hidden":cn==0||Vt||!Ht,tabIndex:cn!==0&&!Vt&&Ht?0:-1,className:"incrementMinusSign ".concat(`${cn===0?"incrementSignDisable":""}`),onClick:pn,children:jsxRuntimeExports.jsx("img",{alt:"Decrement",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Minus.svg",onError:En=>{En.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("div",{className:"incrementCount",children:cn}),jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Increment Button","aria-hidden":Vt||!Ht||!Jt,tabIndex:!Vt&&Ht&&Jt?0:-1,className:"incrementPlusSign ".concat(`${Jt===!0?"":"incrementSignDisable"}`),onClick:_n,onMouseEnter:mn,onMouseLeave:vn,children:jsxRuntimeExports.jsx("img",{alt:"Increment",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Plus.svg",onError:En=>{En.target.src="https://placehold.co/150"}})})]})}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Add Button","aria-hidden":!Jt||Vt||!Ht,tabIndex:!Vt&&Ht&&Jt?0:-1,className:"infoModalAddButton ".concat(`${Jt===!0?"enabledInfoModalAddButton":"disabledInfoModalAddButton"}`),onFocus:mn,onBlur:vn,onMouseEnter:mn,onMouseLeave:vn,onClick:_n,children:"Add"})})}),jsxRuntimeExports.jsx("div",{className:"infoModalActions",children:jt.price&&jsxRuntimeExports.jsxs("button",{className:"item-price",disabled:!0,children:["$",numberWithCommas(parseFloat(jt.price).toFixed(2))]})})]})})},handleGlobalGeometryVariantSwitch=(kt,_e,Dt)=>{kt.uiSceneStore.getState().CORE_API.switchGlobalGeometryVariant(_e,Dt)};function Divider(kt,_e){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:kt!==_e.length-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):""})}const GeometryVariants=({stores:kt,visible:_e})=>{const Dt=kt.productDataStore(Wt=>Wt.categoryData),Vt=kt.colorStore(Wt=>Wt.allActiveGeometryVariants),Gt=kt.uiSceneStore(Wt=>Wt.CORE_API),zt=kt.uiSceneStore(Wt=>Wt.isScreenPortrait),jt=kt.cartStore(Wt=>Wt.previewCartModalOpen),Ht=kt.uiSceneStore(Wt=>Wt.dialogPopupOpen);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{className:"container desktop",role:"group",style:{height:"auto"},hidden:!_e,tabIndex:_e&&!zt?0:-1,"aria-hidden":!_e||zt,children:Dt.geometryVariants.map((Wt,qt)=>jsxRuntimeExports.jsxs("div",{className:"subContainer topContainer",children:[jsxRuntimeExports.jsx("h4",{className:"subheading",children:Wt.label}),jsxRuntimeExports.jsx("div",{className:"sidemenuContent",children:jsxRuntimeExports.jsx("div",{className:"color-grid geometry-variants-selection",children:Object.keys(Wt.variants).map((Xt,Kt)=>jsxRuntimeExports.jsxs("div",{tabIndex:!Ht&&!jt?0:-1,onClick:()=>handleGlobalGeometryVariantSwitch(kt,Wt.id,Xt),role:"button","aria-hidden":Ht||jt,"aria-label":Wt.variants[Xt].label+" Button",className:Vt[Wt.id]==Xt?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",style:{borderRadius:"0%"},children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:Yt=>{Yt.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:Wt.variants[Xt].label,className:"contextColorThumbnail",src:Gt.getResolvedAssetUrl(Wt.variants[Xt].thumbnail),onError:Yt=>{Yt.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsx("p",{className:"truncate colorDetailsLabel",children:capitalize$1(Wt.variants[Xt].label)})})]},"Color-"+Kt))})}),jsxRuntimeExports.jsx(Divider,{})]},`${Wt.label}-${qt}`))})})},VariantMobile=({stores:kt,sideMenuOpen:_e,sortedVariantsTabOrder:Dt})=>{const Vt=kt.productDataStore(pn=>pn.categoryData),Gt=kt.productDataStore(pn=>pn.lookData),zt=kt.colorStore(pn=>pn.allActiveVariants),jt=kt.uiSceneStore(pn=>pn.isScreenPortrait),Ht=kt.colorStore(pn=>pn.allActiveGeometryVariants),Wt=kt.uiSceneStore(pn=>pn.materialOverrideExists),[qt,Xt]=reactExports.useState(0),[Kt,Yt]=reactExports.useState(0);reactExports.useEffect(()=>{let pn=0;Dt.includes("color")===!0&&(pn+=Vt.color.length),Dt.includes("geometryVariants")===!0&&(pn+=Vt.geometryVariants.length),Yt(pn)},[Vt]);const Zt=(pn,dn,mn)=>{pn.uiSceneStore.getState().CORE_API.switchGlobalGeometryVariant(dn,mn)},Jt=(pn,dn,mn)=>{pn.uiSceneStore.getState().CORE_API.switchGlobalVariant(dn,mn)};function nn({color:pn,index:dn,elementId:mn,allActiveVariants:vn}){return jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:_e?0:-1,"aria-hidden":!_e,"aria-label":Gt[pn]?.label+" Button",onClick:()=>Jt(kt,mn,pn),className:vn[mn]==pn?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:_n=>{_n.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:Gt[pn]?.label,className:"contextColorThumbnail",src:kt.uiSceneStore.getState().CORE_API.getResolvedAssetUrl(Gt[pn]?.thumbnail),onError:_n=>{_n.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsx("p",{className:"truncate-mobile colorDetailsLabel",children:capitalize$1(Gt[pn]?.label)})})]},"Color-"+dn)}function rn({variant:pn,variantId:dn,index:mn,elementId:vn,allActiveGeometryVariants:_n}){return jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:_e?0:-1,"aria-hidden":!_e,"aria-label":pn.label+" Button",onClick:()=>Zt(kt,vn,dn),className:_n[vn]==dn?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:En=>{En.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:pn.label,className:"contextColorThumbnail",src:kt.uiSceneStore.getState().CORE_API.getResolvedAssetUrl(pn.thumbnail),onError:En=>{En.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsx("p",{className:"truncate-mobile colorDetailsLabel",children:capitalize$1(pn.label)})})]},"GeometryVariant-"+mn)}function Qt({variantType:pn,element:dn,allActiveVariants:mn,startIndex:vn}){return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[pn=="color"&&dn.looks.map((_n,En)=>jsxRuntimeExports.jsx(nn,{color:_n,index:En,elementId:dn.id,allActiveVariants:mn},"MobileGridInternal_"+En)),pn=="geometry"&&Object.keys(dn.variants).map((_n,En)=>jsxRuntimeExports.jsx(rn,{variant:dn.variants[_n],index:En,elementId:dn.id,variantId:_n,allActiveGeometryVariants:mn},"MobileGridVariantInternal_"+En))]})}const en=reactExports.useCallback(({index:pn})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:pn!==Kt-1?jsxRuntimeExports.jsx("div",{className:"itemGridDivider"}):jsxRuntimeExports.jsx("div",{className:"itemGridPlaceholder"})}),[Vt,Kt]),tn=reactExports.useCallback(()=>{kt.uiSceneStore.getState().CORE_API.removeAllVariantOverrides()},[]),sn=reactExports.useCallback(pn=>{if(un.current.scrollLeft===pn)return;let dn,mn,vn,_n=!1;function En(An){dn===void 0&&(dn=An);const Tn=An-dn;if(mn!==An){const Cn=Tn/200;un.current.scrollLeft>pn?(vn=(un.current.scrollLeft-pn)*Math.min(Cn,1),un.current.scrollLeft-=vn,un.current.scrollLeft===pn&&(_n=!0)):un.current.scrollLeft<pn&&(vn=(pn-un.current.scrollLeft)*Math.min(Cn,1),un.current.scrollLeft+=vn,un.current.scrollLeft===pn&&(_n=!0))}Tn<200&&(mn=An,!_n&&window.requestAnimationFrame(En))}window.requestAnimationFrame(En)},[]),cn=reactExports.useRef([]);reactExports.useEffect(()=>{cn.current=cn.current.slice(0,Kt)},[Kt]);const un=reactExports.useRef(null),hn=reactExports.useCallback(({sideMenuOpen:pn,categoryID:dn,label:mn,index:vn,totalLength:_n})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("a",{role:"button",tabIndex:pn?0:-1,"aria-hidden":!pn,"aria-label":mn+" Button",className:qt===vn?"mobileTab scrolled":"mobileTab",onClick:()=>{for(let En=0;En<_n;En++)En===vn&&sn(cn.current[En].offsetLeft)},children:mn})}),[qt,cn]),fn=reactExports.useCallback(()=>{let pn=-3e3,dn=-1;for(let mn=0;mn<Kt;mn++){let vn=cn.current[mn].getBoundingClientRect().left;vn<28&&pn<vn&&(pn=vn,dn=mn)}dn!==-1&&Xt(dn)},[cn,Vt,Kt]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{className:"mobileTabContent",tabIndex:jt?0:-1,"aria-hidden":!jt,children:jsxRuntimeExports.jsxs("div",{className:"scrollSpyTabs",children:[jsxRuntimeExports.jsx("div",{className:"secondMobileTabs",children:Dt.map((pn,dn)=>{if(pn=="color")return Vt.color.map((mn,vn)=>jsxRuntimeExports.jsx(hn,{sideMenuOpen:_e,categoryID:mn.id,label:mn.label,index:dn==0?vn:Dt.includes("geometryVariants")?Vt.geometryVariants.length+vn:vn,totalLength:Kt},"mobileTabsColors"+mn.id));if(pn=="geometryVariants")return Vt.geometryVariants.map((mn,vn)=>jsxRuntimeExports.jsx(hn,{categoryID:mn.id,label:mn.label,index:dn==0?vn:Dt.includes("color")?Vt.color.length+vn:vn,totalLength:Kt},"mobileTabsVariants"+mn.id))})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx("div",{className:"mobileGrid mobileGridCenter",ref:un,onScroll:fn,children:jsxRuntimeExports.jsxs("section",{className:"mobileGridSection",children:[Wt&&jsxRuntimeExports.jsxs("button",{role:"button",tabIndex:jt&&Wt&&_e?0:-1,"aria-label":"Remove All Overrides Button","aria-hidden":!jt||!Wt||!_e,onClick:tn,className:"removeAllColorOverridesButton",disabled:!Wt,children:[jsxRuntimeExports.jsx("div",{className:"iconContainer",children:jsxRuntimeExports.jsx("img",{src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/TrashSimple.svg",alt:"Remove",onError:pn=>{pn.target.src="https://placehold.co/150"}})}),"Remove all",jsxRuntimeExports.jsx("br",{}),"overrides"]}),Dt.map((pn,dn)=>{if(pn=="color")return Vt.color.map((mn,vn)=>jsxRuntimeExports.jsxs("section",{className:"mobileGridCategorySection color-variants-selection",id:`section-${mn.categoryID}`,ref:_n=>cn.current[dn==0?vn:Dt.includes("geometryVariants")?Vt.geometryVariants.length+vn:vn]=_n,children:[jsxRuntimeExports.jsx(Qt,{variantType:"color",element:mn,allActiveVariants:zt},`mobileGrid-${mn.categoryID}`),jsxRuntimeExports.jsx(en,{index:dn==0?vn:Dt.includes("geometryVariants")?Vt.geometryVariants.length+vn:vn},"divider"+mn.categoryID)]},`sectionz-${mn.categoryID}-${vn}`));if(pn=="geometryVariants")return Vt.geometryVariants.map((mn,vn)=>jsxRuntimeExports.jsxs("section",{className:"mobileGridCategorySection geometry-variants-selection",id:`section-${mn.id}`,ref:_n=>cn.current[dn==0?vn:Dt.includes("color")?Vt.color.length+vn:vn]=_n,children:[jsxRuntimeExports.jsx(Qt,{variantType:"geometry",element:mn,allActiveVariants:Ht},`mobileGrid-variants-${mn.id}`),jsxRuntimeExports.jsx(en,{index:dn==0?vn:Dt.includes("color")?Vt.color.length+vn:vn},"divider-variants-"+mn.id)]},`sectionz-variants-${mn.id}-${vn}`))})]})})})]})})})},SideMenu=({stores:kt,sideMenuOpen:_e,sideMenuRef:Dt,toggleSideMenuOpen:Vt,configuratorWcRef:Gt,PUBLIC_DESIGN_ASSETS_ENDPOINT:zt,handleSideButtonClick:jt,useTabIcon:Ht,GENERIC_PROJECT_ASSET_DATA_ROOT_URL:Wt,sideMenuState:qt,togglePreviewCartModal:Xt,getItemCount:Kt,currency:Yt})=>{const Zt=kt.productDataStore(un=>un.hotspotsData),Jt=kt.cartStore(un=>un.previewCartModalOpen),nn=kt.uiSceneStore(un=>un.dialogPopupOpen),rn=kt.productDataStore(un=>un.categoryData),Qt=kt.uiSceneStore(un=>un.disableCart),en=kt.uiSceneStore(un=>un.CORE_API),tn=kt.uiSceneStore(un=>un.isScreenPortrait),[sn,cn]=reactExports.useState([]);return reactExports.useEffect(()=>{const un=en.sceneSettings.variantsTabOrder,hn=Object.entries(un);hn.sort(([,pn],[,dn])=>pn.priority-dn.priority);const fn=[];hn.forEach(([pn,dn])=>{dn.enabled&&fn.push(pn)}),cn(fn)},[en]),reactExports.useEffect(()=>{if(!kt.uiSceneStore.getState().CORE_API.isMobile)return;const{current:un}=Dt;!un||Gt.shadowRoot.getElementById("_leftShell")},[_e,Dt]),jsxRuntimeExports.jsxs("div",{className:`sideMenu interactable ${_e===!0?"":"side-menu-collapsed"}`,ref:Dt,children:[jsxRuntimeExports.jsxs("div",{className:_e?"mobileExpandButton sideMenuOpen":"mobileExpandButton",tabIndex:tn?0:-1,"aria-hidden":!tn,children:[jsxRuntimeExports.jsx("span",{children:"Expand Configurator"}),jsxRuntimeExports.jsx("div",{role:"button",tabIndex:!_e&&!nn&&!Jt?0:-1,"aria-hidden":_e||nn||Jt,"aria-label":"Expand Menu",onClick:Vt,children:jsxRuntimeExports.jsx("img",{alt:"Down",src:zt+"/Icon/ArrowDown.svg",onError:un=>{un.target.src="https://placehold.co/150"}})},"expandSideMenuButton")]}),jsxRuntimeExports.jsx("div",{className:_e===!0?"sideMenuTabContainer":"sideMenuTabContainer side-menu-container-hide",tabIndex:tn?0:-1,"aria-hidden":!tn,children:jsxRuntimeExports.jsxs(Tabs,{className:"firstMobileTab",children:[jsxRuntimeExports.jsxs(TabList,{className:"firstMobileTabs","aria-label":"Mobile Tab List",children:[jsxRuntimeExports.jsx(Tab$1,{children:jsxRuntimeExports.jsxs("div",{className:"mobileTab",role:"button",tabIndex:!Jt&&!nn&&_e?0:-1,"aria-hidden":Jt||!_e||nn,"aria-label":"A button to select the "+en.sceneSettings.textSettings.buildTabHeadingText+" Tab",onClick:()=>{jt(0)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Build",src:Wt+"/thumbnails/common-ui/BuildTabIcon.svg",onError:un=>{un.target.src="https://placehold.co/150"}}):"",en.sceneSettings.textSettings.buildTabHeadingText]})}),(rn.color.length>0||rn.geometryVariants.length>0)&&jsxRuntimeExports.jsx(Tab$1,{children:jsxRuntimeExports.jsxs("div",{className:"mobileTab",role:"button",tabIndex:!Jt&&!nn&&_e?0:-1,"aria-hidden":Jt||nn||!_e,"aria-label":en.sceneSettings.textSettings.colorTabHeadingText+" Button",onClick:()=>{jt(1)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Color",src:Wt+"/thumbnails/common-ui/ColorTabIcon.svg",onError:un=>{un.target.src="https://placehold.co/150"}}):"",en.sceneSettings.textSettings.colorTabHeadingText]})}),Object.keys(Zt).length>0&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Tab$1,{children:jsxRuntimeExports.jsxs("div",{className:"mobileTab",role:"button",tabIndex:!Jt&&!nn&&_e?0:-1,"aria-hidden":!_e||nn||Jt,"aria-label":en.sceneSettings.textSettings.featuresTabHeadingText+" Button",onClick:()=>{jt(2)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Features",src:Wt+"/thumbnails/common-ui/ProductFeaturesTabIcon.png",onError:un=>{un.target.src="https://placehold.co/150"}}):"",en.sceneSettings.textSettings.featuresTabHeadingText]})})}),jsxRuntimeExports.jsx("div",{role:"tab",className:"collapse-side-menu-button-parent",children:jsxRuntimeExports.jsx("div",{className:`collapse-side-menu-button ${_e===!0?"":"set-display-none"}`,role:"button",tabIndex:!Jt&&!nn&&_e?0:-1,"aria-hidden":Jt||nn||!_e,"aria-label":"Collapse Menu",onClick:Vt,children:jsxRuntimeExports.jsx("img",{alt:"Down",src:zt+"/Icon/ArrowDown.svg",onError:un=>{un.target.src="https://placehold.co/150"}})},"collapseSideMenuButton")})]}),jsxRuntimeExports.jsx(TabPanel,{children:jsxRuntimeExports.jsx(BuildUI,{stores:kt,sideMenuOpen:_e,identifier:"buildUI-mobile",sideMenuState:0})}),(rn.color.length>0||rn.geometryVariants.length>0)&&jsxRuntimeExports.jsx(TabPanel,{children:jsxRuntimeExports.jsx("div",{className:"variantContainer",children:jsxRuntimeExports.jsx(VariantMobile,{stores:kt,sideMenuOpen:_e,sortedVariantsTabOrder:sn})})}),Object.keys(Zt).length>0&&jsxRuntimeExports.jsx(TabPanel,{children:jsxRuntimeExports.jsx("div",{className:"featuresContainer",children:jsxRuntimeExports.jsx(ProductFeaturesUI,{stores:kt,sideMenuOpen:_e,identifier:"featuresTab-mobile",visible:qt===2})})})]})}),jsxRuntimeExports.jsxs("div",{className:"desktopSideMenu",tabIndex:tn?-1:0,"aria-hidden":tn,role:"group",children:[jsxRuntimeExports.jsxs("nav",{className:"sideMenuTabs",children:[jsxRuntimeExports.jsxs("div",{role:"button","aria-hidden":!_e||nn||Jt,tabIndex:_e&&!nn&&!Jt?0:-1,className:qt===0?"activeSideMenuTab rightTopBarButton button":"inactiveSideMenuTab rightTopBarButton button","aria-label":en.sceneSettings.textSettings.buildTabHeadingText+" Button",onClick:()=>{jt(0)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Build",src:Wt+"BuildTabIcon.png",onError:un=>{un.target.src="https://placehold.co/150"}}):"",jsxRuntimeExports.jsx("span",{children:en.sceneSettings.textSettings.buildTabHeadingText})]}),(rn.color.length>0||rn.geometryVariants.length>0)&&jsxRuntimeExports.jsxs("div",{role:"button","aria-hidden":!_e||nn||Jt,tabIndex:_e&&!nn&&!Jt?0:-1,className:qt===1?"activeSideMenuTab rightTopBarButton button":"inactiveSideMenuTab rightTopBarButton button","aria-label":en.sceneSettings.textSettings.colorTabHeadingText+" Button",onClick:()=>{jt(1)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Color",src:Wt+"/thumbnails/common-ui/ColorTabIcon.svg",onError:un=>{un.target.src="https://placehold.co/150"}}):"",jsxRuntimeExports.jsx("span",{children:en.sceneSettings.textSettings.colorTabHeadingText})]}),Object.keys(Zt).length>0&&jsxRuntimeExports.jsxs("div",{role:"button","aria-label":en.sceneSettings.textSettings.featuresTabHeadingText+" Button","aria-hidden":!_e||nn||Jt,tabIndex:_e&&!nn&&!Jt?0:-1,className:qt===2?"activeSideMenuTab rightTopBarButton button":"inactiveSideMenuTab rightTopBarButton button",onClick:()=>{jt(2)},children:[Ht?jsxRuntimeExports.jsx("img",{className:"icon",alt:"Features",src:Wt+"/thumbnails/common-ui/ProductFeaturesTabIcon.png",onError:un=>{un.target.src="https://placehold.co/150"}}):"",jsxRuntimeExports.jsx("span",{children:en.sceneSettings.textSettings.featuresTabHeadingText})]})]}),jsxRuntimeExports.jsxs("div",{className:"sideMenuContent",children:[jsxRuntimeExports.jsx(PreviewCart,{stores:kt}),jsxRuntimeExports.jsx(InfoModal,{stores:kt,visible:qt===0}),jsxRuntimeExports.jsx(BuildUI,{stores:kt,sideMenuOpen:!0,identifier:"buildUI-desktop",visible:qt===0}),jsxRuntimeExports.jsx("div",{className:"variantContainer",children:sn.map(un=>{if(un=="color"){if(rn.color.length>0)return jsxRuntimeExports.jsx(Color,{stores:kt,visible:qt===1},"colourTab-desktop")}else if(un=="geometryVariants"&&rn.geometryVariants.length>0)return jsxRuntimeExports.jsx(GeometryVariants,{stores:kt,visible:qt===1},"geometryVariantsTab-desktop")})}),jsxRuntimeExports.jsx(ProductFeaturesUI,{stores:kt,sideMenuOpen:!0,identifier:"featuresTab-desktop",visible:qt===2})]})]}),jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:nn?-1:0,"aria-hidden":nn,id:"preview-cart-button",className:"bottomBar right button","aria-label":"Toggle Preview Cart Button",onClick:()=>{Xt()},children:[jsxRuntimeExports.jsxs("div",{className:"bottomBarChildDiv",children:[jsxRuntimeExports.jsx("span",{children:en.sceneSettings.textSettings.reviewButtonText}),jsxRuntimeExports.jsx("div",{className:"cartNumber",children:Kt()})]}),jsxRuntimeExports.jsx("div",{className:"reviewButtonParentDiv",children:jsxRuntimeExports.jsx("div",{className:"button reviewButton".concat(Qt===!0?" hide":""),children:jsxRuntimeExports.jsxs("div",{className:"cartTotalText",children:[`${Yt}${numberWithCommas(kt.cartStore.getState().cartTotalPrice)}`,kt.cartStore.getState().cartTotalCompareAtPrice!=0&&kt.cartStore.getState().cartTotalCompareAtPrice>kt.cartStore.getState().cartTotalPrice&&jsxRuntimeExports.jsx("strike",{children:`${Yt}${numberWithCommas(kt.cartStore.getState().cartTotalCompareAtPrice)}`})]})})})]}),jsxRuntimeExports.jsx("div",{className:"reviewButtonSibling"})]})},PreviewCartMobile=({stores:kt,previewCartModalOpen:_e,togglePreviewCartModal:Dt,PUBLIC_DESIGN_ASSETS_ENDPOINT:Vt,cart:Gt})=>{const zt=kt.uiSceneStore(Xt=>Xt.disableCart),jt=kt.uiSceneStore(Xt=>Xt.CORE_API),Ht=kt.uiSceneStore(Xt=>Xt.cartMessage),Wt=kt.uiSceneStore(Xt=>Xt.isScreenPortrait),qt=reactExports.useCallback(async()=>{await jt.checkoutAsync()},[]);return jsxRuntimeExports.jsxs("div",{className:_e?"previewCartModal mobile open":"previewCartModal mobile",tabIndex:Wt?0:-1,"aria-hidden":!Wt,children:[jsxRuntimeExports.jsx("div",{className:"closeButton",role:"button",tabIndex:_e?0:-1,"aria-hidden":!_e,"aria-label":"Close Button",id:"preview-cart-close-button",onClick:()=>{Dt()},children:jsxRuntimeExports.jsx("img",{alt:"Close",src:Vt+"/Icon/X.svg",onError:Xt=>{Xt.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("h2",{className:"cartTitle",children:jt.sceneSettings.textSettings.cartHeadingText}),Gt.length>0?jsxRuntimeExports.jsxs("div",{className:"previewCartContentParentDiv",children:[jsxRuntimeExports.jsx("div",{className:"previewCartContent",children:Gt.map(function(Xt,Kt){return jsxRuntimeExports.jsx(CartItem,{stores:kt,itemObject:Xt,index:Kt},`Cart Item - ${Kt}`)})}),jsxRuntimeExports.jsxs("div",{className:"previewCartButtonContainer".concat(zt===!0?" hide":""),children:[Ht&&jsxRuntimeExports.jsx("div",{className:"cartMessageDiv",children:jsxRuntimeExports.jsx("span",{children:Ht})}),jsxRuntimeExports.jsxs("button",{className:"checkoutButton",role:"button",tabIndex:zt?-1:0,"aria-hidden":zt,"aria-label":"Click to checkout the cart",onClick:qt,children:[jsxRuntimeExports.jsx("span",{children:jt.sceneSettings.addToCartCTAText}),jsxRuntimeExports.jsx("img",{alt:"Right",src:Vt+"/Icon/ArrowRight.svg",onError:Xt=>{Xt.target.src="https://placehold.co/150"}})]})]})]}):jsxRuntimeExports.jsx("h3",{className:"cartEmptyText",children:"Your cart is currently empty"})]})},ContextMenuDesktop=({stores:kt,selectedItemData:_e,colors:Dt,colorsCategoryName:Vt})=>{const Gt=kt.uiSceneStore(en=>en.CORE_API),[zt,jt]=reactExports.useState(null),[Ht,Wt]=reactExports.useState(0),[qt,Xt]=reactExports.useState(0),[Kt,Yt]=reactExports.useState(null),Zt=reactExports.useRef(null),Jt=reactExports.useRef(null),nn=kt.uiSceneStore(en=>en.dialogPopupOpen),rn=kt.uiSceneStore(en=>en.isScreenPortrait),Qt=reactExports.useCallback(()=>{Gt.fireEvent(Gt.EVENTS.UI.ContextMenu_InfoBtnClicked,_e)},[_e]);return reactExports.useEffect(()=>{Yt(null),_e&&(Yt({..._e}),_e.overrideVariant?jt(_e.overrideVariant):jt(_e.currentVariant))},[_e]),reactExports.useEffect(()=>{if(!Kt||!Jt.current||!_e||!Zt.current)return;const en=Gt.getCanvasSize();let tn=_e.offsetX+Zt.current.children[0].clientWidth,sn=_e.offsetY+Zt.current.children[0].clientHeight,cn=en.width-tn;cn<0?Wt(_e.offsetX+cn-10):Wt(_e.offsetX);let un=en.height-sn;un<0?Xt(_e.offsetY+un-10):Xt(_e.offsetY),Jt.current.focus()},[Kt,_e,Zt]),jsxRuntimeExports.jsx("div",{ref:Zt,tabIndex:rn?-1:0,"aria-hidden":rn,children:_e!==null&&jsxRuntimeExports.jsx("div",{className:"contextMenuParent interactable",style:{left:Ht+"px",top:qt+"px"},children:jsxRuntimeExports.jsx("div",{className:"contextContentDiv",children:jsxRuntimeExports.jsxs("div",{className:"contextContent",children:[jsxRuntimeExports.jsxs("div",{className:"contextContentChildDiv",children:[jsxRuntimeExports.jsxs("div",{className:"contextNameContent",children:[jsxRuntimeExports.jsx("h3",{children:_e.itemData.name}),jsxRuntimeExports.jsx("img",{ref:Jt,role:"button","aria-hidden":nn,tabIndex:nn?-1:0,className:"infoButton",alt:"Info","aria-label":"Info",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Info.svg",onClick:()=>Qt(),onError:en=>{en.target.src="https://placehold.co/150"}})]}),jsxRuntimeExports.jsx("div",{role:"button",tabIndex:nn?-1:0,"aria-hidden":nn,"aria-label":"Close",className:"closeContainer closeButton",onClick:()=>Gt.exitSelectedItem(),children:jsxRuntimeExports.jsx("img",{alt:"Close",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/X.svg",onError:en=>{en.target.src="https://placehold.co/150"}})})]}),Dt.length>0&&Gt.sceneSettings.disableLocalColorOverride===!1&&jsxRuntimeExports.jsxs("div",{className:"contextColorContent",children:[jsxRuntimeExports.jsxs("span",{className:"colorSwatchTitle",children:["Select ",Vt]}),jsxRuntimeExports.jsx("div",{className:"color-grid color-variants-selection",children:Dt.map((en,tn)=>jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:nn?-1:0,"aria-hidden":nn,"aria-label":"Select "+en.label,onClick:async()=>{await Gt.overrideSelectedItemMaterial(en.id),jt(en.id)},className:zt==en.id?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnailContainer",children:jsxRuntimeExports.jsxs("div",{className:"colorThumbnail",children:[jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Checkmark",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:sn=>{sn.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("img",{alt:en.label,className:"contextColorThumbnail",src:Gt.getResolvedAssetUrl(en.thumbnail),onError:sn=>{sn.target.src="https://placehold.co/150"}})]})}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsxs("p",{className:"truncate colorDetailsLabel",children:[capitalize$1(en.label),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"redText",children:en.outOfStock?"OUT OF STOCK":jsxRuntimeExports.jsx("br",{})})]})})]},"Color-"+tn))})]}),jsxRuntimeExports.jsxs("div",{className:"contextButtons",children:[Gt.canSelectedItemDrag()&&jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:nn?-1:0,"aria-hidden":nn,"aria-label":"Remove Button",onClick:()=>{Gt.doesSelectedItemHasAttachedDependency()?Gt.triggerItemRemoveModal(_e.itemData.guid):Gt.removeSelectedItem()},children:[jsxRuntimeExports.jsx("img",{src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/TrashSimple.svg",alt:"Remove",onError:en=>{en.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:"Remove"})]}),Gt.canSelectedItemRotate()&&jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Rotate Button",tabIndex:nn?-1:0,"aria-hidden":nn,onClick:()=>Gt.rotateSelectedItem(),children:[jsxRuntimeExports.jsx("img",{alt:"Rotate",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Rotate.svg",onError:en=>{en.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:"Rotate"})]})]})]})})})})},ContextMenuMobile=({stores:kt,selectedItemData:_e,contextMenuDrawerOpen:Dt,dismissContextMenuDrawer:Vt,colors:Gt,colorsCategoryName:zt})=>{const[jt,Ht]=reactExports.useState(Dt),Wt=reactExports.useRef(null),qt=kt.uiSceneStore(Jt=>Jt.CORE_API),Xt=kt.uiSceneStore(Jt=>Jt.isScreenPortrait),[Kt,Yt]=reactExports.useState(null);reactExports.useEffect(()=>{Wt.current&&Wt.current.addEventListener("drawerClosed",()=>{Vt()})},[Wt]),reactExports.useEffect(()=>(Ht(Dt),()=>{}),[Dt]),reactExports.useEffect(()=>{qt.isMobile&&kt.uiSceneStore.setState({dialogPopupOpen:jt})},[jt]),reactExports.useEffect(()=>{!_e||!_e.itemData||(_e.overrideVariant?Yt(_e.overrideVariant):Yt(_e.currentVariant))},[_e]);async function Zt(){qt.doesSelectedItemHasAttachedDependency()?qt.triggerItemRemoveModal(_e.itemData.guid):(await qt.removeSelectedItem(),Vt())}return jsxRuntimeExports.jsx(BottomDrawer,{stores:kt,id:"contextDrawer",ref:Wt,open:`${jt}`,"initial-screen-coverage":"60%",children:jsxRuntimeExports.jsx("div",{className:"contextMenuDrawer epigraphDrawer",slot:"bottom-drawer-content",tabIndex:Xt?0:-1,"aria-hidden":!Xt,children:jsxRuntimeExports.jsxs("div",{className:"contextMenuParent interactable",children:[jsxRuntimeExports.jsx("div",{className:"contextContent",children:_e&&_e.itemData?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{className:"contextContentNameDiv",children:jsxRuntimeExports.jsx("h3",{children:_e.itemData.name})})}):""}),Gt.length>0&&qt.sceneSettings.disableLocalColorOverride===!1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("p",{className:"colorSwatchTitle",children:["Select ",zt]}),jsxRuntimeExports.jsx("div",{className:"color-grid color-variants-selection",children:Gt.map((Jt,nn)=>jsxRuntimeExports.jsxs("div",{role:"button","aria-label":"Select "+Jt.label,tabIndex:jt?0:-1,"aria-hidden":!jt,onClick:async()=>{await kt.uiSceneStore.getState().CORE_API.overrideSelectedItemMaterial(Jt.id),Yt(Jt.id)},className:Kt==Jt.id?"colorSelector selected":"colorSelector",children:[jsxRuntimeExports.jsxs("div",{className:"colorThumbnailContainer",children:[jsxRuntimeExports.jsx("div",{className:"colorThumbnail",children:jsxRuntimeExports.jsx("img",{alt:Jt.label,className:"colorThumbnailImg",src:qt.getResolvedAssetUrl(Jt.thumbnail),onError:rn=>{rn.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("div",{className:"checkMark",children:jsxRuntimeExports.jsx("img",{alt:"Check",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Check.svg",onError:rn=>{rn.target.src="https://placehold.co/150"}})})]}),jsxRuntimeExports.jsx("div",{className:"colorDetails",children:jsxRuntimeExports.jsxs("p",{className:"truncate colorDetailsLabel",children:[capitalize$1(Jt.label),jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("span",{className:"redText",children:Jt.outOfStock?"OUT OF STOCK":jsxRuntimeExports.jsx("br",{})})]})})]},"Color-"+nn))})]}),jsxRuntimeExports.jsxs("div",{className:"contextButtons",children:[qt.canSelectedItemBeRemoved()&&jsxRuntimeExports.jsxs("button",{role:"button",tabIndex:jt?0:-1,"aria-hidden":!jt,"aria-label":"Remove Button",onClick:()=>Zt(),children:[jsxRuntimeExports.jsx("img",{alt:"Remove",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Trash.svg",onError:Jt=>{Jt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:"Remove"})]}),qt.canSelectedItemRotate()&&jsxRuntimeExports.jsxs("button",{role:"button",tabIndex:jt?0:-1,"aria-hidden":!jt,"aria-label":"Rotate Button",onClick:()=>qt.rotateSelectedItem(),children:[jsxRuntimeExports.jsx("img",{alt:"Rotate",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/Rotate.svg",onError:Jt=>{Jt.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("span",{children:"Rotate"})]})]})]})})})},ContextMenu=({stores:kt,selectedItemData:_e,contextMenuOpen:Dt,dismissContextMenuDrawer:Vt})=>{const Gt=kt.uiSceneStore(Zt=>Zt.CORE_API),[zt,jt]=reactExports.useState(!1),[Ht,Wt]=reactExports.useState([]),[qt,Xt]=reactExports.useState(""),Kt=kt.uiSceneStore(Zt=>Zt.inventoryData);reactExports.useEffect(()=>(jt(Dt),()=>{}),[Dt]),reactExports.useEffect(()=>{if(Wt([]),_e===void 0||!_e.itemData||Gt===null)return;const Zt=Gt.getSelectedItemColors(),Jt=Gt.getInventoryInfo()[_e.itemData.skuID];if(Zt.map(rn=>{rn.outOfStock=!1,Jt[rn.id].countAvailable==0&&(rn.outOfStock=!0)}),Wt(Zt),Zt.length===0)return;const nn=Gt.categoryData;nn.color&&nn.color.map(rn=>{rn.looks.map(Qt=>{Qt===Zt[0].id&&Xt(rn.label)})})},[_e]),reactExports.useEffect(()=>{Kt!=null&&Yt(Kt)},[Kt]);const Yt=reactExports.useCallback(Zt=>{const Jt=Gt.getSelectedItemData();if(Jt==null)return;const nn=Gt.getSelectedItemColors(),rn=Zt[Jt.itemData.skuID];nn.map(Qt=>{Qt.outOfStock=!1,rn[Qt.id].countAvailable==0&&(Qt.outOfStock=!0)}),Wt(nn)},[_e]);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Gt.isMobile&&window.innerWidth<=768?jsxRuntimeExports.jsx(ContextMenuMobile,{stores:kt,selectedItemData:_e,contextMenuDrawerOpen:zt,dismissContextMenuDrawer:Vt,colors:Ht,colorsCategoryName:qt}):zt&&jsxRuntimeExports.jsx(ContextMenuDesktop,{stores:kt,contextMenuDesktopOpen:zt,selectedItemData:_e,colors:Ht,colorsCategoryName:qt})})},FullScreenModal=reactExports.forwardRef((kt,_e)=>{const Dt=reactExports.useRef(null),Vt=reactExports.useRef(null);reactExports.useEffect(()=>{_e.current&&Vt.current&&Dt.current&&(_e.current.show=Ht=>zt(),_e.current.hide=Ht=>jt(),_e.current.mainContainer=Dt.current,_e.current.closeButton=Vt.current,Gt())},[_e,Vt,Dt]);const Gt=()=>{Vt.current.addEventListener("click",()=>{kt.onExit&&kt.onExit(),jt()})},zt=()=>{Dt.current.classList.add("show"),kt.stores.uiSceneStore.setState({dialogPopupOpen:!0}),Vt.current.focus()},jt=()=>{kt.stores.uiSceneStore.setState({dialogPopupOpen:!1}),Dt.current.classList.remove("show")};return jsxRuntimeExports.jsx("div",{id:kt.id,ref:_e,className:kt.className,children:jsxRuntimeExports.jsx("div",{"aria-hidden":!kt.open,ref:Dt,className:"full-screen-modal-container",children:jsxRuntimeExports.jsxs("div",{className:"modal-content-container",children:[jsxRuntimeExports.jsx("div",{role:"button","aria-hidden":!kt.open,"aria-label":"Close Button",tabIndex:kt.open?0:-1,ref:Vt,className:"close-button",children:jsxRuntimeExports.jsx("img",{alt:"Close",src:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/X.svg",onError:Ht=>{Ht.target.src="https://placehold.co/150"}})}),jsxRuntimeExports.jsx("slot",{name:"full-screen-dialog-content",children:kt.children})]})})})});var lottie$1={exports:{}};(function(module,exports){typeof navigator<"u"&&function(kt,_e){module.exports=_e()}(commonjsGlobal,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(_e){_useWebWorker=!!_e},getWebWorker=function(){return _useWebWorker},setLocationHref=function(_e){locationHref=_e},getLocationHref=function(){return locationHref};function createTag(kt){return document.createElement(kt)}function extendPrototype(kt,_e){var Dt,Vt=kt.length,Gt;for(Dt=0;Dt<Vt;Dt+=1){Gt=kt[Dt].prototype;for(var zt in Gt)Object.prototype.hasOwnProperty.call(Gt,zt)&&(_e.prototype[zt]=Gt[zt])}}function getDescriptor(kt,_e){return Object.getOwnPropertyDescriptor(kt,_e)}function createProxyFunction(kt){function _e(){}return _e.prototype=kt,_e}var audioControllerFactory=function(){function kt(_e){this.audios=[],this.audioFactory=_e,this._volume=1,this._isMuted=!1}return kt.prototype={addAudio:function(Dt){this.audios.push(Dt)},pause:function(){var Dt,Vt=this.audios.length;for(Dt=0;Dt<Vt;Dt+=1)this.audios[Dt].pause()},resume:function(){var Dt,Vt=this.audios.length;for(Dt=0;Dt<Vt;Dt+=1)this.audios[Dt].resume()},setRate:function(Dt){var Vt,Gt=this.audios.length;for(Vt=0;Vt<Gt;Vt+=1)this.audios[Vt].setRate(Dt)},createAudio:function(Dt){return this.audioFactory?this.audioFactory(Dt):window.Howl?new window.Howl({src:[Dt]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(Dt){this.audioFactory=Dt},setVolume:function(Dt){this._volume=Dt,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var Dt,Vt=this.audios.length;for(Dt=0;Dt<Vt;Dt+=1)this.audios[Dt].volume(this._volume*(this._isMuted?0:1))}},function(){return new kt}}(),createTypedArray=function(){function kt(Dt,Vt){var Gt=0,zt=[],jt;switch(Dt){case"int16":case"uint8c":jt=1;break;default:jt=1.1;break}for(Gt=0;Gt<Vt;Gt+=1)zt.push(jt);return zt}function _e(Dt,Vt){return Dt==="float32"?new Float32Array(Vt):Dt==="int16"?new Int16Array(Vt):Dt==="uint8c"?new Uint8ClampedArray(Vt):kt(Dt,Vt)}return typeof Uint8ClampedArray=="function"&&typeof Float32Array=="function"?_e:kt}();function createSizedArray(kt){return Array.apply(null,{length:kt})}function _typeof$6(kt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$6=function(Dt){return typeof Dt}:_typeof$6=function(Dt){return Dt&&typeof Symbol=="function"&&Dt.constructor===Symbol&&Dt!==Symbol.prototype?"symbol":typeof Dt},_typeof$6(kt)}var subframeEnabled=!0,expressionsPlugin=null,expressionsInterfaces=null,idPrefix$1="",isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),bmPow=Math.pow,bmSqrt=Math.sqrt,bmFloor=Math.floor,bmMax=Math.max,bmMin=Math.min,BMMath={};(function(){var kt=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],_e,Dt=kt.length;for(_e=0;_e<Dt;_e+=1)BMMath[kt[_e]]=Math[kt[_e]]})(),BMMath.random=Math.random,BMMath.abs=function(kt){var _e=_typeof$6(kt);if(_e==="object"&&kt.length){var Dt=createSizedArray(kt.length),Vt,Gt=kt.length;for(Vt=0;Vt<Gt;Vt+=1)Dt[Vt]=Math.abs(kt[Vt]);return Dt}return Math.abs(kt)};var defaultCurveSegments=150,degToRads=Math.PI/180,roundCorner=.5519;function styleDiv(kt){kt.style.position="absolute",kt.style.top=0,kt.style.left=0,kt.style.display="block",kt.style.transformOrigin="0 0",kt.style.webkitTransformOrigin="0 0",kt.style.backfaceVisibility="visible",kt.style.webkitBackfaceVisibility="visible",kt.style.transformStyle="preserve-3d",kt.style.webkitTransformStyle="preserve-3d",kt.style.mozTransformStyle="preserve-3d"}function BMEnterFrameEvent(kt,_e,Dt,Vt){this.type=kt,this.currentTime=_e,this.totalTime=Dt,this.direction=Vt<0?-1:1}function BMCompleteEvent(kt,_e){this.type=kt,this.direction=_e<0?-1:1}function BMCompleteLoopEvent(kt,_e,Dt,Vt){this.type=kt,this.currentLoop=Dt,this.totalLoops=_e,this.direction=Vt<0?-1:1}function BMSegmentStartEvent(kt,_e,Dt){this.type=kt,this.firstFrame=_e,this.totalFrames=Dt}function BMDestroyEvent(kt,_e){this.type=kt,this.target=_e}function BMRenderFrameErrorEvent(kt,_e){this.type="renderFrameError",this.nativeError=kt,this.currentTime=_e}function BMConfigErrorEvent(kt){this.type="configError",this.nativeError=kt}var createElementID=function(){var kt=0;return function(){return kt+=1,idPrefix$1+"__lottie_element_"+kt}}();function HSVtoRGB(kt,_e,Dt){var Vt,Gt,zt,jt,Ht,Wt,qt,Xt;switch(jt=Math.floor(kt*6),Ht=kt*6-jt,Wt=Dt*(1-_e),qt=Dt*(1-Ht*_e),Xt=Dt*(1-(1-Ht)*_e),jt%6){case 0:Vt=Dt,Gt=Xt,zt=Wt;break;case 1:Vt=qt,Gt=Dt,zt=Wt;break;case 2:Vt=Wt,Gt=Dt,zt=Xt;break;case 3:Vt=Wt,Gt=qt,zt=Dt;break;case 4:Vt=Xt,Gt=Wt,zt=Dt;break;case 5:Vt=Dt,Gt=Wt,zt=qt;break}return[Vt,Gt,zt]}function RGBtoHSV(kt,_e,Dt){var Vt=Math.max(kt,_e,Dt),Gt=Math.min(kt,_e,Dt),zt=Vt-Gt,jt,Ht=Vt===0?0:zt/Vt,Wt=Vt/255;switch(Vt){case Gt:jt=0;break;case kt:jt=_e-Dt+zt*(_e<Dt?6:0),jt/=6*zt;break;case _e:jt=Dt-kt+zt*2,jt/=6*zt;break;case Dt:jt=kt-_e+zt*4,jt/=6*zt;break}return[jt,Ht,Wt]}function addSaturationToRGB(kt,_e){var Dt=RGBtoHSV(kt[0]*255,kt[1]*255,kt[2]*255);return Dt[1]+=_e,Dt[1]>1?Dt[1]=1:Dt[1]<=0&&(Dt[1]=0),HSVtoRGB(Dt[0],Dt[1],Dt[2])}function addBrightnessToRGB(kt,_e){var Dt=RGBtoHSV(kt[0]*255,kt[1]*255,kt[2]*255);return Dt[2]+=_e,Dt[2]>1?Dt[2]=1:Dt[2]<0&&(Dt[2]=0),HSVtoRGB(Dt[0],Dt[1],Dt[2])}function addHueToRGB(kt,_e){var Dt=RGBtoHSV(kt[0]*255,kt[1]*255,kt[2]*255);return Dt[0]+=_e/360,Dt[0]>1?Dt[0]-=1:Dt[0]<0&&(Dt[0]+=1),HSVtoRGB(Dt[0],Dt[1],Dt[2])}var rgbToHex=function(){var kt=[],_e,Dt;for(_e=0;_e<256;_e+=1)Dt=_e.toString(16),kt[_e]=Dt.length===1?"0"+Dt:Dt;return function(Vt,Gt,zt){return Vt<0&&(Vt=0),Gt<0&&(Gt=0),zt<0&&(zt=0),"#"+kt[Vt]+kt[Gt]+kt[zt]}}(),setSubframeEnabled=function(_e){subframeEnabled=!!_e},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(_e){expressionsPlugin=_e},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(_e){expressionsInterfaces=_e},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(_e){defaultCurveSegments=_e},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(_e){idPrefix$1=_e};function createNS(kt){return document.createElementNS(svgNS,kt)}function _typeof$5(kt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function(Dt){return typeof Dt}:_typeof$5=function(Dt){return Dt&&typeof Symbol=="function"&&Dt.constructor===Symbol&&Dt!==Symbol.prototype?"symbol":typeof Dt},_typeof$5(kt)}var dataManager=function(){var kt=1,_e=[],Dt,Vt,Gt={onmessage:function(){},postMessage:function(Zt){Dt({data:Zt})}},zt={postMessage:function(Zt){Gt.onmessage({data:Zt})}};function jt(Yt){if(window.Worker&&window.Blob&&getWebWorker()){var Zt=new Blob(["var _workerSelf = self; self.onmessage = ",Yt.toString()],{type:"text/javascript"}),Jt=URL.createObjectURL(Zt);return new Worker(Jt)}return Dt=Yt,Gt}function Ht(){Vt||(Vt=jt(function(Zt){function Jt(){function rn(An,Tn){var Cn,yn,Sn=An.length,wn,xn,Rn,Ln;for(yn=0;yn<Sn;yn+=1)if(Cn=An[yn],"ks"in Cn&&!Cn.completed){if(Cn.completed=!0,Cn.hasMask){var Nn=Cn.masksProperties;for(xn=Nn.length,wn=0;wn<xn;wn+=1)if(Nn[wn].pt.k.i)cn(Nn[wn].pt.k);else for(Ln=Nn[wn].pt.k.length,Rn=0;Rn<Ln;Rn+=1)Nn[wn].pt.k[Rn].s&&cn(Nn[wn].pt.k[Rn].s[0]),Nn[wn].pt.k[Rn].e&&cn(Nn[wn].pt.k[Rn].e[0])}Cn.ty===0?(Cn.layers=tn(Cn.refId,Tn),rn(Cn.layers,Tn)):Cn.ty===4?sn(Cn.shapes):Cn.ty===5&&_n(Cn)}}function Qt(An,Tn){if(An){var Cn=0,yn=An.length;for(Cn=0;Cn<yn;Cn+=1)An[Cn].t===1&&(An[Cn].data.layers=tn(An[Cn].data.refId,Tn),rn(An[Cn].data.layers,Tn))}}function en(An,Tn){for(var Cn=0,yn=Tn.length;Cn<yn;){if(Tn[Cn].id===An)return Tn[Cn];Cn+=1}return null}function tn(An,Tn){var Cn=en(An,Tn);return Cn?Cn.layers.__used?JSON.parse(JSON.stringify(Cn.layers)):(Cn.layers.__used=!0,Cn.layers):null}function sn(An){var Tn,Cn=An.length,yn,Sn;for(Tn=Cn-1;Tn>=0;Tn-=1)if(An[Tn].ty==="sh")if(An[Tn].ks.k.i)cn(An[Tn].ks.k);else for(Sn=An[Tn].ks.k.length,yn=0;yn<Sn;yn+=1)An[Tn].ks.k[yn].s&&cn(An[Tn].ks.k[yn].s[0]),An[Tn].ks.k[yn].e&&cn(An[Tn].ks.k[yn].e[0]);else An[Tn].ty==="gr"&&sn(An[Tn].it)}function cn(An){var Tn,Cn=An.i.length;for(Tn=0;Tn<Cn;Tn+=1)An.i[Tn][0]+=An.v[Tn][0],An.i[Tn][1]+=An.v[Tn][1],An.o[Tn][0]+=An.v[Tn][0],An.o[Tn][1]+=An.v[Tn][1]}function un(An,Tn){var Cn=Tn?Tn.split("."):[100,100,100];return An[0]>Cn[0]?!0:Cn[0]>An[0]?!1:An[1]>Cn[1]?!0:Cn[1]>An[1]?!1:An[2]>Cn[2]?!0:Cn[2]>An[2]?!1:null}var hn=function(){var An=[4,4,14];function Tn(yn){var Sn=yn.t.d;yn.t.d={k:[{s:Sn,t:0}]}}function Cn(yn){var Sn,wn=yn.length;for(Sn=0;Sn<wn;Sn+=1)yn[Sn].ty===5&&Tn(yn[Sn])}return function(yn){if(un(An,yn.v)&&(Cn(yn.layers),yn.assets)){var Sn,wn=yn.assets.length;for(Sn=0;Sn<wn;Sn+=1)yn.assets[Sn].layers&&Cn(yn.assets[Sn].layers)}}}(),fn=function(){var An=[4,7,99];return function(Tn){if(Tn.chars&&!un(An,Tn.v)){var Cn,yn=Tn.chars.length;for(Cn=0;Cn<yn;Cn+=1){var Sn=Tn.chars[Cn];Sn.data&&Sn.data.shapes&&(sn(Sn.data.shapes),Sn.data.ip=0,Sn.data.op=99999,Sn.data.st=0,Sn.data.sr=1,Sn.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},Tn.chars[Cn].t||(Sn.data.shapes.push({ty:"no"}),Sn.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}}(),pn=function(){var An=[5,7,15];function Tn(yn){var Sn=yn.t.p;typeof Sn.a=="number"&&(Sn.a={a:0,k:Sn.a}),typeof Sn.p=="number"&&(Sn.p={a:0,k:Sn.p}),typeof Sn.r=="number"&&(Sn.r={a:0,k:Sn.r})}function Cn(yn){var Sn,wn=yn.length;for(Sn=0;Sn<wn;Sn+=1)yn[Sn].ty===5&&Tn(yn[Sn])}return function(yn){if(un(An,yn.v)&&(Cn(yn.layers),yn.assets)){var Sn,wn=yn.assets.length;for(Sn=0;Sn<wn;Sn+=1)yn.assets[Sn].layers&&Cn(yn.assets[Sn].layers)}}}(),dn=function(){var An=[4,1,9];function Tn(yn){var Sn,wn=yn.length,xn,Rn;for(Sn=0;Sn<wn;Sn+=1)if(yn[Sn].ty==="gr")Tn(yn[Sn].it);else if(yn[Sn].ty==="fl"||yn[Sn].ty==="st")if(yn[Sn].c.k&&yn[Sn].c.k[0].i)for(Rn=yn[Sn].c.k.length,xn=0;xn<Rn;xn+=1)yn[Sn].c.k[xn].s&&(yn[Sn].c.k[xn].s[0]/=255,yn[Sn].c.k[xn].s[1]/=255,yn[Sn].c.k[xn].s[2]/=255,yn[Sn].c.k[xn].s[3]/=255),yn[Sn].c.k[xn].e&&(yn[Sn].c.k[xn].e[0]/=255,yn[Sn].c.k[xn].e[1]/=255,yn[Sn].c.k[xn].e[2]/=255,yn[Sn].c.k[xn].e[3]/=255);else yn[Sn].c.k[0]/=255,yn[Sn].c.k[1]/=255,yn[Sn].c.k[2]/=255,yn[Sn].c.k[3]/=255}function Cn(yn){var Sn,wn=yn.length;for(Sn=0;Sn<wn;Sn+=1)yn[Sn].ty===4&&Tn(yn[Sn].shapes)}return function(yn){if(un(An,yn.v)&&(Cn(yn.layers),yn.assets)){var Sn,wn=yn.assets.length;for(Sn=0;Sn<wn;Sn+=1)yn.assets[Sn].layers&&Cn(yn.assets[Sn].layers)}}}(),mn=function(){var An=[4,4,18];function Tn(yn){var Sn,wn=yn.length,xn,Rn;for(Sn=wn-1;Sn>=0;Sn-=1)if(yn[Sn].ty==="sh")if(yn[Sn].ks.k.i)yn[Sn].ks.k.c=yn[Sn].closed;else for(Rn=yn[Sn].ks.k.length,xn=0;xn<Rn;xn+=1)yn[Sn].ks.k[xn].s&&(yn[Sn].ks.k[xn].s[0].c=yn[Sn].closed),yn[Sn].ks.k[xn].e&&(yn[Sn].ks.k[xn].e[0].c=yn[Sn].closed);else yn[Sn].ty==="gr"&&Tn(yn[Sn].it)}function Cn(yn){var Sn,wn,xn=yn.length,Rn,Ln,Nn,Fn;for(wn=0;wn<xn;wn+=1){if(Sn=yn[wn],Sn.hasMask){var Pn=Sn.masksProperties;for(Ln=Pn.length,Rn=0;Rn<Ln;Rn+=1)if(Pn[Rn].pt.k.i)Pn[Rn].pt.k.c=Pn[Rn].cl;else for(Fn=Pn[Rn].pt.k.length,Nn=0;Nn<Fn;Nn+=1)Pn[Rn].pt.k[Nn].s&&(Pn[Rn].pt.k[Nn].s[0].c=Pn[Rn].cl),Pn[Rn].pt.k[Nn].e&&(Pn[Rn].pt.k[Nn].e[0].c=Pn[Rn].cl)}Sn.ty===4&&Tn(Sn.shapes)}}return function(yn){if(un(An,yn.v)&&(Cn(yn.layers),yn.assets)){var Sn,wn=yn.assets.length;for(Sn=0;Sn<wn;Sn+=1)yn.assets[Sn].layers&&Cn(yn.assets[Sn].layers)}}}();function vn(An){An.__complete||(dn(An),hn(An),fn(An),pn(An),mn(An),rn(An.layers,An.assets),Qt(An.chars,An.assets),An.__complete=!0)}function _n(An){An.t.a.length===0&&"m"in An.t.p}var En={};return En.completeData=vn,En.checkColors=dn,En.checkChars=fn,En.checkPathProperties=pn,En.checkShapes=mn,En.completeLayers=rn,En}if(zt.dataManager||(zt.dataManager=Jt()),zt.assetLoader||(zt.assetLoader=function(){function rn(en){var tn=en.getResponseHeader("content-type");return tn&&en.responseType==="json"&&tn.indexOf("json")!==-1||en.response&&_typeof$5(en.response)==="object"?en.response:en.response&&typeof en.response=="string"?JSON.parse(en.response):en.responseText?JSON.parse(en.responseText):null}function Qt(en,tn,sn,cn){var un,hn=new XMLHttpRequest;try{hn.responseType="json"}catch{}hn.onreadystatechange=function(){if(hn.readyState===4)if(hn.status===200)un=rn(hn),sn(un);else try{un=rn(hn),sn(un)}catch(fn){cn&&cn(fn)}};try{hn.open(["G","E","T"].join(""),en,!0)}catch{hn.open(["G","E","T"].join(""),tn+"/"+en,!0)}hn.send()}return{load:Qt}}()),Zt.data.type==="loadAnimation")zt.assetLoader.load(Zt.data.path,Zt.data.fullPath,function(rn){zt.dataManager.completeData(rn),zt.postMessage({id:Zt.data.id,payload:rn,status:"success"})},function(){zt.postMessage({id:Zt.data.id,status:"error"})});else if(Zt.data.type==="complete"){var nn=Zt.data.animation;zt.dataManager.completeData(nn),zt.postMessage({id:Zt.data.id,payload:nn,status:"success"})}else Zt.data.type==="loadData"&&zt.assetLoader.load(Zt.data.path,Zt.data.fullPath,function(rn){zt.postMessage({id:Zt.data.id,payload:rn,status:"success"})},function(){zt.postMessage({id:Zt.data.id,status:"error"})})}),Vt.onmessage=function(Yt){var Zt=Yt.data,Jt=Zt.id,nn=_e[Jt];_e[Jt]=null,Zt.status==="success"?nn.onComplete(Zt.payload):nn.onError&&nn.onError()})}function Wt(Yt,Zt){kt+=1;var Jt="processId_"+kt;return _e[Jt]={onComplete:Yt,onError:Zt},Jt}function qt(Yt,Zt,Jt){Ht();var nn=Wt(Zt,Jt);Vt.postMessage({type:"loadAnimation",path:Yt,fullPath:window.location.origin+window.location.pathname,id:nn})}function Xt(Yt,Zt,Jt){Ht();var nn=Wt(Zt,Jt);Vt.postMessage({type:"loadData",path:Yt,fullPath:window.location.origin+window.location.pathname,id:nn})}function Kt(Yt,Zt,Jt){Ht();var nn=Wt(Zt,Jt);Vt.postMessage({type:"complete",animation:Yt,id:nn})}return{loadAnimation:qt,loadData:Xt,completeAnimation:Kt}}(),ImagePreloader=function(){var kt=function(){var Qt=createTag("canvas");Qt.width=1,Qt.height=1;var en=Qt.getContext("2d");return en.fillStyle="rgba(0,0,0,0)",en.fillRect(0,0,1,1),Qt}();function _e(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function Dt(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function Vt(Qt,en,tn){var sn="";if(Qt.e)sn=Qt.p;else if(en){var cn=Qt.p;cn.indexOf("images/")!==-1&&(cn=cn.split("/")[1]),sn=en+cn}else sn=tn,sn+=Qt.u?Qt.u:"",sn+=Qt.p;return sn}function Gt(Qt){var en=0,tn=setInterval(function(){var sn=Qt.getBBox();(sn.width||en>500)&&(this._imageLoaded(),clearInterval(tn)),en+=1}.bind(this),50)}function zt(Qt){var en=Vt(Qt,this.assetsPath,this.path),tn=createNS("image");isSafari?this.testImageLoaded(tn):tn.addEventListener("load",this._imageLoaded,!1),tn.addEventListener("error",function(){sn.img=kt,this._imageLoaded()}.bind(this),!1),tn.setAttributeNS("http://www.w3.org/1999/xlink","href",en),this._elementHelper.append?this._elementHelper.append(tn):this._elementHelper.appendChild(tn);var sn={img:tn,assetData:Qt};return sn}function jt(Qt){var en=Vt(Qt,this.assetsPath,this.path),tn=createTag("img");tn.crossOrigin="anonymous",tn.addEventListener("load",this._imageLoaded,!1),tn.addEventListener("error",function(){sn.img=kt,this._imageLoaded()}.bind(this),!1),tn.src=en;var sn={img:tn,assetData:Qt};return sn}function Ht(Qt){var en={assetData:Qt},tn=Vt(Qt,this.assetsPath,this.path);return dataManager.loadData(tn,function(sn){en.img=sn,this._footageLoaded()}.bind(this),function(){en.img={},this._footageLoaded()}.bind(this)),en}function Wt(Qt,en){this.imagesLoadedCb=en;var tn,sn=Qt.length;for(tn=0;tn<sn;tn+=1)Qt[tn].layers||(!Qt[tn].t||Qt[tn].t==="seq"?(this.totalImages+=1,this.images.push(this._createImageData(Qt[tn]))):Qt[tn].t===3&&(this.totalFootages+=1,this.images.push(this.createFootageData(Qt[tn]))))}function qt(Qt){this.path=Qt||""}function Xt(Qt){this.assetsPath=Qt||""}function Kt(Qt){for(var en=0,tn=this.images.length;en<tn;){if(this.images[en].assetData===Qt)return this.images[en].img;en+=1}return null}function Yt(){this.imagesLoadedCb=null,this.images.length=0}function Zt(){return this.totalImages===this.loadedAssets}function Jt(){return this.totalFootages===this.loadedFootagesCount}function nn(Qt,en){Qt==="svg"?(this._elementHelper=en,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}function rn(){this._imageLoaded=_e.bind(this),this._footageLoaded=Dt.bind(this),this.testImageLoaded=Gt.bind(this),this.createFootageData=Ht.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return rn.prototype={loadAssets:Wt,setAssetsPath:Xt,setPath:qt,loadedImages:Zt,loadedFootages:Jt,destroy:Yt,getAsset:Kt,createImgData:jt,createImageData:zt,imageLoaded:_e,footageLoaded:Dt,setCacheType:nn},rn}();function BaseEvent(){}BaseEvent.prototype={triggerEvent:function(_e,Dt){if(this._cbs[_e])for(var Vt=this._cbs[_e],Gt=0;Gt<Vt.length;Gt+=1)Vt[Gt](Dt)},addEventListener:function(_e,Dt){return this._cbs[_e]||(this._cbs[_e]=[]),this._cbs[_e].push(Dt),function(){this.removeEventListener(_e,Dt)}.bind(this)},removeEventListener:function(_e,Dt){if(!Dt)this._cbs[_e]=null;else if(this._cbs[_e]){for(var Vt=0,Gt=this._cbs[_e].length;Vt<Gt;)this._cbs[_e][Vt]===Dt&&(this._cbs[_e].splice(Vt,1),Vt-=1,Gt-=1),Vt+=1;this._cbs[_e].length||(this._cbs[_e]=null)}}};var markerParser=function(){function kt(_e){for(var Dt=_e.split(`\r
|
|
3942
3942
|
`),Vt={},Gt,zt=0,jt=0;jt<Dt.length;jt+=1)Gt=Dt[jt].split(":"),Gt.length===2&&(Vt[Gt[0]]=Gt[1].trim(),zt+=1);if(zt===0)throw new Error;return Vt}return function(_e){for(var Dt=[],Vt=0;Vt<_e.length;Vt+=1){var Gt=_e[Vt],zt={time:Gt.tm,duration:Gt.dr};try{zt.payload=JSON.parse(_e[Vt].cm)}catch{try{zt.payload=kt(_e[Vt].cm)}catch{zt.payload={name:_e[Vt].cm}}}Dt.push(zt)}return Dt}}(),ProjectInterface=function(){function kt(_e){this.compositions.push(_e)}return function(){function _e(Dt){for(var Vt=0,Gt=this.compositions.length;Vt<Gt;){if(this.compositions[Vt].data&&this.compositions[Vt].data.nm===Dt)return this.compositions[Vt].prepareFrame&&this.compositions[Vt].data.xt&&this.compositions[Vt].prepareFrame(this.currentFrame),this.compositions[Vt].compInterface;Vt+=1}return null}return _e.compositions=[],_e.currentFrame=0,_e.registerComposition=kt,_e}}(),renderers={},registerRenderer=function(_e,Dt){renderers[_e]=Dt};function getRenderer(kt){return renderers[kt]}function getRegisteredRenderer(){if(renderers.canvas)return"canvas";for(var kt in renderers)if(renderers[kt])return kt;return""}function _typeof$4(kt){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$4=function(Dt){return typeof Dt}:_typeof$4=function(Dt){return Dt&&typeof Symbol=="function"&&Dt.constructor===Symbol&&Dt!==Symbol.prototype?"symbol":typeof Dt},_typeof$4(kt)}var AnimationItem=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=createElementID(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=getSubframeEnabled(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=ProjectInterface(),this.imagePreloader=new ImagePreloader,this.audioController=audioControllerFactory(),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new BMEnterFrameEvent("drawnFrame",0,0,0),this.expressionsPlugin=getExpressionsPlugin()};extendPrototype([BaseEvent],AnimationItem),AnimationItem.prototype.setParams=function(kt){(kt.wrapper||kt.container)&&(this.wrapper=kt.wrapper||kt.container);var _e="svg";kt.animType?_e=kt.animType:kt.renderer&&(_e=kt.renderer);var Dt=getRenderer(_e);this.renderer=new Dt(this,kt.rendererSettings),this.imagePreloader.setCacheType(_e,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=_e,kt.loop===""||kt.loop===null||kt.loop===void 0||kt.loop===!0?this.loop=!0:kt.loop===!1?this.loop=!1:this.loop=parseInt(kt.loop,10),this.autoplay="autoplay"in kt?kt.autoplay:!0,this.name=kt.name?kt.name:"",this.autoloadSegments=Object.prototype.hasOwnProperty.call(kt,"autoloadSegments")?kt.autoloadSegments:!0,this.assetsPath=kt.assetsPath,this.initialSegment=kt.initialSegment,kt.audioFactory&&this.audioController.setAudioFactory(kt.audioFactory),kt.animationData?this.setupAnimation(kt.animationData):kt.path&&(kt.path.lastIndexOf("\\")!==-1?this.path=kt.path.substr(0,kt.path.lastIndexOf("\\")+1):this.path=kt.path.substr(0,kt.path.lastIndexOf("/")+1),this.fileName=kt.path.substr(kt.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),dataManager.loadAnimation(kt.path,this.configAnimation,this.onSetupError))},AnimationItem.prototype.onSetupError=function(){this.trigger("data_failed")},AnimationItem.prototype.setupAnimation=function(kt){dataManager.completeAnimation(kt,this.configAnimation)},AnimationItem.prototype.setData=function(kt,_e){_e&&_typeof$4(_e)!=="object"&&(_e=JSON.parse(_e));var Dt={wrapper:kt,animationData:_e},Vt=kt.attributes;Dt.path=Vt.getNamedItem("data-animation-path")?Vt.getNamedItem("data-animation-path").value:Vt.getNamedItem("data-bm-path")?Vt.getNamedItem("data-bm-path").value:Vt.getNamedItem("bm-path")?Vt.getNamedItem("bm-path").value:"",Dt.animType=Vt.getNamedItem("data-anim-type")?Vt.getNamedItem("data-anim-type").value:Vt.getNamedItem("data-bm-type")?Vt.getNamedItem("data-bm-type").value:Vt.getNamedItem("bm-type")?Vt.getNamedItem("bm-type").value:Vt.getNamedItem("data-bm-renderer")?Vt.getNamedItem("data-bm-renderer").value:Vt.getNamedItem("bm-renderer")?Vt.getNamedItem("bm-renderer").value:getRegisteredRenderer()||"canvas";var Gt=Vt.getNamedItem("data-anim-loop")?Vt.getNamedItem("data-anim-loop").value:Vt.getNamedItem("data-bm-loop")?Vt.getNamedItem("data-bm-loop").value:Vt.getNamedItem("bm-loop")?Vt.getNamedItem("bm-loop").value:"";Gt==="false"?Dt.loop=!1:Gt==="true"?Dt.loop=!0:Gt!==""&&(Dt.loop=parseInt(Gt,10));var zt=Vt.getNamedItem("data-anim-autoplay")?Vt.getNamedItem("data-anim-autoplay").value:Vt.getNamedItem("data-bm-autoplay")?Vt.getNamedItem("data-bm-autoplay").value:Vt.getNamedItem("bm-autoplay")?Vt.getNamedItem("bm-autoplay").value:!0;Dt.autoplay=zt!=="false",Dt.name=Vt.getNamedItem("data-name")?Vt.getNamedItem("data-name").value:Vt.getNamedItem("data-bm-name")?Vt.getNamedItem("data-bm-name").value:Vt.getNamedItem("bm-name")?Vt.getNamedItem("bm-name").value:"";var jt=Vt.getNamedItem("data-anim-prerender")?Vt.getNamedItem("data-anim-prerender").value:Vt.getNamedItem("data-bm-prerender")?Vt.getNamedItem("data-bm-prerender").value:Vt.getNamedItem("bm-prerender")?Vt.getNamedItem("bm-prerender").value:"";jt==="false"&&(Dt.prerender=!1),Dt.path?this.setParams(Dt):this.trigger("destroy")},AnimationItem.prototype.includeLayers=function(kt){kt.op>this.animationData.op&&(this.animationData.op=kt.op,this.totalFrames=Math.floor(kt.op-this.animationData.ip));var _e=this.animationData.layers,Dt,Vt=_e.length,Gt=kt.layers,zt,jt=Gt.length;for(zt=0;zt<jt;zt+=1)for(Dt=0;Dt<Vt;){if(_e[Dt].id===Gt[zt].id){_e[Dt]=Gt[zt];break}Dt+=1}if((kt.chars||kt.fonts)&&(this.renderer.globalData.fontManager.addChars(kt.chars),this.renderer.globalData.fontManager.addFonts(kt.fonts,this.renderer.globalData.defs)),kt.assets)for(Vt=kt.assets.length,Dt=0;Dt<Vt;Dt+=1)this.animationData.assets.push(kt.assets[Dt]);this.animationData.__complete=!1,dataManager.completeAnimation(this.animationData,this.onSegmentComplete)},AnimationItem.prototype.onSegmentComplete=function(kt){this.animationData=kt;var _e=getExpressionsPlugin();_e&&_e.initExpressions(this),this.loadNextSegment()},AnimationItem.prototype.loadNextSegment=function(){var kt=this.animationData.segments;if(!kt||kt.length===0||!this.autoloadSegments){this.trigger("data_ready"),this.timeCompleted=this.totalFrames;return}var _e=kt.shift();this.timeCompleted=_e.time*this.frameRate;var Dt=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,dataManager.loadData(Dt,this.includeLayers.bind(this),function(){this.trigger("data_failed")}.bind(this))},AnimationItem.prototype.loadSegments=function(){var kt=this.animationData.segments;kt||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},AnimationItem.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},AnimationItem.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},AnimationItem.prototype.configAnimation=function(kt){if(this.renderer)try{this.animationData=kt,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(kt),kt.assets||(kt.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(kt.assets),this.markers=markerParser(kt.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(_e){this.triggerConfigError(_e)}},AnimationItem.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},AnimationItem.prototype.checkLoaded=function(){if(!this.isLoaded&&this.renderer.globalData.fontManager.isLoaded&&(this.imagePreloader.loadedImages()||this.renderer.rendererType!=="canvas")&&this.imagePreloader.loadedFootages()){this.isLoaded=!0;var kt=getExpressionsPlugin();kt&&kt.initExpressions(this),this.renderer.initItems(),setTimeout(function(){this.trigger("DOMLoaded")}.bind(this),0),this.gotoFrame(),this.autoplay&&this.play()}},AnimationItem.prototype.resize=function(kt,_e){var Dt=typeof kt=="number"?kt:void 0,Vt=typeof _e=="number"?_e:void 0;this.renderer.updateContainerSize(Dt,Vt)},AnimationItem.prototype.setSubframe=function(kt){this.isSubframeEnabled=!!kt},AnimationItem.prototype.gotoFrame=function(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(kt){this.triggerRenderFrameError(kt)}},AnimationItem.prototype.play=function(kt){kt&&this.name!==kt||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(kt){kt&&this.name!==kt||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(kt){kt&&this.name!==kt||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(kt){kt&&this.name!==kt||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(kt){for(var _e,Dt=0;Dt<this.markers.length;Dt+=1)if(_e=this.markers[Dt],_e.payload&&_e.payload.name===kt)return _e;return null},AnimationItem.prototype.goToAndStop=function(kt,_e,Dt){if(!(Dt&&this.name!==Dt)){var Vt=Number(kt);if(isNaN(Vt)){var Gt=this.getMarkerData(kt);Gt&&this.goToAndStop(Gt.time,!0)}else _e?this.setCurrentRawFrameValue(kt):this.setCurrentRawFrameValue(kt*this.frameModifier);this.pause()}},AnimationItem.prototype.goToAndPlay=function(kt,_e,Dt){if(!(Dt&&this.name!==Dt)){var Vt=Number(kt);if(isNaN(Vt)){var Gt=this.getMarkerData(kt);Gt&&(Gt.duration?this.playSegments([Gt.time,Gt.time+Gt.duration],!0):this.goToAndStop(Gt.time,!0))}else this.goToAndStop(Vt,_e,Dt);this.play()}},AnimationItem.prototype.advanceTime=function(kt){if(!(this.isPaused===!0||this.isLoaded===!1)){var _e=this.currentRawFrame+kt*this.frameModifier,Dt=!1;_e>=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(_e>this.totalFrames?_e%this.totalFrames:0)||(Dt=!0,_e=this.totalFrames-1):_e>=this.totalFrames?(this.playCount+=1,this.checkSegments(_e%this.totalFrames)||(this.setCurrentRawFrameValue(_e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(_e):_e<0?this.checkSegments(_e%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+_e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(Dt=!0,_e=0)):this.setCurrentRawFrameValue(_e),Dt&&(this.setCurrentRawFrameValue(_e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(kt,_e){this.playCount=0,kt[1]<kt[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=kt[0]-kt[1],this.timeCompleted=this.totalFrames,this.firstFrame=kt[1],this.setCurrentRawFrameValue(this.totalFrames-.001-_e)):kt[1]>kt[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=kt[1]-kt[0],this.timeCompleted=this.totalFrames,this.firstFrame=kt[0],this.setCurrentRawFrameValue(.001+_e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(kt,_e){var Dt=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<kt?Dt=kt:this.currentRawFrame+this.firstFrame>_e&&(Dt=_e-kt)),this.firstFrame=kt,this.totalFrames=_e-kt,this.timeCompleted=this.totalFrames,Dt!==-1&&this.goToAndStop(Dt,!0)},AnimationItem.prototype.playSegments=function(kt,_e){if(_e&&(this.segments.length=0),_typeof$4(kt[0])==="object"){var Dt,Vt=kt.length;for(Dt=0;Dt<Vt;Dt+=1)this.segments.push(kt[Dt])}else this.segments.push(kt);this.segments.length&&_e&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},AnimationItem.prototype.resetSegments=function(kt){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),kt&&this.checkSegments(0)},AnimationItem.prototype.checkSegments=function(kt){return this.segments.length?(this.adjustSegment(this.segments.shift(),kt),!0):!1},AnimationItem.prototype.destroy=function(kt){kt&&this.name!==kt||!this.renderer||(this.renderer.destroy(),this.imagePreloader.destroy(),this.trigger("destroy"),this._cbs=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onComplete=null,this.onSegmentStart=null,this.onDestroy=null,this.renderer=null,this.expressionsPlugin=null,this.imagePreloader=null,this.projectInterface=null)},AnimationItem.prototype.setCurrentRawFrameValue=function(kt){this.currentRawFrame=kt,this.gotoFrame()},AnimationItem.prototype.setSpeed=function(kt){this.playSpeed=kt,this.updaFrameModifier()},AnimationItem.prototype.setDirection=function(kt){this.playDirection=kt<0?-1:1,this.updaFrameModifier()},AnimationItem.prototype.setLoop=function(kt){this.loop=kt},AnimationItem.prototype.setVolume=function(kt,_e){_e&&this.name!==_e||this.audioController.setVolume(kt)},AnimationItem.prototype.getVolume=function(){return this.audioController.getVolume()},AnimationItem.prototype.mute=function(kt){kt&&this.name!==kt||this.audioController.mute()},AnimationItem.prototype.unmute=function(kt){kt&&this.name!==kt||this.audioController.unmute()},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssetsPath=function(kt){var _e="";if(kt.e)_e=kt.p;else if(this.assetsPath){var Dt=kt.p;Dt.indexOf("images/")!==-1&&(Dt=Dt.split("/")[1]),_e=this.assetsPath+Dt}else _e=this.path,_e+=kt.u?kt.u:"",_e+=kt.p;return _e},AnimationItem.prototype.getAssetData=function(kt){for(var _e=0,Dt=this.assets.length;_e<Dt;){if(kt===this.assets[_e].id)return this.assets[_e];_e+=1}return null},AnimationItem.prototype.hide=function(){this.renderer.hide()},AnimationItem.prototype.show=function(){this.renderer.show()},AnimationItem.prototype.getDuration=function(kt){return kt?this.totalFrames:this.totalFrames/this.frameRate},AnimationItem.prototype.updateDocumentData=function(kt,_e,Dt){try{var Vt=this.renderer.getElementByPath(kt);Vt.updateDocumentData(_e,Dt)}catch{}},AnimationItem.prototype.trigger=function(kt){if(this._cbs&&this._cbs[kt])switch(kt){case"enterFrame":this.triggerEvent(kt,new BMEnterFrameEvent(kt,this.currentFrame,this.totalFrames,this.frameModifier));break;case"drawnFrame":this.drawnFrameEvent.currentTime=this.currentFrame,this.drawnFrameEvent.totalTime=this.totalFrames,this.drawnFrameEvent.direction=this.frameModifier,this.triggerEvent(kt,this.drawnFrameEvent);break;case"loopComplete":this.triggerEvent(kt,new BMCompleteLoopEvent(kt,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(kt,new BMCompleteEvent(kt,this.frameMult));break;case"segmentStart":this.triggerEvent(kt,new BMSegmentStartEvent(kt,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(kt,new BMDestroyEvent(kt,this));break;default:this.triggerEvent(kt)}kt==="enterFrame"&&this.onEnterFrame&&this.onEnterFrame.call(this,new BMEnterFrameEvent(kt,this.currentFrame,this.totalFrames,this.frameMult)),kt==="loopComplete"&&this.onLoopComplete&&this.onLoopComplete.call(this,new BMCompleteLoopEvent(kt,this.loop,this.playCount,this.frameMult)),kt==="complete"&&this.onComplete&&this.onComplete.call(this,new BMCompleteEvent(kt,this.frameMult)),kt==="segmentStart"&&this.onSegmentStart&&this.onSegmentStart.call(this,new BMSegmentStartEvent(kt,this.firstFrame,this.totalFrames)),kt==="destroy"&&this.onDestroy&&this.onDestroy.call(this,new BMDestroyEvent(kt,this))},AnimationItem.prototype.triggerRenderFrameError=function(kt){var _e=new BMRenderFrameErrorEvent(kt,this.currentFrame);this.triggerEvent("error",_e),this.onError&&this.onError.call(this,_e)},AnimationItem.prototype.triggerConfigError=function(kt){var _e=new BMConfigErrorEvent(kt,this.currentFrame);this.triggerEvent("error",_e),this.onError&&this.onError.call(this,_e)};var animationManager=function(){var kt={},_e=[],Dt=0,Vt=0,Gt=0,zt=!0,jt=!1;function Ht(Tn){for(var Cn=0,yn=Tn.target;Cn<Vt;)_e[Cn].animation===yn&&(_e.splice(Cn,1),Cn-=1,Vt-=1,yn.isPaused||Kt()),Cn+=1}function Wt(Tn,Cn){if(!Tn)return null;for(var yn=0;yn<Vt;){if(_e[yn].elem===Tn&&_e[yn].elem!==null)return _e[yn].animation;yn+=1}var Sn=new AnimationItem;return Yt(Sn,Tn),Sn.setData(Tn,Cn),Sn}function qt(){var Tn,Cn=_e.length,yn=[];for(Tn=0;Tn<Cn;Tn+=1)yn.push(_e[Tn].animation);return yn}function Xt(){Gt+=1,dn()}function Kt(){Gt-=1}function Yt(Tn,Cn){Tn.addEventListener("destroy",Ht),Tn.addEventListener("_active",Xt),Tn.addEventListener("_idle",Kt),_e.push({elem:Cn,animation:Tn}),Vt+=1}function Zt(Tn){var Cn=new AnimationItem;return Yt(Cn,null),Cn.setParams(Tn),Cn}function Jt(Tn,Cn){var yn;for(yn=0;yn<Vt;yn+=1)_e[yn].animation.setSpeed(Tn,Cn)}function nn(Tn,Cn){var yn;for(yn=0;yn<Vt;yn+=1)_e[yn].animation.setDirection(Tn,Cn)}function rn(Tn){var Cn;for(Cn=0;Cn<Vt;Cn+=1)_e[Cn].animation.play(Tn)}function Qt(Tn){var Cn=Tn-Dt,yn;for(yn=0;yn<Vt;yn+=1)_e[yn].animation.advanceTime(Cn);Dt=Tn,Gt&&!jt?window.requestAnimationFrame(Qt):zt=!0}function en(Tn){Dt=Tn,window.requestAnimationFrame(Qt)}function tn(Tn){var Cn;for(Cn=0;Cn<Vt;Cn+=1)_e[Cn].animation.pause(Tn)}function sn(Tn,Cn,yn){var Sn;for(Sn=0;Sn<Vt;Sn+=1)_e[Sn].animation.goToAndStop(Tn,Cn,yn)}function cn(Tn){var Cn;for(Cn=0;Cn<Vt;Cn+=1)_e[Cn].animation.stop(Tn)}function un(Tn){var Cn;for(Cn=0;Cn<Vt;Cn+=1)_e[Cn].animation.togglePause(Tn)}function hn(Tn){var Cn;for(Cn=Vt-1;Cn>=0;Cn-=1)_e[Cn].animation.destroy(Tn)}function fn(Tn,Cn,yn){var Sn=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),wn,xn=Sn.length;for(wn=0;wn<xn;wn+=1)yn&&Sn[wn].setAttribute("data-bm-type",yn),Wt(Sn[wn],Tn);if(Cn&&xn===0){yn||(yn="svg");var Rn=document.getElementsByTagName("body")[0];Rn.innerText="";var Ln=createTag("div");Ln.style.width="100%",Ln.style.height="100%",Ln.setAttribute("data-bm-type",yn),Rn.appendChild(Ln),Wt(Ln,Tn)}}function pn(){var Tn;for(Tn=0;Tn<Vt;Tn+=1)_e[Tn].animation.resize()}function dn(){!jt&&Gt&&zt&&(window.requestAnimationFrame(en),zt=!1)}function mn(){jt=!0}function vn(){jt=!1,dn()}function _n(Tn,Cn){var yn;for(yn=0;yn<Vt;yn+=1)_e[yn].animation.setVolume(Tn,Cn)}function En(Tn){var Cn;for(Cn=0;Cn<Vt;Cn+=1)_e[Cn].animation.mute(Tn)}function An(Tn){var Cn;for(Cn=0;Cn<Vt;Cn+=1)_e[Cn].animation.unmute(Tn)}return kt.registerAnimation=Wt,kt.loadAnimation=Zt,kt.setSpeed=Jt,kt.setDirection=nn,kt.play=rn,kt.pause=tn,kt.stop=cn,kt.togglePause=un,kt.searchAnimations=fn,kt.resize=pn,kt.goToAndStop=sn,kt.destroy=hn,kt.freeze=mn,kt.unfreeze=vn,kt.setVolume=_n,kt.mute=En,kt.unmute=An,kt.getRegisteredAnimations=qt,kt}(),BezierFactory=function(){var kt={};kt.getBezierEasing=Dt;var _e={};function Dt(en,tn,sn,cn,un){var hn=un||("bez_"+en+"_"+tn+"_"+sn+"_"+cn).replace(/\./g,"p");if(_e[hn])return _e[hn];var fn=new Qt([en,tn,sn,cn]);return _e[hn]=fn,fn}var Vt=4,Gt=.001,zt=1e-7,jt=10,Ht=11,Wt=1/(Ht-1),qt=typeof Float32Array=="function";function Xt(en,tn){return 1-3*tn+3*en}function Kt(en,tn){return 3*tn-6*en}function Yt(en){return 3*en}function Zt(en,tn,sn){return((Xt(tn,sn)*en+Kt(tn,sn))*en+Yt(tn))*en}function Jt(en,tn,sn){return 3*Xt(tn,sn)*en*en+2*Kt(tn,sn)*en+Yt(tn)}function nn(en,tn,sn,cn,un){var hn,fn,pn=0;do fn=tn+(sn-tn)/2,hn=Zt(fn,cn,un)-en,hn>0?sn=fn:tn=fn;while(Math.abs(hn)>zt&&++pn<jt);return fn}function rn(en,tn,sn,cn){for(var un=0;un<Vt;++un){var hn=Jt(tn,sn,cn);if(hn===0)return tn;var fn=Zt(tn,sn,cn)-en;tn-=fn/hn}return tn}function Qt(en){this._p=en,this._mSampleValues=qt?new Float32Array(Ht):new Array(Ht),this._precomputed=!1,this.get=this.get.bind(this)}return Qt.prototype={get:function(tn){var sn=this._p[0],cn=this._p[1],un=this._p[2],hn=this._p[3];return this._precomputed||this._precompute(),sn===cn&&un===hn?tn:tn===0?0:tn===1?1:Zt(this._getTForX(tn),cn,hn)},_precompute:function(){var tn=this._p[0],sn=this._p[1],cn=this._p[2],un=this._p[3];this._precomputed=!0,(tn!==sn||cn!==un)&&this._calcSampleValues()},_calcSampleValues:function(){for(var tn=this._p[0],sn=this._p[2],cn=0;cn<Ht;++cn)this._mSampleValues[cn]=Zt(cn*Wt,tn,sn)},_getTForX:function(tn){for(var sn=this._p[0],cn=this._p[2],un=this._mSampleValues,hn=0,fn=1,pn=Ht-1;fn!==pn&&un[fn]<=tn;++fn)hn+=Wt;--fn;var dn=(tn-un[fn])/(un[fn+1]-un[fn]),mn=hn+dn*Wt,vn=Jt(mn,sn,cn);return vn>=Gt?rn(tn,mn,sn,cn):vn===0?mn:nn(tn,hn,hn+Wt,sn,cn)}},kt}(),pooling=function(){function kt(_e){return _e.concat(createSizedArray(_e.length))}return{double:kt}}(),poolFactory=function(){return function(kt,_e,Dt){var Vt=0,Gt=kt,zt=createSizedArray(Gt),jt={newElement:Ht,release:Wt};function Ht(){var qt;return Vt?(Vt-=1,qt=zt[Vt]):qt=_e(),qt}function Wt(qt){Vt===Gt&&(zt=pooling.double(zt),Gt*=2),Dt&&Dt(qt),zt[Vt]=qt,Vt+=1}return jt}}(),bezierLengthPool=function(){function kt(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}return poolFactory(8,kt)}(),segmentsLengthPool=function(){function kt(){return{lengths:[],totalLength:0}}function _e(Dt){var Vt,Gt=Dt.lengths.length;for(Vt=0;Vt<Gt;Vt+=1)bezierLengthPool.release(Dt.lengths[Vt]);Dt.lengths.length=0}return poolFactory(8,kt,_e)}();function bezFunction(){var kt=Math;function _e(Yt,Zt,Jt,nn,rn,Qt){var en=Yt*nn+Zt*rn+Jt*Qt-rn*nn-Qt*Yt-Jt*Zt;return en>-.001&&en<.001}function Dt(Yt,Zt,Jt,nn,rn,Qt,en,tn,sn){if(Jt===0&&Qt===0&&sn===0)return _e(Yt,Zt,nn,rn,en,tn);var cn=kt.sqrt(kt.pow(nn-Yt,2)+kt.pow(rn-Zt,2)+kt.pow(Qt-Jt,2)),un=kt.sqrt(kt.pow(en-Yt,2)+kt.pow(tn-Zt,2)+kt.pow(sn-Jt,2)),hn=kt.sqrt(kt.pow(en-nn,2)+kt.pow(tn-rn,2)+kt.pow(sn-Qt,2)),fn;return cn>un?cn>hn?fn=cn-un-hn:fn=hn-un-cn:hn>un?fn=hn-un-cn:fn=un-cn-hn,fn>-1e-4&&fn<1e-4}var Vt=function(){return function(Yt,Zt,Jt,nn){var rn=getDefaultCurveSegments(),Qt,en,tn,sn,cn,un=0,hn,fn=[],pn=[],dn=bezierLengthPool.newElement();for(tn=Jt.length,Qt=0;Qt<rn;Qt+=1){for(cn=Qt/(rn-1),hn=0,en=0;en<tn;en+=1)sn=bmPow(1-cn,3)*Yt[en]+3*bmPow(1-cn,2)*cn*Jt[en]+3*(1-cn)*bmPow(cn,2)*nn[en]+bmPow(cn,3)*Zt[en],fn[en]=sn,pn[en]!==null&&(hn+=bmPow(fn[en]-pn[en],2)),pn[en]=fn[en];hn&&(hn=bmSqrt(hn),un+=hn),dn.percents[Qt]=cn,dn.lengths[Qt]=un}return dn.addedLength=un,dn}}();function Gt(Yt){var Zt=segmentsLengthPool.newElement(),Jt=Yt.c,nn=Yt.v,rn=Yt.o,Qt=Yt.i,en,tn=Yt._length,sn=Zt.lengths,cn=0;for(en=0;en<tn-1;en+=1)sn[en]=Vt(nn[en],nn[en+1],rn[en],Qt[en+1]),cn+=sn[en].addedLength;return Jt&&tn&&(sn[en]=Vt(nn[en],nn[0],rn[en],Qt[0]),cn+=sn[en].addedLength),Zt.totalLength=cn,Zt}function zt(Yt){this.segmentLength=0,this.points=new Array(Yt)}function jt(Yt,Zt){this.partialLength=Yt,this.point=Zt}var Ht=function(){var Yt={};return function(Zt,Jt,nn,rn){var Qt=(Zt[0]+"_"+Zt[1]+"_"+Jt[0]+"_"+Jt[1]+"_"+nn[0]+"_"+nn[1]+"_"+rn[0]+"_"+rn[1]).replace(/\./g,"p");if(!Yt[Qt]){var en=getDefaultCurveSegments(),tn,sn,cn,un,hn,fn=0,pn,dn,mn=null;Zt.length===2&&(Zt[0]!==Jt[0]||Zt[1]!==Jt[1])&&_e(Zt[0],Zt[1],Jt[0],Jt[1],Zt[0]+nn[0],Zt[1]+nn[1])&&_e(Zt[0],Zt[1],Jt[0],Jt[1],Jt[0]+rn[0],Jt[1]+rn[1])&&(en=2);var vn=new zt(en);for(cn=nn.length,tn=0;tn<en;tn+=1){for(dn=createSizedArray(cn),hn=tn/(en-1),pn=0,sn=0;sn<cn;sn+=1)un=bmPow(1-hn,3)*Zt[sn]+3*bmPow(1-hn,2)*hn*(Zt[sn]+nn[sn])+3*(1-hn)*bmPow(hn,2)*(Jt[sn]+rn[sn])+bmPow(hn,3)*Jt[sn],dn[sn]=un,mn!==null&&(pn+=bmPow(dn[sn]-mn[sn],2));pn=bmSqrt(pn),fn+=pn,vn.points[tn]=new jt(pn,dn),mn=dn}vn.segmentLength=fn,Yt[Qt]=vn}return Yt[Qt]}}();function Wt(Yt,Zt){var Jt=Zt.percents,nn=Zt.lengths,rn=Jt.length,Qt=bmFloor((rn-1)*Yt),en=Yt*Zt.addedLength,tn=0;if(Qt===rn-1||Qt===0||en===nn[Qt])return Jt[Qt];for(var sn=nn[Qt]>en?-1:1,cn=!0;cn;)if(nn[Qt]<=en&&nn[Qt+1]>en?(tn=(en-nn[Qt])/(nn[Qt+1]-nn[Qt]),cn=!1):Qt+=sn,Qt<0||Qt>=rn-1){if(Qt===rn-1)return Jt[Qt];cn=!1}return Jt[Qt]+(Jt[Qt+1]-Jt[Qt])*tn}function qt(Yt,Zt,Jt,nn,rn,Qt){var en=Wt(rn,Qt),tn=1-en,sn=kt.round((tn*tn*tn*Yt[0]+(en*tn*tn+tn*en*tn+tn*tn*en)*Jt[0]+(en*en*tn+tn*en*en+en*tn*en)*nn[0]+en*en*en*Zt[0])*1e3)/1e3,cn=kt.round((tn*tn*tn*Yt[1]+(en*tn*tn+tn*en*tn+tn*tn*en)*Jt[1]+(en*en*tn+tn*en*en+en*tn*en)*nn[1]+en*en*en*Zt[1])*1e3)/1e3;return[sn,cn]}var Xt=createTypedArray("float32",8);function Kt(Yt,Zt,Jt,nn,rn,Qt,en){rn<0?rn=0:rn>1&&(rn=1);var tn=Wt(rn,en);Qt=Qt>1?1:Qt;var sn=Wt(Qt,en),cn,un=Yt.length,hn=1-tn,fn=1-sn,pn=hn*hn*hn,dn=tn*hn*hn*3,mn=tn*tn*hn*3,vn=tn*tn*tn,_n=hn*hn*fn,En=tn*hn*fn+hn*tn*fn+hn*hn*sn,An=tn*tn*fn+hn*tn*sn+tn*hn*sn,Tn=tn*tn*sn,Cn=hn*fn*fn,yn=tn*fn*fn+hn*sn*fn+hn*fn*sn,Sn=tn*sn*fn+hn*sn*sn+tn*fn*sn,wn=tn*sn*sn,xn=fn*fn*fn,Rn=sn*fn*fn+fn*sn*fn+fn*fn*sn,Ln=sn*sn*fn+fn*sn*sn+sn*fn*sn,Nn=sn*sn*sn;for(cn=0;cn<un;cn+=1)Xt[cn*4]=kt.round((pn*Yt[cn]+dn*Jt[cn]+mn*nn[cn]+vn*Zt[cn])*1e3)/1e3,Xt[cn*4+1]=kt.round((_n*Yt[cn]+En*Jt[cn]+An*nn[cn]+Tn*Zt[cn])*1e3)/1e3,Xt[cn*4+2]=kt.round((Cn*Yt[cn]+yn*Jt[cn]+Sn*nn[cn]+wn*Zt[cn])*1e3)/1e3,Xt[cn*4+3]=kt.round((xn*Yt[cn]+Rn*Jt[cn]+Ln*nn[cn]+Nn*Zt[cn])*1e3)/1e3;return Xt}return{getSegmentsLength:Gt,getNewSegment:Kt,getPointInSegment:qt,buildBezierData:Ht,pointOnLine2D:_e,pointOnLine3D:Dt}}var bez=bezFunction(),initFrame=initialDefaultFrame,mathAbs=Math.abs;function interpolateValue(kt,_e){var Dt=this.offsetTime,Vt;this.propType==="multidimensional"&&(Vt=createTypedArray("float32",this.pv.length));for(var Gt=_e.lastIndex,zt=Gt,jt=this.keyframes.length-1,Ht=!0,Wt,qt,Xt;Ht;){if(Wt=this.keyframes[zt],qt=this.keyframes[zt+1],zt===jt-1&&kt>=qt.t-Dt){Wt.h&&(Wt=qt),Gt=0;break}if(qt.t-Dt>kt){Gt=zt;break}zt<jt-1?zt+=1:(Gt=0,Ht=!1)}Xt=this.keyframesMetadata[zt]||{};var Kt,Yt,Zt,Jt,nn,rn,Qt=qt.t-Dt,en=Wt.t-Dt,tn;if(Wt.to){Xt.bezierData||(Xt.bezierData=bez.buildBezierData(Wt.s,qt.s||Wt.e,Wt.to,Wt.ti));var sn=Xt.bezierData;if(kt>=Qt||kt<en){var cn=kt>=Qt?sn.points.length-1:0;for(Yt=sn.points[cn].point.length,Kt=0;Kt<Yt;Kt+=1)Vt[Kt]=sn.points[cn].point[Kt]}else{Xt.__fnct?rn=Xt.__fnct:(rn=BezierFactory.getBezierEasing(Wt.o.x,Wt.o.y,Wt.i.x,Wt.i.y,Wt.n).get,Xt.__fnct=rn),Zt=rn((kt-en)/(Qt-en));var un=sn.segmentLength*Zt,hn,fn=_e.lastFrame<kt&&_e._lastKeyframeIndex===zt?_e._lastAddedLength:0;for(nn=_e.lastFrame<kt&&_e._lastKeyframeIndex===zt?_e._lastPoint:0,Ht=!0,Jt=sn.points.length;Ht;){if(fn+=sn.points[nn].partialLength,un===0||Zt===0||nn===sn.points.length-1){for(Yt=sn.points[nn].point.length,Kt=0;Kt<Yt;Kt+=1)Vt[Kt]=sn.points[nn].point[Kt];break}else if(un>=fn&&un<fn+sn.points[nn+1].partialLength){for(hn=(un-fn)/sn.points[nn+1].partialLength,Yt=sn.points[nn].point.length,Kt=0;Kt<Yt;Kt+=1)Vt[Kt]=sn.points[nn].point[Kt]+(sn.points[nn+1].point[Kt]-sn.points[nn].point[Kt])*hn;break}nn<Jt-1?nn+=1:Ht=!1}_e._lastPoint=nn,_e._lastAddedLength=fn-sn.points[nn].partialLength,_e._lastKeyframeIndex=zt}}else{var pn,dn,mn,vn,_n;if(jt=Wt.s.length,tn=qt.s||Wt.e,this.sh&&Wt.h!==1)if(kt>=Qt)Vt[0]=tn[0],Vt[1]=tn[1],Vt[2]=tn[2];else if(kt<=en)Vt[0]=Wt.s[0],Vt[1]=Wt.s[1],Vt[2]=Wt.s[2];else{var En=createQuaternion(Wt.s),An=createQuaternion(tn),Tn=(kt-en)/(Qt-en);quaternionToEuler(Vt,slerp(En,An,Tn))}else for(zt=0;zt<jt;zt+=1)Wt.h!==1&&(kt>=Qt?Zt=1:kt<en?Zt=0:(Wt.o.x.constructor===Array?(Xt.__fnct||(Xt.__fnct=[]),Xt.__fnct[zt]?rn=Xt.__fnct[zt]:(pn=Wt.o.x[zt]===void 0?Wt.o.x[0]:Wt.o.x[zt],dn=Wt.o.y[zt]===void 0?Wt.o.y[0]:Wt.o.y[zt],mn=Wt.i.x[zt]===void 0?Wt.i.x[0]:Wt.i.x[zt],vn=Wt.i.y[zt]===void 0?Wt.i.y[0]:Wt.i.y[zt],rn=BezierFactory.getBezierEasing(pn,dn,mn,vn).get,Xt.__fnct[zt]=rn)):Xt.__fnct?rn=Xt.__fnct:(pn=Wt.o.x,dn=Wt.o.y,mn=Wt.i.x,vn=Wt.i.y,rn=BezierFactory.getBezierEasing(pn,dn,mn,vn).get,Wt.keyframeMetadata=rn),Zt=rn((kt-en)/(Qt-en)))),tn=qt.s||Wt.e,_n=Wt.h===1?Wt.s[zt]:Wt.s[zt]+(tn[zt]-Wt.s[zt])*Zt,this.propType==="multidimensional"?Vt[zt]=_n:Vt=_n}return _e.lastIndex=Gt,Vt}function slerp(kt,_e,Dt){var Vt=[],Gt=kt[0],zt=kt[1],jt=kt[2],Ht=kt[3],Wt=_e[0],qt=_e[1],Xt=_e[2],Kt=_e[3],Yt,Zt,Jt,nn,rn;return Zt=Gt*Wt+zt*qt+jt*Xt+Ht*Kt,Zt<0&&(Zt=-Zt,Wt=-Wt,qt=-qt,Xt=-Xt,Kt=-Kt),1-Zt>1e-6?(Yt=Math.acos(Zt),Jt=Math.sin(Yt),nn=Math.sin((1-Dt)*Yt)/Jt,rn=Math.sin(Dt*Yt)/Jt):(nn=1-Dt,rn=Dt),Vt[0]=nn*Gt+rn*Wt,Vt[1]=nn*zt+rn*qt,Vt[2]=nn*jt+rn*Xt,Vt[3]=nn*Ht+rn*Kt,Vt}function quaternionToEuler(kt,_e){var Dt=_e[0],Vt=_e[1],Gt=_e[2],zt=_e[3],jt=Math.atan2(2*Vt*zt-2*Dt*Gt,1-2*Vt*Vt-2*Gt*Gt),Ht=Math.asin(2*Dt*Vt+2*Gt*zt),Wt=Math.atan2(2*Dt*zt-2*Vt*Gt,1-2*Dt*Dt-2*Gt*Gt);kt[0]=jt/degToRads,kt[1]=Ht/degToRads,kt[2]=Wt/degToRads}function createQuaternion(kt){var _e=kt[0]*degToRads,Dt=kt[1]*degToRads,Vt=kt[2]*degToRads,Gt=Math.cos(_e/2),zt=Math.cos(Dt/2),jt=Math.cos(Vt/2),Ht=Math.sin(_e/2),Wt=Math.sin(Dt/2),qt=Math.sin(Vt/2),Xt=Gt*zt*jt-Ht*Wt*qt,Kt=Ht*Wt*jt+Gt*zt*qt,Yt=Ht*zt*jt+Gt*Wt*qt,Zt=Gt*Wt*jt-Ht*zt*qt;return[Kt,Yt,Zt,Xt]}function getValueAtCurrentTime(){var kt=this.comp.renderedFrame-this.offsetTime,_e=this.keyframes[0].t-this.offsetTime,Dt=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(kt===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=Dt&&kt>=Dt||this._caching.lastFrame<_e&&kt<_e))){this._caching.lastFrame>=kt&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var Vt=this.interpolateValue(kt,this._caching);this.pv=Vt}return this._caching.lastFrame=kt,this.pv}function setVValue(kt){var _e;if(this.propType==="unidimensional")_e=kt*this.mult,mathAbs(this.v-_e)>1e-5&&(this.v=_e,this._mdf=!0);else for(var Dt=0,Vt=this.v.length;Dt<Vt;)_e=kt[Dt]*this.mult,mathAbs(this.v[Dt]-_e)>1e-5&&(this.v[Dt]=_e,this._mdf=!0),Dt+=1}function processEffectsSequence(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var kt,_e=this.effectsSequence.length,Dt=this.kf?this.pv:this.data.k;for(kt=0;kt<_e;kt+=1)Dt=this.effectsSequence[kt](Dt);this.setVValue(Dt),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function addEffect(kt){this.effectsSequence.push(kt),this.container.addDynamicProperty(this)}function ValueProperty(kt,_e,Dt,Vt){this.propType="unidimensional",this.mult=Dt||1,this.data=_e,this.v=Dt?_e.k*Dt:_e.k,this.pv=_e.k,this._mdf=!1,this.elem=kt,this.container=Vt,this.comp=kt.comp,this.k=!1,this.kf=!1,this.vel=0,this.effectsSequence=[],this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function MultiDimensionalProperty(kt,_e,Dt,Vt){this.propType="multidimensional",this.mult=Dt||1,this.data=_e,this._mdf=!1,this.elem=kt,this.container=Vt,this.comp=kt.comp,this.k=!1,this.kf=!1,this.frameId=-1;var Gt,zt=_e.k.length;for(this.v=createTypedArray("float32",zt),this.pv=createTypedArray("float32",zt),this.vel=createTypedArray("float32",zt),Gt=0;Gt<zt;Gt+=1)this.v[Gt]=_e.k[Gt]*this.mult,this.pv[Gt]=_e.k[Gt];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function KeyframedValueProperty(kt,_e,Dt,Vt){this.propType="unidimensional",this.keyframes=_e.k,this.keyframesMetadata=[],this.offsetTime=kt.data.st,this.frameId=-1,this._caching={lastFrame:initFrame,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=_e,this.mult=Dt||1,this.elem=kt,this.container=Vt,this.comp=kt.comp,this.v=initFrame,this.pv=initFrame,this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.addEffect=addEffect}function KeyframedMultidimensionalProperty(kt,_e,Dt,Vt){this.propType="multidimensional";var Gt,zt=_e.k.length,jt,Ht,Wt,qt;for(Gt=0;Gt<zt-1;Gt+=1)_e.k[Gt].to&&_e.k[Gt].s&&_e.k[Gt+1]&&_e.k[Gt+1].s&&(jt=_e.k[Gt].s,Ht=_e.k[Gt+1].s,Wt=_e.k[Gt].to,qt=_e.k[Gt].ti,(jt.length===2&&!(jt[0]===Ht[0]&&jt[1]===Ht[1])&&bez.pointOnLine2D(jt[0],jt[1],Ht[0],Ht[1],jt[0]+Wt[0],jt[1]+Wt[1])&&bez.pointOnLine2D(jt[0],jt[1],Ht[0],Ht[1],Ht[0]+qt[0],Ht[1]+qt[1])||jt.length===3&&!(jt[0]===Ht[0]&&jt[1]===Ht[1]&&jt[2]===Ht[2])&&bez.pointOnLine3D(jt[0],jt[1],jt[2],Ht[0],Ht[1],Ht[2],jt[0]+Wt[0],jt[1]+Wt[1],jt[2]+Wt[2])&&bez.pointOnLine3D(jt[0],jt[1],jt[2],Ht[0],Ht[1],Ht[2],Ht[0]+qt[0],Ht[1]+qt[1],Ht[2]+qt[2]))&&(_e.k[Gt].to=null,_e.k[Gt].ti=null),jt[0]===Ht[0]&&jt[1]===Ht[1]&&Wt[0]===0&&Wt[1]===0&&qt[0]===0&&qt[1]===0&&(jt.length===2||jt[2]===Ht[2]&&Wt[2]===0&&qt[2]===0)&&(_e.k[Gt].to=null,_e.k[Gt].ti=null));this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.data=_e,this.keyframes=_e.k,this.keyframesMetadata=[],this.offsetTime=kt.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=Dt||1,this.elem=kt,this.container=Vt,this.comp=kt.comp,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.frameId=-1;var Xt=_e.k[0].s.length;for(this.v=createTypedArray("float32",Xt),this.pv=createTypedArray("float32",Xt),Gt=0;Gt<Xt;Gt+=1)this.v[Gt]=initFrame,this.pv[Gt]=initFrame;this._caching={lastFrame:initFrame,lastIndex:0,value:createTypedArray("float32",Xt)},this.addEffect=addEffect}var PropertyFactory=function(){function kt(Dt,Vt,Gt,zt,jt){Vt.sid&&(Vt=Dt.globalData.slotManager.getProp(Vt));var Ht;if(!Vt.k.length)Ht=new ValueProperty(Dt,Vt,zt,jt);else if(typeof Vt.k[0]=="number")Ht=new MultiDimensionalProperty(Dt,Vt,zt,jt);else switch(Gt){case 0:Ht=new KeyframedValueProperty(Dt,Vt,zt,jt);break;case 1:Ht=new KeyframedMultidimensionalProperty(Dt,Vt,zt,jt);break}return Ht.effectsSequence.length&&jt.addDynamicProperty(Ht),Ht}var _e={getProp:kt};return _e}();function DynamicPropertyContainer(){}DynamicPropertyContainer.prototype={addDynamicProperty:function(_e){this.dynamicProperties.indexOf(_e)===-1&&(this.dynamicProperties.push(_e),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){this._mdf=!1;var _e,Dt=this.dynamicProperties.length;for(_e=0;_e<Dt;_e+=1)this.dynamicProperties[_e].getValue(),this.dynamicProperties[_e]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(_e){this.container=_e,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var pointPool=function(){function kt(){return createTypedArray("float32",2)}return poolFactory(8,kt)}();function ShapePath(){this.c=!1,this._length=0,this._maxLength=8,this.v=createSizedArray(this._maxLength),this.o=createSizedArray(this._maxLength),this.i=createSizedArray(this._maxLength)}ShapePath.prototype.setPathData=function(kt,_e){this.c=kt,this.setLength(_e);for(var Dt=0;Dt<_e;)this.v[Dt]=pointPool.newElement(),this.o[Dt]=pointPool.newElement(),this.i[Dt]=pointPool.newElement(),Dt+=1},ShapePath.prototype.setLength=function(kt){for(;this._maxLength<kt;)this.doubleArrayLength();this._length=kt},ShapePath.prototype.doubleArrayLength=function(){this.v=this.v.concat(createSizedArray(this._maxLength)),this.i=this.i.concat(createSizedArray(this._maxLength)),this.o=this.o.concat(createSizedArray(this._maxLength)),this._maxLength*=2},ShapePath.prototype.setXYAt=function(kt,_e,Dt,Vt,Gt){var zt;switch(this._length=Math.max(this._length,Vt+1),this._length>=this._maxLength&&this.doubleArrayLength(),Dt){case"v":zt=this.v;break;case"i":zt=this.i;break;case"o":zt=this.o;break;default:zt=[];break}(!zt[Vt]||zt[Vt]&&!Gt)&&(zt[Vt]=pointPool.newElement()),zt[Vt][0]=kt,zt[Vt][1]=_e},ShapePath.prototype.setTripleAt=function(kt,_e,Dt,Vt,Gt,zt,jt,Ht){this.setXYAt(kt,_e,"v",jt,Ht),this.setXYAt(Dt,Vt,"o",jt,Ht),this.setXYAt(Gt,zt,"i",jt,Ht)},ShapePath.prototype.reverse=function(){var kt=new ShapePath;kt.setPathData(this.c,this._length);var _e=this.v,Dt=this.o,Vt=this.i,Gt=0;this.c&&(kt.setTripleAt(_e[0][0],_e[0][1],Vt[0][0],Vt[0][1],Dt[0][0],Dt[0][1],0,!1),Gt=1);var zt=this._length-1,jt=this._length,Ht;for(Ht=Gt;Ht<jt;Ht+=1)kt.setTripleAt(_e[zt][0],_e[zt][1],Vt[zt][0],Vt[zt][1],Dt[zt][0],Dt[zt][1],Ht,!1),zt-=1;return kt},ShapePath.prototype.length=function(){return this._length};var shapePool=function(){function kt(){return new ShapePath}function _e(Gt){var zt=Gt._length,jt;for(jt=0;jt<zt;jt+=1)pointPool.release(Gt.v[jt]),pointPool.release(Gt.i[jt]),pointPool.release(Gt.o[jt]),Gt.v[jt]=null,Gt.i[jt]=null,Gt.o[jt]=null;Gt._length=0,Gt.c=!1}function Dt(Gt){var zt=Vt.newElement(),jt,Ht=Gt._length===void 0?Gt.v.length:Gt._length;for(zt.setLength(Ht),zt.c=Gt.c,jt=0;jt<Ht;jt+=1)zt.setTripleAt(Gt.v[jt][0],Gt.v[jt][1],Gt.o[jt][0],Gt.o[jt][1],Gt.i[jt][0],Gt.i[jt][1],jt);return zt}var Vt=poolFactory(4,kt,_e);return Vt.clone=Dt,Vt}();function ShapeCollection(){this._length=0,this._maxLength=4,this.shapes=createSizedArray(this._maxLength)}ShapeCollection.prototype.addShape=function(kt){this._length===this._maxLength&&(this.shapes=this.shapes.concat(createSizedArray(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=kt,this._length+=1},ShapeCollection.prototype.releaseShapes=function(){var kt;for(kt=0;kt<this._length;kt+=1)shapePool.release(this.shapes[kt]);this._length=0};var shapeCollectionPool=function(){var kt={newShapeCollection:Gt,release:zt},_e=0,Dt=4,Vt=createSizedArray(Dt);function Gt(){var jt;return _e?(_e-=1,jt=Vt[_e]):jt=new ShapeCollection,jt}function zt(jt){var Ht,Wt=jt._length;for(Ht=0;Ht<Wt;Ht+=1)shapePool.release(jt.shapes[Ht]);jt._length=0,_e===Dt&&(Vt=pooling.double(Vt),Dt*=2),Vt[_e]=jt,_e+=1}return kt}(),ShapePropertyFactory=function(){var kt=-999999;function _e(Qt,en,tn){var sn=tn.lastIndex,cn,un,hn,fn,pn,dn,mn,vn,_n,En=this.keyframes;if(Qt<En[0].t-this.offsetTime)cn=En[0].s[0],hn=!0,sn=0;else if(Qt>=En[En.length-1].t-this.offsetTime)cn=En[En.length-1].s?En[En.length-1].s[0]:En[En.length-2].e[0],hn=!0;else{for(var An=sn,Tn=En.length-1,Cn=!0,yn,Sn,wn;Cn&&(yn=En[An],Sn=En[An+1],!(Sn.t-this.offsetTime>Qt));)An<Tn-1?An+=1:Cn=!1;if(wn=this.keyframesMetadata[An]||{},hn=yn.h===1,sn=An,!hn){if(Qt>=Sn.t-this.offsetTime)vn=1;else if(Qt<yn.t-this.offsetTime)vn=0;else{var xn;wn.__fnct?xn=wn.__fnct:(xn=BezierFactory.getBezierEasing(yn.o.x,yn.o.y,yn.i.x,yn.i.y).get,wn.__fnct=xn),vn=xn((Qt-(yn.t-this.offsetTime))/(Sn.t-this.offsetTime-(yn.t-this.offsetTime)))}un=Sn.s?Sn.s[0]:yn.e[0]}cn=yn.s[0]}for(dn=en._length,mn=cn.i[0].length,tn.lastIndex=sn,fn=0;fn<dn;fn+=1)for(pn=0;pn<mn;pn+=1)_n=hn?cn.i[fn][pn]:cn.i[fn][pn]+(un.i[fn][pn]-cn.i[fn][pn])*vn,en.i[fn][pn]=_n,_n=hn?cn.o[fn][pn]:cn.o[fn][pn]+(un.o[fn][pn]-cn.o[fn][pn])*vn,en.o[fn][pn]=_n,_n=hn?cn.v[fn][pn]:cn.v[fn][pn]+(un.v[fn][pn]-cn.v[fn][pn])*vn,en.v[fn][pn]=_n}function Dt(){var Qt=this.comp.renderedFrame-this.offsetTime,en=this.keyframes[0].t-this.offsetTime,tn=this.keyframes[this.keyframes.length-1].t-this.offsetTime,sn=this._caching.lastFrame;return sn!==kt&&(sn<en&&Qt<en||sn>tn&&Qt>tn)||(this._caching.lastIndex=sn<Qt?this._caching.lastIndex:0,this.interpolateShape(Qt,this.pv,this._caching)),this._caching.lastFrame=Qt,this.pv}function Vt(){this.paths=this.localShapeCollection}function Gt(Qt,en){if(Qt._length!==en._length||Qt.c!==en.c)return!1;var tn,sn=Qt._length;for(tn=0;tn<sn;tn+=1)if(Qt.v[tn][0]!==en.v[tn][0]||Qt.v[tn][1]!==en.v[tn][1]||Qt.o[tn][0]!==en.o[tn][0]||Qt.o[tn][1]!==en.o[tn][1]||Qt.i[tn][0]!==en.i[tn][0]||Qt.i[tn][1]!==en.i[tn][1])return!1;return!0}function zt(Qt){Gt(this.v,Qt)||(this.v=shapePool.clone(Qt),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function jt(){if(this.elem.globalData.frameId!==this.frameId){if(!this.effectsSequence.length){this._mdf=!1;return}if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=!1;var Qt;this.kf?Qt=this.pv:this.data.ks?Qt=this.data.ks.k:Qt=this.data.pt.k;var en,tn=this.effectsSequence.length;for(en=0;en<tn;en+=1)Qt=this.effectsSequence[en](Qt);this.setVValue(Qt),this.lock=!1,this.frameId=this.elem.globalData.frameId}}function Ht(Qt,en,tn){this.propType="shape",this.comp=Qt.comp,this.container=Qt,this.elem=Qt,this.data=en,this.k=!1,this.kf=!1,this._mdf=!1;var sn=tn===3?en.pt.k:en.ks.k;this.v=shapePool.clone(sn),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=Vt,this.effectsSequence=[]}function Wt(Qt){this.effectsSequence.push(Qt),this.container.addDynamicProperty(this)}Ht.prototype.interpolateShape=_e,Ht.prototype.getValue=jt,Ht.prototype.setVValue=zt,Ht.prototype.addEffect=Wt;function qt(Qt,en,tn){this.propType="shape",this.comp=Qt.comp,this.elem=Qt,this.container=Qt,this.offsetTime=Qt.data.st,this.keyframes=tn===3?en.pt.k:en.ks.k,this.keyframesMetadata=[],this.k=!0,this.kf=!0;var sn=this.keyframes[0].s[0].i.length;this.v=shapePool.newElement(),this.v.setPathData(this.keyframes[0].s[0].c,sn),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.lastFrame=kt,this.reset=Vt,this._caching={lastFrame:kt,lastIndex:0},this.effectsSequence=[Dt.bind(this)]}qt.prototype.getValue=jt,qt.prototype.interpolateShape=_e,qt.prototype.setVValue=zt,qt.prototype.addEffect=Wt;var Xt=function(){var Qt=roundCorner;function en(tn,sn){this.v=shapePool.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=sn.d,this.elem=tn,this.comp=tn.comp,this.frameId=-1,this.initDynamicPropertyContainer(tn),this.p=PropertyFactory.getProp(tn,sn.p,1,0,this),this.s=PropertyFactory.getProp(tn,sn.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return en.prototype={reset:Vt,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertEllToPath())},convertEllToPath:function(){var sn=this.p.v[0],cn=this.p.v[1],un=this.s.v[0]/2,hn=this.s.v[1]/2,fn=this.d!==3,pn=this.v;pn.v[0][0]=sn,pn.v[0][1]=cn-hn,pn.v[1][0]=fn?sn+un:sn-un,pn.v[1][1]=cn,pn.v[2][0]=sn,pn.v[2][1]=cn+hn,pn.v[3][0]=fn?sn-un:sn+un,pn.v[3][1]=cn,pn.i[0][0]=fn?sn-un*Qt:sn+un*Qt,pn.i[0][1]=cn-hn,pn.i[1][0]=fn?sn+un:sn-un,pn.i[1][1]=cn-hn*Qt,pn.i[2][0]=fn?sn+un*Qt:sn-un*Qt,pn.i[2][1]=cn+hn,pn.i[3][0]=fn?sn-un:sn+un,pn.i[3][1]=cn+hn*Qt,pn.o[0][0]=fn?sn+un*Qt:sn-un*Qt,pn.o[0][1]=cn-hn,pn.o[1][0]=fn?sn+un:sn-un,pn.o[1][1]=cn+hn*Qt,pn.o[2][0]=fn?sn-un*Qt:sn+un*Qt,pn.o[2][1]=cn+hn,pn.o[3][0]=fn?sn-un:sn+un,pn.o[3][1]=cn-hn*Qt}},extendPrototype([DynamicPropertyContainer],en),en}(),Kt=function(){function Qt(en,tn){this.v=shapePool.newElement(),this.v.setPathData(!0,0),this.elem=en,this.comp=en.comp,this.data=tn,this.frameId=-1,this.d=tn.d,this.initDynamicPropertyContainer(en),tn.sy===1?(this.ir=PropertyFactory.getProp(en,tn.ir,0,0,this),this.is=PropertyFactory.getProp(en,tn.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=PropertyFactory.getProp(en,tn.pt,0,0,this),this.p=PropertyFactory.getProp(en,tn.p,1,0,this),this.r=PropertyFactory.getProp(en,tn.r,0,degToRads,this),this.or=PropertyFactory.getProp(en,tn.or,0,0,this),this.os=PropertyFactory.getProp(en,tn.os,0,.01,this),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertToPath())}return Qt.prototype={reset:Vt,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertToPath())},convertStarToPath:function(){var tn=Math.floor(this.pt.v)*2,sn=Math.PI*2/tn,cn=!0,un=this.or.v,hn=this.ir.v,fn=this.os.v,pn=this.is.v,dn=2*Math.PI*un/(tn*2),mn=2*Math.PI*hn/(tn*2),vn,_n,En,An,Tn=-Math.PI/2;Tn+=this.r.v;var Cn=this.data.d===3?-1:1;for(this.v._length=0,vn=0;vn<tn;vn+=1){_n=cn?un:hn,En=cn?fn:pn,An=cn?dn:mn;var yn=_n*Math.cos(Tn),Sn=_n*Math.sin(Tn),wn=yn===0&&Sn===0?0:Sn/Math.sqrt(yn*yn+Sn*Sn),xn=yn===0&&Sn===0?0:-yn/Math.sqrt(yn*yn+Sn*Sn);yn+=+this.p.v[0],Sn+=+this.p.v[1],this.v.setTripleAt(yn,Sn,yn-wn*An*En*Cn,Sn-xn*An*En*Cn,yn+wn*An*En*Cn,Sn+xn*An*En*Cn,vn,!0),cn=!cn,Tn+=sn*Cn}},convertPolygonToPath:function(){var tn=Math.floor(this.pt.v),sn=Math.PI*2/tn,cn=this.or.v,un=this.os.v,hn=2*Math.PI*cn/(tn*4),fn,pn=-Math.PI*.5,dn=this.data.d===3?-1:1;for(pn+=this.r.v,this.v._length=0,fn=0;fn<tn;fn+=1){var mn=cn*Math.cos(pn),vn=cn*Math.sin(pn),_n=mn===0&&vn===0?0:vn/Math.sqrt(mn*mn+vn*vn),En=mn===0&&vn===0?0:-mn/Math.sqrt(mn*mn+vn*vn);mn+=+this.p.v[0],vn+=+this.p.v[1],this.v.setTripleAt(mn,vn,mn-_n*hn*un*dn,vn-En*hn*un*dn,mn+_n*hn*un*dn,vn+En*hn*un*dn,fn,!0),pn+=sn*dn}this.paths.length=0,this.paths[0]=this.v}},extendPrototype([DynamicPropertyContainer],Qt),Qt}(),Yt=function(){function Qt(en,tn){this.v=shapePool.newElement(),this.v.c=!0,this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=en,this.comp=en.comp,this.frameId=-1,this.d=tn.d,this.initDynamicPropertyContainer(en),this.p=PropertyFactory.getProp(en,tn.p,1,0,this),this.s=PropertyFactory.getProp(en,tn.s,1,0,this),this.r=PropertyFactory.getProp(en,tn.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return Qt.prototype={convertRectToPath:function(){var tn=this.p.v[0],sn=this.p.v[1],cn=this.s.v[0]/2,un=this.s.v[1]/2,hn=bmMin(cn,un,this.r.v),fn=hn*(1-roundCorner);this.v._length=0,this.d===2||this.d===1?(this.v.setTripleAt(tn+cn,sn-un+hn,tn+cn,sn-un+hn,tn+cn,sn-un+fn,0,!0),this.v.setTripleAt(tn+cn,sn+un-hn,tn+cn,sn+un-fn,tn+cn,sn+un-hn,1,!0),hn!==0?(this.v.setTripleAt(tn+cn-hn,sn+un,tn+cn-hn,sn+un,tn+cn-fn,sn+un,2,!0),this.v.setTripleAt(tn-cn+hn,sn+un,tn-cn+fn,sn+un,tn-cn+hn,sn+un,3,!0),this.v.setTripleAt(tn-cn,sn+un-hn,tn-cn,sn+un-hn,tn-cn,sn+un-fn,4,!0),this.v.setTripleAt(tn-cn,sn-un+hn,tn-cn,sn-un+fn,tn-cn,sn-un+hn,5,!0),this.v.setTripleAt(tn-cn+hn,sn-un,tn-cn+hn,sn-un,tn-cn+fn,sn-un,6,!0),this.v.setTripleAt(tn+cn-hn,sn-un,tn+cn-fn,sn-un,tn+cn-hn,sn-un,7,!0)):(this.v.setTripleAt(tn-cn,sn+un,tn-cn+fn,sn+un,tn-cn,sn+un,2),this.v.setTripleAt(tn-cn,sn-un,tn-cn,sn-un+fn,tn-cn,sn-un,3))):(this.v.setTripleAt(tn+cn,sn-un+hn,tn+cn,sn-un+fn,tn+cn,sn-un+hn,0,!0),hn!==0?(this.v.setTripleAt(tn+cn-hn,sn-un,tn+cn-hn,sn-un,tn+cn-fn,sn-un,1,!0),this.v.setTripleAt(tn-cn+hn,sn-un,tn-cn+fn,sn-un,tn-cn+hn,sn-un,2,!0),this.v.setTripleAt(tn-cn,sn-un+hn,tn-cn,sn-un+hn,tn-cn,sn-un+fn,3,!0),this.v.setTripleAt(tn-cn,sn+un-hn,tn-cn,sn+un-fn,tn-cn,sn+un-hn,4,!0),this.v.setTripleAt(tn-cn+hn,sn+un,tn-cn+hn,sn+un,tn-cn+fn,sn+un,5,!0),this.v.setTripleAt(tn+cn-hn,sn+un,tn+cn-fn,sn+un,tn+cn-hn,sn+un,6,!0),this.v.setTripleAt(tn+cn,sn+un-hn,tn+cn,sn+un-hn,tn+cn,sn+un-fn,7,!0)):(this.v.setTripleAt(tn-cn,sn-un,tn-cn+fn,sn-un,tn-cn,sn-un,1,!0),this.v.setTripleAt(tn-cn,sn+un,tn-cn,sn+un-fn,tn-cn,sn+un,2,!0),this.v.setTripleAt(tn+cn,sn+un,tn+cn-fn,sn+un,tn+cn,sn+un,3,!0)))},getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertRectToPath())},reset:Vt},extendPrototype([DynamicPropertyContainer],Qt),Qt}();function Zt(Qt,en,tn){var sn;if(tn===3||tn===4){var cn=tn===3?en.pt:en.ks,un=cn.k;un.length?sn=new qt(Qt,en,tn):sn=new Ht(Qt,en,tn)}else tn===5?sn=new Yt(Qt,en):tn===6?sn=new Xt(Qt,en):tn===7&&(sn=new Kt(Qt,en));return sn.k&&Qt.addDynamicProperty(sn),sn}function Jt(){return Ht}function nn(){return qt}var rn={};return rn.getShapeProp=Zt,rn.getConstructorFunction=Jt,rn.getKeyframedConstructorFunction=nn,rn}();/*!
|
|
3943
3943
|
Transformation Matrix v2.0
|
|
3944
3944
|
(c) Epistemex 2014-2015
|
|
@@ -4646,7 +4646,7 @@ ${zt.join(`
|
|
|
4646
4646
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4647
4647
|
* See the License for the specific language governing permissions and
|
|
4648
4648
|
* limitations under the License.
|
|
4649
|
-
*/const HAS_WEBXR_DEVICE_API=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;HAS_WEBXR_DEVICE_API&&self.XRSession.prototype.requestHitTestSource!=null;(()=>{const kt=navigator.userAgent||navigator.vendor||self.opera;let _e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(kt)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(kt.substr(0,4)))&&(_e=!0),_e})();const IS_IOS=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,IS_WKWEBVIEW=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(IS_IOS){if(IS_WKWEBVIEW)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const kt=document.createElement("a");return!!(kt.relList&&kt.relList.supports&&kt.relList.supports("ar"))}}else return!1})();class ConfiguratorCoreAPI{static forwardVector3=new Vector3(0,0,1);#e={EUR:"€",GBP:"£",USD:"$",INR:"₹",JPY:"¥",CAD:"CA$",NZD:"NZ$",SGD:"S$"};#t=!1;#r;#i;#n;#o;#a;#s;#l;#v;#y;#g;#p;#u=!0;#c;#h=!0;#f="";#d="";#m=null;epigraphAnalytics=null;EVENTS={UI:{PreloadScreen_Show:"preload:show",PreloadScreen_Hide:"preload:hide",ContextMenu_InfoBtnClicked:"infoButtonClicked_ContextMenu",ContextMenu_Show:"contextMenu:show",ContextMenu_Hide:"contextMenu:hide",UtilityMenu_Show:"utilityMenu:show",UtilityMenu_Hide:"utilityMenu:hide",ShareButton_Show:"shareButton:show",ShareButton_Hide:"shareButton:hide",ViewInYourSpaceButton_Show:"viewInYourSpace:show",ViewInYourSpaceButton_Hide:"viewInYourSpace:hide",ResetButton_Show:"resetBtn:show",ResetButton_Hide:"resetBtn:hide",DimensionsButton_Show:"dimensionsBtn:show",DimensionsButton_Hide:"dimensionsBtn:hide",Instructions_Show:"instructions:show",ReviewCart_Shown:"review-cart-shown",ReviewCart_Hidden:"review-cart-hidden"},SCENE:{Item_Added:"item:added",Item_Removed:"item:removed",Items_Updated:"items:updated",FittingSkuIds_Updated:"fittingSkuIds:updated",CartItems_Updated:"cartItems:updated",Hotspot_Enter:"hotspot:enter",Hotspot_Exit:"hotspot:exit",SavedConfiguration_Loaded:"loaded-saved-configuration",MaterialOverrides_Exists:"materialOverrideExists",Cart_Checkout:"cart:checkout",Cart_OutOfStock:"cart:outOfStock",Cart_StatusUpdated:"cart:statusUpdated",ReplaceableCategory_Updated:"replaceableCategory:updated",GlobalVariant_Updated:"globalVariant:updated",CategoryData_Updated:"categoryData:updated",GlobalGeometryVariant_Updated:"globalGeometryVariant:updated",Ghost_Loaded:"ghost:loaded",Model_Loaded:"model:loaded",Model_Removed:"model:removed",Scene_Cleared:"scene:cleared",Inventory_Updated:"inventory:updated",DraggingOnDrop_CollisionDetected:"draggingOnDrop:collisionDetected",ItemRemoveModalTriggered:"itemRemoveModal:triggered",ActionButton_Clicked:"actionButton:clicked",CartMessage_Update:"cartMessage:updated"},CONFIGURATION:{OnClickItem:"onClickItem",CameraDetails_Update:"cameraDetails:Update"}};constructor(_e,Dt,Vt=null){if(Dt.identifier!=="wc-epigraph-configurator-core")return LOGGER.error({title:"Invalid identifier on the 'wc-epigraph-configurator-core'. Unable to initialize the ConfiguratorCoreAPI class."}),null;this.stores=_e,Object.freeze(this.CORE_EVENTS),this.#o=Dt,this.#s=performance.now(),this.#n=Vt,this.#o.addEventListener(this.EVENTS.SCENE.CartItems_Updated,()=>{this.#c=void 0,this.#u=!0,this.#h=!0}),this.setupAnalyticsEventListeners(),this.#t=!0}set shadowRootRef(_e){this.#r=_e}get shadowRootRef(){return this.#r}set configuratorWCRef(_e){this.#a=_e}get configuratorWCRef(){return this.#a}set clientAccessKey(_e){this.#y=_e}get lastSharedConfigurationID(){return this.#c}set lastSharedConfigurationID(_e){this.#c=_e}set projectId(_e){this.#g=_e}get projectId(){return this.#g}set experienceId(_e){this.#p=_e}get experienceId(){return this.#p}get coreWCRef(){return this.#o}getResolvedAssetUrl(_e){return resolveAssetUrl(_e)}getCurrencyFromSymbol(_e){if(typeof _e!="string")return"USD";for(const[Dt,Vt]of Object.entries(this.#e))if(Vt===_e)return Dt;return"USD"}getCurrentCurrencySymbol(){return this.stores.coreSceneStore.getState().sceneSettings.currency.replace(/\s/g,"")}getCurrentCurrencyCode(){return this.getCurrencyFromSymbol(this.getCurrentCurrencySymbol())}initializeAnalytics(_e,Dt=!1){const Vt=this.coreWCRef.consentPlugin??null,Gt=this.coreWCRef.consentIdentifier??null;if(this.epigraphAnalytics=new X$2(Vt,Gt),_e.gaMeasurementId!=="")try{this.epigraphAnalytics.addEventPlugin(new I$2({trackingID:_e.gaMeasurementId,experienceID:this.#p,solution:"epigraph-configurator",verboseLogging:!0}))}catch(zt){LOGGER.info({title:"Error initializing GA4 Analytics",details:zt})}_e.epgExperienceID!==void 0&&this.epigraphAnalytics.addEventPlugin(new C$2({trackingID:_e.epgExperienceID,experienceID:this.#p,solution:"epigraph-configurator",sessionId:crypto.randomUUID(),xPath:"",verboseLogging:!1,sendToStaging:Dt}))}get isReady(){return this.#t}get preloadProgress(){return this.#i}get categoryData(){return this.stores.productDataStore.getState().categoryData}get productData(){return this.stores.productDataStore.getState().productData}get lookData(){return this.stores.productDataStore.getState().lookData}get hotspotsData(){return this.stores.productDataStore.getState().hotspotsData}get sceneSettings(){return this.stores.coreSceneStore.getState().sceneSettings}get assetsData(){return this.stores.productDataStore.getState().assetsData}get isMobile(){return this.stores.coreSceneStore.getState().isMobile}get isScreenPortrait(){return this.stores.uiSceneStore.getState().isScreenPortrait}getDeviceState(){return this.stores.coreSceneStore.getState().actions.getDeviceState()}get hasSceneChanged(){return this.#u}set hasSceneChanged(_e){this.#u=_e}enableCart(){this.stores.coreSceneStore.getState().actions.enableCart()}disableCart(){this.stores.coreSceneStore.getState().actions.disableCart()}fireEvent(_e,Dt){let Vt=new CustomEvent(_e,{bubbles:!0,cancelable:!1,composed:!0});Vt.data=Dt,this.coreWCRef?this.coreWCRef.dispatchEvent(Vt):LOGGER.warn({title:"core web component not found!"})}setupAnalyticsEventListeners(){this.coreWCRef.addEventListener("coreApi:ready",_e=>{const Dt=((performance.now()-this.#s)/1e3).toFixed(2);if(this.#l=Dt,this.epigraphAnalytics){const Vt=new S$3(!1,Dt*1e3);this.epigraphAnalytics.sendEvent(Vt)}}),this.coreWCRef.addEventListener("coreApi:failed",_e=>{if(this.epigraphAnalytics){const Dt=new T$1(!1,((performance.now()-this.#s)/1e3).toFixed(2)*1e3,"authentication-failed");this.epigraphAnalytics.sendEvent(Dt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Added,_e=>{LOGGER.info({title:"Add Item",details:_e});const Dt=_e.data.itemData.guid,Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt),zt=[{item_id:_e.data.itemData.skuID,item_name:_e.data.itemData.name,price:Gt.price,quantity:1}],jt=this.stores.coreSceneStore.getState().preconfigurationLoaded==!1&&this.stores.coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,Ht=this.stores.coreSceneStore.getState().configurationLoaded==!1&&this.stores.coreSceneStore.getState().preconfigurationLoaded==!0&&this.stores.coreSceneStore.getState().configurationLoadedOnRestart==!0;if(jt||Ht){if(this.epigraphAnalytics){const Wt=new R$2(zt,!1,Gt.price,this.getCurrentCurrencyCode(),1);this.epigraphAnalytics.sendEvent(Wt)}}else if(this.epigraphAnalytics){const Wt=new R$2(zt,!0,Gt.price,this.getCurrentCurrencyCode(),1);this.epigraphAnalytics.sendEvent(Wt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Removed,_e=>{if(LOGGER.info({title:"Remove Item"}),_e.data.itemData==null)return;const Dt=_e.data.itemData.guid,Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt),zt=Gt.skuID,jt=this.stores.coreSceneStore.getState().sceneSettings.currency.replace(/\s/g,"");if(this.epigraphAnalytics){const Ht=new k$2([{item_id:zt,item_name:_e.data.itemData.name,price:Gt.price,quantity:1}],jt,1);this.epigraphAnalytics.sendEvent(Ht)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,_e=>{if(this.epigraphAnalytics){const Dt=new q$4("hotspot_enter",_e.data.hotspotAbsID);this.epigraphAnalytics.sendEvent(Dt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,_e=>{if(this.epigraphAnalytics){const Dt=new q$4("hotspot_exit",_e.data.hotspotAbsID);this.epigraphAnalytics.sendEvent(Dt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Cart_Checkout,async _e=>{if(this.epigraphAnalytics){const Dt=await this.getItemsArrayForAnalytics(),Vt=new V$3(Dt,_e.data.details.total,this.getCurrentCurrencyCode());this.epigraphAnalytics.sendEvent(Vt)}})}getPreconfigurationModuleData(){return this.stores.productDataStore.getState().categoryData.preconfiguration}setEmptySceneText(_e){const Dt=this.stores.coreSceneStore.getState().sceneSettings;Dt.emptySceneText=_e,this.stores.coreSceneStore.setState({sceneSettings:{...Dt}})}getSpawningRequirementForSkuID(_e){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getSpawningRequirementForSkuID(_e)}getAllSkusThatCanReplaceGuid(_e){if(!this.stores.itemStore.getState().itemsSpawned[_e])return LOGGER.warn({title:"Item with guid: "+_e+" doesn't exist"}),[];const zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);return zt?zt.getAllSkusThatCanReplaceMe():(LOGGER.warn({title:"Node with guid: "+_e+" doesn't exist"}),[])}getCartItems(){return this.stores.attachmentStore.getState().attachmentSystem.getCartItems()}async getCartItemsAsync(){return await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync()}checkout(_e=!1){const Dt=this.stores.attachmentStore.getState().attachmentSystem;this.#m=this.getSceneStructure();let Vt=Dt.getCartItems();return Vt=this.stores.dynamicHookStore.getState().hookOnCheckout(Vt,this),Vt==null?null:(LOGGER.warn({title:"CONFIGURATOR CHECKED OUT: "}),LOGGER.table(Vt),_e===!0||Vt.cartItems.find(Gt=>Gt.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,Vt),this.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,Vt),Vt)}async checkoutAsync(_e=!1){const Dt=this.stores.attachmentStore.getState().attachmentSystem;this.#m=this.getSceneStructure();let Vt=Dt.getCartItems();return Vt=await this.stores.dynamicHookStore.getState().hookOnCheckout(Vt,this),Vt==null?null:(LOGGER.warn({title:"CONFIGURATOR CHECKED OUT: "}),LOGGER.table(Vt),_e===!0||Vt.cartItems.find(Gt=>Gt.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,Vt),this.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,Vt),Vt)}async reloadCheckedoutScene(){if(!this.#m){LOGGER.info({title:"No data found since last checkout"});return}await this.loadSceneFromConfiguration(this.#m)}getCurrentItemsInReplaceableCategory(){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getCurrentItemsInReplaceableCategory()}async getSceneAsGlbUrl(){return this.#h===!1?this.#f:(URL.revokeObjectURL(this.#f),this.#f=void 0,this.#f=await getSceneAsGLBUrl(this.stores),this.#h=!1,this.#f)}async getSceneAsUsdzUrl(){return this.#h===!1?this.#d:(URL.revokeObjectURL(this.#d),this.#d=void 0,this.#d=await getSceneAsUsdzUrl(this.stores),this.#h=!1,this.#d)}async generateShareableLink(_e=!1){if(!this.#u&&this.#c)LOGGER.info({title:"Reusing the cached configuration ID that was last saved..."});else{LOGGER.info({title:"Generating a new configuration ID..."});let Gt=this.stores.attachmentStore.getState().actions.export(),zt=await this.stores.nexusApiInstance.postExperienceSaveAndShare(this.experienceId,Gt);this.#c=zt.payload.save_id}const Dt=window.location.href;let Vt=new URL(Dt);if(_e===!0&&Vt.searchParams.set("launchInAR",!0),Vt.searchParams.set("projectId",this.projectId),Vt.searchParams.set("epgsharedconfigid",this.#c),this.#u=!1,this.epigraphAnalytics){const Gt=await this.getItemsArrayForAnalytics(),zt=new U$2(Gt,"configuration","link");this.epigraphAnalytics.sendEvent(zt)}return Vt.href}closeContextMenu(){this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem()}updatePreloadProgress(_e){const Dt=this.#i;this.#i=_e;const Vt=new CustomEvent("preload:update",{detail:{progress:this.#i}});window.dispatchEvent(Vt),typeof this.#n=="function"&&this.#n(Dt,_e)}alert({alertMsg:_e,alertTime:Dt,alertType:Vt,alertLabel:Gt,persistant:zt=!1,alertId:jt}){this.stores.coreSceneStore.getState().actions.sendAlert({alertMsg:_e,alertTime:Dt,alertType:Vt,alertLabel:Gt,persistant:zt,alertId:jt})}removePersistantAlert(){this.stores.coreSceneStore.setState({persistantAlertData:null})}clickHotspot(_e){let Dt=this.coreWCRef.shadowRootRef.getElementById(_e);Dt&&Dt.click()}exitHotspot(){this.stores.hotspotStore.getState().actions.exitHotspot(!1)}isSystemBusy(){return this.stores.itemStore.getState().isBusy()}async spawnGhostsForSkuID(_e,Dt=!1,Vt){return this.isSystemBusy()?null:await this.stores.ghostStore.getState().actions.spawnGhostsForSkuID(_e,Dt,Vt)}removeAllGhosts(){if(this.stores.itemStore.getState().isBusy())return null;this.stores.ghostStore.getState().actions.clearAllGhosts()}printSceneHierarchy(_e=!1){const Dt=this.stores.coreSceneStore.getState().sceneRef;(function Vt(Gt){const zt=`${Gt.name} < ${Gt.type} >`;_e===!0?console.groupCollapsed(zt):console.group(zt),Gt.children.forEach(Vt),console.groupEnd()})(Dt)}getSceneItems(){const _e=this.stores.itemStore.getState().itemsSpawned;if(typeof _e!="object"){LOGGER.error({title:"There was an error while fetching the scene item count."});return}return _e}getSceneItemCount(){let _e;const Dt=this.stores.itemStore.getState().itemsSpawned;return typeof Dt!="object"&&LOGGER.error({title:"There was an error while fetching the scene item count."}),_e=Object.keys(Dt).length,_e}async spawnItemBySkuID(_e,Dt=!1){if(this.isSystemBusy())return null;const Vt=this.getActiveGhostData();return Vt&&Vt.skuID!==_e?null:(Dt===!0&&!Vt&&await this.spawnGhostsForSkuID(_e,!1,1),await this.stores.itemStore.getState().actions.addItemBySkuID(_e,0))}async spawnItemBySkuIDAndGhostIndex(_e,Dt=0){if(this.stores.itemStore.getState().isBusy())return null;let Vt=null;const Gt=this.getActiveGhostData();return Dt>=0&&Gt.count>Dt&&Gt.skuID==_e&&(Vt=await this.stores.itemStore.getState().actions.addItemBySkuID(_e,Dt)),Vt}async replaceItemBySkuId(_e,Dt){return await this.stores.itemStore.getState().actions.replaceGuidItemBySkuId(_e,Dt)}async replaceItemsBySkuId(_e,Dt){if(!Array.isArray(_e))throw new Error("guids parameter must be an array");try{for(const Vt of _e)await this.replaceItemBySkuId(Vt,Dt);return!0}catch(Vt){throw new Error(`Failed to replace items by SKU ID: ${Vt.message}`)}}async replaceAllItemsBySkuId(_e,Dt){const Vt=[],Gt=this.stores.itemStore.getState().itemsSpawned;Object.keys(Gt).map(zt=>{Gt[zt].itemData.skuID==_e&&Vt.push(zt)});try{for(const zt of Vt)await this.replaceItemBySkuId(zt,Dt);return!0}catch(zt){throw new Error(`Failed to replace items by SKU ID: ${zt.message}`)}}async removeItemByGUID(_e,Dt=!1){if(this.stores.itemStore.getState().isBusy())return null;const Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);return Dt===!1&&Gt.canSwapRoot===!0&&Gt.swapRoot(),await this.stores.itemStore.getState().actions.removeItemByGUID(_e)}triggerItemRemoveModal(_e){const Dt=this.getGuidItemAttachedDependencies(_e);Dt&&this.fireEvent(this.EVENTS.SCENE.ItemRemoveModalTriggered,Dt)}async updateFittingSkuIds(){await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}rotateItemByGUID(_e){this.stores.attachmentStore.getState().attachmentSystem.currentStructure.rotateNode(_e)}rotateSelectedItem(){const _e=this.stores.itemStore.getState().selectedItemData;if(!_e){LOGGER.info({title:"No current item selected to rotate"});return}const Dt=_e.itemData.guid;return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.rotateNode(Dt),_e}removeLastItemBySkuId(_e){const Dt=this.stores.itemStore.getState().itemsSpawned,Vt=Object.keys(Dt);for(let Gt=Vt.length-1;Gt>=0;Gt--){const zt=Vt[Gt];if(Dt[zt].itemData.skuID===_e){this.doesGuidItemHaveAnAttachedDependency(zt)?(this.selectItemWithGUID(zt),this.triggerItemRemoveModal(zt)):this.removeItemByGUID(zt);break}}}async removeSelectedItem(){const _e=this.stores.itemStore.getState().selectedItemData;if(!_e){LOGGER.info({title:"No current item selected to delete"});return}const Dt=_e.itemData.guid;return this.stores.itemStore.getState().actions.deselectItem(),await this.removeItemByGUID(Dt),LOGGER.info({title:`Removed Item: ${Dt}`}),_e}refocus(){this.stores.coreSceneStore.getState().actions.triggerAutoFocus()}getActiveGhostData(){return this.stores.ghostStore.getState().ghostData}focusOnGhosts(){if(this.stores.ghostStore.getState().ghostParentRef===null){LOGGER.warn({title:"Ghost Parent Reference not found"});return}this.stores.ghostStore.getState().ghostParentRef.children.length<=0?this.stores.coreSceneStore.getState().actions.triggerAutoFocus():this.stores.coreSceneStore.getState().actions.triggerAutoFocus(this.stores.ghostStore.getState().ghostParentRef)}exitSelectedItem(){this.stores.itemStore.getState().actions.deselectItem()}getSelectedItemData(){return this.stores.itemStore.getState().selectedItemData}canSelectedItemRotate(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure;let Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canRotate:!1}canSelectedItemBeRemoved(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canRemove:!1}canSelectedItemDrag(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canDrag:!1}doesGuidItemHaveAnAttachedDependency(_e){let Dt=!0;const Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e),zt=Gt.isEndNode;return Dt=!zt,zt||Gt.canSwapRoot&&Gt.whichNodesAreAttachedToUs().length==1&&(Dt=!1),Dt}getGuidItemAttachedDependencies(_e){const Dt=this.stores.attachmentStore.getState().attachmentSystem,Vt=this.stores.itemStore.getState().itemsSpawned,Gt=Dt.currentStructure.getNodeByGUID(_e);if(!Gt)return;let zt={[Gt.guid]:{...Vt[Gt.guid]}};return Gt.getAllBranchedNodesAttachedToUs().forEach(Ht=>{zt[Ht.guid]=Vt[Ht.guid]}),zt}doesSelectedItemHasAttachedDependency(){const _e=this.getSelectedItemData();return _e?this.doesGuidItemHaveAnAttachedDependency(_e.itemData.guid):!1}isSelectedItemAnEndNode(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).isEndNode:!1}getCurrentSceneEnvMap(){return this.stores.lightStore.getState().envMapUrl}async switchGlobalGeometryVariant(_e,Dt){if(!_e){LOGGER.WARN({title:"Geometry Category: '"+_e+"' not valid!"});return}if(this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),await this.stores.attachmentStore.getState().attachmentSystem.switchGlobalGeometryVariant(_e,Dt),await wait(1),this.epigraphAnalytics){const Ht=await this.getItemsArrayForAnalytics(),Wt=new j$1(Ht,"category-geometry");this.epigraphAnalytics.sendEvent(Wt)}const Gt=this.stores.productDataStore.getState().categoryData.geometryVariants;let zt=null;if(Gt.map(Ht=>{Ht.id==_e&&(zt=Ht)}),!zt)return;const jt=zt.variants[Dt];this.alert({alertMsg:zt.label.charAt(0).toUpperCase()+zt.label.slice(1)+" was successfully switched to "+jt.label.charAt(0).toUpperCase()+jt.label.slice(1)+".",alertTime:3e3,alertType:"success",alertLabel:`${zt.label} Changed`,alertId:"geometryVariantChanged"})}async switchGlobalVariant(_e,Dt=""){if(!_e){LOGGER.WARN({title:"Look Category: '"+_e+"' not valid!"});return}if(this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),LOGGER.info({title:`Changing Global Variant: Category: ${_e} Id: ${Dt}`}),await this.stores.attachmentStore.getState().attachmentSystem.switchGlobalVariant(_e,Dt),await wait(1),this.epigraphAnalytics){const Vt=await this.getItemsArrayForAnalytics(),Gt=new j$1(Vt,"category-variant");this.epigraphAnalytics.sendEvent(Gt)}}async overrideSelectedItemMaterial(_e=""){return this.stores.itemStore.getState().selectedItemData?(await this.stores.itemStore.getState().actions.switchToVariant(this.stores.itemStore.getState().selectedItemData.itemData,_e,!0),!0):!1}async overrideItemMaterialByGuid(_e,Dt){const Vt=this.stores.itemStore.getState().itemsSpawned[_e];if(!Vt)return LOGGER.warn({title:"Item with guid: "+_e+" doesn't exist"}),!1;if(await this.stores.itemStore.getState().actions.switchToVariant(Vt.itemData,Dt,!0),this.epigraphAnalytics){const Gt=new j$1([{item_id:Vt.itemData.skuID,item_name:Vt.itemData.name,price:Vt.itemData.lookDetails[Dt].price,quantity:1}],"variant");this.epigraphAnalytics.sendEvent(Gt)}return!0}getSelectedItemColors(){let _e=[];if(this.getSelectedItemData()==null)return _e;let Vt=this.getSelectedItemData().itemData.looks;if(Vt){let Gt=this.stores.productDataStore.getState().lookData;Vt.map(zt=>{Gt.hasOwnProperty(zt)&&_e.push(Gt[zt])})}return _e}getCanvasSize(){return this.stores.coreSceneStore.getState().canvasSize}async removeAllVariantOverrides(){return this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),await this.stores.attachmentStore.getState().attachmentSystem.removeAllVariantOverrides()}switchCursor(_e){this.stores.coreSceneStore&&this.stores.coreSceneStore.getState().actions.switchCursor(_e)}getSceneStructure(){return this.stores.attachmentStore.getState().actions.export()}getSceneStructureRaw(){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure}async getItemsArrayForAnalytics(){const _e=this.stores.attachmentStore.getState().attachmentSystem;if(!_e)return[];let Dt=await _e.getCartItemsAsync();if(Dt=await this.stores.dynamicHookStore.getState().hookOnCheckout(Dt,this),console.log(Dt),Dt==null)return[];let Vt=[];for(const Gt of Dt.cartItems){const jt=this.stores.productDataStore.getState().productData[Gt.skuID];Vt.push({item_id:Gt.clientProductId,item_name:jt.name,price:Gt.price,quantity:Gt.count})}return Vt}getAllConnectionsInScene(){const _e=this.getSceneStructureRaw(),Dt=new Map;for(const Vt of _e.nodes)for(const Gt of Vt.plugs){if(!Gt.attachedPlugGUID)continue;const zt=[Gt.guid,Gt.attachedPlugGUID].sort().join();Dt.has(zt)||Dt.set(zt,{from:Gt,to:Gt.attachedPlug})}return Dt}async loadSceneFromConfiguration(_e){await this.stores.attachmentStore.getState().actions.loadStructure(_e)}async loadSceneFromConfigurationID(_e,Dt=!0){const Vt=await this.stores.attachmentStore.getState().actions.loadSavedStructureFromConfigID(_e);if(!Vt)return null;Dt===!0&&this.stores.attachmentStore.setState({defaultConfig:Vt});let Gt=Object.assign({},CONFIGURATOR_LOAD_FROM_PRECONFIG);Gt.label=`Preconfig ID: ${_e}`,await this.loadSceneFromConfiguration(Vt)}async viewInYourSpace(){if(LOGGER.info({title:"View in your space called from the Core API"}),this.#o.epigraphViewInYourSpaceRef.onViewInYourSpaceButtonClicked(),this.epigraphAnalytics){const _e=await this.getItemsArrayForAnalytics(),Dt=new w$2(_e);this.epigraphAnalytics.sendEvent(Dt)}}async shareScene(){return await this.generateShareableLink()}async clearScene(){return await this.stores.attachmentStore.getState().attachmentSystem.clear()}async restartScene(){if(LOGGER.info({title:"Restarting Scene."}),await this.stores.attachmentStore.getState().attachmentSystem.restart(),this.epigraphAnalytics){const _e=new q$4("restart","restart-scene");this.epigraphAnalytics.sendEvent(_e)}}areDimensionsVisible(){return this.stores.coreSceneStore.getState().showDimensions}getCurrentDimensions(){return this.stores.coreSceneStore.getState().boundData}getActiveHotspot(){return this.stores.hotspotStore.getState().activeHotspotData}reviewCartShown(){const _e=new q$4("review_cart","preview-cart-button");this.fireEvent(this.EVENTS.UI.ReviewCart_Shown,_e),this.epigraphAnalytics.sendEvent(_e)}isGeometryVisibleForGUID(_e,Dt){const Vt={success:!1,result:!1},zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt);return zt.ref&&zt.ref.traverse(jt=>{jt.name===_e&&(console.log(jt),Vt.success=!0,Vt.result=jt.visible)}),Vt}reviewCartHidden(){const _e=new q$4("review_cart","preview-cart-close-button");this.fireEvent(this.EVENTS.UI.ReviewCart_Hidden,_e),this.epigraphAnalytics&&this.epigraphAnalytics.sendEvent(_e)}sendShowInstructionsBtnAnalyticsEvent(){if(this.epigraphAnalytics){const _e=new q$4("show_instructions","show-instructions-button");this.epigraphAnalytics.sendEvent(_e)}}async showInstructions(){this.fireEvent(this.EVENTS.UI.Instructions_Show),this.#v=Date.now();const _e=localStorage.getItem("instructionsDisplayed-"+this.#g),Dt=await this.getItemsArrayForAnalytics(),Vt=new O$2(Dt,!!_e,"info_panel",_e?"button":"auto");this.epigraphAnalytics.sendEvent(Vt)}showDimensions(){if(this.stores.coreSceneStore.setState({showDimensions:!0}),this.epigraphAnalytics){const _e=new q$4("dimensions_show","dimensions-button");this.epigraphAnalytics.sendEvent(_e)}}async hideDimensions(){if(this.stores.coreSceneStore.setState({showDimensions:!1}),this.epigraphAnalytics){const _e=new q$4("dimensions_hide","dimensions-button");this.epigraphAnalytics.sendEvent(_e)}}areHotspotsVisible(){return this.stores.hotspotStore.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return this.stores.hotspotStore.getState().hotspotsTempVisibility}showAllHotspots(_e=!1){this.stores.hotspotStore.getState().actions.switchHotspotsVisibility(!0,_e)}hideAllHotspots(_e=!1){this.stores.hotspotStore.getState().actions.switchHotspotsVisibility(!1,_e)}getFittingSkuIds(){return this.stores.attachmentStore.getState().attachmentSystem.getFittingSKUIDs()}selectItemWithGUID(_e){const Dt=this.stores.itemStore.getState().itemsSpawned,Vt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);this.stores.itemStore.getState().actions.setSelectedItemData({...Dt[_e],overrideVariant:Vt.overrideVariant,currentVariant:Vt.currentVariant,offsetX:0,offsetY:0})}async getCurrentCameraDetails(){return new Promise((_e,Dt)=>{this.coreWCRef.addEventListener(this.EVENTS.CONFIGURATION.CameraDetails_Update,Vt=>{_e(Vt.data)},{once:!0}),this.stores.cameraStore.getState().actions.triggerFetchingCamera()})}moveCamera(_e,Dt,Vt=!0){this.stores.hotspotStore.setState({isAnyHotspotActive:!0}),_e&&this.stores.cameraStore.setState({viewPointPosition:ArrToVec3(_e)}),Dt&&this.stores.cameraStore.setState({focusPointPosition:ArrToVec3(Dt)}),this.stores.cameraStore.setState({resetToLastPosition:Vt})}setEnvLightMap(_e){this.stores.lightStore.setState({envMapUrl:_e})}updateInventoryForAllProducts(_e){return this.stores.inventoryStore.getState().actions.updateInventoryForAllProducts(_e),this.getInventoryInfo()}getInventoryInfo(){return JSON.parse(JSON.stringify(this.stores.inventoryStore.getState().inventoryData))}updateCompareAtPricingForAllProducts(_e){this.stores.productDataStore.getState().actions.updateCompareAtPricingForAllProducts(_e);const Vt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentCompareAtPricingInfo()}updatePricingForAllProducts(_e){this.stores.productDataStore.getState().actions.updatePricingForAllProducts(_e);const Vt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentPricingInfo()}async updateCompareAtPricingForAllProductsAsync(_e){this.stores.productDataStore.getState().actions.updateCompareAtPricingForAllProducts(_e);const Vt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentCompareAtPricingInfo()}async updatePricingForAllProductsAsync(_e){this.stores.productDataStore.getState().actions.updatePricingForAllProducts(_e);const Vt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentPricingInfo()}updatePricingForProduct(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updatePricingForProduct(_e,Dt,Vt);const zt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentPricingInfo()}updateCompareAtPricingForProduct(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updateCompareAtPricingForProduct(_e,Dt,Vt);const zt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentCompareAtPricingInfo()}async updatePricingForProductAsync(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updatePricingForProduct(_e,Dt,Vt);const zt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentPricingInfo()}async updateCompareAtPricingForProductAsync(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updateCompareAtPricingForProduct(_e,Dt,Vt);const zt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentCompareAtPricingInfo()}getCurrentPricingInfo(){return this.stores.productDataStore.getState().actions.getCurrentPricingInfo()}getCurrentCompareAtPricingInfo(){return this.stores.productDataStore.getState().actions.getCurrentCompareAtPricingInfo()}async itemDragStart(_e){if(this.stores.itemStore.getState().isBusy())return null;this.stores.coreSceneStore.setState({hoveredGhostIndex:-1}),await this.removeAllGhosts(),this.stores.coreSceneStore.setState({itemDraggedSkuID:_e}),await this.spawnGhostsForSkuID(_e,!1)}async itemDragEnd(){if(this.stores.itemStore.getState().isBusy())return null;const _e=this.stores.coreSceneStore.getState().hoveredGhostIndex;_e!==-1?await this.stores.itemStore.getState().actions.addItemBySkuID(this.stores.coreSceneStore.getState().itemDraggedSkuID,_e):await this.removeAllGhosts(),this.stores.coreSceneStore.setState({itemDraggedSkuID:null,hoveredGhostIndex:-1})}async forceSpawnItem(_e,Dt){const Vt=this.stores.productDataStore.getState().productData,Gt=this.stores.attachmentStore.getState().attachmentSystem;if(!Gt)return;const zt=Gt.currentStructure;if(!zt)return;let jt=zt.getNodeByGUID(Dt);jt?(jt._skuID=_e,jt.generatePlugsForNode(_e)):(jt=new Node$1(this.stores,_e,{guid:Dt,isEndNode:!0,overrideVariant:null,plugs:Vt[_e].plugs}),zt.addNode(jt),zt.connectPlugs({incomingPlug:new Plug({name:"tempPlug",acceptedPlugTypes:[],connectsToPlugTypes:[]},jt),receiverPlug:zt.rootNode.plugs[0]}));const Ht=await this.stores.itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},_e,Dt);return await wait(1),Ht}async getScreenshotForCurrentCamera(_e){return await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(null,_e)}async getScreenshotForCamera(_e,Dt){return await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(_e,Dt)}async getAllPredefinedScreenshots(_e){const Dt=this.stores.coreSceneStore.getState().sceneSettings.screenshotCameras,Vt=[];for(const Gt of Dt){const zt=await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(Gt,_e);Vt.push(zt)}return Vt}setCameraFocusPointPosition(_e){this.stores.cameraStore.setState({focusPointPosition:_e})}triggerFetchingCamera(){this.stores.cameraStore.getState().actions.triggerFetchingCamera()}async completeItemDrop(){await this.stores.coreSceneStore.getState().actions.completeDropItem()}revertItemDrop(){this.stores.coreSceneStore.getState().actions.revertDropItem()}getCameraFocusPointPosition(){return this.stores.cameraStore.getState().focusPointPosition}sendAnalyticsPageViewedEvent(){}sendAnalyticsEvent(_e){if(this.epigraphAnalytics!==null)try{if(_e&&typeof _e.eventName=="string")this.epigraphAnalytics.sendEvent(_e);else if(LOGGER.warn({title:"Deprecated analytics event format detected. Please migrate to Epigraph events.",details:"Use epigraphAnalytics.sendEvent() directly with Epigraph events instead of sendAnalyticsEvent()"}),_e&&_e.action){const Dt=new K$2(_e.action,_e.interaction?.nonInteraction===!1,_e.parameters||{});this.epigraphAnalytics.sendEvent(Dt)}}catch(Dt){LOGGER.error({title:"Failed to send analytics event",details:Dt})}}isIosDevice(){return IS_IOS}actionButtonClicked(_e){this.fireEvent(this.EVENTS.SCENE.ActionButton_Clicked,{data:_e.actionButton.data,skuID:_e.skuID,count:_e.count,price:_e.price,compareAtPrice:_e.compareAtPrice,countAvailable:_e.countAvailable,countUnavailable:_e.countUnavailable,currentVariant:_e.currentVariant})}setCartMessage(_e){this.fireEvent(this.EVENTS.SCENE.CartMessage_Update,{cartMessage:_e})}convertQuaternionToEuler(_e){return new Euler(0,0,0,"XYZ").setFromQuaternion(_e)}convertDegreeToRadians(_e){return MathUtils.degToRad(_e)}convertRadiansToDegree(_e){return MathUtils.radToDeg(_e)}createVector3(_e,Dt,Vt){return new Vector3(_e,Dt,Vt)}isFacingInDirection(_e,Dt){return ConfiguratorCoreAPI.forwardVector3.set(0,0,1),Dt.normalize(),ConfiguratorCoreAPI.forwardVector3.applyQuaternion(_e),ConfiguratorCoreAPI.forwardVector3.dot(Dt)>=0}}const EpigraphConfiguratorCore=reactExports.forwardRef(({customVersionId:kt,experienceId:_e,stores:Dt,viewInYourSpaceRef:Vt,configuratorWcRef:Gt,initialConfigId:zt,clientAccessKey:jt,consentPlugin:Ht,consentIdentifier:Wt,gaMeasurementId:qt,builderMode:Xt,id:Kt,disableCart:Yt,apiMode:Zt},Jt)=>{const[nn,rn]=reactExports.useState(null);reactExports.useEffect(()=>{Jt.current&&(Jt.current.identifier="wc-epigraph-configurator-core",Jt.current.epigraphViewInYourSpaceRef=void 0,Jt.current.initialConfigId="",Jt.current.clientAccessKey="",Jt.current.consentPlugin="",Jt.current.consentIdentifier="",Jt.current.gaMeasurementId="",Jt.current.configuratorWcRef=void 0,Jt.current.builderMode=!1,Jt.current.projectId="",Jt.current.api=null,Jt.current.api=new ConfiguratorCoreAPI(Dt,Jt.current),Dt.coreSceneStore.setState({CORE_API:Jt.current.api}),en(Jt.current))},[Jt]),reactExports.useEffect(()=>{Jt.current&&Vt&&(Vt.current&&(Jt.current.epigraphViewInYourSpaceRef=Vt.current),LOGGER.info({title:"ViewInYourSpace is now accessible from the core: "}))},[Jt,Vt]);const Qt=reactExports.useCallback(tn=>{Gt&&(tn.configuratorWCRef=Gt,tn.shadowRootRef=tn.configuratorWCRef.shadowRoot,tn.api.shadowRootRef=tn.shadowRootRef,tn.api.configuratorWCRef=tn.configuratorWCRef),kt&&(tn.customVersionId=kt),zt&&(tn.initialConfigId=zt),jt&&(tn.clientAccessKey=jt),Ht&&(tn.consentPlugin=Ht),Wt&&(tn.consentIdentifier=Wt),qt&&(tn.gaMeasurementId=qt),Xt&&(tn.builderMode=!0),LOGGER.group("Collected Web Component Attributes"),LOGGER.table({initialConfigId:tn.initialConfigId,clientAccessKey:tn.clientAccessKey,consentPlugin:tn.consentPlugin,consentIdentifier:tn.consentIdentifier,builderMode:tn.builderMode}),LOGGER.groupEnd()},[Xt,zt,qt,jt,Gt]),en=reactExports.useCallback(async tn=>{if(tn.coreReady===!0)return;Qt(tn);let sn=kt;!sn&&IS_DEV_ENV&&(sn="latest");let cn={};if(Zt==="input.json"?cn={payload:{project_id:"local-project",experience_id:"",configurator_data:await __vitePreload(()=>import("./input-afb87ea8.js"),[]),session_details:{environment:"development"}},report:"Local Input Json",success:!0}:jt?cn=await Dt.nexusApiInstance.getConfiguratorByClientAccessKey(jt,sn):cn=await Dt.nexusApiInstance.getConfiguratorByExperienceId(_e,sn),tn.validationPassed=cn.success,tn.validationPassed==!1){LOGGER.error({title:"Request from an invalidated source: "+window.location.href}),Dt.coreSceneStore.getState().CORE_API.fireEvent("coreApi:failed");return}Dt.nexusApiResponseEnvironment=cn.payload.session_details.environment,tn.projectId=cn.payload.project_id,tn.experienceId=cn.payload.experience_id,Dt.experienceId=cn.payload.experience_id,tn.api.projectId=tn.projectId,tn.api.experienceId=tn.experienceId;const un=cn.payload.configurator_data,hn={gaMeasurementId:tn.gaMeasurementId??void 0,epgExperienceID:tn.experienceId??void 0};Dt.coreSceneStore.getState().CORE_API.initializeAnalytics(hn,IS_DEV_ENV);let fn=new URL(window.location).searchParams;if(fn.has("epgsharedconfigid")&&(tn.initialConfigId=fn.get("epgsharedconfigid")),Dt.coreSceneStore.getState().CORE_API.epigraphAnalytics){const pn=new x$2(fn.has("epgsharedconfigid"));Dt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(pn)}LOGGER.info({title:"VALIDATION SUCCESSFUL!"}),tn.coreReady=!0,rn({projectId:tn.projectId,parsedData:un,customVersionId:tn.customVersionId,clientAccessKey:tn.clientAccessKey,consentPlugin:tn.consentPlugin,consentIdentifier:tn.consentIdentifier,initialConfigId:tn.initialConfigId,builderMode:tn.builderMode})},[]);return reactExports.useEffect(()=>async()=>{if(Dt.coreSceneStore.getState().CORE_API){if(Dt.coreSceneStore.getState().CORE_API.epigraphAnalytics){const tn=await Dt.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics(),sn=new L$2(tn);Dt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(sn)}Dt.coreSceneStore.getState().CORE_API.fireEvent("coreApi:shutDown")}},[]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{id:Kt,ref:Jt,children:nn&&jsxRuntimeExports.jsx(App$1,{parsedData:nn.parsedData,stores:Dt,clientAccessKey:nn.clientAccessKey,consentPlugin:nn.consentPlugin,consentIdentifier:nn.consentIdentifier,initialConfigId:nn.initialConfigId,builderMode:nn.builderMode,disableCart:Yt!==void 0?Yt:!1})})})}),ViewInYourSpace=React.forwardRef((kt,_e)=>{const[Dt,Vt]=reactExports.useState(!1),[Gt,zt]=reactExports.useState(!1),jt=reactExports.useRef(null),Ht=reactExports.useRef(null),Wt=reactExports.useRef(null),qt=reactExports.useRef(null),Xt=reactExports.useRef(null),Kt=reactExports.useRef(null),Yt=reactExports.useRef(null),Zt=reactExports.useRef(null),Jt=reactExports.useRef(null),nn=reactExports.useRef(null),rn=kt.stores.uiSceneStore(Hn=>Hn.dialogPopupOpen),Qt=reactExports.useMemo(()=>`*Technical requirements: iOS Version ${_e?.current?.coreApi?.sceneSettings?.technicalRequirements?.minIosVersion??"11"} and later or Android 8 and later.`,[kt]),en=reactExports.useMemo(()=>`*Technical requirements: iOS Version ${_e?.current?.coreApi?.sceneSettings?.technicalRequirements?.minIosVersion??"11"} and later or Android 8 and later.`,[kt]),tn=()=>{kt["asset-src"]&&(_e.current.assetSrc=kt["asset-src"])};reactExports.useEffect(()=>{!_e.current||!jt.current||!Ht.current||!Wt.current||!qt.current||!Xt.current||!Kt.current||!Yt.current||!Zt.current||!Jt.current||!nn.current||(tn(),_e.current.getQRForURL=async(Hn,qn)=>await Pn(Hn,qn),_e.current.onViewInYourSpaceButtonClicked=async Hn=>await yn(),_e.current.assetSrc="",_e.current.iosAssetSrc="",_e.current.arLink="",_e.current.coreApi=void 0,_e.current.arInProgress=!1,_e.current._modelViewerScriptSource="https://cdn.jsdelivr.net/npm/@google/model-viewer@2.x.x/dist/model-viewer.min.js",_e.current._modelViewer=null,_e.current._qrModalContainer=null,dn(),fn(),un(),_e.current._modelViewer.addEventListener("error",Hn=>{Cn(Hn)}),_e.current._viewInYourSpaceButton.addEventListener("click",Hn=>{yn()}),_e.current.canLaunchAR=sn)},[_e,jt,Ht,Wt,qt,Xt,Kt,Yt,Zt,Jt,nn]);const sn=reactExports.useCallback(()=>_e.current._modelViewer.canActivateAR,[]);reactExports.useEffect(()=>{_e.current&&(kt["asset-src"]&&(_e.current.assetSrc=kt["asset-src"]),kt["core-api"]&&(_e.current.coreApi=kt["core-api"]),cn())},[_e,kt]);const cn=()=>{_e.current._modelViewer.setAttribute("src",_e.current.assetSrc),_e.current._modelViewer.setAttribute("ios-src",_e.current.iosAssetSrc),_e.current._modelViewer.style.display="none"},un=()=>{window.customElements.get("model-viewer")===void 0&&hn(),En(),cn(),_e.current._modelViewer.addEventListener("ar-status",Hn=>{Hn.detail.status==="session-started"?(_e.current._modelViewer.style.display="block",_e.current.arInProgress=!0):(Hn.detail.status==="not-presenting"||Hn.detail.status==="failed")&&(_e.current._modelViewer.style.display="none",_e.current.arInProgress=!1)})},hn=()=>{_e.current._modelViewerScriptElem=document.createElement("script"),_e.current._modelViewerScriptElem.setAttribute("type","module"),_e.current._modelViewerScriptElem.setAttribute("src",_e.current._modelViewerScriptSource),_e.current._modelViewerScriptElem.setAttribute("id","modelViewerScript"),document.head.appendChild(_e.current._modelViewerScriptElem)},fn=()=>{_e.current._qrModalContainer=qt.current,_e.current._qrCodeImage=Xt.current,_e.current._arLink=Kt.current,_e.current._qrLoader=Yt.current,_e.current.doneViewInYourSpaceBtn=Zt.current,_e.current.doneViewInYourSpaceBtn.addEventListener("click",()=>{pn(),Tn()})},pn=async()=>{if(_e.current._qrCodeImage!==null)for(;_e.current._qrCodeImage.firstChild;)_e.current._qrCodeImage.removeChild(_e.current._qrCodeImage.firstChild)},dn=()=>{_e.current.arDrawer=jt.current,_e.current._launchARButton=Ht.current,_e.current._modelDownloadLoader=Wt.current,_e.current._launchARButton.addEventListener("click",()=>{_e.current.arInProgress!==!0&&Rn()})},mn=()=>{_e.current._modelDownloadLoader.classList.remove("loader-hide")},vn=()=>{_e.current._modelDownloadLoader.classList.add("loader-hide")},_n=async()=>{if(zt(!0),xn(),_e.current.arDrawer.show(),kt.stores?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics){const Hn=await kt.stores.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics(),qn=new EpigraphPanelOpenedEvent(Hn,!0,"ar","button");kt.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qn)}},En=()=>{_e.current._modelViewer=Jt.current,_e.current._viewInYourSpaceButton=nn.current},An=async()=>{if(Vt(!0),_e.current._qrModalContainer.show(),kt.stores?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics){const Hn=await kt.stores.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics(),qn=new EpigraphPanelOpenedEvent(Hn,!0,"qr","button");kt.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qn)}},Tn=async()=>{if(Vt(!1),_e.current._qrModalContainer.hide(),kt.stores?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics){const Hn=await kt.stores.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics(),qn=new EpigraphPanelClosedEvent(Hn,!0,"qr","button");kt.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qn)}},Cn=Hn=>{console.error(`[VIEW-IN-YOUR-SPACE ERROR]: Asset load Errors!!
|
|
4649
|
+
*/const HAS_WEBXR_DEVICE_API=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;HAS_WEBXR_DEVICE_API&&self.XRSession.prototype.requestHitTestSource!=null;(()=>{const kt=navigator.userAgent||navigator.vendor||self.opera;let _e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(kt)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(kt.substr(0,4)))&&(_e=!0),_e})();const IS_IOS=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,IS_WKWEBVIEW=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(IS_IOS){if(IS_WKWEBVIEW)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const kt=document.createElement("a");return!!(kt.relList&&kt.relList.supports&&kt.relList.supports("ar"))}}else return!1})();class ConfiguratorCoreAPI{static forwardVector3=new Vector3(0,0,1);#e={EUR:"€",GBP:"£",USD:"$",INR:"₹",JPY:"¥",CAD:"CA$",NZD:"NZ$",SGD:"S$"};#t=!1;#r;#i;#n;#o;#a;#s;#l;#v;#y;#g;#p;#u=!0;#c;#h=!0;#f="";#d="";#m=null;epigraphAnalytics=null;EVENTS={UI:{PreloadScreen_Show:"preload:show",PreloadScreen_Hide:"preload:hide",ContextMenu_InfoBtnClicked:"infoButtonClicked_ContextMenu",ContextMenu_Show:"contextMenu:show",ContextMenu_Hide:"contextMenu:hide",UtilityMenu_Show:"utilityMenu:show",UtilityMenu_Hide:"utilityMenu:hide",ShareButton_Show:"shareButton:show",ShareButton_Hide:"shareButton:hide",ViewInYourSpaceButton_Show:"viewInYourSpace:show",ViewInYourSpaceButton_Hide:"viewInYourSpace:hide",ResetButton_Show:"resetBtn:show",ResetButton_Hide:"resetBtn:hide",DimensionsButton_Show:"dimensionsBtn:show",DimensionsButton_Hide:"dimensionsBtn:hide",Instructions_Show:"instructions:show",ReviewCart_Shown:"review-cart-shown",ReviewCart_Hidden:"review-cart-hidden"},SCENE:{Item_Added:"item:added",Item_Removed:"item:removed",Items_Updated:"items:updated",FittingSkuIds_Updated:"fittingSkuIds:updated",CartItems_Updated:"cartItems:updated",Hotspot_Enter:"hotspot:enter",Hotspot_Exit:"hotspot:exit",SavedConfiguration_Loaded:"loaded-saved-configuration",MaterialOverrides_Exists:"materialOverrideExists",Cart_Checkout:"cart:checkout",Cart_OutOfStock:"cart:outOfStock",Cart_StatusUpdated:"cart:statusUpdated",ReplaceableCategory_Updated:"replaceableCategory:updated",GlobalVariant_Updated:"globalVariant:updated",CategoryData_Updated:"categoryData:updated",GlobalGeometryVariant_Updated:"globalGeometryVariant:updated",Ghost_Loaded:"ghost:loaded",Model_Loaded:"model:loaded",Model_Removed:"model:removed",Scene_Cleared:"scene:cleared",Inventory_Updated:"inventory:updated",DraggingOnDrop_CollisionDetected:"draggingOnDrop:collisionDetected",ItemRemoveModalTriggered:"itemRemoveModal:triggered",ActionButton_Clicked:"actionButton:clicked",CartMessage_Update:"cartMessage:updated"},CONFIGURATION:{OnClickItem:"onClickItem",CameraDetails_Update:"cameraDetails:Update"}};constructor(_e,Dt,Vt=null){if(Dt.identifier!=="wc-epigraph-configurator-core")return LOGGER.error({title:"Invalid identifier on the 'wc-epigraph-configurator-core'. Unable to initialize the ConfiguratorCoreAPI class."}),null;this.stores=_e,Object.freeze(this.CORE_EVENTS),this.#o=Dt,this.#s=performance.now(),this.#n=Vt,this.#o.addEventListener(this.EVENTS.SCENE.CartItems_Updated,()=>{this.#c=void 0,this.#u=!0,this.#h=!0}),this.setupAnalyticsEventListeners(),this.#t=!0}set shadowRootRef(_e){this.#r=_e}get shadowRootRef(){return this.#r}set configuratorWCRef(_e){this.#a=_e}get configuratorWCRef(){return this.#a}set clientAccessKey(_e){this.#y=_e}get lastSharedConfigurationID(){return this.#c}set lastSharedConfigurationID(_e){this.#c=_e}set projectId(_e){this.#g=_e}get projectId(){return this.#g}set experienceId(_e){this.#p=_e}get experienceId(){return this.#p}get coreWCRef(){return this.#o}getResolvedAssetUrl(_e){return resolveAssetUrl(_e)}getCurrencyFromSymbol(_e){if(typeof _e!="string")return"USD";for(const[Dt,Vt]of Object.entries(this.#e))if(Vt===_e)return Dt;return"USD"}getCurrentCurrencySymbol(){return this.stores.coreSceneStore.getState().sceneSettings.currency.replace(/\s/g,"")}getCurrentCurrencyCode(){return this.getCurrencyFromSymbol(this.getCurrentCurrencySymbol())}initializeAnalytics(_e,Dt=!1){const Vt=this.coreWCRef.consentPlugin??null,Gt=this.coreWCRef.consentIdentifier??null;if(this.epigraphAnalytics=new X$2(Vt,Gt),_e.gaMeasurementId!=="")try{this.epigraphAnalytics.addEventPlugin(new I$2({trackingID:_e.gaMeasurementId,experienceID:this.#p,solution:"epigraph-configurator",verboseLogging:!0}))}catch(zt){LOGGER.info({title:"Error initializing GA4 Analytics",details:zt})}_e.epgExperienceID!==void 0&&this.epigraphAnalytics.addEventPlugin(new C$2({trackingID:_e.epgExperienceID,experienceID:this.#p,solution:"epigraph-configurator",sessionId:crypto.randomUUID(),xPath:"",verboseLogging:!1,sendToStaging:Dt}))}get isReady(){return this.#t}get preloadProgress(){return this.#i}get categoryData(){return this.stores.productDataStore.getState().categoryData}get productData(){return this.stores.productDataStore.getState().productData}get lookData(){return this.stores.productDataStore.getState().lookData}get hotspotsData(){return this.stores.productDataStore.getState().hotspotsData}get sceneSettings(){return this.stores.coreSceneStore.getState().sceneSettings}get assetsData(){return this.stores.productDataStore.getState().assetsData}get isMobile(){return this.stores.coreSceneStore.getState().isMobile}get isScreenPortrait(){return this.stores.uiSceneStore.getState().isScreenPortrait}getDeviceState(){return this.stores.coreSceneStore.getState().actions.getDeviceState()}get hasSceneChanged(){return this.#u}set hasSceneChanged(_e){this.#u=_e}enableCart(){this.stores.coreSceneStore.getState().actions.enableCart()}disableCart(){this.stores.coreSceneStore.getState().actions.disableCart()}fireEvent(_e,Dt){let Vt=new CustomEvent(_e,{bubbles:!0,cancelable:!1,composed:!0});Vt.data=Dt,this.coreWCRef?this.coreWCRef.dispatchEvent(Vt):LOGGER.warn({title:"core web component not found!"})}setupAnalyticsEventListeners(){this.coreWCRef.addEventListener("coreApi:ready",_e=>{const Dt=((performance.now()-this.#s)/1e3).toFixed(2);if(this.#l=Dt,this.epigraphAnalytics){const Vt=new S$3(!1,Dt*1e3);this.epigraphAnalytics.sendEvent(Vt)}}),this.coreWCRef.addEventListener("coreApi:failed",_e=>{if(this.epigraphAnalytics){const Dt=new T$1(!1,((performance.now()-this.#s)/1e3).toFixed(2)*1e3,"authentication-failed");this.epigraphAnalytics.sendEvent(Dt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Added,_e=>{LOGGER.info({title:"Add Item",details:_e});const Dt=_e.data.itemData.guid,Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt),zt=[{item_id:_e.data.itemData.skuID,item_name:_e.data.itemData.name,price:Gt.price,quantity:1}],jt=this.stores.coreSceneStore.getState().preconfigurationLoaded==!1&&this.stores.coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,Ht=this.stores.coreSceneStore.getState().configurationLoaded==!1&&this.stores.coreSceneStore.getState().preconfigurationLoaded==!0&&this.stores.coreSceneStore.getState().configurationLoadedOnRestart==!0;if(jt||Ht){if(this.epigraphAnalytics){const Wt=new R$2(zt,!1,Gt.price,this.getCurrentCurrencyCode(),1);this.epigraphAnalytics.sendEvent(Wt)}}else if(this.epigraphAnalytics){const Wt=new R$2(zt,!0,Gt.price,this.getCurrentCurrencyCode(),1);this.epigraphAnalytics.sendEvent(Wt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Removed,_e=>{if(LOGGER.info({title:"Remove Item"}),_e.data.itemData==null)return;const Dt=_e.data.itemData.guid,Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt),zt=Gt.skuID,jt=this.stores.coreSceneStore.getState().sceneSettings.currency.replace(/\s/g,"");if(this.epigraphAnalytics){const Ht=new k$2([{item_id:zt,item_name:_e.data.itemData.name,price:Gt.price,quantity:1}],jt,1);this.epigraphAnalytics.sendEvent(Ht)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,_e=>{if(this.epigraphAnalytics){const Dt=new q$4("hotspot_enter",_e.data.hotspotAbsID);this.epigraphAnalytics.sendEvent(Dt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,_e=>{if(this.epigraphAnalytics){const Dt=new q$4("hotspot_exit",_e.data.hotspotAbsID);this.epigraphAnalytics.sendEvent(Dt)}}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Cart_Checkout,async _e=>{if(this.epigraphAnalytics){const Dt=await this.getItemsArrayForAnalytics(),Vt=new V$3(Dt,_e.data.details.total,this.getCurrentCurrencyCode());this.epigraphAnalytics.sendEvent(Vt)}})}getPreconfigurationModuleData(){return this.stores.productDataStore.getState().categoryData.preconfiguration}setEmptySceneText(_e){const Dt=this.stores.coreSceneStore.getState().sceneSettings;Dt.emptySceneText=_e,this.stores.coreSceneStore.setState({sceneSettings:{...Dt}})}getSpawningRequirementForSkuID(_e){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getSpawningRequirementForSkuID(_e)}getAllSkusThatCanReplaceGuid(_e){if(!this.stores.itemStore.getState().itemsSpawned[_e])return LOGGER.warn({title:"Item with guid: "+_e+" doesn't exist"}),[];const zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);return zt?zt.getAllSkusThatCanReplaceMe():(LOGGER.warn({title:"Node with guid: "+_e+" doesn't exist"}),[])}getCartItems(){return this.stores.attachmentStore.getState().attachmentSystem.getCartItems()}async getCartItemsAsync(){return await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync()}checkout(_e=!1){const Dt=this.stores.attachmentStore.getState().attachmentSystem;this.#m=this.getSceneStructure();let Vt=Dt.getCartItems();return Vt=this.stores.dynamicHookStore.getState().hookOnCheckout(Vt,this),Vt==null?null:(LOGGER.warn({title:"CONFIGURATOR CHECKED OUT: "}),LOGGER.table(Vt),_e===!0||Vt.cartItems.find(Gt=>Gt.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,Vt),this.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,Vt),Vt)}async checkoutAsync(_e=!1){const Dt=this.stores.attachmentStore.getState().attachmentSystem;this.#m=this.getSceneStructure();let Vt=Dt.getCartItems();return Vt=await this.stores.dynamicHookStore.getState().hookOnCheckout(Vt,this),Vt==null?null:(LOGGER.warn({title:"CONFIGURATOR CHECKED OUT: "}),LOGGER.table(Vt),_e===!0||Vt.cartItems.find(Gt=>Gt.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,Vt),this.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,Vt),Vt)}async reloadCheckedoutScene(){if(!this.#m){LOGGER.info({title:"No data found since last checkout"});return}await this.loadSceneFromConfiguration(this.#m)}getCurrentItemsInReplaceableCategory(){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getCurrentItemsInReplaceableCategory()}async getSceneAsGlbUrl(){return this.#h===!1?this.#f:(URL.revokeObjectURL(this.#f),this.#f=void 0,this.#f=await getSceneAsGLBUrl(this.stores),this.#h=!1,this.#f)}async getSceneAsUsdzUrl(){return this.#h===!1?this.#d:(URL.revokeObjectURL(this.#d),this.#d=void 0,this.#d=await getSceneAsUsdzUrl(this.stores),this.#h=!1,this.#d)}async generateShareableLink(_e=!1){if(!this.#u&&this.#c)LOGGER.info({title:"Reusing the cached configuration ID that was last saved..."});else{LOGGER.info({title:"Generating a new configuration ID..."});let Gt=this.stores.attachmentStore.getState().actions.export(),zt=await this.stores.nexusApiInstance.postExperienceSaveAndShare(this.experienceId,Gt);this.#c=zt.payload.save_id}const Dt=window.location.href;let Vt=new URL(Dt);if(_e===!0&&Vt.searchParams.set("launchInAR",!0),Vt.searchParams.set("projectId",this.projectId),Vt.searchParams.set("epgsharedconfigid",this.#c),this.#u=!1,this.epigraphAnalytics){const Gt=await this.getItemsArrayForAnalytics(),zt=new U$2(Gt,"configuration","link");this.epigraphAnalytics.sendEvent(zt)}return Vt.href}closeContextMenu(){this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem()}updatePreloadProgress(_e){const Dt=this.#i;this.#i=_e;const Vt=new CustomEvent("preload:update",{detail:{progress:this.#i}});window.dispatchEvent(Vt),typeof this.#n=="function"&&this.#n(Dt,_e)}alert({alertMsg:_e,alertTime:Dt,alertType:Vt,alertLabel:Gt,persistant:zt=!1,alertId:jt}){this.stores.coreSceneStore.getState().actions.sendAlert({alertMsg:_e,alertTime:Dt,alertType:Vt,alertLabel:Gt,persistant:zt,alertId:jt})}removePersistantAlert(){this.stores.coreSceneStore.setState({persistantAlertData:null})}clickHotspot(_e){let Dt=this.coreWCRef.shadowRootRef.getElementById(_e);Dt&&Dt.click()}exitHotspot(){this.stores.hotspotStore.getState().actions.exitHotspot(!1)}isSystemBusy(){return this.stores.itemStore.getState().isBusy()}async spawnGhostsForSkuID(_e,Dt=!1,Vt){return this.isSystemBusy()?null:await this.stores.ghostStore.getState().actions.spawnGhostsForSkuID(_e,Dt,Vt)}removeAllGhosts(){if(this.stores.itemStore.getState().isBusy())return null;this.stores.ghostStore.getState().actions.clearAllGhosts()}printSceneHierarchy(_e=!1){const Dt=this.stores.coreSceneStore.getState().sceneRef;(function Vt(Gt){const zt=`${Gt.name} < ${Gt.type} >`;_e===!0?console.groupCollapsed(zt):console.group(zt),Gt.children.forEach(Vt),console.groupEnd()})(Dt)}getSceneItems(){const _e=this.stores.itemStore.getState().itemsSpawned;if(typeof _e!="object"){LOGGER.error({title:"There was an error while fetching the scene item count."});return}return _e}getSceneItemCount(){let _e;const Dt=this.stores.itemStore.getState().itemsSpawned;return typeof Dt!="object"&&LOGGER.error({title:"There was an error while fetching the scene item count."}),_e=Object.keys(Dt).length,_e}async spawnItemBySkuID(_e,Dt=!1){if(this.isSystemBusy())return null;const Vt=this.getActiveGhostData();return Vt&&Vt.skuID!==_e?null:(Dt===!0&&!Vt&&await this.spawnGhostsForSkuID(_e,!1,1),await this.stores.itemStore.getState().actions.addItemBySkuID(_e,0))}async spawnItemBySkuIDAndGhostIndex(_e,Dt=0){if(this.stores.itemStore.getState().isBusy())return null;let Vt=null;const Gt=this.getActiveGhostData();return Dt>=0&&Gt.count>Dt&&Gt.skuID==_e&&(Vt=await this.stores.itemStore.getState().actions.addItemBySkuID(_e,Dt)),Vt}async replaceItemBySkuId(_e,Dt){return await this.stores.itemStore.getState().actions.replaceGuidItemBySkuId(_e,Dt)}async replaceItemsBySkuId(_e,Dt){if(!Array.isArray(_e))throw new Error("guids parameter must be an array");try{for(const Vt of _e)await this.replaceItemBySkuId(Vt,Dt);return!0}catch(Vt){throw new Error(`Failed to replace items by SKU ID: ${Vt.message}`)}}async replaceAllItemsBySkuId(_e,Dt){const Vt=[],Gt=this.stores.itemStore.getState().itemsSpawned;Object.keys(Gt).map(zt=>{Gt[zt].itemData.skuID==_e&&Vt.push(zt)});try{for(const zt of Vt)await this.replaceItemBySkuId(zt,Dt);return!0}catch(zt){throw new Error(`Failed to replace items by SKU ID: ${zt.message}`)}}async removeItemByGUID(_e,Dt=!1){if(this.stores.itemStore.getState().isBusy())return null;const Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);return Dt===!1&&Gt.canSwapRoot===!0&&Gt.swapRoot(),await this.stores.itemStore.getState().actions.removeItemByGUID(_e)}triggerItemRemoveModal(_e){const Dt=this.getGuidItemAttachedDependencies(_e);Dt&&this.fireEvent(this.EVENTS.SCENE.ItemRemoveModalTriggered,Dt)}async updateFittingSkuIds(){await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}rotateItemByGUID(_e){this.stores.attachmentStore.getState().attachmentSystem.currentStructure.rotateNode(_e)}rotateSelectedItem(){const _e=this.stores.itemStore.getState().selectedItemData;if(!_e){LOGGER.info({title:"No current item selected to rotate"});return}const Dt=_e.itemData.guid;return this.stores.attachmentStore.getState().attachmentSystem.currentStructure.rotateNode(Dt),_e}removeLastItemBySkuId(_e){const Dt=this.stores.itemStore.getState().itemsSpawned,Vt=Object.keys(Dt);for(let Gt=Vt.length-1;Gt>=0;Gt--){const zt=Vt[Gt];if(Dt[zt].itemData.skuID===_e){this.doesGuidItemHaveAnAttachedDependency(zt)?(this.selectItemWithGUID(zt),this.triggerItemRemoveModal(zt)):this.removeItemByGUID(zt);break}}}async removeSelectedItem(){const _e=this.stores.itemStore.getState().selectedItemData;if(!_e){LOGGER.info({title:"No current item selected to delete"});return}const Dt=_e.itemData.guid;return this.stores.itemStore.getState().actions.deselectItem(),await this.removeItemByGUID(Dt),LOGGER.info({title:`Removed Item: ${Dt}`}),_e}refocus(){this.stores.coreSceneStore.getState().actions.triggerAutoFocus()}getActiveGhostData(){return this.stores.ghostStore.getState().ghostData}focusOnGhosts(){if(this.stores.ghostStore.getState().ghostParentRef===null){LOGGER.warn({title:"Ghost Parent Reference not found"});return}this.stores.ghostStore.getState().ghostParentRef.children.length<=0?this.stores.coreSceneStore.getState().actions.triggerAutoFocus():this.stores.coreSceneStore.getState().actions.triggerAutoFocus(this.stores.ghostStore.getState().ghostParentRef)}exitSelectedItem(){this.stores.itemStore.getState().actions.deselectItem()}getSelectedItemData(){return this.stores.itemStore.getState().selectedItemData}canSelectedItemRotate(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure;let Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canRotate:!1}canSelectedItemBeRemoved(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canRemove:!1}canSelectedItemDrag(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).canDrag:!1}doesGuidItemHaveAnAttachedDependency(_e){let Dt=!0;const Gt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e),zt=Gt.isEndNode;return Dt=!zt,zt||Gt.canSwapRoot&&Gt.whichNodesAreAttachedToUs().length==1&&(Dt=!1),Dt}getGuidItemAttachedDependencies(_e){const Dt=this.stores.attachmentStore.getState().attachmentSystem,Vt=this.stores.itemStore.getState().itemsSpawned,Gt=Dt.currentStructure.getNodeByGUID(_e);if(!Gt)return;let zt={[Gt.guid]:{...Vt[Gt.guid]}};return Gt.getAllBranchedNodesAttachedToUs().forEach(Ht=>{zt[Ht.guid]=Vt[Ht.guid]}),zt}doesSelectedItemHasAttachedDependency(){const _e=this.getSelectedItemData();return _e?this.doesGuidItemHaveAnAttachedDependency(_e.itemData.guid):!1}isSelectedItemAnEndNode(){const _e=this.stores.attachmentStore.getState().attachmentSystem.currentStructure,Dt=this.getSelectedItemData();return Dt?_e.getNodeByGUID(Dt.itemData.guid).isEndNode:!1}getCurrentSceneEnvMap(){return this.stores.lightStore.getState().envMapUrl}async switchGlobalGeometryVariant(_e,Dt){if(!_e){LOGGER.WARN({title:"Geometry Category: '"+_e+"' not valid!"});return}if(this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),await this.stores.attachmentStore.getState().attachmentSystem.switchGlobalGeometryVariant(_e,Dt),await wait(1),this.epigraphAnalytics){const Ht=await this.getItemsArrayForAnalytics(),Wt=new j$1(Ht,"category-geometry");this.epigraphAnalytics.sendEvent(Wt)}const Gt=this.stores.productDataStore.getState().categoryData.geometryVariants;let zt=null;if(Gt.map(Ht=>{Ht.id==_e&&(zt=Ht)}),!zt)return;const jt=zt.variants[Dt];this.alert({alertMsg:zt.label.charAt(0).toUpperCase()+zt.label.slice(1)+" was successfully switched to "+jt.label.charAt(0).toUpperCase()+jt.label.slice(1)+".",alertTime:3e3,alertType:"success",alertLabel:`${zt.label} Changed`,alertId:"geometryVariantChanged"})}async switchGlobalVariant(_e,Dt=""){if(!_e){LOGGER.WARN({title:"Look Category: '"+_e+"' not valid!"});return}if(this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),LOGGER.info({title:`Changing Global Variant: Category: ${_e} Id: ${Dt}`}),await this.stores.attachmentStore.getState().attachmentSystem.switchGlobalVariant(_e,Dt),await wait(1),this.epigraphAnalytics){const Vt=await this.getItemsArrayForAnalytics(),Gt=new j$1(Vt,"category-variant");this.epigraphAnalytics.sendEvent(Gt)}}async overrideSelectedItemMaterial(_e=""){return this.stores.itemStore.getState().selectedItemData?(await this.stores.itemStore.getState().actions.switchToVariant(this.stores.itemStore.getState().selectedItemData.itemData,_e,!0),!0):!1}async overrideItemMaterialByGuid(_e,Dt){const Vt=this.stores.itemStore.getState().itemsSpawned[_e];if(!Vt)return LOGGER.warn({title:"Item with guid: "+_e+" doesn't exist"}),!1;if(await this.stores.itemStore.getState().actions.switchToVariant(Vt.itemData,Dt,!0),this.epigraphAnalytics){const Gt=new j$1([{item_id:Vt.itemData.skuID,item_name:Vt.itemData.name,price:Vt.itemData.lookDetails[Dt].price,quantity:1}],"variant");this.epigraphAnalytics.sendEvent(Gt)}return!0}getSelectedItemColors(){let _e=[];if(this.getSelectedItemData()==null)return _e;let Vt=this.getSelectedItemData().itemData.looks;if(Vt){let Gt=this.stores.productDataStore.getState().lookData;Vt.map(zt=>{Gt.hasOwnProperty(zt)&&_e.push(Gt[zt])})}return _e}getCanvasSize(){return this.stores.coreSceneStore.getState().canvasSize}async removeAllVariantOverrides(){return this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem(),await this.stores.attachmentStore.getState().attachmentSystem.removeAllVariantOverrides()}switchCursor(_e){this.stores.coreSceneStore&&this.stores.coreSceneStore.getState().actions.switchCursor(_e)}getSceneStructure(){return this.stores.attachmentStore.getState().actions.export()}getSceneStructureRaw(){return this.stores.attachmentStore.getState().attachmentSystem.currentStructure}async getItemsArrayForAnalytics(){const _e=this.stores.attachmentStore.getState().attachmentSystem;if(!_e)return[];let Dt=await _e.getCartItemsAsync();if(Dt=await this.stores.dynamicHookStore.getState().hookOnCheckout(Dt,this),console.log(Dt),Dt==null)return[];let Vt=[];for(const Gt of Dt.cartItems){const jt=this.stores.productDataStore.getState().productData[Gt.skuID];Vt.push({item_id:Gt.clientProductId,item_name:jt.name,price:Gt.price,quantity:Gt.count})}return Vt}getAllConnectionsInScene(){const _e=this.getSceneStructureRaw(),Dt=new Map;for(const Vt of _e.nodes)for(const Gt of Vt.plugs){if(!Gt.attachedPlugGUID)continue;const zt=[Gt.guid,Gt.attachedPlugGUID].sort().join();Dt.has(zt)||Dt.set(zt,{from:Gt,to:Gt.attachedPlug})}return Dt}async loadSceneFromConfiguration(_e){await this.stores.attachmentStore.getState().actions.loadStructure(_e)}async loadSceneFromConfigurationID(_e,Dt=!0){const Vt=await this.stores.attachmentStore.getState().actions.loadSavedStructureFromConfigID(_e);if(!Vt)return null;Dt===!0&&this.stores.attachmentStore.setState({defaultConfig:Vt});let Gt=Object.assign({},CONFIGURATOR_LOAD_FROM_PRECONFIG);Gt.label=`Preconfig ID: ${_e}`,await this.loadSceneFromConfiguration(Vt)}async viewInYourSpace(){if(LOGGER.info({title:"View in your space called from the Core API"}),this.#o.epigraphViewInYourSpaceRef.onViewInYourSpaceButtonClicked(),this.epigraphAnalytics){const _e=await this.getItemsArrayForAnalytics(),Dt=new w$2(_e);this.epigraphAnalytics.sendEvent(Dt)}}async shareScene(){return await this.generateShareableLink()}async clearScene(){return await this.stores.attachmentStore.getState().attachmentSystem.clear()}async restartScene(){if(LOGGER.info({title:"Restarting Scene."}),await this.stores.attachmentStore.getState().attachmentSystem.restart(),this.epigraphAnalytics){const _e=new q$4("restart","restart-scene");this.epigraphAnalytics.sendEvent(_e)}}areDimensionsVisible(){return this.stores.coreSceneStore.getState().showDimensions}getCurrentDimensions(){return this.stores.coreSceneStore.getState().boundData}getActiveHotspot(){return this.stores.hotspotStore.getState().activeHotspotData}reviewCartShown(){const _e=new q$4("review_cart","preview-cart-button");this.fireEvent(this.EVENTS.UI.ReviewCart_Shown,_e),this.epigraphAnalytics.sendEvent(_e)}isGeometryVisibleForGUID(_e,Dt){const Vt={success:!1,result:!1},zt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt);return zt.ref&&zt.ref.traverse(jt=>{jt.name===_e&&(console.log(jt),Vt.success=!0,Vt.result=jt.visible)}),Vt}reviewCartHidden(){const _e=new q$4("review_cart","preview-cart-close-button");this.fireEvent(this.EVENTS.UI.ReviewCart_Hidden,_e),this.epigraphAnalytics&&this.epigraphAnalytics.sendEvent(_e)}sendShowInstructionsBtnAnalyticsEvent(){if(this.epigraphAnalytics){const _e=new q$4("show_instructions","show-instructions-button");this.epigraphAnalytics.sendEvent(_e)}}async showInstructions(){this.fireEvent(this.EVENTS.UI.Instructions_Show),this.#v=Date.now();const _e=localStorage.getItem("instructionsDisplayed-"+this.#g),Dt=await this.getItemsArrayForAnalytics(),Vt=new O$2(Dt,!!_e,"info_panel",_e?"button":"auto");this.epigraphAnalytics.sendEvent(Vt)}showDimensions(){if(this.stores.coreSceneStore.setState({showDimensions:!0}),this.epigraphAnalytics){const _e=new q$4("dimensions_show","dimensions-button");this.epigraphAnalytics.sendEvent(_e)}}async hideDimensions(){if(this.stores.coreSceneStore.setState({showDimensions:!1}),this.epigraphAnalytics){const _e=new q$4("dimensions_hide","dimensions-button");this.epigraphAnalytics.sendEvent(_e)}}areHotspotsVisible(){return this.stores.hotspotStore.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return this.stores.hotspotStore.getState().hotspotsTempVisibility}showAllHotspots(_e=!1){this.stores.hotspotStore.getState().actions.switchHotspotsVisibility(!0,_e)}hideAllHotspots(_e=!1){this.stores.hotspotStore.getState().actions.switchHotspotsVisibility(!1,_e)}getFittingSkuIds(){return this.stores.attachmentStore.getState().attachmentSystem.getFittingSKUIDs()}selectItemWithGUID(_e){const Dt=this.stores.itemStore.getState().itemsSpawned,Vt=this.stores.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(_e);this.stores.itemStore.getState().actions.setSelectedItemData({...Dt[_e],overrideVariant:Vt.overrideVariant,currentVariant:Vt.currentVariant,offsetX:0,offsetY:0})}async getCurrentCameraDetails(){return new Promise((_e,Dt)=>{this.coreWCRef.addEventListener(this.EVENTS.CONFIGURATION.CameraDetails_Update,Vt=>{_e(Vt.data)},{once:!0}),this.stores.cameraStore.getState().actions.triggerFetchingCamera()})}moveCamera(_e,Dt,Vt=!0){this.stores.hotspotStore.setState({isAnyHotspotActive:!0}),_e&&this.stores.cameraStore.setState({viewPointPosition:ArrToVec3(_e)}),Dt&&this.stores.cameraStore.setState({focusPointPosition:ArrToVec3(Dt)}),this.stores.cameraStore.setState({resetToLastPosition:Vt})}setEnvLightMap(_e){this.stores.lightStore.setState({envMapUrl:_e})}updateInventoryForAllProducts(_e){return this.stores.inventoryStore.getState().actions.updateInventoryForAllProducts(_e),this.getInventoryInfo()}getInventoryInfo(){return JSON.parse(JSON.stringify(this.stores.inventoryStore.getState().inventoryData))}updateCompareAtPricingForAllProducts(_e){this.stores.productDataStore.getState().actions.updateCompareAtPricingForAllProducts(_e);const Vt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentCompareAtPricingInfo()}updatePricingForAllProducts(_e){this.stores.productDataStore.getState().actions.updatePricingForAllProducts(_e);const Vt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentPricingInfo()}async updateCompareAtPricingForAllProductsAsync(_e){this.stores.productDataStore.getState().actions.updateCompareAtPricingForAllProducts(_e);const Vt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentCompareAtPricingInfo()}async updatePricingForAllProductsAsync(_e){this.stores.productDataStore.getState().actions.updatePricingForAllProducts(_e);const Vt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return Vt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,Vt),this.getCurrentPricingInfo()}updatePricingForProduct(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updatePricingForProduct(_e,Dt,Vt);const zt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentPricingInfo()}updateCompareAtPricingForProduct(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updateCompareAtPricingForProduct(_e,Dt,Vt);const zt=this.stores.attachmentStore.getState().attachmentSystem.getCartItems();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentCompareAtPricingInfo()}async updatePricingForProductAsync(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updatePricingForProduct(_e,Dt,Vt);const zt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentPricingInfo()}async updateCompareAtPricingForProductAsync(_e,Dt,Vt){this.stores.productDataStore.getState().actions.updateCompareAtPricingForProduct(_e,Dt,Vt);const zt=await this.stores.attachmentStore.getState().attachmentSystem.getCartItemsAsync();return zt&&this.fireEvent(this.EVENTS.SCENE.CartItems_Updated,zt),this.getCurrentCompareAtPricingInfo()}getCurrentPricingInfo(){return this.stores.productDataStore.getState().actions.getCurrentPricingInfo()}getCurrentCompareAtPricingInfo(){return this.stores.productDataStore.getState().actions.getCurrentCompareAtPricingInfo()}async itemDragStart(_e){if(this.stores.itemStore.getState().isBusy())return null;this.stores.coreSceneStore.setState({hoveredGhostIndex:-1}),await this.removeAllGhosts(),this.stores.coreSceneStore.setState({itemDraggedSkuID:_e}),await this.spawnGhostsForSkuID(_e,!1)}async itemDragEnd(){if(this.stores.itemStore.getState().isBusy())return null;const _e=this.stores.coreSceneStore.getState().hoveredGhostIndex;_e!==-1?await this.stores.itemStore.getState().actions.addItemBySkuID(this.stores.coreSceneStore.getState().itemDraggedSkuID,_e):await this.removeAllGhosts(),this.stores.coreSceneStore.setState({itemDraggedSkuID:null,hoveredGhostIndex:-1})}async forceSpawnItem(_e,Dt){const Vt=this.stores.productDataStore.getState().productData,Gt=this.stores.attachmentStore.getState().attachmentSystem;if(!Gt)return;const zt=Gt.currentStructure;if(!zt)return;let jt=zt.getNodeByGUID(Dt);jt?(jt._skuID=_e,jt.generatePlugsForNode(_e)):(jt=new Node$1(this.stores,_e,{guid:Dt,isEndNode:!0,overrideVariant:null,plugs:Vt[_e].plugs}),zt.addNode(jt),zt.connectPlugs({incomingPlug:new Plug({name:"tempPlug",acceptedPlugTypes:[],connectsToPlugTypes:[]},jt),receiverPlug:zt.rootNode.plugs[0]}));const Ht=await this.stores.itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},_e,Dt);return await wait(1),Ht}async getScreenshotForCurrentCamera(_e){return await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(null,_e)}async getScreenshotForCamera(_e,Dt){return await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(_e,Dt)}async getAllPredefinedScreenshots(_e){const Dt=this.stores.coreSceneStore.getState().sceneSettings.screenshotCameras,Vt=[];for(const Gt of Dt){const zt=await this.stores.coreSceneStore.getState().actions.requestNewScreenshot(Gt,_e);Vt.push(zt)}return Vt}setCameraFocusPointPosition(_e){this.stores.cameraStore.setState({focusPointPosition:_e})}triggerFetchingCamera(){this.stores.cameraStore.getState().actions.triggerFetchingCamera()}async completeItemDrop(){await this.stores.coreSceneStore.getState().actions.completeDropItem()}revertItemDrop(){this.stores.coreSceneStore.getState().actions.revertDropItem()}getCameraFocusPointPosition(){return this.stores.cameraStore.getState().focusPointPosition}sendAnalyticsPageViewedEvent(){}sendAnalyticsEvent(_e){if(this.epigraphAnalytics!==null)try{if(_e&&typeof _e.eventName=="string")this.epigraphAnalytics.sendEvent(_e);else if(LOGGER.warn({title:"Deprecated analytics event format detected. Please migrate to Epigraph events.",details:"Use epigraphAnalytics.sendEvent() directly with Epigraph events instead of sendAnalyticsEvent()"}),_e&&_e.action){const Dt=new K$2(_e.action,_e.interaction?.nonInteraction===!1,_e.parameters||{});this.epigraphAnalytics.sendEvent(Dt)}}catch(Dt){LOGGER.error({title:"Failed to send analytics event",details:Dt})}}isIosDevice(){return IS_IOS}actionButtonClicked(_e){this.fireEvent(this.EVENTS.SCENE.ActionButton_Clicked,{data:_e.actionButton.data,skuID:_e.skuID,count:_e.count,price:_e.price,compareAtPrice:_e.compareAtPrice,countAvailable:_e.countAvailable,countUnavailable:_e.countUnavailable,currentVariant:_e.currentVariant})}setCartMessage(_e){this.fireEvent(this.EVENTS.SCENE.CartMessage_Update,{cartMessage:_e})}convertQuaternionToEuler(_e){return new Euler(0,0,0,"XYZ").setFromQuaternion(_e)}convertDegreeToRadians(_e){return MathUtils.degToRad(_e)}convertRadiansToDegree(_e){return MathUtils.radToDeg(_e)}createVector3(_e,Dt,Vt){return new Vector3(_e,Dt,Vt)}isFacingInDirection(_e,Dt){return ConfiguratorCoreAPI.forwardVector3.set(0,0,1),Dt.normalize(),ConfiguratorCoreAPI.forwardVector3.applyQuaternion(_e),ConfiguratorCoreAPI.forwardVector3.dot(Dt)>=0}}const EpigraphConfiguratorCore=reactExports.forwardRef(({customVersionId:kt,experienceId:_e,stores:Dt,viewInYourSpaceRef:Vt,configuratorWcRef:Gt,initialConfigId:zt,clientAccessKey:jt,consentPlugin:Ht,consentIdentifier:Wt,gaMeasurementId:qt,builderMode:Xt,id:Kt,disableCart:Yt,apiMode:Zt},Jt)=>{const[nn,rn]=reactExports.useState(null);reactExports.useEffect(()=>{Jt.current&&(Jt.current.identifier="wc-epigraph-configurator-core",Jt.current.epigraphViewInYourSpaceRef=void 0,Jt.current.initialConfigId="",Jt.current.clientAccessKey="",Jt.current.consentPlugin="",Jt.current.consentIdentifier="",Jt.current.gaMeasurementId="",Jt.current.configuratorWcRef=void 0,Jt.current.builderMode=!1,Jt.current.projectId="",Jt.current.api=null,Jt.current.api=new ConfiguratorCoreAPI(Dt,Jt.current),Dt.coreSceneStore.setState({CORE_API:Jt.current.api}),en(Jt.current))},[Jt]),reactExports.useEffect(()=>{Jt.current&&Vt&&(Vt.current&&(Jt.current.epigraphViewInYourSpaceRef=Vt.current),LOGGER.info({title:"ViewInYourSpace is now accessible from the core: "}))},[Jt,Vt]);const Qt=reactExports.useCallback(tn=>{Gt&&(tn.configuratorWCRef=Gt,tn.shadowRootRef=tn.configuratorWCRef.shadowRoot,tn.api.shadowRootRef=tn.shadowRootRef,tn.api.configuratorWCRef=tn.configuratorWCRef),kt&&(tn.customVersionId=kt),zt&&(tn.initialConfigId=zt),jt&&(tn.clientAccessKey=jt),Ht&&(tn.consentPlugin=Ht),Wt&&(tn.consentIdentifier=Wt),qt&&(tn.gaMeasurementId=qt),Xt&&(tn.builderMode=!0),LOGGER.group("Collected Web Component Attributes"),LOGGER.table({initialConfigId:tn.initialConfigId,clientAccessKey:tn.clientAccessKey,consentPlugin:tn.consentPlugin,consentIdentifier:tn.consentIdentifier,builderMode:tn.builderMode}),LOGGER.groupEnd()},[Xt,zt,qt,jt,Gt]),en=reactExports.useCallback(async tn=>{if(tn.coreReady===!0)return;Qt(tn);let sn=kt;!sn&&IS_DEV_ENV&&(sn="latest");let cn={};if(Zt==="input.json"?cn={payload:{project_id:"local-project",experience_id:"",configurator_data:await __vitePreload(()=>import("./input-afb87ea8.js"),[]),session_details:{environment:"development"}},report:"Local Input Json",success:!0}:jt?cn=await Dt.nexusApiInstance.getConfiguratorByClientAccessKey(jt,sn):cn=await Dt.nexusApiInstance.getConfiguratorByExperienceId(_e,sn),tn.validationPassed=cn.success,tn.validationPassed==!1){LOGGER.error({title:"Request from an invalidated source: "+window.location.href}),Dt.coreSceneStore.getState().CORE_API.fireEvent("coreApi:failed");return}Dt.nexusApiResponseEnvironment=cn.payload.session_details.environment,tn.projectId=cn.payload.project_id,tn.experienceId=cn.payload.experience_id,Dt.experienceId=cn.payload.experience_id,tn.api.projectId=tn.projectId,tn.api.experienceId=tn.experienceId;const un=cn.payload.configurator_data,hn={gaMeasurementId:tn.gaMeasurementId??void 0,epgExperienceID:tn.experienceId??void 0};Dt.coreSceneStore.getState().CORE_API.initializeAnalytics(hn,IS_DEV_ENV);let fn=new URL(window.location).searchParams;if(fn.has("epgsharedconfigid")&&(tn.initialConfigId=fn.get("epgsharedconfigid")),Dt.coreSceneStore.getState().CORE_API.epigraphAnalytics){const pn=new x$2(fn.has("epgsharedconfigid"));Dt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(pn)}LOGGER.info({title:"VALIDATION SUCCESSFUL!"}),tn.coreReady=!0,rn({projectId:tn.projectId,parsedData:un,customVersionId:tn.customVersionId,clientAccessKey:tn.clientAccessKey,consentPlugin:tn.consentPlugin,consentIdentifier:tn.consentIdentifier,initialConfigId:tn.initialConfigId,builderMode:tn.builderMode})},[]);return reactExports.useEffect(()=>async()=>{if(Dt.coreSceneStore.getState().CORE_API){if(Dt.coreSceneStore.getState().CORE_API.epigraphAnalytics){const tn=await Dt.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics(),sn=new L$2(tn);Dt.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(sn)}Dt.coreSceneStore.getState().CORE_API.fireEvent("coreApi:shutDown")}},[]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx("div",{id:Kt,ref:Jt,children:nn&&jsxRuntimeExports.jsx(App$1,{parsedData:nn.parsedData,stores:Dt,clientAccessKey:nn.clientAccessKey,consentPlugin:nn.consentPlugin,consentIdentifier:nn.consentIdentifier,initialConfigId:nn.initialConfigId,builderMode:nn.builderMode,disableCart:Yt!==void 0?Yt:!1})})})}),ViewInYourSpace=React.forwardRef((kt,_e)=>{const[Dt,Vt]=reactExports.useState(!1),[Gt,zt]=reactExports.useState(!1),jt=reactExports.useRef(null),Ht=reactExports.useRef(null),Wt=reactExports.useRef(null),qt=reactExports.useRef(null),Xt=reactExports.useRef(null),Kt=reactExports.useRef(null),Yt=reactExports.useRef(null),Zt=reactExports.useRef(null),Jt=reactExports.useRef(null),nn=reactExports.useRef(null),rn=kt.stores.uiSceneStore(Hn=>Hn.dialogPopupOpen),Qt=reactExports.useMemo(()=>`*Technical requirements: iOS Version ${_e?.current?.coreApi?.sceneSettings?.technicalRequirements?.minIosVersion??"11"} and later or Android 8 and later.`,[kt]),en=reactExports.useMemo(()=>`*Technical requirements: iOS Version ${_e?.current?.coreApi?.sceneSettings?.technicalRequirements?.minIosVersion??"11"} and later or Android 8 and later.`,[kt]),tn=()=>{kt["asset-src"]&&(_e.current.assetSrc=kt["asset-src"])};reactExports.useEffect(()=>{!_e.current||!jt.current||!Ht.current||!Wt.current||!qt.current||!Xt.current||!Kt.current||!Yt.current||!Zt.current||!Jt.current||!nn.current||(tn(),_e.current.getQRForURL=async(Hn,qn)=>await Pn(Hn,qn),_e.current.onViewInYourSpaceButtonClicked=async Hn=>await yn(),_e.current.assetSrc="",_e.current.iosAssetSrc="",_e.current.arLink="",_e.current.coreApi=void 0,_e.current.arInProgress=!1,_e.current._modelViewerScriptSource="https://cdn.jsdelivr.net/npm/@google/model-viewer@2.x.x/dist/model-viewer.min.js",_e.current._modelViewer=null,_e.current._qrModalContainer=null,dn(),fn(),un(),_e.current._modelViewer.addEventListener("error",Hn=>{Cn(Hn)}),_e.current._viewInYourSpaceButton.addEventListener("click",Hn=>{yn()}),_e.current.canLaunchAR=sn)},[_e,jt,Ht,Wt,qt,Xt,Kt,Yt,Zt,Jt,nn]);const sn=reactExports.useCallback(()=>_e.current._modelViewer.canActivateAR,[]);reactExports.useEffect(()=>{_e.current&&(kt["asset-src"]&&(_e.current.assetSrc=kt["asset-src"]),kt["core-api"]&&(_e.current.coreApi=kt["core-api"]),cn())},[_e,kt]);const cn=()=>{_e.current._modelViewer.setAttribute("src",_e.current.assetSrc),_e.current._modelViewer.setAttribute("ios-src",_e.current.iosAssetSrc),_e.current._modelViewer.style.display="none"},un=()=>{window.customElements.get("model-viewer")===void 0&&hn(),En(),cn(),_e.current._modelViewer.addEventListener("ar-status",Hn=>{Hn.detail.status==="session-started"?(_e.current._modelViewer.style.display="block",_e.current.arInProgress=!0):(Hn.detail.status==="not-presenting"||Hn.detail.status==="failed")&&(_e.current._modelViewer.style.display="none",_e.current.arInProgress=!1)})},hn=()=>{_e.current._modelViewerScriptElem=document.createElement("script"),_e.current._modelViewerScriptElem.setAttribute("type","module"),_e.current._modelViewerScriptElem.setAttribute("src",_e.current._modelViewerScriptSource),_e.current._modelViewerScriptElem.setAttribute("id","modelViewerScript"),document.head.appendChild(_e.current._modelViewerScriptElem)},fn=()=>{_e.current._qrModalContainer=qt.current,_e.current._qrCodeImage=Xt.current,_e.current._arLink=Kt.current,_e.current._qrLoader=Yt.current,_e.current.doneViewInYourSpaceBtn=Zt.current,_e.current.doneViewInYourSpaceBtn.addEventListener("click",()=>{pn(),Tn()})},pn=async()=>{if(_e.current._qrCodeImage!==null)for(;_e.current._qrCodeImage.firstChild;)_e.current._qrCodeImage.removeChild(_e.current._qrCodeImage.firstChild)},dn=()=>{_e.current.arDrawer=jt.current,_e.current._launchARButton=Ht.current,_e.current._modelDownloadLoader=Wt.current,_e.current._launchARButton.addEventListener("click",()=>{_e.current.arInProgress!==!0&&Rn()})},mn=()=>{_e.current._modelDownloadLoader.classList.remove("loader-hide")},vn=()=>{_e.current._modelDownloadLoader.classList.add("loader-hide")},_n=async()=>{if(zt(!0),xn(),_e.current.arDrawer.show(),kt.stores?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics){const Hn=await kt.stores.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics(),qn=new O$2(Hn,!0,"ar","button");kt.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qn)}},En=()=>{_e.current._modelViewer=Jt.current,_e.current._viewInYourSpaceButton=nn.current},An=async()=>{if(Vt(!0),_e.current._qrModalContainer.show(),kt.stores?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics){const Hn=await kt.stores.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics(),qn=new O$2(Hn,!0,"qr","button");kt.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qn)}},Tn=async()=>{if(Vt(!1),_e.current._qrModalContainer.hide(),kt.stores?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics){const Hn=await kt.stores.coreSceneStore.getState().CORE_API.getItemsArrayForAnalytics(),qn=new G$3(Hn,!0,"qr","button");kt.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(qn)}},Cn=Hn=>{console.error(`[VIEW-IN-YOUR-SPACE ERROR]: Asset load Errors!!
|
|
4650
4650
|
Make sure that the URL provided for the asset to be loaded is correct.`),console.error("==============================================================="),console.error(Hn),console.error("===============================================================")},yn=Hn=>{_e.current.canLaunchAR()===!0?Sn():Fn()},Sn=async Hn=>{if(_n(),await wait(1e3),_e.current.coreApi.isIosDevice()){_e.current.iosAssetSrc=await _e.current.coreApi.getSceneAsUsdzUrl(kt.stores);const qn=`${GENERIC_PROJECT_ASSET_DATA_ROOT_URL}/3d-assets/proxy/null-product-proxy.glb`;_e.current.assetSrc=qn}else _e.current.assetSrc=await _e.current.coreApi.getSceneAsGlbUrl(kt.stores);cn(),wn()},wn=()=>{_e.current._launchARButton.disabled=!1,vn()},xn=()=>{_e.current._launchARButton.disabled=!0,mn()},Rn=()=>{_e.current._modelViewer.activateAR()},Ln=()=>{_e.current._qrLoader.classList.remove("loader-hide")},Nn=()=>{_e.current._qrLoader.classList.add("loader-hide")},Fn=async()=>{_e.current._qrCodeImage.classList.add("img-hide"),_e.current._qrCodeImage.setAttribute("src",""),Ln(),An(),await Bn(_e.current._qrCodeImage),_e.current._qrCodeImage.classList.remove("img-hide"),Nn()},Pn=async(Hn,qn)=>{QrCreator$1.render({text:Hn,radius:.25,ecLevel:"H",fill:"#000000",background:null,size:200},qn),await wait(250)},Bn=async Hn=>{_e.current.arLink=await _e.current.coreApi.generateShareableLink(!0),await _e.current.getQRForURL(_e.current.arLink,Hn)};return jsxRuntimeExports.jsxs("div",{...kt,ref:_e,children:[jsxRuntimeExports.jsxs("button",{tabIndex:rn?-1:0,id:"viewInYourSpaceButton",ref:nn,className:"viewInYourSpaceButton",children:[jsxRuntimeExports.jsx("img",{alt:"Close",src:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",onError:Hn=>{Hn.target.src="https://placehold.co/150"}}),"VIEW IN YOUR SPACE"]}),jsxRuntimeExports.jsx("model-viewer",{ref:Jt,ar:!0,"ar-modes":"webxr scene-viewer quick-look","ar-scale":"fixed","ar-placement":kt.arplacement,src:"",alt:"Epigraph View In Your Space","camera-controls":!0,style:{visibility:"hidden"}}),jsxRuntimeExports.jsx(FullScreenModal,{stores:kt.stores,open:Gt,id:"arDrawer",ref:jt,children:jsxRuntimeExports.jsxs("div",{className:"launch-ar-content-container",children:[jsxRuntimeExports.jsx("div",{className:"launch-ar-modal-title",children:"View In Your Space®"}),jsxRuntimeExports.jsxs("div",{className:"launch-ar-bottom-content-container",children:[jsxRuntimeExports.jsx("div",{className:"launch-ar-modal-instruction",children:"Click the “Launch AR” button below to begin viewing this product in your space."}),jsxRuntimeExports.jsxs("div",{className:"launch-ar-button-container",children:[jsxRuntimeExports.jsx("img",{id:"modelDownloadLoader",ref:Wt,alt:"Loading...",draggable:"false",className:"spinner-loader",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Animation/Loading.svg",onError:Hn=>{Hn.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("button",{tabIndex:Gt?0:-1,className:"launch-ar-button",id:"launchARButton",ref:Ht,children:"Launch AR"})]}),jsxRuntimeExports.jsx("div",{className:"launch-ar-modal-requirement",children:en})]}),jsxRuntimeExports.jsxs("div",{id:"arSessionError",className:"launch-ar-modal-error launch-ar-modal-error-hide",children:[" ","Uh Oh! Looks like there was a problem while loading the AR session."," "]})]})}),jsxRuntimeExports.jsx(FullScreenModal,{stores:kt.stores,open:Dt,id:"qrModalContainer",ref:qt,onExit:pn,children:jsxRuntimeExports.jsxs("div",{className:"qr-content-container",children:[jsxRuntimeExports.jsxs("div",{className:"QR-Parent",children:[jsxRuntimeExports.jsx("div",{id:"qrCodeImage",ref:Xt,className:"qr-code-image"}),jsxRuntimeExports.jsx("img",{id:"qrLoader",ref:Yt,alt:"Loading...",draggable:"false",className:"spinner-loader",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Animation/Loading.svg",onError:Hn=>{Hn.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx("div",{id:"arLink",ref:Kt})]}),jsxRuntimeExports.jsxs("div",{className:"QR-Content-Parent",children:[jsxRuntimeExports.jsx("div",{className:"qr-ar-modal-title",children:"Scan QR code"}),jsxRuntimeExports.jsxs("div",{className:"qr-ar-bottom-content-container",children:[jsxRuntimeExports.jsx("div",{className:"qr-ar-modal-instruction",children:"Using your mobile device camera, scan the QR code and follow the on-screen directions to view this item in your space."}),jsxRuntimeExports.jsx("div",{className:"launch-ar-button-container",children:jsxRuntimeExports.jsx("div",{role:"button","aria-label":"Done Button","aria-hidden":!Dt,tabIndex:Dt?0:-1,className:"launch-ar-button",id:"doneViewInYourSpaceBtn",ref:Zt,children:"Done"})}),jsxRuntimeExports.jsx("div",{className:"qr-ar-modal-requirement",children:Qt})]})]}),jsxRuntimeExports.jsxs("div",{id:"arSessionError",className:"launch-ar-modal-error launch-ar-modal-error-hide",children:[" ","Uh Oh! Looks like there was a problem while loading the AR session."," "]})]})})]})}),UI_LOCAL_STYLES=[{id:"variables",contents:StyleVariables},{id:"styles",contents:GenericStyles$1},{id:"accordion",contents:AccordionStyles},{id:"productFeaturesUI",contents:FeaturesUiStyles},{id:"sideMenuContent",contents:SideMenuContentStyles},{id:"build",contents:BuildStyles},{id:"mobile",contents:MobileStyles$1},{id:"bottomDrawer",contents:BottomDrawerStyles},{id:"fullScreenModal",contents:FullScreenModalStyles},{id:"viewInYourSpace",contents:ViewInYourSpaceStyles},{id:"instructionsModal",contents:InstructionsModalStyles}];function App({stores:kt,customVersionId:_e,experienceId:Dt,disableUI:Vt,disableCart:Gt,configuratorWcRef:zt,gaMeasurementId:jt}){const Ht=kt.itemStore(cn=>cn.itemsSpawned),Wt=reactExports.useRef(null),qt=reactExports.useRef(null),Xt=reactExports.useRef(null),Kt=kt.coreSceneStore(cn=>cn.coreReady),Yt=kt.uiSceneStore(cn=>cn.CORE_API),Zt=kt.uiSceneStore(cn=>cn.cssLoaded),Jt=kt.coreSceneStore(cn=>cn.sceneSettings?.arPlacement),nn=kt.uiSceneStore(cn=>cn.setCSSLoaded),rn=reactExports.useRef(null);addCoreEventListener(kt,"coreApi:ready",cn=>{const un=cn.categoryData.geometryVariants;Object.keys(kt.colorStore.getState().allActiveGeometryVariants).length==0&&un.map(fn=>kt.colorStore.getState().allActiveGeometryVariants[fn.id]=Object.keys(fn.variants)[0]);const hn=cn.categoryData.color;if(Object.keys(kt.colorStore.getState().allActiveVariants).length==0&&hn.map(fn=>kt.colorStore.getState().allActiveVariants[fn.id]=fn.looks[0]),cn.configuration&&cn.configuration.globalVariants){const fn=cn.configuration.globalVariants;Object.keys(fn).map(pn=>{kt.colorStore.getState().allActiveVariants[pn]=fn[pn]}),kt.colorStore.setState({allActiveVariants:{...kt.colorStore.getState().allActiveVariants}})}Xt.current.coreApi=Wt.current.api,kt.coreSceneStore.setState({coreReady:!0})}),addCoreEventListener(kt,"coreApi:failed",cn=>{zt.showHiccupScreen(`AUTHENTICATION FAILED FOR: ${window.location.href}`),kt.coreSceneStore.setState({coreReady:!1})}),reactExports.useEffect(()=>{Qt(Ht)},[Ht]),addCoreEventListener(kt,"globalGeometryVariant:updated",cn=>{kt.colorStore.setState({allActiveGeometryVariants:{...cn}});const un=kt.itemStore.getState().itemsSpawned;Qt(un)}),addCoreEventListener(kt,"globalVariant:updated",cn=>{kt.colorStore.setState({allActiveVariants:{...cn}})}),addCoreEventListener(kt,"cartMessage:updated",cn=>{kt.uiSceneStore.setState({cartMessage:cn.cartMessage})});const Qt=cn=>{let un=[],hn=[];const fn=kt.colorStore.getState().allActiveGeometryVariants;Object.keys(cn).map(pn=>{let dn=cn[pn];dn.hotspotsData&&dn.hotspotsData.map(mn=>{if(mn.geometryVariantID){let vn=!1;if(Object.keys(fn).map(_n=>{mn.geometryVariantID==fn[_n]&&(vn=!0)}),vn===!1)return}mn.categoryID!==""&&hn.includes(mn.categoryID)||(hn.push(mn.categoryID),un=[...un,{itemData:{...cn[pn].itemData},hotspotData:{...mn}}])})}),kt.uiSceneStore.setState({tabSpawnCount:un})};addCoreEventListener(kt,"cart:statusUpdated",cn=>{cn.disableCart!==void 0&&kt.uiSceneStore.setState({disableCart:cn.disableCart})}),addCoreEventListener(kt,"viewInYourSpace:hide",cn=>{kt.uiSceneStore.setState({viewInYourSpaceMenuBtnVisible:!1})}),addCoreEventListener(kt,"viewInYourSpace:show",cn=>{kt.uiSceneStore.setState({viewInYourSpaceMenuBtnVisible:!0})});const en=reactExports.useCallback(cn=>{let un=[];const hn=kt.productDataStore.getState().productData;cn.cartItems.forEach(fn=>{let pn={...fn},dn=hn[fn.skuID];pn.title=dn.lookDetails[fn.currentVariant].title,pn.subheading=dn.subheading,pn.subtitle=dn.lookDetails[fn.currentVariant].subtitle,pn.actionButton=dn.lookDetails[fn.currentVariant].actionButton,pn.thumbnails=dn.lookDetails[fn.currentVariant].thumbnails,un.push(pn)}),kt.cartStore.setState({cart:[...un]}),kt.cartStore.getState().actions.setCartTotalPrice(cn.details.total,cn.details.compareAtTotal)},[]),tn=reactExports.useCallback(async cn=>{if(!Yt)return;kt.uiSceneStore.setState({inventoryData:{...cn}});const un=await Yt.getCartItemsAsync();en(un)},[Yt]),sn=()=>(addCoreEventListener(kt,Yt.EVENTS.UI.PreloadScreen_Hide,()=>{zt.api.ui.hidePreloadScreen()}),addCoreEventListener(kt,Yt.EVENTS.UI.PreloadScreen_Show,()=>{zt.api.ui.showPreloadScreen()}),addCoreEventListener(kt,Yt.EVENTS.SCENE.CartItems_Updated,en),addCoreEventListener(kt,Yt.EVENTS.SCENE.Inventory_Updated,tn),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}));return reactExports.useEffect(()=>{const{current:cn}=Wt;cn&&(kt.uiSceneStore.setState({coreWCRef:cn}),zt.api.core=cn.api,zt.api.core.clientAccessKey=zt.clientAccessKey,zt.api.core.consentPlugin=zt.consentPlugin,zt.api.core.consentIdentifier=zt.consentIdentifier,kt.uiSceneStore.setState({CORE_API:cn.api}))},[Wt]),reactExports.useEffect(()=>{async function cn(){if(Zt===!1||Kt!==!0)return;const un=await Yt.getCartItemsAsync();en(un),zt.api.ui.hidePreloadScreen()}cn()},[Zt,Kt]),reactExports.useEffect(()=>{const{current:cn}=rn;if(!cn)return;let un=window.getComputedStyle(cn);kt.coreSceneStore.setState({dragImgElRef:cn});const hn=En=>{En.preventDefault();const An=kt.coreSceneStore.getState().mouseDownImgSrc;if(An){const Tn=kt.coreSceneStore.getState().pointerDownPos,Cn=kt.coreSceneStore.getState().moveThreshold,yn=kt.coreSceneStore.getState().mouseDragging,Sn=kt.coreSceneStore.getState().mouseDownSkuID;if(Math.abs(En.clientX-Tn)<=Cn)return;const xn={x:En.offsetX,y:En.offsetY},Rn=cn;Rn.src=An,Rn.style.opacity=.75,Rn.style.left=`calc(${xn.x}px - ${un.width})`,Rn.style.top=`calc(${xn.y}px - ${un.height})`,yn||(kt.coreSceneStore.setState({mouseDragging:!0}),kt.uiSceneStore.getState().CORE_API.itemDragStart(Sn))}},fn=()=>{if(kt.coreSceneStore.getState().mouseDownImgSrc){const An=kt.coreSceneStore.getState().mouseDragging,Tn=cn;Tn.style.opacity=0,An&&kt.uiSceneStore.getState().CORE_API.itemDragEnd(),kt.coreSceneStore.setState({mouseDownImgSrc:null,mouseDragging:!1})}},pn=En=>{const An=kt.coreSceneStore.getState().mouseDownImgSrc;if(An){const Tn=kt.coreSceneStore.getState().pointerDownPos,Cn=kt.coreSceneStore.getState().moveThreshold,yn=kt.coreSceneStore.getState().mouseDragging,Sn=kt.coreSceneStore.getState().mouseDownSkuID;if(En.preventDefault(),Math.abs(En.touches[0].clientX-kt.wcRef.offsetLeft-Tn)<=Cn)return;const xn={x:En.touches[0].clientX-kt.wcRef.offsetLeft,y:En.touches[0].clientY},Rn=cn.parentElement.getBoundingClientRect().top,Ln=cn;if(Ln.src=An,Ln.style.opacity=.75,Ln.style.left=`calc(${xn.x}px - ${un.width})`,Ln.style.top=`calc(${xn.y}px - ${Rn}px - ${un.height})`,!yn){kt.coreSceneStore.setState({mouseDragging:!0});const Nn=qt.current.getElementsByClassName("mobileGrid");for(let Fn=0;Fn<Nn.length;Fn++)Nn[Fn].style="overflow-x:hidden !important";kt.uiSceneStore.getState().CORE_API.itemDragStart(Sn)}}},dn=()=>{if(kt.coreSceneStore.getState().mouseDownImgSrc){const An=kt.coreSceneStore.getState().mouseDragging,Tn=cn;if(Tn.style.left="0px",Tn.style.top="0px",Tn.style.opacity=0,An){kt.uiSceneStore.getState().CORE_API.itemDragEnd();const Cn=qt.current.getElementsByClassName("mobileGrid");for(let yn=0;yn<Cn.length;yn++)Cn[yn].style="overflow-x:auto !important"}kt.coreSceneStore.setState({mouseDownImgSrc:null,mouseDragging:!1})}},mn=window.matchMedia("(orientation: portrait)");function vn(En){kt.uiSceneStore.setState({isScreenPortrait:En.matches})}vn(mn);const _n=kt.wcRef;return _n.addEventListener("mousemove",hn),window.addEventListener("mouseup",fn),_n.addEventListener("touchmove",pn,{passive:!1}),window.addEventListener("touchend",dn),mn.addEventListener("change",vn),()=>{const En=kt.wcRef;En&&(En.removeEventListener("mousemove",hn),En.removeEventListener("touchmove",pn)),window.removeEventListener("mouseup",fn),window.removeEventListener("touchend",dn),mn.removeEventListener("change",vn)}},[rn,qt,Yt]),jsxRuntimeExports.jsxs("div",{className:"configuratorParentDiv",style:{background:kt.cameraStore.getState().cameraSettings.clearColour},ref:qt,children:[Kt&&jsxRuntimeExports.jsx(sn,{}),jsxRuntimeExports.jsx(StyleManager,{stores:kt,containerId:"uiStylesContainer",localStyles:UI_LOCAL_STYLES,dynamicStylesId:"uiStyles",setCSSLoaded:nn}),jsxRuntimeExports.jsx("img",{id:"dragImgElRef",ref:rn,alt:"A placeholder holder element used for drag and drop functionality.",style:{backgroundImage:"url(https://placehold.co/150)"},onError:cn=>{cn.target.src="https://placehold.co/150"}}),jsxRuntimeExports.jsx(EpigraphConfiguratorCore,{stores:kt,ref:Wt,id:"epigraphConfiguratorCore",customVersionId:_e,experienceId:Dt,viewInYourSpaceRef:Xt,gaMeasurementId:jt,...Gt&&{disableCart:""},configuratorWcRef:zt,initialConfigId:zt.initialConfigId,clientAccessKey:zt.clientAccessKey,consentPlugin:zt.consentPlugin,consentIdentifier:zt.consentIdentifier,apiMode:zt.apiMode}),jsxRuntimeExports.jsx(ViewInYourSpace,{stores:kt,ref:Xt,id:"viewInYourSpace",arplacement:Jt}),Kt&&Zt&&jsxRuntimeExports.jsx("div",{className:"uiContainer",children:jsxRuntimeExports.jsx(OverlayUIManager$1,{stores:kt,configuratorWcRef:zt,coreRef:Wt,viewInYourSpaceRef:Xt,disableUI:Vt})})]})}const PRELOAD_MUTED_CSS=document.createElement("template");PRELOAD_MUTED_CSS.innerHTML=`
|
|
4651
4651
|
<style>
|
|
4652
4652
|
.preload-main-container{
|
|
@@ -4793,4 +4793,4 @@ ${zt.join(`
|
|
|
4793
4793
|
There was a problem while trying to initialise the configurator.
|
|
4794
4794
|
</div>
|
|
4795
4795
|
</div>
|
|
4796
|
-
`;const createCoreSceneStore=kt=>{const _e=coreStoreCreator();return _e.setState({stores:kt}),_e},coreStoreCreator=()=>create((kt,_e)=>({stores:null,shadowRefreshKey:0,CORE_API:null,coreReady:void 0,frameloop:"always",hoveredGhostIndex:-1,itemDraggedSkuID:null,screenshotRenderer:new WebGLRenderer({antiAlias:!0,preserveDrawingBuffer:!0}),screenshotCamera:new PerspectiveCamera(75,1.33,.1,1e3),builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!1,sceneHasDefaultConfigurationID:!1,configurationLoaded:!0,preconfigurationLoaded:!1,configurationLoadedOnRestart:!0,cursorParentRef:null,glContext:null,canvasTooltipText:"",canvasSize:{width:600,height:600},boundData:{center:new Vector3(0,0,0),size:new Vector3(0,0,0)},showDimensions:!1,autoFocusTrigger:0,cameraActive:!1,autoFocusRef:null,alertData:{},persistantAlertData:null,alertQueue:[],currentAlertData:null,alertSettings:null,draggingOnDropCollisionData:null,multipleTouchDetected:!1,isMobile:!1,isTouchDevice:!1,isTablet:!1,isDesktop:!0,isLandscape:!1,sceneSettings:{usdzMaxTextureSize:1024,usdzPrecision:7,swappableRoot:!0,ghostColorOnHoverWithDraggableUi:{r:153,g:252,b:0,a:1},preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,showInstructionsBtn:!1,showInstructionsOnStartup:!1,sceneScaleUnit:"ft",arPlacement:"floor",arTransforms:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},currency:"$",disableDragDrop:!1,ignoreSpawningCollision:!1,disableCollider:!1,disableContextMenu:!1,ghostColor:{r:10,g:10,b:10,a:.2},technicalRequirements:{minIosVersion:"11"},ghostScale:[1,1,1],ghostAsWireframe:!1,draggableUI:!1,addFromInfoModal:!1,clickToAddUi:!0,accordionInBuildUi:!1,outOfStock_EmissiveColor:{r:250,g:50,b:0},outOfStock_EmissiveIntensity:.002,defaultConfigurationID:null,emptySceneText:null,emptySceneTextFontSize:"2rem",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,comboPlugDistanceThreshold:.05,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,analyticsEventPrefix:"",outlineSettings:{multisampling:10,visibleEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),hiddenEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),blur:3,width:1e3,edgeStrength:1e3,blendFunction:BlendFunction.ALPHA,pulseSpeed:0,xRay:!0},textSettings:{arButtonLabel:"AR",arHoverLabel:"View In Your Space",restartButtonLabel:"Restart",restartHoverLabel:"Restart",saveButtonLabel:"Save",saveHoverLabel:"Save",shareButtonLabel:"Share",shareHoverLabel:"Share",sizeButtonLabel:"Size",sizeHoverLabel:"Size",hotspotsButtonLabel:"Hotspots",hotspotsHoverLabel:"Hotspots",instructionsButtonLabel:"Instructions",instructionsHoverLabel:"Instructions",cartQuantityText:"Qty",reviewButtonText:"Review",cartHeadingText:"Review Products",buildTabHeadingText:"Build",colorTabHeadingText:"Color",featuresTabHeadingText:"Features",featuresTabEmptyText:"*Please add an item to the scene to see the features",tooltipEmptySceneText:"",tooltipInstructionText:"-Drag to rotate the camera-"},variantsTabOrder:{color:{enabled:!0,priority:1},geometryVariants:{enabled:!0,priority:2}},boundingBoxLeeway:.9,contactShadowVisibility:!0,measurementPrecision:2,disableAlerts:!1,focusCameraOnGhosts:!0,alertLevel:2999,alertControl:{default:!0,itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0,unvisualizedItemSpawn:!0},screenshotCameras:[{position:new Vector3(-2.5,.6,-5),rotation:new Vector3(-3.1097068566150314,-.6437852162982552,-3.122449778846033)},{position:new Vector3(3,1,-5),rotation:new Vector3(-.5,1,.5)}],instructionsSettings_desktop:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],instructionsSettings_mobile:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],defaultInstructionsSettings:{step1_drag:{mobile:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop_Mobile/Mobile_Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"}},desktop:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop/Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"}}},step1_add:{mobile:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add_Mobile/Mobile_Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add_Mobile/Mobile_Non-furniture_Step_1B.json"}},desktop:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add/Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add/Non-furniture_Step_1B.json"}}},step2:{mobile:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}},desktop:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}}},step3:{mobile:{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}},desktop:{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}}}}},setCSSLoaded:Dt=>{kt({cssLoaded:Dt})},actions:{refreshShadows:()=>{const{shadowRefreshKey:Dt}=_e();kt({shadowRefreshKey:Dt+1})},popFromAlertQueue:()=>{const{alertQueue:Dt}=_e();return Dt.shift(),kt({alertQueue:Dt}),Dt},addToAlertQueue:Dt=>{const{alertQueue:Vt,currentAlertData:Gt}=_e();return Vt.length>0&&Vt[Vt.length-1].alertId&&Dt.alertId===Vt[Vt.length-1].alertId||Vt.length==0&&Gt&&Gt.alertId&&Gt.alertId==Dt.alertId||(Vt.push(Dt),kt({alertQueue:Vt})),Vt},getDeviceState:()=>{const{isDesktop:Dt,isMobile:Vt,isTablet:Gt,isTouchDevice:zt,isLandscape:jt}=_e();return{isDesktop:Dt,isMobile:Vt,isTablet:Gt,isTouchDevice:zt,isLandscape:jt}},enableCart:()=>{const{sceneSettings:Dt,CORE_API:Vt,stores:Gt}=_e();Dt.disableCart=!1,Gt.inventoryStore.getState().actions.refreshInventory(Gt.itemStore.getState().itemsSpawned),Vt.fireEvent(Vt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:Dt,CORE_API:Vt,stores:Gt}=_e();Dt.disableCart=!0,Gt.inventoryStore.getState().actions.refreshInventory(Gt.itemStore.getState().itemsSpawned),Vt.fireEvent(Vt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:Dt}=_e();return Dt},sendAlert:Dt=>{kt({alertData:{...Dt}})},switchCursor(Dt){const{cursorParentRef:Vt}=_e();if(!Vt)return;let Gt="";switch(Dt){default:case CURSORS.GRAB:Gt="grabCursor";break;case CURSORS.GRABBING:Gt="grabbingCursor";break;case CURSORS.BLOCKED:Gt="blockedCursor";break;case CURSORS.POINTER:Gt="pointerCursor";break;case CURSORS.MOVE:Gt="moveCursor";break}for(let zt=0;zt<Vt.classList.length;zt++)Vt.classList[zt].includes("Cursor")&&Vt.classList.remove(Vt.classList[zt]);Vt.classList.add(Gt)},setAlertSettings:Dt=>{kt({alertSettings:Dt})},async completeDropItem(){const{draggingOnDropCollisionData:Dt,CORE_API:Vt,stores:Gt}=_e(),zt=Gt.attachmentStore.getState().attachmentSystem,{node:jt,attachedChildrenGuids:Ht,collidingStatus:Wt,intersectingGhostObject:qt,initPosition:Xt,initRotation:Kt,detachedPlugs:Yt,attachedNodesToCurrentNode:Zt}=Dt;Vt.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[Qt,en]of Ht.entries())Wt[Qt]===!0&&await Gt.itemStore.getState().actions.removeItemByGUID(en);const Jt=qt.userData;let nn=jt.getPlugByName(Jt.incomingPlugName),rn=zt.currentStructure.getPlugByGUID(Jt.receiverPlugGUID);jt.ref.position.set(qt.position.x,qt.position.y,qt.position.z),jt.ref.setRotationFromEuler(qt.rotation),jt.transform={position:qt.position,rotation:qt.quaternion},zt.currentStructure.connectPlugs({incomingPlug:nn,receiverPlug:rn}),Gt.ghostStore.getState().actions.clearAllGhosts(),Gt.itemStore.getState().actions.deselectItem(),Zt.map(Qt=>{jt.ref.parent.attach(Qt.ref),Qt.transform={position:Qt.ref.position,rotation:Qt.ref.quaternion},jt.dragging=!1,Qt.dragging=!1}),await Gt.attachmentStore.getState().actions.updateFittingSkuIds()},async revertDropItem(){const{draggingOnDropCollisionData:Dt,stores:Vt}=_e(),Gt=Vt.attachmentStore.getState().attachmentSystem,{node:zt,attachedChildrenGuids:jt,collidingStatus:Ht,intersectingGhostObject:Wt,initPosition:qt,initRotation:Xt,detachedPlugs:Kt,attachedNodesToCurrentNode:Yt}=Dt;CORE_API.alert({alertMsg:"Position of item"+zt.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const Zt=Kt.neighbourDetachedPlugs;Zt&&(Kt.neighbourNode.detachNodeFromReceiver(),Gt.currentStructure.connectPlugs({incomingPlug:Zt.incomingPlug,receiverPlug:Zt.receiverPlug}));let Jt=Kt.rootDetachedPlugs.incomingPlug,nn=Kt.rootDetachedPlugs.receiverPlug;zt.ref.position.set(qt.x,qt.y,qt.z),zt.ref.setRotationFromEuler(Xt);let rn=new Quaternion().identity();zt.ref.getWorldQuaternion(rn),zt.transform={position:qt,rotation:rn},Gt.currentStructure.connectPlugs({incomingPlug:Jt,receiverPlug:nn}),Vt.ghostStore.getState().actions.clearAllGhosts(),Vt.itemStore.getState().actions.deselectItem(),Yt.map(Qt=>{zt.ref.parent.attach(Qt.ref),Qt.transform={position:Qt.ref.position,rotation:Qt.ref.quaternion},zt.dragging=!1,Qt.dragging=!1}),await Vt.attachmentStore.getState().actions.updateFittingSkuIds()},setCoreSettings:Dt=>{const{sceneSettings:Vt,isMobile:Gt,isTouchDevice:zt,isLandscape:jt,actions:Ht}=_e(),Wt=Gt===!0?"mobile":"desktop",qt=["showSave","showShare","showReset","showDimension","showHotspots","showInstructionsBtn","showViewInYourSpace","showContextMenu","showInstructionsOnStartup","draggableUI","clickToAddUi","textSettings","alertControl","variantsTabOrder","emptySceneTextFontSize","instructionsSettings"];for(const Xt of qt)if(Xt==="draggableUI"||Xt==="clickToAddUi"||Xt==="emptySceneTextFontSize"||Xt==="showInstructionsOnStartup"||Xt==="showInstructionsBtn"||Xt==="instructionsSettings"){const Yt=`${Xt}_${jt===!1&&zt===!0?"mobile":"desktop"}`;Dt[Yt]!==void 0?Vt[Xt]=Dt[Yt]:Vt[Yt]!==void 0&&(Vt[Xt]=Vt[Yt])}else if(Xt==="textSettings"||Xt==="variantsTabOrder"||Xt==="alertControl"||Xt==="outlineSettings"){if(Dt.hasOwnProperty(Xt)){let Kt=Vt[Xt];Object.keys(Kt).map(Yt=>{let Zt=Dt[Xt];Zt.hasOwnProperty(Yt)?(Yt==="visibleEdgeColor"||Yt==="hiddenEdgeColor")&&(Zt[Yt]=new Color$1(Zt[Yt]).convertSRGBToLinear()):Zt[Yt]=Kt[Yt]})}}else{const Kt=`${Xt}_${Wt}`;if(Dt[Kt]!==void 0){let Yt=`${Xt}Btn`;Xt=="showContextMenu"&&(Yt=`${Xt}`),Vt[Yt]=Dt[Kt]}}Dt.disableCart===!0&&Ht.disableCart(),Object.keys(Dt).map(Xt=>Vt[Xt]=Dt[Xt]),Vt.emptySceneText===null&&(Vt.emptySceneTextFontSize=Gt?"1.2rem":"1.5rem",Vt.draggableUI===!0?Vt.emptySceneText="Drag an item here to get started":Vt.emptySceneText="Select an item to get started"),kt({sceneSettings:{...Vt,ghostThreeColor:{r:Vt.ghostColor.r/255,g:Vt.ghostColor.g/255,b:Vt.ghostColor.b/255,a:Vt.ghostColor.a/255},draggableUiGhostThreeColorOnHover:{r:Vt.ghostColorOnHoverWithDraggableUi.r/255,g:Vt.ghostColorOnHoverWithDraggableUi.g/255,b:Vt.ghostColorOnHoverWithDraggableUi.b/255,a:Vt.ghostColorOnHoverWithDraggableUi.a/255}}})},triggerAutoFocus:(Dt=null)=>kt(Vt=>({autoFocusRef:Dt,autoFocusTrigger:Vt.autoFocusTrigger+1})),requestNewScreenshot:async(Dt,Vt)=>{const{CORE_API:Gt}=_e();return new Promise(async(zt,jt)=>{LOGGER.info({title:"Taking a screenshot"});const{screenshotRenderer:Ht,sceneRef:Wt,screenshotCamera:qt,canvasSize:Xt}=_e(),Kt=await Gt.getCurrentCameraDetails();if(Ht.setClearColor(16777215),qt.copy(Kt),Dt!==null&&(qt.position.copy(Dt.position),qt.rotation.copy(new Euler(Dt.rotation.x,Dt.rotation.y,Dt.rotation.z))),Vt==null?Ht.setSize(Xt.width,Xt.height):Ht.setSize(Vt.width,Vt.height),Ht.render(Wt.parent,qt),Ht.preserveDrawingBuffer===!1)LOGGER.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),jt({success:!1,imageData:null});else{LOGGER.info({title:"Downloading the screenshot"});const Yt=Ht.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");zt({success:!0,imageData:Yt})}})}}})),createProductDataStore=kt=>{const _e=productDataStoreCreator();return _e.setState({stores:kt}),_e},productDataStoreCreator=()=>create((kt,_e)=>({stores:null,productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:void 0,actions:{getCurrentCompareAtPricingInfo:()=>{const{productData:Dt}=_e();let Vt={};return Object.keys(Dt).map(Gt=>{if(Gt.toLowerCase()==="root")return;let zt=Dt[Gt].lookDetails,jt={};Object.keys(zt).map(Ht=>{Ht!="default"&&(jt[Ht]=zt[Ht].compareAtPrice)}),Vt[Gt]=jt}),Vt},getCurrentPricingInfo:()=>{const{productData:Dt}=_e();let Vt={};return Object.keys(Dt).map(Gt=>{if(Gt.toLowerCase()==="root")return;let zt=Dt[Gt].lookDetails,jt={};Object.keys(zt).map(Ht=>{Ht!="default"&&(jt[Ht]=zt[Ht].price)}),Vt[Gt]=jt}),Vt},updateCompareAtPricingForAllProducts:Dt=>{const{actions:Vt}=_e();Object.keys(Dt).map(Gt=>{let zt=Dt[Gt];Object.keys(zt).map(jt=>{Vt.updateCompareAtPricingForProduct(Gt,jt,zt[jt])})})},updatePricingForAllProducts:Dt=>{const{actions:Vt}=_e();Object.keys(Dt).map(Gt=>{let zt=Dt[Gt];Object.keys(zt).map(jt=>{Vt.updatePricingForProduct(Gt,jt,zt[jt])})})},updateCompareAtPricingForProduct:(Dt,Vt,Gt)=>{const{productData:zt,stores:jt}=_e();let Ht=zt[Dt];if(!Ht||!Ht.lookDetails)return;let Wt=Ht.lookDetails[Vt];if(!Wt)return;Wt.compareAtPrice=Gt,jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodesBySKUID(Dt).map(Kt=>Kt.updateCompareAtPricing())},updatePricingForProduct:(Dt,Vt,Gt)=>{const{productData:zt,stores:jt}=_e();let Ht=zt[Dt];if(!Ht||!Ht.lookDetails)return;let Wt=Ht.lookDetails[Vt];if(!Wt)return;Wt.price=Gt,jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodesBySKUID(Dt).map(Kt=>Kt.updatePricing())},setProductData:Dt=>{const{stores:Vt}=_e();let Gt={};Dt&&Object.keys(Dt).map(zt=>{const jt=Dt[zt];if(jt.skuID=zt,jt.skuID.toLowerCase()==="root"){jt.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},jt.defaultVariant="default";return}if(jt?.lookDetails){const Ht=jt.lookDetails;let Wt=Object.keys(jt.lookDetails);if(Wt.includes("default")){const Xt=Wt.indexOf("default");Wt.splice(Xt,1)}jt.looks=Wt,Object.keys(jt.lookDetails).map(Xt=>{let Kt=jt.lookDetails[Xt];Kt.inventory===void 0&&(Kt.inventory=DEFAULT_INVENTORY),Kt.price===void 0&&(Kt.price=DEFAULT_PRODUCT_PRICE),Kt.compareAtPrice===void 0&&(Kt.compareAtPrice=DEFAULT_PRODUCT_COMPARE_AT_PRICE),Gt[zt]={...Gt[zt],[Xt]:{inventory:DEFAULT_INVENTORY,inScene:[]}}});let qt=jt?.defaultVariant;qt||(LOGGER.warn({title:`No defaultVariant set for ${jt.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),qt=Object.keys(jt.lookDetails).sort()[0],LOGGER.warn({title:"Auto resolved default look ID: "+qt})),Wt.includes(qt)?(jt.lookDetails.default=Ht[qt],jt.lookDetails.default.id=qt):(LOGGER.error({title:`Default look [ ${qt} ] doesn't exist for: ${zt}. Please make sure to select a default variant in Input Data for this project`}),jt.lookDetails.default=null)}}),LOGGER.info({title:"PRODUCT DATA: ",details:Dt}),Vt.inventoryStore.setState({inventoryData:Gt}),kt({productData:Dt})},setCategoryData:Dt=>{const{productData:Vt}=_e();Dt.geometryVariants!==void 0&&Dt.geometryVariants.map(Gt=>{Gt.defaultVariant===void 0&&Object.keys(Gt.variants).length>0&&(Gt.defaultVariant=Object.keys(Gt.variants)[0])}),Dt.color!==void 0&&Dt.color.map(Gt=>{(Gt.defaultLook===void 0&&Gt.looks.length>0||!Gt.looks.includes(Gt.defaultLook))&&(Gt.defaultLook=Gt.looks[0])}),kt({categoryData:Dt}),Dt.build!==void 0&&Dt.build.map(Gt=>{Gt.skus.map(zt=>{Vt[zt].categoryID=Gt.categoryID,Vt[zt].categoryLabel=Gt.label,Vt[zt].swappable=Gt.swappable?Gt.swappable:!1,Vt[zt].replace=Gt.replace})})},getProductDataById:Dt=>{const{productData:Vt}=_e();let Gt=null;return Vt[Dt]&&(Gt=Vt[Dt]),Gt},setLookData:Dt=>kt({lookData:Dt}),setHotspotsData:Dt=>{const{categoryData:Vt,productData:Gt}=_e();Vt.geometryVariants&&Object.keys(Dt).map(zt=>{Dt[zt].map(jt=>{jt.geometryVariantID&&Vt.geometryVariants.map(Ht=>{Object.keys(Ht.variants).map(Wt=>{jt.geometryVariantID==Wt&&Ht.productsInCategory.map(qt=>{let Xt=null;qt.products.map(Kt=>{Dt.hasOwnProperty(Kt)&&(Xt=Dt[Kt])}),qt.products.map(Kt=>{Dt.hasOwnProperty(Kt)||(Dt[Kt]=Xt)})})})})})}),kt({hotspotsData:Dt})},setAssetsData:Dt=>kt({assetsData:Dt})}})),createItemStore=kt=>{const _e=itemStoreCreator();return _e.setState({stores:kt}),_e},itemStoreCreator=()=>create((kt,_e)=>({stores:null,variantChangeAlert:!1,focusedGUID:null,removeItems:[],removeItemTrigger:!1,itemsSpawned:{},itemsCount:0,modelLoadedAlert:0,lastDeletedItemData:null,lastDeletedItemsData:[],hoveredItemRef:{},collidersRef:[],fittingSkuIds:[],filteredCollidersRef:[],selectedItemData:null,defaultSceneItemCount:0,busySpawningItem:!1,busyReplacingItem:!1,busySpawningDependency:!1,busyDraggingItem:!1,busyRemovingItem:!1,isBusy:()=>{const{busySpawningItem:Dt,busyReplacingItem:Vt,busySpawningDependency:Gt,busyDraggingItem:zt,busyRemovingItem:jt}=_e();return Dt||Vt||Gt||zt||jt},actions:{triggerModelLoaded:()=>{kt(Dt=>({modelLoadedAlert:Dt.modelLoadedAlert+1}))},triggerRemoveItem:()=>{kt(Dt=>({removeItemTrigger:!Dt.removeItemTrigger}))},addToRemoveItems:Dt=>{const{removeItems:Vt}=_e();Vt.push(Dt)},switchToVariant:async(Dt,Vt,Gt=!1)=>{const{variantChangeAlert:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().categoryData;let qt=jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt.guid);const Xt=jt.assetStore.getState().assets.items,Kt=qt.ref.getObjectByName("GRP_RenderGeometry");Xt[Dt.skuID].data||Ht.geometryVariants&&Ht.geometryVariants.map(Yt=>{Yt.productsInCategory.map(Zt=>{let Jt=!1;Zt.products.map(nn=>{nn==Dt.skuID&&(Jt=!0)}),Jt&&Zt.products.map(nn=>{const rn=jt.assetStore.getState().assets.items[nn].data;rn&&(jt.assetStore.getState().assets.items[Dt.skuID].data=rn)})})}),qt.modelFunctions&&(await qt.modelFunctions.selectVariant(Kt,Vt),Gt?(qt.overrideVariant=Vt,jt.coreSceneStore.getState().CORE_API.fireEvent(jt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0)):qt.currentVariant=Vt,kt({variantChangeAlert:!zt}))},clearAllItems:()=>{kt({itemsSpawned:{},itemsCount:0,lastDeletedItemsData:[],hoveredItemRef:[],collidersRef:[],filteredCollidersRef:[],selectedItemData:null})},setItemsSpawned:Dt=>{kt({itemsSpawned:Dt,itemsCount:Object.keys(Dt).length})},setHoveredItemRef:Dt=>kt({hoveredItemRef:Dt}),setCollidersRef:Dt=>{const{stores:Vt}=_e();kt({collidersRef:Dt});let Gt=[];for(let zt=0;zt<Dt.length;zt++)Dt[zt].current&&Gt.push(Dt[zt]);Vt.itemStore.setState({filteredCollidersRef:[...Gt]})},setSelectedItemData:Dt=>{const{selectedItemData:Vt,hoveredItemRef:Gt,actions:zt,stores:jt}=_e();Vt&&(delete Gt[Vt.itemData.guid],zt.setHoveredItemRef({...Gt})),kt({selectedItemData:{...Dt}}),jt.hotspotStore.getState().actions.switchHotspotsVisibility(!1,!0),jt.cameraStore.getState().actions.canCameraRotate(!1)},deselectItem:()=>{const{selectedItemData:Dt,stores:Vt}=_e();Dt&&Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.UI.ContextMenu_Hide,Dt),kt(()=>({selectedItemData:null})),Vt.hotspotStore.getState().actions.switchHotspotsVisibility(!0,!0),Vt.cameraStore.getState().actions.canCameraRotate(!0),Vt.itemStore.getState().actions.setHoveredItemRef({})},removeItemByGUID:async Dt=>{const{itemsSpawned:Vt,actions:Gt,stores:zt}=_e();if(Vt.hasOwnProperty(Dt))return kt({busyRemovingItem:!0}),new Promise(async(jt,Ht)=>{const Wt=qt=>{Dt===qt.data.itemData.guid&&(kt({busyRemovingItem:!1}),jt(Dt))};zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Removed,Wt,{once:!0}),Gt.addToRemoveItems(Dt),Gt.triggerRemoveItem()})},addItemBySkuID:async(Dt,Vt=0,Gt=!1,zt)=>{kt({busySpawningItem:!0});const{actions:jt,itemsSpawned:Ht,stores:Wt}=_e(),qt=Wt.productDataStore.getState().productData,Xt=Wt.productDataStore.getState().hotspotsData,Kt=Wt.attachmentStore.getState().attachmentSystem;let Yt=!0;const Zt=await new Promise(async(Jt,nn)=>{if(LOGGER.info({title:`Spawning item: ${Dt}`}),jt.deselectItem(),!qt[Dt]){LOGGER.warn({title:`Product not found: ${Dt}`}),Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:Dt+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),Yt=!1,nn(Dt+": product not found!");return}const rn=[...Wt.ghostStore.getState().ghostsTransform],Qt={...Wt.ghostStore.getState().ghostData};if(rn.length<=0){Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:"Unable to add item to configuration",alertTime:6e3,alertType:"warn",alertLabel:"Action Unavailable"}),Yt=!1,nn("No available connections for this product to attach to");return}const en=tn=>{Dt===tn.data&&Jt(Qt.newNodes[Vt].guid)};if(Wt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Wt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,en,{once:!0}),Qt.addItemOrSwap[Vt]=="replace")await replaceItem(kt,Wt,Ht,Qt.skuID,rn[Vt],Qt.newNodes[Vt]);else{Wt.ghostStore.getState().actions.clearAllGhosts();const tn=Qt.newNodes[Vt];tn.isDependent=Gt;let sn=!0;if(qt[Qt.skuID].hasOwnProperty("disableInteraction")){const fn=qt[Qt.skuID].disableInteraction;(fn==!0||fn==!1)&&(sn=!fn)}zt!=null&&(sn=zt),tn.isInteractive=sn;const{position:cn,rotation:un}=rn[Vt];tn.transform={position:cn,rotation:un},Kt.currentStructure.addNode(tn),Qt.connectablePlugs[Vt].receiverPlug.type=="unvisualizedPlug"&&Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:"This product is not shown in your 3D configuration but can be found in your shopping list.",alertTime:3e3,alertType:"warn",alertLabel:"Internal Storage",persistant:!1,alertId:"unvisualizedItemSpawn"}),Qt.comboPlugs[Vt].length>0&&Qt.connectablePlugs[Vt].incomingPlug.type=="comboPlug"&&Qt.comboPlugs[Vt].map(fn=>{Kt.currentStructure.connectPlugs(fn)}),Qt.connectablePlugs[Vt].incomingPlug.comboPlugConnector=!0,Kt.currentStructure.connectPlugs(Qt.connectablePlugs[Vt]);const hn=await Wt.assetStore.getState().actions.loadProxyAsset(Qt.skuID,!0);LOGGER.info({title:"GHOST NEW NODE: ",details:tn}),Ht[tn.guid]={itemData:{proxyScene:hn.proxy.data.scene,guid:Qt.newNodes[Vt].guid,...qt[Qt.skuID],position:cn,rotation:un,hasItemLoaded:!1,isDependent:Gt,isInteractive:sn},hotspotsData:Xt[Qt.skuID],hotspotSpawned:!1},await wait(1),jt.setItemsSpawned({...Ht})}}).catch(Jt=>{LOGGER.error({title:Jt}),Yt=!1});if(Yt===!1)return kt({busySpawningItem:!1}),Zt;if(Wt.coreSceneStore.getState().preconfigurationLoaded&&Wt.coreSceneStore.getState().configurationLoaded){const Jt=await Kt.getCartItemsAsync();Jt&&Wt.coreSceneStore.getState().CORE_API.fireEvent(Wt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Jt)}if(await jt.resolvePlugDependencyOnGUID(Zt),kt({busySpawningItem:!1}),!Gt){const Jt=Kt.currentStructure,nn=Jt.getNodeByGUID(Zt);Wt.dynamicHookStore.getState().hookOnSceneItemAdded(nn,Jt.nodes,Wt.coreSceneStore.getState().CORE_API),await Wt.attachmentStore.getState().actions.updateFittingSkuIds()}return Zt},async addItemWithTransform(Dt,Vt,Gt,zt=!0){const{actions:jt,itemsSpawned:Ht,defaultSceneItemCount:Wt,stores:qt}=_e(),Xt=qt.productDataStore.getState().productData,Kt=qt.productDataStore.getState().hotspotsData;return await new Promise(async(Zt,Jt)=>{if(jt.deselectItem(),!Xt[Vt]){qt.coreSceneStore.getState().CORE_API.alert({alertMsg:Vt+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),Jt(Vt+": product not found!");return}const{position:nn,rotation:rn}=Dt;Ht[Gt]!=null&&(qt.hotspotStore.getState().actions.removeHotspotForItem({...Ht[Gt]}),delete Ht[Gt]);const Qt=tn=>{Vt.toLowerCase()==tn.data.toLowerCase()&&Zt(Gt)};qt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(qt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Qt,{once:!0});const en=await qt.assetStore.getState().actions.loadProxyAsset(Vt,!0);if(en==null){Jt(Vt+": Asset not found!");return}await wait(1),Vt.toLowerCase()==="root"&&kt({defaultSceneItemCount:Wt+1}),Ht[Gt]={itemData:{proxyScene:en.proxy.data.scene,guid:Gt,...Xt[Vt],position:nn,rotation:rn,hasItemLoaded:!1,isInteractive:zt},hotspotsData:Kt[Vt],hotspotSpawned:!1},kt({itemsSpawned:{...Ht}})}).catch(Zt=>{LOGGER.info({title:Zt})})},async resolvePlugDependencyOnGUID(Dt){const{actions:Vt,itemsSpawned:Gt,defaultSceneItemCount:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().productData,Wt=jt.attachmentStore.getState().attachmentSystem,qt=Gt[Dt].itemData.skuID,Xt=Ht[qt]?.plugs;if(!Xt)return;let Kt=!1;for(const Yt of Xt)Yt?.dependencySku&&(Kt=!0);Kt&&(kt({busySpawningDependency:!0}),await new Promise(async(Yt,Zt)=>{const Jt=[];for(const nn of Xt){const rn=nn?.dependencySku;if(!rn)continue;const Qt=async()=>{LOGGER.info({title:`Found a dependency: ${rn} on the plug: ${nn.name}`});let en=!0;Ht[rn]&&Ht[rn].hasOwnProperty("ignoreSpawningCollisionAsDependency")&&(en=Ht[rn].ignoreSpawningCollisionAsDependency),nn.hasOwnProperty("ignoreSpawningCollision")&&(en=nn.ignoreSpawningCollision);let tn=jt.coreSceneStore.getState().sceneSettings.ignoreSpawningCollision;Ht[rn].hasOwnProperty("ignoreSpawningCollision")&&(tn=Ht[rn].ignoreSpawningCollision),Ht[rn].ignoreSpawningCollision=en,jt.ghostStore.setState({ghostVisibility:!1});const sn=await jt.ghostStore.getState().actions.spawnGhostsForSkuID(rn,en);if(Ht[rn].ignoreSpawningCollision=tn,!sn)return;const cn=Wt.currentStructure.getNodeByGUID(Dt),un=cn.getPlugByName(nn.name)?.guid,hn=nn?.isDependencySkuInteractive?nn.isDependencySkuInteractive===1:!1,fn=sn.connectablePlugs;let pn=-1;for(const mn of fn)mn.receiverPlug.guid===un&&(pn=fn.indexOf(mn));if(pn==-1){jt.ghostStore.getState().actions.clearAllGhosts();return}const dn=await Vt.addItemBySkuID(rn,pn,!0,hn);qt.toLowerCase()==="root"&&Ht[rn].ignoreInCart&&kt({defaultSceneItemCount:zt+1}),dn!==null&&cn.addMyDependenciesGUID(dn)};Jt.push(await Qt())}await Promise.all(Jt),Yt(!0)}),kt({busySpawningDependency:!1}))},async replaceGuidItemBySkuId(Dt,Vt){const{itemsSpawned:Gt,stores:zt}=_e();if(Gt[Dt]==null)return!1;const jt=zt.attachmentStore.getState().attachmentSystem.currentStructure,Ht=jt.getNodeByGUID(Dt);if(!Ht||!Ht.isReplaceableWithSkuId(Vt))return!1;LOGGER.info({title:"Replacing Item"});const qt=zt.productDataStore.getState().productData,Xt=zt.productDataStore.getState().hotspotsData;kt({busyReplacingItem:!0}),await new Promise(async(Kt,Yt)=>{const Zt=async()=>{LOGGER.info({title:"Removed old item with guid: "+Dt});const Jt=async Qt=>{Vt===Qt.data&&(jt.recalculateStructureFromNode(Ht.whichNodeAreWeAttachedTo()),await zt.attachmentStore.getState().actions.toggleStructureUpdated(),kt({busyReplacingItem:!1}),Kt(Ht.guid))};zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Jt,{once:!0});const nn=await zt.assetStore.getState().actions.loadProxyAsset(Vt,!0),rn={receiverPlug:Ht.whichPlugAreWeAttachedTo(),incomingPlug:Ht.whichPlugAreWeAttachedUsing()};jt.findItemTransform(rn),Gt[Dt]={itemData:{proxyScene:nn.proxy.data.scene,guid:Dt,...qt[Vt],position:Ht.transform.position,rotation:Ht.transform.rotation,hasItemLoaded:!1},hotspotsData:Xt[Vt],hotspotSpawned:!1},LOGGER.warn({title:"SWITCHING VARIANT: ",details:Ht.currentVariant}),zt.itemStore.setState({itemsSpawned:{...Gt}})};zt.hotspotStore.getState().actions.removeHotspotForItem({...Gt[Dt]}),delete Gt[Dt],Ht.update(Vt),zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Zt,{once:!0})})}}}));async function replaceItem(kt,_e,Dt,Vt,Gt,zt){LOGGER.info({title:"Replacing Item"});const{position:jt,rotation:Ht}=Gt,Wt=_e.productDataStore.getState().productData,qt=_e.productDataStore.getState().hotspotsData,Xt=_e.attachmentStore.getState().attachmentSystem.currentStructure;return kt({busyReplacingItem:!0}),new Promise(async(Kt,Yt)=>{const Zt=async()=>{const Jt=await _e.assetStore.getState().actions.loadProxyAsset(Vt,!0),nn=async rn=>{Vt===rn.data&&(Xt.recalculateStructureFromNode(zt),await _e.attachmentStore.getState().actions.toggleStructureUpdated(),_e.ghostStore.getState().actions.clearAllGhosts(),kt({busyReplacingItem:!1}),Kt(zt.guid))};_e.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,nn,{once:!0}),Dt[zt.guid]={itemData:{proxyScene:Jt.proxy.data.scene,guid:zt.guid,...Wt[Vt],position:jt,rotation:Ht,hasItemLoaded:!1},hotspotsData:qt[Vt],hotspotSpawned:!1},LOGGER.warn({title:"SWITCHING VARIANT: ",details:zt.currentVariant}),zt.currentVariant=zt.currentVariant,zt.transform=Gt,_e.itemStore.setState({itemsSpawned:{...Dt}})};_e.hotspotStore.getState().actions.removeHotspotForItem({...Dt[zt.guid]}),delete Dt[zt.guid],zt.update(Vt),_e.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Zt,{once:!0})})}const createInventoryStore=kt=>{const _e=inventoryStoreCreator();return _e.setState({stores:kt}),_e},inventoryStoreCreator=()=>create((kt,_e)=>({stores:null,inventoryData:{},actions:{updateInventoryForAllProducts:Dt=>{const{actions:Vt,stores:Gt}=_e();Object.keys(Dt).map(zt=>{let jt=Dt[zt];Object.keys(jt).map(Ht=>{Vt.updateInventoryForProduct(zt,Ht,jt[Ht].inventory)})}),Vt.refreshInventory(Gt.itemStore.getState().itemsSpawned)},updateInventoryForProduct:(Dt,Vt,Gt)=>{const{inventoryData:zt}=_e();let jt=zt[Dt],Ht=jt[Vt];!jt||!Ht||(Ht.inventory=Gt)},_clearInScene:()=>{const{inventoryData:Dt}=_e();Object.keys(Dt).map(Vt=>{const Gt=Dt[Vt];Object.keys(Gt).map(zt=>{Gt[zt].inScene=[]})})},refreshInventory:Dt=>{if(!Dt)return;LOGGER.info({title:"Refreshing Inventory"});const{actions:Vt,inventoryData:Gt,stores:zt}=_e();Vt._clearInScene();const jt=zt.attachmentStore.getState().attachmentSystem;if(jt===null)return;const Ht=jt.currentStructure;if(Ht===null)return;Object.keys(Dt).map(Kt=>{const Yt=Ht.getNodeByGUID(Kt);if(!Yt)return;const Zt=Yt.overrideVariant?Yt.overrideVariant:Yt.currentVariant;if(!Zt)return;const Jt=Gt[Yt.skuID];if(!Jt||!Jt[Zt].inScene)return;Jt[Zt].inScene.push(Kt),zt.coreSceneStore.getState().sceneSettings.disableCart===!0?Yt.inStock={variantName:Zt,newValue:!0}:Jt[Zt].inScene.length>Jt[Zt].inventory?Yt.inStock={variantName:Zt,newValue:!1}:Yt.inStock={variantName:Zt,newValue:!0}});let Wt=!1;Object.keys(Gt).map(Kt=>{const Yt=Gt[Kt];Object.keys(Yt).map(Zt=>{Yt[Zt].countAvailable=Yt[Zt].inventory-Yt[Zt].inScene.length,Yt[Zt].countAvailable<0?(Yt[Zt].countUnavailable=Yt[Zt].countAvailable*-1,Yt[Zt].countAvailable=0,Wt=!0):Yt[Zt].countUnavailable=0})});const qt={alertMsg:"Some item(s) in configuration are out of stock",alertTime:7e3,alertType:"warn",alertLabel:"Stock Alert",persistant:!0,alertId:"outOfStock"},Xt=compareObjects(zt.coreSceneStore.getState().persistantAlertData,qt);Wt===!1&&Xt===!0&&zt.coreSceneStore.getState().CORE_API.removePersistantAlert(),zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Inventory_Updated,Gt)}}})),createAssetStore=kt=>{const _e=assetStoreCreator();return _e.setState({stores:kt}),_e},assetStoreCreator=()=>create((kt,_e)=>({stores:null,assets:{items:{}},gltfLoader:null,dracoLoader:null,actions:{init(){const Dt=new DRACOLoader;Dt.setDecoderPath(`${ASSETS_SOURCE_ROOT}/external-libs/draco/`),Dt.setDecoderConfig({type:"js"});const Vt=new GLTFLoader;Vt.register(Gt=>new GLTFMaterialsVariantsExtension(Gt)),Vt.setDRACOLoader(Dt),kt({dracoLoader:Dt,gltfLoader:Vt})},async loadProxyAsset(Dt){const{assets:Vt,gltfLoader:Gt,stores:zt}=_e(),jt="proxy",Ht=Vt.items[Dt]=Vt.items[Dt]||{isLoaded:!1,errorLoading:!1,proxy:{isLoaded:!1,errorLoading:!1}},Wt=Ht.proxy;if(Wt.isLoaded)return Ht;if(Wt.errorLoading)throw new Error(`${jt} loading failed for: ${Dt}`);const qt=zt.productDataStore.getState().productData[Dt];if(!qt)throw new Error(`Data doesn't exist for ${Dt}`);const Xt=zt.coreSceneStore.getState().CORE_API.getResolvedAssetUrl(qt.colliderProxyGLTF);if(!Xt)return null;try{const Kt=await Gt.loadAsync(Xt,Yt=>{Wt.progress=Yt.loaded/Yt.total*100});return Wt.data=Kt,Wt.isLoaded=!0,Ht}catch(Kt){throw Wt.isLoaded=!1,Wt.errorLoading=!0,Wt.error=Kt,LOGGER.info({title:Xt}),new Error(`Couldn't load ${Dt}`)}},isProxyLoaded(Dt){const Vt=_e().assets.items[Dt];return Vt?Vt.proxy.isLoaded:!1}}}));class Structure{#e=!1;constructor(_e,Dt=null,Vt,Gt){if(this.stores=_e,this._nodes=[],this._rootNode=null,LOGGER.info({title:"preloadNodes",details:Dt}),this.setupHookOnSceneItemsUpdated(),Dt){LOGGER.info({title:"PRELOAD Length-----------------:"+Dt.length});for(let zt=0;zt<Dt.length;zt++){LOGGER.info({title:"FOUND PRELOAD-----------------"});const jt=Dt[zt].skuID;if(jt.toLowerCase()=="root"){const Wt=this.stores.itemStore.getState().itemsSpawned;Object.keys(Wt).length>0&&(Dt[zt].guid=Object.keys(Wt)[0])}let Ht=new Node$1(_e,jt,Dt[zt],Vt,Gt);jt.toLowerCase()=="root"&&(this._rootNode=Ht),this._nodes.push(Ht)}}else{const zt=new Node$1(_e,"Root",null,Vt,Gt);this._rootNode=zt,this._nodes.push(zt),this.stores.itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},"Root",this._rootNode.guid,!1)}this._boundingBoxLeeway=this.stores.coreSceneStore.getState().sceneSettings.boundingBoxLeeway}async setupHookOnSceneItemsUpdated(){const _e=this.stores.coreSceneStore.getState().CORE_API;this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.EVENTS.SCENE.FittingSkuIds_Updated,()=>{this.stores.dynamicHookStore.getState().hookOnSceneItemsUpdated(this._nodes,_e)})}get nodes(){return this._nodes}get rootNode(){return this._rootNode}updatePricing(){for(let _e=0;_e<this._nodes.length;_e++)this._nodes[_e].updatePricing()}getCurrentItemsInReplaceableCategory(){let _e={};for(const Dt of this._nodes)Dt.replace&&(_e[Dt.categoryID]=Dt.skuID);return _e}recalculateStructureFromNode(_e){for(let Dt=0;Dt<_e.plugs.length;Dt++)if(!_e.plugs[Dt].isOpen&&_e.plugs[Dt].isReceiverPlug){const Vt=_e.plugs[Dt].attachedPlug.node,Gt={receiverPlug:_e.plugs[Dt],incomingPlug:_e.plugs[Dt].attachedPlug};if(Gt){const zt=this.findItemTransform(Gt);zt&&(Vt.ref.position.set(zt.position.x,zt.position.y,zt.position.z),zt.rotation.isQuaternion===!0?Vt.ref.setRotationFromQuaternion(zt.rotation):zt.rotation.isEuler===!0&&Vt.ref.setRotationFromEuler(zt.rotation),Vt.transform={position:zt.position,rotation:zt.rotation})}this.recalculateStructureFromNode(Vt)}}rotateNode(_e){const Dt=this.getNodeByGUID(_e);let Vt=null,Gt=null;for(let Ht=0;Ht<Dt.plugs.length;Ht++)if(!Gt&&!Dt.plugs[Ht].isOpen&&Dt.plugs[Ht].attachedPlug.isReceiverPlug){const Wt=Dt.plugs[Ht].attachedPlug.acceptedPlugTypes;Gt=Dt.plugs[Ht].attachedPlug;let qt=[];for(let Xt=Ht+1;Xt<Dt.plugs.length;Xt++)qt.push(Dt.plugs[Xt]);for(let Xt=0;Xt<Ht;Xt++)qt.push(Dt.plugs[Xt]);for(let Xt=0;Xt<qt.length;Xt++)for(let Kt=0;Kt<qt[Xt].connectsToPlugTypes.length;Kt++)Wt.includes(qt[Xt].connectsToPlugTypes[Kt])&&(Vt=qt[Xt])}if(!Vt)return;Dt.detachNodeFromReceiver();const{position:zt,rotation:jt}=this.findItemTransform({receiverPlug:Gt,incomingPlug:Vt});Dt.ref.position.set(zt.x,zt.y,zt.z),jt.isQuaternion===!0?Dt.ref.setRotationFromQuaternion(jt):jt.isEuler===!0&&Dt.ref.setRotationFromEuler(jt),Dt.transform={position:Dt.ref.position,rotation:jt},this.connectPlugs({receiverPlug:Gt,incomingPlug:Vt}),this.recalculateStructureFromNode(Dt)}async load(_e){this.resolvePlugConnections(_e),await this.respawnItems()}materialOverrideExists(){let _e=!1;return this.nodes.map(Dt=>{if(Dt.overrideVariant)return _e=!0,!0}),_e}async findGhostTransformForReplacement(_e,Dt){let Vt=[],Gt=[],zt=[];for(const Ht of Dt){if(Ht.skuID==_e)continue;const Wt=this.stores.attachmentStore.getState().attachmentSystem,qt=Ht.whichPlugAreWeAttachedTo(),Xt=Ht.whichPlugAreWeAttachedUsing(),Yt=new Node$1(this.stores,_e,null,Wt.globalVariants,Wt.globalGeometryVariants).getPlugByName(Xt.name);if(!Yt)continue;const Zt={incomingPlug:Yt,receiverPlug:qt},{position:Jt,rotation:nn}=this.findItemTransform(Zt);Jt&&nn&&(Gt.push({position:Jt,rotation:nn,incomingPlugName:Zt.incomingPlug.name,receiverPlugName:Zt.receiverPlug.name,incomingPlugGUID:Zt.incomingPlug.guid,receiverPlugGUID:Zt.receiverPlug.guid}),zt.push(Zt),Vt.push(Ht))}let jt={transforms:Gt,connectablePlugs:zt,newNodes:Vt};return jt=await this.stores.dynamicHookStore.getState().hookOnNewItemGhostsCollectedForReplacement(jt,this.stores.coreSceneStore.getState().CORE_API),jt}async findGhostTransforms(_e,Dt){const Vt=this.getOpenPlugs(),Gt=this.stores.coreSceneStore.getState().sceneSettings.comboPlugDistanceThreshold;if(Vt.length<=0)return{transforms:[]};const zt=this.stores.attachmentStore.getState().attachmentSystem,jt=this.stores.productDataStore.getState().productData,Ht=new Node$1(this.stores,_e,null,zt.globalVariants,zt.globalGeometryVariants),Wt=this.getConnectablePlugs(Ht,Vt);let qt=[];if(Wt.length<=0)return{transforms:[]};let Xt=[],Kt=[];const Yt=this.stores.assetStore.getState().assets.items[_e].proxy.data.scene;if(!Yt)return!1;let Zt=Yt.clone();for(let rn=0;rn<Wt.length;rn++){let Qt=Dt,{incomingPlug:en,receiverPlug:tn}=Wt[rn],sn=this.findItemTransform(Wt[rn]);if(!sn)continue;let{position:cn,rotation:un}=sn;if(!cn||!un)continue;Zt.position.set(cn.x,cn.y,cn.z),un.isQuaternion===!0?Zt.setRotationFromQuaternion(un):un.isEuler===!0&&Zt.setRotationFromEuler(un);let hn=[],fn=[];if(en.type=="comboPlug"){if(en.connectsToPlugTypes.length<=0)continue;const vn=en.connectsToPlugTypes[0];let _n=!1;if(Kt.map(Cn=>{_n===!0||Cn.length<=0||Cn.map(yn=>{_n===!0||yn.incomingPlug.guid!==en.guid||yn.incomingPlug.connectsToPlugTypes.includes(vn)&&(_n=!0)})}),_n===!0)continue;const An=en.node.plugs;let Tn=!0;if(An.map(Cn=>{if(Cn.type!=="comboPlug"||Cn.guid===en.guid||!Cn.connectsToPlugTypes.includes(vn))return;let yn=!1;if(Vt.map(Sn=>{if(tn.guid===Sn.guid||!Sn.acceptedPlugTypes.includes(vn)||!Sn.node.ref)return;let wn=new Vector3(0,0,0);const xn=Sn.node.ref.getObjectByName(""+Sn.name);if(!xn)return;xn.getWorldPosition(wn);let Rn=new Vector3(0,0,0);const Ln=Zt.getObjectByName(""+Cn.name);if(!Ln)return;Ln.getWorldPosition(Rn);const Nn=wn.distanceTo(Rn);Math.abs(Nn)<Gt&&(hn.push(tn.node.guid),hn.push(Sn.node.guid),fn.push({receiverPlug:Sn,incomingPlug:Cn}),yn=!0)}),yn==!1){Tn=!1;return}}),!Tn)continue}let pn=Qt;Array.isArray(Qt)===!0&&(pn=!1),hn.length>0&&(pn=!1,Array.isArray(Qt)===!0?hn.map(vn=>{Qt.push(vn)}):Qt=hn),jt[_e].hasOwnProperty("ignoreSpawningCollision")&&(pn=jt[_e].ignoreSpawningCollision),Wt[rn].receiverPlug.type=="unvisualizedPlug"&&(pn=!0),(pn?!1:this.isColliding(Ht.skuID,sn,Wt[rn].receiverPlug,Qt))||(Xt.push({position:cn,rotation:un,incomingPlugName:Wt[rn].incomingPlug.name,receiverPlugName:Wt[rn].receiverPlug.name,incomingPlugGUID:Wt[rn].incomingPlug.guid,receiverPlugGUID:Wt[rn].receiverPlug.guid}),qt.push(Wt[rn]),Kt.push(fn))}let Jt=[];for(let rn=0;rn<Xt.length;rn++)Jt.push(Ht);dispose3(Zt);let nn={transforms:Xt,newNodes:Jt,connectablePlugs:qt,comboPlugs:Kt};return nn=await this.stores.dynamicHookStore.getState().hookOnNewItemGhostsCollected(nn,this.stores.coreSceneStore.getState().CORE_API),nn}resolvePlugConnections(_e){for(let Dt=0;Dt<_e.length;Dt++)Object.keys(_e[Dt].plugs).map(Vt=>{let Gt=_e[Dt].plugs[Vt].guid,zt=this.getPlugInNodesByGUID(Gt);if(!zt||zt.attachedPlug)return;let jt=_e[Dt].plugs[Vt].attachedPlugGUID,Ht=this.getPlugInNodesByGUID(jt);Ht&&(Ht.attachedPlug||(zt.attachPlug(Ht,_e[Dt].plugs[Vt].isReceiverPlug),Ht.attachPlug(zt,!_e[Dt].plugs[Vt].isReceiverPlug)))});LOGGER.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let _e=[this.rootNode];for(let zt=0;zt<_e.length;zt++){let Ht=_e[zt].whichPlugsAreAttachedToUs();for(let Wt=0;Wt<Ht.length;Wt++){if(Ht[Wt].incomingPlug.type=="comboPlug"&&Ht[Wt].incomingPlug.connectsToPlugTypes.length>0&&!Ht[Wt].incomingPlug.comboPlugConnector)continue;let qt=this.findItemTransformForPreload(Ht[Wt],Ht[Wt].receiverPlug.node.transform);qt?await this.stores.itemStore.getState().actions.addItemWithTransform(qt,Ht[Wt].incomingPlug.node.skuID,Ht[Wt].incomingPlug.node.guid):LOGGER.warn({title:"Problem finding plug transform! "+Ht[Wt].name}),Ht[Wt].incomingPlug.node.transform=qt,_e.push(Ht[Wt].incomingPlug.node)}}const Dt=await this.stores.coreSceneStore.getState().CORE_API.getCartItemsAsync();this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.SavedConfiguration_Loaded,{...Dt}),this.stores.coreSceneStore.getState().actions.triggerAutoFocus(),this.stores.hotspotStore.getState().actions.checkHotspotHealth();const Vt=this.stores.coreSceneStore.getState().preconfigurationLoaded==!1&&this.stores.coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,Gt=this.stores.coreSceneStore.getState().configurationLoaded==!1&&this.stores.coreSceneStore.getState().preconfigurationLoaded==!0&&this.stores.coreSceneStore.getState().configurationLoadedOnRestart==!0;if((Vt||Gt)&&this.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics){const zt=new x$2(!0);this.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(zt)}}getPlugInNodesByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++){let Vt=this._nodes[Dt].getPlugByGUID(_e);if(Vt)return Vt}return null}export(){let _e=[];for(let Dt=0;Dt<this._nodes.length;Dt++){let Vt=this._nodes[Dt].export();Vt&&_e.push(Vt)}return _e}async clear(){return new Promise(async(_e,Dt)=>{!this._rootNode&&this._rootNode.isEndNode&&_e(!0);let Vt=null;const Gt=this._rootNode.whichNodesAreAttachedToUs();Gt.length>0&&(Vt=Gt[0]),this.#e=!0,this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Scene_Cleared,zt=>_e(zt.data),{once:!0}),Vt?this.stores.coreSceneStore.getState().CORE_API.removeItemByGUID(Vt.guid,!0):(await wait(500),_e(!0))})}getNodeByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e)return this._nodes[Dt];return null}getPlugByGUID(_e){for(const Dt of this._nodes){const Vt=Dt.getPlugByGUID(_e);if(Vt)return Vt}return null}findItemTransformForPreload(_e,Dt){let{receiverPlug:Vt,incomingPlug:Gt}=_e,zt=Vt,jt=Gt;if(zt.node.skuID=="Root")return this.findItemTransformRoot(_e);let Ht=null,Wt=null,qt=new Object3D,Xt=this.stores.assetStore.getState().assets.items[zt.node.skuID].proxy.data.scene.clone();qt.add(Xt);let{position:Kt,rotation:Yt}=Dt;if(Xt.position.set(Kt.x,Kt.y,Kt.z),Yt.isQuaternion===!0?Xt.setRotationFromQuaternion(Yt):Yt.isEuler===!0&&Xt.setRotationFromEuler(Yt),Wt=Xt,!Wt||(Ht=Wt.getObjectByName(zt.name),!Ht))return;let Zt=new Vector3(0,0,0);Ht.getWorldPosition(Zt);let Jt=new Quaternion().identity();Ht.getWorldQuaternion(Jt);let nn=new Object3D;Ht.add(nn);let rn=this.stores.assetStore.getState().assets.items[jt.node.skuID].proxy.data.scene.clone();rn.position.set(Zt.x,Zt.y,Zt.z),rn.applyQuaternion(Jt);let Qt=new Vector3;Qt.copy(Xt.up).applyQuaternion(Wt.quaternion);let en=new Vector3;en.copy(rn.up).applyQuaternion(Jt),en.negate();let tn=new Quaternion().setFromUnitVectors(Qt,en);Qt.round(),en.round();let sn=Qt.dot(en);sn!==1&&sn!==-1&&rn.applyQuaternion(tn);let cn=rn.getObjectByName(jt.name),un=new Quaternion().identity();cn.getWorldQuaternion(un);let hn=new Vector3(0,1,0);hn.applyQuaternion(un);let fn=new Vector3(0,1,0);fn.applyQuaternion(Jt),fn.negate();let pn=new Quaternion().setFromUnitVectors(hn,fn);if(hn.round(),fn.round(),hn.dot(fn)!==-1)rn.applyQuaternion(pn);else{let An=new Vector3(0,1,0),Tn=fn.dot(An);if(Tn!==1&&Tn!==-1)rn.rotateOnAxis(An,Math.PI);else{let Cn=new Vector3(0,0,1),yn=fn.dot(Cn);if(yn!==1&&yn!==-1)rn.rotateOnAxis(Cn,Math.PI);else{let Sn=new Vector3(1,0,0),wn=fn.dot(Sn);wn!==1&&wn!==-1&&rn.rotateOnAxis(Sn,Math.PI)}}}let mn=rn.getObjectByName(jt.name),vn=new Vector3(mn.position.x,mn.position.y,mn.position.z);rn.translateX(-vn.x),rn.translateY(-vn.y),rn.translateZ(-vn.z);let _n=new Vector3(0,0,0);rn.getWorldPosition(_n);let En=new Quaternion().identity();return rn.getWorldQuaternion(En),rn=null,{position:_n,rotation:En}}findItemTransformRoot(_e){let{receiverPlug:Dt,incomingPlug:Vt}=_e,Gt=Vt;const zt=new Object3D;let jt=zt,Ht=new Vector3(0,0,0);jt.getWorldPosition(Ht);let Wt=new Quaternion().identity(),qt=new Object3D;qt.position.set(0,0,0),zt.add(qt);let Xt=this.stores.assetStore.getState().assets.items[Gt.node.skuID].proxy.data.scene.clone();qt.attach(Xt),Xt.translateX(Ht.x),Xt.translateY(Ht.y),Xt.translateZ(Ht.z);let Kt=Xt.getObjectByName(Gt.name),Yt=new Quaternion().identity();Kt&&Kt.getWorldQuaternion(Yt);const Zt=new Vector3(0,1,0);Zt.applyQuaternion(Yt);const Jt=new Vector3(0,1,0);Jt.applyQuaternion(Wt);const nn=Jt.angleTo(Zt),rn=new Vector3(0,0,0);rn.crossVectors(Jt,Zt),rn.round(),rn.length()!==0&&Xt.rotateOnAxis(rn,nn);let Qt=new Matrix4().extractRotation(Xt.matrixWorld),en=new Vector3(0,0,0);Kt&&en.set(Kt.position.x,Kt.position.y,Kt.position.z),en.applyMatrix4(Qt),Xt.translateX(-en.x),Xt.translateY(-en.y),Xt.translateZ(-en.z);let tn=new Vector3(0,0,0);Xt.getWorldPosition(tn);let sn=new Quaternion().identity();return Xt.getWorldQuaternion(sn),qt.remove(Xt),qt=null,Xt=null,{position:tn,rotation:sn}}findItemTransform(_e){let{receiverPlug:Dt,incomingPlug:Vt}=_e,Gt=Dt,zt=Vt;if(Gt.node.isRoot)return this.findItemTransformRoot(_e);const jt=Gt.node.transform;if(!jt)return;const Ht=this.stores.assetStore.getState().assets.items[Gt.node.skuID].proxy.data.scene.clone(),Wt=new Object3D;Wt.position.set(jt.position.x,jt.position.y,jt.position.z),jt.rotation.isQuaternion===!0?Wt.setRotationFromQuaternion(jt.rotation):jt.rotation.isEuler===!0&&Wt.setRotationFromEuler(jt.rotation),Wt.add(Ht);let qt=Wt.getObjectByName(""+Gt.name);if(!qt){LOGGER.error({title:"Plug: "+Gt.name+" doesn't exist in "+Gt.node.skuID});return}let Xt=new Vector3(0,1,0);qt.getWorldPosition(Xt);let Kt=new Quaternion().identity();qt.getWorldQuaternion(Kt);let Yt=this.stores.assetStore.getState().assets.items[zt.node.skuID].proxy.data.scene.clone();Yt.position.set(Xt.x,Xt.y,Xt.z),Yt.applyQuaternion(Kt);let Zt=new Vector3;Zt.copy(Ht.up).applyQuaternion(Wt.quaternion);let Jt=new Vector3;Jt.copy(Yt.up).applyQuaternion(Kt),Jt.negate();let nn=new Quaternion().setFromUnitVectors(Zt,Jt);Zt.round(),Jt.round();let rn=Zt.dot(Jt);rn!==1&&rn!==-1&&Yt.applyQuaternion(nn);let Qt=Yt.getObjectByName(zt.name);if(!Qt){LOGGER.error({title:"Plug: "+zt.name+" doesn't exist in "+zt.node.skuID});return}let en=new Quaternion().identity();Qt.getWorldQuaternion(en);let tn=new Vector3(0,1,0);tn.applyQuaternion(en);let sn=new Vector3(0,1,0);sn.applyQuaternion(Kt),sn.negate();let cn=new Quaternion().setFromUnitVectors(tn,sn);if(tn.round(),sn.round(),tn.dot(sn)!==-1)Yt.applyQuaternion(cn);else{let mn=new Vector3(0,1,0),vn=sn.dot(mn);if(vn!==1&&vn!==-1)Yt.rotateOnAxis(mn,Math.PI);else{let _n=new Vector3(0,0,1),En=sn.dot(_n);if(En!==1&&En!==-1)Yt.rotateOnAxis(_n,Math.PI);else{let An=new Vector3(1,0,0),Tn=sn.dot(An);Tn!==1&&Tn!==-1&&Yt.rotateOnAxis(An,Math.PI)}}}let hn=Yt.getObjectByName(zt.name),fn=new Vector3(hn.position.x,hn.position.y,hn.position.z);Yt.translateX(-fn.x),Yt.translateY(-fn.y),Yt.translateZ(-fn.z);let pn=new Vector3(0,0,0);Yt.getWorldPosition(pn);let dn=new Quaternion().identity();return Yt.getWorldQuaternion(dn),Wt.remove(Ht),Yt=null,{position:pn,rotation:dn}}getSpawningRequirementForSkuID(_e){let Dt=[];const Vt=this.stores.productDataStore.getState().productData,Gt=Vt[_e];if(!Gt)return Dt;const zt=[];return Gt.plugs.map(jt=>{jt.connectsToPlugTypes.map(Ht=>{zt.push(Ht)})}),Object.keys(Vt).map(jt=>{for(let Ht=0;Ht<Vt[jt].plugs.length;Ht++){const Wt=Vt[jt].plugs[Ht].acceptedPlugTypes;for(let qt=0;qt<Wt.length;qt++)zt.map(Xt=>{Xt==Wt[qt]&&!Dt.includes(jt)&&Dt.push(jt)})}}),Dt}getConnectablePlugs(_e,Dt){let Vt=[],Gt=_e.getOpenPlugsWeCanAttachFrom();for(let zt=0;zt<Gt.length;zt++)for(let jt=0;jt<Dt.length;jt++){let Ht=!1;for(let qt=0;qt<Vt.length;qt++)if(Vt[qt].receiverPlug.guid==Dt[jt].guid&&Vt[qt].incomingPlug.type!="comboPlug"){Ht=!0;break}if(Ht)continue;Gt[zt].canAttachToPlug(Dt[jt])&&Vt.push({incomingPlug:Gt[zt],receiverPlug:Dt[jt]})}return Vt}getOpenPlugs(){let _e=[];return this._nodes.map(Dt=>{if(Dt.dragging===!0)return;let Vt=Dt.getOpenPlugsFromNode();_e=_e.concat(Vt)}),_e}checkCollisionForGUID(_e,Dt=[]){if(this.stores.coreSceneStore.getState().sceneSettings.disableCollider)return!1;const Vt=this.stores.itemStore.getState().itemsSpawned,Gt=this.stores.productDataStore.getState().productData;if(!Vt[_e])return!1;const jt=this.getNodeByGUID(_e);if(!jt||!jt.ref||Gt[jt.skuID].disableCollider)return!1;let Ht=new Vector3;jt.ref.getWorldPosition(Ht);let Wt=new Quaternion;jt.ref.getWorldQuaternion(Wt);const qt={position:Ht,rotation:Wt},Xt=jt.whichPlugAreWeAttachedTo();return Xt==null?!1:this.isColliding(jt.skuID,qt,Xt,Dt)}isColliding(_e,{position:Dt,rotation:Vt},Gt,zt=[]){const jt=this.stores.assetStore.getState().assets.items[_e].proxy.data.scene,Ht=this.stores.productDataStore.getState().productData;if(!jt)return!1;let Wt=jt.clone();Wt.position.set(Dt.x,Dt.y,Dt.z),Vt.isQuaternion===!0?Wt.setRotationFromQuaternion(Vt):Vt.isEuler===!0&&Wt.setRotationFromEuler(Vt);let qt=new Box3().setFromObject(Wt),Xt=new Vector3;qt.getCenter(Xt);let Kt=new Object3D;Kt.position.set(Xt.x,Xt.y,Xt.z),Kt.attach(Wt),Kt.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),qt=new Box3().setFromObject(Kt);const Yt=[];if(this._nodes.forEach(Jt=>{if(Gt.node.guid==Jt.guid||Array.isArray(zt)===!0&&zt.includes(Jt.guid)||!Jt.ref||(Ht[Jt.skuID].hasOwnProperty("disableCollider")?Ht[Jt.skuID].disableCollider:this.stores.coreSceneStore.getState().sceneSettings.disableCollider))return;const nn=Jt.ref.getObjectByName("GRP_ProxyMesh");nn&&Yt.push(nn)}),Yt.length<=0)return!1;let Zt=!1;return Yt.forEach(Jt=>{if(Zt)return;let nn=new Box3().setFromObject(Jt);if(qt.intersectsBox(nn)){Zt=!0;return}}),Kt.clear(),Wt=null,Kt=null,qt=null,Zt}boxOverlapPercent(_e,Dt){if(_e.containsBox(Dt)||Dt.containsBox(_e))return 100;if(!(_e.min.x<Dt.max.x||Dt.min.x<_e.max.x))return 0;let Vt=new Vector3(0,0,0);_e.getSize(Vt),Vt.x*Vt.y*Vt.z;let Gt=new Vector3(0,0,0);Dt.getSize(Gt),Gt.x*Gt.y*Gt.z}checkInsideOutCollision(_e,Dt,Vt){let Gt=Dt.position.clone(),zt=new Float32Array(Vt.attributes.position.array),jt=zt.length/3;for(let Ht=0;Ht<jt;Ht++){let Wt=new Vector3(zt[Ht*3],zt[Ht*3+1],zt[Ht*3+2]),qt=Wt.add(Dt.position);qt=Wt.applyQuaternion(Dt.quaternion);let Xt=qt.sub(Dt.position);const Yt=new Raycaster(Gt,Xt.clone().normalize()).intersectObjects(_e),Zt=Yt.length>0,Jt=Yt[0].distance<Xt.length();if(Zt&&Jt)return!0}return!1}addNode(_e){this._nodes.push(_e)}getFirstNodeByCategoryID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt]._categoryID==_e)return this._nodes[Dt];return null}getNodesBySKUID(_e){let Dt=[];for(let Vt=0;Vt<this._nodes.length;Vt++)this._nodes[Vt].skuID==_e&&Dt.push(this._nodes[Vt]);return Dt}getNodesByCategoryID(_e){let Dt=[];for(let Vt=0;Vt<this._nodes.length;Vt++)this._nodes[Vt]._categoryID==_e&&Dt.push(this._nodes[Vt]);return Dt}async connectPlugs({incomingPlug:_e,receiverPlug:Dt}){_e.attachPlug(Dt,!1),Dt.attachPlug(_e,!0),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}removeNodeByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e){this._nodes[Dt].removeNode(),this._nodes.splice(Dt,1);break}this._nodes.length==1&&this.#e&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Scene_Cleared,!0),this.stores.attachmentStore.getState().actions.updateFittingSkuIds(),this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}async removeNodeFromStructure(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e.guid){this._nodes.splice(Dt,1);break}await this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}}class AttachmentSystem{constructor(_e){this._globalVariants={},this._globalGeometryVariants={},this.stores=_e,this.stores.productDataStore.getState().categoryData.geometryVariants.map(Dt=>{this._globalGeometryVariants[Dt.id]=Dt.defaultVariant}),this.stores.productDataStore.getState().categoryData.color.map(Dt=>{this._globalVariants[Dt.id]=Dt.defaultLook}),this._currentStructure=new Structure(this.stores,null,this._globalVariants,this._globalGeometryVariants);for(const[Dt,Vt]of Object.entries(this._globalVariants))this.switchGlobalVariant(Dt,Vt);for(const[Dt,Vt]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(Dt,Vt)}get globalGeometryVariants(){return this._globalGeometryVariants}get globalVariants(){return this._globalVariants}get currentStructure(){return this._currentStructure}getClientProductId(_e,Dt){let Vt;return Vt=this.stores.productDataStore.getState()?.productData[_e]?.lookDetails[Dt],Vt?.clientProductId?Vt?.clientProductId:""}getCartItems(){let _e=[];const Dt=this.stores.inventoryStore.getState().inventoryData;let Vt=!1;this.currentStructure.nodes.map(Ht=>{if(Ht.skuID=="Root"||Ht.ignoreInCart===!0)return;let Wt=!1;if(_e.map(Kt=>{const Yt=Dt[Kt.skuID];if(Kt.skuID==Ht.skuID&&Kt.currentVariant==Ht.currentVariant){Kt.count++,Kt.countAvailable=Yt[Ht.currentVariant].countAvailable,Kt.countUnavailable=Yt[Ht.currentVariant].countUnavailable,Kt.price=Ht.price*Kt.count,Kt.compareAtPrice=Ht.compareAtPrice*Kt.count,Wt=!0;return}}),Wt===!0)return;let qt={};qt.skuID=Ht.skuID,qt.currentVariant=Ht.currentVariant,qt.clientProductId=this.getClientProductId(qt.skuID,qt.currentVariant),qt.count=1;const Xt=Dt[qt.skuID];qt.price=Ht.price,qt.compareAtPrice=Ht.compareAtPrice*qt.count,Ht.compareAtPrice>0&&(Vt=!0),qt.countAvailable=Xt[Ht.currentVariant].countAvailable,qt.countUnavailable=Xt[Ht.currentVariant].countUnavailable,_e.push(qt)});let Gt=0,zt=0;for(const Ht of _e)Gt=Gt+Ht.price,Vt&&(zt=zt+(Ht.compareAtPrice==0?Ht.price:Ht.compareAtPrice));return{cartItems:_e,details:{total:Gt.toFixed(2),compareAtTotal:zt}}}async getCartItemsAsync(){let _e=[];const Dt=this.stores.inventoryStore.getState().inventoryData;let Vt=!1;this.currentStructure.nodes.map(Ht=>{if(Ht.skuID=="Root"||Ht.ignoreInCart===!0)return;let Wt=!1;if(_e.map(Kt=>{const Yt=Dt[Kt.skuID];if(Kt.skuID==Ht.skuID&&Kt.currentVariant==Ht.currentVariant){Kt.count++,Kt.countAvailable=Yt[Ht.currentVariant].countAvailable,Kt.countUnavailable=Yt[Ht.currentVariant].countUnavailable,Kt.price=Ht.price*Kt.count,Kt.compareAtPrice=Ht.compareAtPrice*Kt.count,Wt=!0;return}}),Wt===!0)return;let qt={};qt.skuID=Ht.skuID,qt.currentVariant=Ht.currentVariant,qt.clientProductId=this.getClientProductId(qt.skuID,qt.currentVariant),qt.count=1;const Xt=Dt[qt.skuID];qt.price=Ht.price,qt.compareAtPrice=Ht.compareAtPrice*qt.count,qt.compareAtPrice>0&&(Vt=!0),qt.countAvailable=Xt[Ht.currentVariant].countAvailable,qt.countUnavailable=Xt[Ht.currentVariant].countUnavailable,_e.push(qt)}),_e=await this.stores.dynamicHookStore.getState().hookOnCartItemsCollected(_e,this.stores.coreSceneStore.getState().CORE_API);let Gt=0,zt=0;for(const Ht of _e)Gt=Gt+Ht.price,Vt&&(zt=zt+(Ht.compareAtPrice==0?Ht.price:Ht.compareAtPrice));return{cartItems:_e,details:{total:Gt.toFixed(2),compareAtTotal:zt.toFixed(2)}}}async getFittingSKUIDs(){if(!this.currentStructure)return[];const{productData:_e}=this.stores.productDataStore.getState(),{sceneSettings:Dt}=this.stores.coreSceneStore.getState(),{draggableUI:Vt,ignoreSpawningCollision:Gt}=Dt;if(!this.currentStructure)return[];const{openPlugTypes:zt,closedPlugTypes:jt,existingSkuids:Ht}=this.analyzeCurrentStructure();if(zt.size===0&&jt.size===0)return[];const Wt=this.findFittingSkuids(_e,zt,jt,Ht,Vt);return this.filterNonBlockedSkuids(Wt,_e,Gt)}analyzeCurrentStructure(){const _e=this.currentStructure.nodes,Dt=new Set,Vt=new Set,Gt=new Set;for(const zt of _e){Gt.add(zt.skuID);for(const jt of zt.plugs)jt.isOpen?jt.acceptedPlugTypes.forEach(Ht=>Dt.add(Ht)):jt.attachedPlug.node.replace&&jt.acceptedPlugTypes.forEach(Ht=>Vt.add(Ht))}return{openPlugTypes:Dt,closedPlugTypes:Vt,existingSkuids:Gt}}findFittingSkuids(_e,Dt,Vt,Gt,zt){const jt=new Set;for(const[Ht,Wt]of Object.entries(_e))if(Wt.plugs)for(const qt of Wt.plugs){for(const Xt of qt.connectsToPlugTypes)if((this.isClosedPlugFitting(Ht,Wt,Xt,Vt,Gt,zt)||this.isOpenPlugFitting(Wt,Xt,Dt))&&jt.add(Ht),jt.has(Ht))break;if(jt.has(Ht))break}return jt}isClosedPlugFitting(_e,Dt,Vt,Gt,zt,jt){if(!Gt.has(Vt)||!jt&&zt.has(_e))return!1;const Ht=this.currentStructure.getNodesByCategoryID(Dt.categoryID);for(const Wt of Ht)if(Wt.skuID!==_e&&this.isNodeCompatible(Wt,Dt))return!0;return!1}isNodeCompatible(_e,Dt){let Vt=!1;for(const Gt of _e.plugs)if(!Gt.isOpen&&Gt.isReceiverPlug&&(Vt=!0,this.isPlugCompatible(Gt,Dt.plugs)))return!0;return!Vt}isPlugCompatible(_e,Dt){return Dt.some(Vt=>Vt.name===_e.name&&_e.attachedPlug.connectsToPlugTypes.some(Gt=>Vt.acceptedPlugTypes.includes(Gt)))}isOpenPlugFitting(_e,Dt,Vt){if(!Vt.has(Dt))return!1;const Gt=this.currentStructure.getFirstNodeByCategoryID(_e.categoryID);return!Gt||!Gt.replace}async filterNonBlockedSkuids(_e,Dt,Vt){const Gt=[];for(const zt of _e)if(Dt[zt].replace)Gt.push(zt);else{const jt=await this.currentStructure.findGhostTransforms(zt,Vt);jt&&jt.transforms.length>0&&Gt.push(zt)}return Gt}async removeAllVariantOverrides(){let _e=this._currentStructure.nodes,Dt=this.stores.productDataStore.getState().productData,Vt=this.stores.itemStore.getState().itemsSpawned;return await _e.map(async Gt=>{if(!Gt.overrideVariant||(Gt.overrideVariant=null,!Dt[Gt.skuID].looks))return;let zt=null;Object.keys(this._globalVariants).map(jt=>{Dt[Gt.skuID].looks.includes(this._globalVariants[jt])&&zt==null&&(zt=this._globalVariants[jt])}),zt&&await this.stores.itemStore.getState().actions.switchToVariant(Vt[Gt.guid].itemData,zt)}),this.stores.coreSceneStore.getState().CORE_API.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!1),!0}async switchGlobalGeometryVariant(_e,Dt){const Gt=this.stores.productDataStore.getState().categoryData.geometryVariants;let zt=null;if(Gt.map(Yt=>{Yt.id==_e&&(zt=Yt)}),!zt)return;const jt=zt.productsInCategory,Wt=zt.variants[Dt].productsToSwitch,qt=this.stores.itemStore.getState().itemsSpawned;let Xt=this.stores.productDataStore.getState().categoryData;Wt.map(Yt=>{jt.map(Zt=>{let Jt=!1;Zt.products.map(nn=>{Yt==nn&&(Jt=!0)}),Jt&&Xt.build.map(nn=>{Zt.products.map(rn=>{nn.skus.map((Qt,en)=>{nn.skus[en]==rn&&(nn.skus[en]=Yt)})})})})}),this._currentStructure.nodes.map(Yt=>{jt.map(Zt=>{Zt.products.map(Jt=>{Yt.skuID==Jt&&Yt.ref!==null&&Zt.products.map(nn=>{Wt.map(rn=>{if(rn==nn){const Qt=this.stores.productDataStore.getState().actions.getProductDataById(rn);let en=Qt.geometriesToHide;Yt.plugs.map(sn=>{!sn.isOpen&&sn.attachedPlug&&sn.type=="weighted_hider"&&sn.attachedPlug.weight>sn.weight&&(en=en.concat(sn.affectedNodes))}),Yt.showNodes(Qt.geometriesToShow),Yt.hideNodes(en),Yt.skuID=rn;const tn=qt[Yt.guid];tn&&tn.itemData&&Object.keys(Qt).map(sn=>{tn.itemData[sn]=Qt[sn]}),Yt.resetInStock(),Yt.updatePricing()}})})})})}),this._globalGeometryVariants[_e]=Dt,this.stores.hotspotStore.getState().actions.checkHotspotHealth(),this.stores.inventoryStore.getState().actions.refreshInventory(qt),this.stores.productDataStore.setState({categoryData:Xt}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CategoryData_Updated,Xt),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const Kt=await this.getCartItemsAsync();Kt&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Kt)}async switchGlobalVariant(_e,Dt){this._globalVariants[_e]=Dt;const Vt=this.stores.itemStore.getState().actions;let Gt=this.stores.itemStore.getState().itemsSpawned;for(let Wt=0;Wt<Object.keys(Gt).length;Wt++){let qt=Gt[Object.keys(Gt)[Wt]];if(qt.itemData.looks&&qt.itemData.looks.includes(Dt)){let Xt=this._currentStructure.getNodeByGUID(qt.itemData.guid);Xt&&!Xt.overrideVariant&&await Vt.switchToVariant(qt.itemData,Dt)}}const zt=this.stores.productDataStore.getState().lookData;this.stores.lightStore.getState().actions.processLookEnvMapOverride(Dt);const jt=_e;Object.keys(Gt).length>0&&this.stores.coreSceneStore.getState().CORE_API.alert({alertMsg:jt.charAt(0).toUpperCase()+jt.slice(1)+" was successfully switched to "+zt[Dt].label+".",alertTime:3e3,alertType:"success",alertLabel:`${jt} Changed`,alertId:"materialVariantChanged"}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),this.stores.itemStore.setState({variantChangeAlert:!this.stores.itemStore.getState().variantChangeAlert});const Ht=await this.getCartItemsAsync();Ht&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Ht)}async#e(_e){if(!_e)return;LOGGER.info({title:"Structure to load",details:_e}),delete this._currentStructure,this._globalVariants={..._e.globalVariants},this._globalGeometryVariants=_e.globalGeometryVariants?{..._e.globalGeometryVariants}:{};const Dt=[..._e.structure];this._currentStructure=new Structure(this.stores,Dt,this._globalVariants,this._globalGeometryVariants);for(const[Vt,Gt]of Object.entries(this._globalVariants))this.switchGlobalVariant(Vt,Gt);for(const[Vt,Gt]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(Vt,Gt);LOGGER.info({title:"Structure Loading..."}),await this._currentStructure.load(Dt),LOGGER.info({title:"Structure Loaded."})}async loadStructure(_e){if(!_e)return;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),this.stores.coreSceneStore.setState({configurationLoaded:!1}),await wait(500),await this._currentStructure.clear(),await this.#e(_e),this.stores.coreSceneStore.getState().preconfigurationLoaded?this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide):this.stores.coreSceneStore.setState({preconfigurationLoaded:!0}),this.stores.coreSceneStore.getState().configurationLoadedOnRestart||this.stores.coreSceneStore.setState({configurationLoadedOnRestart:!0}),this.stores.coreSceneStore.setState({configurationLoaded:!0}),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated();const Dt=this.stores.itemStore.getState().itemsSpawned;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Dt}),this.stores.inventoryStore.getState().actions.refreshInventory(Dt),await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}export(){return{experienceId:this.stores.coreSceneStore.getState().CORE_API.experienceId,structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),await this._currentStructure.clear(),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide)}async restart(){LOGGER.warn({title:"Restarting the Scene!!"}),this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem();const _e=this.stores.attachmentStore.getState().defaultConfig;this.stores.coreSceneStore.setState({configurationLoaded:!1,configurationLoadedOnRestart:!1}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),await wait(500),await this._currentStructure.clear(),await this.#e(_e),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated(),this.stores.coreSceneStore.setState({configurationLoaded:!0,configurationLoadedOnRestart:!0}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide);const Dt=this.stores.itemStore.getState().itemsSpawned;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Dt}),this.stores.inventoryStore.getState().actions.refreshInventory(Dt),await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}}const createAttachmentStore=kt=>{const _e=attachmentStoreCreator();return _e.setState({stores:kt}),_e},attachmentStoreCreator=()=>create((kt,_e)=>({stores:null,attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async Dt=>{const{actions:Vt,defaultConfig:Gt}=_e();LOGGER.info({title:"Initializing Attachment System!"});const zt=await new AttachmentSystem(Dt);kt({attachmentSystem:zt}),await Vt.updateFittingSkuIds(),await Vt.toggleStructureUpdated()},loadSavedStructureFromConfigID:async Dt=>{const{stores:Vt}=_e();LOGGER.info({title:"Fetching Structure Using ConfigID!"});let Gt="";Dt.length==20&&(Gt=FETCH_CONFIG_ENDPOINT_FB+Dt);let zt=null;return Gt!=""?zt=await getJSONFromEndpoint(Gt):zt=await Vt.nexusApiInstance.getExperienceSaveAndShare(Vt.experienceId,Dt),zt.success===!1?null:Dt.length==20?zt.data:zt.payload.save_data},loadDefaultStructure:async()=>{const{actions:Dt,defaultConfig:Vt}=_e();LOGGER.info({title:"Loading Default Structure!"}),await Dt.loadStructure(Vt)},updateFittingSkuIds:async()=>{const{stores:Dt,attachmentSystem:Vt}=_e();if(!Dt.coreSceneStore.getState().preconfigurationLoaded||!Dt.coreSceneStore.getState().configurationLoaded)return;const Gt=await Vt.getFittingSKUIDs();Gt&&(Dt.itemStore.setState({fittingSkuIds:[...Gt]}),Dt.coreSceneStore.getState().CORE_API.fireEvent(Dt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:Gt}))},toggleStructureUpdated:async()=>{const{attachmentSystem:Dt,stores:Vt}=_e();if(kt(zt=>({structureUpdated:!zt.structureUpdated})),!Vt.coreSceneStore.getState().preconfigurationLoaded||!Vt.coreSceneStore.getState().configurationLoaded)return;Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,Dt.currentStructure.getCurrentItemsInReplaceableCategory());const Gt=await Dt.getCartItemsAsync();Gt&&Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Gt)},loadStructure:async Dt=>{const{attachmentSystem:Vt,stores:Gt}=_e();LOGGER.info({title:"Loading Structure!"}),Vt&&Gt.coreSceneStore.getState().configurationLoaded!==!1&&await Vt.loadStructure(Dt)},export:()=>{const{attachmentSystem:Dt}=_e();if(Dt)return Dt.export()}}})),createInfoStore=kt=>{const _e=infoStoreCreator();return _e.setState({stores:kt}),_e},infoStoreCreator=()=>create((kt,_e)=>({stores:null,infoObject:{},populateInfoObject:Dt=>{kt(Vt=>({infoObject:Dt}))},infoModalOpen:!1,updateInfoModalOpen:Dt=>{kt(Vt=>({infoModalOpen:Dt}))}})),createUIHotspotStore=kt=>{const _e=uiHotspotStoreCreator();return _e.setState({stores:kt}),_e},uiHotspotStoreCreator=()=>create((kt,_e)=>({stores:null,activeHotspotData:null,activeFeatureID:"",actions:{enterHotspotInFeaturesTab(Vt){const{stores:Gt}=_e();Gt.uiSceneStore.getState().sideMenuState!==2&&Gt.uiSceneStore.setState({sideMenuState:2}),kt({activeFeatureID:Vt})},exitHotspot(){kt({activeFeatureID:null})}}})),createColorStore=kt=>{const _e=colorStoreCreator();return _e.setState({stores:kt}),_e},colorStoreCreator=()=>create((kt,_e)=>({stores:null,allActiveVariants:{},allActiveGeometryVariants:{}})),arrayWithoutElementAtIndex=function(kt,_e){return kt.filter(function(Dt,Vt){return _e!==Vt})},updateQuantityAtIndex=function(kt,_e,Dt){let Vt=kt.slice();return Vt[_e].quantity=Dt,Vt},createCartStore=kt=>{const _e=cartStoreCreator();return _e.setState({stores:kt}),_e},cartStoreCreator=()=>create((kt,_e)=>({stores:null,cart:[],cartTotalPrice:0,cartTotalCompareAtPrice:0,deleteCartItem:Dt=>{kt(Vt=>({cart:arrayWithoutElementAtIndex(Vt.cart,Dt)}))},addToCart:Dt=>{kt(Vt=>({cart:[...Vt.cart,Dt]}))},updateQuantity:(Dt,Vt)=>{kt(Gt=>({cart:updateQuantityAtIndex(Gt.cart,Dt,Vt)}))},previewCartModalOpen:!1,togglePreviewCartModal:()=>{const{previewCartModalOpen:Dt,stores:Vt}=_e();Dt===!0?Vt.uiSceneStore.getState().CORE_API.reviewCartHidden():Vt.uiSceneStore.getState().CORE_API.reviewCartShown(),kt({previewCartModalOpen:!Dt})},actions:{setCartTotalPrice:(Dt,Vt)=>{kt(()=>({cartTotalPrice:Dt,cartTotalCompareAtPrice:Vt}))}}})),createLightStore=kt=>{const _e=lightStoreCreator();return _e.setState({stores:kt}),_e},lightStoreCreator=()=>create((kt,_e)=>({stores:null,defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:Dt=>{kt(Vt=>({envMapUrl:Dt}))},processLookEnvMapOverride:Dt=>{const{envMapUrl:Vt,defaultEnvMapUrl:Gt,actions:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().lookData[Dt],Wt=Ht?.envMapOverride;if(!Ht||!Wt){zt.setEnvLightMap(Gt);return}if(Wt===Vt){LOGGER.info({title:`New Env Map Url is the same as the current ${Wt}`});return}zt.setEnvLightMap(Wt)}}})),createHotspotStore=kt=>{const _e=hotspotStoreCreator();return _e.setState({stores:kt}),_e},hotspotStoreCreator=()=>create((kt,_e)=>({stores:null,activeHotspotData:null,lastActiveHotspotData:null,isAnyHotspotActive:!1,hotspotsVisibility:!1,hotspotsTempVisibility:!0,hotspotsHealthCheck:!0,hotspotsSpawned:{},visitedHotspotsID:[],hotspotSpawnedForCategoryIDs:[],actions:{clearAllHotspots:()=>kt({isAnyHotspotActive:!1,activeHotspotData:null,lastActiveHotspotData:null,hotspotsSpawned:{}}),removeHotspotForItem(Dt){const{hotspotsSpawned:Vt}=_e();Object.keys(Vt).map(Gt=>{Vt[Gt].itemData.guid==Dt.itemData.guid&&delete Vt[Gt]}),kt({hotspotsSpawned:{...Vt}})},checkHotspotHealth(){const{hotspotsHealthCheck:Dt}=_e();kt({hotspotsHealthCheck:!Dt})},toggleHotspotVisibility(){const{hotspotsVisibility:Dt}=_e();kt({hotspotsVisibility:!Dt})},switchHotspotsVisibility(Dt,Vt=!1){kt(Vt===!0?{hotspotsTempVisibility:Dt}:{hotspotsVisibility:Dt})},clickHotspot(Dt,Vt,Gt,zt=!1){const{activeHotspotData:jt,stores:Ht}=_e();kt({lastActiveHotspotData:jt}),hotspotEnter(Ht,Dt,Vt,Gt);let qt=Ht.itemStore.getState().itemsSpawned[Gt].itemData.skuID;zt===!1&&(Ht.coreSceneStore.getState().CORE_API.fireEvent(Ht.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Hotspot_Enter,{hotspotAbsID:generateHotspotAbsoluteID(qt,Dt),hotspot:jt}),Ht.coreSceneStore.getState().CORE_API.fireEvent(Ht.coreSceneStore.getState().CORE_API.EVENTS.UI.UtilityMenu_Hide))},exitHotspot(Dt=!1){const{activeHotspotData:Vt,isAnyHotspotActive:Gt,stores:zt}=_e();if(Gt&&kt({isAnyHotspotActive:!1}),!!Vt&&(kt({lastActiveHotspotData:Vt}),hotspotExit(zt),Dt===!1)){const jt=Math.round((performance.now()-_e().lastActiveHotspotData.hotspotEnterTime)/1e3);zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Hotspot_Exit,{hotspot:_e().lastActiveHotspotData,hotspotTimeSpent:jt}),zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.UI.UtilityMenu_Show)}}}}));function hotspotExit(kt){kt.hotspotStore.setState({activeHotspotData:null}),kt.coreSceneStore.getState().actions.triggerAutoFocus()}function hotspotEnter(kt,_e,Dt,Vt){let Gt=kt.hotspotStore.getState();const jt=kt.itemStore.getState().itemsSpawned;let Ht=Gt.visitedHotspotsID;const Wt=jt[Vt].hotspotsData.filter(un=>un.hotspotID==_e);if(!Wt||Wt.length<=0)return;const qt=Wt[0],Xt=jt[Vt].itemData.skuID+"_"+_e;let Yt=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Vt),Zt=new Vector3(0,0,0);Yt&&Yt.ref&&Yt.ref.getWorldPosition(Zt);let Jt=new Quaternion().identity();Yt&&Yt.ref&&Yt.ref.getWorldQuaternion(Jt);let nn=qt.focusPointTransform,rn=ArrToVec3(nn);rn.applyQuaternion(Jt);let Qt=qt.viewPointTransform,en=ArrToVec3(Qt);en.applyQuaternion(Jt);let tn=addVector(Vec3ToArr(rn),Vec3ToArr(Zt)),sn=addVector(Vec3ToArr(en),Vec3ToArr(Zt));kt.cameraStore.setState({focusPointPosition:tn,viewPointPosition:sn}),kt.hotspotStore.setState({activeHotspotData:{hotspotData:{guid:Dt,...qt},itemData:{...jt[Vt],guid:Vt},domID:"rd_"+Xt,hotspotEnterTime:performance.now()},isAnyHotspotActive:!0}),Ht.includes(Xt)||(Ht.push(Xt),kt.hotspotStore.setState({visitedIDs:{...Ht}}))}var replacingNodes=null,swappableNodes=[];const createGhostStore=kt=>{const _e=ghostStoreCreator();return _e.setState({stores:kt}),_e},ghostStoreCreator=()=>create((kt,_e)=>({stores:null,ghostData:null,ghostsTransform:[],ghostVisibility:!0,ghostParentRef:null,ghostMaterial:null,actions:{spawnGhostsForSkuID:async(Dt,Vt=!1,Gt)=>{const{ghostData:zt,ghostsTransform:jt,stores:Ht}=_e();if(zt!==null||jt.length>0){LOGGER.info({title:"ghosts are already spawned for: "+zt.skuID});return}return await new Promise(async(qt,Xt)=>{let Kt={};const Yt=()=>{qt(Kt)};Ht.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Ht.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Ghost_Loaded,Yt,{once:!0});const Zt=Ht.productDataStore.getState().productData,Jt=Ht.attachmentStore.getState().attachmentSystem.currentStructure;replacingNodes=Jt.getNodesByCategoryID(Zt[Dt].categoryID);const nn=Ht.coreSceneStore.getState().sceneSettings.draggableUI,rn=await Jt.findGhostTransforms(Dt,Vt),Qt=nn?rn&&rn.transforms&&rn.transforms.length===0:!0;if(Zt[Dt].replace&&replacingNodes.length>0&&Qt)if(nn){const{newNodes:tn,transforms:sn,connectablePlugs:cn}=await Jt.findGhostTransformForReplacement(Dt,replacingNodes);if(sn==null||cn==null||sn.length<=0){LOGGER.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+Dt});return}let un=[];for(const hn of tn)hn.setModelVisibility(!1),un.push("replace");Kt.transforms=sn,Kt.newNodes=tn,Kt.connectablePlugs=cn,Kt.addItemOrSwap=un}else{const{newNodes:tn,transforms:sn,connectablePlugs:cn}=await Jt.findGhostTransformForReplacement(Dt,replacingNodes);if(sn==null&&cn==null){LOGGER.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+Dt});return}let un=[];for(const hn of tn)hn.setModelVisibility(!1),un.push("replace");Kt.transforms=sn,Kt.newNodes=tn,Kt.connectablePlugs=cn,Kt.addItemOrSwap=un}else{const{transforms:tn,newNodes:sn,connectablePlugs:cn,comboPlugs:un}=rn;let hn=tn,fn=cn,pn=sn,dn=[];for(let mn=0;mn<tn.length;mn++)dn.push("add");if(Zt[Dt].swappable&&!Ht.coreSceneStore.getState().dragging){swappableNodes=Jt.getNodesByCategoryID(Zt[Dt].categoryID);const mn=await Jt.findGhostTransformForReplacement(Dt,swappableNodes);if(mn.transforms)for(let vn=0;vn<mn.transforms.length;vn++)hn.push(mn.transforms[vn]),fn.push(mn.connectablePlugs[vn]),pn.push(mn.newNodes[vn]),dn.push("replace"),mn.newNodes[vn].setModelVisibility(!1)}Kt.transforms=hn,Kt.newNodes=pn,Kt.connectablePlugs=fn,Kt.comboPlugs=un,Kt.addItemOrSwap=dn}if(Kt.transforms.length<=0){Xt();return}const en=await Ht.assetStore.getState().actions.loadProxyAsset(Dt,!0);kt({ghostsTransform:Kt.transforms,ghostData:{proxyScene:en.proxy.data.scene,skuID:Dt,newNodes:Kt.newNodes,addItemOrSwap:Kt.addItemOrSwap,connectablePlugs:Kt.connectablePlugs,comboPlugs:Kt.comboPlugs,count:Gt||Kt.transforms.length}})})},clearAllGhosts:()=>{const{ghostsTransform:Dt}=_e();if(replacingNodes)for(const Vt of replacingNodes)Vt.setModelVisibility(!0);if(swappableNodes)for(let Vt=0;Vt<swappableNodes.length;Vt++)swappableNodes[Vt].setModelVisibility(!0);Dt.length<=0||kt({ghostVisibility:!0,ghostData:null,ghostsTransform:[]})}}})),createCameraStore=kt=>{const _e=cameraStoreCreator();return _e.setState({stores:kt}),_e},cameraStoreCreator=()=>create((kt,_e)=>({stores:null,focusPointPosition:new Vector3(0,0,0),sendCameraDetailsTrigger:!1,viewPointPosition:new Vector3(0,0,0),boundsMargin:0,savedState:!1,resetToLastPosition:!0,cameraControlsRef:null,userDragging:!1,disableAutoRotate:!1,cameraSettings:{truckSpeed:1,fov:35,dollySpeed:1,initialViewPointPosition:new Vector3(20,15,50),canZoom:!1,canPan:!1,minZoom:1,maxZoom:3,canAutoRotate:!1,autoRotateSpeed:.5,minPolarAngle:0,maxPolarAngle:180,clearColour:"white",zoomingMultiplier:0},actions:{canCameraRotate:Dt=>{const{cameraControlsRef:Vt}=_e();Vt&&(Dt===!0?(Vt.mouseButtons.left=CAMERA_ACTION.ROTATE,Vt.touches.one=CAMERA_ACTION.TOUCH_ROTATE):(Vt.mouseButtons.left=CAMERA_ACTION.NONE,Vt.touches.one=CAMERA_ACTION.NONE))},triggerFetchingCamera:()=>{kt(Dt=>({sendCameraDetailsTrigger:!Dt.sendCameraDetailsTrigger}))},setCameraSettings:Dt=>{const{cameraSettings:Vt,stores:Gt}=_e();Gt.coreSceneStore.getState().isMobile===!0&&Dt.zoomingMultiplier_mobile!==void 0?Dt.zoomingMultiplier=Dt.zoomingMultiplier_mobile:Dt.zoomingMultiplier_desktop!==void 0&&(Dt.zoomingMultiplier=Dt.zoomingMultiplier_desktop),Object.keys(Dt).map(jt=>Vt[jt]=Dt[jt]),kt({cameraSettings:{...Vt},viewPointPosition:ArrToVec3(Vt.initialViewPointPosition)})}}})),createUISceneStore=kt=>{const _e=uiSceneStoreCreator();return _e.setState({stores:kt}),_e},uiSceneStoreCreator=()=>create((kt,_e)=>({stores:null,CORE_API:null,sideMenuState:0,cssLoaded:!1,isScreenPortrait:!0,materialOverrideExists:!1,tabSpawnCount:[],coreWCRef:null,removeModalOpen:!1,outOfStockModalOpen:!1,disableCart:!1,inventoryData:{},cartMessage:"",loadConfigId:"",dialogPopupOpen:!1,viewInYourSpaceMenuBtnVisible:!1,loadConfigModalOpen:!1,setLoadConfigModalOpen:Dt=>kt({loadConfigModalOpen:Dt}),setOutOfStockModalOpen:Dt=>kt({outOfStockModalOpen:Dt}),setRemoveModalOpen:Dt=>kt({removeModalOpen:Dt}),moveModalOpen:!1,setMoveModalOpen:Dt=>kt({moveModalOpen:Dt}),setCSSLoaded:Dt=>{kt({cssLoaded:Dt})},setSideMenuState:Dt=>{kt(()=>({sideMenuState:Dt}));const{CORE_API:Vt}=_e();Dt!==2?Vt.exitHotspot():Vt.showAllHotspots()}})),createDynamicHookStore=kt=>{const _e=dynamicHookStoreCreator();return _e.setState({stores:kt}),_e},dynamicHookStoreCreator=()=>create((kt,_e)=>({hookOnCartItemsCollected:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnCartItemsCollected"}),Promise.resolve(Dt)),hookOnSceneItemsUpdated:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnSceneItemsUpdated"}),Promise.resolve()),hookOnNewItemGhostsCollected:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnNewItemGhostsCollected"}),Promise.resolve(Dt)),hookOnNewItemGhostsCollectedForReplacement:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnNewItemGhostsCollected"}),Promise.resolve(Dt)),hookOnSceneItemAdded:async(Dt,Vt,Gt)=>(LOGGER.info({title:"No hook provided: hookOnSceneItemAdded"}),Promise.resolve()),hookOnCheckout:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnSceneItemAdded"}),Promise.resolve(Dt))}));class STORES{experienceId="";uuid=null;wcRef=null;nexusApiResponseEnvironment="production";nexusApiInstance=null;productDataStore=null;coreSceneStore=null;inventoryStore=null;itemStore=null;assetStore=null;attachmentStore=null;lightStore=null;hotspotStore=null;ghostStore=null;cameraStore=null;infoStore=null;uiHotspotStore=null;colorStore=null;cartStore=null;uiSceneStore=null;constructor(_e){this.wcRef=_e,this.uuid=v4(),this.dynamicHookStore=createDynamicHookStore(this),this.productDataStore=createProductDataStore(this),this.coreSceneStore=createCoreSceneStore(this),this.inventoryStore=createInventoryStore(this),this.itemStore=createItemStore(this),this.assetStore=createAssetStore(this),this.attachmentStore=createAttachmentStore(this),this.lightStore=createLightStore(this),this.hotspotStore=createHotspotStore(this),this.ghostStore=createGhostStore(this),this.cameraStore=createCameraStore(this),this.infoStore=createInfoStore(this),this.uiHotspotStore=createUIHotspotStore(this),this.colorStore=createColorStore(this),this.cartStore=createCartStore(this),this.uiSceneStore=createUISceneStore(this)}setupNexusApiInstance(_e){let Dt=p$5.PRODUCTION;_e=="local"?Dt=p$5.LOCAL:_e==="staging"&&(Dt=p$5.STAGING);const Vt=window.location.href,Gt=window.epigraph?window.epigraph.epigraphSessionId:"no-session-id",zt="2.1.0-alpha",jt=g$3.generateXPath(this.wcRef);this.nexusApiInstance=new P$2(Dt,Vt,Gt,zt,jt)}}class EpigraphConfigurator extends h$5{#e=void 0;#t=null;#r=null;clientAccessKey=null;validationPassed=!1;projectID="";configID="default";customVersionId="";experienceId="";apiMode="production";gaMeasurementId="";#i=getUrlParameterByName("launchInAR")==="true";#n=!1;api={core:null,ui:null};stores=null;constructor(){let _e=s$2.PRODUCTION;super("2.1.0-alpha",_e),this.stores=new STORES(this),this.api.ui=this,this.shadowRoot||this.attachShadow({mode:"open"}),this.hasAttribute("launch-in-ar")&&(this.#i=!0),this.#o(),this.#a()}#o(){this.preloadDiv=document.createElement("div"),this.preloadDiv.id="preloadMainContainer",this.preloadDiv.classList.add("preload-main-container"),this.preloadDiv.classList.add("showPreload"),this.preloadDiv.appendChild(PRELOAD_MUTED_CSS.content.cloneNode(!0)),this.preloadDiv.appendChild(PRELOAD_HTML_TEMPLATE.content.cloneNode(!0)),this.shadowRoot.appendChild(this.preloadDiv);const _e=this.shadowRoot;this.#r=Dt=>{if(Dt.code=="Enter"){let Vt=_e.activeElement;Vt&&Vt.click()}if(this.stores?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics){const Vt=new D$2(Dt.code);this.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(Vt)}},this.shadowRoot.addEventListener("keyup",this.#r)}#a(){this.hiccupUi=document.createElement("div"),this.hiccupUi.id="hiccupMainContainer",this.hiccupUi.classList.add("hiccup-ui-main-container"),this.hiccupUi.appendChild(HICCUP_MUTED_CSS.content.cloneNode(!0)),this.hiccupUi.appendChild(HICCUP_HTML_TEMPLATE.content.cloneNode(!0)),this.shadowRoot.appendChild(this.hiccupUi)}get configuratorWcId(){return this.#e}get launchInAr(){return this.#i}#s(){if(this.hasAttribute("id")?this.#e=this.getAttribute("id"):(this.setAttribute("id","epigraphConfiguratorWc"),this.#e=this.getAttribute("id")),this.hasAttribute("custom-version-id")&&(this.customVersionId=this.getAttribute("custom-version-id")),this.hasAttribute("experience-id")&&(this.experienceId=this.getAttribute("experience-id")),this.hasAttribute("api-mode")){const _e=this.getAttribute("api-mode");["local","staging","production"].includes(_e)&&(this.apiMode=_e)}this.stores.setupNexusApiInstance(this.apiMode),(this.hasAttribute("ga-measurement-id")||this.hasAttribute("ga-code"))&&(this.gaMeasurementId=this.getAttribute("ga-measurement-id")??this.getAttribute("ga-code")),this.clientAccessKey=this.getAttribute("client-access-key"),this.initialConfigId=this.getAttribute("initial-config-id"),this.consentPlugin=this.getAttribute("consent-plugin"),this.consentIdentifier=this.getAttribute("consent-identifier"),this.initialConfigId||(this.initialConfigId="default")}async connectedCallback(){if(this.#n===!0){console.warn("Tried to remount configurator. Blocking the process.");return}this.#s(),this.style.maxWidth="1440px",this.style.maxHeight="800px",this.style.overflow="hidden",this.style.width="100%",this.style.height="100%",this.style.position="relative",this.style.visibility="visible",this.style.display="flex";const _e=document.createElement("div");_e.id="configuratorContainer",_e.style.width="100%",_e.style.height="100%",_e.style.userSelect="none",_e.style.overflow="hidden",this.shadowRoot.appendChild(_e),this.#t=createRoot(_e),this.#t.render(jsxRuntimeExports.jsx(App,{stores:this.stores,customVersionId:this.customVersionId,experienceId:this.experienceId,disableUI:this.hasAttribute("disable-ui"),disableCart:this.hasAttribute("disable-cart"),configuratorWcRef:this,gaMeasurementId:this.gaMeasurementId},"Configurator-App")),this.#n=!0}disconnectedCallback(){for(this.#t&&(this.#t.unmount(),this.#t=null),this.#r&&(this.shadowRoot.removeEventListener("keyup",this.#r),this.#r=null),this.#e=void 0,this.clientAccessKey=null,this.validationPassed=!1,this.projectID="",this.configID="default",this.customVersionId="",this.gaMeasurementId="",this.#i=!1,this.#n=!1,this.api={core:null,ui:null},this.preloadDiv&&(this.preloadDiv.remove(),this.preloadDiv=null),this.hiccupUi&&(this.hiccupUi.remove(),this.hiccupUi=null);this.shadowRoot.firstChild;)this.shadowRoot.removeChild(this.shadowRoot.firstChild)}showPreloadScreen(){this.preloadDiv&&(this.preloadDiv.classList.remove("no-pointer-events"),this.preloadDiv.classList.add("showPreload"))}async hidePreloadScreen(){this.preloadDiv&&(this.preloadDiv.classList.remove("showPreload"),await wait(1e3),this.preloadDiv.classList.add("no-pointer-events"))}showHiccupScreen(){this.hiccupUi&&(this.hiccupUi.classList.remove("no-pointer-events"),this.hiccupUi.classList.add("show-hiccup"))}async hideHiccupScreen(){this.hiccupUi&&(this.hiccupUi.classList.remove("show-hiccup"),await wait(1e3),this.hiccupUi.classList.add("no-pointer-events"))}}window.customElements.define("epigraph-configurator",EpigraphConfigurator);
|
|
4796
|
+
`;const createCoreSceneStore=kt=>{const _e=coreStoreCreator();return _e.setState({stores:kt}),_e},coreStoreCreator=()=>create((kt,_e)=>({stores:null,shadowRefreshKey:0,CORE_API:null,coreReady:void 0,frameloop:"always",hoveredGhostIndex:-1,itemDraggedSkuID:null,screenshotRenderer:new WebGLRenderer({antiAlias:!0,preserveDrawingBuffer:!0}),screenshotCamera:new PerspectiveCamera(75,1.33,.1,1e3),builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!1,sceneHasDefaultConfigurationID:!1,configurationLoaded:!0,preconfigurationLoaded:!1,configurationLoadedOnRestart:!0,cursorParentRef:null,glContext:null,canvasTooltipText:"",canvasSize:{width:600,height:600},boundData:{center:new Vector3(0,0,0),size:new Vector3(0,0,0)},showDimensions:!1,autoFocusTrigger:0,cameraActive:!1,autoFocusRef:null,alertData:{},persistantAlertData:null,alertQueue:[],currentAlertData:null,alertSettings:null,draggingOnDropCollisionData:null,multipleTouchDetected:!1,isMobile:!1,isTouchDevice:!1,isTablet:!1,isDesktop:!0,isLandscape:!1,sceneSettings:{usdzMaxTextureSize:1024,usdzPrecision:7,swappableRoot:!0,ghostColorOnHoverWithDraggableUi:{r:153,g:252,b:0,a:1},preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,showInstructionsBtn:!1,showInstructionsOnStartup:!1,sceneScaleUnit:"ft",arPlacement:"floor",arTransforms:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},currency:"$",disableDragDrop:!1,ignoreSpawningCollision:!1,disableCollider:!1,disableContextMenu:!1,ghostColor:{r:10,g:10,b:10,a:.2},technicalRequirements:{minIosVersion:"11"},ghostScale:[1,1,1],ghostAsWireframe:!1,draggableUI:!1,addFromInfoModal:!1,clickToAddUi:!0,accordionInBuildUi:!1,outOfStock_EmissiveColor:{r:250,g:50,b:0},outOfStock_EmissiveIntensity:.002,defaultConfigurationID:null,emptySceneText:null,emptySceneTextFontSize:"2rem",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,comboPlugDistanceThreshold:.05,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,analyticsEventPrefix:"",outlineSettings:{multisampling:10,visibleEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),hiddenEdgeColor:new Color$1("#0f0").convertSRGBToLinear(),blur:3,width:1e3,edgeStrength:1e3,blendFunction:BlendFunction.ALPHA,pulseSpeed:0,xRay:!0},textSettings:{arButtonLabel:"AR",arHoverLabel:"View In Your Space",restartButtonLabel:"Restart",restartHoverLabel:"Restart",saveButtonLabel:"Save",saveHoverLabel:"Save",shareButtonLabel:"Share",shareHoverLabel:"Share",sizeButtonLabel:"Size",sizeHoverLabel:"Size",hotspotsButtonLabel:"Hotspots",hotspotsHoverLabel:"Hotspots",instructionsButtonLabel:"Instructions",instructionsHoverLabel:"Instructions",cartQuantityText:"Qty",reviewButtonText:"Review",cartHeadingText:"Review Products",buildTabHeadingText:"Build",colorTabHeadingText:"Color",featuresTabHeadingText:"Features",featuresTabEmptyText:"*Please add an item to the scene to see the features",tooltipEmptySceneText:"",tooltipInstructionText:"-Drag to rotate the camera-"},variantsTabOrder:{color:{enabled:!0,priority:1},geometryVariants:{enabled:!0,priority:2}},boundingBoxLeeway:.9,contactShadowVisibility:!0,measurementPrecision:2,disableAlerts:!1,focusCameraOnGhosts:!0,alertLevel:2999,alertControl:{default:!0,itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0,unvisualizedItemSpawn:!0},screenshotCameras:[{position:new Vector3(-2.5,.6,-5),rotation:new Vector3(-3.1097068566150314,-.6437852162982552,-3.122449778846033)},{position:new Vector3(3,1,-5),rotation:new Vector3(-.5,1,.5)}],instructionsSettings_desktop:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],instructionsSettings_mobile:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],defaultInstructionsSettings:{step1_drag:{mobile:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop_Mobile/Mobile_Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"}},desktop:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop/Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"}}},step1_add:{mobile:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add_Mobile/Mobile_Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add_Mobile/Mobile_Non-furniture_Step_1B.json"}},desktop:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add/Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add/Non-furniture_Step_1B.json"}}},step2:{mobile:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}},desktop:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}}},step3:{mobile:{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}},desktop:{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}}}}},setCSSLoaded:Dt=>{kt({cssLoaded:Dt})},actions:{refreshShadows:()=>{const{shadowRefreshKey:Dt}=_e();kt({shadowRefreshKey:Dt+1})},popFromAlertQueue:()=>{const{alertQueue:Dt}=_e();return Dt.shift(),kt({alertQueue:Dt}),Dt},addToAlertQueue:Dt=>{const{alertQueue:Vt,currentAlertData:Gt}=_e();return Vt.length>0&&Vt[Vt.length-1].alertId&&Dt.alertId===Vt[Vt.length-1].alertId||Vt.length==0&&Gt&&Gt.alertId&&Gt.alertId==Dt.alertId||(Vt.push(Dt),kt({alertQueue:Vt})),Vt},getDeviceState:()=>{const{isDesktop:Dt,isMobile:Vt,isTablet:Gt,isTouchDevice:zt,isLandscape:jt}=_e();return{isDesktop:Dt,isMobile:Vt,isTablet:Gt,isTouchDevice:zt,isLandscape:jt}},enableCart:()=>{const{sceneSettings:Dt,CORE_API:Vt,stores:Gt}=_e();Dt.disableCart=!1,Gt.inventoryStore.getState().actions.refreshInventory(Gt.itemStore.getState().itemsSpawned),Vt.fireEvent(Vt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:Dt,CORE_API:Vt,stores:Gt}=_e();Dt.disableCart=!0,Gt.inventoryStore.getState().actions.refreshInventory(Gt.itemStore.getState().itemsSpawned),Vt.fireEvent(Vt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:Dt}=_e();return Dt},sendAlert:Dt=>{kt({alertData:{...Dt}})},switchCursor(Dt){const{cursorParentRef:Vt}=_e();if(!Vt)return;let Gt="";switch(Dt){default:case CURSORS.GRAB:Gt="grabCursor";break;case CURSORS.GRABBING:Gt="grabbingCursor";break;case CURSORS.BLOCKED:Gt="blockedCursor";break;case CURSORS.POINTER:Gt="pointerCursor";break;case CURSORS.MOVE:Gt="moveCursor";break}for(let zt=0;zt<Vt.classList.length;zt++)Vt.classList[zt].includes("Cursor")&&Vt.classList.remove(Vt.classList[zt]);Vt.classList.add(Gt)},setAlertSettings:Dt=>{kt({alertSettings:Dt})},async completeDropItem(){const{draggingOnDropCollisionData:Dt,CORE_API:Vt,stores:Gt}=_e(),zt=Gt.attachmentStore.getState().attachmentSystem,{node:jt,attachedChildrenGuids:Ht,collidingStatus:Wt,intersectingGhostObject:qt,initPosition:Xt,initRotation:Kt,detachedPlugs:Yt,attachedNodesToCurrentNode:Zt}=Dt;Vt.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[Qt,en]of Ht.entries())Wt[Qt]===!0&&await Gt.itemStore.getState().actions.removeItemByGUID(en);const Jt=qt.userData;let nn=jt.getPlugByName(Jt.incomingPlugName),rn=zt.currentStructure.getPlugByGUID(Jt.receiverPlugGUID);jt.ref.position.set(qt.position.x,qt.position.y,qt.position.z),jt.ref.setRotationFromEuler(qt.rotation),jt.transform={position:qt.position,rotation:qt.quaternion},zt.currentStructure.connectPlugs({incomingPlug:nn,receiverPlug:rn}),Gt.ghostStore.getState().actions.clearAllGhosts(),Gt.itemStore.getState().actions.deselectItem(),Zt.map(Qt=>{jt.ref.parent.attach(Qt.ref),Qt.transform={position:Qt.ref.position,rotation:Qt.ref.quaternion},jt.dragging=!1,Qt.dragging=!1}),await Gt.attachmentStore.getState().actions.updateFittingSkuIds()},async revertDropItem(){const{draggingOnDropCollisionData:Dt,stores:Vt}=_e(),Gt=Vt.attachmentStore.getState().attachmentSystem,{node:zt,attachedChildrenGuids:jt,collidingStatus:Ht,intersectingGhostObject:Wt,initPosition:qt,initRotation:Xt,detachedPlugs:Kt,attachedNodesToCurrentNode:Yt}=Dt;CORE_API.alert({alertMsg:"Position of item"+zt.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const Zt=Kt.neighbourDetachedPlugs;Zt&&(Kt.neighbourNode.detachNodeFromReceiver(),Gt.currentStructure.connectPlugs({incomingPlug:Zt.incomingPlug,receiverPlug:Zt.receiverPlug}));let Jt=Kt.rootDetachedPlugs.incomingPlug,nn=Kt.rootDetachedPlugs.receiverPlug;zt.ref.position.set(qt.x,qt.y,qt.z),zt.ref.setRotationFromEuler(Xt);let rn=new Quaternion().identity();zt.ref.getWorldQuaternion(rn),zt.transform={position:qt,rotation:rn},Gt.currentStructure.connectPlugs({incomingPlug:Jt,receiverPlug:nn}),Vt.ghostStore.getState().actions.clearAllGhosts(),Vt.itemStore.getState().actions.deselectItem(),Yt.map(Qt=>{zt.ref.parent.attach(Qt.ref),Qt.transform={position:Qt.ref.position,rotation:Qt.ref.quaternion},zt.dragging=!1,Qt.dragging=!1}),await Vt.attachmentStore.getState().actions.updateFittingSkuIds()},setCoreSettings:Dt=>{const{sceneSettings:Vt,isMobile:Gt,isTouchDevice:zt,isLandscape:jt,actions:Ht}=_e(),Wt=Gt===!0?"mobile":"desktop",qt=["showSave","showShare","showReset","showDimension","showHotspots","showInstructionsBtn","showViewInYourSpace","showContextMenu","showInstructionsOnStartup","draggableUI","clickToAddUi","textSettings","alertControl","variantsTabOrder","emptySceneTextFontSize","instructionsSettings"];for(const Xt of qt)if(Xt==="draggableUI"||Xt==="clickToAddUi"||Xt==="emptySceneTextFontSize"||Xt==="showInstructionsOnStartup"||Xt==="showInstructionsBtn"||Xt==="instructionsSettings"){const Yt=`${Xt}_${jt===!1&&zt===!0?"mobile":"desktop"}`;Dt[Yt]!==void 0?Vt[Xt]=Dt[Yt]:Vt[Yt]!==void 0&&(Vt[Xt]=Vt[Yt])}else if(Xt==="textSettings"||Xt==="variantsTabOrder"||Xt==="alertControl"||Xt==="outlineSettings"){if(Dt.hasOwnProperty(Xt)){let Kt=Vt[Xt];Object.keys(Kt).map(Yt=>{let Zt=Dt[Xt];Zt.hasOwnProperty(Yt)?(Yt==="visibleEdgeColor"||Yt==="hiddenEdgeColor")&&(Zt[Yt]=new Color$1(Zt[Yt]).convertSRGBToLinear()):Zt[Yt]=Kt[Yt]})}}else{const Kt=`${Xt}_${Wt}`;if(Dt[Kt]!==void 0){let Yt=`${Xt}Btn`;Xt=="showContextMenu"&&(Yt=`${Xt}`),Vt[Yt]=Dt[Kt]}}Dt.disableCart===!0&&Ht.disableCart(),Object.keys(Dt).map(Xt=>Vt[Xt]=Dt[Xt]),Vt.emptySceneText===null&&(Vt.emptySceneTextFontSize=Gt?"1.2rem":"1.5rem",Vt.draggableUI===!0?Vt.emptySceneText="Drag an item here to get started":Vt.emptySceneText="Select an item to get started"),kt({sceneSettings:{...Vt,ghostThreeColor:{r:Vt.ghostColor.r/255,g:Vt.ghostColor.g/255,b:Vt.ghostColor.b/255,a:Vt.ghostColor.a/255},draggableUiGhostThreeColorOnHover:{r:Vt.ghostColorOnHoverWithDraggableUi.r/255,g:Vt.ghostColorOnHoverWithDraggableUi.g/255,b:Vt.ghostColorOnHoverWithDraggableUi.b/255,a:Vt.ghostColorOnHoverWithDraggableUi.a/255}}})},triggerAutoFocus:(Dt=null)=>kt(Vt=>({autoFocusRef:Dt,autoFocusTrigger:Vt.autoFocusTrigger+1})),requestNewScreenshot:async(Dt,Vt)=>{const{CORE_API:Gt}=_e();return new Promise(async(zt,jt)=>{LOGGER.info({title:"Taking a screenshot"});const{screenshotRenderer:Ht,sceneRef:Wt,screenshotCamera:qt,canvasSize:Xt}=_e(),Kt=await Gt.getCurrentCameraDetails();if(Ht.setClearColor(16777215),qt.copy(Kt),Dt!==null&&(qt.position.copy(Dt.position),qt.rotation.copy(new Euler(Dt.rotation.x,Dt.rotation.y,Dt.rotation.z))),Vt==null?Ht.setSize(Xt.width,Xt.height):Ht.setSize(Vt.width,Vt.height),Ht.render(Wt.parent,qt),Ht.preserveDrawingBuffer===!1)LOGGER.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),jt({success:!1,imageData:null});else{LOGGER.info({title:"Downloading the screenshot"});const Yt=Ht.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");zt({success:!0,imageData:Yt})}})}}})),createProductDataStore=kt=>{const _e=productDataStoreCreator();return _e.setState({stores:kt}),_e},productDataStoreCreator=()=>create((kt,_e)=>({stores:null,productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:void 0,actions:{getCurrentCompareAtPricingInfo:()=>{const{productData:Dt}=_e();let Vt={};return Object.keys(Dt).map(Gt=>{if(Gt.toLowerCase()==="root")return;let zt=Dt[Gt].lookDetails,jt={};Object.keys(zt).map(Ht=>{Ht!="default"&&(jt[Ht]=zt[Ht].compareAtPrice)}),Vt[Gt]=jt}),Vt},getCurrentPricingInfo:()=>{const{productData:Dt}=_e();let Vt={};return Object.keys(Dt).map(Gt=>{if(Gt.toLowerCase()==="root")return;let zt=Dt[Gt].lookDetails,jt={};Object.keys(zt).map(Ht=>{Ht!="default"&&(jt[Ht]=zt[Ht].price)}),Vt[Gt]=jt}),Vt},updateCompareAtPricingForAllProducts:Dt=>{const{actions:Vt}=_e();Object.keys(Dt).map(Gt=>{let zt=Dt[Gt];Object.keys(zt).map(jt=>{Vt.updateCompareAtPricingForProduct(Gt,jt,zt[jt])})})},updatePricingForAllProducts:Dt=>{const{actions:Vt}=_e();Object.keys(Dt).map(Gt=>{let zt=Dt[Gt];Object.keys(zt).map(jt=>{Vt.updatePricingForProduct(Gt,jt,zt[jt])})})},updateCompareAtPricingForProduct:(Dt,Vt,Gt)=>{const{productData:zt,stores:jt}=_e();let Ht=zt[Dt];if(!Ht||!Ht.lookDetails)return;let Wt=Ht.lookDetails[Vt];if(!Wt)return;Wt.compareAtPrice=Gt,jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodesBySKUID(Dt).map(Kt=>Kt.updateCompareAtPricing())},updatePricingForProduct:(Dt,Vt,Gt)=>{const{productData:zt,stores:jt}=_e();let Ht=zt[Dt];if(!Ht||!Ht.lookDetails)return;let Wt=Ht.lookDetails[Vt];if(!Wt)return;Wt.price=Gt,jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodesBySKUID(Dt).map(Kt=>Kt.updatePricing())},setProductData:Dt=>{const{stores:Vt}=_e();let Gt={};Dt&&Object.keys(Dt).map(zt=>{const jt=Dt[zt];if(jt.skuID=zt,jt.skuID.toLowerCase()==="root"){jt.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},jt.defaultVariant="default";return}if(jt?.lookDetails){const Ht=jt.lookDetails;let Wt=Object.keys(jt.lookDetails);if(Wt.includes("default")){const Xt=Wt.indexOf("default");Wt.splice(Xt,1)}jt.looks=Wt,Object.keys(jt.lookDetails).map(Xt=>{let Kt=jt.lookDetails[Xt];Kt.inventory===void 0&&(Kt.inventory=DEFAULT_INVENTORY),Kt.price===void 0&&(Kt.price=DEFAULT_PRODUCT_PRICE),Kt.compareAtPrice===void 0&&(Kt.compareAtPrice=DEFAULT_PRODUCT_COMPARE_AT_PRICE),Gt[zt]={...Gt[zt],[Xt]:{inventory:DEFAULT_INVENTORY,inScene:[]}}});let qt=jt?.defaultVariant;qt||(LOGGER.warn({title:`No defaultVariant set for ${jt.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),qt=Object.keys(jt.lookDetails).sort()[0],LOGGER.warn({title:"Auto resolved default look ID: "+qt})),Wt.includes(qt)?(jt.lookDetails.default=Ht[qt],jt.lookDetails.default.id=qt):(LOGGER.error({title:`Default look [ ${qt} ] doesn't exist for: ${zt}. Please make sure to select a default variant in Input Data for this project`}),jt.lookDetails.default=null)}}),LOGGER.info({title:"PRODUCT DATA: ",details:Dt}),Vt.inventoryStore.setState({inventoryData:Gt}),kt({productData:Dt})},setCategoryData:Dt=>{const{productData:Vt}=_e();Dt.geometryVariants!==void 0&&Dt.geometryVariants.map(Gt=>{Gt.defaultVariant===void 0&&Object.keys(Gt.variants).length>0&&(Gt.defaultVariant=Object.keys(Gt.variants)[0])}),Dt.color!==void 0&&Dt.color.map(Gt=>{(Gt.defaultLook===void 0&&Gt.looks.length>0||!Gt.looks.includes(Gt.defaultLook))&&(Gt.defaultLook=Gt.looks[0])}),kt({categoryData:Dt}),Dt.build!==void 0&&Dt.build.map(Gt=>{Gt.skus.map(zt=>{Vt[zt].categoryID=Gt.categoryID,Vt[zt].categoryLabel=Gt.label,Vt[zt].swappable=Gt.swappable?Gt.swappable:!1,Vt[zt].replace=Gt.replace})})},getProductDataById:Dt=>{const{productData:Vt}=_e();let Gt=null;return Vt[Dt]&&(Gt=Vt[Dt]),Gt},setLookData:Dt=>kt({lookData:Dt}),setHotspotsData:Dt=>{const{categoryData:Vt,productData:Gt}=_e();Vt.geometryVariants&&Object.keys(Dt).map(zt=>{Dt[zt].map(jt=>{jt.geometryVariantID&&Vt.geometryVariants.map(Ht=>{Object.keys(Ht.variants).map(Wt=>{jt.geometryVariantID==Wt&&Ht.productsInCategory.map(qt=>{let Xt=null;qt.products.map(Kt=>{Dt.hasOwnProperty(Kt)&&(Xt=Dt[Kt])}),qt.products.map(Kt=>{Dt.hasOwnProperty(Kt)||(Dt[Kt]=Xt)})})})})})}),kt({hotspotsData:Dt})},setAssetsData:Dt=>kt({assetsData:Dt})}})),createItemStore=kt=>{const _e=itemStoreCreator();return _e.setState({stores:kt}),_e},itemStoreCreator=()=>create((kt,_e)=>({stores:null,variantChangeAlert:!1,focusedGUID:null,removeItems:[],removeItemTrigger:!1,itemsSpawned:{},itemsCount:0,modelLoadedAlert:0,lastDeletedItemData:null,lastDeletedItemsData:[],hoveredItemRef:{},collidersRef:[],fittingSkuIds:[],filteredCollidersRef:[],selectedItemData:null,defaultSceneItemCount:0,busySpawningItem:!1,busyReplacingItem:!1,busySpawningDependency:!1,busyDraggingItem:!1,busyRemovingItem:!1,isBusy:()=>{const{busySpawningItem:Dt,busyReplacingItem:Vt,busySpawningDependency:Gt,busyDraggingItem:zt,busyRemovingItem:jt}=_e();return Dt||Vt||Gt||zt||jt},actions:{triggerModelLoaded:()=>{kt(Dt=>({modelLoadedAlert:Dt.modelLoadedAlert+1}))},triggerRemoveItem:()=>{kt(Dt=>({removeItemTrigger:!Dt.removeItemTrigger}))},addToRemoveItems:Dt=>{const{removeItems:Vt}=_e();Vt.push(Dt)},switchToVariant:async(Dt,Vt,Gt=!1)=>{const{variantChangeAlert:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().categoryData;let qt=jt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Dt.guid);const Xt=jt.assetStore.getState().assets.items,Kt=qt.ref.getObjectByName("GRP_RenderGeometry");Xt[Dt.skuID].data||Ht.geometryVariants&&Ht.geometryVariants.map(Yt=>{Yt.productsInCategory.map(Zt=>{let Jt=!1;Zt.products.map(nn=>{nn==Dt.skuID&&(Jt=!0)}),Jt&&Zt.products.map(nn=>{const rn=jt.assetStore.getState().assets.items[nn].data;rn&&(jt.assetStore.getState().assets.items[Dt.skuID].data=rn)})})}),qt.modelFunctions&&(await qt.modelFunctions.selectVariant(Kt,Vt),Gt?(qt.overrideVariant=Vt,jt.coreSceneStore.getState().CORE_API.fireEvent(jt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0)):qt.currentVariant=Vt,kt({variantChangeAlert:!zt}))},clearAllItems:()=>{kt({itemsSpawned:{},itemsCount:0,lastDeletedItemsData:[],hoveredItemRef:[],collidersRef:[],filteredCollidersRef:[],selectedItemData:null})},setItemsSpawned:Dt=>{kt({itemsSpawned:Dt,itemsCount:Object.keys(Dt).length})},setHoveredItemRef:Dt=>kt({hoveredItemRef:Dt}),setCollidersRef:Dt=>{const{stores:Vt}=_e();kt({collidersRef:Dt});let Gt=[];for(let zt=0;zt<Dt.length;zt++)Dt[zt].current&&Gt.push(Dt[zt]);Vt.itemStore.setState({filteredCollidersRef:[...Gt]})},setSelectedItemData:Dt=>{const{selectedItemData:Vt,hoveredItemRef:Gt,actions:zt,stores:jt}=_e();Vt&&(delete Gt[Vt.itemData.guid],zt.setHoveredItemRef({...Gt})),kt({selectedItemData:{...Dt}}),jt.hotspotStore.getState().actions.switchHotspotsVisibility(!1,!0),jt.cameraStore.getState().actions.canCameraRotate(!1)},deselectItem:()=>{const{selectedItemData:Dt,stores:Vt}=_e();Dt&&Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.UI.ContextMenu_Hide,Dt),kt(()=>({selectedItemData:null})),Vt.hotspotStore.getState().actions.switchHotspotsVisibility(!0,!0),Vt.cameraStore.getState().actions.canCameraRotate(!0),Vt.itemStore.getState().actions.setHoveredItemRef({})},removeItemByGUID:async Dt=>{const{itemsSpawned:Vt,actions:Gt,stores:zt}=_e();if(Vt.hasOwnProperty(Dt))return kt({busyRemovingItem:!0}),new Promise(async(jt,Ht)=>{const Wt=qt=>{Dt===qt.data.itemData.guid&&(kt({busyRemovingItem:!1}),jt(Dt))};zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Item_Removed,Wt,{once:!0}),Gt.addToRemoveItems(Dt),Gt.triggerRemoveItem()})},addItemBySkuID:async(Dt,Vt=0,Gt=!1,zt)=>{kt({busySpawningItem:!0});const{actions:jt,itemsSpawned:Ht,stores:Wt}=_e(),qt=Wt.productDataStore.getState().productData,Xt=Wt.productDataStore.getState().hotspotsData,Kt=Wt.attachmentStore.getState().attachmentSystem;let Yt=!0;const Zt=await new Promise(async(Jt,nn)=>{if(LOGGER.info({title:`Spawning item: ${Dt}`}),jt.deselectItem(),!qt[Dt]){LOGGER.warn({title:`Product not found: ${Dt}`}),Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:Dt+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),Yt=!1,nn(Dt+": product not found!");return}const rn=[...Wt.ghostStore.getState().ghostsTransform],Qt={...Wt.ghostStore.getState().ghostData};if(rn.length<=0){Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:"Unable to add item to configuration",alertTime:6e3,alertType:"warn",alertLabel:"Action Unavailable"}),Yt=!1,nn("No available connections for this product to attach to");return}const en=tn=>{Dt===tn.data&&Jt(Qt.newNodes[Vt].guid)};if(Wt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Wt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,en,{once:!0}),Qt.addItemOrSwap[Vt]=="replace")await replaceItem(kt,Wt,Ht,Qt.skuID,rn[Vt],Qt.newNodes[Vt]);else{Wt.ghostStore.getState().actions.clearAllGhosts();const tn=Qt.newNodes[Vt];tn.isDependent=Gt;let sn=!0;if(qt[Qt.skuID].hasOwnProperty("disableInteraction")){const fn=qt[Qt.skuID].disableInteraction;(fn==!0||fn==!1)&&(sn=!fn)}zt!=null&&(sn=zt),tn.isInteractive=sn;const{position:cn,rotation:un}=rn[Vt];tn.transform={position:cn,rotation:un},Kt.currentStructure.addNode(tn),Qt.connectablePlugs[Vt].receiverPlug.type=="unvisualizedPlug"&&Wt.coreSceneStore.getState().CORE_API.alert({alertMsg:"This product is not shown in your 3D configuration but can be found in your shopping list.",alertTime:3e3,alertType:"warn",alertLabel:"Internal Storage",persistant:!1,alertId:"unvisualizedItemSpawn"}),Qt.comboPlugs[Vt].length>0&&Qt.connectablePlugs[Vt].incomingPlug.type=="comboPlug"&&Qt.comboPlugs[Vt].map(fn=>{Kt.currentStructure.connectPlugs(fn)}),Qt.connectablePlugs[Vt].incomingPlug.comboPlugConnector=!0,Kt.currentStructure.connectPlugs(Qt.connectablePlugs[Vt]);const hn=await Wt.assetStore.getState().actions.loadProxyAsset(Qt.skuID,!0);LOGGER.info({title:"GHOST NEW NODE: ",details:tn}),Ht[tn.guid]={itemData:{proxyScene:hn.proxy.data.scene,guid:Qt.newNodes[Vt].guid,...qt[Qt.skuID],position:cn,rotation:un,hasItemLoaded:!1,isDependent:Gt,isInteractive:sn},hotspotsData:Xt[Qt.skuID],hotspotSpawned:!1},await wait(1),jt.setItemsSpawned({...Ht})}}).catch(Jt=>{LOGGER.error({title:Jt}),Yt=!1});if(Yt===!1)return kt({busySpawningItem:!1}),Zt;if(Wt.coreSceneStore.getState().preconfigurationLoaded&&Wt.coreSceneStore.getState().configurationLoaded){const Jt=await Kt.getCartItemsAsync();Jt&&Wt.coreSceneStore.getState().CORE_API.fireEvent(Wt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Jt)}if(await jt.resolvePlugDependencyOnGUID(Zt),kt({busySpawningItem:!1}),!Gt){const Jt=Kt.currentStructure,nn=Jt.getNodeByGUID(Zt);Wt.dynamicHookStore.getState().hookOnSceneItemAdded(nn,Jt.nodes,Wt.coreSceneStore.getState().CORE_API),await Wt.attachmentStore.getState().actions.updateFittingSkuIds()}return Zt},async addItemWithTransform(Dt,Vt,Gt,zt=!0){const{actions:jt,itemsSpawned:Ht,defaultSceneItemCount:Wt,stores:qt}=_e(),Xt=qt.productDataStore.getState().productData,Kt=qt.productDataStore.getState().hotspotsData;return await new Promise(async(Zt,Jt)=>{if(jt.deselectItem(),!Xt[Vt]){qt.coreSceneStore.getState().CORE_API.alert({alertMsg:Vt+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),Jt(Vt+": product not found!");return}const{position:nn,rotation:rn}=Dt;Ht[Gt]!=null&&(qt.hotspotStore.getState().actions.removeHotspotForItem({...Ht[Gt]}),delete Ht[Gt]);const Qt=tn=>{Vt.toLowerCase()==tn.data.toLowerCase()&&Zt(Gt)};qt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(qt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Qt,{once:!0});const en=await qt.assetStore.getState().actions.loadProxyAsset(Vt,!0);if(en==null){Jt(Vt+": Asset not found!");return}await wait(1),Vt.toLowerCase()==="root"&&kt({defaultSceneItemCount:Wt+1}),Ht[Gt]={itemData:{proxyScene:en.proxy.data.scene,guid:Gt,...Xt[Vt],position:nn,rotation:rn,hasItemLoaded:!1,isInteractive:zt},hotspotsData:Kt[Vt],hotspotSpawned:!1},kt({itemsSpawned:{...Ht}})}).catch(Zt=>{LOGGER.info({title:Zt})})},async resolvePlugDependencyOnGUID(Dt){const{actions:Vt,itemsSpawned:Gt,defaultSceneItemCount:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().productData,Wt=jt.attachmentStore.getState().attachmentSystem,qt=Gt[Dt].itemData.skuID,Xt=Ht[qt]?.plugs;if(!Xt)return;let Kt=!1;for(const Yt of Xt)Yt?.dependencySku&&(Kt=!0);Kt&&(kt({busySpawningDependency:!0}),await new Promise(async(Yt,Zt)=>{const Jt=[];for(const nn of Xt){const rn=nn?.dependencySku;if(!rn)continue;const Qt=async()=>{LOGGER.info({title:`Found a dependency: ${rn} on the plug: ${nn.name}`});let en=!0;Ht[rn]&&Ht[rn].hasOwnProperty("ignoreSpawningCollisionAsDependency")&&(en=Ht[rn].ignoreSpawningCollisionAsDependency),nn.hasOwnProperty("ignoreSpawningCollision")&&(en=nn.ignoreSpawningCollision);let tn=jt.coreSceneStore.getState().sceneSettings.ignoreSpawningCollision;Ht[rn].hasOwnProperty("ignoreSpawningCollision")&&(tn=Ht[rn].ignoreSpawningCollision),Ht[rn].ignoreSpawningCollision=en,jt.ghostStore.setState({ghostVisibility:!1});const sn=await jt.ghostStore.getState().actions.spawnGhostsForSkuID(rn,en);if(Ht[rn].ignoreSpawningCollision=tn,!sn)return;const cn=Wt.currentStructure.getNodeByGUID(Dt),un=cn.getPlugByName(nn.name)?.guid,hn=nn?.isDependencySkuInteractive?nn.isDependencySkuInteractive===1:!1,fn=sn.connectablePlugs;let pn=-1;for(const mn of fn)mn.receiverPlug.guid===un&&(pn=fn.indexOf(mn));if(pn==-1){jt.ghostStore.getState().actions.clearAllGhosts();return}const dn=await Vt.addItemBySkuID(rn,pn,!0,hn);qt.toLowerCase()==="root"&&Ht[rn].ignoreInCart&&kt({defaultSceneItemCount:zt+1}),dn!==null&&cn.addMyDependenciesGUID(dn)};Jt.push(await Qt())}await Promise.all(Jt),Yt(!0)}),kt({busySpawningDependency:!1}))},async replaceGuidItemBySkuId(Dt,Vt){const{itemsSpawned:Gt,stores:zt}=_e();if(Gt[Dt]==null)return!1;const jt=zt.attachmentStore.getState().attachmentSystem.currentStructure,Ht=jt.getNodeByGUID(Dt);if(!Ht||!Ht.isReplaceableWithSkuId(Vt))return!1;LOGGER.info({title:"Replacing Item"});const qt=zt.productDataStore.getState().productData,Xt=zt.productDataStore.getState().hotspotsData;kt({busyReplacingItem:!0}),await new Promise(async(Kt,Yt)=>{const Zt=async()=>{LOGGER.info({title:"Removed old item with guid: "+Dt});const Jt=async Qt=>{Vt===Qt.data&&(jt.recalculateStructureFromNode(Ht.whichNodeAreWeAttachedTo()),await zt.attachmentStore.getState().actions.toggleStructureUpdated(),kt({busyReplacingItem:!1}),Kt(Ht.guid))};zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,Jt,{once:!0});const nn=await zt.assetStore.getState().actions.loadProxyAsset(Vt,!0),rn={receiverPlug:Ht.whichPlugAreWeAttachedTo(),incomingPlug:Ht.whichPlugAreWeAttachedUsing()};jt.findItemTransform(rn),Gt[Dt]={itemData:{proxyScene:nn.proxy.data.scene,guid:Dt,...qt[Vt],position:Ht.transform.position,rotation:Ht.transform.rotation,hasItemLoaded:!1},hotspotsData:Xt[Vt],hotspotSpawned:!1},LOGGER.warn({title:"SWITCHING VARIANT: ",details:Ht.currentVariant}),zt.itemStore.setState({itemsSpawned:{...Gt}})};zt.hotspotStore.getState().actions.removeHotspotForItem({...Gt[Dt]}),delete Gt[Dt],Ht.update(Vt),zt.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Zt,{once:!0})})}}}));async function replaceItem(kt,_e,Dt,Vt,Gt,zt){LOGGER.info({title:"Replacing Item"});const{position:jt,rotation:Ht}=Gt,Wt=_e.productDataStore.getState().productData,qt=_e.productDataStore.getState().hotspotsData,Xt=_e.attachmentStore.getState().attachmentSystem.currentStructure;return kt({busyReplacingItem:!0}),new Promise(async(Kt,Yt)=>{const Zt=async()=>{const Jt=await _e.assetStore.getState().actions.loadProxyAsset(Vt,!0),nn=async rn=>{Vt===rn.data&&(Xt.recalculateStructureFromNode(zt),await _e.attachmentStore.getState().actions.toggleStructureUpdated(),_e.ghostStore.getState().actions.clearAllGhosts(),kt({busyReplacingItem:!1}),Kt(zt.guid))};_e.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Loaded,nn,{once:!0}),Dt[zt.guid]={itemData:{proxyScene:Jt.proxy.data.scene,guid:zt.guid,...Wt[Vt],position:jt,rotation:Ht,hasItemLoaded:!1},hotspotsData:qt[Vt],hotspotSpawned:!1},LOGGER.warn({title:"SWITCHING VARIANT: ",details:zt.currentVariant}),zt.currentVariant=zt.currentVariant,zt.transform=Gt,_e.itemStore.setState({itemsSpawned:{...Dt}})};_e.hotspotStore.getState().actions.removeHotspotForItem({...Dt[zt.guid]}),delete Dt[zt.guid],zt.update(Vt),_e.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Model_Removed,Zt,{once:!0})})}const createInventoryStore=kt=>{const _e=inventoryStoreCreator();return _e.setState({stores:kt}),_e},inventoryStoreCreator=()=>create((kt,_e)=>({stores:null,inventoryData:{},actions:{updateInventoryForAllProducts:Dt=>{const{actions:Vt,stores:Gt}=_e();Object.keys(Dt).map(zt=>{let jt=Dt[zt];Object.keys(jt).map(Ht=>{Vt.updateInventoryForProduct(zt,Ht,jt[Ht].inventory)})}),Vt.refreshInventory(Gt.itemStore.getState().itemsSpawned)},updateInventoryForProduct:(Dt,Vt,Gt)=>{const{inventoryData:zt}=_e();let jt=zt[Dt],Ht=jt[Vt];!jt||!Ht||(Ht.inventory=Gt)},_clearInScene:()=>{const{inventoryData:Dt}=_e();Object.keys(Dt).map(Vt=>{const Gt=Dt[Vt];Object.keys(Gt).map(zt=>{Gt[zt].inScene=[]})})},refreshInventory:Dt=>{if(!Dt)return;LOGGER.info({title:"Refreshing Inventory"});const{actions:Vt,inventoryData:Gt,stores:zt}=_e();Vt._clearInScene();const jt=zt.attachmentStore.getState().attachmentSystem;if(jt===null)return;const Ht=jt.currentStructure;if(Ht===null)return;Object.keys(Dt).map(Kt=>{const Yt=Ht.getNodeByGUID(Kt);if(!Yt)return;const Zt=Yt.overrideVariant?Yt.overrideVariant:Yt.currentVariant;if(!Zt)return;const Jt=Gt[Yt.skuID];if(!Jt||!Jt[Zt].inScene)return;Jt[Zt].inScene.push(Kt),zt.coreSceneStore.getState().sceneSettings.disableCart===!0?Yt.inStock={variantName:Zt,newValue:!0}:Jt[Zt].inScene.length>Jt[Zt].inventory?Yt.inStock={variantName:Zt,newValue:!1}:Yt.inStock={variantName:Zt,newValue:!0}});let Wt=!1;Object.keys(Gt).map(Kt=>{const Yt=Gt[Kt];Object.keys(Yt).map(Zt=>{Yt[Zt].countAvailable=Yt[Zt].inventory-Yt[Zt].inScene.length,Yt[Zt].countAvailable<0?(Yt[Zt].countUnavailable=Yt[Zt].countAvailable*-1,Yt[Zt].countAvailable=0,Wt=!0):Yt[Zt].countUnavailable=0})});const qt={alertMsg:"Some item(s) in configuration are out of stock",alertTime:7e3,alertType:"warn",alertLabel:"Stock Alert",persistant:!0,alertId:"outOfStock"},Xt=compareObjects(zt.coreSceneStore.getState().persistantAlertData,qt);Wt===!1&&Xt===!0&&zt.coreSceneStore.getState().CORE_API.removePersistantAlert(),zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Inventory_Updated,Gt)}}})),createAssetStore=kt=>{const _e=assetStoreCreator();return _e.setState({stores:kt}),_e},assetStoreCreator=()=>create((kt,_e)=>({stores:null,assets:{items:{}},gltfLoader:null,dracoLoader:null,actions:{init(){const Dt=new DRACOLoader;Dt.setDecoderPath(`${ASSETS_SOURCE_ROOT}/external-libs/draco/`),Dt.setDecoderConfig({type:"js"});const Vt=new GLTFLoader;Vt.register(Gt=>new GLTFMaterialsVariantsExtension(Gt)),Vt.setDRACOLoader(Dt),kt({dracoLoader:Dt,gltfLoader:Vt})},async loadProxyAsset(Dt){const{assets:Vt,gltfLoader:Gt,stores:zt}=_e(),jt="proxy",Ht=Vt.items[Dt]=Vt.items[Dt]||{isLoaded:!1,errorLoading:!1,proxy:{isLoaded:!1,errorLoading:!1}},Wt=Ht.proxy;if(Wt.isLoaded)return Ht;if(Wt.errorLoading)throw new Error(`${jt} loading failed for: ${Dt}`);const qt=zt.productDataStore.getState().productData[Dt];if(!qt)throw new Error(`Data doesn't exist for ${Dt}`);const Xt=zt.coreSceneStore.getState().CORE_API.getResolvedAssetUrl(qt.colliderProxyGLTF);if(!Xt)return null;try{const Kt=await Gt.loadAsync(Xt,Yt=>{Wt.progress=Yt.loaded/Yt.total*100});return Wt.data=Kt,Wt.isLoaded=!0,Ht}catch(Kt){throw Wt.isLoaded=!1,Wt.errorLoading=!0,Wt.error=Kt,LOGGER.info({title:Xt}),new Error(`Couldn't load ${Dt}`)}},isProxyLoaded(Dt){const Vt=_e().assets.items[Dt];return Vt?Vt.proxy.isLoaded:!1}}}));class Structure{#e=!1;constructor(_e,Dt=null,Vt,Gt){if(this.stores=_e,this._nodes=[],this._rootNode=null,LOGGER.info({title:"preloadNodes",details:Dt}),this.setupHookOnSceneItemsUpdated(),Dt){LOGGER.info({title:"PRELOAD Length-----------------:"+Dt.length});for(let zt=0;zt<Dt.length;zt++){LOGGER.info({title:"FOUND PRELOAD-----------------"});const jt=Dt[zt].skuID;if(jt.toLowerCase()=="root"){const Wt=this.stores.itemStore.getState().itemsSpawned;Object.keys(Wt).length>0&&(Dt[zt].guid=Object.keys(Wt)[0])}let Ht=new Node$1(_e,jt,Dt[zt],Vt,Gt);jt.toLowerCase()=="root"&&(this._rootNode=Ht),this._nodes.push(Ht)}}else{const zt=new Node$1(_e,"Root",null,Vt,Gt);this._rootNode=zt,this._nodes.push(zt),this.stores.itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},"Root",this._rootNode.guid,!1)}this._boundingBoxLeeway=this.stores.coreSceneStore.getState().sceneSettings.boundingBoxLeeway}async setupHookOnSceneItemsUpdated(){const _e=this.stores.coreSceneStore.getState().CORE_API;this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(_e.EVENTS.SCENE.FittingSkuIds_Updated,()=>{this.stores.dynamicHookStore.getState().hookOnSceneItemsUpdated(this._nodes,_e)})}get nodes(){return this._nodes}get rootNode(){return this._rootNode}updatePricing(){for(let _e=0;_e<this._nodes.length;_e++)this._nodes[_e].updatePricing()}getCurrentItemsInReplaceableCategory(){let _e={};for(const Dt of this._nodes)Dt.replace&&(_e[Dt.categoryID]=Dt.skuID);return _e}recalculateStructureFromNode(_e){for(let Dt=0;Dt<_e.plugs.length;Dt++)if(!_e.plugs[Dt].isOpen&&_e.plugs[Dt].isReceiverPlug){const Vt=_e.plugs[Dt].attachedPlug.node,Gt={receiverPlug:_e.plugs[Dt],incomingPlug:_e.plugs[Dt].attachedPlug};if(Gt){const zt=this.findItemTransform(Gt);zt&&(Vt.ref.position.set(zt.position.x,zt.position.y,zt.position.z),zt.rotation.isQuaternion===!0?Vt.ref.setRotationFromQuaternion(zt.rotation):zt.rotation.isEuler===!0&&Vt.ref.setRotationFromEuler(zt.rotation),Vt.transform={position:zt.position,rotation:zt.rotation})}this.recalculateStructureFromNode(Vt)}}rotateNode(_e){const Dt=this.getNodeByGUID(_e);let Vt=null,Gt=null;for(let Ht=0;Ht<Dt.plugs.length;Ht++)if(!Gt&&!Dt.plugs[Ht].isOpen&&Dt.plugs[Ht].attachedPlug.isReceiverPlug){const Wt=Dt.plugs[Ht].attachedPlug.acceptedPlugTypes;Gt=Dt.plugs[Ht].attachedPlug;let qt=[];for(let Xt=Ht+1;Xt<Dt.plugs.length;Xt++)qt.push(Dt.plugs[Xt]);for(let Xt=0;Xt<Ht;Xt++)qt.push(Dt.plugs[Xt]);for(let Xt=0;Xt<qt.length;Xt++)for(let Kt=0;Kt<qt[Xt].connectsToPlugTypes.length;Kt++)Wt.includes(qt[Xt].connectsToPlugTypes[Kt])&&(Vt=qt[Xt])}if(!Vt)return;Dt.detachNodeFromReceiver();const{position:zt,rotation:jt}=this.findItemTransform({receiverPlug:Gt,incomingPlug:Vt});Dt.ref.position.set(zt.x,zt.y,zt.z),jt.isQuaternion===!0?Dt.ref.setRotationFromQuaternion(jt):jt.isEuler===!0&&Dt.ref.setRotationFromEuler(jt),Dt.transform={position:Dt.ref.position,rotation:jt},this.connectPlugs({receiverPlug:Gt,incomingPlug:Vt}),this.recalculateStructureFromNode(Dt)}async load(_e){this.resolvePlugConnections(_e),await this.respawnItems()}materialOverrideExists(){let _e=!1;return this.nodes.map(Dt=>{if(Dt.overrideVariant)return _e=!0,!0}),_e}async findGhostTransformForReplacement(_e,Dt){let Vt=[],Gt=[],zt=[];for(const Ht of Dt){if(Ht.skuID==_e)continue;const Wt=this.stores.attachmentStore.getState().attachmentSystem,qt=Ht.whichPlugAreWeAttachedTo(),Xt=Ht.whichPlugAreWeAttachedUsing(),Yt=new Node$1(this.stores,_e,null,Wt.globalVariants,Wt.globalGeometryVariants).getPlugByName(Xt.name);if(!Yt)continue;const Zt={incomingPlug:Yt,receiverPlug:qt},{position:Jt,rotation:nn}=this.findItemTransform(Zt);Jt&&nn&&(Gt.push({position:Jt,rotation:nn,incomingPlugName:Zt.incomingPlug.name,receiverPlugName:Zt.receiverPlug.name,incomingPlugGUID:Zt.incomingPlug.guid,receiverPlugGUID:Zt.receiverPlug.guid}),zt.push(Zt),Vt.push(Ht))}let jt={transforms:Gt,connectablePlugs:zt,newNodes:Vt};return jt=await this.stores.dynamicHookStore.getState().hookOnNewItemGhostsCollectedForReplacement(jt,this.stores.coreSceneStore.getState().CORE_API),jt}async findGhostTransforms(_e,Dt){const Vt=this.getOpenPlugs(),Gt=this.stores.coreSceneStore.getState().sceneSettings.comboPlugDistanceThreshold;if(Vt.length<=0)return{transforms:[]};const zt=this.stores.attachmentStore.getState().attachmentSystem,jt=this.stores.productDataStore.getState().productData,Ht=new Node$1(this.stores,_e,null,zt.globalVariants,zt.globalGeometryVariants),Wt=this.getConnectablePlugs(Ht,Vt);let qt=[];if(Wt.length<=0)return{transforms:[]};let Xt=[],Kt=[];const Yt=this.stores.assetStore.getState().assets.items[_e].proxy.data.scene;if(!Yt)return!1;let Zt=Yt.clone();for(let rn=0;rn<Wt.length;rn++){let Qt=Dt,{incomingPlug:en,receiverPlug:tn}=Wt[rn],sn=this.findItemTransform(Wt[rn]);if(!sn)continue;let{position:cn,rotation:un}=sn;if(!cn||!un)continue;Zt.position.set(cn.x,cn.y,cn.z),un.isQuaternion===!0?Zt.setRotationFromQuaternion(un):un.isEuler===!0&&Zt.setRotationFromEuler(un);let hn=[],fn=[];if(en.type=="comboPlug"){if(en.connectsToPlugTypes.length<=0)continue;const vn=en.connectsToPlugTypes[0];let _n=!1;if(Kt.map(Cn=>{_n===!0||Cn.length<=0||Cn.map(yn=>{_n===!0||yn.incomingPlug.guid!==en.guid||yn.incomingPlug.connectsToPlugTypes.includes(vn)&&(_n=!0)})}),_n===!0)continue;const An=en.node.plugs;let Tn=!0;if(An.map(Cn=>{if(Cn.type!=="comboPlug"||Cn.guid===en.guid||!Cn.connectsToPlugTypes.includes(vn))return;let yn=!1;if(Vt.map(Sn=>{if(tn.guid===Sn.guid||!Sn.acceptedPlugTypes.includes(vn)||!Sn.node.ref)return;let wn=new Vector3(0,0,0);const xn=Sn.node.ref.getObjectByName(""+Sn.name);if(!xn)return;xn.getWorldPosition(wn);let Rn=new Vector3(0,0,0);const Ln=Zt.getObjectByName(""+Cn.name);if(!Ln)return;Ln.getWorldPosition(Rn);const Nn=wn.distanceTo(Rn);Math.abs(Nn)<Gt&&(hn.push(tn.node.guid),hn.push(Sn.node.guid),fn.push({receiverPlug:Sn,incomingPlug:Cn}),yn=!0)}),yn==!1){Tn=!1;return}}),!Tn)continue}let pn=Qt;Array.isArray(Qt)===!0&&(pn=!1),hn.length>0&&(pn=!1,Array.isArray(Qt)===!0?hn.map(vn=>{Qt.push(vn)}):Qt=hn),jt[_e].hasOwnProperty("ignoreSpawningCollision")&&(pn=jt[_e].ignoreSpawningCollision),Wt[rn].receiverPlug.type=="unvisualizedPlug"&&(pn=!0),(pn?!1:this.isColliding(Ht.skuID,sn,Wt[rn].receiverPlug,Qt))||(Xt.push({position:cn,rotation:un,incomingPlugName:Wt[rn].incomingPlug.name,receiverPlugName:Wt[rn].receiverPlug.name,incomingPlugGUID:Wt[rn].incomingPlug.guid,receiverPlugGUID:Wt[rn].receiverPlug.guid}),qt.push(Wt[rn]),Kt.push(fn))}let Jt=[];for(let rn=0;rn<Xt.length;rn++)Jt.push(Ht);dispose3(Zt);let nn={transforms:Xt,newNodes:Jt,connectablePlugs:qt,comboPlugs:Kt};return nn=await this.stores.dynamicHookStore.getState().hookOnNewItemGhostsCollected(nn,this.stores.coreSceneStore.getState().CORE_API),nn}resolvePlugConnections(_e){for(let Dt=0;Dt<_e.length;Dt++)Object.keys(_e[Dt].plugs).map(Vt=>{let Gt=_e[Dt].plugs[Vt].guid,zt=this.getPlugInNodesByGUID(Gt);if(!zt||zt.attachedPlug)return;let jt=_e[Dt].plugs[Vt].attachedPlugGUID,Ht=this.getPlugInNodesByGUID(jt);Ht&&(Ht.attachedPlug||(zt.attachPlug(Ht,_e[Dt].plugs[Vt].isReceiverPlug),Ht.attachPlug(zt,!_e[Dt].plugs[Vt].isReceiverPlug)))});LOGGER.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let _e=[this.rootNode];for(let zt=0;zt<_e.length;zt++){let Ht=_e[zt].whichPlugsAreAttachedToUs();for(let Wt=0;Wt<Ht.length;Wt++){if(Ht[Wt].incomingPlug.type=="comboPlug"&&Ht[Wt].incomingPlug.connectsToPlugTypes.length>0&&!Ht[Wt].incomingPlug.comboPlugConnector)continue;let qt=this.findItemTransformForPreload(Ht[Wt],Ht[Wt].receiverPlug.node.transform);qt?await this.stores.itemStore.getState().actions.addItemWithTransform(qt,Ht[Wt].incomingPlug.node.skuID,Ht[Wt].incomingPlug.node.guid):LOGGER.warn({title:"Problem finding plug transform! "+Ht[Wt].name}),Ht[Wt].incomingPlug.node.transform=qt,_e.push(Ht[Wt].incomingPlug.node)}}const Dt=await this.stores.coreSceneStore.getState().CORE_API.getCartItemsAsync();this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.SavedConfiguration_Loaded,{...Dt}),this.stores.coreSceneStore.getState().actions.triggerAutoFocus(),this.stores.hotspotStore.getState().actions.checkHotspotHealth();const Vt=this.stores.coreSceneStore.getState().preconfigurationLoaded==!1&&this.stores.coreSceneStore.getState().sceneHasDefaultConfigurationID==!1,Gt=this.stores.coreSceneStore.getState().configurationLoaded==!1&&this.stores.coreSceneStore.getState().preconfigurationLoaded==!0&&this.stores.coreSceneStore.getState().configurationLoadedOnRestart==!0;if((Vt||Gt)&&this.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics){const zt=new x$2(!0);this.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(zt)}}getPlugInNodesByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++){let Vt=this._nodes[Dt].getPlugByGUID(_e);if(Vt)return Vt}return null}export(){let _e=[];for(let Dt=0;Dt<this._nodes.length;Dt++){let Vt=this._nodes[Dt].export();Vt&&_e.push(Vt)}return _e}async clear(){return new Promise(async(_e,Dt)=>{!this._rootNode&&this._rootNode.isEndNode&&_e(!0);let Vt=null;const Gt=this._rootNode.whichNodesAreAttachedToUs();Gt.length>0&&(Vt=Gt[0]),this.#e=!0,this.stores.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Scene_Cleared,zt=>_e(zt.data),{once:!0}),Vt?this.stores.coreSceneStore.getState().CORE_API.removeItemByGUID(Vt.guid,!0):(await wait(500),_e(!0))})}getNodeByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e)return this._nodes[Dt];return null}getPlugByGUID(_e){for(const Dt of this._nodes){const Vt=Dt.getPlugByGUID(_e);if(Vt)return Vt}return null}findItemTransformForPreload(_e,Dt){let{receiverPlug:Vt,incomingPlug:Gt}=_e,zt=Vt,jt=Gt;if(zt.node.skuID=="Root")return this.findItemTransformRoot(_e);let Ht=null,Wt=null,qt=new Object3D,Xt=this.stores.assetStore.getState().assets.items[zt.node.skuID].proxy.data.scene.clone();qt.add(Xt);let{position:Kt,rotation:Yt}=Dt;if(Xt.position.set(Kt.x,Kt.y,Kt.z),Yt.isQuaternion===!0?Xt.setRotationFromQuaternion(Yt):Yt.isEuler===!0&&Xt.setRotationFromEuler(Yt),Wt=Xt,!Wt||(Ht=Wt.getObjectByName(zt.name),!Ht))return;let Zt=new Vector3(0,0,0);Ht.getWorldPosition(Zt);let Jt=new Quaternion().identity();Ht.getWorldQuaternion(Jt);let nn=new Object3D;Ht.add(nn);let rn=this.stores.assetStore.getState().assets.items[jt.node.skuID].proxy.data.scene.clone();rn.position.set(Zt.x,Zt.y,Zt.z),rn.applyQuaternion(Jt);let Qt=new Vector3;Qt.copy(Xt.up).applyQuaternion(Wt.quaternion);let en=new Vector3;en.copy(rn.up).applyQuaternion(Jt),en.negate();let tn=new Quaternion().setFromUnitVectors(Qt,en);Qt.round(),en.round();let sn=Qt.dot(en);sn!==1&&sn!==-1&&rn.applyQuaternion(tn);let cn=rn.getObjectByName(jt.name),un=new Quaternion().identity();cn.getWorldQuaternion(un);let hn=new Vector3(0,1,0);hn.applyQuaternion(un);let fn=new Vector3(0,1,0);fn.applyQuaternion(Jt),fn.negate();let pn=new Quaternion().setFromUnitVectors(hn,fn);if(hn.round(),fn.round(),hn.dot(fn)!==-1)rn.applyQuaternion(pn);else{let An=new Vector3(0,1,0),Tn=fn.dot(An);if(Tn!==1&&Tn!==-1)rn.rotateOnAxis(An,Math.PI);else{let Cn=new Vector3(0,0,1),yn=fn.dot(Cn);if(yn!==1&&yn!==-1)rn.rotateOnAxis(Cn,Math.PI);else{let Sn=new Vector3(1,0,0),wn=fn.dot(Sn);wn!==1&&wn!==-1&&rn.rotateOnAxis(Sn,Math.PI)}}}let mn=rn.getObjectByName(jt.name),vn=new Vector3(mn.position.x,mn.position.y,mn.position.z);rn.translateX(-vn.x),rn.translateY(-vn.y),rn.translateZ(-vn.z);let _n=new Vector3(0,0,0);rn.getWorldPosition(_n);let En=new Quaternion().identity();return rn.getWorldQuaternion(En),rn=null,{position:_n,rotation:En}}findItemTransformRoot(_e){let{receiverPlug:Dt,incomingPlug:Vt}=_e,Gt=Vt;const zt=new Object3D;let jt=zt,Ht=new Vector3(0,0,0);jt.getWorldPosition(Ht);let Wt=new Quaternion().identity(),qt=new Object3D;qt.position.set(0,0,0),zt.add(qt);let Xt=this.stores.assetStore.getState().assets.items[Gt.node.skuID].proxy.data.scene.clone();qt.attach(Xt),Xt.translateX(Ht.x),Xt.translateY(Ht.y),Xt.translateZ(Ht.z);let Kt=Xt.getObjectByName(Gt.name),Yt=new Quaternion().identity();Kt&&Kt.getWorldQuaternion(Yt);const Zt=new Vector3(0,1,0);Zt.applyQuaternion(Yt);const Jt=new Vector3(0,1,0);Jt.applyQuaternion(Wt);const nn=Jt.angleTo(Zt),rn=new Vector3(0,0,0);rn.crossVectors(Jt,Zt),rn.round(),rn.length()!==0&&Xt.rotateOnAxis(rn,nn);let Qt=new Matrix4().extractRotation(Xt.matrixWorld),en=new Vector3(0,0,0);Kt&&en.set(Kt.position.x,Kt.position.y,Kt.position.z),en.applyMatrix4(Qt),Xt.translateX(-en.x),Xt.translateY(-en.y),Xt.translateZ(-en.z);let tn=new Vector3(0,0,0);Xt.getWorldPosition(tn);let sn=new Quaternion().identity();return Xt.getWorldQuaternion(sn),qt.remove(Xt),qt=null,Xt=null,{position:tn,rotation:sn}}findItemTransform(_e){let{receiverPlug:Dt,incomingPlug:Vt}=_e,Gt=Dt,zt=Vt;if(Gt.node.isRoot)return this.findItemTransformRoot(_e);const jt=Gt.node.transform;if(!jt)return;const Ht=this.stores.assetStore.getState().assets.items[Gt.node.skuID].proxy.data.scene.clone(),Wt=new Object3D;Wt.position.set(jt.position.x,jt.position.y,jt.position.z),jt.rotation.isQuaternion===!0?Wt.setRotationFromQuaternion(jt.rotation):jt.rotation.isEuler===!0&&Wt.setRotationFromEuler(jt.rotation),Wt.add(Ht);let qt=Wt.getObjectByName(""+Gt.name);if(!qt){LOGGER.error({title:"Plug: "+Gt.name+" doesn't exist in "+Gt.node.skuID});return}let Xt=new Vector3(0,1,0);qt.getWorldPosition(Xt);let Kt=new Quaternion().identity();qt.getWorldQuaternion(Kt);let Yt=this.stores.assetStore.getState().assets.items[zt.node.skuID].proxy.data.scene.clone();Yt.position.set(Xt.x,Xt.y,Xt.z),Yt.applyQuaternion(Kt);let Zt=new Vector3;Zt.copy(Ht.up).applyQuaternion(Wt.quaternion);let Jt=new Vector3;Jt.copy(Yt.up).applyQuaternion(Kt),Jt.negate();let nn=new Quaternion().setFromUnitVectors(Zt,Jt);Zt.round(),Jt.round();let rn=Zt.dot(Jt);rn!==1&&rn!==-1&&Yt.applyQuaternion(nn);let Qt=Yt.getObjectByName(zt.name);if(!Qt){LOGGER.error({title:"Plug: "+zt.name+" doesn't exist in "+zt.node.skuID});return}let en=new Quaternion().identity();Qt.getWorldQuaternion(en);let tn=new Vector3(0,1,0);tn.applyQuaternion(en);let sn=new Vector3(0,1,0);sn.applyQuaternion(Kt),sn.negate();let cn=new Quaternion().setFromUnitVectors(tn,sn);if(tn.round(),sn.round(),tn.dot(sn)!==-1)Yt.applyQuaternion(cn);else{let mn=new Vector3(0,1,0),vn=sn.dot(mn);if(vn!==1&&vn!==-1)Yt.rotateOnAxis(mn,Math.PI);else{let _n=new Vector3(0,0,1),En=sn.dot(_n);if(En!==1&&En!==-1)Yt.rotateOnAxis(_n,Math.PI);else{let An=new Vector3(1,0,0),Tn=sn.dot(An);Tn!==1&&Tn!==-1&&Yt.rotateOnAxis(An,Math.PI)}}}let hn=Yt.getObjectByName(zt.name),fn=new Vector3(hn.position.x,hn.position.y,hn.position.z);Yt.translateX(-fn.x),Yt.translateY(-fn.y),Yt.translateZ(-fn.z);let pn=new Vector3(0,0,0);Yt.getWorldPosition(pn);let dn=new Quaternion().identity();return Yt.getWorldQuaternion(dn),Wt.remove(Ht),Yt=null,{position:pn,rotation:dn}}getSpawningRequirementForSkuID(_e){let Dt=[];const Vt=this.stores.productDataStore.getState().productData,Gt=Vt[_e];if(!Gt)return Dt;const zt=[];return Gt.plugs.map(jt=>{jt.connectsToPlugTypes.map(Ht=>{zt.push(Ht)})}),Object.keys(Vt).map(jt=>{for(let Ht=0;Ht<Vt[jt].plugs.length;Ht++){const Wt=Vt[jt].plugs[Ht].acceptedPlugTypes;for(let qt=0;qt<Wt.length;qt++)zt.map(Xt=>{Xt==Wt[qt]&&!Dt.includes(jt)&&Dt.push(jt)})}}),Dt}getConnectablePlugs(_e,Dt){let Vt=[],Gt=_e.getOpenPlugsWeCanAttachFrom();for(let zt=0;zt<Gt.length;zt++)for(let jt=0;jt<Dt.length;jt++){let Ht=!1;for(let qt=0;qt<Vt.length;qt++)if(Vt[qt].receiverPlug.guid==Dt[jt].guid&&Vt[qt].incomingPlug.type!="comboPlug"){Ht=!0;break}if(Ht)continue;Gt[zt].canAttachToPlug(Dt[jt])&&Vt.push({incomingPlug:Gt[zt],receiverPlug:Dt[jt]})}return Vt}getOpenPlugs(){let _e=[];return this._nodes.map(Dt=>{if(Dt.dragging===!0)return;let Vt=Dt.getOpenPlugsFromNode();_e=_e.concat(Vt)}),_e}checkCollisionForGUID(_e,Dt=[]){if(this.stores.coreSceneStore.getState().sceneSettings.disableCollider)return!1;const Vt=this.stores.itemStore.getState().itemsSpawned,Gt=this.stores.productDataStore.getState().productData;if(!Vt[_e])return!1;const jt=this.getNodeByGUID(_e);if(!jt||!jt.ref||Gt[jt.skuID].disableCollider)return!1;let Ht=new Vector3;jt.ref.getWorldPosition(Ht);let Wt=new Quaternion;jt.ref.getWorldQuaternion(Wt);const qt={position:Ht,rotation:Wt},Xt=jt.whichPlugAreWeAttachedTo();return Xt==null?!1:this.isColliding(jt.skuID,qt,Xt,Dt)}isColliding(_e,{position:Dt,rotation:Vt},Gt,zt=[]){const jt=this.stores.assetStore.getState().assets.items[_e].proxy.data.scene,Ht=this.stores.productDataStore.getState().productData;if(!jt)return!1;let Wt=jt.clone();Wt.position.set(Dt.x,Dt.y,Dt.z),Vt.isQuaternion===!0?Wt.setRotationFromQuaternion(Vt):Vt.isEuler===!0&&Wt.setRotationFromEuler(Vt);let qt=new Box3().setFromObject(Wt),Xt=new Vector3;qt.getCenter(Xt);let Kt=new Object3D;Kt.position.set(Xt.x,Xt.y,Xt.z),Kt.attach(Wt),Kt.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),qt=new Box3().setFromObject(Kt);const Yt=[];if(this._nodes.forEach(Jt=>{if(Gt.node.guid==Jt.guid||Array.isArray(zt)===!0&&zt.includes(Jt.guid)||!Jt.ref||(Ht[Jt.skuID].hasOwnProperty("disableCollider")?Ht[Jt.skuID].disableCollider:this.stores.coreSceneStore.getState().sceneSettings.disableCollider))return;const nn=Jt.ref.getObjectByName("GRP_ProxyMesh");nn&&Yt.push(nn)}),Yt.length<=0)return!1;let Zt=!1;return Yt.forEach(Jt=>{if(Zt)return;let nn=new Box3().setFromObject(Jt);if(qt.intersectsBox(nn)){Zt=!0;return}}),Kt.clear(),Wt=null,Kt=null,qt=null,Zt}boxOverlapPercent(_e,Dt){if(_e.containsBox(Dt)||Dt.containsBox(_e))return 100;if(!(_e.min.x<Dt.max.x||Dt.min.x<_e.max.x))return 0;let Vt=new Vector3(0,0,0);_e.getSize(Vt),Vt.x*Vt.y*Vt.z;let Gt=new Vector3(0,0,0);Dt.getSize(Gt),Gt.x*Gt.y*Gt.z}checkInsideOutCollision(_e,Dt,Vt){let Gt=Dt.position.clone(),zt=new Float32Array(Vt.attributes.position.array),jt=zt.length/3;for(let Ht=0;Ht<jt;Ht++){let Wt=new Vector3(zt[Ht*3],zt[Ht*3+1],zt[Ht*3+2]),qt=Wt.add(Dt.position);qt=Wt.applyQuaternion(Dt.quaternion);let Xt=qt.sub(Dt.position);const Yt=new Raycaster(Gt,Xt.clone().normalize()).intersectObjects(_e),Zt=Yt.length>0,Jt=Yt[0].distance<Xt.length();if(Zt&&Jt)return!0}return!1}addNode(_e){this._nodes.push(_e)}getFirstNodeByCategoryID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt]._categoryID==_e)return this._nodes[Dt];return null}getNodesBySKUID(_e){let Dt=[];for(let Vt=0;Vt<this._nodes.length;Vt++)this._nodes[Vt].skuID==_e&&Dt.push(this._nodes[Vt]);return Dt}getNodesByCategoryID(_e){let Dt=[];for(let Vt=0;Vt<this._nodes.length;Vt++)this._nodes[Vt]._categoryID==_e&&Dt.push(this._nodes[Vt]);return Dt}async connectPlugs({incomingPlug:_e,receiverPlug:Dt}){_e.attachPlug(Dt,!1),Dt.attachPlug(_e,!0),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}removeNodeByGUID(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e){this._nodes[Dt].removeNode(),this._nodes.splice(Dt,1);break}this._nodes.length==1&&this.#e&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Scene_Cleared,!0),this.stores.attachmentStore.getState().actions.updateFittingSkuIds(),this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}async removeNodeFromStructure(_e){for(let Dt=0;Dt<this._nodes.length;Dt++)if(this._nodes[Dt].guid==_e.guid){this._nodes.splice(Dt,1);break}await this.stores.attachmentStore.getState().actions.toggleStructureUpdated()}}class AttachmentSystem{constructor(_e){this._globalVariants={},this._globalGeometryVariants={},this.stores=_e,this.stores.productDataStore.getState().categoryData.geometryVariants.map(Dt=>{this._globalGeometryVariants[Dt.id]=Dt.defaultVariant}),this.stores.productDataStore.getState().categoryData.color.map(Dt=>{this._globalVariants[Dt.id]=Dt.defaultLook}),this._currentStructure=new Structure(this.stores,null,this._globalVariants,this._globalGeometryVariants);for(const[Dt,Vt]of Object.entries(this._globalVariants))this.switchGlobalVariant(Dt,Vt);for(const[Dt,Vt]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(Dt,Vt)}get globalGeometryVariants(){return this._globalGeometryVariants}get globalVariants(){return this._globalVariants}get currentStructure(){return this._currentStructure}getClientProductId(_e,Dt){let Vt;return Vt=this.stores.productDataStore.getState()?.productData[_e]?.lookDetails[Dt],Vt?.clientProductId?Vt?.clientProductId:""}getCartItems(){let _e=[];const Dt=this.stores.inventoryStore.getState().inventoryData;let Vt=!1;this.currentStructure.nodes.map(Ht=>{if(Ht.skuID=="Root"||Ht.ignoreInCart===!0)return;let Wt=!1;if(_e.map(Kt=>{const Yt=Dt[Kt.skuID];if(Kt.skuID==Ht.skuID&&Kt.currentVariant==Ht.currentVariant){Kt.count++,Kt.countAvailable=Yt[Ht.currentVariant].countAvailable,Kt.countUnavailable=Yt[Ht.currentVariant].countUnavailable,Kt.price=Ht.price*Kt.count,Kt.compareAtPrice=Ht.compareAtPrice*Kt.count,Wt=!0;return}}),Wt===!0)return;let qt={};qt.skuID=Ht.skuID,qt.currentVariant=Ht.currentVariant,qt.clientProductId=this.getClientProductId(qt.skuID,qt.currentVariant),qt.count=1;const Xt=Dt[qt.skuID];qt.price=Ht.price,qt.compareAtPrice=Ht.compareAtPrice*qt.count,Ht.compareAtPrice>0&&(Vt=!0),qt.countAvailable=Xt[Ht.currentVariant].countAvailable,qt.countUnavailable=Xt[Ht.currentVariant].countUnavailable,_e.push(qt)});let Gt=0,zt=0;for(const Ht of _e)Gt=Gt+Ht.price,Vt&&(zt=zt+(Ht.compareAtPrice==0?Ht.price:Ht.compareAtPrice));return{cartItems:_e,details:{total:Gt.toFixed(2),compareAtTotal:zt}}}async getCartItemsAsync(){let _e=[];const Dt=this.stores.inventoryStore.getState().inventoryData;let Vt=!1;this.currentStructure.nodes.map(Ht=>{if(Ht.skuID=="Root"||Ht.ignoreInCart===!0)return;let Wt=!1;if(_e.map(Kt=>{const Yt=Dt[Kt.skuID];if(Kt.skuID==Ht.skuID&&Kt.currentVariant==Ht.currentVariant){Kt.count++,Kt.countAvailable=Yt[Ht.currentVariant].countAvailable,Kt.countUnavailable=Yt[Ht.currentVariant].countUnavailable,Kt.price=Ht.price*Kt.count,Kt.compareAtPrice=Ht.compareAtPrice*Kt.count,Wt=!0;return}}),Wt===!0)return;let qt={};qt.skuID=Ht.skuID,qt.currentVariant=Ht.currentVariant,qt.clientProductId=this.getClientProductId(qt.skuID,qt.currentVariant),qt.count=1;const Xt=Dt[qt.skuID];qt.price=Ht.price,qt.compareAtPrice=Ht.compareAtPrice*qt.count,qt.compareAtPrice>0&&(Vt=!0),qt.countAvailable=Xt[Ht.currentVariant].countAvailable,qt.countUnavailable=Xt[Ht.currentVariant].countUnavailable,_e.push(qt)}),_e=await this.stores.dynamicHookStore.getState().hookOnCartItemsCollected(_e,this.stores.coreSceneStore.getState().CORE_API);let Gt=0,zt=0;for(const Ht of _e)Gt=Gt+Ht.price,Vt&&(zt=zt+(Ht.compareAtPrice==0?Ht.price:Ht.compareAtPrice));return{cartItems:_e,details:{total:Gt.toFixed(2),compareAtTotal:zt.toFixed(2)}}}async getFittingSKUIDs(){if(!this.currentStructure)return[];const{productData:_e}=this.stores.productDataStore.getState(),{sceneSettings:Dt}=this.stores.coreSceneStore.getState(),{draggableUI:Vt,ignoreSpawningCollision:Gt}=Dt;if(!this.currentStructure)return[];const{openPlugTypes:zt,closedPlugTypes:jt,existingSkuids:Ht}=this.analyzeCurrentStructure();if(zt.size===0&&jt.size===0)return[];const Wt=this.findFittingSkuids(_e,zt,jt,Ht,Vt);return this.filterNonBlockedSkuids(Wt,_e,Gt)}analyzeCurrentStructure(){const _e=this.currentStructure.nodes,Dt=new Set,Vt=new Set,Gt=new Set;for(const zt of _e){Gt.add(zt.skuID);for(const jt of zt.plugs)jt.isOpen?jt.acceptedPlugTypes.forEach(Ht=>Dt.add(Ht)):jt.attachedPlug.node.replace&&jt.acceptedPlugTypes.forEach(Ht=>Vt.add(Ht))}return{openPlugTypes:Dt,closedPlugTypes:Vt,existingSkuids:Gt}}findFittingSkuids(_e,Dt,Vt,Gt,zt){const jt=new Set;for(const[Ht,Wt]of Object.entries(_e))if(Wt.plugs)for(const qt of Wt.plugs){for(const Xt of qt.connectsToPlugTypes)if((this.isClosedPlugFitting(Ht,Wt,Xt,Vt,Gt,zt)||this.isOpenPlugFitting(Wt,Xt,Dt))&&jt.add(Ht),jt.has(Ht))break;if(jt.has(Ht))break}return jt}isClosedPlugFitting(_e,Dt,Vt,Gt,zt,jt){if(!Gt.has(Vt)||!jt&&zt.has(_e))return!1;const Ht=this.currentStructure.getNodesByCategoryID(Dt.categoryID);for(const Wt of Ht)if(Wt.skuID!==_e&&this.isNodeCompatible(Wt,Dt))return!0;return!1}isNodeCompatible(_e,Dt){let Vt=!1;for(const Gt of _e.plugs)if(!Gt.isOpen&&Gt.isReceiverPlug&&(Vt=!0,this.isPlugCompatible(Gt,Dt.plugs)))return!0;return!Vt}isPlugCompatible(_e,Dt){return Dt.some(Vt=>Vt.name===_e.name&&_e.attachedPlug.connectsToPlugTypes.some(Gt=>Vt.acceptedPlugTypes.includes(Gt)))}isOpenPlugFitting(_e,Dt,Vt){if(!Vt.has(Dt))return!1;const Gt=this.currentStructure.getFirstNodeByCategoryID(_e.categoryID);return!Gt||!Gt.replace}async filterNonBlockedSkuids(_e,Dt,Vt){const Gt=[];for(const zt of _e)if(Dt[zt].replace)Gt.push(zt);else{const jt=await this.currentStructure.findGhostTransforms(zt,Vt);jt&&jt.transforms.length>0&&Gt.push(zt)}return Gt}async removeAllVariantOverrides(){let _e=this._currentStructure.nodes,Dt=this.stores.productDataStore.getState().productData,Vt=this.stores.itemStore.getState().itemsSpawned;return await _e.map(async Gt=>{if(!Gt.overrideVariant||(Gt.overrideVariant=null,!Dt[Gt.skuID].looks))return;let zt=null;Object.keys(this._globalVariants).map(jt=>{Dt[Gt.skuID].looks.includes(this._globalVariants[jt])&&zt==null&&(zt=this._globalVariants[jt])}),zt&&await this.stores.itemStore.getState().actions.switchToVariant(Vt[Gt.guid].itemData,zt)}),this.stores.coreSceneStore.getState().CORE_API.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!1),!0}async switchGlobalGeometryVariant(_e,Dt){const Gt=this.stores.productDataStore.getState().categoryData.geometryVariants;let zt=null;if(Gt.map(Yt=>{Yt.id==_e&&(zt=Yt)}),!zt)return;const jt=zt.productsInCategory,Wt=zt.variants[Dt].productsToSwitch,qt=this.stores.itemStore.getState().itemsSpawned;let Xt=this.stores.productDataStore.getState().categoryData;Wt.map(Yt=>{jt.map(Zt=>{let Jt=!1;Zt.products.map(nn=>{Yt==nn&&(Jt=!0)}),Jt&&Xt.build.map(nn=>{Zt.products.map(rn=>{nn.skus.map((Qt,en)=>{nn.skus[en]==rn&&(nn.skus[en]=Yt)})})})})}),this._currentStructure.nodes.map(Yt=>{jt.map(Zt=>{Zt.products.map(Jt=>{Yt.skuID==Jt&&Yt.ref!==null&&Zt.products.map(nn=>{Wt.map(rn=>{if(rn==nn){const Qt=this.stores.productDataStore.getState().actions.getProductDataById(rn);let en=Qt.geometriesToHide;Yt.plugs.map(sn=>{!sn.isOpen&&sn.attachedPlug&&sn.type=="weighted_hider"&&sn.attachedPlug.weight>sn.weight&&(en=en.concat(sn.affectedNodes))}),Yt.showNodes(Qt.geometriesToShow),Yt.hideNodes(en),Yt.skuID=rn;const tn=qt[Yt.guid];tn&&tn.itemData&&Object.keys(Qt).map(sn=>{tn.itemData[sn]=Qt[sn]}),Yt.resetInStock(),Yt.updatePricing()}})})})})}),this._globalGeometryVariants[_e]=Dt,this.stores.hotspotStore.getState().actions.checkHotspotHealth(),this.stores.inventoryStore.getState().actions.refreshInventory(qt),this.stores.productDataStore.setState({categoryData:Xt}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CategoryData_Updated,Xt),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const Kt=await this.getCartItemsAsync();Kt&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Kt)}async switchGlobalVariant(_e,Dt){this._globalVariants[_e]=Dt;const Vt=this.stores.itemStore.getState().actions;let Gt=this.stores.itemStore.getState().itemsSpawned;for(let Wt=0;Wt<Object.keys(Gt).length;Wt++){let qt=Gt[Object.keys(Gt)[Wt]];if(qt.itemData.looks&&qt.itemData.looks.includes(Dt)){let Xt=this._currentStructure.getNodeByGUID(qt.itemData.guid);Xt&&!Xt.overrideVariant&&await Vt.switchToVariant(qt.itemData,Dt)}}const zt=this.stores.productDataStore.getState().lookData;this.stores.lightStore.getState().actions.processLookEnvMapOverride(Dt);const jt=_e;Object.keys(Gt).length>0&&this.stores.coreSceneStore.getState().CORE_API.alert({alertMsg:jt.charAt(0).toUpperCase()+jt.slice(1)+" was successfully switched to "+zt[Dt].label+".",alertTime:3e3,alertType:"success",alertLabel:`${jt} Changed`,alertId:"materialVariantChanged"}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),this.stores.itemStore.setState({variantChangeAlert:!this.stores.itemStore.getState().variantChangeAlert});const Ht=await this.getCartItemsAsync();Ht&&this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Ht)}async#e(_e){if(!_e)return;LOGGER.info({title:"Structure to load",details:_e}),delete this._currentStructure,this._globalVariants={..._e.globalVariants},this._globalGeometryVariants=_e.globalGeometryVariants?{..._e.globalGeometryVariants}:{};const Dt=[..._e.structure];this._currentStructure=new Structure(this.stores,Dt,this._globalVariants,this._globalGeometryVariants);for(const[Vt,Gt]of Object.entries(this._globalVariants))this.switchGlobalVariant(Vt,Gt);for(const[Vt,Gt]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(Vt,Gt);LOGGER.info({title:"Structure Loading..."}),await this._currentStructure.load(Dt),LOGGER.info({title:"Structure Loaded."})}async loadStructure(_e){if(!_e)return;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),this.stores.coreSceneStore.setState({configurationLoaded:!1}),await wait(500),await this._currentStructure.clear(),await this.#e(_e),this.stores.coreSceneStore.getState().preconfigurationLoaded?this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide):this.stores.coreSceneStore.setState({preconfigurationLoaded:!0}),this.stores.coreSceneStore.getState().configurationLoadedOnRestart||this.stores.coreSceneStore.setState({configurationLoadedOnRestart:!0}),this.stores.coreSceneStore.setState({configurationLoaded:!0}),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated();const Dt=this.stores.itemStore.getState().itemsSpawned;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Dt}),this.stores.inventoryStore.getState().actions.refreshInventory(Dt),await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}export(){return{experienceId:this.stores.coreSceneStore.getState().CORE_API.experienceId,structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),await this._currentStructure.clear(),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide)}async restart(){LOGGER.warn({title:"Restarting the Scene!!"}),this.stores.itemStore.getState().selectedItemData&&this.stores.itemStore.getState().actions.deselectItem();const _e=this.stores.attachmentStore.getState().defaultConfig;this.stores.coreSceneStore.setState({configurationLoaded:!1,configurationLoadedOnRestart:!1}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Show),await wait(500),await this._currentStructure.clear(),await this.#e(_e),await this.stores.attachmentStore.getState().actions.toggleStructureUpdated(),this.stores.coreSceneStore.setState({configurationLoaded:!0,configurationLoadedOnRestart:!0}),this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.UI.PreloadScreen_Hide);const Dt=this.stores.itemStore.getState().itemsSpawned;this.stores.coreSceneStore.getState().CORE_API.fireEvent(this.stores.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:Dt}),this.stores.inventoryStore.getState().actions.refreshInventory(Dt),await this.stores.attachmentStore.getState().actions.updateFittingSkuIds()}}const createAttachmentStore=kt=>{const _e=attachmentStoreCreator();return _e.setState({stores:kt}),_e},attachmentStoreCreator=()=>create((kt,_e)=>({stores:null,attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async Dt=>{const{actions:Vt,defaultConfig:Gt}=_e();LOGGER.info({title:"Initializing Attachment System!"});const zt=await new AttachmentSystem(Dt);kt({attachmentSystem:zt}),await Vt.updateFittingSkuIds(),await Vt.toggleStructureUpdated()},loadSavedStructureFromConfigID:async Dt=>{const{stores:Vt}=_e();LOGGER.info({title:"Fetching Structure Using ConfigID!"});let Gt="";Dt.length==20&&(Gt=FETCH_CONFIG_ENDPOINT_FB+Dt);let zt=null;return Gt!=""?zt=await getJSONFromEndpoint(Gt):zt=await Vt.nexusApiInstance.getExperienceSaveAndShare(Vt.experienceId,Dt),zt.success===!1?null:Dt.length==20?zt.data:zt.payload.save_data},loadDefaultStructure:async()=>{const{actions:Dt,defaultConfig:Vt}=_e();LOGGER.info({title:"Loading Default Structure!"}),await Dt.loadStructure(Vt)},updateFittingSkuIds:async()=>{const{stores:Dt,attachmentSystem:Vt}=_e();if(!Dt.coreSceneStore.getState().preconfigurationLoaded||!Dt.coreSceneStore.getState().configurationLoaded)return;const Gt=await Vt.getFittingSKUIDs();Gt&&(Dt.itemStore.setState({fittingSkuIds:[...Gt]}),Dt.coreSceneStore.getState().CORE_API.fireEvent(Dt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:Gt}))},toggleStructureUpdated:async()=>{const{attachmentSystem:Dt,stores:Vt}=_e();if(kt(zt=>({structureUpdated:!zt.structureUpdated})),!Vt.coreSceneStore.getState().preconfigurationLoaded||!Vt.coreSceneStore.getState().configurationLoaded)return;Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,Dt.currentStructure.getCurrentItemsInReplaceableCategory());const Gt=await Dt.getCartItemsAsync();Gt&&Vt.coreSceneStore.getState().CORE_API.fireEvent(Vt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.CartItems_Updated,Gt)},loadStructure:async Dt=>{const{attachmentSystem:Vt,stores:Gt}=_e();LOGGER.info({title:"Loading Structure!"}),Vt&&Gt.coreSceneStore.getState().configurationLoaded!==!1&&await Vt.loadStructure(Dt)},export:()=>{const{attachmentSystem:Dt}=_e();if(Dt)return Dt.export()}}})),createInfoStore=kt=>{const _e=infoStoreCreator();return _e.setState({stores:kt}),_e},infoStoreCreator=()=>create((kt,_e)=>({stores:null,infoObject:{},populateInfoObject:Dt=>{kt(Vt=>({infoObject:Dt}))},infoModalOpen:!1,updateInfoModalOpen:Dt=>{kt(Vt=>({infoModalOpen:Dt}))}})),createUIHotspotStore=kt=>{const _e=uiHotspotStoreCreator();return _e.setState({stores:kt}),_e},uiHotspotStoreCreator=()=>create((kt,_e)=>({stores:null,activeHotspotData:null,activeFeatureID:"",actions:{enterHotspotInFeaturesTab(Vt){const{stores:Gt}=_e();Gt.uiSceneStore.getState().sideMenuState!==2&&Gt.uiSceneStore.setState({sideMenuState:2}),kt({activeFeatureID:Vt})},exitHotspot(){kt({activeFeatureID:null})}}})),createColorStore=kt=>{const _e=colorStoreCreator();return _e.setState({stores:kt}),_e},colorStoreCreator=()=>create((kt,_e)=>({stores:null,allActiveVariants:{},allActiveGeometryVariants:{}})),arrayWithoutElementAtIndex=function(kt,_e){return kt.filter(function(Dt,Vt){return _e!==Vt})},updateQuantityAtIndex=function(kt,_e,Dt){let Vt=kt.slice();return Vt[_e].quantity=Dt,Vt},createCartStore=kt=>{const _e=cartStoreCreator();return _e.setState({stores:kt}),_e},cartStoreCreator=()=>create((kt,_e)=>({stores:null,cart:[],cartTotalPrice:0,cartTotalCompareAtPrice:0,deleteCartItem:Dt=>{kt(Vt=>({cart:arrayWithoutElementAtIndex(Vt.cart,Dt)}))},addToCart:Dt=>{kt(Vt=>({cart:[...Vt.cart,Dt]}))},updateQuantity:(Dt,Vt)=>{kt(Gt=>({cart:updateQuantityAtIndex(Gt.cart,Dt,Vt)}))},previewCartModalOpen:!1,togglePreviewCartModal:()=>{const{previewCartModalOpen:Dt,stores:Vt}=_e();Dt===!0?Vt.uiSceneStore.getState().CORE_API.reviewCartHidden():Vt.uiSceneStore.getState().CORE_API.reviewCartShown(),kt({previewCartModalOpen:!Dt})},actions:{setCartTotalPrice:(Dt,Vt)=>{kt(()=>({cartTotalPrice:Dt,cartTotalCompareAtPrice:Vt}))}}})),createLightStore=kt=>{const _e=lightStoreCreator();return _e.setState({stores:kt}),_e},lightStoreCreator=()=>create((kt,_e)=>({stores:null,defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:Dt=>{kt(Vt=>({envMapUrl:Dt}))},processLookEnvMapOverride:Dt=>{const{envMapUrl:Vt,defaultEnvMapUrl:Gt,actions:zt,stores:jt}=_e(),Ht=jt.productDataStore.getState().lookData[Dt],Wt=Ht?.envMapOverride;if(!Ht||!Wt){zt.setEnvLightMap(Gt);return}if(Wt===Vt){LOGGER.info({title:`New Env Map Url is the same as the current ${Wt}`});return}zt.setEnvLightMap(Wt)}}})),createHotspotStore=kt=>{const _e=hotspotStoreCreator();return _e.setState({stores:kt}),_e},hotspotStoreCreator=()=>create((kt,_e)=>({stores:null,activeHotspotData:null,lastActiveHotspotData:null,isAnyHotspotActive:!1,hotspotsVisibility:!1,hotspotsTempVisibility:!0,hotspotsHealthCheck:!0,hotspotsSpawned:{},visitedHotspotsID:[],hotspotSpawnedForCategoryIDs:[],actions:{clearAllHotspots:()=>kt({isAnyHotspotActive:!1,activeHotspotData:null,lastActiveHotspotData:null,hotspotsSpawned:{}}),removeHotspotForItem(Dt){const{hotspotsSpawned:Vt}=_e();Object.keys(Vt).map(Gt=>{Vt[Gt].itemData.guid==Dt.itemData.guid&&delete Vt[Gt]}),kt({hotspotsSpawned:{...Vt}})},checkHotspotHealth(){const{hotspotsHealthCheck:Dt}=_e();kt({hotspotsHealthCheck:!Dt})},toggleHotspotVisibility(){const{hotspotsVisibility:Dt}=_e();kt({hotspotsVisibility:!Dt})},switchHotspotsVisibility(Dt,Vt=!1){kt(Vt===!0?{hotspotsTempVisibility:Dt}:{hotspotsVisibility:Dt})},clickHotspot(Dt,Vt,Gt,zt=!1){const{activeHotspotData:jt,stores:Ht}=_e();kt({lastActiveHotspotData:jt}),hotspotEnter(Ht,Dt,Vt,Gt);let qt=Ht.itemStore.getState().itemsSpawned[Gt].itemData.skuID;zt===!1&&(Ht.coreSceneStore.getState().CORE_API.fireEvent(Ht.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Hotspot_Enter,{hotspotAbsID:generateHotspotAbsoluteID(qt,Dt),hotspot:jt}),Ht.coreSceneStore.getState().CORE_API.fireEvent(Ht.coreSceneStore.getState().CORE_API.EVENTS.UI.UtilityMenu_Hide))},exitHotspot(Dt=!1){const{activeHotspotData:Vt,isAnyHotspotActive:Gt,stores:zt}=_e();if(Gt&&kt({isAnyHotspotActive:!1}),!!Vt&&(kt({lastActiveHotspotData:Vt}),hotspotExit(zt),Dt===!1)){const jt=Math.round((performance.now()-_e().lastActiveHotspotData.hotspotEnterTime)/1e3);zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Hotspot_Exit,{hotspot:_e().lastActiveHotspotData,hotspotTimeSpent:jt}),zt.coreSceneStore.getState().CORE_API.fireEvent(zt.coreSceneStore.getState().CORE_API.EVENTS.UI.UtilityMenu_Show)}}}}));function hotspotExit(kt){kt.hotspotStore.setState({activeHotspotData:null}),kt.coreSceneStore.getState().actions.triggerAutoFocus()}function hotspotEnter(kt,_e,Dt,Vt){let Gt=kt.hotspotStore.getState();const jt=kt.itemStore.getState().itemsSpawned;let Ht=Gt.visitedHotspotsID;const Wt=jt[Vt].hotspotsData.filter(un=>un.hotspotID==_e);if(!Wt||Wt.length<=0)return;const qt=Wt[0],Xt=jt[Vt].itemData.skuID+"_"+_e;let Yt=kt.attachmentStore.getState().attachmentSystem.currentStructure.getNodeByGUID(Vt),Zt=new Vector3(0,0,0);Yt&&Yt.ref&&Yt.ref.getWorldPosition(Zt);let Jt=new Quaternion().identity();Yt&&Yt.ref&&Yt.ref.getWorldQuaternion(Jt);let nn=qt.focusPointTransform,rn=ArrToVec3(nn);rn.applyQuaternion(Jt);let Qt=qt.viewPointTransform,en=ArrToVec3(Qt);en.applyQuaternion(Jt);let tn=addVector(Vec3ToArr(rn),Vec3ToArr(Zt)),sn=addVector(Vec3ToArr(en),Vec3ToArr(Zt));kt.cameraStore.setState({focusPointPosition:tn,viewPointPosition:sn}),kt.hotspotStore.setState({activeHotspotData:{hotspotData:{guid:Dt,...qt},itemData:{...jt[Vt],guid:Vt},domID:"rd_"+Xt,hotspotEnterTime:performance.now()},isAnyHotspotActive:!0}),Ht.includes(Xt)||(Ht.push(Xt),kt.hotspotStore.setState({visitedIDs:{...Ht}}))}var replacingNodes=null,swappableNodes=[];const createGhostStore=kt=>{const _e=ghostStoreCreator();return _e.setState({stores:kt}),_e},ghostStoreCreator=()=>create((kt,_e)=>({stores:null,ghostData:null,ghostsTransform:[],ghostVisibility:!0,ghostParentRef:null,ghostMaterial:null,actions:{spawnGhostsForSkuID:async(Dt,Vt=!1,Gt)=>{const{ghostData:zt,ghostsTransform:jt,stores:Ht}=_e();if(zt!==null||jt.length>0){LOGGER.info({title:"ghosts are already spawned for: "+zt.skuID});return}return await new Promise(async(qt,Xt)=>{let Kt={};const Yt=()=>{qt(Kt)};Ht.coreSceneStore.getState().CORE_API.coreWCRef.addEventListener(Ht.coreSceneStore.getState().CORE_API.EVENTS.SCENE.Ghost_Loaded,Yt,{once:!0});const Zt=Ht.productDataStore.getState().productData,Jt=Ht.attachmentStore.getState().attachmentSystem.currentStructure;replacingNodes=Jt.getNodesByCategoryID(Zt[Dt].categoryID);const nn=Ht.coreSceneStore.getState().sceneSettings.draggableUI,rn=await Jt.findGhostTransforms(Dt,Vt),Qt=nn?rn&&rn.transforms&&rn.transforms.length===0:!0;if(Zt[Dt].replace&&replacingNodes.length>0&&Qt)if(nn){const{newNodes:tn,transforms:sn,connectablePlugs:cn}=await Jt.findGhostTransformForReplacement(Dt,replacingNodes);if(sn==null||cn==null||sn.length<=0){LOGGER.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+Dt});return}let un=[];for(const hn of tn)hn.setModelVisibility(!1),un.push("replace");Kt.transforms=sn,Kt.newNodes=tn,Kt.connectablePlugs=cn,Kt.addItemOrSwap=un}else{const{newNodes:tn,transforms:sn,connectablePlugs:cn}=await Jt.findGhostTransformForReplacement(Dt,replacingNodes);if(sn==null&&cn==null){LOGGER.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+Dt});return}let un=[];for(const hn of tn)hn.setModelVisibility(!1),un.push("replace");Kt.transforms=sn,Kt.newNodes=tn,Kt.connectablePlugs=cn,Kt.addItemOrSwap=un}else{const{transforms:tn,newNodes:sn,connectablePlugs:cn,comboPlugs:un}=rn;let hn=tn,fn=cn,pn=sn,dn=[];for(let mn=0;mn<tn.length;mn++)dn.push("add");if(Zt[Dt].swappable&&!Ht.coreSceneStore.getState().dragging){swappableNodes=Jt.getNodesByCategoryID(Zt[Dt].categoryID);const mn=await Jt.findGhostTransformForReplacement(Dt,swappableNodes);if(mn.transforms)for(let vn=0;vn<mn.transforms.length;vn++)hn.push(mn.transforms[vn]),fn.push(mn.connectablePlugs[vn]),pn.push(mn.newNodes[vn]),dn.push("replace"),mn.newNodes[vn].setModelVisibility(!1)}Kt.transforms=hn,Kt.newNodes=pn,Kt.connectablePlugs=fn,Kt.comboPlugs=un,Kt.addItemOrSwap=dn}if(Kt.transforms.length<=0){Xt();return}const en=await Ht.assetStore.getState().actions.loadProxyAsset(Dt,!0);kt({ghostsTransform:Kt.transforms,ghostData:{proxyScene:en.proxy.data.scene,skuID:Dt,newNodes:Kt.newNodes,addItemOrSwap:Kt.addItemOrSwap,connectablePlugs:Kt.connectablePlugs,comboPlugs:Kt.comboPlugs,count:Gt||Kt.transforms.length}})})},clearAllGhosts:()=>{const{ghostsTransform:Dt}=_e();if(replacingNodes)for(const Vt of replacingNodes)Vt.setModelVisibility(!0);if(swappableNodes)for(let Vt=0;Vt<swappableNodes.length;Vt++)swappableNodes[Vt].setModelVisibility(!0);Dt.length<=0||kt({ghostVisibility:!0,ghostData:null,ghostsTransform:[]})}}})),createCameraStore=kt=>{const _e=cameraStoreCreator();return _e.setState({stores:kt}),_e},cameraStoreCreator=()=>create((kt,_e)=>({stores:null,focusPointPosition:new Vector3(0,0,0),sendCameraDetailsTrigger:!1,viewPointPosition:new Vector3(0,0,0),boundsMargin:0,savedState:!1,resetToLastPosition:!0,cameraControlsRef:null,userDragging:!1,disableAutoRotate:!1,cameraSettings:{truckSpeed:1,fov:35,dollySpeed:1,initialViewPointPosition:new Vector3(20,15,50),canZoom:!1,canPan:!1,minZoom:1,maxZoom:3,canAutoRotate:!1,autoRotateSpeed:.5,minPolarAngle:0,maxPolarAngle:180,clearColour:"white",zoomingMultiplier:0},actions:{canCameraRotate:Dt=>{const{cameraControlsRef:Vt}=_e();Vt&&(Dt===!0?(Vt.mouseButtons.left=CAMERA_ACTION.ROTATE,Vt.touches.one=CAMERA_ACTION.TOUCH_ROTATE):(Vt.mouseButtons.left=CAMERA_ACTION.NONE,Vt.touches.one=CAMERA_ACTION.NONE))},triggerFetchingCamera:()=>{kt(Dt=>({sendCameraDetailsTrigger:!Dt.sendCameraDetailsTrigger}))},setCameraSettings:Dt=>{const{cameraSettings:Vt,stores:Gt}=_e();Gt.coreSceneStore.getState().isMobile===!0&&Dt.zoomingMultiplier_mobile!==void 0?Dt.zoomingMultiplier=Dt.zoomingMultiplier_mobile:Dt.zoomingMultiplier_desktop!==void 0&&(Dt.zoomingMultiplier=Dt.zoomingMultiplier_desktop),Object.keys(Dt).map(jt=>Vt[jt]=Dt[jt]),kt({cameraSettings:{...Vt},viewPointPosition:ArrToVec3(Vt.initialViewPointPosition)})}}})),createUISceneStore=kt=>{const _e=uiSceneStoreCreator();return _e.setState({stores:kt}),_e},uiSceneStoreCreator=()=>create((kt,_e)=>({stores:null,CORE_API:null,sideMenuState:0,cssLoaded:!1,isScreenPortrait:!0,materialOverrideExists:!1,tabSpawnCount:[],coreWCRef:null,removeModalOpen:!1,outOfStockModalOpen:!1,disableCart:!1,inventoryData:{},cartMessage:"",loadConfigId:"",dialogPopupOpen:!1,viewInYourSpaceMenuBtnVisible:!1,loadConfigModalOpen:!1,setLoadConfigModalOpen:Dt=>kt({loadConfigModalOpen:Dt}),setOutOfStockModalOpen:Dt=>kt({outOfStockModalOpen:Dt}),setRemoveModalOpen:Dt=>kt({removeModalOpen:Dt}),moveModalOpen:!1,setMoveModalOpen:Dt=>kt({moveModalOpen:Dt}),setCSSLoaded:Dt=>{kt({cssLoaded:Dt})},setSideMenuState:Dt=>{kt(()=>({sideMenuState:Dt}));const{CORE_API:Vt}=_e();Dt!==2?Vt.exitHotspot():Vt.showAllHotspots()}})),createDynamicHookStore=kt=>{const _e=dynamicHookStoreCreator();return _e.setState({stores:kt}),_e},dynamicHookStoreCreator=()=>create((kt,_e)=>({hookOnCartItemsCollected:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnCartItemsCollected"}),Promise.resolve(Dt)),hookOnSceneItemsUpdated:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnSceneItemsUpdated"}),Promise.resolve()),hookOnNewItemGhostsCollected:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnNewItemGhostsCollected"}),Promise.resolve(Dt)),hookOnNewItemGhostsCollectedForReplacement:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnNewItemGhostsCollected"}),Promise.resolve(Dt)),hookOnSceneItemAdded:async(Dt,Vt,Gt)=>(LOGGER.info({title:"No hook provided: hookOnSceneItemAdded"}),Promise.resolve()),hookOnCheckout:async(Dt,Vt)=>(LOGGER.info({title:"No hook provided: hookOnSceneItemAdded"}),Promise.resolve(Dt))}));class STORES{experienceId="";uuid=null;wcRef=null;nexusApiResponseEnvironment="production";nexusApiInstance=null;productDataStore=null;coreSceneStore=null;inventoryStore=null;itemStore=null;assetStore=null;attachmentStore=null;lightStore=null;hotspotStore=null;ghostStore=null;cameraStore=null;infoStore=null;uiHotspotStore=null;colorStore=null;cartStore=null;uiSceneStore=null;constructor(_e){this.wcRef=_e,this.uuid=v4(),this.dynamicHookStore=createDynamicHookStore(this),this.productDataStore=createProductDataStore(this),this.coreSceneStore=createCoreSceneStore(this),this.inventoryStore=createInventoryStore(this),this.itemStore=createItemStore(this),this.assetStore=createAssetStore(this),this.attachmentStore=createAttachmentStore(this),this.lightStore=createLightStore(this),this.hotspotStore=createHotspotStore(this),this.ghostStore=createGhostStore(this),this.cameraStore=createCameraStore(this),this.infoStore=createInfoStore(this),this.uiHotspotStore=createUIHotspotStore(this),this.colorStore=createColorStore(this),this.cartStore=createCartStore(this),this.uiSceneStore=createUISceneStore(this)}setupNexusApiInstance(_e){let Dt=p$5.PRODUCTION;_e=="local"?Dt=p$5.LOCAL:_e==="staging"&&(Dt=p$5.STAGING);const Vt=window.location.href,Gt=window.epigraph?window.epigraph.epigraphSessionId:"no-session-id",zt="2.1.1-alpha",jt=g$3.generateXPath(this.wcRef);this.nexusApiInstance=new P$2(Dt,Vt,Gt,zt,jt)}}class EpigraphConfigurator extends h$5{#e=void 0;#t=null;#r=null;clientAccessKey=null;validationPassed=!1;projectID="";configID="default";customVersionId="";experienceId="";apiMode="production";gaMeasurementId="";#i=getUrlParameterByName("launchInAR")==="true";#n=!1;api={core:null,ui:null};stores=null;constructor(){let _e=s$2.PRODUCTION;super("2.1.1-alpha",_e),this.stores=new STORES(this),this.api.ui=this,this.shadowRoot||this.attachShadow({mode:"open"}),this.hasAttribute("launch-in-ar")&&(this.#i=!0),this.#o(),this.#a()}#o(){this.preloadDiv=document.createElement("div"),this.preloadDiv.id="preloadMainContainer",this.preloadDiv.classList.add("preload-main-container"),this.preloadDiv.classList.add("showPreload"),this.preloadDiv.appendChild(PRELOAD_MUTED_CSS.content.cloneNode(!0)),this.preloadDiv.appendChild(PRELOAD_HTML_TEMPLATE.content.cloneNode(!0)),this.shadowRoot.appendChild(this.preloadDiv);const _e=this.shadowRoot;this.#r=Dt=>{if(Dt.code=="Enter"){let Vt=_e.activeElement;Vt&&Vt.click()}if(this.stores?.coreSceneStore?.getState()?.CORE_API?.epigraphAnalytics){const Vt=new D$2(Dt.code);this.stores.coreSceneStore.getState().CORE_API.epigraphAnalytics.sendEvent(Vt)}},this.shadowRoot.addEventListener("keyup",this.#r)}#a(){this.hiccupUi=document.createElement("div"),this.hiccupUi.id="hiccupMainContainer",this.hiccupUi.classList.add("hiccup-ui-main-container"),this.hiccupUi.appendChild(HICCUP_MUTED_CSS.content.cloneNode(!0)),this.hiccupUi.appendChild(HICCUP_HTML_TEMPLATE.content.cloneNode(!0)),this.shadowRoot.appendChild(this.hiccupUi)}get configuratorWcId(){return this.#e}get launchInAr(){return this.#i}#s(){if(this.hasAttribute("id")?this.#e=this.getAttribute("id"):(this.setAttribute("id","epigraphConfiguratorWc"),this.#e=this.getAttribute("id")),this.hasAttribute("custom-version-id")&&(this.customVersionId=this.getAttribute("custom-version-id")),this.hasAttribute("experience-id")&&(this.experienceId=this.getAttribute("experience-id")),this.hasAttribute("api-mode")){const _e=this.getAttribute("api-mode");["local","staging","production"].includes(_e)&&(this.apiMode=_e)}this.stores.setupNexusApiInstance(this.apiMode),(this.hasAttribute("ga-measurement-id")||this.hasAttribute("ga-code"))&&(this.gaMeasurementId=this.getAttribute("ga-measurement-id")??this.getAttribute("ga-code")),this.clientAccessKey=this.getAttribute("client-access-key"),this.initialConfigId=this.getAttribute("initial-config-id"),this.consentPlugin=this.getAttribute("consent-plugin"),this.consentIdentifier=this.getAttribute("consent-identifier"),this.initialConfigId||(this.initialConfigId="default")}async connectedCallback(){if(this.#n===!0){console.warn("Tried to remount configurator. Blocking the process.");return}this.#s(),this.style.maxWidth="1440px",this.style.maxHeight="800px",this.style.overflow="hidden",this.style.width="100%",this.style.height="100%",this.style.position="relative",this.style.visibility="visible",this.style.display="flex";const _e=document.createElement("div");_e.id="configuratorContainer",_e.style.width="100%",_e.style.height="100%",_e.style.userSelect="none",_e.style.overflow="hidden",this.shadowRoot.appendChild(_e),this.#t=createRoot(_e),this.#t.render(jsxRuntimeExports.jsx(App,{stores:this.stores,customVersionId:this.customVersionId,experienceId:this.experienceId,disableUI:this.hasAttribute("disable-ui"),disableCart:this.hasAttribute("disable-cart"),configuratorWcRef:this,gaMeasurementId:this.gaMeasurementId},"Configurator-App")),this.#n=!0}disconnectedCallback(){for(this.#t&&(this.#t.unmount(),this.#t=null),this.#r&&(this.shadowRoot.removeEventListener("keyup",this.#r),this.#r=null),this.#e=void 0,this.clientAccessKey=null,this.validationPassed=!1,this.projectID="",this.configID="default",this.customVersionId="",this.gaMeasurementId="",this.#i=!1,this.#n=!1,this.api={core:null,ui:null},this.preloadDiv&&(this.preloadDiv.remove(),this.preloadDiv=null),this.hiccupUi&&(this.hiccupUi.remove(),this.hiccupUi=null);this.shadowRoot.firstChild;)this.shadowRoot.removeChild(this.shadowRoot.firstChild)}showPreloadScreen(){this.preloadDiv&&(this.preloadDiv.classList.remove("no-pointer-events"),this.preloadDiv.classList.add("showPreload"))}async hidePreloadScreen(){this.preloadDiv&&(this.preloadDiv.classList.remove("showPreload"),await wait(1e3),this.preloadDiv.classList.add("no-pointer-events"))}showHiccupScreen(){this.hiccupUi&&(this.hiccupUi.classList.remove("no-pointer-events"),this.hiccupUi.classList.add("show-hiccup"))}async hideHiccupScreen(){this.hiccupUi&&(this.hiccupUi.classList.remove("show-hiccup"),await wait(1e3),this.hiccupUi.classList.add("no-pointer-events"))}}window.customElements.define("epigraph-configurator",EpigraphConfigurator);
|