@aibee/crc-bmap 0.12.24 → 0.12.25
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/lib/index.online.min.js
CHANGED
|
@@ -8167,7 +8167,7 @@ void main() {
|
|
|
8167
8167
|
}
|
|
8168
8168
|
|
|
8169
8169
|
}\`,uh=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){let r=new $t,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){let i=t.cameras[0].viewport,r=new xn({extensions:{fragDepth:!0},vertexShader:tN,fragmentShader:nN,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new on(new bo(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}},hh=class extends ai{constructor(e,t){super();let i=this,r=null,s=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,f=null,m=null,g=null,_=new uh,d=t.getContextAttributes(),p=null,b=null,v=[],E=[],I=new ie,R=null,w=new Gt;w.layers.enable(1),w.viewport=new yt;let B=new Gt;B.layers.enable(2),B.viewport=new yt;let j=[w,B],x=new lh;x.layers.enable(1),x.layers.enable(2);let A=null,re=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(k){let Q=v[k];return Q===void 0&&(Q=new hs,v[k]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(k){let Q=v[k];return Q===void 0&&(Q=new hs,v[k]=Q),Q.getGripSpace()},this.getHand=function(k){let Q=v[k];return Q===void 0&&(Q=new hs,v[k]=Q),Q.getHandSpace()};function K(k){let Q=E.indexOf(k.inputSource);if(Q===-1)return;let me=v[Q];me!==void 0&&(me.update(k.inputSource,k.frame,l||o),me.dispatchEvent({type:k.type,data:k.inputSource}))}function C(){r.removeEventListener("select",K),r.removeEventListener("selectstart",K),r.removeEventListener("selectend",K),r.removeEventListener("squeeze",K),r.removeEventListener("squeezestart",K),r.removeEventListener("squeezeend",K),r.removeEventListener("end",C),r.removeEventListener("inputsourceschange",W);for(let k=0;k<v.length;k++){let Q=E[k];Q!==null&&(E[k]=null,v[k].disconnect(Q))}A=null,re=null,_.reset(),e.setRenderTarget(p),m=null,f=null,h=null,r=null,b=null,Ie.stop(),i.isPresenting=!1,e.setPixelRatio(R),e.setSize(I.width,I.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(k){s=k,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(k){a=k,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(k){l=k},this.getBaseLayer=function(){return f!==null?f:m},this.getBinding=function(){return h},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=function(k){return Cs(this,null,function*(){if(r=k,r!==null){if(p=e.getRenderTarget(),r.addEventListener("select",K),r.addEventListener("selectstart",K),r.addEventListener("selectend",K),r.addEventListener("squeeze",K),r.addEventListener("squeezestart",K),r.addEventListener("squeezeend",K),r.addEventListener("end",C),r.addEventListener("inputsourceschange",W),d.xrCompatible!==!0&&(yield t.makeXRCompatible()),R=e.getPixelRatio(),e.getSize(I),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let Q={antialias:r.renderState.layers===void 0?d.antialias:!0,alpha:!0,depth:d.depth,stencil:d.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,Q),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),b=new Fn(m.framebufferWidth,m.framebufferHeight,{format:an,type:ii,colorSpace:e.outputColorSpace,stencilBuffer:d.stencil})}else{let Q=null,me=null,Ae=null;d.depth&&(Ae=d.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Q=d.stencil?Tr:Ii,me=d.stencil?Pi:ei);let Me={colorFormat:t.RGBA8,depthFormat:Ae,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(Me),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),b=new Fn(f.textureWidth,f.textureHeight,{format:an,type:ii,depthTexture:new Ao(f.textureWidth,f.textureHeight,me,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:d.stencil,colorSpace:e.outputColorSpace,samples:d.antialias?4:0});let ye=e.properties.get(b);ye.__ignoreDepthValues=f.ignoreDepthValues}b.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=yield r.requestReferenceSpace(a),Ie.setContext(r),Ie.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function W(k){for(let Q=0;Q<k.removed.length;Q++){let me=k.removed[Q],Ae=E.indexOf(me);Ae>=0&&(E[Ae]=null,v[Ae].disconnect(me))}for(let Q=0;Q<k.added.length;Q++){let me=k.added[Q],Ae=E.indexOf(me);if(Ae===-1){for(let ye=0;ye<v.length;ye++)if(ye>=E.length){E.push(me),Ae=ye;break}else if(E[ye]===null){E[ye]=me,Ae=ye;break}if(Ae===-1)break}let Me=v[Ae];Me&&Me.connect(me)}}let G=new U,$=new U;function q(k,Q,me){G.setFromMatrixPosition(Q.matrixWorld),$.setFromMatrixPosition(me.matrixWorld);let Ae=G.distanceTo($),Me=Q.projectionMatrix.elements,ye=me.projectionMatrix.elements,ke=Me[14]/(Me[10]-1),Te=Me[14]/(Me[10]+1),T=(Me[9]+1)/Me[5],oe=(Me[9]-1)/Me[5],Y=(Me[8]-1)/Me[0],se=(ye[8]+1)/ye[0],Z=ke*Y,_e=ke*se,pe=Ae/(-Y+se),xe=pe*-Y;Q.matrixWorld.decompose(k.position,k.quaternion,k.scale),k.translateX(xe),k.translateZ(pe),k.matrixWorld.compose(k.position,k.quaternion,k.scale),k.matrixWorldInverse.copy(k.matrixWorld).invert();let Ge=ke+pe,S=Te+pe,y=Z-xe,V=_e+(Ae-xe),H=T*Te/S*Ge,ee=oe*Te/S*Ge;k.projectionMatrix.makePerspective(y,V,H,ee,Ge,S),k.projectionMatrixInverse.copy(k.projectionMatrix).invert()}function X(k,Q){Q===null?k.matrixWorld.copy(k.matrix):k.matrixWorld.multiplyMatrices(Q.matrixWorld,k.matrix),k.matrixWorldInverse.copy(k.matrixWorld).invert()}this.updateCamera=function(k){if(r===null)return;_.texture!==null&&(k.near=_.depthNear,k.far=_.depthFar),x.near=B.near=w.near=k.near,x.far=B.far=w.far=k.far,(A!==x.near||re!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),A=x.near,re=x.far,w.near=A,w.far=re,B.near=A,B.far=re,w.updateProjectionMatrix(),B.updateProjectionMatrix(),k.updateProjectionMatrix());let Q=k.parent,me=x.cameras;X(x,Q);for(let Ae=0;Ae<me.length;Ae++)X(me[Ae],Q);me.length===2?q(x,w,B):x.projectionMatrix.copy(w.projectionMatrix),ne(k,x,Q)};function ne(k,Q,me){me===null?k.matrix.copy(Q.matrixWorld):(k.matrix.copy(me.matrixWorld),k.matrix.invert(),k.matrix.multiply(Q.matrixWorld)),k.matrix.decompose(k.position,k.quaternion,k.scale),k.updateMatrixWorld(!0),k.projectionMatrix.copy(Q.projectionMatrix),k.projectionMatrixInverse.copy(Q.projectionMatrixInverse),k.isPerspectiveCamera&&(k.fov=Yu*2*Math.atan(1/k.projectionMatrix.elements[5]),k.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(f===null&&m===null))return c},this.setFoveation=function(k){c=k,f!==null&&(f.fixedFoveation=k),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=k)},this.hasDepthSensing=function(){return _.texture!==null};let te=null;function ve(k,Q){if(u=Q.getViewerPose(l||o),g=Q,u!==null){let me=u.views;m!==null&&(e.setRenderTargetFramebuffer(b,m.framebuffer),e.setRenderTarget(b));let Ae=!1;me.length!==x.cameras.length&&(x.cameras.length=0,Ae=!0);for(let ye=0;ye<me.length;ye++){let ke=me[ye],Te=null;if(m!==null)Te=m.getViewport(ke);else{let oe=h.getViewSubImage(f,ke);Te=oe.viewport,ye===0&&(e.setRenderTargetTextures(b,oe.colorTexture,f.ignoreDepthValues?void 0:oe.depthStencilTexture),e.setRenderTarget(b))}let T=j[ye];T===void 0&&(T=new Gt,T.layers.enable(ye),T.viewport=new yt,j[ye]=T),T.matrix.fromArray(ke.transform.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale),T.projectionMatrix.fromArray(ke.projectionMatrix),T.projectionMatrixInverse.copy(T.projectionMatrix).invert(),T.viewport.set(Te.x,Te.y,Te.width,Te.height),ye===0&&(x.matrix.copy(T.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),Ae===!0&&x.cameras.push(T)}let Me=r.enabledFeatures;if(Me&&Me.includes("depth-sensing")){let ye=h.getDepthInformation(me[0]);ye&&ye.isValid&&ye.texture&&_.init(e,ye,r.renderState)}}for(let me=0;me<v.length;me++){let Ae=E[me],Me=v[me];Ae!==null&&Me!==void 0&&Me.update(Ae,Q,l||o)}_.render(e,x),te&&te(k,Q),Q.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Q}),g=null}let Ie=new hy;Ie.setAnimationLoop(ve),this.setAnimationLoop=function(k){te=k},this.dispose=function(){}}},bi=new Ui,iN=new ft;function rN(n,e){function t(d,p){d.matrixAutoUpdate===!0&&d.updateMatrix(),p.value.copy(d.matrix)}function i(d,p){p.color.getRGB(d.fogColor.value,uy(n)),p.isFog?(d.fogNear.value=p.near,d.fogFar.value=p.far):p.isFogExp2&&(d.fogDensity.value=p.density)}function r(d,p,b,v,E){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(d,p):p.isMeshToonMaterial?(s(d,p),h(d,p)):p.isMeshPhongMaterial?(s(d,p),u(d,p)):p.isMeshStandardMaterial?(s(d,p),f(d,p),p.isMeshPhysicalMaterial&&m(d,p,E)):p.isMeshMatcapMaterial?(s(d,p),g(d,p)):p.isMeshDepthMaterial?s(d,p):p.isMeshDistanceMaterial?(s(d,p),_(d,p)):p.isMeshNormalMaterial?s(d,p):p.isLineBasicMaterial?(o(d,p),p.isLineDashedMaterial&&a(d,p)):p.isPointsMaterial?c(d,p,b,v):p.isSpriteMaterial?l(d,p):p.isShadowMaterial?(d.color.value.copy(p.color),d.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(d,p){d.opacity.value=p.opacity,p.color&&d.diffuse.value.copy(p.color),p.emissive&&d.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(d.map.value=p.map,t(p.map,d.mapTransform)),p.alphaMap&&(d.alphaMap.value=p.alphaMap,t(p.alphaMap,d.alphaMapTransform)),p.bumpMap&&(d.bumpMap.value=p.bumpMap,t(p.bumpMap,d.bumpMapTransform),d.bumpScale.value=p.bumpScale,p.side===Dt&&(d.bumpScale.value*=-1)),p.normalMap&&(d.normalMap.value=p.normalMap,t(p.normalMap,d.normalMapTransform),d.normalScale.value.copy(p.normalScale),p.side===Dt&&d.normalScale.value.negate()),p.displacementMap&&(d.displacementMap.value=p.displacementMap,t(p.displacementMap,d.displacementMapTransform),d.displacementScale.value=p.displacementScale,d.displacementBias.value=p.displacementBias),p.emissiveMap&&(d.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,d.emissiveMapTransform)),p.specularMap&&(d.specularMap.value=p.specularMap,t(p.specularMap,d.specularMapTransform)),p.alphaTest>0&&(d.alphaTest.value=p.alphaTest);let b=e.get(p),v=b.envMap,E=b.envMapRotation;if(v&&(d.envMap.value=v,bi.copy(E),bi.x*=-1,bi.y*=-1,bi.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(bi.y*=-1,bi.z*=-1),d.envMapRotation.value.setFromMatrix4(iN.makeRotationFromEuler(bi)),d.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=p.reflectivity,d.ior.value=p.ior,d.refractionRatio.value=p.refractionRatio),p.lightMap){d.lightMap.value=p.lightMap;let I=n._useLegacyLights===!0?Math.PI:1;d.lightMapIntensity.value=p.lightMapIntensity*I,t(p.lightMap,d.lightMapTransform)}p.aoMap&&(d.aoMap.value=p.aoMap,d.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,d.aoMapTransform))}function o(d,p){d.diffuse.value.copy(p.color),d.opacity.value=p.opacity,p.map&&(d.map.value=p.map,t(p.map,d.mapTransform))}function a(d,p){d.dashSize.value=p.dashSize,d.totalSize.value=p.dashSize+p.gapSize,d.scale.value=p.scale}function c(d,p,b,v){d.diffuse.value.copy(p.color),d.opacity.value=p.opacity,d.size.value=p.size*b,d.scale.value=v*.5,p.map&&(d.map.value=p.map,t(p.map,d.uvTransform)),p.alphaMap&&(d.alphaMap.value=p.alphaMap,t(p.alphaMap,d.alphaMapTransform)),p.alphaTest>0&&(d.alphaTest.value=p.alphaTest)}function l(d,p){d.diffuse.value.copy(p.color),d.opacity.value=p.opacity,d.rotation.value=p.rotation,p.map&&(d.map.value=p.map,t(p.map,d.mapTransform)),p.alphaMap&&(d.alphaMap.value=p.alphaMap,t(p.alphaMap,d.alphaMapTransform)),p.alphaTest>0&&(d.alphaTest.value=p.alphaTest)}function u(d,p){d.specular.value.copy(p.specular),d.shininess.value=Math.max(p.shininess,1e-4)}function h(d,p){p.gradientMap&&(d.gradientMap.value=p.gradientMap)}function f(d,p){d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,d.roughnessMapTransform)),e.get(p).envMap&&(d.envMapIntensity.value=p.envMapIntensity)}function m(d,p,b){d.ior.value=p.ior,p.sheen>0&&(d.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),d.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(d.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,d.sheenColorMapTransform)),p.sheenRoughnessMap&&(d.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,d.sheenRoughnessMapTransform))),p.clearcoat>0&&(d.clearcoat.value=p.clearcoat,d.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(d.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,d.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,d.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(d.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,d.clearcoatNormalMapTransform),d.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Dt&&d.clearcoatNormalScale.value.negate())),p.iridescence>0&&(d.iridescence.value=p.iridescence,d.iridescenceIOR.value=p.iridescenceIOR,d.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(d.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,d.iridescenceMapTransform)),p.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,d.iridescenceThicknessMapTransform))),p.transmission>0&&(d.transmission.value=p.transmission,d.transmissionSamplerMap.value=b.texture,d.transmissionSamplerSize.value.set(b.width,b.height),p.transmissionMap&&(d.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,d.transmissionMapTransform)),d.thickness.value=p.thickness,p.thicknessMap&&(d.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,d.thicknessMapTransform)),d.attenuationDistance.value=p.attenuationDistance,d.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(d.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(d.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,d.anisotropyMapTransform))),d.specularIntensity.value=p.specularIntensity,d.specularColor.value.copy(p.specularColor),p.specularColorMap&&(d.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,d.specularColorMapTransform)),p.specularIntensityMap&&(d.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,d.specularIntensityMapTransform))}function g(d,p){p.matcap&&(d.matcap.value=p.matcap)}function _(d,p){let b=e.get(p).light;d.referencePosition.value.setFromMatrixPosition(b.matrixWorld),d.nearDistance.value=b.shadow.camera.near,d.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function sN(n,e,t,i){let r={},s={},o=[],a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(b,v){let E=v.program;i.uniformBlockBinding(b,E)}function l(b,v){let E=r[b.id];E===void 0&&(g(b),E=u(b),r[b.id]=E,b.addEventListener("dispose",d));let I=v.program;i.updateUBOMapping(b,I);let R=e.render.frame;s[b.id]!==R&&(f(b),s[b.id]=R)}function u(b){let v=h();b.__bindingPointIndex=v;let E=n.createBuffer(),I=b.__size,R=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,I,R),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,E),E}function h(){for(let b=0;b<a;b++)if(o.indexOf(b)===-1)return o.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(b){let v=r[b.id],E=b.uniforms,I=b.__cache;n.bindBuffer(n.UNIFORM_BUFFER,v);for(let R=0,w=E.length;R<w;R++){let B=Array.isArray(E[R])?E[R]:[E[R]];for(let j=0,x=B.length;j<x;j++){let A=B[j];if(m(A,R,j,I)===!0){let re=A.__offset,K=Array.isArray(A.value)?A.value:[A.value],C=0;for(let W=0;W<K.length;W++){let G=K[W],$=_(G);typeof G=="number"||typeof G=="boolean"?(A.__data[0]=G,n.bufferSubData(n.UNIFORM_BUFFER,re+C,A.__data)):G.isMatrix3?(A.__data[0]=G.elements[0],A.__data[1]=G.elements[1],A.__data[2]=G.elements[2],A.__data[3]=0,A.__data[4]=G.elements[3],A.__data[5]=G.elements[4],A.__data[6]=G.elements[5],A.__data[7]=0,A.__data[8]=G.elements[6],A.__data[9]=G.elements[7],A.__data[10]=G.elements[8],A.__data[11]=0):(G.toArray(A.__data,C),C+=$.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,re,A.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function m(b,v,E,I){let R=b.value,w=v+"_"+E;if(I[w]===void 0)return typeof R=="number"||typeof R=="boolean"?I[w]=R:I[w]=R.clone(),!0;{let B=I[w];if(typeof R=="number"||typeof R=="boolean"){if(B!==R)return I[w]=R,!0}else if(B.equals(R)===!1)return B.copy(R),!0}return!1}function g(b){let v=b.uniforms,E=0,I=16;for(let w=0,B=v.length;w<B;w++){let j=Array.isArray(v[w])?v[w]:[v[w]];for(let x=0,A=j.length;x<A;x++){let re=j[x],K=Array.isArray(re.value)?re.value:[re.value];for(let C=0,W=K.length;C<W;C++){let G=K[C],$=_(G),q=E%I;q!==0&&I-q<$.boundary&&(E+=I-q),re.__data=new Float32Array($.storage/Float32Array.BYTES_PER_ELEMENT),re.__offset=E,E+=$.storage}}}let R=E%I;return R>0&&(E+=I-R),b.__size=E,b.__cache={},this}function _(b){let v={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(v.boundary=4,v.storage=4):b.isVector2?(v.boundary=8,v.storage=8):b.isVector3||b.isColor?(v.boundary=16,v.storage=12):b.isVector4?(v.boundary=16,v.storage=16):b.isMatrix3?(v.boundary=48,v.storage=48):b.isMatrix4?(v.boundary=64,v.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),v}function d(b){let v=b.target;v.removeEventListener("dispose",d);let E=o.indexOf(v.__bindingPointIndex);o.splice(E,1),n.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function p(){for(let b in r)n.deleteBuffer(r[b]);o=[],r={},s={}}return{bind:c,update:l,dispose:p}}var fh=class{constructor(e={}){let{canvas:t=lP(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;let m=new Uint32Array(4),g=new Int32Array(4),_=null,d=null,p=[],b=[];this.domElement=t,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=vn,this._useLegacyLights=!1,this.toneMapping=ni,this.toneMappingExposure=1;let v=this,E=!1,I=0,R=0,w=null,B=-1,j=null,x=new yt,A=new yt,re=null,K=new Xe(0),C=0,W=t.width,G=t.height,$=1,q=null,X=null,ne=new yt(0,0,W,G),te=new yt(0,0,W,G),ve=!1,Ie=new So,k=!1,Q=!1,me=null,Ae=new ft,Me=new ie,ye=new U,ke={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Te(){return w===null?$:1}let T=i;function oe(M,N){for(let F=0;F<M.length;F++){let z=M[F],D=t.getContext(z,N);if(D!==null)return D}return null}try{let M={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",\`three.js r\${Dh}\`),t.addEventListener("webglcontextlost",tt,!1),t.addEventListener("webglcontextrestored",P,!1),t.addEventListener("webglcontextcreationerror",fe,!1),T===null){let N=["webgl2","webgl","experimental-webgl"];if(v.isWebGL1Renderer===!0&&N.shift(),T=oe(N,M),T===null)throw oe(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&T instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),T.getShaderPrecisionFormat===void 0&&(T.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let Y,se,Z,_e,pe,xe,Ge,S,y,V,H,ee,J,Le,Re,le,he,Ue,ae,lt,He,we,Se,be;function Ye(){Y=new ML(T),se=new mL(T,Y,e),Y.init(se),we=new QU(T,Y,se),Z=new KU(T,Y,se),_e=new EL(T),pe=new zU,xe=new jU(T,Y,Z,pe,se,we,_e),Ge=new vL(v),S=new xL(v),y=new PP(T,se),Se=new dL(T,Y,y,se),V=new SL(T,y,_e,Se),H=new RL(T,V,y,_e),ae=new wL(T,se,xe),le=new gL(pe),ee=new BU(v,Ge,S,Y,se,Se,le),J=new rN(v,pe),Le=new VU,Re=new YU(Y,se),Ue=new fL(v,Ge,S,Z,H,f,c),he=new JU(v,H,se),be=new sN(T,_e,se,Z),lt=new pL(T,Y,_e,se),He=new bL(T,Y,_e,se),_e.programs=ee.programs,v.capabilities=se,v.extensions=Y,v.properties=pe,v.renderLists=Le,v.shadowMap=he,v.state=Z,v.info=_e}Ye();let De=new hh(v,T);this.xr=De,this.getContext=function(){return T},this.getContextAttributes=function(){return T.getContextAttributes()},this.forceContextLoss=function(){let M=Y.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){let M=Y.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(M){M!==void 0&&($=M,this.setSize(W,G,!1))},this.getSize=function(M){return M.set(W,G)},this.setSize=function(M,N,F=!0){if(De.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=M,G=N,t.width=Math.floor(M*$),t.height=Math.floor(N*$),F===!0&&(t.style.width=M+"px",t.style.height=N+"px"),this.setViewport(0,0,M,N)},this.getDrawingBufferSize=function(M){return M.set(W*$,G*$).floor()},this.setDrawingBufferSize=function(M,N,F){W=M,G=N,$=F,t.width=Math.floor(M*F),t.height=Math.floor(N*F),this.setViewport(0,0,M,N)},this.getCurrentViewport=function(M){return M.copy(x)},this.getViewport=function(M){return M.copy(ne)},this.setViewport=function(M,N,F,z){M.isVector4?ne.set(M.x,M.y,M.z,M.w):ne.set(M,N,F,z),Z.viewport(x.copy(ne).multiplyScalar($).round())},this.getScissor=function(M){return M.copy(te)},this.setScissor=function(M,N,F,z){M.isVector4?te.set(M.x,M.y,M.z,M.w):te.set(M,N,F,z),Z.scissor(A.copy(te).multiplyScalar($).round())},this.getScissorTest=function(){return ve},this.setScissorTest=function(M){Z.setScissorTest(ve=M)},this.setOpaqueSort=function(M){q=M},this.setTransparentSort=function(M){X=M},this.getClearColor=function(M){return M.copy(Ue.getClearColor())},this.setClearColor=function(){Ue.setClearColor.apply(Ue,arguments)},this.getClearAlpha=function(){return Ue.getClearAlpha()},this.setClearAlpha=function(){Ue.setClearAlpha.apply(Ue,arguments)},this.clear=function(M=!0,N=!0,F=!0){let z=0;if(M){let D=!1;if(w!==null){let ge=w.texture.format;D=ge===ry||ge===iy||ge===ny}if(D){let ge=w.texture.type,Ee=ge===ii||ge===ei||ge===Oh||ge===Pi||ge===ey||ge===ty,Ce=Ue.getClearColor(),Pe=Ue.getClearAlpha(),Ve=Ce.r,Ne=Ce.g,Oe=Ce.b;Ee?(m[0]=Ve,m[1]=Ne,m[2]=Oe,m[3]=Pe,T.clearBufferuiv(T.COLOR,0,m)):(g[0]=Ve,g[1]=Ne,g[2]=Oe,g[3]=Pe,T.clearBufferiv(T.COLOR,0,g))}else z|=T.COLOR_BUFFER_BIT}N&&(z|=T.DEPTH_BUFFER_BIT),F&&(z|=T.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),T.clear(z)},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(){t.removeEventListener("webglcontextlost",tt,!1),t.removeEventListener("webglcontextrestored",P,!1),t.removeEventListener("webglcontextcreationerror",fe,!1),Le.dispose(),Re.dispose(),pe.dispose(),Ge.dispose(),S.dispose(),H.dispose(),Se.dispose(),be.dispose(),ee.dispose(),he.dispose(),De.dispose(),De.removeEventListener("sessionstart",Ht),De.removeEventListener("sessionend",je),me&&(me.dispose(),me=null),Tt.stop()};function tt(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),E=!0}function P(){console.log("THREE.WebGLRenderer: Context Restored."),E=!1;let M=_e.autoReset,N=he.enabled,F=he.autoUpdate,z=he.needsUpdate,D=he.type;Ye(),_e.autoReset=M,he.enabled=N,he.autoUpdate=F,he.needsUpdate=z,he.type=D}function fe(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function O(M){let N=M.target;N.removeEventListener("dispose",O),ce(N)}function ce(M){de(M),pe.remove(M)}function de(M){let N=pe.get(M).programs;N!==void 0&&(N.forEach(function(F){ee.releaseProgram(F)}),M.isShaderMaterial&&ee.releaseShaderCache(M))}this.renderBufferDirect=function(M,N,F,z,D,ge){N===null&&(N=ke);let Ee=D.isMesh&&D.matrixWorld.determinant()<0,Ce=Yx(M,N,F,z,D);Z.setMaterial(z,Ee);let Pe=F.index,Ve=1;if(z.wireframe===!0){if(Pe=V.getWireframeAttribute(F),Pe===void 0)return;Ve=2}let Ne=F.drawRange,Oe=F.attributes.position,ct=Ne.start*Ve,Ft=(Ne.start+Ne.count)*Ve;ge!==null&&(ct=Math.max(ct,ge.start*Ve),Ft=Math.min(Ft,(ge.start+ge.count)*Ve)),Pe!==null?(ct=Math.max(ct,0),Ft=Math.min(Ft,Pe.count)):Oe!=null&&(ct=Math.max(ct,0),Ft=Math.min(Ft,Oe.count));let mt=Ft-ct;if(mt<0||mt===1/0)return;Se.setup(D,z,Ce,F,Pe);let Mn,st=lt;if(Pe!==null&&(Mn=y.get(Pe),st=He,st.setIndex(Mn)),D.isMesh)z.wireframe===!0?(Z.setLineWidth(z.wireframeLinewidth*Te()),st.setMode(T.LINES)):st.setMode(T.TRIANGLES);else if(D.isLine){let Fe=z.linewidth;Fe===void 0&&(Fe=1),Z.setLineWidth(Fe*Te()),D.isLineSegments?st.setMode(T.LINES):D.isLineLoop?st.setMode(T.LINE_LOOP):st.setMode(T.LINE_STRIP)}else D.isPoints?st.setMode(T.POINTS):D.isSprite&&st.setMode(T.TRIANGLES);if(D.isBatchedMesh)st.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else if(D.isInstancedMesh)st.renderInstances(ct,mt,D.count);else if(F.isInstancedBufferGeometry){let Fe=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,Wo=Math.min(F.instanceCount,Fe);st.renderInstances(ct,mt,Wo)}else st.render(ct,mt)};function qe(M,N,F){M.transparent===!0&&M.side===Un&&M.forceSinglePass===!1?(M.side=Dt,M.needsUpdate=!0,Rs(M,N,F),M.side=si,M.needsUpdate=!0,Rs(M,N,F),M.side=Un):Rs(M,N,F)}this.compile=function(M,N,F=null){F===null&&(F=M),d=Re.get(F),d.init(),b.push(d),F.traverseVisible(function(D){D.isLight&&D.layers.test(N.layers)&&(d.pushLight(D),D.castShadow&&d.pushShadow(D))}),M!==F&&M.traverseVisible(function(D){D.isLight&&D.layers.test(N.layers)&&(d.pushLight(D),D.castShadow&&d.pushShadow(D))}),d.setupLights(v._useLegacyLights);let z=new Set;return M.traverse(function(D){let ge=D.material;if(ge)if(Array.isArray(ge))for(let Ee=0;Ee<ge.length;Ee++){let Ce=ge[Ee];qe(Ce,F,D),z.add(Ce)}else qe(ge,F,D),z.add(ge)}),b.pop(),d=null,z},this.compileAsync=function(M,N,F=null){let z=this.compile(M,N,F);return new Promise(D=>{function ge(){if(z.forEach(function(Ee){pe.get(Ee).currentProgram.isReady()&&z.delete(Ee)}),z.size===0){D(M);return}setTimeout(ge,10)}Y.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let Ke=null;function vt(M){Ke&&Ke(M)}function Ht(){Tt.stop()}function je(){Tt.start()}let Tt=new hy;Tt.setAnimationLoop(vt),typeof self!="undefined"&&Tt.setContext(self),this.setAnimationLoop=function(M){Ke=M,De.setAnimationLoop(M),M===null?Tt.stop():Tt.start()},De.addEventListener("sessionstart",Ht),De.addEventListener("sessionend",je),this.render=function(M,N){if(N!==void 0&&N.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(E===!0)return;M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),De.enabled===!0&&De.isPresenting===!0&&(De.cameraAutoUpdate===!0&&De.updateCamera(N),N=De.getCamera()),M.isScene===!0&&M.onBeforeRender(v,M,N,w),d=Re.get(M,b.length),d.init(),b.push(d),Ae.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),Ie.setFromProjectionMatrix(Ae),Q=this.localClippingEnabled,k=le.init(this.clippingPlanes,Q),_=Le.get(M,p.length),_.init(),p.push(_),un(M,N,0,v.sortObjects),_.finish(),v.sortObjects===!0&&_.sort(q,X),this.info.render.frame++,k===!0&&le.beginShadows();let F=d.state.shadowsArray;if(he.render(F,M,N),k===!0&&le.endShadows(),this.info.autoReset===!0&&this.info.reset(),(De.enabled===!1||De.isPresenting===!1||De.hasDepthSensing()===!1)&&Ue.render(_,M),d.setupLights(v._useLegacyLights),N.isArrayCamera){let z=N.cameras;for(let D=0,ge=z.length;D<ge;D++){let Ee=z[D];mf(_,M,Ee,Ee.viewport)}}else mf(_,M,N);w!==null&&(xe.updateMultisampleRenderTarget(w),xe.updateRenderTargetMipmap(w)),M.isScene===!0&&M.onAfterRender(v,M,N),Se.resetDefaultState(),B=-1,j=null,b.pop(),b.length>0?d=b[b.length-1]:d=null,p.pop(),p.length>0?_=p[p.length-1]:_=null};function un(M,N,F,z){if(M.visible===!1)return;if(M.layers.test(N.layers)){if(M.isGroup)F=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(N);else if(M.isLight)d.pushLight(M),M.castShadow&&d.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Ie.intersectsSprite(M)){z&&ye.setFromMatrixPosition(M.matrixWorld).applyMatrix4(Ae);let Ee=H.update(M),Ce=M.material;Ce.visible&&_.push(M,Ee,Ce,F,ye.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Ie.intersectsObject(M))){let Ee=H.update(M),Ce=M.material;if(z&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),ye.copy(M.boundingSphere.center)):(Ee.boundingSphere===null&&Ee.computeBoundingSphere(),ye.copy(Ee.boundingSphere.center)),ye.applyMatrix4(M.matrixWorld).applyMatrix4(Ae)),Array.isArray(Ce)){let Pe=Ee.groups;for(let Ve=0,Ne=Pe.length;Ve<Ne;Ve++){let Oe=Pe[Ve],ct=Ce[Oe.materialIndex];ct&&ct.visible&&_.push(M,Ee,ct,F,ye.z,Oe)}}else Ce.visible&&_.push(M,Ee,Ce,F,ye.z,null)}}let ge=M.children;for(let Ee=0,Ce=ge.length;Ee<Ce;Ee++)un(ge[Ee],N,F,z)}function mf(M,N,F,z){let D=M.opaque,ge=M.transmissive,Ee=M.transparent;d.setupLightsView(F),k===!0&&le.setGlobalState(v.clippingPlanes,F),ge.length>0&&Xx(D,ge,N,F),z&&Z.viewport(x.copy(z)),D.length>0&&ws(D,N,F),ge.length>0&&ws(ge,N,F),Ee.length>0&&ws(Ee,N,F),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Xx(M,N,F,z){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;let ge=se.isWebGL2;me===null&&(me=new Fn(1,1,{generateMipmaps:!0,type:Y.has("EXT_color_buffer_half_float")?ps:ii,minFilter:wi,samples:ge?4:0})),v.getDrawingBufferSize(Me),ge?me.setSize(Me.x,Me.y):me.setSize($u(Me.x),$u(Me.y));let Ee=v.getRenderTarget();v.setRenderTarget(me),v.getClearColor(K),C=v.getClearAlpha(),C<1&&v.setClearColor(16777215,.5),v.clear();let Ce=v.toneMapping;v.toneMapping=ni,ws(M,F,z),xe.updateMultisampleRenderTarget(me),xe.updateRenderTargetMipmap(me);let Pe=!1;for(let Ve=0,Ne=N.length;Ve<Ne;Ve++){let Oe=N[Ve],ct=Oe.object,Ft=Oe.geometry,mt=Oe.material,Mn=Oe.group;if(mt.side===Un&&ct.layers.test(z.layers)){let st=mt.side;mt.side=Dt,mt.needsUpdate=!0,gf(ct,F,z,Ft,mt,Mn),mt.side=st,mt.needsUpdate=!0,Pe=!0}}Pe===!0&&(xe.updateMultisampleRenderTarget(me),xe.updateRenderTargetMipmap(me)),v.setRenderTarget(Ee),v.setClearColor(K,C),v.toneMapping=Ce}function ws(M,N,F){let z=N.isScene===!0?N.overrideMaterial:null;for(let D=0,ge=M.length;D<ge;D++){let Ee=M[D],Ce=Ee.object,Pe=Ee.geometry,Ve=z===null?Ee.material:z,Ne=Ee.group;Ce.layers.test(F.layers)&&gf(Ce,N,F,Pe,Ve,Ne)}}function gf(M,N,F,z,D,ge){M.onBeforeRender(v,N,F,z,D,ge),M.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),D.onBeforeRender(v,N,F,z,M,ge),D.transparent===!0&&D.side===Un&&D.forceSinglePass===!1?(D.side=Dt,D.needsUpdate=!0,v.renderBufferDirect(F,N,z,D,M,ge),D.side=si,D.needsUpdate=!0,v.renderBufferDirect(F,N,z,D,M,ge),D.side=Un):v.renderBufferDirect(F,N,z,D,M,ge),M.onAfterRender(v,N,F,z,D,ge)}function Rs(M,N,F){N.isScene!==!0&&(N=ke);let z=pe.get(M),D=d.state.lights,ge=d.state.shadowsArray,Ee=D.state.version,Ce=ee.getParameters(M,D.state,ge,N,F),Pe=ee.getProgramCacheKey(Ce),Ve=z.programs;z.environment=M.isMeshStandardMaterial?N.environment:null,z.fog=N.fog,z.envMap=(M.isMeshStandardMaterial?S:Ge).get(M.envMap||z.environment),z.envMapRotation=z.environment!==null&&M.envMap===null?N.environmentRotation:M.envMapRotation,Ve===void 0&&(M.addEventListener("dispose",O),Ve=new Map,z.programs=Ve);let Ne=Ve.get(Pe);if(Ne!==void 0){if(z.currentProgram===Ne&&z.lightsStateVersion===Ee)return _f(M,Ce),Ne}else Ce.uniforms=ee.getUniforms(M),M.onBuild(F,Ce,v),M.onBeforeCompile(Ce,v),Ne=ee.acquireProgram(Ce,Pe),Ve.set(Pe,Ne),z.uniforms=Ce.uniforms;let Oe=z.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Oe.clippingPlanes=le.uniform),_f(M,Ce),z.needsLights=Zx(M),z.lightsStateVersion=Ee,z.needsLights&&(Oe.ambientLightColor.value=D.state.ambient,Oe.lightProbe.value=D.state.probe,Oe.directionalLights.value=D.state.directional,Oe.directionalLightShadows.value=D.state.directionalShadow,Oe.spotLights.value=D.state.spot,Oe.spotLightShadows.value=D.state.spotShadow,Oe.rectAreaLights.value=D.state.rectArea,Oe.ltc_1.value=D.state.rectAreaLTC1,Oe.ltc_2.value=D.state.rectAreaLTC2,Oe.pointLights.value=D.state.point,Oe.pointLightShadows.value=D.state.pointShadow,Oe.hemisphereLights.value=D.state.hemi,Oe.directionalShadowMap.value=D.state.directionalShadowMap,Oe.directionalShadowMatrix.value=D.state.directionalShadowMatrix,Oe.spotShadowMap.value=D.state.spotShadowMap,Oe.spotLightMatrix.value=D.state.spotLightMatrix,Oe.spotLightMap.value=D.state.spotLightMap,Oe.pointShadowMap.value=D.state.pointShadowMap,Oe.pointShadowMatrix.value=D.state.pointShadowMatrix),z.currentProgram=Ne,z.uniformsList=null,Ne}function vf(M){if(M.uniformsList===null){let N=M.currentProgram.getUniforms();M.uniformsList=br.seqWithValue(N.seq,M.uniforms)}return M.uniformsList}function _f(M,N){let F=pe.get(M);F.outputColorSpace=N.outputColorSpace,F.batching=N.batching,F.instancing=N.instancing,F.instancingColor=N.instancingColor,F.instancingMorph=N.instancingMorph,F.skinning=N.skinning,F.morphTargets=N.morphTargets,F.morphNormals=N.morphNormals,F.morphColors=N.morphColors,F.morphTargetsCount=N.morphTargetsCount,F.numClippingPlanes=N.numClippingPlanes,F.numIntersection=N.numClipIntersection,F.vertexAlphas=N.vertexAlphas,F.vertexTangents=N.vertexTangents,F.toneMapping=N.toneMapping}function Yx(M,N,F,z,D){N.isScene!==!0&&(N=ke),xe.resetTextureUnits();let ge=N.fog,Ee=z.isMeshStandardMaterial?N.environment:null,Ce=w===null?v.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:ci,Pe=(z.isMeshStandardMaterial?S:Ge).get(z.envMap||Ee),Ve=z.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,Ne=!!F.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Oe=!!F.morphAttributes.position,ct=!!F.morphAttributes.normal,Ft=!!F.morphAttributes.color,mt=ni;z.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(mt=v.toneMapping);let Mn=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,st=Mn!==void 0?Mn.length:0,Fe=pe.get(z),Wo=d.state.lights;if(k===!0&&(Q===!0||M!==j)){let Wt=M===j&&z.id===B;le.setState(z,M,Wt)}let nt=!1;z.version===Fe.__version?(Fe.needsLights&&Fe.lightsStateVersion!==Wo.state.version||Fe.outputColorSpace!==Ce||D.isBatchedMesh&&Fe.batching===!1||!D.isBatchedMesh&&Fe.batching===!0||D.isInstancedMesh&&Fe.instancing===!1||!D.isInstancedMesh&&Fe.instancing===!0||D.isSkinnedMesh&&Fe.skinning===!1||!D.isSkinnedMesh&&Fe.skinning===!0||D.isInstancedMesh&&Fe.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&Fe.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&Fe.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&Fe.instancingMorph===!1&&D.morphTexture!==null||Fe.envMap!==Pe||z.fog===!0&&Fe.fog!==ge||Fe.numClippingPlanes!==void 0&&(Fe.numClippingPlanes!==le.numPlanes||Fe.numIntersection!==le.numIntersection)||Fe.vertexAlphas!==Ve||Fe.vertexTangents!==Ne||Fe.morphTargets!==Oe||Fe.morphNormals!==ct||Fe.morphColors!==Ft||Fe.toneMapping!==mt||se.isWebGL2===!0&&Fe.morphTargetsCount!==st)&&(nt=!0):(nt=!0,Fe.__version=z.version);let li=Fe.currentProgram;nt===!0&&(li=Rs(z,N,D));let yf=!1,Fr=!1,qo=!1,Mt=li.getUniforms(),ui=Fe.uniforms;if(Z.useProgram(li.program)&&(yf=!0,Fr=!0,qo=!0),z.id!==B&&(B=z.id,Fr=!0),yf||j!==M){Mt.setValue(T,"projectionMatrix",M.projectionMatrix),Mt.setValue(T,"viewMatrix",M.matrixWorldInverse);let Wt=Mt.map.cameraPosition;Wt!==void 0&&Wt.setValue(T,ye.setFromMatrixPosition(M.matrixWorld)),se.logarithmicDepthBuffer&&Mt.setValue(T,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&Mt.setValue(T,"isOrthographic",M.isOrthographicCamera===!0),j!==M&&(j=M,Fr=!0,qo=!0)}if(D.isSkinnedMesh){Mt.setOptional(T,D,"bindMatrix"),Mt.setOptional(T,D,"bindMatrixInverse");let Wt=D.skeleton;Wt&&(se.floatVertexTextures?(Wt.boneTexture===null&&Wt.computeBoneTexture(),Mt.setValue(T,"boneTexture",Wt.boneTexture,xe)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}D.isBatchedMesh&&(Mt.setOptional(T,D,"batchingTexture"),Mt.setValue(T,"batchingTexture",D._matricesTexture,xe));let Xo=F.morphAttributes;if((Xo.position!==void 0||Xo.normal!==void 0||Xo.color!==void 0&&se.isWebGL2===!0)&&ae.update(D,F,li),(Fr||Fe.receiveShadow!==D.receiveShadow)&&(Fe.receiveShadow=D.receiveShadow,Mt.setValue(T,"receiveShadow",D.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(ui.envMap.value=Pe,ui.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),Fr&&(Mt.setValue(T,"toneMappingExposure",v.toneMappingExposure),Fe.needsLights&&$x(ui,qo),ge&&z.fog===!0&&J.refreshFogUniforms(ui,ge),J.refreshMaterialUniforms(ui,z,$,G,me),br.upload(T,vf(Fe),ui,xe)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(br.upload(T,vf(Fe),ui,xe),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&Mt.setValue(T,"center",D.center),Mt.setValue(T,"modelViewMatrix",D.modelViewMatrix),Mt.setValue(T,"normalMatrix",D.normalMatrix),Mt.setValue(T,"modelMatrix",D.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){let Wt=z.uniformsGroups;for(let Yo=0,Jx=Wt.length;Yo<Jx;Yo++)if(se.isWebGL2){let xf=Wt[Yo];be.update(xf,li),be.bind(xf,li)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return li}function $x(M,N){M.ambientLightColor.needsUpdate=N,M.lightProbe.needsUpdate=N,M.directionalLights.needsUpdate=N,M.directionalLightShadows.needsUpdate=N,M.pointLights.needsUpdate=N,M.pointLightShadows.needsUpdate=N,M.spotLights.needsUpdate=N,M.spotLightShadows.needsUpdate=N,M.rectAreaLights.needsUpdate=N,M.hemisphereLights.needsUpdate=N}function Zx(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(M,N,F){pe.get(M.texture).__webglTexture=N,pe.get(M.depthTexture).__webglTexture=F;let z=pe.get(M);z.__hasExternalTextures=!0,z.__autoAllocateDepthBuffer=F===void 0,z.__autoAllocateDepthBuffer||Y.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),z.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(M,N){let F=pe.get(M);F.__webglFramebuffer=N,F.__useDefaultFramebuffer=N===void 0},this.setRenderTarget=function(M,N=0,F=0){w=M,I=N,R=F;let z=!0,D=null,ge=!1,Ee=!1;if(M){let Pe=pe.get(M);Pe.__useDefaultFramebuffer!==void 0?(Z.bindFramebuffer(T.FRAMEBUFFER,null),z=!1):Pe.__webglFramebuffer===void 0?xe.setupRenderTarget(M):Pe.__hasExternalTextures&&xe.rebindTextures(M,pe.get(M.texture).__webglTexture,pe.get(M.depthTexture).__webglTexture);let Ve=M.texture;(Ve.isData3DTexture||Ve.isDataArrayTexture||Ve.isCompressedArrayTexture)&&(Ee=!0);let Ne=pe.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(Ne[N])?D=Ne[N][F]:D=Ne[N],ge=!0):se.isWebGL2&&M.samples>0&&xe.useMultisampledRTT(M)===!1?D=pe.get(M).__webglMultisampledFramebuffer:Array.isArray(Ne)?D=Ne[F]:D=Ne,x.copy(M.viewport),A.copy(M.scissor),re=M.scissorTest}else x.copy(ne).multiplyScalar($).floor(),A.copy(te).multiplyScalar($).floor(),re=ve;if(Z.bindFramebuffer(T.FRAMEBUFFER,D)&&se.drawBuffers&&z&&Z.drawBuffers(M,D),Z.viewport(x),Z.scissor(A),Z.setScissorTest(re),ge){let Pe=pe.get(M.texture);T.framebufferTexture2D(T.FRAMEBUFFER,T.COLOR_ATTACHMENT0,T.TEXTURE_CUBE_MAP_POSITIVE_X+N,Pe.__webglTexture,F)}else if(Ee){let Pe=pe.get(M.texture),Ve=N||0;T.framebufferTextureLayer(T.FRAMEBUFFER,T.COLOR_ATTACHMENT0,Pe.__webglTexture,F||0,Ve)}B=-1},this.readRenderTargetPixels=function(M,N,F,z,D,ge,Ee){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ce=pe.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Ee!==void 0&&(Ce=Ce[Ee]),Ce){Z.bindFramebuffer(T.FRAMEBUFFER,Ce);try{let Pe=M.texture,Ve=Pe.format,Ne=Pe.type;if(Ve!==an&&we.convert(Ve)!==T.getParameter(T.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Oe=Ne===ps&&(Y.has("EXT_color_buffer_half_float")||se.isWebGL2&&Y.has("EXT_color_buffer_float"));if(Ne!==ii&&we.convert(Ne)!==T.getParameter(T.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ne===Nn&&(se.isWebGL2||Y.has("OES_texture_float")||Y.has("WEBGL_color_buffer_float")))&&!Oe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=M.width-z&&F>=0&&F<=M.height-D&&T.readPixels(N,F,z,D,we.convert(Ve),we.convert(Ne),ge)}finally{let Pe=w!==null?pe.get(w).__webglFramebuffer:null;Z.bindFramebuffer(T.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(M,N,F=0){let z=Math.pow(2,-F),D=Math.floor(N.image.width*z),ge=Math.floor(N.image.height*z);xe.setTexture2D(N,0),T.copyTexSubImage2D(T.TEXTURE_2D,F,0,0,M.x,M.y,D,ge),Z.unbindTexture()},this.copyTextureToTexture=function(M,N,F,z=0){let D=N.image.width,ge=N.image.height,Ee=we.convert(F.format),Ce=we.convert(F.type);xe.setTexture2D(F,0),T.pixelStorei(T.UNPACK_FLIP_Y_WEBGL,F.flipY),T.pixelStorei(T.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),T.pixelStorei(T.UNPACK_ALIGNMENT,F.unpackAlignment),N.isDataTexture?T.texSubImage2D(T.TEXTURE_2D,z,M.x,M.y,D,ge,Ee,Ce,N.image.data):N.isCompressedTexture?T.compressedTexSubImage2D(T.TEXTURE_2D,z,M.x,M.y,N.mipmaps[0].width,N.mipmaps[0].height,Ee,N.mipmaps[0].data):T.texSubImage2D(T.TEXTURE_2D,z,M.x,M.y,Ee,Ce,N.image),z===0&&F.generateMipmaps&&T.generateMipmap(T.TEXTURE_2D),Z.unbindTexture()},this.copyTextureToTexture3D=function(M,N,F,z,D=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let ge=Math.round(M.max.x-M.min.x),Ee=Math.round(M.max.y-M.min.y),Ce=M.max.z-M.min.z+1,Pe=we.convert(z.format),Ve=we.convert(z.type),Ne;if(z.isData3DTexture)xe.setTexture3D(z,0),Ne=T.TEXTURE_3D;else if(z.isDataArrayTexture||z.isCompressedArrayTexture)xe.setTexture2DArray(z,0),Ne=T.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}T.pixelStorei(T.UNPACK_FLIP_Y_WEBGL,z.flipY),T.pixelStorei(T.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),T.pixelStorei(T.UNPACK_ALIGNMENT,z.unpackAlignment);let Oe=T.getParameter(T.UNPACK_ROW_LENGTH),ct=T.getParameter(T.UNPACK_IMAGE_HEIGHT),Ft=T.getParameter(T.UNPACK_SKIP_PIXELS),mt=T.getParameter(T.UNPACK_SKIP_ROWS),Mn=T.getParameter(T.UNPACK_SKIP_IMAGES),st=F.isCompressedTexture?F.mipmaps[D]:F.image;T.pixelStorei(T.UNPACK_ROW_LENGTH,st.width),T.pixelStorei(T.UNPACK_IMAGE_HEIGHT,st.height),T.pixelStorei(T.UNPACK_SKIP_PIXELS,M.min.x),T.pixelStorei(T.UNPACK_SKIP_ROWS,M.min.y),T.pixelStorei(T.UNPACK_SKIP_IMAGES,M.min.z),F.isDataTexture||F.isData3DTexture?T.texSubImage3D(Ne,D,N.x,N.y,N.z,ge,Ee,Ce,Pe,Ve,st.data):z.isCompressedArrayTexture?T.compressedTexSubImage3D(Ne,D,N.x,N.y,N.z,ge,Ee,Ce,Pe,st.data):T.texSubImage3D(Ne,D,N.x,N.y,N.z,ge,Ee,Ce,Pe,Ve,st),T.pixelStorei(T.UNPACK_ROW_LENGTH,Oe),T.pixelStorei(T.UNPACK_IMAGE_HEIGHT,ct),T.pixelStorei(T.UNPACK_SKIP_PIXELS,Ft),T.pixelStorei(T.UNPACK_SKIP_ROWS,mt),T.pixelStorei(T.UNPACK_SKIP_IMAGES,Mn),D===0&&z.generateMipmaps&&T.generateMipmap(Ne),Z.unbindTexture()},this.initTexture=function(M){M.isCubeTexture?xe.setTextureCube(M,0):M.isData3DTexture?xe.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?xe.setTexture2DArray(M,0):xe.setTexture2D(M,0),Z.unbindTexture()},this.resetState=function(){I=0,R=0,w=null,Z.reset(),Se.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Dn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===Fh?"display-p3":"srgb",t.unpackColorSpace=Je.workingColorSpace===Lo?"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}},dh=class extends fh{};dh.prototype.isWebGL1Renderer=!0;var To=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=qu,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=On()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return cy("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,t){this.updateRanges.push({start:e,count:t})}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,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=On()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}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=On()),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}}},Pt=new U,vs=class n{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)Pt.fromBufferAttribute(this,t),Pt.applyMatrix4(e),this.setXYZ(t,Pt.x,Pt.y,Pt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Pt.fromBufferAttribute(this,t),Pt.applyNormalMatrix(e),this.setXYZ(t,Pt.x,Pt.y,Pt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Pt.fromBufferAttribute(this,t),Pt.transformDirection(e),this.setXYZ(t,Pt.x,Pt.y,Pt.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=yn(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Ze(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ze(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=yn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=yn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=yn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=yn(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ze(t,this.array),i=Ze(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ze(t,this.array),i=Ze(i,this.array),r=Ze(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ze(t,this.array),i=Ze(i,this.array),r=Ze(r,this.array),s=Ze(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new rt(new this.array.constructor(t),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 n(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.");let t=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,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}}},ph=class extends Ni{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Xe(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}},jn,cs=new U,mr=new U,gr=new U,vr=new ie,ls=new ie,vy=new ft,Ka=new U,us=new U,ja=new U,W0=new ie,Du=new ie,q0=new ie,mh=class extends cn{constructor(e=new ph){if(super(),this.isSprite=!0,this.type="Sprite",jn===void 0){jn=new Ot;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new To(t,5);jn.setIndex([0,1,2,0,2,3]),jn.setAttribute("position",new vs(i,3,0,!1)),jn.setAttribute("uv",new vs(i,2,3,!1))}this.geometry=jn,this.material=e,this.center=new ie(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),mr.setFromMatrixScale(this.matrixWorld),vy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),gr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&mr.multiplyScalar(-gr.z);let i=this.material.rotation,r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));let o=this.center;Qa(Ka.set(-.5,-.5,0),gr,o,mr,r,s),Qa(us.set(.5,-.5,0),gr,o,mr,r,s),Qa(ja.set(.5,.5,0),gr,o,mr,r,s),W0.set(0,0),Du.set(1,0),q0.set(1,1);let a=e.ray.intersectTriangle(Ka,us,ja,!1,cs);if(a===null&&(Qa(us.set(-.5,.5,0),gr,o,mr,r,s),Du.set(0,1),a=e.ray.intersectTriangle(Ka,ja,us,!1,cs),a===null))return;let c=e.ray.origin.distanceTo(cs);c<e.near||c>e.far||t.push({distance:c,point:cs.clone(),uv:Ri.getInterpolation(cs,Ka,us,ja,W0,Du,q0,new ie),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};mh.Dispose=function(){jn.dispose(),jn=void 0};function Qa(n,e,t,i,r,s){vr.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(ls.x=s*vr.x-r*vr.y,ls.y=r*vr.x+s*vr.y):ls.copy(vr),n.copy(e),n.x+=ls.x,n.y+=ls.y,n.applyMatrix4(vy)}var Zt=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let 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;let t=[],i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),r=0,s=i.length,o;t?o=t:o=e*i[s-1];let a=0,c=s-1,l;for(;a<=c;)if(r=Math.floor(a+(c-a)/2),l=i[r]-o,l<0)a=r+1;else if(l>0)c=r-1;else{c=r;break}if(r=c,i[r]===o)return r/(s-1);let u=i[r],f=i[r+1]-u,m=(o-u)/f;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),c=t||(o.isVector2?new ie:new U);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new U,r=[],s=[],o=[],a=new U,c=new ft;for(let m=0;m<=e;m++){let g=m/e;r[m]=this.getTangentAt(g,new U)}s[0]=new U,o[0]=new U;let l=Number.MAX_VALUE,u=Math.abs(r[0].x),h=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=l&&(l=u,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),f<=l&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();let g=Math.acos(At(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(c.makeRotationAxis(a,g))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(At(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let g=1;g<=e;g++)s[g].applyMatrix4(c.makeRotationAxis(r[g],m*g)),o[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let 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}},_s=class extends Zt{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new ie){let i=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=c-this.aX,m=l-this.aY;c=f*u-m*h+this.aX,l=f*h+m*u+this.aY}return i.set(c,l)}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(){let 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}},gh=class extends _s{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function zh(){let n=0,e=0,t=0,i=0;function r(s,o,a,c){n=s,e=a,t=-3*s+3*o-2*a-c,i=2*s-2*o+a+c}return{initCatmullRom:function(s,o,a,c,l){r(o,a,l*(a-s),l*(c-o))},initNonuniformCatmullRom:function(s,o,a,c,l,u,h){let f=(o-s)/l-(a-s)/(l+u)+(a-o)/u,m=(a-o)/u-(c-o)/(u+h)+(c-a)/h;f*=u,m*=u,r(o,a,f,m)},calc:function(s){let o=s*s,a=o*s;return n+e*s+t*o+i*a}}}var eo=new U,Ou=new zh,Fu=new zh,Bu=new zh,vh=class extends Zt{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new U){let i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:c===0&&a===s-1&&(a=s-2,c=1);let l,u;this.closed||a>0?l=r[(a-1)%s]:(eo.subVectors(r[0],r[1]).add(r[0]),l=eo);let h=r[a%s],f=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(eo.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=eo),this.curveType==="centripetal"||this.curveType==="chordal"){let m=this.curveType==="chordal"?.5:.25,g=Math.pow(l.distanceToSquared(h),m),_=Math.pow(h.distanceToSquared(f),m),d=Math.pow(f.distanceToSquared(u),m);_<1e-4&&(_=1),g<1e-4&&(g=_),d<1e-4&&(d=_),Ou.initNonuniformCatmullRom(l.x,h.x,f.x,u.x,g,_,d),Fu.initNonuniformCatmullRom(l.y,h.y,f.y,u.y,g,_,d),Bu.initNonuniformCatmullRom(l.z,h.z,f.z,u.z,g,_,d)}else this.curveType==="catmullrom"&&(Ou.initCatmullRom(l.x,h.x,f.x,u.x,this.tension),Fu.initCatmullRom(l.y,h.y,f.y,u.y,this.tension),Bu.initCatmullRom(l.z,h.z,f.z,u.z,this.tension));return i.set(Ou.calc(c),Fu.calc(c),Bu.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new U().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function X0(n,e,t,i,r){let s=(i-e)*.5,o=(r-t)*.5,a=n*n,c=n*a;return(2*t-2*i+s+o)*c+(-3*t+3*i-2*s-o)*a+s*n+t}function aN(n,e){let t=1-n;return t*t*e}function oN(n,e){return 2*(1-n)*n*e}function cN(n,e){return n*n*e}function fs(n,e,t,i){return aN(n,e)+oN(n,t)+cN(n,i)}function lN(n,e){let t=1-n;return t*t*t*e}function uN(n,e){let t=1-n;return 3*t*t*n*e}function hN(n,e){return 3*(1-n)*n*n*e}function fN(n,e){return n*n*n*e}function ds(n,e,t,i,r){return lN(n,e)+uN(n,t)+hN(n,i)+fN(n,r)}var wo=class extends Zt{constructor(e=new ie,t=new ie,i=new ie,r=new ie){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new ie){let i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(ds(e,r.x,s.x,o.x,a.x),ds(e,r.y,s.y,o.y,a.y)),i}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(){let 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}},_h=class extends Zt{constructor(e=new U,t=new U,i=new U,r=new U){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new U){let i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(ds(e,r.x,s.x,o.x,a.x),ds(e,r.y,s.y,o.y,a.y),ds(e,r.z,s.z,o.z,a.z)),i}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(){let 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}},Ro=class extends Zt{constructor(e=new ie,t=new ie){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ie){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ie){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},yh=class extends Zt{constructor(e=new U,t=new U){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new U){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},Co=class extends Zt{constructor(e=new ie,t=new ie,i=new ie){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new ie){let i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(fs(e,r.x,s.x,o.x),fs(e,r.y,s.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},xh=class extends Zt{constructor(e=new U,t=new U,i=new U){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new U){let i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(fs(e,r.x,s.x,o.x),fs(e,r.y,s.y,o.y),fs(e,r.z,s.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},Po=class extends Zt{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ie){let i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,c=r[o===0?o:o-1],l=r[o],u=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(X0(a,c.x,l.x,u.x,h.x),X0(a,c.y,l.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new ie().fromArray(r))}return this}},Mh=Object.freeze({__proto__:null,ArcCurve:gh,CatmullRomCurve3:vh,CubicBezierCurve:wo,CubicBezierCurve3:_h,EllipseCurve:_s,LineCurve:Ro,LineCurve3:yh,QuadraticBezierCurve:Co,QuadraticBezierCurve3:xh,SplineCurve:Po}),Sh=class extends Zt{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Mh[i](t,e))}return this}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=i){let o=r[s]-i,a=this.curves[s],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}s++}return null}getLength(){let 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;let e=[],t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],i;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){let u=c[l];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let r=e.curves[t];this.curves.push(new Mh[r.type]().fromJSON(r))}return this}},Rr=class extends Sh{constructor(e){super(),this.type="Path",this.currentPoint=new ie,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new Ro(this.currentPoint.clone(),new ie(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let s=new Co(this.currentPoint.clone(),new ie(e,t),new ie(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){let a=new wo(this.currentPoint.clone(),new ie(e,t),new ie(i,r),new ie(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new Po(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){let a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,c){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,i,r,s,o,a,c),this}absellipse(e,t,i,r,s,o,a,c){let l=new _s(e,t,i,r,s,o,a,c);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};var Cr=class extends Rr{constructor(e){super(e),this.uuid=On(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(new Rr().fromJSON(r))}return this}},dN={triangulate:function(n,e,t=2){let i=e&&e.length,r=i?e[0]*t:n.length,s=_y(n,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,c,l,u,h,f,m;if(i&&(s=_N(n,e,s,t)),n.length>80*t){a=l=n[0],c=u=n[1];for(let g=t;g<r;g+=t)h=n[g],f=n[g+1],h<a&&(a=h),f<c&&(c=f),h>l&&(l=h),f>u&&(u=f);m=Math.max(l-a,u-c),m=m!==0?32767/m:0}return ys(s,o,t,a,c,m,0),o}};function _y(n,e,t,i,r){let s,o;if(r===CN(n,e,t,i)>0)for(s=e;s<t;s+=i)o=Y0(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=Y0(s,n[s],n[s+1],o);return o&&No(o,o.next)&&(Ms(o),o=o.next),o}function Di(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(No(t,t.next)||ot(t.prev,t,t.next)===0)){if(Ms(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function ys(n,e,t,i,r,s,o){if(!n)return;!o&&s&&bN(n,i,r,s);let a=n,c,l;for(;n.prev!==n.next;){if(c=n.prev,l=n.next,s?mN(n,i,r,s):pN(n)){e.push(c.i/t|0),e.push(n.i/t|0),e.push(l.i/t|0),Ms(n),n=l.next,a=l.next;continue}if(n=l,n===a){o?o===1?(n=gN(Di(n),e,t),ys(n,e,t,i,r,s,2)):o===2&&vN(n,e,t,i,r,s):ys(Di(n),e,t,i,r,s,1);break}}}function pN(n){let e=n.prev,t=n,i=n.next;if(ot(e,t,i)>=0)return!1;let r=e.x,s=t.x,o=i.x,a=e.y,c=t.y,l=i.y,u=r<s?r<o?r:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,f=r>s?r>o?r:o:s>o?s:o,m=a>c?a>l?a:l:c>l?c:l,g=i.next;for(;g!==e;){if(g.x>=u&&g.x<=f&&g.y>=h&&g.y<=m&&xr(r,a,s,c,o,l,g.x,g.y)&&ot(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function mN(n,e,t,i){let r=n.prev,s=n,o=n.next;if(ot(r,s,o)>=0)return!1;let a=r.x,c=s.x,l=o.x,u=r.y,h=s.y,f=o.y,m=a<c?a<l?a:l:c<l?c:l,g=u<h?u<f?u:f:h<f?h:f,_=a>c?a>l?a:l:c>l?c:l,d=u>h?u>f?u:f:h>f?h:f,p=bh(m,g,e,t,i),b=bh(_,d,e,t,i),v=n.prevZ,E=n.nextZ;for(;v&&v.z>=p&&E&&E.z<=b;){if(v.x>=m&&v.x<=_&&v.y>=g&&v.y<=d&&v!==r&&v!==o&&xr(a,u,c,h,l,f,v.x,v.y)&&ot(v.prev,v,v.next)>=0||(v=v.prevZ,E.x>=m&&E.x<=_&&E.y>=g&&E.y<=d&&E!==r&&E!==o&&xr(a,u,c,h,l,f,E.x,E.y)&&ot(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;v&&v.z>=p;){if(v.x>=m&&v.x<=_&&v.y>=g&&v.y<=d&&v!==r&&v!==o&&xr(a,u,c,h,l,f,v.x,v.y)&&ot(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;E&&E.z<=b;){if(E.x>=m&&E.x<=_&&E.y>=g&&E.y<=d&&E!==r&&E!==o&&xr(a,u,c,h,l,f,E.x,E.y)&&ot(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function gN(n,e,t){let i=n;do{let r=i.prev,s=i.next.next;!No(r,s)&&yy(r,i,i.next,s)&&xs(r,s)&&xs(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Ms(i),Ms(i.next),i=n=s),i=i.next}while(i!==n);return Di(i)}function vN(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&TN(o,a)){let c=xy(o,a);o=Di(o,o.next),c=Di(c,c.next),ys(o,e,t,i,r,s,0),ys(c,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function _N(n,e,t,i){let r=[],s,o,a,c,l;for(s=0,o=e.length;s<o;s++)a=e[s]*i,c=s<o-1?e[s+1]*i:n.length,l=_y(n,a,c,i,!1),l===l.next&&(l.steiner=!0),r.push(AN(l));for(r.sort(yN),s=0;s<r.length;s++)t=xN(r[s],t);return t}function yN(n,e){return n.x-e.x}function xN(n,e){let t=MN(n,e);if(!t)return e;let i=xy(t,n);return Di(i,i.next),Di(t,t.next)}function MN(n,e){let t=e,i=-1/0,r,s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){let f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>i&&(i=f,r=t.x<t.next.x?t:t.next,f===s))return r}t=t.next}while(t!==e);if(!r)return null;let a=r,c=r.x,l=r.y,u=1/0,h;t=r;do s>=t.x&&t.x>=c&&s!==t.x&&xr(o<l?s:i,o,c,l,o<l?i:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),xs(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&SN(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function SN(n,e){return ot(n.prev,n,e.prev)<0&&ot(e.next,n,n.next)<0}function bN(n,e,t,i){let r=n;do r.z===0&&(r.z=bh(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,EN(r)}function EN(n){let e,t,i,r,s,o,a,c,l=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<l&&(a++,i=i.nextZ,!!i);e++);for(c=l;a>0||c>0&&i;)a!==0&&(c===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,c--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,l*=2}while(o>1);return n}function bh(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function AN(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function xr(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function TN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!wN(n,e)&&(xs(n,e)&&xs(e,n)&&RN(n,e)&&(ot(n.prev,n,e.prev)||ot(n,e.prev,e))||No(n,e)&&ot(n.prev,n,n.next)>0&&ot(e.prev,e,e.next)>0)}function ot(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function No(n,e){return n.x===e.x&&n.y===e.y}function yy(n,e,t,i){let r=no(ot(n,e,t)),s=no(ot(n,e,i)),o=no(ot(t,i,n)),a=no(ot(t,i,e));return!!(r!==s&&o!==a||r===0&&to(n,t,e)||s===0&&to(n,i,e)||o===0&&to(t,n,i)||a===0&&to(t,e,i))}function to(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function no(n){return n>0?1:n<0?-1:0}function wN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&yy(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function xs(n,e){return ot(n.prev,n,n.next)<0?ot(n,e,n.next)>=0&&ot(n,n.prev,e)>=0:ot(n,e,n.prev)<0||ot(n,n.next,e)<0}function RN(n,e){let t=n,i=!1,r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function xy(n,e){let t=new Eh(n.i,n.x,n.y),i=new Eh(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function Y0(n,e,t,i){let r=new Eh(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ms(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Eh(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function CN(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}var ri=class n{static area(e){let t=e.length,i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return n.area(e)<0}static triangulateShape(e,t){let i=[],r=[],s=[];$0(e),Z0(i,e);let o=e.length;t.forEach($0);for(let c=0;c<t.length;c++)r.push(o),o+=t[c].length,Z0(i,t[c]);let a=dN.triangulate(i,r);for(let c=0;c<a.length;c+=3)s.push(a.slice(c,c+3));return s}};function $0(n){let e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function Z0(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}var Pr=class n extends Ot{constructor(e=new Cr([new ie(.5,.5),new ie(-.5,.5),new ie(-.5,-.5),new ie(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let i=this,r=[],s=[];for(let a=0,c=e.length;a<c;a++){let l=e[a];o(l)}this.setAttribute("position",new xt(r,3)),this.setAttribute("uv",new xt(s,2)),this.computeVertexNormals();function o(a){let c=[],l=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,g=t.bevelSize!==void 0?t.bevelSize:m-.1,_=t.bevelOffset!==void 0?t.bevelOffset:0,d=t.bevelSegments!==void 0?t.bevelSegments:3,p=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:PN,v,E=!1,I,R,w,B;p&&(v=p.getSpacedPoints(u),E=!0,f=!1,I=p.computeFrenetFrames(u,!1),R=new U,w=new U,B=new U),f||(d=0,m=0,g=0,_=0);let j=a.extractPoints(l),x=j.shape,A=j.holes;if(!ri.isClockWise(x)){x=x.reverse();for(let T=0,oe=A.length;T<oe;T++){let Y=A[T];ri.isClockWise(Y)&&(A[T]=Y.reverse())}}let K=ri.triangulateShape(x,A),C=x;for(let T=0,oe=A.length;T<oe;T++){let Y=A[T];x=x.concat(Y)}function W(T,oe,Y){return oe||console.error("THREE.ExtrudeGeometry: vec does not exist"),T.clone().addScaledVector(oe,Y)}let G=x.length,$=K.length;function q(T,oe,Y){let se,Z,_e,pe=T.x-oe.x,xe=T.y-oe.y,Ge=Y.x-T.x,S=Y.y-T.y,y=pe*pe+xe*xe,V=pe*S-xe*Ge;if(Math.abs(V)>Number.EPSILON){let H=Math.sqrt(y),ee=Math.sqrt(Ge*Ge+S*S),J=oe.x-xe/H,Le=oe.y+pe/H,Re=Y.x-S/ee,le=Y.y+Ge/ee,he=((Re-J)*S-(le-Le)*Ge)/(pe*S-xe*Ge);se=J+pe*he-T.x,Z=Le+xe*he-T.y;let Ue=se*se+Z*Z;if(Ue<=2)return new ie(se,Z);_e=Math.sqrt(Ue/2)}else{let H=!1;pe>Number.EPSILON?Ge>Number.EPSILON&&(H=!0):pe<-Number.EPSILON?Ge<-Number.EPSILON&&(H=!0):Math.sign(xe)===Math.sign(S)&&(H=!0),H?(se=-xe,Z=pe,_e=Math.sqrt(y)):(se=pe,Z=xe,_e=Math.sqrt(y/2))}return new ie(se/_e,Z/_e)}let X=[];for(let T=0,oe=C.length,Y=oe-1,se=T+1;T<oe;T++,Y++,se++)Y===oe&&(Y=0),se===oe&&(se=0),X[T]=q(C[T],C[Y],C[se]);let ne=[],te,ve=X.concat();for(let T=0,oe=A.length;T<oe;T++){let Y=A[T];te=[];for(let se=0,Z=Y.length,_e=Z-1,pe=se+1;se<Z;se++,_e++,pe++)_e===Z&&(_e=0),pe===Z&&(pe=0),te[se]=q(Y[se],Y[_e],Y[pe]);ne.push(te),ve=ve.concat(te)}for(let T=0;T<d;T++){let oe=T/d,Y=m*Math.cos(oe*Math.PI/2),se=g*Math.sin(oe*Math.PI/2)+_;for(let Z=0,_e=C.length;Z<_e;Z++){let pe=W(C[Z],X[Z],se);Ae(pe.x,pe.y,-Y)}for(let Z=0,_e=A.length;Z<_e;Z++){let pe=A[Z];te=ne[Z];for(let xe=0,Ge=pe.length;xe<Ge;xe++){let S=W(pe[xe],te[xe],se);Ae(S.x,S.y,-Y)}}}let Ie=g+_;for(let T=0;T<G;T++){let oe=f?W(x[T],ve[T],Ie):x[T];E?(w.copy(I.normals[0]).multiplyScalar(oe.x),R.copy(I.binormals[0]).multiplyScalar(oe.y),B.copy(v[0]).add(w).add(R),Ae(B.x,B.y,B.z)):Ae(oe.x,oe.y,0)}for(let T=1;T<=u;T++)for(let oe=0;oe<G;oe++){let Y=f?W(x[oe],ve[oe],Ie):x[oe];E?(w.copy(I.normals[T]).multiplyScalar(Y.x),R.copy(I.binormals[T]).multiplyScalar(Y.y),B.copy(v[T]).add(w).add(R),Ae(B.x,B.y,B.z)):Ae(Y.x,Y.y,h/u*T)}for(let T=d-1;T>=0;T--){let oe=T/d,Y=m*Math.cos(oe*Math.PI/2),se=g*Math.sin(oe*Math.PI/2)+_;for(let Z=0,_e=C.length;Z<_e;Z++){let pe=W(C[Z],X[Z],se);Ae(pe.x,pe.y,h+Y)}for(let Z=0,_e=A.length;Z<_e;Z++){let pe=A[Z];te=ne[Z];for(let xe=0,Ge=pe.length;xe<Ge;xe++){let S=W(pe[xe],te[xe],se);E?Ae(S.x,S.y+v[u-1].y,v[u-1].x+Y):Ae(S.x,S.y,h+Y)}}}k(),Q();function k(){let T=r.length/3;if(f){let oe=0,Y=G*oe;for(let se=0;se<$;se++){let Z=K[se];Me(Z[2]+Y,Z[1]+Y,Z[0]+Y)}oe=u+d*2,Y=G*oe;for(let se=0;se<$;se++){let Z=K[se];Me(Z[0]+Y,Z[1]+Y,Z[2]+Y)}}else{for(let oe=0;oe<$;oe++){let Y=K[oe];Me(Y[2],Y[1],Y[0])}for(let oe=0;oe<$;oe++){let Y=K[oe];Me(Y[0]+G*u,Y[1]+G*u,Y[2]+G*u)}}i.addGroup(T,r.length/3-T,0)}function Q(){let T=r.length/3,oe=0;me(C,oe),oe+=C.length;for(let Y=0,se=A.length;Y<se;Y++){let Z=A[Y];me(Z,oe),oe+=Z.length}i.addGroup(T,r.length/3-T,1)}function me(T,oe){let Y=T.length;for(;--Y>=0;){let se=Y,Z=Y-1;Z<0&&(Z=T.length-1);for(let _e=0,pe=u+d*2;_e<pe;_e++){let xe=G*_e,Ge=G*(_e+1),S=oe+se+xe,y=oe+Z+xe,V=oe+Z+Ge,H=oe+se+Ge;ye(S,y,V,H)}}}function Ae(T,oe,Y){c.push(T),c.push(oe),c.push(Y)}function Me(T,oe,Y){ke(T),ke(oe),ke(Y);let se=r.length/3,Z=b.generateTopUV(i,r,se-3,se-2,se-1);Te(Z[0]),Te(Z[1]),Te(Z[2])}function ye(T,oe,Y,se){ke(T),ke(oe),ke(se),ke(oe),ke(Y),ke(se);let Z=r.length/3,_e=b.generateSideWallUV(i,r,Z-6,Z-3,Z-2,Z-1);Te(_e[0]),Te(_e[1]),Te(_e[3]),Te(_e[1]),Te(_e[2]),Te(_e[3])}function ke(T){r.push(c[T*3+0]),r.push(c[T*3+1]),r.push(c[T*3+2])}function Te(T){s.push(T.x),s.push(T.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return IN(t,i,e)}static fromJSON(e,t){let i=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];i.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new Mh[r.type]().fromJSON(r)),new n(i,e.options)}},PN={generateTopUV:function(n,e,t,i,r){let s=e[t*3],o=e[t*3+1],a=e[i*3],c=e[i*3+1],l=e[r*3],u=e[r*3+1];return[new ie(s,o),new ie(a,c),new ie(l,u)]},generateSideWallUV:function(n,e,t,i,r,s){let o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[i*3],u=e[i*3+1],h=e[i*3+2],f=e[r*3],m=e[r*3+1],g=e[r*3+2],_=e[s*3],d=e[s*3+1],p=e[s*3+2];return Math.abs(a-u)<Math.abs(o-l)?[new ie(o,1-c),new ie(l,1-h),new ie(f,1-g),new ie(_,1-p)]:[new ie(a,1-c),new ie(u,1-h),new ie(m,1-g),new ie(d,1-p)]}};function IN(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){let s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Ss=class n extends Ot{constructor(e=new Cr([new ie(0,.5),new ie(-.5,-.5),new ie(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let i=[],r=[],s=[],o=[],a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(a,c,u),a+=c,c=0;this.setIndex(i),this.setAttribute("position",new xt(r,3)),this.setAttribute("normal",new xt(s,3)),this.setAttribute("uv",new xt(o,2));function l(u){let h=r.length/3,f=u.extractPoints(t),m=f.shape,g=f.holes;ri.isClockWise(m)===!1&&(m=m.reverse());for(let d=0,p=g.length;d<p;d++){let b=g[d];ri.isClockWise(b)===!0&&(g[d]=b.reverse())}let _=ri.triangulateShape(m,g);for(let d=0,p=g.length;d<p;d++){let b=g[d];m=m.concat(b)}for(let d=0,p=m.length;d<p;d++){let b=m[d];r.push(b.x,b.y,0),s.push(0,0,1),o.push(b.x,b.y)}for(let d=0,p=_.length;d<p;d++){let b=_[d],v=b[0]+h,E=b[1]+h,I=b[2]+h;i.push(v,E,I),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return LN(t,e)}static fromJSON(e,t){let i=[];for(let r=0,s=e.shapes.length;r<s;r++){let o=t[e.shapes[r]];i.push(o)}return new n(i,e.curveSegments)}};function LN(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){let r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}function io(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function UN(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Ir=class{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],s=t[i-1];n:{e:{let o;t:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break e}o=t.length;break t}if(!(e>=s)){let a=t[1];e<a&&(i=2,s=a);for(let c=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===c)break;if(r=s,s=t[--i-1],e>=s)break e}o=i,i=0;break t}break n}for(;i<o;){let a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Ah=class extends Ir{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Q_,endingEnd:Q_}}intervalChanged_(e,t,i){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],c=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case e0:s=e,a=2*t-i;break;case t0:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(c===void 0)switch(this.getSettings_().endingEnd){case e0:o=e,c=2*i-t;break;case t0:o=1,c=i+r[1]-r[0];break;default:o=e-1,c=t}let l=(i-t)*.5,u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,m=this._weightNext,g=(i-t)/(r-t),_=g*g,d=_*g,p=-f*d+2*f*_-f*g,b=(1+f)*d+(-1.5-2*f)*_+(-.5+f)*g+1,v=(-1-m)*d+(1.5+m)*_+.5*g,E=m*d-m*_;for(let I=0;I!==a;++I)s[I]=p*o[u+I]+b*o[l+I]+v*o[c+I]+E*o[h+I];return s}},Th=class extends Ir{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=(i-t)/(r-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[l+f]*h+o[c+f]*u;return s}},wh=class extends Ir{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},ln=class{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=io(t,this.TimeBufferType),this.values=io(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:io(e.times,Array),values:io(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new wh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Th(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ah(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case so:t=this.InterpolantFactoryMethodDiscrete;break;case ao:t=this.InterpolantFactoryMethodLinear;break;case cu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let i="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(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return so;case this.InterpolantFactoryMethodLinear:return ao;case this.InterpolantFactoryMethodSmooth:return cu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let c=i[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(r!==void 0&&UN(r))for(let a=0,c=r.length;a!==c;++a){let l=r[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===cu,s=e.length-1,o=1;for(let a=1;a<s;++a){let c=!1,l=e[a],u=e[a+1];if(l!==u&&(a!==1||l!==e[0]))if(r)c=!0;else{let h=a*i,f=h-i,m=h+i;for(let g=0;g!==i;++g){let _=t[h+g];if(_!==t[f+g]||_!==t[m+g]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];let h=a*i,f=o*i;for(let m=0;m!==i;++m)t[f+m]=t[h+m]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,c=o*i,l=0;l!==i;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};ln.prototype.TimeBufferType=Float32Array;ln.prototype.ValueBufferType=Float32Array;ln.prototype.DefaultInterpolation=ao;var Oi=class extends ln{};Oi.prototype.ValueTypeName="bool";Oi.prototype.ValueBufferType=Array;Oi.prototype.DefaultInterpolation=so;Oi.prototype.InterpolantFactoryMethodLinear=void 0;Oi.prototype.InterpolantFactoryMethodSmooth=void 0;var Rh=class extends ln{};Rh.prototype.ValueTypeName="color";var Ch=class extends ln{};Ch.prototype.ValueTypeName="number";var Ph=class extends Ir{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(i-t)/(r-t),l=e*a;for(let u=l+a;l!==u;l+=4)oi.slerpFlat(s,0,o,l-a,o,l,c);return s}},bs=class extends ln{InterpolantFactoryMethodLinear(e){return new Ph(this.times,this.values,this.getValueSize(),e)}};bs.prototype.ValueTypeName="quaternion";bs.prototype.DefaultInterpolation=ao;bs.prototype.InterpolantFactoryMethodSmooth=void 0;var Fi=class extends ln{};Fi.prototype.ValueTypeName="string";Fi.prototype.ValueBufferType=Array;Fi.prototype.DefaultInterpolation=so;Fi.prototype.InterpolantFactoryMethodLinear=void 0;Fi.prototype.InterpolantFactoryMethodSmooth=void 0;var Ih=class extends ln{};Ih.prototype.ValueTypeName="vector";var Lh=class{constructor(e,t,i){let r=this,s=!1,o=0,a=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){let h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=l.length;h<f;h+=2){let m=l[h],g=l[h+1];if(m.global&&(m.lastIndex=0),m.test(u))return g}return null}}},NN=new Lh,Uh=class{constructor(e){this.manager=e!==void 0?e:NN,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}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}};Uh.DEFAULT_MATERIAL_NAME="__DEFAULT";var kh="\\\\[\\\\]\\\\.:\\\\/",DN=new RegExp("["+kh+"]","g"),Vh="[^"+kh+"]",ON="[^"+kh.replace("\\\\.","")+"]",FN=/((?:WC+[\\/:])*)/.source.replace("WC",Vh),BN=/(WCOD+)?/.source.replace("WCOD",ON),zN=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Vh),kN=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Vh),VN=new RegExp("^"+FN+BN+zN+kN+"$"),GN=["material","materials","bones","map"],Nh=class{constructor(e,t,i){let r=i||it.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},it=class n{constructor(e,t,i){this.path=t,this.parsedPath=i||n.parseTrackName(t),this.node=n.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new n.Composite(e,t,i):new n(e,t,i)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(DN,"")}static parseTrackName(e){let t=VN.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=i.nodeName.substring(r+1);GN.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){let i=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let c=i(a.children);if(c)return c}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=n.findNode(this.rootNode,t.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(i){let l=t.objectIndex;switch(i){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 u=0;u<e.length;u++)if(e[u].name===l){l=u;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[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let o=e[r];if(o===void 0){let l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(r==="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[s]!==void 0&&(s=e.morphTargetDictionary[s])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};it.Composite=Nh;it.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};it.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};it.prototype.GetterByBindingType=[it.prototype._getValue_direct,it.prototype._getValue_array,it.prototype._getValue_arrayElement,it.prototype._getValue_toArray];it.prototype.SetterByBindingTypeAndVersioning=[[it.prototype._setValue_direct,it.prototype._setValue_direct_setNeedsUpdate,it.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[it.prototype._setValue_array,it.prototype._setValue_array_setNeedsUpdate,it.prototype._setValue_array_setMatrixWorldNeedsUpdate],[it.prototype._setValue_arrayElement,it.prototype._setValue_arrayElement_setNeedsUpdate,it.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[it.prototype._setValue_fromArray,it.prototype._setValue_fromArray_setNeedsUpdate,it.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var ZB=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Dh}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Dh);var uz=We(nx(),1),hz=We(ta(),1);function Ur(n,e){e===void 0&&(e=[]);let t=new Cr(n.map(i=>new ie(...i)));return e.length&&e.forEach(i=>{var r=new Rr(i.map(s=>new ie(...s)));t.holes.push(r)}),t}var Pz=We(Vx(),1),Iz=We(of(),1);function Gx(n){return n.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function Hx(n){let e={};for(let i in n)i.startsWith("on")&&(e[Gx(i.slice(2))]=n[i]);let t=i=>Cs(this,null,function*(){let{data:r}=i;if(e[r.type])try{let s=yield e[r.type](r.data);if(s!=null&&s.$transfer&&Array.isArray(s.$transfer)){let o=s.$transfer;delete s.$transfer,self.postMessage({type:""+r.type+"_result",key:r.key,data:s},o)}else self.postMessage({type:""+r.type+"_result",key:r.key,data:s})}catch(s){self.postMessage({type:""+r.type+"_result",key:r.key,error:s})}else self.postMessage({type:""+r.type+"_result",key:r.key,error:"no_event"})});return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var Gz=We(dl(),1),Hz=We(pl(),1),Wz=We(ml(),1),qz=We(vl(),1),Xz=We(_l(),1),Yz=We(Sl(),1),$z=We(Al(),1),Zz=We(wl(),1),Jz=We(Rl(),1),Kz=We(Pl(),1),jz=We(Ll(),1),Qz=We(Ol(),1),ek=We(zl(),1),tk=We(eu(),1),nk=We(tu(),1),ik=We(ta(),1);function Or(n,e=!1){let t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),r=new Set(Object.keys(n[0].morphAttributes)),s={},o={},a=n[0].morphTargetsRelative,c=new Ot,l=0;for(let u=0;u<n.length;++u){let h=n[u],f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let m in h.attributes){if(!i.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;s[m]===void 0&&(s[m]=[]),s[m].push(h.attributes[m]),f++}if(f!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let m in h.morphAttributes){if(!r.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[m]===void 0&&(o[m]=[]),o[m].push(h.morphAttributes[m])}if(e){let m;if(t)m=h.index.count;else if(h.attributes.position!==void 0)m=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,m,u),l+=m}}if(t){let u=0,h=[];for(let f=0;f<n.length;++f){let m=n[f].index;for(let g=0;g<m.count;++g)h.push(m.getX(g)+u);u+=n[f].attributes.position.count}c.setIndex(h)}for(let u in s){let h=Wx(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;c.setAttribute(u,h)}for(let u in o){let h=o[u][0].length;if(h===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[u]=[];for(let f=0;f<h;++f){let m=[];for(let _=0;_<o[u].length;++_)m.push(o[u][_][f]);let g=Wx(m);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;c.morphAttributes[u].push(g)}}return c}function Wx(n){let e,t,i,r=-1,s=0;for(let l=0;l<n.length;++l){let u=n[l];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=u.normalized),i!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new rt(o,t,i),c=0;for(let l=0;l<n.length;++l){let u=n[l];if(u.isInterleavedBufferAttribute){let h=c/t;for(let f=0,m=u.count;f<m;f++)for(let g=0;g<t;g++){let _=u.getComponent(f,g);a.setComponent(f+h,g,_)}}else o.set(u.array,c);c+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function qx(n,e,t){e===void 0&&(e=!0),t===void 0&&(t=!1);let i=n.filter(a=>a.geometry.type==="polygon");if(!i.length)return null;let r=i.map(a=>{var c;let l=a.geometry.coords,u=Ur(l[0],l.slice(1)),h=new Pr(u,{steps:1,bevelEnabled:!1,depth:a.height,curveSegments:4});(c=a).deltaHeight||(c.deltaHeight=0),h.translate(0,0,a.airHeight+a.deltaHeight);let f=h.attributes.position.count,m=new Float32Array(f).fill(a.height+a.airHeight+a.deltaHeight);if(h.setAttribute("maxZ",new rt(m,1)),h.setAttribute("opacity",new rt(new Float32Array(f).fill(a.fillOpacity),1)),t){let d=new Float32Array(f).fill(a.airHeight+a.deltaHeight);h.setAttribute("minZ",new rt(d,1))}let g=new Xe(a.fillColor).convertLinearToSRGB(),_=new Float32Array(f*3);for(let d=0;d<f;d++)_[d*3]=g.r,_[d*3+1]=g.g,_[d*3+2]=g.b;return h.setAttribute("color",new rt(_,3)),h}),s=Or(r);r.forEach(a=>a.dispose());let o={geometry:s};return s.dispose(),e&&(o.lineGeometry=BO(i)||void 0),o}function BO(n){let{points:e,colors:t,opacities:i}=zO(n);if(!e.length)return null;let r=new Ot().setFromPoints(e);return r.setAttribute("color",new rt(new Float32Array(t),3)),r.setAttribute("opacity",new rt(new Float32Array(i),1)),r}function zO(n){let e=[],t=[],i=[];return n.filter(r=>r.strokeOpacity>0).map(r=>{let s=r.height+(r.deltaHeight||0)+r.airHeight,{coords:o}=r.geometry,{strokeColor:a,strokeOpacity:c}=r,l=new Xe(a).convertLinearToSRGB();for(let u=0;u<o.length;u++){let h=o[u];for(let f=0;f<h.length;f++){let m=h[f],g=f+1===h.length?h[0]:h[f+1];e.push(new U(m[0],m[1],s)),e.push(new U(g[0],g[1],s)),t.push(l.r,l.g,l.b),t.push(l.r,l.g,l.b),i.push(c),i.push(c)}}}),{points:e,colors:t,opacities:i}}Hx({onGetMergedGeometryAttributes(n){let{data:e}=n,t=e.map(s=>{let o=s.geometry.coords,a=Ur(o[0],o.slice(1));return new Pr(a,{steps:1,bevelEnabled:!1,depth:s.height,curveSegments:4})}),i=Or(t);t.forEach(s=>s.dispose());let r={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),r},onGetMergedShapeGeometryAttributes(n){let{data:e}=n,t=e.map(s=>{let o=Ur(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),a=new Ss(o,4),c=a.getAttribute("position"),l=[],u=new Xe(s.fillColor);for(let f=0;f<c.count;f++){c.setZ(f,s.airHeight+(s.deltaHeight||0));var h;l.push(u.r,u.g,u.b,(h=s.fillOpacity)!=null?h:1)}return a.setAttribute("color",new rt(new Float32Array(l),4)),a}),i=Or(t);t.forEach(s=>s.dispose());let r={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),r},onGetMergedTexture2dShapeGeometryAttributes(n){let{data:e}=n,t=e.map(s=>{let o=Ur(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),a=new Ss(o,4),c=a.getAttribute("position"),l=[1,1,1,0,0,0,0,1];a.setAttribute("uv",new xt(l,2));let u=s.height+(s.deltaHeight||0)+s.airHeight;for(let h=0;h<c.count;h++)c.setZ(h,u);return a}),i=Or(t);t.forEach(s=>s.dispose());let r={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),r},onGetMergedGeometriesJson(n){let{data:e}=n,t=qx(e);if(t){var i;return{mergedGeometry:t.geometry.toJSON(),lineGeometry:(i=t.lineGeometry)==null?void 0:i.toJSON()}}else return null}});
|
|
8170
|
-
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var v0=class{static GetMergeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedShapeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedTexture2dGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetBufferGeometryByData(t){let e=new qe;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new He(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new He(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?ee({},t[0],n):null})}static dispose(){this.WorkerPool.dispose()}};v0.WorkerPool=new Pv(10,AR);var CY=H(qs(),1),Dh={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9,center_x:0,center_y:0,center_coord_x:0,center_coord_y:0,dashed:!1},wo=class extends Se{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new G,e=new Be;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new G(0,0,0);let t=new Be,e=new G;return t.setFromObject(this),t.getSize(e),e}getPosition(){let{center_coord_x:t,center_coord_y:e}=this.options,n=this.getCenter();return n.setZ(n.z+this.options.height/2),new G(t,e,n.z+this.options.height/2)}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){var t;if((t=this.options.doors)!=null&&t.length&&this.options.geometry.type==="polygon"){let e=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let i=n.type==="single"?.5:1,o=.5,a=K0(e,n.coord),l=new ft(...n.coord),c=new ft(...e[a]).sub(new ft(...n.coord)).normalize(),f=new ft().addVectors(l,c.clone().multiplyScalar(i)),g=new ft().addVectors(l,c.clone().multiplyScalar(-i)),m=new ft(-c.y,c.x),v=new ft().addVectors(f,m.clone().multiplyScalar(o));gT([v.x,v.y],e)||(m.multiplyScalar(-1),v=new ft().addVectors(f,m.clone().multiplyScalar(o)));let x=new ft().addVectors(g,m.clone().multiplyScalar(o)),S=[[f.x,f.y],[v.x,v.y],[x.x,x.y],[g.x,g.y]];e=this.options.geometry.coords[0]=[...e.slice(0,a+1),...S,...e.slice(a+1)]})}}initGeometry(){let t=Wm(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new bf(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=hn.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&Mo.getTextureByUrl(this.options.secondUrl).then(n=>{n.wrapS=zs,n.wrapT=zs,n.needsUpdate=!0,t.map=n,t.side=qi}),this.options.height<=.1)return this.material=t,t;let e=hn.createMeshBasicMaterial({color:J0(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let n=new Be().setFromObject(this),i=t.clone().add(e.clone().multiplyScalar(1e3)),o=new da(i,e.clone().multiplyScalar(-1)),a=new G;o.intersectBox(n,a);let l=t.clone().add(e.clone().multiplyScalar(-1e3)),c=new da(l,e.clone()),f=new G;return c.intersectBox(n,f),{max:f,min:a}}initGradualMaterial(){let{max:t,min:e}=new Be().setFromObject(this),n=t.clone().sub(e),i=Math.max(n.x,n.y,n.z)/2,o=this.getPosition(),a=new G(-1,.2,0).normalize(),{max:l,min:c}=this.getMaxAndMin(o,a),f=hn.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new G(-1,.2,0),max:l,min:c});if(this.options.height<=.1)return this.material=f,f;let g=this.getCenter(),m=new G(-1,.2,1).normalize(),{max:v,min:x}=this.getMaxAndMin(g,m),S=hn.createShaderMaterial({gradualColor:[J0(this.options.gradualColor[0],this.options.colorFactor),J0(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new G(-1,.2,1),max:v,min:x});return this.material=[f,S],[f,S]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=hn.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=hn.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new en(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:n}=this.options.geometry;for(let i=0;i<n.length;i++){let o=n[i];for(let a=0;a<o.length;a++){let l=o[a],c=a+1===o.length?o[0]:o[a+1];t.push(new G(l[0],l[1],e)),t.push(new G(c[0],c[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new qe().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new Yi(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.options.dashed&&t.computeLineDistances(),this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:n,distance:i}=e[0];return{position:n,distance:i}}return!1}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){if(super(),this.context=t,this.line=null,this.options=Wf((0,CY.cloneDeep)(ee({},Dh,e)),this),this.options.geometry.type==="point"){let[n,i]=this.options.geometry.coords;return this.position.set(n,i,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",n=>{let{value:i}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",n=>{let{value:i}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",n=>{let{value:i}=n;this.dispose(),this.init()}),this.addEventListener("change-strokeColor",n=>{let{value:i}=n;!this.options.stroke||!this.options.strokeOpacity||(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",n=>{let{value:i}=n;if(this.options.stroke)if(i)this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder();else{var o;this.line&&(this.remove(this.line),this.line=null),(o=this.lineGeometry)==null||o.dispose(),this.lineGeometry=void 0}}),this.addEventListener("change-airHeight",n=>{let{value:i}=n;this.position.z=i}),this.addEventListener("change-visible",n=>{let{value:i}=n;this.visible=i}),this.addEventListener("change-stroke",n=>{let{value:i}=n;if(i){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else if(this.line){var o;this.remove(this.line),(o=this.lineGeometry)==null||o.dispose()}}),this.addEventListener("change-dashed",()=>{!this.options.stroke||!this.options.strokeOpacity||(this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}};var t_=class extends Se{initLight(){let t=hM(16777215,.5);return t.position.set(0,0,100),this.add(t),t}changeLightCamera(t){let e=t.x,n=t.y;this.directionalLight.shadow.camera.left=-e,this.directionalLight.shadow.camera.right=e,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(e,n)}changeLightColor(t){this.directionalLight.color=new ne(t)}setPosition(t){this.position.copy(t),this.directionalLight.position.set(-t.x/2,-t.y/2,100)}initPlane(t,e){t===void 0&&(t=1e3),e===void 0&&(e=1e3);let n=new Ju(t,e),i=new Dm({transparent:!0,opacity:0,side:qi}),o=new en(n,i);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(t){this.directionalLight.target=t}transformOpacity(t){return t*this.basicOpacity}setOpacity(t){this.plane.material.opacity=this.transformOpacity(t)}dispose(){Lr(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var zJt=H(Ge(),1);var RY=H(qs(),1);var ubt={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},ap=class extends Zi{initObserver(){let t=new MutationObserver((0,RY.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){var t,e;if(this.element instanceof wo&&this.element.options.geometry.type==="polygon"){let{max:a,min:l}=new Be().setFromObject(this.element),c=(a.x+l.x)/2,f=(a.y+l.y)/2;return{left:new G(l.x,f,a.z),leftTop:new G(l.x,a.y,a.z),top:new G(c,a.y,a.z),rightTop:new G(a.x,a.y,a.z),right:new G(a.x,f,a.z),rightBottom:new G(a.x,l.y,a.z),bottom:new G(c,l.y,a.z),leftBottom:new G(l.x,l.y,a.z),center:new G(c,f,a.z)}}let{x:n,y:i,z:o}=((e=this.element)==null||(t=e.getPosition)==null?void 0:t.call(e))||this.position;return{left:new G(n,i,o),leftTop:new G(n,i,o),top:new G(n,i,o),rightTop:new G(n,i,o),right:new G(n,i,o),rightBottom:new G(n,i,o),bottom:new G(n,i,o),leftBottom:new G(n,i,o),center:new G(n,i,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,n=this.getPlacementPosition();return Object.keys(n).reduce((i,o)=>{let{x:a,y:l}=sn(n[o],this.context.camera,t,e);return i[o]={x:a,y:l},i},{})}checkOverflow(t,e){let{width:n,height:i}=this.context.clientSize;return e.x>0&&t.x<n&&e.y<i&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,n=this.getPlacementScreenPosition(),i=t/2,o=e/2,a=[{type:"center",getBox(l,c){return{max:{x:i+l,y:c-e},min:{x:l-i,y:c}}}},{type:"left",getBox(l,c){return{max:{x:l,y:c-o},min:{x:l-t,y:c+o}}}},{type:"leftTop",getBox(l,c){return{max:{x:l,y:c-e},min:{x:l-t,y:c}}}},{type:"top",getBox(l,c){return{max:{x:l+i,y:c-e},min:{x:l-i,y:c}}}},{type:"rightTop",getBox(l,c){return{max:{x:l+t,y:c-e},min:{x:l,y:c}}}},{type:"right",getBox(l,c){return{max:{x:l+t,y:c-o},min:{x:l,y:c+o}}}},{type:"rightBottom",getBox(l,c){return{max:{x:l+t,y:c},min:{x:l,y:c+e}}}},{type:"bottom",getBox(l,c){return{max:{x:l+i,y:c},min:{x:l-i,y:c+e}}}},{type:"leftBottom",getBox(l,c){return{max:{x:l,y:c},min:{x:l-t,y:c+o}}}}];for(let l=0;l<a.length;l++){let c=a[l],f=n[c.type],{max:g,min:m}=c.getBox(f.x,f.y);if(this.checkOverflow(g,m))return{type:c.type,position:f}}return{type:"center",position:n.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className="overlay_"+t.type,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e){e===void 0&&(e="block"),t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=""+t}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new Be().setFromObject(this.element).getCenter(new G):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:n,height:i}=this.context.clientSize;return t>=0&&t<=n&&e>=0&&e<=i}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:n,height:i,x:o,y:a}=this.context.clientSize;if(this.div){if(this.options.appendToBody){this.div.style.left=""+o+"px",this.div.style.top=""+(a+i)+"px";return}this.options.autoUpdate?(this.div.style.left=""+t+"px",this.div.style.bottom=""+(i-e)+"px"):this.dispatchEvent({type:"update-position",x:t,y:e,width:n,height:i})}}updatePosition(t){t===void 0&&(t=!1);let e=this.getPosition(),{width:n,height:i}=this.context.clientSize,{x:o,y:a}=sn(e,this.context.camera,n,i);this.clientPos.x===o&&this.clientPos.y===a&&!t||this._updatePosition(o,a)}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){var t,e;super.dispose(),this.unRegistryEvent(),this.unBindElement(),(t=this.observer)==null||t.disconnect(),(e=this.div)==null||e.remove(),this.div=null}constructor(t,e={}){super(),this.context=t,this.position=new G,this.clientPos={x:0,y:0},this.visible=!0,this.placement="top",this.observer=null,this.onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()},this.options=ee({},ubt,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var lbt={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},Uh=class extends Sn{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return At(this,null,function*(){if(yield xT(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}})}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let n=document.createElement("div");if(n.style.whiteSpace="nowrap",e.styles)for(let[i,o]of Object.entries(e.styles))n.style[i]=o;n.textContent=e.text,t.appendChild(n)}),t}initIcon(){var t,e;let n=document.createElement("img");return n.setAttribute("src",this.options.icon),n.style.width=""+(((t=this.options.icon_size)==null?void 0:t[0])||32)+"px",n.style.height=""+(((e=this.options.icon_size)==null?void 0:e[1])||32)+"px",n.style.opacity=""+this.options.icon_opacity+"px",n.style.borderRadius="50%",this.options.icon_border.width&&(n.style.border=this.options.icon_border.width+"px solid "+this.options.icon_border.color),n.onload=()=>{this.resetSize()},this.img=n,n}registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t){t===void 0&&(t=this.context.config.poi.boxScale);let{width:e,height:n}=this.size,i=e*t,o=n*t,{x:a,y:l}=this.overlay.clientPos;return{left:a-i/2,right:a+i/2,top:this.options.icon?l-o:l-o/2,bottom:this.options.icon?l:l+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let n=this.getOriginBox();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}constructor(t,e){var n,i,o;super(),this.context=t,this.visible=!0,this.size={width:0,height:0},this.position=new G,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=Wf(ee({},lbt,e),this),this.position.set(((n=e.position)==null?void 0:n.x)||0,((i=e.position)==null?void 0:i.y)||0,((o=e.position)==null?void 0:o.z)||0),this.overlay=new ap(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",a=>{let{x:l,y:c,height:f}=a;this.overlay.div.style.transform="translate3d(calc("+l+"px - 50%), calc("+(-f+c)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",a=>{let{value:l}=a;l?this.img?this.img.setAttribute("src",l):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",a=>{let{value:l}=a,c=this.textDiv;if(c){let f=this.initText();this.div.replaceChild(f,c)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",a=>{let{value:l}=a;this.overlay.setOpacity(l)}),this.addEventListener("change-icon_size",a=>{let{value:l}=a;this.img&&(this.img.style.width=""+((l==null?void 0:l[0])||32)+"px",this.img.style.height=""+((l==null?void 0:l[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",a=>{let{value:l}=a;this.img&&(this.img.style.opacity=""+l)}),this.addEventListener("change-icon_border",a=>{let{value:l}=a;this.img&&(this.img.style.border=l.width+"px solid "+l.color)}),this.addEventListener("change-background",a=>{let{value:l}=a;this.div.style.background=l})}};var Ete=H(Ge(),1),Ste=H(n0(),1),bte=H(r0(),1),Mte=H(i0(),1),wte=H(o0(),1),Tte=H(s0(),1),Ate=H(a0(),1),Cte=H(u0(),1);var LY=H(IY(),1);var e_=class extends Se{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){var e;this.clearHeatmap();let{width:n,height:i,leftTop:o,center:a,scale:l}=this.box,f=(((e=this.context.config.heatMap)==null?void 0:e.radius)||1)*l,g=ee({width:n,height:i,container:this.div},this.context.config.heatMap,{radius:f});this.heatmap=(0,LY.create)(g);let m=this.transformData(t,o,l);t.maxValue!==void 0&&(m.max=t.maxValue),t.minValue!==void 0&&(m.min=t.minValue),this.heatmap.setData(m),this.initPlane(n/l,i/l);let v=this.context.center;this.position.set(a[0]-v[0],a[1]-v[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let n=new Ju(t,e),i=new Pi(this.div.firstChild);i.needsUpdate=!0;let o=new yi({transparent:!0,side:ys,map:i});o.needsUpdate=!0,this.plane=new en(n,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:n}=t;return new Je().makeScale(this.box.scale,-this.box.scale).multiply(new Je().makeTranslation(-e,-n))}transformData(t,e,n){var i,o;let a=this.getTransMatrix(e);var l;let c=(l=(i=t.data[0])==null?void 0:i.value)!=null?l:0;var f;let g=(f=(o=t.data[0])==null?void 0:o.value)!=null?f:0;return{data:t.data.map(v=>{let x=new ft(v.x,v.y).applyMatrix3(a);return v.value>c&&(c=v.value),v.value<g&&(g=v.value),{x:Math.ceil(x.x),y:Math.ceil(x.y),value:v.value}}),max:c,min:g}}getBox(){let t=this.context.range,e=Ho(t),n=Math.ceil(e[2]-e[0]),i=Math.ceil(e[3]-e[1]),o=this.context.clientSize.width,a=this.context.clientSize.height,l=o/n,c=a/i,f=Math.min(l,c);this.scaleRatio=f;let g=n*f,m=i*f,v={x:Math.ceil(e[0]),y:Math.ceil(e[3])},x=fh(t).geometry.coordinates;return{width:g,height:m,leftTop:v,center:x,scale:f}}dispose(){this.clearHeatmap(),this.div.remove(),this.div=null,this.plane&&(this.remove(this.plane),Lr(this.plane))}constructor(t){super(),this.context=t,this.scaleRatio=1,this.div=document.createElement("div"),this.box=this.getBox()}};var n_=class extends Se{loadModel(){return At(this,null,function*(){let t=yield Ms.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){Lr(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new G(0,0,0)),this.loadModel()}};var oQt=H(Ge(),1);var Ki=class extends Se{dispose(){Lr(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t}};var r_=class extends Ki{getCenter(){return new Be().setFromObject(this).getCenter(new G)}createGraphic(t){let e=new wo(this.context,t);return e.userData.data=t,this.add(e),this.graphicMap.set(t.id,e),e}removeGraphic(t){this.remove(t),this.graphicMap.delete(t.options.id),t.dispose()}removeGraphicById(t){this.graphicMap.has(t)&&this.removeGraphic(this.graphicMap.get(t))}getGraphicByNodeId(t){return this.graphicMap.get(t)||null}getGraphicByRaycaster(t){let e={distance:1e4,graphic:null,position:null},n=this.children.reduce((i,o)=>{if(o instanceof wo){let a=o.raycast(t);if(a){let{distance:l}=a;if(l<i.distance)return{distance:a.distance,position:a.position,graphic:o}}return i}else return i},e);return n===e?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}setGraphicOptions(t,e){let n,i=this.graphicMap.get(t);i&&(typeof e=="function"?n=e(i.options):n=ee({},i.options,e),Object.keys(n).forEach(o=>{i.options[o]=n[o]}))}getGraphicPosition(t){let e=this.graphicMap.get(t);return e?[e.options.center_x,e.options.center_y]:null}constructor(t){super(t),this.graphicMap=new Map}};var fQt=H(w6(),1),pQt=H(En(),1);var NY=H(qs(),1);var i_=class extends Ki{clear(t){return t===void 0&&(t=!1),this.pois.forEach(e=>{e.options.built_in&&!t||e.dispose()}),this.pois=t?[]:this.pois.filter(e=>e.options.built_in),this}createPoi(t){let e=new Uh(this.context,t);return this.pushPoi(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}pushPoi(t){if(!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){return this.pois.filter(i=>i instanceof Uh&&i.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,i)=>{let{left:o,right:a,top:l,bottom:c}=n.getBox();if(i===0||!n.options.collision_enable){t.push({left:o,right:a,top:l,bottom:c}),n.parentSetVisible(!0);return}let f=t.some(g=>g.left<a&&g.right>o&&g.top<c&&g.bottom>l);n.parentSetVisible(!f),f||t.push({left:o,right:a,top:l,bottom:c})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new ui,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,NY.debounce)(this.collisionDetection,10)}};var _Qt=H(w6(),1),yQt=H(En(),1);var up=class extends Ki{clear(){return this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new Di(this.context,t);return this.pushPoi(e),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.remove(t),this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}add(t){return this.children.some(e=>e.options.id===t.options.id)||(t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t))),super.add(t),this}pushPoi(t){if(t.parentSetVisible(!1),t.userData.type==="parkingSpace"&&(this.needChangeParkingSpaceVisibleByZoom=!0),this.add(t),!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){let n=new ft(t,e);return this.pois.filter(o=>o instanceof Di&&o.canSelect&&o.box.containsPoint(n))}collisionDetection(){let t=[],{camera:e}=this.context;e.updateMatrixWorld();let n=f=>f<=1&&f>=-1,i=e.projectionMatrix.clone();i.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,a=25/30,l=Math.min(25,Math.max(1,o*a));this.pois.filter(f=>{if(f.visible){var g,m;if(!(l<=f.options.maxWeight&&l>=f.options.minWeight))return f.parentSetVisible(!1),!1;let v=f.spriteIcon?(g=f.spriteIcon)==null?void 0:g.matrixWorld:((m=f.spriteText)==null?void 0:m.matrixWorld)||f.matrixWorld,x=new G().setFromMatrixPosition(v);return x.applyMatrix4(i),f.screenPosition=x,n(x.x)&&n(x.y)&&n(x.z)?!0:(f.parentSetVisible(!1),!1)}return!1}).forEach((f,g)=>{let m=f.getBox(f.screenPosition);if(g===0||!f.options.collision_enable){t.push(m),f.parentSetVisible(!0);return}let v=t.some(x=>x.intersectsBox(m));f.parentSetVisible(!v),v||t.push(m)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}onAddToScene(){this.registryEvent()}onRemoveFromScene(){this.unRegistryEvent()}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.needChangeParkingSpaceVisibleByZoom=!1,this.timer=new ui,this.changeParkingSpaceVisibleByZoom=()=>{var e;let n=(e=this.parent)==null?void 0:e.parent;if(n&&n instanceof $a){let{clientSize:{width:i,height:o}}=this.context,{max:a,min:l}=n.box,f=Math.min(i/(a.x-l.x),o/(a.y-l.y))*(a.x-l.x)/60,g=this.context.camera.zoom>=f;this.pois.filter(m=>m.userData.type==="parkingSpace").map(m=>{m.visible=g,g||m.parentSetVisible(g)})}},this.onUpdate=()=>{this.needChangeParkingSpaceVisibleByZoom&&(this.changeParkingSpaceVisibleByZoom(),this.needChangeParkingSpaceVisibleByZoom=!1),this.timer.requestAnimationFrame(()=>{this.collisionDetection()})}}};var wQt=H(Xa(),1),TQt=H(Ge(),1);var OY=H(qs(),1);var o_=class extends Ki{createParkings(t,e,n){e===void 0&&(e=!0),this.parkingOptions=t,this.merged=e,e?(n?this.createMergedParkingByMergedElements(n):this.createMergedParking(t),t.map((i,o)=>{var a;(a=i.texts[0])==null||a.split(/[,,]/).map(l=>{this.parkingNoIndexMap.set(l,o)}),this.nodeIdIndexMap.set(i.id,o)})):this.createIndependentParking(t)}load(t,e){e===void 0&&(e=!0);var n;this.createParkings(t.elements,e,t.mergedElements),(n=t.mergedParkingTexture)!=null&&n.length?this.createMergedParkingTexture(t.mergedParkingTexture):this.createParkingTexture(t.elements)}createMergedParking(t){return At(this,null,function*(){let e=new s_(this.context,t);this.mergedParkingSpace=e,this.add(e)})}createMergedParkingByMergedElements(t){let e=new a_(this.context,t);this.mergedParkingSpace=e,this.add(e)}createIndependentParking(t){t.forEach(e=>{var n;let i=new wo(this.context,e);this.add(i),(n=e.texts[0])==null||n.split(/[,,]/).map(o=>{this.parkingNoGraphicMap.set(o,i)}),this.graphicMap.set(i.options.id,i)})}createParkingTexture(t){let e=t.filter(n=>E6[n.parkingType]).map(n=>{let i=new ft(...n.geometry.coords[0][0]),o=new ft(...n.geometry.coords[0][1]),a=new ft(...n.geometry.coords[0][2]),l=Math.min(i.distanceTo(o),o.distanceTo(a)),c=0;return l===i.distanceTo(o)?c=o.sub(i).angle()-Math.PI/2:c=a.sub(o).angle()-Math.PI/2,{uuid:n.id,iconUrl:E6[n.parkingType],name:n.texts[0],deltaHeight:(n.deltaHeight||0)+.001,airHeight:n.airHeight,height:n.height,geometry:n.geometry,opacity:n.fillOpacity,visible:!0,secondWidth:l-1,secondHeight:l-1,secondRotate:c,centerCoords:[n.center_coord_x,n.center_coord_y]}});if(e.length){let n=new lp(this.context,e);this.add(n)}}createMergedParkingTexture(t){t.map(e=>{e.iconUrl=E6[e.iconUrl];let n=new cp(this.context,e);this.add(n)})}changeParkingColor(t){this.merged?Object.keys(t).map(e=>{let n=this.parkingNoIndexMap.get(e);if(!(0,OY.isNil)(n)){var i;(i=this.mergedParkingSpace)==null||i.setParkingColorByIndex(n,t[e])}}):Object.keys(t).map(e=>{let n=this.parkingNoGraphicMap.get(e);n&&(n.options.fillColor=t[e])})}getGraphicPosition(t){if(this.merged){let e=this.parkingOptions.find(n=>n.id===t);return e?[e.center_x,e.center_y]:null}}dispose(){var t;(t=this.mergedParkingSpace)==null||t.dispose(),this.mergedParkingSpace=null,Lr(this),this.graphicMap.clear(),this.parkingNoGraphicMap.clear(),this.parkingNoIndexMap.clear(),this.nodeIdIndexMap.clear(),this.parkingOptions=[],super.dispose()}constructor(t){super(t),this.graphicMap=new Map,this.parkingNoGraphicMap=new Map,this.parkingOptions=[],this.merged=!1,this.parkingNoIndexMap=new Map,this.nodeIdIndexMap=new Map,this.mergedParkingSpace=null}};var OQt=H(En(),1);var u_=class extends Ki{addModels(t){let e=t.reduce((n,i)=>{let{url:o}=i;return n[o]?n[o].push(i):n[o]=[i],n},{});Object.values(e).forEach(n=>{let i=new l_(this.context,n);this.add(i)})}constructor(t){super(t)}};var ote=H(Ge(),1);function DY(r){return`${r.x}-${r.y}-${r.z}`}var ba=class{static generateLineMaterialKey({color:t,opacity:e}){return`${t}-${e}`}static createLineMaterial({color:t,opacity:e,vertexColors:n}){let i=this.generateLineMaterialKey({color:t,opacity:e,vertexColors:n});if(this.lineMaterialMap.has(i))return this.lineMaterialMap.get(i);let o=new ma({color:new ne(t).convertLinearToSRGB(),transparent:!0,opacity:e,vertexColors:n!=null?n:!1});return this.lineMaterialMap.set(i,o),o}static createMeshStandardMaterial({color:t,opacity:e}){let n=`${t}-${e}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new t0({color:new ne(t).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:e,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:t,opacity:e,vertexColors:n}){let i=`${t}-${e}-${n}`;if(this.meshBasicMaterialMap.has(i))return this.meshBasicMaterialMap.get(i);let o=new yi({color:t,transparent:!0,opacity:e,depthWrite:!0,vertexColors:n!=null?n:!1});return this.meshBasicMaterialMap.set(i,o),o}static createShaderMaterial({gradualColor:t,center:e,maxValue:n,opacity:i,direction:o,max:a,min:l}){let c=`${t.toString()}-${DY(e)}-${n}-${i}-${DY(o)}`;if(this.shaderMaterialMap.has(c))return this.shaderMaterialMap.get(c);let f=`
|
|
8170
|
+
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var v0=class{static GetMergeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedShapeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedTexture2dGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetBufferGeometryByData(t){let e=new qe;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new He(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new He(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield fi(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?ee({},t[0],n):null})}static dispose(){this.WorkerPool.dispose()}};v0.WorkerPool=new Pv(10,AR);var CY=H(qs(),1),Dh={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9,center_x:0,center_y:0,center_coord_x:0,center_coord_y:0,dashed:!1},wo=class extends Se{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new G,e=new Be;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new G(0,0,0);let t=new Be,e=new G;return t.setFromObject(this),t.getSize(e),e}getPosition(){let{center_coord_x:t,center_coord_y:e}=this.options,n=this.getCenter();return n.setZ(n.z+this.options.height/2),new G(t,e,n.z+this.options.height/2)}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){var t;if((t=this.options.doors)!=null&&t.length&&this.options.geometry.type==="polygon"){let e=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let i=n.type==="single"?.5:1,o=.5,a=K0(e,n.coord),l=new ft(...n.coord),c=new ft(...e[a]).sub(new ft(...n.coord)).normalize(),f=new ft().addVectors(l,c.clone().multiplyScalar(i)),g=new ft().addVectors(l,c.clone().multiplyScalar(-i)),m=new ft(-c.y,c.x),v=new ft().addVectors(f,m.clone().multiplyScalar(o));gT([v.x,v.y],e)||(m.multiplyScalar(-1),v=new ft().addVectors(f,m.clone().multiplyScalar(o)));let x=new ft().addVectors(g,m.clone().multiplyScalar(o)),S=[[f.x,f.y],[v.x,v.y],[x.x,x.y],[g.x,g.y]];e=this.options.geometry.coords[0]=[...e.slice(0,a+1),...S,...e.slice(a+1)]})}}initGeometry(){let t=Wm(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new bf(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=hn.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&Mo.getTextureByUrl(this.options.secondUrl).then(n=>{n.wrapS=zs,n.wrapT=zs,n.needsUpdate=!0,t.map=n,t.side=qi}),this.options.height<=.1)return this.material=t,t;let e=hn.createMeshBasicMaterial({color:J0(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let n=new Be().setFromObject(this),i=t.clone().add(e.clone().multiplyScalar(1e3)),o=new da(i,e.clone().multiplyScalar(-1)),a=new G;o.intersectBox(n,a);let l=t.clone().add(e.clone().multiplyScalar(-1e3)),c=new da(l,e.clone()),f=new G;return c.intersectBox(n,f),{max:f,min:a}}initGradualMaterial(){let{max:t,min:e}=new Be().setFromObject(this),n=t.clone().sub(e),i=Math.max(n.x,n.y,n.z)/2,o=this.getPosition(),a=new G(-1,.2,0).normalize(),{max:l,min:c}=this.getMaxAndMin(o,a),f=hn.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new G(-1,.2,0),max:l,min:c});if(this.options.height<=.1)return this.material=f,f;let g=this.getCenter(),m=new G(-1,.2,1).normalize(),{max:v,min:x}=this.getMaxAndMin(g,m),S=hn.createShaderMaterial({gradualColor:[J0(this.options.gradualColor[0],this.options.colorFactor),J0(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new G(-1,.2,1),max:v,min:x});return this.material=[f,S],[f,S]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=hn.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=hn.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new en(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:n}=this.options.geometry;for(let i=0;i<n.length;i++){let o=n[i];for(let a=0;a<o.length;a++){let l=o[a],c=a+1===o.length?o[0]:o[a+1];t.push(new G(l[0],l[1],e)),t.push(new G(c[0],c[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new qe().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new Yi(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.options.dashed&&t.computeLineDistances(),this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:n,distance:i}=e[0];return{position:n,distance:i}}return!1}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){if(super(),this.context=t,this.line=null,this.options=Wf((0,CY.cloneDeep)(ee({},Dh,e)),this),this.options.geometry.type==="point"){let[n,i]=this.options.geometry.coords;return this.position.set(n,i,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",n=>{let{value:i}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",n=>{let{value:i}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",n=>{let{value:i}=n;this.dispose(),this.init()}),this.addEventListener("change-strokeColor",n=>{let{value:i}=n;!this.options.stroke||!this.options.strokeOpacity||(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",n=>{let{value:i}=n;if(this.options.stroke)if(i)this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder();else{var o;this.line&&(this.remove(this.line),this.line=null),(o=this.lineGeometry)==null||o.dispose(),this.lineGeometry=void 0}}),this.addEventListener("change-airHeight",n=>{let{value:i}=n;this.position.z=i}),this.addEventListener("change-visible",n=>{let{value:i}=n;this.visible=i}),this.addEventListener("change-stroke",n=>{let{value:i}=n;if(i){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else if(this.line){var o;this.remove(this.line),(o=this.lineGeometry)==null||o.dispose()}}),this.addEventListener("change-dashed",()=>{!this.options.stroke||!this.options.strokeOpacity||(this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}};var t_=class extends Se{initLight(){let t=hM(16777215,.5);return t.position.set(0,0,100),this.add(t),t}changeLightCamera(t){let e=t.x,n=t.y;this.directionalLight.shadow.camera.left=-e,this.directionalLight.shadow.camera.right=e,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(e,n)}changeLightColor(t){this.directionalLight.color=new ne(t)}setPosition(t){this.position.copy(t),this.directionalLight.position.set(-t.x/2,-t.y/2,100)}initPlane(t,e){t===void 0&&(t=1e3),e===void 0&&(e=1e3);let n=new Ju(t,e),i=new Dm({transparent:!0,opacity:0,side:qi}),o=new en(n,i);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(t){this.directionalLight.target=t}transformOpacity(t){return t*this.basicOpacity}setOpacity(t){this.plane.material.opacity=this.transformOpacity(t)}dispose(){Lr(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var zJt=H(Ge(),1);var RY=H(qs(),1);var ubt={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},ap=class extends Zi{initObserver(){let t=new MutationObserver((0,RY.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){var t,e;if(this.element instanceof wo&&this.element.options.geometry.type==="polygon"){let{max:a,min:l}=new Be().setFromObject(this.element),c=(a.x+l.x)/2,f=(a.y+l.y)/2;return{left:new G(l.x,f,a.z),leftTop:new G(l.x,a.y,a.z),top:new G(c,a.y,a.z),rightTop:new G(a.x,a.y,a.z),right:new G(a.x,f,a.z),rightBottom:new G(a.x,l.y,a.z),bottom:new G(c,l.y,a.z),leftBottom:new G(l.x,l.y,a.z),center:new G(c,f,a.z)}}let{x:n,y:i,z:o}=((e=this.element)==null||(t=e.getPosition)==null?void 0:t.call(e))||this.position;return{left:new G(n,i,o),leftTop:new G(n,i,o),top:new G(n,i,o),rightTop:new G(n,i,o),right:new G(n,i,o),rightBottom:new G(n,i,o),bottom:new G(n,i,o),leftBottom:new G(n,i,o),center:new G(n,i,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,n=this.getPlacementPosition();return Object.keys(n).reduce((i,o)=>{let{x:a,y:l}=sn(n[o],this.context.camera,t,e);return i[o]={x:a,y:l},i},{})}checkOverflow(t,e){let{width:n,height:i}=this.context.clientSize;return e.x>0&&t.x<n&&e.y<i&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,n=this.getPlacementScreenPosition(),i=t/2,o=e/2,a=[{type:"center",getBox(l,c){return{max:{x:i+l,y:c-e},min:{x:l-i,y:c}}}},{type:"left",getBox(l,c){return{max:{x:l,y:c-o},min:{x:l-t,y:c+o}}}},{type:"leftTop",getBox(l,c){return{max:{x:l,y:c-e},min:{x:l-t,y:c}}}},{type:"top",getBox(l,c){return{max:{x:l+i,y:c-e},min:{x:l-i,y:c}}}},{type:"rightTop",getBox(l,c){return{max:{x:l+t,y:c-e},min:{x:l,y:c}}}},{type:"right",getBox(l,c){return{max:{x:l+t,y:c-o},min:{x:l,y:c+o}}}},{type:"rightBottom",getBox(l,c){return{max:{x:l+t,y:c},min:{x:l,y:c+e}}}},{type:"bottom",getBox(l,c){return{max:{x:l+i,y:c},min:{x:l-i,y:c+e}}}},{type:"leftBottom",getBox(l,c){return{max:{x:l,y:c},min:{x:l-t,y:c+o}}}}];for(let l=0;l<a.length;l++){let c=a[l],f=n[c.type],{max:g,min:m}=c.getBox(f.x,f.y);if(this.checkOverflow(g,m))return{type:c.type,position:f}}return{type:"center",position:n.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className="overlay_"+t.type,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e){e===void 0&&(e="block"),t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=""+t}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new Be().setFromObject(this.element).getCenter(new G):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:n,height:i}=this.context.clientSize;return t>=0&&t<=n&&e>=0&&e<=i}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:n,height:i,x:o,y:a}=this.context.clientSize;if(this.div){if(this.options.appendToBody){this.div.style.left=""+o+"px",this.div.style.top=""+(a+i)+"px";return}this.options.autoUpdate?(this.div.style.left=""+t+"px",this.div.style.bottom=""+(i-e)+"px"):this.dispatchEvent({type:"update-position",x:t,y:e,width:n,height:i})}}updatePosition(t){t===void 0&&(t=!1);let e=this.getPosition(),{width:n,height:i}=this.context.clientSize,{x:o,y:a}=sn(e,this.context.camera,n,i);this.clientPos.x===o&&this.clientPos.y===a&&!t||this._updatePosition(o,a)}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){var t,e;super.dispose(),this.unRegistryEvent(),this.unBindElement(),(t=this.observer)==null||t.disconnect(),(e=this.div)==null||e.remove(),this.div=null}constructor(t,e={}){super(),this.context=t,this.position=new G,this.clientPos={x:0,y:0},this.visible=!0,this.placement="top",this.observer=null,this.onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()},this.options=ee({},ubt,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var lbt={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},Uh=class extends Sn{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return At(this,null,function*(){if(yield xT(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}})}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let n=document.createElement("div");if(n.style.whiteSpace="nowrap",e.styles)for(let[i,o]of Object.entries(e.styles))n.style[i]=o;n.textContent=e.text,t.appendChild(n)}),t}initIcon(){var t,e;let n=document.createElement("img");return n.setAttribute("src",this.options.icon),n.style.width=""+(((t=this.options.icon_size)==null?void 0:t[0])||32)+"px",n.style.height=""+(((e=this.options.icon_size)==null?void 0:e[1])||32)+"px",n.style.opacity=""+this.options.icon_opacity+"px",n.style.borderRadius="50%",this.options.icon_border.width&&(n.style.border=this.options.icon_border.width+"px solid "+this.options.icon_border.color),n.onload=()=>{this.resetSize()},this.img=n,n}registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t){t===void 0&&(t=this.context.config.poi.boxScale);let{width:e,height:n}=this.size,i=e*t,o=n*t,{x:a,y:l}=this.overlay.clientPos;return{left:a-i/2,right:a+i/2,top:this.options.icon?l-o:l-o/2,bottom:this.options.icon?l:l+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let n=this.getOriginBox();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}constructor(t,e){var n,i,o;super(),this.context=t,this.visible=!0,this.size={width:0,height:0},this.position=new G,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=Wf(ee({},lbt,e),this),this.position.set(((n=e.position)==null?void 0:n.x)||0,((i=e.position)==null?void 0:i.y)||0,((o=e.position)==null?void 0:o.z)||0),this.overlay=new ap(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",a=>{let{x:l,y:c,height:f}=a;this.overlay.div.style.transform="translate3d(calc("+l+"px - 50%), calc("+(-f+c)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",a=>{let{value:l}=a;l?this.img?this.img.setAttribute("src",l):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",a=>{let{value:l}=a,c=this.textDiv;if(c){let f=this.initText();this.div.replaceChild(f,c)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",a=>{let{value:l}=a;this.overlay.setOpacity(l)}),this.addEventListener("change-icon_size",a=>{let{value:l}=a;this.img&&(this.img.style.width=""+((l==null?void 0:l[0])||32)+"px",this.img.style.height=""+((l==null?void 0:l[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",a=>{let{value:l}=a;this.img&&(this.img.style.opacity=""+l)}),this.addEventListener("change-icon_border",a=>{let{value:l}=a;this.img&&(this.img.style.border=l.width+"px solid "+l.color)}),this.addEventListener("change-background",a=>{let{value:l}=a;this.div.style.background=l})}};var Ete=H(Ge(),1),Ste=H(n0(),1),bte=H(r0(),1),Mte=H(i0(),1),wte=H(o0(),1),Tte=H(s0(),1),Ate=H(a0(),1),Cte=H(u0(),1);var LY=H(IY(),1);var e_=class extends Se{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){var e;this.clearHeatmap();let{width:n,height:i,leftTop:o,center:a,scale:l}=this.box,f=(((e=this.context.config.heatMap)==null?void 0:e.radius)||1)*l,g=ee({width:n,height:i,container:this.div},this.context.config.heatMap,{radius:f});this.heatmap=(0,LY.create)(g);let m=this.transformData(t,o,l);t.maxValue!==void 0&&(m.max=t.maxValue),t.minValue!==void 0&&(m.min=t.minValue),this.heatmap.setData(m),this.initPlane(n/l,i/l);let v=this.context.center;this.position.set(a[0]-v[0],a[1]-v[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let n=new Ju(t,e),i=new Pi(this.div.firstChild);i.needsUpdate=!0;let o=new yi({transparent:!0,side:ys,map:i});o.needsUpdate=!0,this.plane=new en(n,o),this.plane.renderOrder=1e5,this.add(this.plane)}getTransMatrix(t){let{x:e,y:n}=t;return new Je().makeScale(this.box.scale,-this.box.scale).multiply(new Je().makeTranslation(-e,-n))}transformData(t,e,n){var i,o;let a=this.getTransMatrix(e);var l;let c=(l=(i=t.data[0])==null?void 0:i.value)!=null?l:0;var f;let g=(f=(o=t.data[0])==null?void 0:o.value)!=null?f:0;return{data:t.data.map(v=>{let x=new ft(v.x,v.y).applyMatrix3(a);return v.value>c&&(c=v.value),v.value<g&&(g=v.value),{x:Math.ceil(x.x),y:Math.ceil(x.y),value:v.value}}),max:c,min:g}}getBox(){let t=this.context.range,e=Ho(t),n=Math.ceil(e[2]-e[0]),i=Math.ceil(e[3]-e[1]),o=this.context.clientSize.width,a=this.context.clientSize.height,l=o/n,c=a/i,f=Math.min(l,c);this.scaleRatio=f;let g=n*f,m=i*f,v={x:Math.ceil(e[0]),y:Math.ceil(e[3])},x=fh(t).geometry.coordinates;return{width:g,height:m,leftTop:v,center:x,scale:f}}dispose(){this.clearHeatmap(),this.div.remove(),this.div=null,this.plane&&(this.remove(this.plane),Lr(this.plane))}constructor(t){super(),this.context=t,this.scaleRatio=1,this.div=document.createElement("div"),this.box=this.getBox()}};var n_=class extends Se{loadModel(){return At(this,null,function*(){let t=yield Ms.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){Lr(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new G(0,0,0)),this.loadModel()}};var oQt=H(Ge(),1);var Ki=class extends Se{dispose(){Lr(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t}};var r_=class extends Ki{getCenter(){return new Be().setFromObject(this).getCenter(new G)}createGraphic(t){let e=new wo(this.context,t);return e.userData.data=t,this.add(e),this.graphicMap.set(t.id,e),e}removeGraphic(t){this.remove(t),this.graphicMap.delete(t.options.id),t.dispose()}removeGraphicById(t){this.graphicMap.has(t)&&this.removeGraphic(this.graphicMap.get(t))}getGraphicByNodeId(t){return this.graphicMap.get(t)||null}getGraphicByRaycaster(t){let e={distance:1e4,graphic:null,position:null},n=this.children.reduce((i,o)=>{if(o instanceof wo){let a=o.raycast(t);if(a){let{distance:l}=a;if(l<i.distance)return{distance:a.distance,position:a.position,graphic:o}}return i}else return i},e);return n===e?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}setGraphicOptions(t,e){let n,i=this.graphicMap.get(t);i&&(typeof e=="function"?n=e(i.options):n=ee({},i.options,e),Object.keys(n).forEach(o=>{i.options[o]=n[o]}))}getGraphicPosition(t){let e=this.graphicMap.get(t);return e?[e.options.center_x,e.options.center_y]:null}constructor(t){super(t),this.graphicMap=new Map}};var fQt=H(w6(),1),pQt=H(En(),1);var NY=H(qs(),1);var i_=class extends Ki{clear(t){return t===void 0&&(t=!1),this.pois.forEach(e=>{e.options.built_in&&!t||e.dispose()}),this.pois=t?[]:this.pois.filter(e=>e.options.built_in),this}createPoi(t){let e=new Uh(this.context,t);return this.pushPoi(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}pushPoi(t){if(!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){return this.pois.filter(i=>i instanceof Uh&&i.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,i)=>{let{left:o,right:a,top:l,bottom:c}=n.getBox();if(i===0||!n.options.collision_enable){t.push({left:o,right:a,top:l,bottom:c}),n.parentSetVisible(!0);return}let f=t.some(g=>g.left<a&&g.right>o&&g.top<c&&g.bottom>l);n.parentSetVisible(!f),f||t.push({left:o,right:a,top:l,bottom:c})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new ui,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,NY.debounce)(this.collisionDetection,10)}};var _Qt=H(w6(),1),yQt=H(En(),1);var up=class extends Ki{clear(){return this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new Di(this.context,t);return this.pushPoi(e),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.remove(t),this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}add(t){return this.children.some(e=>e.options.id===t.options.id)||(t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t))),super.add(t),this}pushPoi(t){if(t.parentSetVisible(!1),t.userData.type==="parkingSpace"&&(this.needChangeParkingSpaceVisibleByZoom=!0),this.add(t),!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){let n=new ft(t,e);return this.pois.filter(o=>o instanceof Di&&o.canSelect&&o.box.containsPoint(n))}collisionDetection(){let t=[],{camera:e}=this.context;e.updateMatrixWorld();let n=f=>f<=1&&f>=-1,i=e.projectionMatrix.clone();i.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,a=25/30,l=Math.min(25,Math.max(1,o*a));this.pois.filter(f=>{if(f.visible){var g,m;if(!(l<=f.options.maxWeight&&l>=f.options.minWeight))return f.parentSetVisible(!1),!1;let v=f.spriteIcon?(g=f.spriteIcon)==null?void 0:g.matrixWorld:((m=f.spriteText)==null?void 0:m.matrixWorld)||f.matrixWorld,x=new G().setFromMatrixPosition(v);return x.applyMatrix4(i),f.screenPosition=x,n(x.x)&&n(x.y)&&n(x.z)?!0:(f.parentSetVisible(!1),!1)}return!1}).forEach((f,g)=>{let m=f.getBox(f.screenPosition);if(g===0||!f.options.collision_enable){t.push(m),f.parentSetVisible(!0);return}let v=t.some(x=>x.intersectsBox(m));f.parentSetVisible(!v),v||t.push(m)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}onAddToScene(){this.registryEvent()}onRemoveFromScene(){this.unRegistryEvent()}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.needChangeParkingSpaceVisibleByZoom=!1,this.timer=new ui,this.changeParkingSpaceVisibleByZoom=()=>{var e;let n=(e=this.parent)==null?void 0:e.parent;if(n&&n instanceof $a){let{clientSize:{width:i,height:o}}=this.context,{max:a,min:l}=n.box,f=Math.min(i/(a.x-l.x),o/(a.y-l.y))*(a.x-l.x)/60,g=this.context.camera.zoom>=f;this.pois.filter(m=>m.userData.type==="parkingSpace").map(m=>{m.visible=g,g||m.parentSetVisible(g)})}},this.onUpdate=()=>{this.needChangeParkingSpaceVisibleByZoom&&(this.changeParkingSpaceVisibleByZoom(),this.needChangeParkingSpaceVisibleByZoom=!1),this.timer.requestAnimationFrame(()=>{this.collisionDetection()})}}};var wQt=H(Xa(),1),TQt=H(Ge(),1);var OY=H(qs(),1);var o_=class extends Ki{createParkings(t,e,n){e===void 0&&(e=!0),this.parkingOptions=t,this.merged=e,e?(n?this.createMergedParkingByMergedElements(n):this.createMergedParking(t),t.map((i,o)=>{var a;(a=i.texts[0])==null||a.split(/[,,]/).map(l=>{this.parkingNoIndexMap.set(l,o)}),this.nodeIdIndexMap.set(i.id,o)})):this.createIndependentParking(t)}load(t,e){e===void 0&&(e=!0);var n;this.createParkings(t.elements,e,t.mergedElements),(n=t.mergedParkingTexture)!=null&&n.length?this.createMergedParkingTexture(t.mergedParkingTexture):this.createParkingTexture(t.elements)}createMergedParking(t){return At(this,null,function*(){let e=new s_(this.context,t);this.mergedParkingSpace=e,this.add(e)})}createMergedParkingByMergedElements(t){let e=new a_(this.context,t);this.mergedParkingSpace=e,this.add(e)}createIndependentParking(t){t.forEach(e=>{var n;let i=new wo(this.context,e);this.add(i),(n=e.texts[0])==null||n.split(/[,,]/).map(o=>{this.parkingNoGraphicMap.set(o,i)}),this.graphicMap.set(i.options.id,i)})}createParkingTexture(t){let e=t.filter(n=>E6[n.parkingType]).map(n=>{let i=new ft(...n.geometry.coords[0][0]),o=new ft(...n.geometry.coords[0][1]),a=new ft(...n.geometry.coords[0][2]),l=Math.min(i.distanceTo(o),o.distanceTo(a)),c=0;return l===i.distanceTo(o)?c=o.sub(i).angle()-Math.PI/2:c=a.sub(o).angle()-Math.PI/2,{uuid:n.id,iconUrl:E6[n.parkingType],name:n.texts[0],deltaHeight:(n.deltaHeight||0)+.001,airHeight:n.airHeight,height:n.height,geometry:n.geometry,opacity:n.fillOpacity,visible:!0,secondWidth:l-1,secondHeight:l-1,secondRotate:c,centerCoords:[n.center_coord_x,n.center_coord_y]}});if(e.length){let n=new lp(this.context,e);this.add(n)}}createMergedParkingTexture(t){t.map(e=>{e.iconUrl=E6[e.iconUrl];let n=new cp(this.context,e);this.add(n)})}changeParkingColor(t){this.merged?Object.keys(t).map(e=>{let n=this.parkingNoIndexMap.get(e);if(!(0,OY.isNil)(n)){var i;(i=this.mergedParkingSpace)==null||i.setParkingColorByIndex(n,t[e])}}):Object.keys(t).map(e=>{let n=this.parkingNoGraphicMap.get(e);n&&(n.options.fillColor=t[e])})}getParkingOptionsByParkingNo(t){return this.parkingOptions.find(n=>n.texts[0]===t)||null}getGraphicPosition(t){if(this.merged){let e=this.parkingOptions.find(n=>n.id===t);return e?[e.center_x,e.center_y]:null}}dispose(){var t;(t=this.mergedParkingSpace)==null||t.dispose(),this.mergedParkingSpace=null,Lr(this),this.graphicMap.clear(),this.parkingNoGraphicMap.clear(),this.parkingNoIndexMap.clear(),this.nodeIdIndexMap.clear(),this.parkingOptions=[],super.dispose()}constructor(t){super(t),this.graphicMap=new Map,this.parkingNoGraphicMap=new Map,this.parkingOptions=[],this.merged=!1,this.parkingNoIndexMap=new Map,this.nodeIdIndexMap=new Map,this.mergedParkingSpace=null}};var OQt=H(En(),1);var u_=class extends Ki{addModels(t){let e=t.reduce((n,i)=>{let{url:o}=i;return n[o]?n[o].push(i):n[o]=[i],n},{});Object.values(e).forEach(n=>{let i=new l_(this.context,n);this.add(i)})}constructor(t){super(t)}};var ote=H(Ge(),1);function DY(r){return`${r.x}-${r.y}-${r.z}`}var ba=class{static generateLineMaterialKey({color:t,opacity:e}){return`${t}-${e}`}static createLineMaterial({color:t,opacity:e,vertexColors:n}){let i=this.generateLineMaterialKey({color:t,opacity:e,vertexColors:n});if(this.lineMaterialMap.has(i))return this.lineMaterialMap.get(i);let o=new ma({color:new ne(t).convertLinearToSRGB(),transparent:!0,opacity:e,vertexColors:n!=null?n:!1});return this.lineMaterialMap.set(i,o),o}static createMeshStandardMaterial({color:t,opacity:e}){let n=`${t}-${e}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new t0({color:new ne(t).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:e,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:t,opacity:e,vertexColors:n}){let i=`${t}-${e}-${n}`;if(this.meshBasicMaterialMap.has(i))return this.meshBasicMaterialMap.get(i);let o=new yi({color:t,transparent:!0,opacity:e,depthWrite:!0,vertexColors:n!=null?n:!1});return this.meshBasicMaterialMap.set(i,o),o}static createShaderMaterial({gradualColor:t,center:e,maxValue:n,opacity:i,direction:o,max:a,min:l}){let c=`${t.toString()}-${DY(e)}-${n}-${i}-${DY(o)}`;if(this.shaderMaterialMap.has(c))return this.shaderMaterialMap.get(c);let f=`
|
|
8171
8171
|
uniform vec3 uColor;
|
|
8172
8172
|
uniform vec3 uGradualColor;
|
|
8173
8173
|
uniform vec3 center;
|
|
@@ -12132,7 +12132,7 @@ void main() {
|
|
|
12132
12132
|
}
|
|
12133
12133
|
|
|
12134
12134
|
}\`,go=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){let s=new Le,r=t.properties.get(s);r.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let n=e.cameras[0].viewport,s=new qe({extensions:{fragDepth:!0},vertexShader:im,fragmentShader:sm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new ze(new Xs(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},_o=class extends Mn{constructor(t,e){super();let n=this,s=null,r=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,m=null,g=null,y=new go,f=e.getContextAttributes(),p=null,E=null,x=[],A=[],L=new nt,R=null,T=new Re;T.layers.enable(1),T.viewport=new de;let B=new Re;B.layers.enable(2),B.viewport=new de;let K=[T,B],v=new mo;v.layers.enable(1),v.layers.enable(2);let b=null,it=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(z){let Q=x[z];return Q===void 0&&(Q=new Fi,x[z]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(z){let Q=x[z];return Q===void 0&&(Q=new Fi,x[z]=Q),Q.getGripSpace()},this.getHand=function(z){let Q=x[z];return Q===void 0&&(Q=new Fi,x[z]=Q),Q.getHandSpace()};function $(z){let Q=A.indexOf(z.inputSource);if(Q===-1)return;let pt=x[Q];pt!==void 0&&(pt.update(z.inputSource,z.frame,c||a),pt.dispatchEvent({type:z.type,data:z.inputSource}))}function C(){s.removeEventListener("select",$),s.removeEventListener("selectstart",$),s.removeEventListener("selectend",$),s.removeEventListener("squeeze",$),s.removeEventListener("squeezestart",$),s.removeEventListener("squeezeend",$),s.removeEventListener("end",C),s.removeEventListener("inputsourceschange",H);for(let z=0;z<x.length;z++){let Q=A[z];Q!==null&&(A[z]=null,x[z].disconnect(Q))}b=null,it=null,y.reset(),t.setRenderTarget(p),m=null,d=null,u=null,s=null,E=null,Pt.stop(),n.isPresenting=!1,t.setPixelRatio(R),t.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(z){r=z,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(z){o=z,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(z){c=z},this.getBaseLayer=function(){return d!==null?d:m},this.getBinding=function(){return u},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=function(z){return Qi(this,null,function*(){if(s=z,s!==null){if(p=t.getRenderTarget(),s.addEventListener("select",$),s.addEventListener("selectstart",$),s.addEventListener("selectend",$),s.addEventListener("squeeze",$),s.addEventListener("squeezestart",$),s.addEventListener("squeezeend",$),s.addEventListener("end",C),s.addEventListener("inputsourceschange",H),f.xrCompatible!==!0&&(yield e.makeXRCompatible()),R=t.getPixelRatio(),t.getSize(L),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let Q={antialias:s.renderState.layers===void 0?f.antialias:!0,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};m=new XRWebGLLayer(s,e,Q),s.updateRenderState({baseLayer:m}),t.setPixelRatio(1),t.setSize(m.framebufferWidth,m.framebufferHeight,!1),E=new on(m.framebufferWidth,m.framebufferHeight,{format:Be,type:xn,colorSpace:t.outputColorSpace,stencilBuffer:f.stencil})}else{let Q=null,pt=null,Et=null;f.depth&&(Et=f.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Q=f.stencil?vi:zn,pt=f.stencil?Bn:mn);let yt={colorFormat:e.RGBA8,depthFormat:Et,scaleFactor:r};u=new XRWebGLBinding(s,e),d=u.createProjectionLayer(yt),s.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),E=new on(d.textureWidth,d.textureHeight,{format:Be,type:xn,depthTexture:new Ys(d.textureWidth,d.textureHeight,pt,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:f.stencil,colorSpace:t.outputColorSpace,samples:f.antialias?4:0});let xt=t.properties.get(E);xt.__ignoreDepthValues=d.ignoreDepthValues}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=yield s.requestReferenceSpace(o),Pt.setContext(s),Pt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function H(z){for(let Q=0;Q<z.removed.length;Q++){let pt=z.removed[Q],Et=A.indexOf(pt);Et>=0&&(A[Et]=null,x[Et].disconnect(pt))}for(let Q=0;Q<z.added.length;Q++){let pt=z.added[Q],Et=A.indexOf(pt);if(Et===-1){for(let xt=0;xt<x.length;xt++)if(xt>=A.length){A.push(pt),Et=xt;break}else if(A[xt]===null){A[xt]=pt,Et=xt;break}if(Et===-1)break}let yt=x[Et];yt&&yt.connect(pt)}}let V=new I,Y=new I;function W(z,Q,pt){V.setFromMatrixPosition(Q.matrixWorld),Y.setFromMatrixPosition(pt.matrixWorld);let Et=V.distanceTo(Y),yt=Q.projectionMatrix.elements,xt=pt.projectionMatrix.elements,zt=yt[14]/(yt[10]-1),At=yt[14]/(yt[10]+1),w=(yt[9]+1)/yt[5],ot=(yt[9]-1)/yt[5],q=(yt[8]-1)/yt[0],st=(xt[8]+1)/xt[0],Z=zt*q,_t=zt*st,ft=Et/(-q+st),vt=ft*-q;Q.matrixWorld.decompose(z.position,z.quaternion,z.scale),z.translateX(vt),z.translateZ(ft),z.matrixWorld.compose(z.position,z.quaternion,z.scale),z.matrixWorldInverse.copy(z.matrixWorld).invert();let Vt=zt+ft,S=At+ft,_=Z-vt,k=_t+(Et-vt),G=w*At/S*Vt,j=ot*At/S*Vt;z.projectionMatrix.makePerspective(_,k,G,j,Vt,S),z.projectionMatrixInverse.copy(z.projectionMatrix).invert()}function X(z,Q){Q===null?z.matrixWorld.copy(z.matrix):z.matrixWorld.multiplyMatrices(Q.matrixWorld,z.matrix),z.matrixWorldInverse.copy(z.matrixWorld).invert()}this.updateCamera=function(z){if(s===null)return;y.texture!==null&&(z.near=y.depthNear,z.far=y.depthFar),v.near=B.near=T.near=z.near,v.far=B.far=T.far=z.far,(b!==v.near||it!==v.far)&&(s.updateRenderState({depthNear:v.near,depthFar:v.far}),b=v.near,it=v.far,T.near=b,T.far=it,B.near=b,B.far=it,T.updateProjectionMatrix(),B.updateProjectionMatrix(),z.updateProjectionMatrix());let Q=z.parent,pt=v.cameras;X(v,Q);for(let Et=0;Et<pt.length;Et++)X(pt[Et],Q);pt.length===2?W(v,T,B):v.projectionMatrix.copy(T.projectionMatrix),et(z,v,Q)};function et(z,Q,pt){pt===null?z.matrix.copy(Q.matrixWorld):(z.matrix.copy(pt.matrixWorld),z.matrix.invert(),z.matrix.multiply(Q.matrixWorld)),z.matrix.decompose(z.position,z.quaternion,z.scale),z.updateMatrixWorld(!0),z.projectionMatrix.copy(Q.projectionMatrix),z.projectionMatrixInverse.copy(Q.projectionMatrixInverse),z.isPerspectiveCamera&&(z.fov=Qr*2*Math.atan(1/z.projectionMatrix.elements[5]),z.zoom=1)}this.getCamera=function(){return v},this.getFoveation=function(){if(!(d===null&&m===null))return l},this.setFoveation=function(z){l=z,d!==null&&(d.fixedFoveation=z),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=z)},this.hasDepthSensing=function(){return y.texture!==null};let tt=null;function gt(z,Q){if(h=Q.getViewerPose(c||a),g=Q,h!==null){let pt=h.views;m!==null&&(t.setRenderTargetFramebuffer(E,m.framebuffer),t.setRenderTarget(E));let Et=!1;pt.length!==v.cameras.length&&(v.cameras.length=0,Et=!0);for(let xt=0;xt<pt.length;xt++){let zt=pt[xt],At=null;if(m!==null)At=m.getViewport(zt);else{let ot=u.getViewSubImage(d,zt);At=ot.viewport,xt===0&&(t.setRenderTargetTextures(E,ot.colorTexture,d.ignoreDepthValues?void 0:ot.depthStencilTexture),t.setRenderTarget(E))}let w=K[xt];w===void 0&&(w=new Re,w.layers.enable(xt),w.viewport=new de,K[xt]=w),w.matrix.fromArray(zt.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(zt.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(At.x,At.y,At.width,At.height),xt===0&&(v.matrix.copy(w.matrix),v.matrix.decompose(v.position,v.quaternion,v.scale)),Et===!0&&v.cameras.push(w)}let yt=s.enabledFeatures;if(yt&&yt.includes("depth-sensing")){let xt=u.getDepthInformation(pt[0]);xt&&xt.isValid&&xt.texture&&y.init(t,xt,s.renderState)}}for(let pt=0;pt<x.length;pt++){let Et=A[pt],yt=x[pt];Et!==null&&yt!==void 0&&yt.update(Et,Q,c||a)}y.render(t,v),tt&&tt(z,Q),Q.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Q}),g=null}let Pt=new Wl;Pt.setAnimationLoop(gt),this.setAnimationLoop=function(z){tt=z},this.dispose=function(){}}},In=new Vn,rm=new oe;function om(i,t){function e(f,p){f.matrixAutoUpdate===!0&&f.updateMatrix(),p.value.copy(f.matrix)}function n(f,p){p.color.getRGB(f.fogColor.value,Hl(i)),p.isFog?(f.fogNear.value=p.near,f.fogFar.value=p.far):p.isFogExp2&&(f.fogDensity.value=p.density)}function s(f,p,E,x,A){p.isMeshBasicMaterial||p.isMeshLambertMaterial?r(f,p):p.isMeshToonMaterial?(r(f,p),u(f,p)):p.isMeshPhongMaterial?(r(f,p),h(f,p)):p.isMeshStandardMaterial?(r(f,p),d(f,p),p.isMeshPhysicalMaterial&&m(f,p,A)):p.isMeshMatcapMaterial?(r(f,p),g(f,p)):p.isMeshDepthMaterial?r(f,p):p.isMeshDistanceMaterial?(r(f,p),y(f,p)):p.isMeshNormalMaterial?r(f,p):p.isLineBasicMaterial?(a(f,p),p.isLineDashedMaterial&&o(f,p)):p.isPointsMaterial?l(f,p,E,x):p.isSpriteMaterial?c(f,p):p.isShadowMaterial?(f.color.value.copy(p.color),f.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function r(f,p){f.opacity.value=p.opacity,p.color&&f.diffuse.value.copy(p.color),p.emissive&&f.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(f.map.value=p.map,e(p.map,f.mapTransform)),p.alphaMap&&(f.alphaMap.value=p.alphaMap,e(p.alphaMap,f.alphaMapTransform)),p.bumpMap&&(f.bumpMap.value=p.bumpMap,e(p.bumpMap,f.bumpMapTransform),f.bumpScale.value=p.bumpScale,p.side===be&&(f.bumpScale.value*=-1)),p.normalMap&&(f.normalMap.value=p.normalMap,e(p.normalMap,f.normalMapTransform),f.normalScale.value.copy(p.normalScale),p.side===be&&f.normalScale.value.negate()),p.displacementMap&&(f.displacementMap.value=p.displacementMap,e(p.displacementMap,f.displacementMapTransform),f.displacementScale.value=p.displacementScale,f.displacementBias.value=p.displacementBias),p.emissiveMap&&(f.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,f.emissiveMapTransform)),p.specularMap&&(f.specularMap.value=p.specularMap,e(p.specularMap,f.specularMapTransform)),p.alphaTest>0&&(f.alphaTest.value=p.alphaTest);let E=t.get(p),x=E.envMap,A=E.envMapRotation;if(x&&(f.envMap.value=x,In.copy(A),In.x*=-1,In.y*=-1,In.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(In.y*=-1,In.z*=-1),f.envMapRotation.value.setFromMatrix4(rm.makeRotationFromEuler(In)),f.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,f.reflectivity.value=p.reflectivity,f.ior.value=p.ior,f.refractionRatio.value=p.refractionRatio),p.lightMap){f.lightMap.value=p.lightMap;let L=i._useLegacyLights===!0?Math.PI:1;f.lightMapIntensity.value=p.lightMapIntensity*L,e(p.lightMap,f.lightMapTransform)}p.aoMap&&(f.aoMap.value=p.aoMap,f.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,f.aoMapTransform))}function a(f,p){f.diffuse.value.copy(p.color),f.opacity.value=p.opacity,p.map&&(f.map.value=p.map,e(p.map,f.mapTransform))}function o(f,p){f.dashSize.value=p.dashSize,f.totalSize.value=p.dashSize+p.gapSize,f.scale.value=p.scale}function l(f,p,E,x){f.diffuse.value.copy(p.color),f.opacity.value=p.opacity,f.size.value=p.size*E,f.scale.value=x*.5,p.map&&(f.map.value=p.map,e(p.map,f.uvTransform)),p.alphaMap&&(f.alphaMap.value=p.alphaMap,e(p.alphaMap,f.alphaMapTransform)),p.alphaTest>0&&(f.alphaTest.value=p.alphaTest)}function c(f,p){f.diffuse.value.copy(p.color),f.opacity.value=p.opacity,f.rotation.value=p.rotation,p.map&&(f.map.value=p.map,e(p.map,f.mapTransform)),p.alphaMap&&(f.alphaMap.value=p.alphaMap,e(p.alphaMap,f.alphaMapTransform)),p.alphaTest>0&&(f.alphaTest.value=p.alphaTest)}function h(f,p){f.specular.value.copy(p.specular),f.shininess.value=Math.max(p.shininess,1e-4)}function u(f,p){p.gradientMap&&(f.gradientMap.value=p.gradientMap)}function d(f,p){f.metalness.value=p.metalness,p.metalnessMap&&(f.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,f.metalnessMapTransform)),f.roughness.value=p.roughness,p.roughnessMap&&(f.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,f.roughnessMapTransform)),t.get(p).envMap&&(f.envMapIntensity.value=p.envMapIntensity)}function m(f,p,E){f.ior.value=p.ior,p.sheen>0&&(f.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),f.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(f.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,f.sheenColorMapTransform)),p.sheenRoughnessMap&&(f.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,f.sheenRoughnessMapTransform))),p.clearcoat>0&&(f.clearcoat.value=p.clearcoat,f.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(f.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,f.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(f.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===be&&f.clearcoatNormalScale.value.negate())),p.iridescence>0&&(f.iridescence.value=p.iridescence,f.iridescenceIOR.value=p.iridescenceIOR,f.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(f.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,f.iridescenceMapTransform)),p.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),p.transmission>0&&(f.transmission.value=p.transmission,f.transmissionSamplerMap.value=E.texture,f.transmissionSamplerSize.value.set(E.width,E.height),p.transmissionMap&&(f.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,f.transmissionMapTransform)),f.thickness.value=p.thickness,p.thicknessMap&&(f.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=p.attenuationDistance,f.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(f.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(f.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=p.specularIntensity,f.specularColor.value.copy(p.specularColor),p.specularColorMap&&(f.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,f.specularColorMapTransform)),p.specularIntensityMap&&(f.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,f.specularIntensityMapTransform))}function g(f,p){p.matcap&&(f.matcap.value=p.matcap)}function y(f,p){let E=t.get(p).light;f.referencePosition.value.setFromMatrixPosition(E.matrixWorld),f.nearDistance.value=E.shadow.camera.near,f.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function am(i,t,e,n){let s={},r={},a=[],o=e.isWebGL2?i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(E,x){let A=x.program;n.uniformBlockBinding(E,A)}function c(E,x){let A=s[E.id];A===void 0&&(g(E),A=h(E),s[E.id]=A,E.addEventListener("dispose",f));let L=x.program;n.updateUBOMapping(E,L);let R=t.render.frame;r[E.id]!==R&&(d(E),r[E.id]=R)}function h(E){let x=u();E.__bindingPointIndex=x;let A=i.createBuffer(),L=E.__size,R=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,A),i.bufferData(i.UNIFORM_BUFFER,L,R),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,A),A}function u(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(E){let x=s[E.id],A=E.uniforms,L=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,x);for(let R=0,T=A.length;R<T;R++){let B=Array.isArray(A[R])?A[R]:[A[R]];for(let K=0,v=B.length;K<v;K++){let b=B[K];if(m(b,R,K,L)===!0){let it=b.__offset,$=Array.isArray(b.value)?b.value:[b.value],C=0;for(let H=0;H<$.length;H++){let V=$[H],Y=y(V);typeof V=="number"||typeof V=="boolean"?(b.__data[0]=V,i.bufferSubData(i.UNIFORM_BUFFER,it+C,b.__data)):V.isMatrix3?(b.__data[0]=V.elements[0],b.__data[1]=V.elements[1],b.__data[2]=V.elements[2],b.__data[3]=0,b.__data[4]=V.elements[3],b.__data[5]=V.elements[4],b.__data[6]=V.elements[5],b.__data[7]=0,b.__data[8]=V.elements[6],b.__data[9]=V.elements[7],b.__data[10]=V.elements[8],b.__data[11]=0):(V.toArray(b.__data,C),C+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,it,b.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function m(E,x,A,L){let R=E.value,T=x+"_"+A;if(L[T]===void 0)return typeof R=="number"||typeof R=="boolean"?L[T]=R:L[T]=R.clone(),!0;{let B=L[T];if(typeof R=="number"||typeof R=="boolean"){if(B!==R)return L[T]=R,!0}else if(B.equals(R)===!1)return B.copy(R),!0}return!1}function g(E){let x=E.uniforms,A=0,L=16;for(let T=0,B=x.length;T<B;T++){let K=Array.isArray(x[T])?x[T]:[x[T]];for(let v=0,b=K.length;v<b;v++){let it=K[v],$=Array.isArray(it.value)?it.value:[it.value];for(let C=0,H=$.length;C<H;C++){let V=$[C],Y=y(V),W=A%L;W!==0&&L-W<Y.boundary&&(A+=L-W),it.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),it.__offset=A,A+=Y.storage}}}let R=A%L;return R>0&&(A+=L-R),E.__size=A,E.__cache={},this}function y(E){let x={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(x.boundary=4,x.storage=4):E.isVector2?(x.boundary=8,x.storage=8):E.isVector3||E.isColor?(x.boundary=16,x.storage=12):E.isVector4?(x.boundary=16,x.storage=16):E.isMatrix3?(x.boundary=48,x.storage=48):E.isMatrix4?(x.boundary=64,x.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),x}function f(E){let x=E.target;x.removeEventListener("dispose",f);let A=a.indexOf(x.__bindingPointIndex);a.splice(A,1),i.deleteBuffer(s[x.id]),delete s[x.id],delete r[x.id]}function p(){for(let E in s)i.deleteBuffer(s[E]);a=[],s={},r={}}return{bind:l,update:c,dispose:p}}var xo=class{constructor(t={}){let{canvas:e=hh(),context:n=null,depth:s=!0,stencil:r=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=t;this.isWebGLRenderer=!0;let d;n!==null?d=n.getContextAttributes().alpha:d=a;let m=new Uint32Array(4),g=new Int32Array(4),y=null,f=null,p=[],E=[];this.domElement=e,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=He,this._useLegacyLights=!1,this.toneMapping=_n,this.toneMappingExposure=1;let x=this,A=!1,L=0,R=0,T=null,B=-1,K=null,v=new de,b=new de,it=null,$=new Wt(0),C=0,H=e.width,V=e.height,Y=1,W=null,X=null,et=new de(0,0,H,V),tt=new de(0,0,H,V),gt=!1,Pt=new Ws,z=!1,Q=!1,pt=null,Et=new oe,yt=new nt,xt=new I,zt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function At(){return T===null?Y:1}let w=n;function ot(M,U){for(let O=0;O<M.length;O++){let F=M[O],D=e.getContext(F,U);if(D!==null)return D}return null}try{let M={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${Vo}\`),e.addEventListener("webglcontextlost",Kt,!1),e.addEventListener("webglcontextrestored",P,!1),e.addEventListener("webglcontextcreationerror",ut,!1),w===null){let U=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&U.shift(),w=ot(U,M),w===null)throw ot(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&w instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),w.getShaderPrecisionFormat===void 0&&(w.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let q,st,Z,_t,ft,vt,Vt,S,_,k,G,j,J,It,Tt,lt,ht,Lt,rt,se,Gt,wt,Mt,St;function Xt(){q=new bf(w),st=new _f(w,q,t),q.init(st),wt=new em(w,q,st),Z=new jp(w,q,st),_t=new wf(w),ft=new Vp,vt=new tm(w,q,Z,ft,st,wt,_t),Vt=new vf(x),S=new Sf(x),_=new Ih(w,st),Mt=new mf(w,q,_,st),k=new Ef(w,_,_t,Mt),G=new Pf(w,k,_,_t),rt=new Cf(w,st,vt),lt=new xf(ft),j=new kp(x,Vt,S,q,st,Mt,lt),J=new om(x,ft),It=new Hp,Tt=new Jp(q,st),Lt=new pf(x,Vt,S,Z,G,d,l),ht=new Qp(x,G,st),St=new am(w,_t,st,Z),se=new gf(w,q,_t,st),Gt=new Af(w,q,_t,st),_t.programs=j.programs,x.capabilities=st,x.extensions=q,x.properties=ft,x.renderLists=It,x.shadowMap=ht,x.state=Z,x.info=_t}Xt();let Dt=new _o(x,w);this.xr=Dt,this.getContext=function(){return w},this.getContextAttributes=function(){return w.getContextAttributes()},this.forceContextLoss=function(){let M=q.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){let M=q.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(M){M!==void 0&&(Y=M,this.setSize(H,V,!1))},this.getSize=function(M){return M.set(H,V)},this.setSize=function(M,U,O=!0){if(Dt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=M,V=U,e.width=Math.floor(M*Y),e.height=Math.floor(U*Y),O===!0&&(e.style.width=M+"px",e.style.height=U+"px"),this.setViewport(0,0,M,U)},this.getDrawingBufferSize=function(M){return M.set(H*Y,V*Y).floor()},this.setDrawingBufferSize=function(M,U,O){H=M,V=U,Y=O,e.width=Math.floor(M*O),e.height=Math.floor(U*O),this.setViewport(0,0,M,U)},this.getCurrentViewport=function(M){return M.copy(v)},this.getViewport=function(M){return M.copy(et)},this.setViewport=function(M,U,O,F){M.isVector4?et.set(M.x,M.y,M.z,M.w):et.set(M,U,O,F),Z.viewport(v.copy(et).multiplyScalar(Y).round())},this.getScissor=function(M){return M.copy(tt)},this.setScissor=function(M,U,O,F){M.isVector4?tt.set(M.x,M.y,M.z,M.w):tt.set(M,U,O,F),Z.scissor(b.copy(tt).multiplyScalar(Y).round())},this.getScissorTest=function(){return gt},this.setScissorTest=function(M){Z.setScissorTest(gt=M)},this.setOpaqueSort=function(M){W=M},this.setTransparentSort=function(M){X=M},this.getClearColor=function(M){return M.copy(Lt.getClearColor())},this.setClearColor=function(){Lt.setClearColor.apply(Lt,arguments)},this.getClearAlpha=function(){return Lt.getClearAlpha()},this.setClearAlpha=function(){Lt.setClearAlpha.apply(Lt,arguments)},this.clear=function(M=!0,U=!0,O=!0){let F=0;if(M){let D=!1;if(T!==null){let mt=T.texture.format;D=mt===Fl||mt===Ol||mt===Nl}if(D){let mt=T.texture.type,bt=mt===xn||mt===mn||mt===Go||mt===Bn||mt===Ul||mt===Dl,Rt=Lt.getClearColor(),Ct=Lt.getClearAlpha(),kt=Rt.r,Ut=Rt.g,Nt=Rt.b;bt?(m[0]=kt,m[1]=Ut,m[2]=Nt,m[3]=Ct,w.clearBufferuiv(w.COLOR,0,m)):(g[0]=kt,g[1]=Ut,g[2]=Nt,g[3]=Ct,w.clearBufferiv(w.COLOR,0,g))}else F|=w.COLOR_BUFFER_BIT}U&&(F|=w.DEPTH_BUFFER_BIT),O&&(F|=w.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),w.clear(F)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Kt,!1),e.removeEventListener("webglcontextrestored",P,!1),e.removeEventListener("webglcontextcreationerror",ut,!1),It.dispose(),Tt.dispose(),ft.dispose(),Vt.dispose(),S.dispose(),G.dispose(),Mt.dispose(),St.dispose(),j.dispose(),ht.dispose(),Dt.dispose(),Dt.removeEventListener("sessionstart",Ce),Dt.removeEventListener("sessionend",Jt),pt&&(pt.dispose(),pt=null),xe.stop()};function Kt(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),A=!0}function P(){console.log("THREE.WebGLRenderer: Context Restored."),A=!1;let M=_t.autoReset,U=ht.enabled,O=ht.autoUpdate,F=ht.needsUpdate,D=ht.type;Xt(),_t.autoReset=M,ht.enabled=U,ht.autoUpdate=O,ht.needsUpdate=F,ht.type=D}function ut(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function N(M){let U=M.target;U.removeEventListener("dispose",N),at(U)}function at(M){dt(M),ft.remove(M)}function dt(M){let U=ft.get(M).programs;U!==void 0&&(U.forEach(function(O){j.releaseProgram(O)}),M.isShaderMaterial&&j.releaseShaderCache(M))}this.renderBufferDirect=function(M,U,O,F,D,mt){U===null&&(U=zt);let bt=D.isMesh&&D.matrixWorld.determinant()<0,Rt=rc(M,U,O,F,D);Z.setMaterial(F,bt);let Ct=O.index,kt=1;if(F.wireframe===!0){if(Ct=k.getWireframeAttribute(O),Ct===void 0)return;kt=2}let Ut=O.drawRange,Nt=O.attributes.position,ie=Ut.start*kt,Ae=(Ut.start+Ut.count)*kt;mt!==null&&(ie=Math.max(ie,mt.start*kt),Ae=Math.min(Ae,(mt.start+mt.count)*kt)),Ct!==null?(ie=Math.max(ie,0),Ae=Math.min(Ae,Ct.count)):Nt!=null&&(ie=Math.max(ie,0),Ae=Math.min(Ae,Nt.count));let ce=Ae-ie;if(ce<0||ce===1/0)return;Mt.setup(D,F,Rt,O,Ct);let Ye,ee=se;if(Ct!==null&&(Ye=_.get(Ct),ee=Gt,ee.setIndex(Ye)),D.isMesh)F.wireframe===!0?(Z.setLineWidth(F.wireframeLinewidth*At()),ee.setMode(w.LINES)):ee.setMode(w.TRIANGLES);else if(D.isLine){let Ot=F.linewidth;Ot===void 0&&(Ot=1),Z.setLineWidth(Ot*At()),D.isLineSegments?ee.setMode(w.LINES):D.isLineLoop?ee.setMode(w.LINE_LOOP):ee.setMode(w.LINE_STRIP)}else D.isPoints?ee.setMode(w.POINTS):D.isSprite&&ee.setMode(w.TRIANGLES);if(D.isBatchedMesh)ee.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else if(D.isInstancedMesh)ee.renderInstances(ie,ce,D.count);else if(O.isInstancedBufferGeometry){let Ot=O._maxInstanceCount!==void 0?O._maxInstanceCount:1/0,ir=Math.min(O.instanceCount,Ot);ee.renderInstances(ie,ce,ir)}else ee.render(ie,ce)};function Ht(M,U,O){M.transparent===!0&&M.side===en&&M.forceSinglePass===!1?(M.side=be,M.needsUpdate=!0,Ki(M,U,O),M.side=yn,M.needsUpdate=!0,Ki(M,U,O),M.side=en):Ki(M,U,O)}this.compile=function(M,U,O=null){O===null&&(O=M),f=Tt.get(O),f.init(),E.push(f),O.traverseVisible(function(D){D.isLight&&D.layers.test(U.layers)&&(f.pushLight(D),D.castShadow&&f.pushShadow(D))}),M!==O&&M.traverseVisible(function(D){D.isLight&&D.layers.test(U.layers)&&(f.pushLight(D),D.castShadow&&f.pushShadow(D))}),f.setupLights(x._useLegacyLights);let F=new Set;return M.traverse(function(D){let mt=D.material;if(mt)if(Array.isArray(mt))for(let bt=0;bt<mt.length;bt++){let Rt=mt[bt];Ht(Rt,O,D),F.add(Rt)}else Ht(mt,O,D),F.add(mt)}),E.pop(),f=null,F},this.compileAsync=function(M,U,O=null){let F=this.compile(M,U,O);return new Promise(D=>{function mt(){if(F.forEach(function(bt){ft.get(bt).currentProgram.isReady()&&F.delete(bt)}),F.size===0){D(M);return}setTimeout(mt,10)}q.get("KHR_parallel_shader_compile")!==null?mt():setTimeout(mt,10)})};let Zt=null;function ue(M){Zt&&Zt(M)}function Ce(){xe.stop()}function Jt(){xe.start()}let xe=new Wl;xe.setAnimationLoop(ue),typeof self!="undefined"&&xe.setContext(self),this.setAnimationLoop=function(M){Zt=M,Dt.setAnimationLoop(M),M===null?xe.stop():xe.start()},Dt.addEventListener("sessionstart",Ce),Dt.addEventListener("sessionend",Jt),this.render=function(M,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),Dt.enabled===!0&&Dt.isPresenting===!0&&(Dt.cameraAutoUpdate===!0&&Dt.updateCamera(U),U=Dt.getCamera()),M.isScene===!0&&M.onBeforeRender(x,M,U,T),f=Tt.get(M,E.length),f.init(),E.push(f),Et.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),Pt.setFromProjectionMatrix(Et),Q=this.localClippingEnabled,z=lt.init(this.clippingPlanes,Q),y=It.get(M,p.length),y.init(),p.push(y),Ge(M,U,0,x.sortObjects),y.finish(),x.sortObjects===!0&&y.sort(W,X),this.info.render.frame++,z===!0&<.beginShadows();let O=f.state.shadowsArray;if(ht.render(O,M,U),z===!0&<.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Dt.enabled===!1||Dt.isPresenting===!1||Dt.hasDepthSensing()===!1)&&Lt.render(y,M),f.setupLights(x._useLegacyLights),U.isArrayCamera){let F=U.cameras;for(let D=0,mt=F.length;D<mt;D++){let bt=F[D];Zo(y,M,bt,bt.viewport)}}else Zo(y,M,U);T!==null&&(vt.updateMultisampleRenderTarget(T),vt.updateRenderTargetMipmap(T)),M.isScene===!0&&M.onAfterRender(x,M,U),Mt.resetDefaultState(),B=-1,K=null,E.pop(),E.length>0?f=E[E.length-1]:f=null,p.pop(),p.length>0?y=p[p.length-1]:y=null};function Ge(M,U,O,F){if(M.visible===!1)return;if(M.layers.test(U.layers)){if(M.isGroup)O=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(U);else if(M.isLight)f.pushLight(M),M.castShadow&&f.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Pt.intersectsSprite(M)){F&&xt.setFromMatrixPosition(M.matrixWorld).applyMatrix4(Et);let bt=G.update(M),Rt=M.material;Rt.visible&&y.push(M,bt,Rt,O,xt.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Pt.intersectsObject(M))){let bt=G.update(M),Rt=M.material;if(F&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),xt.copy(M.boundingSphere.center)):(bt.boundingSphere===null&&bt.computeBoundingSphere(),xt.copy(bt.boundingSphere.center)),xt.applyMatrix4(M.matrixWorld).applyMatrix4(Et)),Array.isArray(Rt)){let Ct=bt.groups;for(let kt=0,Ut=Ct.length;kt<Ut;kt++){let Nt=Ct[kt],ie=Rt[Nt.materialIndex];ie&&ie.visible&&y.push(M,bt,ie,O,xt.z,Nt)}}else Rt.visible&&y.push(M,bt,Rt,O,xt.z,null)}}let mt=M.children;for(let bt=0,Rt=mt.length;bt<Rt;bt++)Ge(mt[bt],U,O,F)}function Zo(M,U,O,F){let D=M.opaque,mt=M.transmissive,bt=M.transparent;f.setupLightsView(O),z===!0&<.setGlobalState(x.clippingPlanes,O),mt.length>0&&sc(D,mt,U,O),F&&Z.viewport(v.copy(F)),D.length>0&&$i(D,U,O),mt.length>0&&$i(mt,U,O),bt.length>0&&$i(bt,U,O),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function sc(M,U,O,F){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;let mt=st.isWebGL2;pt===null&&(pt=new on(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?ki:xn,minFilter:Nn,samples:mt?4:0})),x.getDrawingBufferSize(yt),mt?pt.setSize(yt.x,yt.y):pt.setSize(jr(yt.x),jr(yt.y));let bt=x.getRenderTarget();x.setRenderTarget(pt),x.getClearColor($),C=x.getClearAlpha(),C<1&&x.setClearColor(16777215,.5),x.clear();let Rt=x.toneMapping;x.toneMapping=_n,$i(M,O,F),vt.updateMultisampleRenderTarget(pt),vt.updateRenderTargetMipmap(pt);let Ct=!1;for(let kt=0,Ut=U.length;kt<Ut;kt++){let Nt=U[kt],ie=Nt.object,Ae=Nt.geometry,ce=Nt.material,Ye=Nt.group;if(ce.side===en&&ie.layers.test(F.layers)){let ee=ce.side;ce.side=be,ce.needsUpdate=!0,Jo(ie,O,F,Ae,ce,Ye),ce.side=ee,ce.needsUpdate=!0,Ct=!0}}Ct===!0&&(vt.updateMultisampleRenderTarget(pt),vt.updateRenderTargetMipmap(pt)),x.setRenderTarget(bt),x.setClearColor($,C),x.toneMapping=Rt}function $i(M,U,O){let F=U.isScene===!0?U.overrideMaterial:null;for(let D=0,mt=M.length;D<mt;D++){let bt=M[D],Rt=bt.object,Ct=bt.geometry,kt=F===null?bt.material:F,Ut=bt.group;Rt.layers.test(O.layers)&&Jo(Rt,U,O,Ct,kt,Ut)}}function Jo(M,U,O,F,D,mt){M.onBeforeRender(x,U,O,F,D,mt),M.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),D.onBeforeRender(x,U,O,F,M,mt),D.transparent===!0&&D.side===en&&D.forceSinglePass===!1?(D.side=be,D.needsUpdate=!0,x.renderBufferDirect(O,U,F,D,M,mt),D.side=yn,D.needsUpdate=!0,x.renderBufferDirect(O,U,F,D,M,mt),D.side=en):x.renderBufferDirect(O,U,F,D,M,mt),M.onAfterRender(x,U,O,F,D,mt)}function Ki(M,U,O){U.isScene!==!0&&(U=zt);let F=ft.get(M),D=f.state.lights,mt=f.state.shadowsArray,bt=D.state.version,Rt=j.getParameters(M,D.state,mt,U,O),Ct=j.getProgramCacheKey(Rt),kt=F.programs;F.environment=M.isMeshStandardMaterial?U.environment:null,F.fog=U.fog,F.envMap=(M.isMeshStandardMaterial?S:Vt).get(M.envMap||F.environment),F.envMapRotation=F.environment!==null&&M.envMap===null?U.environmentRotation:M.envMapRotation,kt===void 0&&(M.addEventListener("dispose",N),kt=new Map,F.programs=kt);let Ut=kt.get(Ct);if(Ut!==void 0){if(F.currentProgram===Ut&&F.lightsStateVersion===bt)return Ko(M,Rt),Ut}else Rt.uniforms=j.getUniforms(M),M.onBuild(O,Rt,x),M.onBeforeCompile(Rt,x),Ut=j.acquireProgram(Rt,Ct),kt.set(Ct,Ut),F.uniforms=Rt.uniforms;let Nt=F.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Nt.clippingPlanes=lt.uniform),Ko(M,Rt),F.needsLights=ac(M),F.lightsStateVersion=bt,F.needsLights&&(Nt.ambientLightColor.value=D.state.ambient,Nt.lightProbe.value=D.state.probe,Nt.directionalLights.value=D.state.directional,Nt.directionalLightShadows.value=D.state.directionalShadow,Nt.spotLights.value=D.state.spot,Nt.spotLightShadows.value=D.state.spotShadow,Nt.rectAreaLights.value=D.state.rectArea,Nt.ltc_1.value=D.state.rectAreaLTC1,Nt.ltc_2.value=D.state.rectAreaLTC2,Nt.pointLights.value=D.state.point,Nt.pointLightShadows.value=D.state.pointShadow,Nt.hemisphereLights.value=D.state.hemi,Nt.directionalShadowMap.value=D.state.directionalShadowMap,Nt.directionalShadowMatrix.value=D.state.directionalShadowMatrix,Nt.spotShadowMap.value=D.state.spotShadowMap,Nt.spotLightMatrix.value=D.state.spotLightMatrix,Nt.spotLightMap.value=D.state.spotLightMap,Nt.pointShadowMap.value=D.state.pointShadowMap,Nt.pointShadowMatrix.value=D.state.pointShadowMatrix),F.currentProgram=Ut,F.uniformsList=null,Ut}function $o(M){if(M.uniformsList===null){let U=M.currentProgram.getUniforms();M.uniformsList=gi.seqWithValue(U.seq,M.uniforms)}return M.uniformsList}function Ko(M,U){let O=ft.get(M);O.outputColorSpace=U.outputColorSpace,O.batching=U.batching,O.instancing=U.instancing,O.instancingColor=U.instancingColor,O.instancingMorph=U.instancingMorph,O.skinning=U.skinning,O.morphTargets=U.morphTargets,O.morphNormals=U.morphNormals,O.morphColors=U.morphColors,O.morphTargetsCount=U.morphTargetsCount,O.numClippingPlanes=U.numClippingPlanes,O.numIntersection=U.numClipIntersection,O.vertexAlphas=U.vertexAlphas,O.vertexTangents=U.vertexTangents,O.toneMapping=U.toneMapping}function rc(M,U,O,F,D){U.isScene!==!0&&(U=zt),vt.resetTextureUnits();let mt=U.fog,bt=F.isMeshStandardMaterial?U.environment:null,Rt=T===null?x.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:bn,Ct=(F.isMeshStandardMaterial?S:Vt).get(F.envMap||bt),kt=F.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,Ut=!!O.attributes.tangent&&(!!F.normalMap||F.anisotropy>0),Nt=!!O.morphAttributes.position,ie=!!O.morphAttributes.normal,Ae=!!O.morphAttributes.color,ce=_n;F.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(ce=x.toneMapping);let Ye=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,ee=Ye!==void 0?Ye.length:0,Ot=ft.get(F),ir=f.state.lights;if(z===!0&&(Q===!0||M!==K)){let Pe=M===K&&F.id===B;lt.setState(F,M,Pe)}let Qt=!1;F.version===Ot.__version?(Ot.needsLights&&Ot.lightsStateVersion!==ir.state.version||Ot.outputColorSpace!==Rt||D.isBatchedMesh&&Ot.batching===!1||!D.isBatchedMesh&&Ot.batching===!0||D.isInstancedMesh&&Ot.instancing===!1||!D.isInstancedMesh&&Ot.instancing===!0||D.isSkinnedMesh&&Ot.skinning===!1||!D.isSkinnedMesh&&Ot.skinning===!0||D.isInstancedMesh&&Ot.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&Ot.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&Ot.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&Ot.instancingMorph===!1&&D.morphTexture!==null||Ot.envMap!==Ct||F.fog===!0&&Ot.fog!==mt||Ot.numClippingPlanes!==void 0&&(Ot.numClippingPlanes!==lt.numPlanes||Ot.numIntersection!==lt.numIntersection)||Ot.vertexAlphas!==kt||Ot.vertexTangents!==Ut||Ot.morphTargets!==Nt||Ot.morphNormals!==ie||Ot.morphColors!==Ae||Ot.toneMapping!==ce||st.isWebGL2===!0&&Ot.morphTargetsCount!==ee)&&(Qt=!0):(Qt=!0,Ot.__version=F.version);let En=Ot.currentProgram;Qt===!0&&(En=Ki(F,U,D));let Qo=!1,Ri=!1,sr=!1,pe=En.getUniforms(),An=Ot.uniforms;if(Z.useProgram(En.program)&&(Qo=!0,Ri=!0,sr=!0),F.id!==B&&(B=F.id,Ri=!0),Qo||K!==M){pe.setValue(w,"projectionMatrix",M.projectionMatrix),pe.setValue(w,"viewMatrix",M.matrixWorldInverse);let Pe=pe.map.cameraPosition;Pe!==void 0&&Pe.setValue(w,xt.setFromMatrixPosition(M.matrixWorld)),st.logarithmicDepthBuffer&&pe.setValue(w,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(F.isMeshPhongMaterial||F.isMeshToonMaterial||F.isMeshLambertMaterial||F.isMeshBasicMaterial||F.isMeshStandardMaterial||F.isShaderMaterial)&&pe.setValue(w,"isOrthographic",M.isOrthographicCamera===!0),K!==M&&(K=M,Ri=!0,sr=!0)}if(D.isSkinnedMesh){pe.setOptional(w,D,"bindMatrix"),pe.setOptional(w,D,"bindMatrixInverse");let Pe=D.skeleton;Pe&&(st.floatVertexTextures?(Pe.boneTexture===null&&Pe.computeBoneTexture(),pe.setValue(w,"boneTexture",Pe.boneTexture,vt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}D.isBatchedMesh&&(pe.setOptional(w,D,"batchingTexture"),pe.setValue(w,"batchingTexture",D._matricesTexture,vt));let rr=O.morphAttributes;if((rr.position!==void 0||rr.normal!==void 0||rr.color!==void 0&&st.isWebGL2===!0)&&rt.update(D,O,En),(Ri||Ot.receiveShadow!==D.receiveShadow)&&(Ot.receiveShadow=D.receiveShadow,pe.setValue(w,"receiveShadow",D.receiveShadow)),F.isMeshGouraudMaterial&&F.envMap!==null&&(An.envMap.value=Ct,An.flipEnvMap.value=Ct.isCubeTexture&&Ct.isRenderTargetTexture===!1?-1:1),Ri&&(pe.setValue(w,"toneMappingExposure",x.toneMappingExposure),Ot.needsLights&&oc(An,sr),mt&&F.fog===!0&&J.refreshFogUniforms(An,mt),J.refreshMaterialUniforms(An,F,Y,V,pt),gi.upload(w,$o(Ot),An,vt)),F.isShaderMaterial&&F.uniformsNeedUpdate===!0&&(gi.upload(w,$o(Ot),An,vt),F.uniformsNeedUpdate=!1),F.isSpriteMaterial&&pe.setValue(w,"center",D.center),pe.setValue(w,"modelViewMatrix",D.modelViewMatrix),pe.setValue(w,"normalMatrix",D.normalMatrix),pe.setValue(w,"modelMatrix",D.matrixWorld),F.isShaderMaterial||F.isRawShaderMaterial){let Pe=F.uniformsGroups;for(let or=0,lc=Pe.length;or<lc;or++)if(st.isWebGL2){let jo=Pe[or];St.update(jo,En),St.bind(jo,En)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return En}function oc(M,U){M.ambientLightColor.needsUpdate=U,M.lightProbe.needsUpdate=U,M.directionalLights.needsUpdate=U,M.directionalLightShadows.needsUpdate=U,M.pointLights.needsUpdate=U,M.pointLightShadows.needsUpdate=U,M.spotLights.needsUpdate=U,M.spotLightShadows.needsUpdate=U,M.rectAreaLights.needsUpdate=U,M.hemisphereLights.needsUpdate=U}function ac(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return L},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(M,U,O){ft.get(M.texture).__webglTexture=U,ft.get(M.depthTexture).__webglTexture=O;let F=ft.get(M);F.__hasExternalTextures=!0,F.__autoAllocateDepthBuffer=O===void 0,F.__autoAllocateDepthBuffer||q.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),F.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(M,U){let O=ft.get(M);O.__webglFramebuffer=U,O.__useDefaultFramebuffer=U===void 0},this.setRenderTarget=function(M,U=0,O=0){T=M,L=U,R=O;let F=!0,D=null,mt=!1,bt=!1;if(M){let Ct=ft.get(M);Ct.__useDefaultFramebuffer!==void 0?(Z.bindFramebuffer(w.FRAMEBUFFER,null),F=!1):Ct.__webglFramebuffer===void 0?vt.setupRenderTarget(M):Ct.__hasExternalTextures&&vt.rebindTextures(M,ft.get(M.texture).__webglTexture,ft.get(M.depthTexture).__webglTexture);let kt=M.texture;(kt.isData3DTexture||kt.isDataArrayTexture||kt.isCompressedArrayTexture)&&(bt=!0);let Ut=ft.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(Ut[U])?D=Ut[U][O]:D=Ut[U],mt=!0):st.isWebGL2&&M.samples>0&&vt.useMultisampledRTT(M)===!1?D=ft.get(M).__webglMultisampledFramebuffer:Array.isArray(Ut)?D=Ut[O]:D=Ut,v.copy(M.viewport),b.copy(M.scissor),it=M.scissorTest}else v.copy(et).multiplyScalar(Y).floor(),b.copy(tt).multiplyScalar(Y).floor(),it=gt;if(Z.bindFramebuffer(w.FRAMEBUFFER,D)&&st.drawBuffers&&F&&Z.drawBuffers(M,D),Z.viewport(v),Z.scissor(b),Z.setScissorTest(it),mt){let Ct=ft.get(M.texture);w.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_CUBE_MAP_POSITIVE_X+U,Ct.__webglTexture,O)}else if(bt){let Ct=ft.get(M.texture),kt=U||0;w.framebufferTextureLayer(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,Ct.__webglTexture,O||0,kt)}B=-1},this.readRenderTargetPixels=function(M,U,O,F,D,mt,bt){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Rt=ft.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&bt!==void 0&&(Rt=Rt[bt]),Rt){Z.bindFramebuffer(w.FRAMEBUFFER,Rt);try{let Ct=M.texture,kt=Ct.format,Ut=Ct.type;if(kt!==Be&&wt.convert(kt)!==w.getParameter(w.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Nt=Ut===ki&&(q.has("EXT_color_buffer_half_float")||st.isWebGL2&&q.has("EXT_color_buffer_float"));if(Ut!==xn&&wt.convert(Ut)!==w.getParameter(w.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ut===nn&&(st.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float")))&&!Nt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=M.width-F&&O>=0&&O<=M.height-D&&w.readPixels(U,O,F,D,wt.convert(kt),wt.convert(Ut),mt)}finally{let Ct=T!==null?ft.get(T).__webglFramebuffer:null;Z.bindFramebuffer(w.FRAMEBUFFER,Ct)}}},this.copyFramebufferToTexture=function(M,U,O=0){let F=Math.pow(2,-O),D=Math.floor(U.image.width*F),mt=Math.floor(U.image.height*F);vt.setTexture2D(U,0),w.copyTexSubImage2D(w.TEXTURE_2D,O,0,0,M.x,M.y,D,mt),Z.unbindTexture()},this.copyTextureToTexture=function(M,U,O,F=0){let D=U.image.width,mt=U.image.height,bt=wt.convert(O.format),Rt=wt.convert(O.type);vt.setTexture2D(O,0),w.pixelStorei(w.UNPACK_FLIP_Y_WEBGL,O.flipY),w.pixelStorei(w.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),w.pixelStorei(w.UNPACK_ALIGNMENT,O.unpackAlignment),U.isDataTexture?w.texSubImage2D(w.TEXTURE_2D,F,M.x,M.y,D,mt,bt,Rt,U.image.data):U.isCompressedTexture?w.compressedTexSubImage2D(w.TEXTURE_2D,F,M.x,M.y,U.mipmaps[0].width,U.mipmaps[0].height,bt,U.mipmaps[0].data):w.texSubImage2D(w.TEXTURE_2D,F,M.x,M.y,bt,Rt,U.image),F===0&&O.generateMipmaps&&w.generateMipmap(w.TEXTURE_2D),Z.unbindTexture()},this.copyTextureToTexture3D=function(M,U,O,F,D=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let mt=Math.round(M.max.x-M.min.x),bt=Math.round(M.max.y-M.min.y),Rt=M.max.z-M.min.z+1,Ct=wt.convert(F.format),kt=wt.convert(F.type),Ut;if(F.isData3DTexture)vt.setTexture3D(F,0),Ut=w.TEXTURE_3D;else if(F.isDataArrayTexture||F.isCompressedArrayTexture)vt.setTexture2DArray(F,0),Ut=w.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}w.pixelStorei(w.UNPACK_FLIP_Y_WEBGL,F.flipY),w.pixelStorei(w.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),w.pixelStorei(w.UNPACK_ALIGNMENT,F.unpackAlignment);let Nt=w.getParameter(w.UNPACK_ROW_LENGTH),ie=w.getParameter(w.UNPACK_IMAGE_HEIGHT),Ae=w.getParameter(w.UNPACK_SKIP_PIXELS),ce=w.getParameter(w.UNPACK_SKIP_ROWS),Ye=w.getParameter(w.UNPACK_SKIP_IMAGES),ee=O.isCompressedTexture?O.mipmaps[D]:O.image;w.pixelStorei(w.UNPACK_ROW_LENGTH,ee.width),w.pixelStorei(w.UNPACK_IMAGE_HEIGHT,ee.height),w.pixelStorei(w.UNPACK_SKIP_PIXELS,M.min.x),w.pixelStorei(w.UNPACK_SKIP_ROWS,M.min.y),w.pixelStorei(w.UNPACK_SKIP_IMAGES,M.min.z),O.isDataTexture||O.isData3DTexture?w.texSubImage3D(Ut,D,U.x,U.y,U.z,mt,bt,Rt,Ct,kt,ee.data):F.isCompressedArrayTexture?w.compressedTexSubImage3D(Ut,D,U.x,U.y,U.z,mt,bt,Rt,Ct,ee.data):w.texSubImage3D(Ut,D,U.x,U.y,U.z,mt,bt,Rt,Ct,kt,ee),w.pixelStorei(w.UNPACK_ROW_LENGTH,Nt),w.pixelStorei(w.UNPACK_IMAGE_HEIGHT,ie),w.pixelStorei(w.UNPACK_SKIP_PIXELS,Ae),w.pixelStorei(w.UNPACK_SKIP_ROWS,ce),w.pixelStorei(w.UNPACK_SKIP_IMAGES,Ye),D===0&&F.generateMipmaps&&w.generateMipmap(Ut),Z.unbindTexture()},this.initTexture=function(M){M.isCubeTexture?vt.setTextureCube(M,0):M.isData3DTexture?vt.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?vt.setTexture2DArray(M,0):vt.setTexture2D(M,0),Z.unbindTexture()},this.resetState=function(){L=0,R=0,T=null,Z.reset(),Mt.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return sn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Ho?"display-p3":"srgb",e.unpackColorSpace=Yt.workingColorSpace===tr?"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(t){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=t}},vo=class extends xo{};vo.prototype.isWebGL1Renderer=!0;var Zs=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=$r,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=rn()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return Vl("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let s=0,r=this.stride;s<r;s++)this.array[t+s]=e.array[n+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=rn()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=rn()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},ve=new I,Hi=class i{constructor(t,e,n,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.applyMatrix4(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.applyNormalMatrix(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.transformDirection(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=Xe(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=qt(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=qt(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=qt(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=qt(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=qt(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Xe(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Xe(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Xe(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Xe(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array),s=qt(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=s,this}setXYZW(t,e,n,s,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=qt(e,this.array),n=qt(n,this.array),s=qt(s,this.array),r=qt(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=s,this.data.array[t+3]=r,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[s+r])}return new te(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new i(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let n=0;n<this.count;n++){let s=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[s+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},yo=class extends Gn{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Wt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},fn,Di=new I,li=new I,ci=new I,hi=new nt,Ni=new nt,$l=new oe,ys=new I,Oi=new I,Ms=new I,bl=new nt,kr=new nt,El=new nt,Mo=class extends ke{constructor(t=new yo){if(super(),this.isSprite=!0,this.type="Sprite",fn===void 0){fn=new Ee;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Zs(e,5);fn.setIndex([0,1,2,0,2,3]),fn.setAttribute("position",new Hi(n,3,0,!1)),fn.setAttribute("uv",new Hi(n,2,3,!1))}this.geometry=fn,this.material=t,this.center=new nt(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),li.setFromMatrixScale(this.matrixWorld),$l.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),ci.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&li.multiplyScalar(-ci.z);let n=this.material.rotation,s,r;n!==0&&(r=Math.cos(n),s=Math.sin(n));let a=this.center;Ss(ys.set(-.5,-.5,0),ci,a,li,s,r),Ss(Oi.set(.5,-.5,0),ci,a,li,s,r),Ss(Ms.set(.5,.5,0),ci,a,li,s,r),bl.set(0,0),kr.set(1,0),El.set(1,1);let o=t.ray.intersectTriangle(ys,Oi,Ms,!1,Di);if(o===null&&(Ss(Oi.set(-.5,.5,0),ci,a,li,s,r),kr.set(0,1),o=t.ray.intersectTriangle(ys,Ms,Oi,!1,Di),o===null))return;let l=t.ray.origin.distanceTo(Di);l<t.near||l>t.far||e.push({distance:l,point:Di.clone(),uv:On.getInterpolation(Di,ys,Oi,Ms,bl,kr,El,new nt),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};Mo.Dispose=function(){fn.dispose(),fn=void 0};function Ss(i,t,e,n,s,r){hi.subVectors(i,e).addScalar(.5).multiply(n),s!==void 0?(Ni.x=r*hi.x-s*hi.y,Ni.y=s*hi.x+r*hi.y):Ni.copy(hi),i.copy(t),i.x+=Ni.x,i.y+=Ni.y,i.applyMatrix4($l)}var Ue=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){let n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){let e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e=[],n,s=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),r+=n.distanceTo(s),e.push(r),s=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){let n=this.getLengths(),s=0,r=n.length,a;e?a=e:a=t*n[r-1];let o=0,l=r-1,c;for(;o<=l;)if(s=Math.floor(o+(l-o)/2),c=n[s]-a,c<0)o=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,n[s]===a)return s/(r-1);let h=n[s],d=n[s+1]-h,m=(a-h)/d;return(s+m)/(r-1)}getTangent(t,e){let s=t-1e-4,r=t+1e-4;s<0&&(s=0),r>1&&(r=1);let a=this.getPoint(s),o=this.getPoint(r),l=e||(a.isVector2?new nt:new I);return l.copy(o).sub(a).normalize(),l}getTangentAt(t,e){let n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){let n=new I,s=[],r=[],a=[],o=new I,l=new oe;for(let m=0;m<=t;m++){let g=m/t;s[m]=this.getTangentAt(g,new I)}r[0]=new I,a[0]=new I;let c=Number.MAX_VALUE,h=Math.abs(s[0].x),u=Math.abs(s[0].y),d=Math.abs(s[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(s[0],n).normalize(),r[0].crossVectors(s[0],o),a[0].crossVectors(s[0],r[0]);for(let m=1;m<=t;m++){if(r[m]=r[m-1].clone(),a[m]=a[m-1].clone(),o.crossVectors(s[m-1],s[m]),o.length()>Number.EPSILON){o.normalize();let g=Math.acos(_e(s[m-1].dot(s[m]),-1,1));r[m].applyMatrix4(l.makeRotationAxis(o,g))}a[m].crossVectors(s[m],r[m])}if(e===!0){let m=Math.acos(_e(r[0].dot(r[t]),-1,1));m/=t,s[0].dot(o.crossVectors(r[0],r[t]))>0&&(m=-m);for(let g=1;g<=t;g++)r[g].applyMatrix4(l.makeRotationAxis(s[g],m*g)),a[g].crossVectors(s[g],r[g])}return{tangents:s,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},Wi=class extends Ue{constructor(t=0,e=0,n=1,s=1,r=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(t,e=new nt){let n=e,s=Math.PI*2,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=s;for(;r>s;)r-=s;r<Number.EPSILON&&(a?r=0:r=s),this.aClockwise===!0&&!a&&(r===s?r=-s:r=r-s);let o=this.aStartAngle+t*r,l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=l-this.aX,m=c-this.aY;l=d*h-m*u+this.aX,c=d*u+m*h+this.aY}return n.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},So=class extends Wi{constructor(t,e,n,s,r,a){super(t,e,n,n,s,r,a),this.isArcCurve=!0,this.type="ArcCurve"}};function Xo(){let i=0,t=0,e=0,n=0;function s(r,a,o,l){i=r,t=o,e=-3*r+3*a-2*o-l,n=2*r-2*a+o+l}return{initCatmullRom:function(r,a,o,l,c){s(a,o,c*(o-r),c*(l-a))},initNonuniformCatmullRom:function(r,a,o,l,c,h,u){let d=(a-r)/c-(o-r)/(c+h)+(o-a)/h,m=(o-a)/h-(l-a)/(h+u)+(l-o)/u;d*=h,m*=h,s(a,o,d,m)},calc:function(r){let a=r*r,o=a*r;return i+t*r+e*a+n*o}}}var bs=new I,Vr=new Xo,Gr=new Xo,Hr=new Xo,bo=class extends Ue{constructor(t=[],e=!1,n="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=s}getPoint(t,e=new I){let n=e,s=this.points,r=s.length,a=(r-(this.closed?0:1))*t,o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:l===0&&o===r-1&&(o=r-2,l=1);let c,h;this.closed||o>0?c=s[(o-1)%r]:(bs.subVectors(s[0],s[1]).add(s[0]),c=bs);let u=s[o%r],d=s[(o+1)%r];if(this.closed||o+2<r?h=s[(o+2)%r]:(bs.subVectors(s[r-1],s[r-2]).add(s[r-1]),h=bs),this.curveType==="centripetal"||this.curveType==="chordal"){let m=this.curveType==="chordal"?.5:.25,g=Math.pow(c.distanceToSquared(u),m),y=Math.pow(u.distanceToSquared(d),m),f=Math.pow(d.distanceToSquared(h),m);y<1e-4&&(y=1),g<1e-4&&(g=y),f<1e-4&&(f=y),Vr.initNonuniformCatmullRom(c.x,u.x,d.x,h.x,g,y,f),Gr.initNonuniformCatmullRom(c.y,u.y,d.y,h.y,g,y,f),Hr.initNonuniformCatmullRom(c.z,u.z,d.z,h.z,g,y,f)}else this.curveType==="catmullrom"&&(Vr.initCatmullRom(c.x,u.x,d.x,h.x,this.tension),Gr.initCatmullRom(c.y,u.y,d.y,h.y,this.tension),Hr.initCatmullRom(c.z,u.z,d.z,h.z,this.tension));return n.set(Vr.calc(l),Gr.calc(l),Hr.calc(l)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(new I().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}};function Al(i,t,e,n,s){let r=(n-t)*.5,a=(s-e)*.5,o=i*i,l=i*o;return(2*e-2*n+r+a)*l+(-3*e+3*n-2*r-a)*o+r*i+e}function lm(i,t){let e=1-i;return e*e*t}function cm(i,t){return 2*(1-i)*i*t}function hm(i,t){return i*i*t}function Bi(i,t,e,n){return lm(i,t)+cm(i,e)+hm(i,n)}function um(i,t){let e=1-i;return e*e*e*t}function dm(i,t){let e=1-i;return 3*e*e*i*t}function fm(i,t){return 3*(1-i)*i*i*t}function pm(i,t){return i*i*i*t}function zi(i,t,e,n,s){return um(i,t)+dm(i,e)+fm(i,n)+pm(i,s)}var Js=class extends Ue{constructor(t=new nt,e=new nt,n=new nt,s=new nt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=s}getPoint(t,e=new nt){let n=e,s=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(zi(t,s.x,r.x,a.x,o.x),zi(t,s.y,r.y,a.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Eo=class extends Ue{constructor(t=new I,e=new I,n=new I,s=new I){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=s}getPoint(t,e=new I){let n=e,s=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(zi(t,s.x,r.x,a.x,o.x),zi(t,s.y,r.y,a.y,o.y),zi(t,s.z,r.z,a.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},$s=class extends Ue{constructor(t=new nt,e=new nt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new nt){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new nt){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Ao=class extends Ue{constructor(t=new I,e=new I){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new I){let n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new I){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Ks=class extends Ue{constructor(t=new nt,e=new nt,n=new nt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new nt){let n=e,s=this.v0,r=this.v1,a=this.v2;return n.set(Bi(t,s.x,r.x,a.x),Bi(t,s.y,r.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},wo=class extends Ue{constructor(t=new I,e=new I,n=new I){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new I){let n=e,s=this.v0,r=this.v1,a=this.v2;return n.set(Bi(t,s.x,r.x,a.x),Bi(t,s.y,r.y,a.y),Bi(t,s.z,r.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Qs=class extends Ue{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new nt){let n=e,s=this.points,r=(s.length-1)*t,a=Math.floor(r),o=r-a,l=s[a===0?a:a-1],c=s[a],h=s[a>s.length-2?s.length-1:a+1],u=s[a>s.length-3?s.length-1:a+2];return n.set(Al(o,l.x,c.x,h.x,u.x),Al(o,l.y,c.y,h.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){let s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){let s=t.points[e];this.points.push(new nt().fromArray(s))}return this}},To=Object.freeze({__proto__:null,ArcCurve:So,CatmullRomCurve3:bo,CubicBezierCurve:Js,CubicBezierCurve3:Eo,EllipseCurve:Wi,LineCurve:$s,LineCurve3:Ao,QuadraticBezierCurve:Ks,QuadraticBezierCurve3:wo,SplineCurve:Qs}),Ro=class extends Ue{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let n=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new To[n](e,t))}return this}getPoint(t,e){let n=t*this.getLength(),s=this.getCurveLengths(),r=0;for(;r<s.length;){if(s[r]>=n){let a=s[r]-n,o=this.curves[r],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let n=0,s=this.curves.length;n<s;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e=[],n;for(let s=0,r=this.curves;s<r.length;s++){let a=r[s],o=a.isEllipseCurve?t*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,l=a.getPoints(o);for(let c=0;c<l.length;c++){let h=l[c];n&&n.equals(h)||(e.push(h),n=h)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){let s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){let s=t.curves[e];this.curves.push(new To[s.type]().fromJSON(s))}return this}},Mi=class extends Ro{constructor(t){super(),this.type="Path",this.currentPoint=new nt,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let n=new $s(this.currentPoint.clone(),new nt(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,s){let r=new Ks(this.currentPoint.clone(),new nt(t,e),new nt(n,s));return this.curves.push(r),this.currentPoint.set(n,s),this}bezierCurveTo(t,e,n,s,r,a){let o=new Js(this.currentPoint.clone(),new nt(t,e),new nt(n,s),new nt(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),n=new Qs(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,s,r,a){let o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(t+o,e+l,n,s,r,a),this}absarc(t,e,n,s,r,a){return this.absellipse(t,e,n,n,s,r,a),this}ellipse(t,e,n,s,r,a,o,l){let c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+c,e+h,n,s,r,a,o,l),this}absellipse(t,e,n,s,r,a,o,l){let c=new Wi(t,e,n,s,r,a,o,l);if(this.curves.length>0){let u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);let h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}};var Si=class extends Mi{constructor(t){super(t),this.uuid=rn(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let n=0,s=this.holes.length;n<s;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){let s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){let s=t.holes[e];this.holes.push(new Mi().fromJSON(s))}return this}},mm={triangulate:function(i,t,e=2){let n=t&&t.length,s=n?t[0]*e:i.length,r=Kl(i,0,s,e,!0),a=[];if(!r||r.next===r.prev)return a;let o,l,c,h,u,d,m;if(n&&(r=ym(i,t,r,e)),i.length>80*e){o=c=i[0],l=h=i[1];for(let g=e;g<s;g+=e)u=i[g],d=i[g+1],u<o&&(o=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);m=Math.max(c-o,h-l),m=m!==0?32767/m:0}return Xi(r,a,e,o,l,m,0),a}};function Kl(i,t,e,n,s){let r,a;if(s===Im(i,t,e,n)>0)for(r=t;r<e;r+=n)a=wl(r,i[r],i[r+1],a);else for(r=e-n;r>=t;r-=n)a=wl(r,i[r],i[r+1],a);return a&&nr(a,a.next)&&(Yi(a),a=a.next),a}function Hn(i,t){if(!i)return i;t||(t=i);let e=i,n;do if(n=!1,!e.steiner&&(nr(e,e.next)||ne(e.prev,e,e.next)===0)){if(Yi(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Xi(i,t,e,n,s,r,a){if(!i)return;!a&&r&&Am(i,n,s,r);let o=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,r?_m(i,n,s,r):gm(i)){t.push(l.i/e|0),t.push(i.i/e|0),t.push(c.i/e|0),Yi(i),i=c.next,o=c.next;continue}if(i=c,i===o){a?a===1?(i=xm(Hn(i),t,e),Xi(i,t,e,n,s,r,2)):a===2&&vm(i,t,e,n,s,r):Xi(Hn(i),t,e,n,s,r,1);break}}}function gm(i){let t=i.prev,e=i,n=i.next;if(ne(t,e,n)>=0)return!1;let s=t.x,r=e.x,a=n.x,o=t.y,l=e.y,c=n.y,h=s<r?s<a?s:a:r<a?r:a,u=o<l?o<c?o:c:l<c?l:c,d=s>r?s>a?s:a:r>a?r:a,m=o>l?o>c?o:c:l>c?l:c,g=n.next;for(;g!==t;){if(g.x>=h&&g.x<=d&&g.y>=u&&g.y<=m&&fi(s,o,r,l,a,c,g.x,g.y)&&ne(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function _m(i,t,e,n){let s=i.prev,r=i,a=i.next;if(ne(s,r,a)>=0)return!1;let o=s.x,l=r.x,c=a.x,h=s.y,u=r.y,d=a.y,m=o<l?o<c?o:c:l<c?l:c,g=h<u?h<d?h:d:u<d?u:d,y=o>l?o>c?o:c:l>c?l:c,f=h>u?h>d?h:d:u>d?u:d,p=Co(m,g,t,e,n),E=Co(y,f,t,e,n),x=i.prevZ,A=i.nextZ;for(;x&&x.z>=p&&A&&A.z<=E;){if(x.x>=m&&x.x<=y&&x.y>=g&&x.y<=f&&x!==s&&x!==a&&fi(o,h,l,u,c,d,x.x,x.y)&&ne(x.prev,x,x.next)>=0||(x=x.prevZ,A.x>=m&&A.x<=y&&A.y>=g&&A.y<=f&&A!==s&&A!==a&&fi(o,h,l,u,c,d,A.x,A.y)&&ne(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;x&&x.z>=p;){if(x.x>=m&&x.x<=y&&x.y>=g&&x.y<=f&&x!==s&&x!==a&&fi(o,h,l,u,c,d,x.x,x.y)&&ne(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;A&&A.z<=E;){if(A.x>=m&&A.x<=y&&A.y>=g&&A.y<=f&&A!==s&&A!==a&&fi(o,h,l,u,c,d,A.x,A.y)&&ne(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function xm(i,t,e){let n=i;do{let s=n.prev,r=n.next.next;!nr(s,r)&&Ql(s,n,n.next,r)&&qi(s,r)&&qi(r,s)&&(t.push(s.i/e|0),t.push(n.i/e|0),t.push(r.i/e|0),Yi(n),Yi(n.next),n=i=r),n=n.next}while(n!==i);return Hn(n)}function vm(i,t,e,n,s,r){let a=i;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Rm(a,o)){let l=jl(a,o);a=Hn(a,a.next),l=Hn(l,l.next),Xi(a,t,e,n,s,r,0),Xi(l,t,e,n,s,r,0);return}o=o.next}a=a.next}while(a!==i)}function ym(i,t,e,n){let s=[],r,a,o,l,c;for(r=0,a=t.length;r<a;r++)o=t[r]*n,l=r<a-1?t[r+1]*n:i.length,c=Kl(i,o,l,n,!1),c===c.next&&(c.steiner=!0),s.push(Tm(c));for(s.sort(Mm),r=0;r<s.length;r++)e=Sm(s[r],e);return e}function Mm(i,t){return i.x-t.x}function Sm(i,t){let e=bm(i,t);if(!e)return t;let n=jl(e,i);return Hn(n,n.next),Hn(e,e.next)}function bm(i,t){let e=t,n=-1/0,s,r=i.x,a=i.y;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){let d=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=r&&d>n&&(n=d,s=e.x<e.next.x?e:e.next,d===r))return s}e=e.next}while(e!==t);if(!s)return null;let o=s,l=s.x,c=s.y,h=1/0,u;e=s;do r>=e.x&&e.x>=l&&r!==e.x&&fi(a<c?r:n,a,l,c,a<c?n:r,a,e.x,e.y)&&(u=Math.abs(a-e.y)/(r-e.x),qi(e,i)&&(u<h||u===h&&(e.x>s.x||e.x===s.x&&Em(s,e)))&&(s=e,h=u)),e=e.next;while(e!==o);return s}function Em(i,t){return ne(i.prev,i,t.prev)<0&&ne(t.next,i,i.next)<0}function Am(i,t,e,n){let s=i;do s.z===0&&(s.z=Co(s.x,s.y,t,e,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,wm(s)}function wm(i){let t,e,n,s,r,a,o,l,c=1;do{for(e=i,i=null,r=null,a=0;e;){for(a++,n=e,o=0,t=0;t<c&&(o++,n=n.nextZ,!!n);t++);for(l=c;o>0||l>0&&n;)o!==0&&(l===0||!n||e.z<=n.z)?(s=e,e=e.nextZ,o--):(s=n,n=n.nextZ,l--),r?r.nextZ=s:i=s,s.prevZ=r,r=s;e=n}r.nextZ=null,c*=2}while(a>1);return i}function Co(i,t,e,n,s){return i=(i-e)*s|0,t=(t-n)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function Tm(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function fi(i,t,e,n,s,r,a,o){return(s-a)*(t-o)>=(i-a)*(r-o)&&(i-a)*(n-o)>=(e-a)*(t-o)&&(e-a)*(r-o)>=(s-a)*(n-o)}function Rm(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!Cm(i,t)&&(qi(i,t)&&qi(t,i)&&Pm(i,t)&&(ne(i.prev,i,t.prev)||ne(i,t.prev,t))||nr(i,t)&&ne(i.prev,i,i.next)>0&&ne(t.prev,t,t.next)>0)}function ne(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function nr(i,t){return i.x===t.x&&i.y===t.y}function Ql(i,t,e,n){let s=As(ne(i,t,e)),r=As(ne(i,t,n)),a=As(ne(e,n,i)),o=As(ne(e,n,t));return!!(s!==r&&a!==o||s===0&&Es(i,e,t)||r===0&&Es(i,n,t)||a===0&&Es(e,i,n)||o===0&&Es(e,t,n))}function Es(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function As(i){return i>0?1:i<0?-1:0}function Cm(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Ql(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function qi(i,t){return ne(i.prev,i,i.next)<0?ne(i,t,i.next)>=0&&ne(i,i.prev,t)>=0:ne(i,t,i.prev)<0||ne(i,i.next,t)<0}function Pm(i,t){let e=i,n=!1,s=(i.x+t.x)/2,r=(i.y+t.y)/2;do e.y>r!=e.next.y>r&&e.next.y!==e.y&&s<(e.next.x-e.x)*(r-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==i);return n}function jl(i,t){let e=new Po(i.i,i.x,i.y),n=new Po(t.i,t.x,t.y),s=i.next,r=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,n.next=e,e.prev=n,r.next=n,n.prev=r,n}function wl(i,t,e,n){let s=new Po(i,t,e);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Yi(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Po(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Im(i,t,e,n){let s=0;for(let r=t,a=e-n;r<e;r+=n)s+=(i[a]-i[r])*(i[r+1]+i[a+1]),a=r;return s}var vn=class i{static area(t){let e=t.length,n=0;for(let s=e-1,r=0;r<e;s=r++)n+=t[s].x*t[r].y-t[r].x*t[s].y;return n*.5}static isClockWise(t){return i.area(t)<0}static triangulateShape(t,e){let n=[],s=[],r=[];Tl(t),Rl(n,t);let a=t.length;e.forEach(Tl);for(let l=0;l<e.length;l++)s.push(a),a+=e[l].length,Rl(n,e[l]);let o=mm.triangulate(n,s);for(let l=0;l<o.length;l+=3)r.push(o.slice(l,l+3));return r}};function Tl(i){let t=i.length;t>2&&i[t-1].equals(i[0])&&i.pop()}function Rl(i,t){for(let e=0;e<t.length;e++)i.push(t[e].x),i.push(t[e].y)}var bi=class i extends Ee{constructor(t=new Si([new nt(.5,.5),new nt(-.5,.5),new nt(-.5,-.5),new nt(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let n=this,s=[],r=[];for(let o=0,l=t.length;o<l;o++){let c=t[o];a(c)}this.setAttribute("position",new fe(s,3)),this.setAttribute("uv",new fe(r,2)),this.computeVertexNormals();function a(o){let l=[],c=e.curveSegments!==void 0?e.curveSegments:12,h=e.steps!==void 0?e.steps:1,u=e.depth!==void 0?e.depth:1,d=e.bevelEnabled!==void 0?e.bevelEnabled:!0,m=e.bevelThickness!==void 0?e.bevelThickness:.2,g=e.bevelSize!==void 0?e.bevelSize:m-.1,y=e.bevelOffset!==void 0?e.bevelOffset:0,f=e.bevelSegments!==void 0?e.bevelSegments:3,p=e.extrudePath,E=e.UVGenerator!==void 0?e.UVGenerator:Lm,x,A=!1,L,R,T,B;p&&(x=p.getSpacedPoints(h),A=!0,d=!1,L=p.computeFrenetFrames(h,!1),R=new I,T=new I,B=new I),d||(f=0,m=0,g=0,y=0);let K=o.extractPoints(c),v=K.shape,b=K.holes;if(!vn.isClockWise(v)){v=v.reverse();for(let w=0,ot=b.length;w<ot;w++){let q=b[w];vn.isClockWise(q)&&(b[w]=q.reverse())}}let $=vn.triangulateShape(v,b),C=v;for(let w=0,ot=b.length;w<ot;w++){let q=b[w];v=v.concat(q)}function H(w,ot,q){return ot||console.error("THREE.ExtrudeGeometry: vec does not exist"),w.clone().addScaledVector(ot,q)}let V=v.length,Y=$.length;function W(w,ot,q){let st,Z,_t,ft=w.x-ot.x,vt=w.y-ot.y,Vt=q.x-w.x,S=q.y-w.y,_=ft*ft+vt*vt,k=ft*S-vt*Vt;if(Math.abs(k)>Number.EPSILON){let G=Math.sqrt(_),j=Math.sqrt(Vt*Vt+S*S),J=ot.x-vt/G,It=ot.y+ft/G,Tt=q.x-S/j,lt=q.y+Vt/j,ht=((Tt-J)*S-(lt-It)*Vt)/(ft*S-vt*Vt);st=J+ft*ht-w.x,Z=It+vt*ht-w.y;let Lt=st*st+Z*Z;if(Lt<=2)return new nt(st,Z);_t=Math.sqrt(Lt/2)}else{let G=!1;ft>Number.EPSILON?Vt>Number.EPSILON&&(G=!0):ft<-Number.EPSILON?Vt<-Number.EPSILON&&(G=!0):Math.sign(vt)===Math.sign(S)&&(G=!0),G?(st=-vt,Z=ft,_t=Math.sqrt(_)):(st=ft,Z=vt,_t=Math.sqrt(_/2))}return new nt(st/_t,Z/_t)}let X=[];for(let w=0,ot=C.length,q=ot-1,st=w+1;w<ot;w++,q++,st++)q===ot&&(q=0),st===ot&&(st=0),X[w]=W(C[w],C[q],C[st]);let et=[],tt,gt=X.concat();for(let w=0,ot=b.length;w<ot;w++){let q=b[w];tt=[];for(let st=0,Z=q.length,_t=Z-1,ft=st+1;st<Z;st++,_t++,ft++)_t===Z&&(_t=0),ft===Z&&(ft=0),tt[st]=W(q[st],q[_t],q[ft]);et.push(tt),gt=gt.concat(tt)}for(let w=0;w<f;w++){let ot=w/f,q=m*Math.cos(ot*Math.PI/2),st=g*Math.sin(ot*Math.PI/2)+y;for(let Z=0,_t=C.length;Z<_t;Z++){let ft=H(C[Z],X[Z],st);Et(ft.x,ft.y,-q)}for(let Z=0,_t=b.length;Z<_t;Z++){let ft=b[Z];tt=et[Z];for(let vt=0,Vt=ft.length;vt<Vt;vt++){let S=H(ft[vt],tt[vt],st);Et(S.x,S.y,-q)}}}let Pt=g+y;for(let w=0;w<V;w++){let ot=d?H(v[w],gt[w],Pt):v[w];A?(T.copy(L.normals[0]).multiplyScalar(ot.x),R.copy(L.binormals[0]).multiplyScalar(ot.y),B.copy(x[0]).add(T).add(R),Et(B.x,B.y,B.z)):Et(ot.x,ot.y,0)}for(let w=1;w<=h;w++)for(let ot=0;ot<V;ot++){let q=d?H(v[ot],gt[ot],Pt):v[ot];A?(T.copy(L.normals[w]).multiplyScalar(q.x),R.copy(L.binormals[w]).multiplyScalar(q.y),B.copy(x[w]).add(T).add(R),Et(B.x,B.y,B.z)):Et(q.x,q.y,u/h*w)}for(let w=f-1;w>=0;w--){let ot=w/f,q=m*Math.cos(ot*Math.PI/2),st=g*Math.sin(ot*Math.PI/2)+y;for(let Z=0,_t=C.length;Z<_t;Z++){let ft=H(C[Z],X[Z],st);Et(ft.x,ft.y,u+q)}for(let Z=0,_t=b.length;Z<_t;Z++){let ft=b[Z];tt=et[Z];for(let vt=0,Vt=ft.length;vt<Vt;vt++){let S=H(ft[vt],tt[vt],st);A?Et(S.x,S.y+x[h-1].y,x[h-1].x+q):Et(S.x,S.y,u+q)}}}z(),Q();function z(){let w=s.length/3;if(d){let ot=0,q=V*ot;for(let st=0;st<Y;st++){let Z=$[st];yt(Z[2]+q,Z[1]+q,Z[0]+q)}ot=h+f*2,q=V*ot;for(let st=0;st<Y;st++){let Z=$[st];yt(Z[0]+q,Z[1]+q,Z[2]+q)}}else{for(let ot=0;ot<Y;ot++){let q=$[ot];yt(q[2],q[1],q[0])}for(let ot=0;ot<Y;ot++){let q=$[ot];yt(q[0]+V*h,q[1]+V*h,q[2]+V*h)}}n.addGroup(w,s.length/3-w,0)}function Q(){let w=s.length/3,ot=0;pt(C,ot),ot+=C.length;for(let q=0,st=b.length;q<st;q++){let Z=b[q];pt(Z,ot),ot+=Z.length}n.addGroup(w,s.length/3-w,1)}function pt(w,ot){let q=w.length;for(;--q>=0;){let st=q,Z=q-1;Z<0&&(Z=w.length-1);for(let _t=0,ft=h+f*2;_t<ft;_t++){let vt=V*_t,Vt=V*(_t+1),S=ot+st+vt,_=ot+Z+vt,k=ot+Z+Vt,G=ot+st+Vt;xt(S,_,k,G)}}}function Et(w,ot,q){l.push(w),l.push(ot),l.push(q)}function yt(w,ot,q){zt(w),zt(ot),zt(q);let st=s.length/3,Z=E.generateTopUV(n,s,st-3,st-2,st-1);At(Z[0]),At(Z[1]),At(Z[2])}function xt(w,ot,q,st){zt(w),zt(ot),zt(st),zt(ot),zt(q),zt(st);let Z=s.length/3,_t=E.generateSideWallUV(n,s,Z-6,Z-3,Z-2,Z-1);At(_t[0]),At(_t[1]),At(_t[3]),At(_t[1]),At(_t[2]),At(_t[3])}function zt(w){s.push(l[w*3+0]),s.push(l[w*3+1]),s.push(l[w*3+2])}function At(w){r.push(w.x),r.push(w.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return Um(e,n,t)}static fromJSON(t,e){let n=[];for(let r=0,a=t.shapes.length;r<a;r++){let o=e[t.shapes[r]];n.push(o)}let s=t.options.extrudePath;return s!==void 0&&(t.options.extrudePath=new To[s.type]().fromJSON(s)),new i(n,t.options)}},Lm={generateTopUV:function(i,t,e,n,s){let r=t[e*3],a=t[e*3+1],o=t[n*3],l=t[n*3+1],c=t[s*3],h=t[s*3+1];return[new nt(r,a),new nt(o,l),new nt(c,h)]},generateSideWallUV:function(i,t,e,n,s,r){let a=t[e*3],o=t[e*3+1],l=t[e*3+2],c=t[n*3],h=t[n*3+1],u=t[n*3+2],d=t[s*3],m=t[s*3+1],g=t[s*3+2],y=t[r*3],f=t[r*3+1],p=t[r*3+2];return Math.abs(o-h)<Math.abs(a-c)?[new nt(a,1-l),new nt(c,1-u),new nt(d,1-g),new nt(y,1-p)]:[new nt(o,1-l),new nt(h,1-u),new nt(m,1-g),new nt(f,1-p)]}};function Um(i,t,e){if(e.shapes=[],Array.isArray(i))for(let n=0,s=i.length;n<s;n++){let r=i[n];e.shapes.push(r.uuid)}else e.shapes.push(i.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}var Zi=class i extends Ee{constructor(t=new Si([new nt(0,.5),new nt(-.5,-.5),new nt(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let n=[],s=[],r=[],a=[],o=0,l=0;if(Array.isArray(t)===!1)c(t);else for(let h=0;h<t.length;h++)c(t[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new fe(s,3)),this.setAttribute("normal",new fe(r,3)),this.setAttribute("uv",new fe(a,2));function c(h){let u=s.length/3,d=h.extractPoints(e),m=d.shape,g=d.holes;vn.isClockWise(m)===!1&&(m=m.reverse());for(let f=0,p=g.length;f<p;f++){let E=g[f];vn.isClockWise(E)===!0&&(g[f]=E.reverse())}let y=vn.triangulateShape(m,g);for(let f=0,p=g.length;f<p;f++){let E=g[f];m=m.concat(E)}for(let f=0,p=m.length;f<p;f++){let E=m[f];s.push(E.x,E.y,0),r.push(0,0,1),a.push(E.x,E.y)}for(let f=0,p=y.length;f<p;f++){let E=y[f],x=E[0]+u,A=E[1]+u,L=E[2]+u;n.push(x,A,L),l+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return Dm(e,t)}static fromJSON(t,e){let n=[];for(let s=0,r=t.shapes.length;s<r;s++){let a=e[t.shapes[s]];n.push(a)}return new i(n,t.curveSegments)}};function Dm(i,t){if(t.shapes=[],Array.isArray(i))for(let e=0,n=i.length;e<n;e++){let s=i[e];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t}function ws(i,t,e){return!i||!e&&i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}function Nm(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}var Ei=class{constructor(t,e,n,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,s=e[n],r=e[n-1];n:{t:{let a;e:{i:if(!(t<s)){for(let o=n+2;;){if(s===void 0){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=s,s=e[++n],t<s)break t}a=e.length;break e}if(!(t>=r)){let o=e[1];t<o&&(n=2,r=o);for(let l=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(s=r,r=e[--n-1],t>=r)break t}a=n,n=0;break e}break n}for(;n<a;){let o=n+a>>>1;t<e[o]?a=o:n=o+1}if(s=e[n],r=e[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=t*s;for(let a=0;a!==s;++a)e[a]=n[r+a];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Io=class extends Ei{constructor(t,e,n,s){super(t,e,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:La,endingEnd:La}}intervalChanged_(t,e,n){let s=this.parameterPositions,r=t-2,a=t+1,o=s[r],l=s[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ua:r=t,o=2*e-n;break;case Da:r=s.length-2,o=e+s[r]-s[r+1];break;default:r=t,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case Ua:a=t,l=2*n-e;break;case Da:a=1,l=n+s[1]-s[0];break;default:a=t-1,l=e}let c=(n-e)*.5,h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(l-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,m=this._weightNext,g=(n-e)/(s-e),y=g*g,f=y*g,p=-d*f+2*d*y-d*g,E=(1+d)*f+(-1.5-2*d)*y+(-.5+d)*g+1,x=(-1-m)*f+(1.5+m)*y+.5*g,A=m*f-m*y;for(let L=0;L!==o;++L)r[L]=p*a[h+L]+E*a[c+L]+x*a[l+L]+A*a[u+L];return r}},Lo=class extends Ei{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=(n-e)/(s-e),u=1-h;for(let d=0;d!==o;++d)r[d]=a[c+d]*u+a[l+d]*h;return r}},Uo=class extends Ei{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t){return this.copySampleValue_(t-1)}},Ve=class{constructor(t,e,n,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=ws(e,this.TimeBufferType),this.values=ws(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:ws(t.times,Array),values:ws(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(n.interpolation=s)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Uo(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Lo(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Io(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Rs:e=this.InterpolantFactoryMethodDiscrete;break;case Cs:e=this.InterpolantFactoryMethodLinear;break;case fr:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Rs;case this.InterpolantFactoryMethodLinear:return Cs;case this.InterpolantFactoryMethodSmooth:return fr}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]*=t}return this}trim(t,e){let n=this.times,s=n.length,r=0,a=s-1;for(;r!==s&&n[r]<t;)++r;for(;a!==-1&&n[a]>e;)--a;if(++a,r!==0||a!==s){r>=a&&(a=Math.max(a,1),r=a-1);let o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,s=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==r;o++){let l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),t=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),t=!1;break}a=l}if(s!==void 0&&Nm(s))for(let o=0,l=s.length;o!==l;++o){let c=s[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===fr,r=t.length-1,a=1;for(let o=1;o<r;++o){let l=!1,c=t[o],h=t[o+1];if(c!==h&&(o!==1||c!==t[0]))if(s)l=!0;else{let u=o*n,d=u-n,m=u+n;for(let g=0;g!==n;++g){let y=e[u+g];if(y!==e[d+g]||y!==e[m+g]){l=!0;break}}}if(l){if(o!==a){t[a]=t[o];let u=o*n,d=a*n;for(let m=0;m!==n;++m)e[d+m]=e[u+m]}++a}}if(r>0){t[a]=t[r];for(let o=r*n,l=a*n,c=0;c!==n;++c)e[l+c]=e[o+c];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,s=new n(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};Ve.prototype.TimeBufferType=Float32Array;Ve.prototype.ValueBufferType=Float32Array;Ve.prototype.DefaultInterpolation=Cs;var Wn=class extends Ve{};Wn.prototype.ValueTypeName="bool";Wn.prototype.ValueBufferType=Array;Wn.prototype.DefaultInterpolation=Rs;Wn.prototype.InterpolantFactoryMethodLinear=void 0;Wn.prototype.InterpolantFactoryMethodSmooth=void 0;var Do=class extends Ve{};Do.prototype.ValueTypeName="color";var No=class extends Ve{};No.prototype.ValueTypeName="number";var Oo=class extends Ei{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-e)/(s-e),c=t*o;for(let h=c+o;c!==h;c+=4)Sn.slerpFlat(r,0,a,c-o,a,c,l);return r}},Ji=class extends Ve{InterpolantFactoryMethodLinear(t){return new Oo(this.times,this.values,this.getValueSize(),t)}};Ji.prototype.ValueTypeName="quaternion";Ji.prototype.DefaultInterpolation=Cs;Ji.prototype.InterpolantFactoryMethodSmooth=void 0;var Xn=class extends Ve{};Xn.prototype.ValueTypeName="string";Xn.prototype.ValueBufferType=Array;Xn.prototype.DefaultInterpolation=Rs;Xn.prototype.InterpolantFactoryMethodLinear=void 0;Xn.prototype.InterpolantFactoryMethodSmooth=void 0;var Fo=class extends Ve{};Fo.prototype.ValueTypeName="vector";var Bo=class{constructor(t,e,n){let s=this,r=!1,a=0,o=0,l,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(h){o++,r===!1&&s.onStart!==void 0&&s.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,s.onProgress!==void 0&&s.onProgress(h,a,o),a===o&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(h){s.onError!==void 0&&s.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){let u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){let m=c[u],g=c[u+1];if(m.global&&(m.lastIndex=0),m.test(h))return g}return null}}},Om=new Bo,zo=class{constructor(t){this.manager=t!==void 0?t:Om,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let n=this;return new Promise(function(s,r){n.load(t,s,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};zo.DEFAULT_MATERIAL_NAME="__DEFAULT";var qo="\\\\[\\\\]\\\\.:\\\\/",Fm=new RegExp("["+qo+"]","g"),Yo="[^"+qo+"]",Bm="[^"+qo.replace("\\\\.","")+"]",zm=/((?:WC+[\\/:])*)/.source.replace("WC",Yo),km=/(WCOD+)?/.source.replace("WCOD",Bm),Vm=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Yo),Gm=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Yo),Hm=new RegExp("^"+zm+km+Vm+Gm+"$"),Wm=["material","materials","bones","map"],ko=class{constructor(t,e,n){let s=n||jt.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},jt=class i{constructor(t,e,n){this.path=e,this.parsedPath=n||i.parseTrackName(e),this.node=i.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new i.Composite(t,e,n):new i(t,e,n)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(Fm,"")}static parseTrackName(t){let e=Hm.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let r=n.nodeName.substring(s+1);Wm.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,s),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(r){for(let a=0;a<r.length;a++){let o=r[a];if(o.name===e||o.uuid===e)return o;let l=n(o.children);if(l)return l}return null},s=n(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)t[e++]=n[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,s=e.propertyName,r=e.propertyIndex;if(t||(t=i.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=e.objectIndex;switch(n){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let h=0;h<t.length;h++)if(t[h].name===c){c=h;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}let a=t[s];if(a===void 0){let c=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+s+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(r!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[r]!==void 0&&(r=t.morphTargetDictionary[r])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=s;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};jt.Composite=ko;jt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};jt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};jt.prototype.GetterByBindingType=[jt.prototype._getValue_direct,jt.prototype._getValue_array,jt.prototype._getValue_arrayElement,jt.prototype._getValue_toArray];jt.prototype.SetterByBindingTypeAndVersioning=[[jt.prototype._setValue_direct,jt.prototype._setValue_direct_setNeedsUpdate,jt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[jt.prototype._setValue_array,jt.prototype._setValue_array_setNeedsUpdate,jt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[jt.prototype._setValue_arrayElement,jt.prototype._setValue_arrayElement_setNeedsUpdate,jt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[jt.prototype._setValue_fromArray,jt.prototype._setValue_fromArray_setNeedsUpdate,jt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var $m=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vo}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vo);function wi(i,t=[]){let e=new Si(i.map(n=>new nt(...n)));return t.length&&t.forEach(n=>{var s=new Mi(n.map(r=>new nt(...r)));e.holes.push(s)}),e}function tc(i){return i.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function ec(i){let t={};for(let n in i)n.startsWith("on")&&(t[tc(n.slice(2))]=i[n]);let e=s=>Qi(this,[s],function*({data:n}){if(t[n.type])try{let r=yield t[n.type](n.data);if(r!=null&&r.$transfer&&Array.isArray(r.$transfer)){let a=r.$transfer;delete r.$transfer,self.postMessage({type:\`\${n.type}_result\`,key:n.key,data:r},a)}else self.postMessage({type:\`\${n.type}_result\`,key:n.key,data:r})}catch(r){self.postMessage({type:\`\${n.type}_result\`,key:n.key,error:r})}else self.postMessage({type:\`\${n.type}_result\`,key:n.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}function Ti(i,t=!1){let e=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),s=new Set(Object.keys(i[0].morphAttributes)),r={},a={},o=i[0].morphTargetsRelative,l=new Ee,c=0;for(let h=0;h<i.length;++h){let u=i[h],d=0;if(e!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let m in u.attributes){if(!n.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;r[m]===void 0&&(r[m]=[]),r[m].push(u.attributes[m]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let m in u.morphAttributes){if(!s.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[m]===void 0&&(a[m]=[]),a[m].push(u.morphAttributes[m])}if(t){let m;if(e)m=u.index.count;else if(u.attributes.position!==void 0)m=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,m,h),c+=m}}if(e){let h=0,u=[];for(let d=0;d<i.length;++d){let m=i[d].index;for(let g=0;g<m.count;++g)u.push(m.getX(g)+h);h+=i[d].attributes.position.count}l.setIndex(u)}for(let h in r){let u=nc(r[h]);if(!u)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,u)}for(let h in a){let u=a[h][0].length;if(u===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let d=0;d<u;++d){let m=[];for(let y=0;y<a[h].length;++y)m.push(a[h][y][d]);let g=nc(m);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(g)}}return l}function nc(i){let t,e,n,s=-1,r=0;for(let c=0;c<i.length;++c){let h=i[c];if(t===void 0&&(t=h.array.constructor),t!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=h.itemSize),e!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(s===-1&&(s=h.gpuType),s!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;r+=h.count*e}let a=new t(r),o=new te(a,e,n),l=0;for(let c=0;c<i.length;++c){let h=i[c];if(h.isInterleavedBufferAttribute){let u=l/e;for(let d=0,m=h.count;d<m;d++)for(let g=0;g<e;g++){let y=h.getComponent(d,g);o.setComponent(d+u,g,y)}}else a.set(h.array,l);l+=h.count*e}return s!==void 0&&(o.gpuType=s),o}function ic(i,t=!0,e=!1){let n=i.filter(o=>o.geometry.type==="polygon");if(!n.length)return null;let s=n.map(o=>{let l=o.geometry.coords,c=wi(l[0],l.slice(1)),h=new bi(c,{steps:1,bevelEnabled:!1,depth:o.height,curveSegments:4});o.deltaHeight||(o.deltaHeight=0),h.translate(0,0,o.airHeight+o.deltaHeight);let u=h.attributes.position.count,d=new Float32Array(u).fill(o.height+o.airHeight+o.deltaHeight);if(h.setAttribute("maxZ",new te(d,1)),h.setAttribute("opacity",new te(new Float32Array(u).fill(o.fillOpacity),1)),e){let y=new Float32Array(u).fill(o.airHeight+o.deltaHeight);h.setAttribute("minZ",new te(y,1))}let m=new Wt(o.fillColor).convertLinearToSRGB(),g=new Float32Array(u*3);for(let y=0;y<u;y++)g[y*3]=m.r,g[y*3+1]=m.g,g[y*3+2]=m.b;return h.setAttribute("color",new te(g,3)),h}),r=Ti(s);s.forEach(o=>o.dispose());let a={geometry:r};return r.dispose(),t&&(a.lineGeometry=Xm(n)||void 0),a}function Xm(i){let{points:t,colors:e,opacities:n}=qm(i);if(!t.length)return null;let s=new Ee().setFromPoints(t);return s.setAttribute("color",new te(new Float32Array(e),3)),s.setAttribute("opacity",new te(new Float32Array(n),1)),s}function qm(i){let t=[],e=[],n=[];return i.filter(s=>s.strokeOpacity>0).map(s=>{let r=s.height+(s.deltaHeight||0)+s.airHeight,{coords:a}=s.geometry,{strokeColor:o,strokeOpacity:l}=s,c=new Wt(o).convertLinearToSRGB();for(let h=0;h<a.length;h++){let u=a[h];for(let d=0;d<u.length;d++){let m=u[d],g=d+1===u.length?u[0]:u[d+1];t.push(new I(m[0],m[1],r)),t.push(new I(g[0],g[1],r)),e.push(c.r,c.g,c.b),e.push(c.r,c.g,c.b),n.push(l),n.push(l)}}}),{points:t,colors:e,opacities:n}}ec({onGetMergedGeometryAttributes({data:i}){let t=i.map(s=>{let r=s.geometry.coords,a=wi(r[0],r.slice(1));return new bi(a,{steps:1,bevelEnabled:!1,depth:s.height,curveSegments:4})}),e=Ti(t);t.forEach(s=>s.dispose());let n={attributes:e.attributes,index:e.index,morphAttributes:e.morphAttributes,morphTargetsRelative:e.morphTargetsRelative,groups:e.groups,boundingSphere:e.boundingSphere};return e.dispose(),n},onGetMergedShapeGeometryAttributes({data:i}){let t=i.map(s=>{var h;let r=wi(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),a=new Zi(r,4),o=a.getAttribute("position"),l=[],c=new Wt(s.fillColor);for(let u=0;u<o.count;u++)o.setZ(u,s.airHeight+(s.deltaHeight||0)),l.push(c.r,c.g,c.b,(h=s.fillOpacity)!=null?h:1);return a.setAttribute("color",new te(new Float32Array(l),4)),a}),e=Ti(t);t.forEach(s=>s.dispose());let n={attributes:e.attributes,index:e.index,morphAttributes:e.morphAttributes,morphTargetsRelative:e.morphTargetsRelative,groups:e.groups,boundingSphere:e.boundingSphere};return e.dispose(),n},onGetMergedTexture2dShapeGeometryAttributes({data:i}){let t=i.map(s=>{let r=wi(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),a=new Zi(r,4),o=a.getAttribute("position"),l=[1,1,1,0,0,0,0,1];a.setAttribute("uv",new fe(l,2));let c=s.height+(s.deltaHeight||0)+s.airHeight;for(let h=0;h<o.count;h++)o.setZ(h,c);return a}),e=Ti(t);t.forEach(s=>s.dispose());let n={attributes:e.attributes,index:e.index,morphAttributes:e.morphAttributes,morphTargetsRelative:e.morphTargetsRelative,groups:e.groups,boundingSphere:e.boundingSphere};return e.dispose(),n},onGetMergedGeometriesJson({data:i}){var e;let t=ic(i);return t?{mergedGeometry:t.geometry.toJSON(),lineGeometry:(e=t.lineGeometry)==null?void 0:e.toJSON()}:null}});
|
|
12135
|
-
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var h_=class{static GetMergeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield c_(e,"get_merged_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedShapeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield c_(e,"get_merged_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedTexture2dGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield c_(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetBufferGeometryByData(t){let e=new qe;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new He(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new He(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield c_(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?Mp(Mp({},t[0]),n):null})}static dispose(){this.WorkerPool.dispose()}};po(h_,"WorkerPool",new T6(10,CR));var f_=class extends Ki{getCenter(){return new Be().setFromObject(this).getCenter(new G)}addGraphics(t,e){t.map(n=>{this.graphicDataMap.set(n.id,n)}),e?e.map(n=>{let i=new Fh(this.context,n);this.group.add(i)}):this.refresh()}createGraphic(t){return At(this,null,function*(){let e=yield h_.GetMergedGeometry(t);if(Lr(this.group),this.group.clear(),e){let n=new Fh(this.context,e);this.group.add(n)}})}refresh(){this.createGraphic(Array.from(this.graphicDataMap.values()))}removeGraphicById(t){this.graphicDataMap.delete(t),this.createGraphic(Array.from(this.graphicDataMap.values()))}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){let n,i=this.graphicDataMap.get(t);i&&(typeof e=="function"?n=e(i):n=ee({},i,e),this.graphicDataMap.set(t,n),this.createGraphic(Array.from(this.graphicDataMap.values())))}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}constructor(t){super(t),this.graphicMap=new Map,this.group=new es,this.graphicDataMap=new Map,this.add(this.group)}};var dte=H(Ge(),1),gte=H(E1(),1);var pg=H(qs(),1);var ybt={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},Di=class extends Se{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:i,text_texture_offset_y:o}=this.options;return!(0,pg.isNil)(t)&&!(0,pg.isNil)(e)&&!(0,pg.isNil)(n)&&!(0,pg.isNil)(i)&&!(0,pg.isNil)(o)}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>At(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>At(this,null,function*(){let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),yield this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text_font_size",t=>At(this,null,function*(){let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),yield this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&(this.initSize(),this._initScale({zoom:this.context.camera.zoom}))}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return At(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>At(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:a}=this.options;e=yield Mo.getUrlTextureBorder(i,o[0]-a.width*2,a)}else e=yield Mo.getTextureByUrl(this.options.icon);let n=new Ha(new Vl({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){return At(this,null,function*(){if(this.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:i,text_texture_height:o,text_texture_offset_x:a,text_texture_offset_y:l}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(a/t.image.width,1-(o+l)/t.image.height),t.repeat.set(i/t.image.width,o/t.image.height),this.textAspect=i/o}else{let n=yield Oi.getTextureByText(this.options.text);t=n.texture,this.textureLines=n.lines,this.textAspect=t.image.width/t.image.height}let e=new Ha(new Vl({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let n=0,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return At(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,i=e*(t.x+1)/2,o=n*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let a=this.iconWidth/2,l=new V0(new ft(i-a,o-this.iconHeight),new ft(i+a,o)),c=this.textWidth/2,f=new V0(new ft(i-c,o-this.textHeight-this.durIconAndText-this.iconHeight),new ft(i+c,o-this.iconHeight-this.durIconAndText));return this.box=f.union(l),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.clear(),this.unRegistryEvent(),this.spriteText=void 0,this.spriteIcon=void 0,this._listeners={}}constructor(t,e){var n;super(),this.context=t,this.textAspect=1,this.box=new V0,this._initIconPromise=null,this.textureLines=1,this._initScale=o=>{let{zoom:a}=o;if(this.spriteText){let c=this.textHeight/a;this.spriteText.scale.set(this.textAspect*c,c,.1)}if(this.spriteIcon){var l;(l=this.spriteIcon)==null||l.scale.set(this.options.icon_size[0]/a,this.options.icon_size[1]/a,.1)}this.resetZ()};var i;this.options=Wf(ee({},ybt,e,{text:(i=(n=e.text)==null?void 0:n.trim())!=null?i:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var $a=class extends Se{getPosition(){return this.box.getCenter(new G)}onAddToScene(){this.poiLayer2.onAddToScene()}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new wo(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new Be().setFromObject(this).getCenter(new G)}addModel(t){let e=new n_(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new Be().setFromObject(this.groundUpper),e=t.getCenter(new G),n=t.getSize(new G);this.shadow.setPosition(e),this.shadow.changeLightCamera(n)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new Di(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}addHeatmap(t){this.heatmap||(this.heatmap=new e_(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new Be().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z+.1),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof wo)}dispose(){var t;console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(e=>e.dispose()),(t=this.heatmap)==null||t.dispose(),this.groundUpper.clear(),this.models.children.forEach(e=>e.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new t_,this.groundUpper=new Se,this.models=new Se,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new Be,this.groundLayer=new Ki(this.context),this.graphicLayer=new r_(this.context),this.poiLayer=new i_(this.context),this.poiLayer2=new up(this.context),this.parkingSpaceLayer=new o_(this.context),this.wallLayer=new Ki(this.context),this.textureLayer=new Ki(this.context),this.glbModelLayer=new u_(this.context),this.laneLayer=new Ki(this.context),this.mergeGraphicLayer=new f_(this.context),this.textTextureLayer=new Ki(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var Gte=H(En(),1),kte=H(Ge(),1);var Ja=class extends Sn{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:n}=this.context,{offsetX:i,offsetY:o}=t,{clientWidth:a,clientHeight:l}=n.domElement,c=i/a*2-1,f=1-o/l*2;return new G(c,f,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:n}=this.context;return sn(t,e,n.clientWidth,n.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:n,height:i}=e;this.svg&&(this.svg.setAttribute("width",""+n),this.svg.setAttribute("height",""+i))},this.svg=yT(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var p_=class extends Ja{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:n,y:i}]=this.points;return Math.sqrt((n-t)**2+(i-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let i=this.getSvgCoordinate(this.points[0]);_h(this.circles[0],i.x,i.y),wu(this.line,i)}if(this.points[1]){let i=this.getSvgCoordinate(this.points[1]);_h(this.circles[1],i.x,i.y),wu(this.line,void 0,i)}},this.onPointermove=i=>{this.points.length===1&&(this.line.style.display="block",wu(this.line,void 0,{x:i.offsetX,y:i.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=i=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(i);if(o){let{offsetX:a,offsetY:l}=i,c=this.circles[this.points.length];_h(c,a,l),this.points.length||wu(this.line,{x:a,y:l},{x:a,y:l}),this.addPoint(o)}};let{config:{svg:{circle:e,line:n}}}=t;this.circles=[Xd(e.radius,e.fill),Xd(e.radius,e.fill)],this.line=Ev(n.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var qte=H(En(),1);var d_=class extends Ja{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let n=this.circles[0],i=+n.getAttribute("cx"),o=+n.getAttribute("cy");return Math.sqrt((t-i)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(i=>[i.x,i.y]),e=0,n=t.length;for(let i=0;i<n;i++){let o=(i+1)%n;e+=t[i][0]*t[o][1]-t[o][0]*t[i][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,n)=>{let i=this.getSvgCoordinate(e);this.circles[n]&&_h(this.circles[n],i.x,i.y),n!==0&&wu(this.lines[n-1],void 0,i),this.lines[n]&&wu(this.lines[n],i)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",wu(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let n=this.getIntersectByPointerEvent(e);if(n){let{offsetX:i,offsetY:o}=e;this.checkAdsorb(i,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(n);let{circle:{fill:a,radius:l},line:{stroke:c}}=this.context.config.svg;if(!this.isClose){let f=Xd(l,a);_h(f,i,o),this.addCircle(f)}if(this.lines.length&&wu(this.lastLine,void 0,{x:i,y:o}),!this.isClose){let f=Ev(c);wu(f,{x:i,y:o},{x:i,y:o}),this.addLine(f)}}},this.registryEvent()}};var RR=class extends Ja{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let n=new Be().setFromObject(this.graphic),{camera:i,container:{clientWidth:o,clientHeight:a}}=this.context,{min:l,max:c}=n,f=sn(l,i,o,a),g=sn(c,i,o,a);bs(this.rect,f.x,g.y,Math.abs(g.x-f.x),Math.abs(g.y-f.y));let{x:m,y:v}=f,{x,y:S}=g,w=5,E=[{x:m-w,y:S-w},{x:x-w,y:S-w},{x:m-w,y:v-w},{x:x-w,y:v-w}];for(let F=0;F<E.length;F++)bs(this.cornerRect[F],E[F].x,E[F].y,w*2,w*2);let b=4,C=(m+x)/2,A=(v+S)/2,P=[{x:C-b,y:S-b},{x:m-b,y:A-b},{x:x-b,y:A-b},{x:C-b,y:v-b}];for(let F=0;F<P.length;F++)bs(this.centerRect[F],P[F].x,P[F].y,b*2,b*2)}else{bs(this.rect,0,0,0,0);for(let n=0;n<this.cornerRect.length;n++)bs(this.cornerRect[n],0,0,0,0),bs(this.centerRect[n],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=Zl(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let n=0;n<4;n++)this.cornerRect[n]=Zl(e.stroke,"#ffffff"),this.centerRect[n]=Zl(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[n]),this.svg.appendChild(this.centerRect[n]);this.registryEvent()}};var Qte=H(En(),1);var g_=class extends Se{initGeometry(){return At(this,null,function*(){let t=yield v0.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
12135
|
+
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var h_=class{static GetMergeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield c_(e,"get_merged_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedShapeGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield c_(e,"get_merged_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedTexture2dGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield c_(e,"get_merged_texture2d_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetBufferGeometryByData(t){let e=new qe;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new He(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new He(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static GetMergedGeometry(t){return At(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield c_(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?Mp(Mp({},t[0]),n):null})}static dispose(){this.WorkerPool.dispose()}};po(h_,"WorkerPool",new T6(10,CR));var f_=class extends Ki{getCenter(){return new Be().setFromObject(this).getCenter(new G)}addGraphics(t,e){t.map(n=>{this.graphicDataMap.set(n.id,n)}),e?e.map(n=>{let i=new Fh(this.context,n);this.group.add(i)}):this.refresh()}createGraphic(t){return At(this,null,function*(){let e=yield h_.GetMergedGeometry(t);if(Lr(this.group),this.group.clear(),e){let n=new Fh(this.context,e);this.group.add(n)}})}refresh(){this.createGraphic(Array.from(this.graphicDataMap.values()))}removeGraphicById(t){this.graphicDataMap.delete(t),this.createGraphic(Array.from(this.graphicDataMap.values()))}getGraphicDataByNodeId(t){return this.graphicMap.get(t)||null}setGraphicOptions(t,e){let n,i=this.graphicDataMap.get(t);i&&(typeof e=="function"?n=e(i):n=ee({},i,e),this.graphicDataMap.set(t,n),this.createGraphic(Array.from(this.graphicDataMap.values())))}getGraphicPosition(t){let e=this.graphicDataMap.get(t);return e?[e.center_x,e.center_y]:null}constructor(t){super(t),this.graphicMap=new Map,this.group=new es,this.graphicDataMap=new Map,this.add(this.group)}};var dte=H(Ge(),1),gte=H(E1(),1);var pg=H(qs(),1);var ybt={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1,text_opacity:1,icon_opacity:1},Di=class extends Se{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:i,text_texture_offset_y:o}=this.options;return!(0,pg.isNil)(t)&&!(0,pg.isNil)(e)&&!(0,pg.isNil)(n)&&!(0,pg.isNil)(i)&&!(0,pg.isNil)(o)}get deltaZ(){return this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:this.hasText?.1+.5*this.textHeight/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>At(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>At(this,null,function*(){let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),yield this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text_font_size",t=>At(this,null,function*(){let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),yield this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&(this.initSize(),this._initScale({zoom:this.context.camera.zoom}))}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)}),this.addEventListener("change-icon_opacity",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.opacity=e)}),this.addEventListener("change-text_opacity",t=>{let{value:e}=t;this.spriteText&&(this.spriteText.material.opacity=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return At(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>At(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:a}=this.options;e=yield Mo.getUrlTextureBorder(i,o[0]-a.width*2,a)}else e=yield Mo.getTextureByUrl(this.options.icon);let n=new Ha(new Vl({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI,opacity:this.options.icon_opacity}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){return At(this,null,function*(){if(this.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:i,text_texture_height:o,text_texture_offset_x:a,text_texture_offset_y:l}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(a/t.image.width,1-(o+l)/t.image.height),t.repeat.set(i/t.image.width,o/t.image.height),this.textAspect=i/o}else{let n=yield Oi.getTextureByText(this.options.text);t=n.texture,this.textureLines=n.lines,this.textAspect=t.image.width/t.image.height}let e=new Ha(new Vl({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,opacity:this.options.text_opacity}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}})}initSize(){var t,e;let n=0,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return At(this,null,function*(){yield Promise.all([this.initIcon(),this.initText()]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,i=e*(t.x+1)/2,o=n*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let a=this.iconWidth/2,l=new V0(new ft(i-a,o-this.iconHeight),new ft(i+a,o)),c=this.textWidth/2,f=new V0(new ft(i-c,o-this.textHeight-this.durIconAndText-this.iconHeight),new ft(i+c,o-this.iconHeight-this.durIconAndText));return this.box=f.union(l),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.clear(),this.unRegistryEvent(),this.spriteText=void 0,this.spriteIcon=void 0,this._listeners={}}constructor(t,e){var n;super(),this.context=t,this.textAspect=1,this.box=new V0,this._initIconPromise=null,this.textureLines=1,this._initScale=o=>{let{zoom:a}=o;if(this.spriteText){let c=this.textHeight/a;this.spriteText.scale.set(this.textAspect*c,c,.1)}if(this.spriteIcon){var l;(l=this.spriteIcon)==null||l.scale.set(this.options.icon_size[0]/a,this.options.icon_size[1]/a,.1)}this.resetZ()};var i;this.options=Wf(ee({},ybt,e,{text:(i=(n=e.text)==null?void 0:n.trim())!=null?i:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var $a=class extends Se{getPosition(){return this.box.getCenter(new G)}onAddToScene(){this.poiLayer2.onAddToScene()}onRemoveFromScene(){this.poiLayer2.onRemoveFromScene()}createGround(t){let e=new wo(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new Be().setFromObject(this).getCenter(new G)}addModel(t){let e=new n_(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new Be().setFromObject(this.groundUpper),e=t.getCenter(new G),n=t.getSize(new G);this.shadow.setPosition(e),this.shadow.changeLightCamera(n)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addPoi2(t){let e=new Di(this.context,t);return this.poiLayer2.pushPoi(e),e}removePoi2(t){return this.poiLayer2.removePoi(t)}removePoi2ById(t){return this.poiLayer2.removePoiById(t)}addHeatmap(t){this.heatmap||(this.heatmap=new e_(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new Be().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z+.1),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}setGraphicOptions(t,e){this.graphicLayer.graphicMap.has(t)?this.graphicLayer.setGraphicOptions(t,e):this.mergeGraphicLayer.setGraphicOptions(t,e)}getGraphicPosition(t){return this.graphicLayer.getGraphicPosition(t)||this.mergeGraphicLayer.getGraphicPosition(t)||this.parkingSpaceLayer.getGraphicPosition(t)}changeParkingColor(t){this.parkingSpaceLayer.changeParkingColor(t)}getParkingOptionsByParkingNo(t){return this.parkingSpaceLayer.getParkingOptionsByParkingNo(t)}updateBox(){this.box.setFromObject(this.groundLayer)}getGraphics(){return this.graphicLayer.children.filter(t=>t instanceof wo)}dispose(){var t;console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(e=>e.dispose()),(t=this.heatmap)==null||t.dispose(),this.groundUpper.clear(),this.models.children.forEach(e=>e.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new t_,this.groundUpper=new Se,this.models=new Se,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new Be,this.groundLayer=new Ki(this.context),this.graphicLayer=new r_(this.context),this.poiLayer=new i_(this.context),this.poiLayer2=new up(this.context),this.parkingSpaceLayer=new o_(this.context),this.wallLayer=new Ki(this.context),this.textureLayer=new Ki(this.context),this.glbModelLayer=new u_(this.context),this.laneLayer=new Ki(this.context),this.mergeGraphicLayer=new f_(this.context),this.textTextureLayer=new Ki(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var Gte=H(En(),1),kte=H(Ge(),1);var Ja=class extends Sn{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:n}=this.context,{offsetX:i,offsetY:o}=t,{clientWidth:a,clientHeight:l}=n.domElement,c=i/a*2-1,f=1-o/l*2;return new G(c,f,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:n}=this.context;return sn(t,e,n.clientWidth,n.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:n,height:i}=e;this.svg&&(this.svg.setAttribute("width",""+n),this.svg.setAttribute("height",""+i))},this.svg=yT(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var p_=class extends Ja{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:n,y:i}]=this.points;return Math.sqrt((n-t)**2+(i-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let i=this.getSvgCoordinate(this.points[0]);_h(this.circles[0],i.x,i.y),wu(this.line,i)}if(this.points[1]){let i=this.getSvgCoordinate(this.points[1]);_h(this.circles[1],i.x,i.y),wu(this.line,void 0,i)}},this.onPointermove=i=>{this.points.length===1&&(this.line.style.display="block",wu(this.line,void 0,{x:i.offsetX,y:i.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=i=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(i);if(o){let{offsetX:a,offsetY:l}=i,c=this.circles[this.points.length];_h(c,a,l),this.points.length||wu(this.line,{x:a,y:l},{x:a,y:l}),this.addPoint(o)}};let{config:{svg:{circle:e,line:n}}}=t;this.circles=[Xd(e.radius,e.fill),Xd(e.radius,e.fill)],this.line=Ev(n.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var qte=H(En(),1);var d_=class extends Ja{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let n=this.circles[0],i=+n.getAttribute("cx"),o=+n.getAttribute("cy");return Math.sqrt((t-i)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(i=>[i.x,i.y]),e=0,n=t.length;for(let i=0;i<n;i++){let o=(i+1)%n;e+=t[i][0]*t[o][1]-t[o][0]*t[i][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,n)=>{let i=this.getSvgCoordinate(e);this.circles[n]&&_h(this.circles[n],i.x,i.y),n!==0&&wu(this.lines[n-1],void 0,i),this.lines[n]&&wu(this.lines[n],i)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",wu(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let n=this.getIntersectByPointerEvent(e);if(n){let{offsetX:i,offsetY:o}=e;this.checkAdsorb(i,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(n);let{circle:{fill:a,radius:l},line:{stroke:c}}=this.context.config.svg;if(!this.isClose){let f=Xd(l,a);_h(f,i,o),this.addCircle(f)}if(this.lines.length&&wu(this.lastLine,void 0,{x:i,y:o}),!this.isClose){let f=Ev(c);wu(f,{x:i,y:o},{x:i,y:o}),this.addLine(f)}}},this.registryEvent()}};var RR=class extends Ja{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let n=new Be().setFromObject(this.graphic),{camera:i,container:{clientWidth:o,clientHeight:a}}=this.context,{min:l,max:c}=n,f=sn(l,i,o,a),g=sn(c,i,o,a);bs(this.rect,f.x,g.y,Math.abs(g.x-f.x),Math.abs(g.y-f.y));let{x:m,y:v}=f,{x,y:S}=g,w=5,E=[{x:m-w,y:S-w},{x:x-w,y:S-w},{x:m-w,y:v-w},{x:x-w,y:v-w}];for(let F=0;F<E.length;F++)bs(this.cornerRect[F],E[F].x,E[F].y,w*2,w*2);let b=4,C=(m+x)/2,A=(v+S)/2,P=[{x:C-b,y:S-b},{x:m-b,y:A-b},{x:x-b,y:A-b},{x:C-b,y:v-b}];for(let F=0;F<P.length;F++)bs(this.centerRect[F],P[F].x,P[F].y,b*2,b*2)}else{bs(this.rect,0,0,0,0);for(let n=0;n<this.cornerRect.length;n++)bs(this.cornerRect[n],0,0,0,0),bs(this.centerRect[n],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=Zl(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let n=0;n<4;n++)this.cornerRect[n]=Zl(e.stroke,"#ffffff"),this.centerRect[n]=Zl(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[n]),this.svg.appendChild(this.centerRect[n]);this.registryEvent()}};var Qte=H(En(),1);var g_=class extends Se{initGeometry(){return At(this,null,function*(){let t=yield v0.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
|
|
12136
12136
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
12137
12137
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
12138
12138
|
uniform vec3 uColor;
|