@aibee/crc-bmap 0.12.2 → 0.12.3

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.cjs CHANGED
@@ -3943,7 +3943,7 @@ void main() {
3943
3943
  }
3944
3944
 
3945
3945
  }\`,Zu=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 Yt,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 _n({extensions:{fragDepth:!0},vertexShader:OU,fragmentShader:FU,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new an(new uo(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}},Ju=class extends ni{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 Zu,d=t.getContextAttributes(),p=null,b=null,v=[],E=[],I=new ue,R=null,w=new kt;w.layers.enable(1),w.viewport=new _t;let B=new kt;B.layers.enable(2),B.viewport=new _t;let j=[w,B],x=new $u;x.layers.enable(1),x.layers.enable(2);let A=null,ie=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(k){let Q=v[k];return Q===void 0&&(Q=new rs,v[k]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(k){let Q=v[k];return Q===void 0&&(Q=new rs,v[k]=Q),Q.getGripSpace()},this.getHand=function(k){let Q=v[k];return Q===void 0&&(Q=new rs,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,ie=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 Ms(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 Nn(m.framebufferWidth,m.framebufferHeight,{format:sn,type:Qn,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?_r:Ti,me=d.stencil?Ai:Jn);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 Nn(f.textureWidth,f.textureHeight,{format:sn,type:Qn,depthTexture:new fo(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],ae=(Me[9]-1)/Me[5],Y=(Me[8]-1)/Me[0],re=(ye[8]+1)/ye[0],Z=ke*Y,_e=ke*re,pe=Ae/(-Y+re),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=ae*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||ie!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),A=x.near,ie=x.far,w.near=A,w.far=ie,B.near=A,B.far=ie,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=Lu*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 ae=h.getViewSubImage(f,ke);Te=ae.viewport,ye===0&&(e.setRenderTargetTextures(b,ae.colorTexture,f.ignoreDepthValues?void 0:ae.depthStencilTexture),e.setRenderTarget(b))}let T=j[ye];T===void 0&&(T=new kt,T.layers.enable(ye),T.viewport=new _t,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 X0;Ie.setAnimationLoop(ve),this.setAnimationLoop=function(k){te=k},this.dispose=function(){}}},yi=new Ri,BU=new ht;function zU(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,q0(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===Nt&&(d.bumpScale.value*=-1)),p.normalMap&&(d.normalMap.value=p.normalMap,t(p.normalMap,d.normalMapTransform),d.normalScale.value.copy(p.normalScale),p.side===Nt&&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,yi.copy(E),yi.x*=-1,yi.y*=-1,yi.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(yi.y*=-1,yi.z*=-1),d.envMapRotation.value.setFromMatrix4(BU.makeRotationFromEuler(yi)),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===Nt&&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 kU(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 ie=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,ie+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,ie,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 ie=j[x],K=Array.isArray(ie.value)?ie.value:[ie.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),ie.__data=new Float32Array($.storage/Float32Array.BYTES_PER_ELEMENT),ie.__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 Ku=class{constructor(e={}){let{canvas:t=HC(),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=mn,this._useLegacyLights=!1,this.toneMapping=jn,this.toneMappingExposure=1;let v=this,E=!1,I=0,R=0,w=null,B=-1,j=null,x=new _t,A=new _t,ie=null,K=new Xe(0),C=0,W=t.width,G=t.height,$=1,q=null,X=null,ne=new _t(0,0,W,G),te=new _t(0,0,W,G),ve=!1,Ie=new lo,k=!1,Q=!1,me=null,Ae=new ht,Me=new ue,ye=new U,ke={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Te(){return w===null?$:1}let T=i;function ae(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\${_h}\`),t.addEventListener("webglcontextlost",et,!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=ae(N,M),T===null)throw ae(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,re,Z,_e,pe,xe,Ge,S,y,V,H,ee,J,Le,Re,ce,he,Ue,se,ct,He,we,Se,be;function Ye(){Y=new nL(T),re=new J2(T,Y,e),Y.init(re),we=new NU(T,Y,re),Z=new LU(T,Y,re),_e=new sL(T),pe=new xU,xe=new UU(T,Y,Z,pe,re,we,_e),Ge=new j2(v),S=new tL(v),y=new hP(T,re),Se=new $2(T,Y,y,re),V=new iL(T,y,_e,Se),H=new lL(T,V,y,_e),se=new cL(T,re,xe),ce=new K2(pe),ee=new yU(v,Ge,S,Y,re,Se,ce),J=new zU(v,pe),Le=new SU,Re=new RU(Y,re),Ue=new Y2(v,Ge,S,Z,H,f,c),he=new IU(v,H,re),be=new kU(T,_e,re,Z),ct=new Z2(T,Y,_e,re),He=new rL(T,Y,_e,re),_e.programs=ee.programs,v.capabilities=re,v.extensions=Y,v.properties=pe,v.renderLists=Le,v.shadowMap=he,v.state=Z,v.info=_e}Ye();let De=new Ju(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===k0||ge===z0||ge===B0}if(D){let ge=w.texture.type,Ee=ge===Qn||ge===Jn||ge===yh||ge===Ai||ge===O0||ge===F0,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",et,!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",Gt),De.removeEventListener("sessionend",Ke),me&&(me.dispose(),me=null),At.stop()};function et(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),oe(N)}function oe(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=wx(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,ot=Ne.start*Ve,Dt=(Ne.start+Ne.count)*Ve;ge!==null&&(ot=Math.max(ot,ge.start*Ve),Dt=Math.min(Dt,(ge.start+ge.count)*Ve)),Pe!==null?(ot=Math.max(ot,0),Dt=Math.min(Dt,Pe.count)):Oe!=null&&(ot=Math.max(ot,0),Dt=Math.min(Dt,Oe.count));let pt=Dt-ot;if(pt<0||pt===1/0)return;Se.setup(D,z,Ce,F,Pe);let yn,it=ct;if(Pe!==null&&(yn=y.get(Pe),it=He,it.setIndex(yn)),D.isMesh)z.wireframe===!0?(Z.setLineWidth(z.wireframeLinewidth*Te()),it.setMode(T.LINES)):it.setMode(T.TRIANGLES);else if(D.isLine){let Fe=z.linewidth;Fe===void 0&&(Fe=1),Z.setLineWidth(Fe*Te()),D.isLineSegments?it.setMode(T.LINES):D.isLineLoop?it.setMode(T.LINE_LOOP):it.setMode(T.LINE_STRIP)}else D.isPoints?it.setMode(T.POINTS):D.isSprite&&it.setMode(T.TRIANGLES);if(D.isBatchedMesh)it.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else if(D.isInstancedMesh)it.renderInstances(ot,pt,D.count);else if(F.isInstancedBufferGeometry){let Fe=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,Io=Math.min(F.instanceCount,Fe);it.renderInstances(ot,pt,Io)}else it.render(ot,pt)};function qe(M,N,F){M.transparent===!0&&M.side===In&&M.forceSinglePass===!1?(M.side=Nt,M.needsUpdate=!0,xs(M,N,F),M.side=ti,M.needsUpdate=!0,xs(M,N,F),M.side=In):xs(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 Je=null;function gt(M){Je&&Je(M)}function Gt(){At.stop()}function Ke(){At.start()}let At=new X0;At.setAnimationLoop(gt),typeof self!="undefined"&&At.setContext(self),this.setAnimationLoop=function(M){Je=M,De.setAnimationLoop(M),M===null?At.stop():At.start()},De.addEventListener("sessionstart",Gt),De.addEventListener("sessionend",Ke),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=ce.init(this.clippingPlanes,Q),_=Le.get(M,p.length),_.init(),p.push(_),cn(M,N,0,v.sortObjects),_.finish(),v.sortObjects===!0&&_.sort(q,X),this.info.render.frame++,k===!0&&ce.beginShadows();let F=d.state.shadowsArray;if(he.render(F,M,N),k===!0&&ce.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];Kh(_,M,Ee,Ee.viewport)}}else Kh(_,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 cn(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],ot=Ce[Oe.materialIndex];ot&&ot.visible&&_.push(M,Ee,ot,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++)cn(ge[Ee],N,F,z)}function Kh(M,N,F,z){let D=M.opaque,ge=M.transmissive,Ee=M.transparent;d.setupLightsView(F),k===!0&&ce.setGlobalState(v.clippingPlanes,F),ge.length>0&&Tx(D,ge,N,F),z&&Z.viewport(x.copy(z)),D.length>0&&ys(D,N,F),ge.length>0&&ys(ge,N,F),Ee.length>0&&ys(Ee,N,F),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Tx(M,N,F,z){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;let ge=re.isWebGL2;me===null&&(me=new Nn(1,1,{generateMipmaps:!0,type:Y.has("EXT_color_buffer_half_float")?os:Qn,minFilter:bi,samples:ge?4:0})),v.getDrawingBufferSize(Me),ge?me.setSize(Me.x,Me.y):me.setSize(Uu(Me.x),Uu(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=jn,ys(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],ot=Oe.object,Dt=Oe.geometry,pt=Oe.material,yn=Oe.group;if(pt.side===In&&ot.layers.test(z.layers)){let it=pt.side;pt.side=Nt,pt.needsUpdate=!0,jh(ot,F,z,Dt,pt,yn),pt.side=it,pt.needsUpdate=!0,Pe=!0}}Pe===!0&&(xe.updateMultisampleRenderTarget(me),xe.updateRenderTargetMipmap(me)),v.setRenderTarget(Ee),v.setClearColor(K,C),v.toneMapping=Ce}function ys(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)&&jh(Ce,N,F,Pe,Ve,Ne)}}function jh(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===In&&D.forceSinglePass===!1?(D.side=Nt,D.needsUpdate=!0,v.renderBufferDirect(F,N,z,D,M,ge),D.side=ti,D.needsUpdate=!0,v.renderBufferDirect(F,N,z,D,M,ge),D.side=In):v.renderBufferDirect(F,N,z,D,M,ge),M.onAfterRender(v,N,F,z,D,ge)}function xs(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 ef(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=ce.uniform),ef(M,Ce),z.needsLights=Cx(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 Qh(M){if(M.uniformsList===null){let N=M.currentProgram.getUniforms();M.uniformsList=mr.seqWithValue(N.seq,M.uniforms)}return M.uniformsList}function ef(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 wx(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:ri,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,ot=!!F.morphAttributes.normal,Dt=!!F.morphAttributes.color,pt=jn;z.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(pt=v.toneMapping);let yn=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,it=yn!==void 0?yn.length:0,Fe=pe.get(z),Io=d.state.lights;if(k===!0&&(Q===!0||M!==j)){let Ht=M===j&&z.id===B;ce.setState(z,M,Ht)}let tt=!1;z.version===Fe.__version?(Fe.needsLights&&Fe.lightsStateVersion!==Io.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!==ce.numPlanes||Fe.numIntersection!==ce.numIntersection)||Fe.vertexAlphas!==Ve||Fe.vertexTangents!==Ne||Fe.morphTargets!==Oe||Fe.morphNormals!==ot||Fe.morphColors!==Dt||Fe.toneMapping!==pt||re.isWebGL2===!0&&Fe.morphTargetsCount!==it)&&(tt=!0):(tt=!0,Fe.__version=z.version);let si=Fe.currentProgram;tt===!0&&(si=xs(z,N,D));let tf=!1,Ir=!1,Lo=!1,xt=si.getUniforms(),ai=Fe.uniforms;if(Z.useProgram(si.program)&&(tf=!0,Ir=!0,Lo=!0),z.id!==B&&(B=z.id,Ir=!0),tf||j!==M){xt.setValue(T,"projectionMatrix",M.projectionMatrix),xt.setValue(T,"viewMatrix",M.matrixWorldInverse);let Ht=xt.map.cameraPosition;Ht!==void 0&&Ht.setValue(T,ye.setFromMatrixPosition(M.matrixWorld)),re.logarithmicDepthBuffer&&xt.setValue(T,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&xt.setValue(T,"isOrthographic",M.isOrthographicCamera===!0),j!==M&&(j=M,Ir=!0,Lo=!0)}if(D.isSkinnedMesh){xt.setOptional(T,D,"bindMatrix"),xt.setOptional(T,D,"bindMatrixInverse");let Ht=D.skeleton;Ht&&(re.floatVertexTextures?(Ht.boneTexture===null&&Ht.computeBoneTexture(),xt.setValue(T,"boneTexture",Ht.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&&(xt.setOptional(T,D,"batchingTexture"),xt.setValue(T,"batchingTexture",D._matricesTexture,xe));let Uo=F.morphAttributes;if((Uo.position!==void 0||Uo.normal!==void 0||Uo.color!==void 0&&re.isWebGL2===!0)&&se.update(D,F,si),(Ir||Fe.receiveShadow!==D.receiveShadow)&&(Fe.receiveShadow=D.receiveShadow,xt.setValue(T,"receiveShadow",D.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(ai.envMap.value=Pe,ai.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),Ir&&(xt.setValue(T,"toneMappingExposure",v.toneMappingExposure),Fe.needsLights&&Rx(ai,Lo),ge&&z.fog===!0&&J.refreshFogUniforms(ai,ge),J.refreshMaterialUniforms(ai,z,$,G,me),mr.upload(T,Qh(Fe),ai,xe)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(mr.upload(T,Qh(Fe),ai,xe),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&xt.setValue(T,"center",D.center),xt.setValue(T,"modelViewMatrix",D.modelViewMatrix),xt.setValue(T,"normalMatrix",D.normalMatrix),xt.setValue(T,"modelMatrix",D.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){let Ht=z.uniformsGroups;for(let No=0,Px=Ht.length;No<Px;No++)if(re.isWebGL2){let nf=Ht[No];be.update(nf,si),be.bind(nf,si)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return si}function Rx(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 Cx(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):re.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),ie=M.scissorTest}else x.copy(ne).multiplyScalar($).floor(),A.copy(te).multiplyScalar($).floor(),ie=ve;if(Z.bindFramebuffer(T.FRAMEBUFFER,D)&&re.drawBuffers&&z&&Z.drawBuffers(M,D),Z.viewport(x),Z.scissor(A),Z.setScissorTest(ie),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!==sn&&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===os&&(Y.has("EXT_color_buffer_half_float")||re.isWebGL2&&Y.has("EXT_color_buffer_float"));if(Ne!==Qn&&we.convert(Ne)!==T.getParameter(T.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ne===Ln&&(re.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),ot=T.getParameter(T.UNPACK_IMAGE_HEIGHT),Dt=T.getParameter(T.UNPACK_SKIP_PIXELS),pt=T.getParameter(T.UNPACK_SKIP_ROWS),yn=T.getParameter(T.UNPACK_SKIP_IMAGES),it=F.isCompressedTexture?F.mipmaps[D]:F.image;T.pixelStorei(T.UNPACK_ROW_LENGTH,it.width),T.pixelStorei(T.UNPACK_IMAGE_HEIGHT,it.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,it.data):z.isCompressedArrayTexture?T.compressedTexSubImage3D(Ne,D,N.x,N.y,N.z,ge,Ee,Ce,Pe,it.data):T.texSubImage3D(Ne,D,N.x,N.y,N.z,ge,Ee,Ce,Pe,Ve,it),T.pixelStorei(T.UNPACK_ROW_LENGTH,Oe),T.pixelStorei(T.UNPACK_IMAGE_HEIGHT,ot),T.pixelStorei(T.UNPACK_SKIP_PIXELS,Dt),T.pixelStorei(T.UNPACK_SKIP_ROWS,pt),T.pixelStorei(T.UNPACK_SKIP_IMAGES,yn),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 Un}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===xh?"display-p3":"srgb",t.unpackColorSpace=Ze.workingColorSpace===yo?"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}},ju=class extends Ku{};ju.prototype.isWebGL1Renderer=!0;var $t=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 ue: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 ht;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(Et(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(Et(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}},us=class extends $t{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 ue){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}},Qu=class extends us{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function Sh(){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 Ga=new U,Su=new Sh,bu=new Sh,Eu=new Sh,eh=class extends $t{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]:(Ga.subVectors(r[0],r[1]).add(r[0]),l=Ga);let h=r[a%s],f=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(Ga.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=Ga),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=_),Su.initNonuniformCatmullRom(l.x,h.x,f.x,u.x,g,_,d),bu.initNonuniformCatmullRom(l.y,h.y,f.y,u.y,g,_,d),Eu.initNonuniformCatmullRom(l.z,h.z,f.z,u.z,g,_,d)}else this.curveType==="catmullrom"&&(Su.initCatmullRom(l.x,h.x,f.x,u.x,this.tension),bu.initCatmullRom(l.y,h.y,f.y,u.y,this.tension),Eu.initCatmullRom(l.z,h.z,f.z,u.z,this.tension));return i.set(Su.calc(c),bu.calc(c),Eu.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 R0(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 VU(n,e){let t=1-n;return t*t*e}function GU(n,e){return 2*(1-n)*n*e}function HU(n,e){return n*n*e}function ss(n,e,t,i){return VU(n,e)+GU(n,t)+HU(n,i)}function WU(n,e){let t=1-n;return t*t*t*e}function qU(n,e){let t=1-n;return 3*t*t*n*e}function XU(n,e){return 3*(1-n)*n*n*e}function YU(n,e){return n*n*n*e}function as(n,e,t,i,r){return WU(n,e)+qU(n,t)+XU(n,i)+YU(n,r)}var po=class extends $t{constructor(e=new ue,t=new ue,i=new ue,r=new ue){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new ue){let i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(as(e,r.x,s.x,o.x,a.x),as(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}},th=class extends $t{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(as(e,r.x,s.x,o.x,a.x),as(e,r.y,s.y,o.y,a.y),as(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}},mo=class extends $t{constructor(e=new ue,t=new ue){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ue){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 ue){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}},nh=class extends $t{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}},go=class extends $t{constructor(e=new ue,t=new ue,i=new ue){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new ue){let i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(ss(e,r.x,s.x,o.x),ss(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}},ih=class extends $t{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(ss(e,r.x,s.x,o.x),ss(e,r.y,s.y,o.y),ss(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}},vo=class extends $t{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ue){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(R0(a,c.x,l.x,u.x,h.x),R0(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 ue().fromArray(r))}return this}},rh=Object.freeze({__proto__:null,ArcCurve:Qu,CatmullRomCurve3:eh,CubicBezierCurve:po,CubicBezierCurve3:th,EllipseCurve:us,LineCurve:mo,LineCurve3:nh,QuadraticBezierCurve:go,QuadraticBezierCurve3:ih,SplineCurve:vo}),sh=class extends $t{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 rh[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 rh[r.type]().fromJSON(r))}return this}},Mr=class extends sh{constructor(e){super(),this.type="Path",this.currentPoint=new ue,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 mo(this.currentPoint.clone(),new ue(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let s=new go(this.currentPoint.clone(),new ue(e,t),new ue(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){let a=new po(this.currentPoint.clone(),new ue(e,t),new ue(i,r),new ue(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new vo(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 us(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 Sr=class extends Mr{constructor(e){super(e),this.uuid=Ar(),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 Mr().fromJSON(r))}return this}},$U={triangulate:function(n,e,t=2){let i=e&&e.length,r=i?e[0]*t:n.length,s=j0(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=QU(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 hs(s,o,t,a,c,m,0),o}};function j0(n,e,t,i,r){let s,o;if(r===uN(n,e,t,i)>0)for(s=e;s<t;s+=i)o=C0(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=C0(s,n[s],n[s+1],o);return o&&Mo(o,o.next)&&(ds(o),o=o.next),o}function Ci(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Mo(t,t.next)||st(t.prev,t,t.next)===0)){if(ds(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function hs(n,e,t,i,r,s,o){if(!n)return;!o&&s&&rN(n,i,r,s);let a=n,c,l;for(;n.prev!==n.next;){if(c=n.prev,l=n.next,s?JU(n,i,r,s):ZU(n)){e.push(c.i/t|0),e.push(n.i/t|0),e.push(l.i/t|0),ds(n),n=l.next,a=l.next;continue}if(n=l,n===a){o?o===1?(n=KU(Ci(n),e,t),hs(n,e,t,i,r,s,2)):o===2&&jU(n,e,t,i,r,s):hs(Ci(n),e,t,i,r,s,1);break}}}function ZU(n){let e=n.prev,t=n,i=n.next;if(st(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&&fr(r,a,s,c,o,l,g.x,g.y)&&st(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function JU(n,e,t,i){let r=n.prev,s=n,o=n.next;if(st(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=ah(m,g,e,t,i),b=ah(_,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&&fr(a,u,c,h,l,f,v.x,v.y)&&st(v.prev,v,v.next)>=0||(v=v.prevZ,E.x>=m&&E.x<=_&&E.y>=g&&E.y<=d&&E!==r&&E!==o&&fr(a,u,c,h,l,f,E.x,E.y)&&st(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&&fr(a,u,c,h,l,f,v.x,v.y)&&st(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&&fr(a,u,c,h,l,f,E.x,E.y)&&st(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function KU(n,e,t){let i=n;do{let r=i.prev,s=i.next.next;!Mo(r,s)&&Q0(r,i,i.next,s)&&fs(r,s)&&fs(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),ds(i),ds(i.next),i=n=s),i=i.next}while(i!==n);return Ci(i)}function jU(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&oN(o,a)){let c=ey(o,a);o=Ci(o,o.next),c=Ci(c,c.next),hs(o,e,t,i,r,s,0),hs(c,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function QU(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=j0(n,a,c,i,!1),l===l.next&&(l.steiner=!0),r.push(aN(l));for(r.sort(eN),s=0;s<r.length;s++)t=tN(r[s],t);return t}function eN(n,e){return n.x-e.x}function tN(n,e){let t=nN(n,e);if(!t)return e;let i=ey(t,n);return Ci(i,i.next),Ci(t,t.next)}function nN(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&&fr(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),fs(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&iN(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function iN(n,e){return st(n.prev,n,e.prev)<0&&st(e.next,n,n.next)<0}function rN(n,e,t,i){let r=n;do r.z===0&&(r.z=ah(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,sN(r)}function sN(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 ah(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 fr(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 oN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!cN(n,e)&&(fs(n,e)&&fs(e,n)&&lN(n,e)&&(st(n.prev,n,e.prev)||st(n,e.prev,e))||Mo(n,e)&&st(n.prev,n,n.next)>0&&st(e.prev,e,e.next)>0)}function st(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Mo(n,e){return n.x===e.x&&n.y===e.y}function Q0(n,e,t,i){let r=Wa(st(n,e,t)),s=Wa(st(n,e,i)),o=Wa(st(t,i,n)),a=Wa(st(t,i,e));return!!(r!==s&&o!==a||r===0&&Ha(n,t,e)||s===0&&Ha(n,i,e)||o===0&&Ha(t,n,i)||a===0&&Ha(t,e,i))}function Ha(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 Wa(n){return n>0?1:n<0?-1:0}function cN(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&&Q0(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function fs(n,e){return st(n.prev,n,n.next)<0?st(n,e,n.next)>=0&&st(n,n.prev,e)>=0:st(n,e,n.prev)<0||st(n,n.next,e)<0}function lN(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 ey(n,e){let t=new oh(n.i,n.x,n.y),i=new oh(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 C0(n,e,t,i){let r=new oh(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 ds(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 oh(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 uN(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 ei=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=[];P0(e),I0(i,e);let o=e.length;t.forEach(P0);for(let c=0;c<t.length;c++)r.push(o),o+=t[c].length,I0(i,t[c]);let a=$U.triangulate(i,r);for(let c=0;c<a.length;c+=3)s.push(a.slice(c,c+3));return s}};function P0(n){let e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function I0(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}var br=class n extends Vt{constructor(e=new Sr([new ue(.5,.5),new ue(-.5,.5),new ue(-.5,-.5),new ue(.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 yt(r,3)),this.setAttribute("uv",new yt(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:hN,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(!ei.isClockWise(x)){x=x.reverse();for(let T=0,ae=A.length;T<ae;T++){let Y=A[T];ei.isClockWise(Y)&&(A[T]=Y.reverse())}}let K=ei.triangulateShape(x,A),C=x;for(let T=0,ae=A.length;T<ae;T++){let Y=A[T];x=x.concat(Y)}function W(T,ae,Y){return ae||console.error("THREE.ExtrudeGeometry: vec does not exist"),T.clone().addScaledVector(ae,Y)}let G=x.length,$=K.length;function q(T,ae,Y){let re,Z,_e,pe=T.x-ae.x,xe=T.y-ae.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=ae.x-xe/H,Le=ae.y+pe/H,Re=Y.x-S/ee,ce=Y.y+Ge/ee,he=((Re-J)*S-(ce-Le)*Ge)/(pe*S-xe*Ge);re=J+pe*he-T.x,Z=Le+xe*he-T.y;let Ue=re*re+Z*Z;if(Ue<=2)return new ue(re,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?(re=-xe,Z=pe,_e=Math.sqrt(y)):(re=pe,Z=xe,_e=Math.sqrt(y/2))}return new ue(re/_e,Z/_e)}let X=[];for(let T=0,ae=C.length,Y=ae-1,re=T+1;T<ae;T++,Y++,re++)Y===ae&&(Y=0),re===ae&&(re=0),X[T]=q(C[T],C[Y],C[re]);let ne=[],te,ve=X.concat();for(let T=0,ae=A.length;T<ae;T++){let Y=A[T];te=[];for(let re=0,Z=Y.length,_e=Z-1,pe=re+1;re<Z;re++,_e++,pe++)_e===Z&&(_e=0),pe===Z&&(pe=0),te[re]=q(Y[re],Y[_e],Y[pe]);ne.push(te),ve=ve.concat(te)}for(let T=0;T<d;T++){let ae=T/d,Y=m*Math.cos(ae*Math.PI/2),re=g*Math.sin(ae*Math.PI/2)+_;for(let Z=0,_e=C.length;Z<_e;Z++){let pe=W(C[Z],X[Z],re);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],re);Ae(S.x,S.y,-Y)}}}let Ie=g+_;for(let T=0;T<G;T++){let ae=f?W(x[T],ve[T],Ie):x[T];E?(w.copy(I.normals[0]).multiplyScalar(ae.x),R.copy(I.binormals[0]).multiplyScalar(ae.y),B.copy(v[0]).add(w).add(R),Ae(B.x,B.y,B.z)):Ae(ae.x,ae.y,0)}for(let T=1;T<=u;T++)for(let ae=0;ae<G;ae++){let Y=f?W(x[ae],ve[ae],Ie):x[ae];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 ae=T/d,Y=m*Math.cos(ae*Math.PI/2),re=g*Math.sin(ae*Math.PI/2)+_;for(let Z=0,_e=C.length;Z<_e;Z++){let pe=W(C[Z],X[Z],re);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],re);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 ae=0,Y=G*ae;for(let re=0;re<$;re++){let Z=K[re];Me(Z[2]+Y,Z[1]+Y,Z[0]+Y)}ae=u+d*2,Y=G*ae;for(let re=0;re<$;re++){let Z=K[re];Me(Z[0]+Y,Z[1]+Y,Z[2]+Y)}}else{for(let ae=0;ae<$;ae++){let Y=K[ae];Me(Y[2],Y[1],Y[0])}for(let ae=0;ae<$;ae++){let Y=K[ae];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,ae=0;me(C,ae),ae+=C.length;for(let Y=0,re=A.length;Y<re;Y++){let Z=A[Y];me(Z,ae),ae+=Z.length}i.addGroup(T,r.length/3-T,1)}function me(T,ae){let Y=T.length;for(;--Y>=0;){let re=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=ae+re+xe,y=ae+Z+xe,V=ae+Z+Ge,H=ae+re+Ge;ye(S,y,V,H)}}}function Ae(T,ae,Y){c.push(T),c.push(ae),c.push(Y)}function Me(T,ae,Y){ke(T),ke(ae),ke(Y);let re=r.length/3,Z=b.generateTopUV(i,r,re-3,re-2,re-1);Te(Z[0]),Te(Z[1]),Te(Z[2])}function ye(T,ae,Y,re){ke(T),ke(ae),ke(re),ke(ae),ke(Y),ke(re);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 fN(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 rh[r.type]().fromJSON(r)),new n(i,e.options)}},hN={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 ue(s,o),new ue(a,c),new ue(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 ue(o,1-c),new ue(l,1-h),new ue(f,1-g),new ue(_,1-p)]:[new ue(a,1-c),new ue(u,1-h),new ue(m,1-g),new ue(d,1-p)]}};function fN(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 ps=class n extends Vt{constructor(e=new Sr([new ue(0,.5),new ue(-.5,-.5),new ue(.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 yt(r,3)),this.setAttribute("normal",new yt(s,3)),this.setAttribute("uv",new yt(o,2));function l(u){let h=r.length/3,f=u.extractPoints(t),m=f.shape,g=f.holes;ei.isClockWise(m)===!1&&(m=m.reverse());for(let d=0,p=g.length;d<p;d++){let b=g[d];ei.isClockWise(b)===!0&&(g[d]=b.reverse())}let _=ei.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 dN(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 dN(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 qa(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 pN(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Er=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_(){}},ch=class extends Er{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:O_,endingEnd:O_}}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 F_:s=e,a=2*t-i;break;case B_: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 F_:o=e,c=2*i-t;break;case B_: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}},lh=class extends Er{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}},uh=class extends Er{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},on=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=qa(t,this.TimeBufferType),this.values=qa(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:qa(e.times,Array),values:qa(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new uh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new lh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new ch(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ya:t=this.InterpolantFactoryMethodDiscrete;break;case $a:t=this.InterpolantFactoryMethodLinear;break;case Zl: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 Ya;case this.InterpolantFactoryMethodLinear:return $a;case this.InterpolantFactoryMethodSmooth:return Zl}}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&&pN(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()===Zl,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}};on.prototype.TimeBufferType=Float32Array;on.prototype.ValueBufferType=Float32Array;on.prototype.DefaultInterpolation=$a;var Pi=class extends on{};Pi.prototype.ValueTypeName="bool";Pi.prototype.ValueBufferType=Array;Pi.prototype.DefaultInterpolation=Ya;Pi.prototype.InterpolantFactoryMethodLinear=void 0;Pi.prototype.InterpolantFactoryMethodSmooth=void 0;var hh=class extends on{};hh.prototype.ValueTypeName="color";var fh=class extends on{};fh.prototype.ValueTypeName="number";var dh=class extends Er{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)ii.slerpFlat(s,0,o,l-a,o,l,c);return s}},ms=class extends on{InterpolantFactoryMethodLinear(e){return new dh(this.times,this.values,this.getValueSize(),e)}};ms.prototype.ValueTypeName="quaternion";ms.prototype.DefaultInterpolation=$a;ms.prototype.InterpolantFactoryMethodSmooth=void 0;var Ii=class extends on{};Ii.prototype.ValueTypeName="string";Ii.prototype.ValueBufferType=Array;Ii.prototype.DefaultInterpolation=Ya;Ii.prototype.InterpolantFactoryMethodLinear=void 0;Ii.prototype.InterpolantFactoryMethodSmooth=void 0;var ph=class extends on{};ph.prototype.ValueTypeName="vector";var mh=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}}},mN=new mh,gh=class{constructor(e){this.manager=e!==void 0?e:mN,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}};gh.DEFAULT_MATERIAL_NAME="__DEFAULT";var bh="\\\\[\\\\]\\\\.:\\\\/",gN=new RegExp("["+bh+"]","g"),Eh="[^"+bh+"]",vN="[^"+bh.replace("\\\\.","")+"]",_N=/((?:WC+[\\/:])*)/.source.replace("WC",Eh),yN=/(WCOD+)?/.source.replace("WCOD",vN),xN=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Eh),MN=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Eh),SN=new RegExp("^"+_N+yN+xN+MN+"$"),bN=["material","materials","bones","map"],vh=class{constructor(e,t,i){let r=i||nt.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()}},nt=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(gN,"")}static parseTrackName(e){let t=SN.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);bN.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}};nt.Composite=vh;nt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};nt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};nt.prototype.GetterByBindingType=[nt.prototype._getValue_direct,nt.prototype._getValue_array,nt.prototype._getValue_arrayElement,nt.prototype._getValue_toArray];nt.prototype.SetterByBindingTypeAndVersioning=[[nt.prototype._setValue_direct,nt.prototype._setValue_direct_setNeedsUpdate,nt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_array,nt.prototype._setValue_array_setNeedsUpdate,nt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_arrayElement,nt.prototype._setValue_arrayElement_setNeedsUpdate,nt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_fromArray,nt.prototype._setValue_fromArray_setNeedsUpdate,nt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var CB=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:_h}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=_h);var WB=We(Oy(),1),qB=We(Xs(),1);function wr(n,e){e===void 0&&(e=[]);let t=new Sr(n.map(i=>new ue(...i)));return e.length&&e.forEach(i=>{var r=new Mr(i.map(s=>new ue(...s)));t.holes.push(r)}),t}var uz=We(Mx(),1),hz=We(Hh(),1);function Sx(n){return n.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function bx(n){let e={};for(let i in n)i.startsWith("on")&&(e[Sx(i.slice(2))]=n[i]);let t=i=>Ms(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 Ez=We(el(),1),Az=We(tl(),1),Tz=We(nl(),1),wz=We(rl(),1),Rz=We(sl(),1),Cz=We(ll(),1),Pz=We(fl(),1),Iz=We(pl(),1),Lz=We(ml(),1),Uz=We(vl(),1),Nz=We(yl(),1),Dz=We(bl(),1),Oz=We(Tl(),1),Fz=We(Vl(),1),Bz=We(Gl(),1),zz=We(Xs(),1);function Pr(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 Vt,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=Ex(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=Ex(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 Ex(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 at(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 Ax(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=wr(l[0],l.slice(1)),h=new br(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 at(m,1)),h.setAttribute("opacity",new at(new Float32Array(f).fill(a.fillOpacity),1)),t){let d=new Float32Array(f).fill(a.airHeight+a.deltaHeight);h.setAttribute("minZ",new at(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 at(_,3)),h}),s=Pr(r);r.forEach(a=>a.dispose());let o={geometry:s};if(s.dispose(),e){let{points:a,colors:c,opacities:l}=yO(i),u=new Vt().setFromPoints(a);u.setAttribute("color",new at(new Float32Array(c),3)),u.setAttribute("opacity",new at(new Float32Array(l),1)),o.lineGeometry=u}return o}function yO(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}}bx({onGetMergedGeometryAttributes(n){let{data:e}=n,t=e.map(s=>{let o=s.geometry.coords,a=wr(o[0],o.slice(1));return new br(a,{steps:1,bevelEnabled:!1,depth:s.height,curveSegments:4})}),i=Pr(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=wr(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),a=new ps(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 at(new Float32Array(l),4)),a}),i=Pr(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=wr(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),a=new ps(o,4),c=a.getAttribute("position"),l=[1,1,1,0,0,0,0,1];a.setAttribute("uv",new yt(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=Pr(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=Ax(e);if(t){var i;return{mergedGeometry:t.geometry.toJSON(),lineGeometry:(i=t.lineGeometry)==null?void 0:i.toJSON()}}else return null}});
3946
- `],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var Ps=require("three");var xe=class{static GetMergeGeometry(t){return T(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield gt(e,"get_merged_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedShapeGeometry(t){return T(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield gt(e,"get_merged_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedTexture2dGeometry(t){return T(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield gt(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 Ps.BufferGeometry;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new Ps.BufferAttribute(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new Ps.BufferAttribute(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 T(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield gt(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?R({},t[0],n):null})}static dispose(){this.WorkerPool.dispose()}};xe.WorkerPool=new Ho(10,lf);var CS=require("lodash"),ro={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},wt=class extends V.Object3D{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new V.Vector3,e=new V.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new V.Vector3(0,0,0);let t=new V.Box3,e=new V.Vector3;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 V.Vector3(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,s=yn(e,n.coord),a=new V.Vector2(...n.coord),u=new V.Vector2(...e[s]).sub(new V.Vector2(...n.coord)).normalize(),l=new V.Vector2().addVectors(a,u.clone().multiplyScalar(i)),c=new V.Vector2().addVectors(a,u.clone().multiplyScalar(-i)),h=new V.Vector2(-u.y,u.x),p=new V.Vector2().addVectors(l,h.clone().multiplyScalar(o));Ac([p.x,p.y],e)||(h.multiplyScalar(-1),p=new V.Vector2().addVectors(l,h.clone().multiplyScalar(o)));let f=new V.Vector2().addVectors(c,h.clone().multiplyScalar(o)),d=[[l.x,l.y],[p.x,p.y],[f.x,f.y],[c.x,c.y]];e=this.options.geometry.coords[0]=[...e.slice(0,s+1),...d,...e.slice(s+1)]})}}initGeometry(){let t=Zo(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new V.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=nt.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&Ct.getTextureByUrl(this.options.secondUrl).then(n=>{n.wrapS=V.RepeatWrapping,n.wrapT=V.RepeatWrapping,n.needsUpdate=!0,t.map=n,t.side=V.DoubleSide}),this.options.height<=.1)return this.material=t,t;let e=nt.createMeshBasicMaterial({color:vn(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let n=new V.Box3().setFromObject(this),i=t.clone().add(e.clone().multiplyScalar(1e3)),o=new V.Ray(i,e.clone().multiplyScalar(-1)),s=new V.Vector3;o.intersectBox(n,s);let a=t.clone().add(e.clone().multiplyScalar(-1e3)),u=new V.Ray(a,e.clone()),l=new V.Vector3;return u.intersectBox(n,l),{max:l,min:s}}initGradualMaterial(){let{max:t,min:e}=new V.Box3().setFromObject(this),n=t.clone().sub(e),i=Math.max(n.x,n.y,n.z)/2,o=this.getPosition(),s=new V.Vector3(-1,.2,0).normalize(),{max:a,min:u}=this.getMaxAndMin(o,s),l=nt.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new V.Vector3(-1,.2,0),max:a,min:u});if(this.options.height<=.1)return this.material=l,l;let c=this.getCenter(),h=new V.Vector3(-1,.2,1).normalize(),{max:p,min:f}=this.getMaxAndMin(c,h),d=nt.createShaderMaterial({gradualColor:[vn(this.options.gradualColor[0],this.options.colorFactor),vn(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new V.Vector3(-1,.2,1),max:p,min:f});return this.material=[l,d],[l,d]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=nt.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=nt.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new V.Mesh(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 s=0;s<o.length;s++){let a=o[s],u=s+1===o.length?o[0]:o[s+1];t.push(new V.Vector3(a[0],a[1],e)),t.push(new V.Vector3(u[0],u[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new V.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new V.LineSegments(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=zr((0,CS.cloneDeep)(R({},ro,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 Ge=require("three");var _s=class extends Ge.Object3D{initLight(){let t=fc(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 Ge.Color(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 Ge.PlaneGeometry(t,e),i=new Ge.ShadowMaterial({transparent:!0,opacity:0,side:Ge.DoubleSide}),o=new Ge.Mesh(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(){st(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var C7=v(L(),1);var T0=require("three");var yt=require("three");var WS=require("lodash");var rZ={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},ni=class extends Ut{initObserver(){let t=new MutationObserver((0,WS.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 wt&&this.element.options.geometry.type==="polygon"){let{max:s,min:a}=new yt.Box3().setFromObject(this.element),u=(s.x+a.x)/2,l=(s.y+a.y)/2;return{left:new yt.Vector3(a.x,l,s.z),leftTop:new yt.Vector3(a.x,s.y,s.z),top:new yt.Vector3(u,s.y,s.z),rightTop:new yt.Vector3(s.x,s.y,s.z),right:new yt.Vector3(s.x,l,s.z),rightBottom:new yt.Vector3(s.x,a.y,s.z),bottom:new yt.Vector3(u,a.y,s.z),leftBottom:new yt.Vector3(a.x,a.y,s.z),center:new yt.Vector3(u,l,s.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 yt.Vector3(n,i,o),leftTop:new yt.Vector3(n,i,o),top:new yt.Vector3(n,i,o),rightTop:new yt.Vector3(n,i,o),right:new yt.Vector3(n,i,o),rightBottom:new yt.Vector3(n,i,o),bottom:new yt.Vector3(n,i,o),leftBottom:new yt.Vector3(n,i,o),center:new yt.Vector3(n,i,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,n=this.getPlacementPosition();return Object.keys(n).reduce((i,o)=>{let{x:s,y:a}=B(n[o],this.context.camera,t,e);return i[o]={x:s,y:a},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,s=[{type:"center",getBox(a,u){return{max:{x:i+a,y:u-e},min:{x:a-i,y:u}}}},{type:"left",getBox(a,u){return{max:{x:a,y:u-o},min:{x:a-t,y:u+o}}}},{type:"leftTop",getBox(a,u){return{max:{x:a,y:u-e},min:{x:a-t,y:u}}}},{type:"top",getBox(a,u){return{max:{x:a+i,y:u-e},min:{x:a-i,y:u}}}},{type:"rightTop",getBox(a,u){return{max:{x:a+t,y:u-e},min:{x:a,y:u}}}},{type:"right",getBox(a,u){return{max:{x:a+t,y:u-o},min:{x:a,y:u+o}}}},{type:"rightBottom",getBox(a,u){return{max:{x:a+t,y:u},min:{x:a,y:u+e}}}},{type:"bottom",getBox(a,u){return{max:{x:a+i,y:u},min:{x:a-i,y:u+e}}}},{type:"leftBottom",getBox(a,u){return{max:{x:a,y:u},min:{x:a-t,y:u+o}}}}];for(let a=0;a<s.length;a++){let u=s[a],l=n[u.type],{max:c,min:h}=u.getBox(l.x,l.y);if(this.checkOverflow(c,h))return{type:u.type,position:l}}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 yt.Box3().setFromObject(this.element).getCenter(new yt.Vector3):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:s}=this.context.clientSize;if(this.options.appendToBody){this.div.style.left=""+o+"px",this.div.style.top=""+(s+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:s}=B(e,this.context.camera,n,i);this.clientPos.x===o&&this.clientPos.y===s&&!t||this._updatePosition(o,s)}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 yt.Vector3,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=R({},rZ,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var iZ={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},_r=class extends T0.EventDispatcher{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return T(this,null,function*(){if(yield wc(),!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:s,y:a}=this.overlay.clientPos;return{left:s-i/2,right:s+i/2,top:this.options.icon?a-o:a-o/2,bottom:this.options.icon?a:a+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 T0.Vector3,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=zr(R({},iZ,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 ni(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",s=>{let{x:a,y:u,height:l}=s;this.overlay.div.style.transform="translate3d(calc("+a+"px - 50%), calc("+(-l+u)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",s=>{let{value:a}=s;a?this.img?this.img.setAttribute("src",a):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",s=>{let{value:a}=s,u=this.textDiv;if(u){let l=this.initText();this.div.replaceChild(l,u)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",s=>{let{value:a}=s;this.overlay.setOpacity(a)}),this.addEventListener("change-icon_size",s=>{let{value:a}=s;this.img&&(this.img.style.width=""+((a==null?void 0:a[0])||32)+"px",this.img.style.height=""+((a==null?void 0:a[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",s=>{let{value:a}=s;this.img&&(this.img.style.opacity=""+a)}),this.addEventListener("change-icon_border",s=>{let{value:a}=s;this.img&&(this.img.style.border=a.width+"px solid "+a.color)}),this.addEventListener("change-background",s=>{let{value:a}=s;this.div.style.background=a})}};var tH=v(L(),1),eH=v($e(),1),nH=v(tn(),1),rH=v(en(),1),iH=v(nn(),1),oH=v(rn(),1),sH=v(on(),1),aH=v(sn(),1),pe=require("three");var Lt=require("three"),YS=require("@mars3d/heatmap.js"),Ar=require("@turf/turf"),As=class extends Lt.Object3D{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:n,leftTop:i,center:o}=this.getBox(t);this.heatmap=(0,YS.create)(R({width:e,height:n,container:this.div},this.context.config.heatMap)),this.heatmap.setData(this.transformData(t,i)),this.initPlane(e,n),this.position.set(o[0],o[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let n=new Lt.PlaneGeometry(t,e),i=new Lt.Texture(this.div.firstChild);i.needsUpdate=!0;let o=new Lt.MeshBasicMaterial({transparent:!0,side:Lt.DoubleSide,map:i});o.needsUpdate=!0,this.plane=new Lt.Mesh(n,o),this.add(this.plane)}getTransMatrix(t){let{x:e,y:n}=t;return new Lt.Matrix3().makeScale(1,-1).multiply(new Lt.Matrix3().makeTranslation(0-e,0-n))}transformData(t,e){let n=this.getTransMatrix(e);return{data:t.data.map(o=>{let s=new Lt.Vector2(o.x,o.y).applyMatrix3(n);return{x:s.x,y:s.y,value:o.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,Ar.featureCollection)(t.data.map(u=>(0,Ar.point)([u.x,u.y]))),n=(0,Ar.bbox)(e),i=n[2]-n[0],o=n[3]-n[1],s={x:n[0],y:n[3]},a=(0,Ar.center)(e);return{width:i,height:o,leftTop:s,center:a.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}constructor(t){super(),this.context=t,this.div=document.createElement("div")}};var w0=require("three");var xs=class extends w0.Object3D{loadModel(){return T(this,null,function*(){let t=yield Ht.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){st(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new w0.Vector3(0,0,0)),this.loadModel()}};var k7=v(L(),1);var j0=require("three");var RS=require("three");var xt=class extends RS.Object3D{dispose(){st(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t}};var Ss=class extends xt{getCenter(){return new j0.Box3().setFromObject(this).getCenter(new j0.Vector3)}createGraphic(t){let e=new wt(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 wt){let s=o.raycast(t);if(s){let{distance:a}=s;if(a<i.distance)return{distance:s.distance,position:s.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=R({},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 q7=v(E0(),1),$7=v(Q(),1);var OS=require("lodash");var bs=class extends xt{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 _r(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 _r&&i.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,i)=>{let{left:o,right:s,top:a,bottom:u}=n.getBox();if(i===0||!n.options.collision_enable){t.push({left:o,right:s,top:a,bottom:u}),n.parentSetVisible(!0);return}let l=t.some(c=>c.left<s&&c.right>o&&c.top<u&&c.bottom>a);n.parentSetVisible(!l),l||t.push({left:o,right:s,top:a,bottom:u})})}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 ft,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,OS.debounce)(this.collisionDetection,10)}};var i8=v(E0(),1),o8=v(Q(),1);var cf=require("lodash");var I0=require("three"),ri=class extends xt{clear(){return this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new Mt(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}pushPoi(t){if(this.add(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceChangeParkingSpaceVisibleByZoom(),this.debounceCollisionDetection()}),!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 I0.Vector2(t,e);return this.pois.filter(o=>o instanceof Mt&&o.canSelect&&o.box.containsPoint(n))}collisionDetection(){let t=[],{camera:e}=this.context;e.updateMatrixWorld();let n=l=>l<=1&&l>=-1,i=e.projectionMatrix.clone();i.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,s=25/30,a=Math.min(25,Math.max(1,o*s));this.pois.filter(l=>{if(l.visible){var c,h;if(!(a<=l.options.maxWeight&&a>=l.options.minWeight))return l.parentSetVisible(!1),!1;let p=l.spriteIcon?(c=l.spriteIcon)==null?void 0:c.matrixWorld:((h=l.spriteText)==null?void 0:h.matrixWorld)||l.matrixWorld,f=new I0.Vector3().setFromMatrixPosition(p);return f.applyMatrix4(i),l.screenPosition=f,n(f.x)&&n(f.y)&&n(f.z)}return!1}).forEach((l,c)=>{let h=l.getBox(l.screenPosition);if(c===0||!l.options.collision_enable){t.push(h),l.parentSetVisible(!0);return}let p=t.some(f=>f.intersectsBox(h));l.parentSetVisible(!p),p||t.push(h)})}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)}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 ft,this.changeParkingSpaceVisibleByZoom=()=>{var e;let n=(e=this.parent)==null?void 0:e.parent;if(n&&n instanceof Se){let{clientSize:{width:i,height:o}}=this.context,{max:s,min:a}=n.box,l=Math.min(i/(s.x-a.x),o/(s.y-a.y))*(s.x-a.x)/60,c=this.context.camera.zoom>=l;this.pois.filter(h=>h.userData.type==="parkingSpace").map(h=>{h.visible=c,c||h.parentSetVisible(c)})}},this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,cf.debounce)(this.collisionDetection,10),this.debounceChangeParkingSpaceVisibleByZoom=(0,cf.debounce)(this.changeParkingSpaceVisibleByZoom,10)}};var w8=v(L(),1);var ZS=require("three");var NS=require("three/examples/jsm/lines/LineMaterial.js"),St=require("three");function XS(r){return`${r.x}-${r.y}-${r.z}`}var be=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 St.LineBasicMaterial({color:new St.Color(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 St.MeshStandardMaterial({color:new St.Color(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 St.MeshBasicMaterial({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:s,min:a}){let u=`${t.toString()}-${XS(e)}-${n}-${i}-${XS(o)}`;if(this.shaderMaterialMap.has(u))return this.shaderMaterialMap.get(u);let l=`
3946
+ `],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var Ps=require("three");var xe=class{static GetMergeGeometry(t){return T(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield gt(e,"get_merged_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedShapeGeometry(t){return T(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield gt(e,"get_merged_shape_geometry_attributes",{data:t}),i=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),i})}static GetMergedTexture2dGeometry(t){return T(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield gt(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 Ps.BufferGeometry;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new Ps.BufferAttribute(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new Ps.BufferAttribute(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 T(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield gt(e,"get_merged_geometries_json",{data:t});return this.WorkerPool.releaseWorker(e),n?R({},t[0],n):null})}static dispose(){this.WorkerPool.dispose()}};xe.WorkerPool=new Ho(10,lf);var CS=require("lodash"),ro={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},wt=class extends V.Object3D{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new V.Vector3,e=new V.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new V.Vector3(0,0,0);let t=new V.Box3,e=new V.Vector3;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 V.Vector3(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,s=yn(e,n.coord),a=new V.Vector2(...n.coord),u=new V.Vector2(...e[s]).sub(new V.Vector2(...n.coord)).normalize(),l=new V.Vector2().addVectors(a,u.clone().multiplyScalar(i)),c=new V.Vector2().addVectors(a,u.clone().multiplyScalar(-i)),h=new V.Vector2(-u.y,u.x),p=new V.Vector2().addVectors(l,h.clone().multiplyScalar(o));Ac([p.x,p.y],e)||(h.multiplyScalar(-1),p=new V.Vector2().addVectors(l,h.clone().multiplyScalar(o)));let f=new V.Vector2().addVectors(c,h.clone().multiplyScalar(o)),d=[[l.x,l.y],[p.x,p.y],[f.x,f.y],[c.x,c.y]];e=this.options.geometry.coords[0]=[...e.slice(0,s+1),...d,...e.slice(s+1)]})}}initGeometry(){let t=Zo(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new V.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=nt.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&Ct.getTextureByUrl(this.options.secondUrl).then(n=>{n.wrapS=V.RepeatWrapping,n.wrapT=V.RepeatWrapping,n.needsUpdate=!0,t.map=n,t.side=V.DoubleSide}),this.options.height<=.1)return this.material=t,t;let e=nt.createMeshBasicMaterial({color:vn(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let n=new V.Box3().setFromObject(this),i=t.clone().add(e.clone().multiplyScalar(1e3)),o=new V.Ray(i,e.clone().multiplyScalar(-1)),s=new V.Vector3;o.intersectBox(n,s);let a=t.clone().add(e.clone().multiplyScalar(-1e3)),u=new V.Ray(a,e.clone()),l=new V.Vector3;return u.intersectBox(n,l),{max:l,min:s}}initGradualMaterial(){let{max:t,min:e}=new V.Box3().setFromObject(this),n=t.clone().sub(e),i=Math.max(n.x,n.y,n.z)/2,o=this.getPosition(),s=new V.Vector3(-1,.2,0).normalize(),{max:a,min:u}=this.getMaxAndMin(o,s),l=nt.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new V.Vector3(-1,.2,0),max:a,min:u});if(this.options.height<=.1)return this.material=l,l;let c=this.getCenter(),h=new V.Vector3(-1,.2,1).normalize(),{max:p,min:f}=this.getMaxAndMin(c,h),d=nt.createShaderMaterial({gradualColor:[vn(this.options.gradualColor[0],this.options.colorFactor),vn(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new V.Vector3(-1,.2,1),max:p,min:f});return this.material=[l,d],[l,d]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=nt.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=nt.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new V.Mesh(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 s=0;s<o.length;s++){let a=o[s],u=s+1===o.length?o[0]:o[s+1];t.push(new V.Vector3(a[0],a[1],e)),t.push(new V.Vector3(u[0],u[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new V.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new V.LineSegments(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=zr((0,CS.cloneDeep)(R({},ro,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 Ge=require("three");var _s=class extends Ge.Object3D{initLight(){let t=fc(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 Ge.Color(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 Ge.PlaneGeometry(t,e),i=new Ge.ShadowMaterial({transparent:!0,opacity:0,side:Ge.DoubleSide}),o=new Ge.Mesh(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(){st(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var C7=v(L(),1);var T0=require("three");var yt=require("three");var WS=require("lodash");var rZ={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},ni=class extends Ut{initObserver(){let t=new MutationObserver((0,WS.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 wt&&this.element.options.geometry.type==="polygon"){let{max:s,min:a}=new yt.Box3().setFromObject(this.element),u=(s.x+a.x)/2,l=(s.y+a.y)/2;return{left:new yt.Vector3(a.x,l,s.z),leftTop:new yt.Vector3(a.x,s.y,s.z),top:new yt.Vector3(u,s.y,s.z),rightTop:new yt.Vector3(s.x,s.y,s.z),right:new yt.Vector3(s.x,l,s.z),rightBottom:new yt.Vector3(s.x,a.y,s.z),bottom:new yt.Vector3(u,a.y,s.z),leftBottom:new yt.Vector3(a.x,a.y,s.z),center:new yt.Vector3(u,l,s.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 yt.Vector3(n,i,o),leftTop:new yt.Vector3(n,i,o),top:new yt.Vector3(n,i,o),rightTop:new yt.Vector3(n,i,o),right:new yt.Vector3(n,i,o),rightBottom:new yt.Vector3(n,i,o),bottom:new yt.Vector3(n,i,o),leftBottom:new yt.Vector3(n,i,o),center:new yt.Vector3(n,i,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,n=this.getPlacementPosition();return Object.keys(n).reduce((i,o)=>{let{x:s,y:a}=B(n[o],this.context.camera,t,e);return i[o]={x:s,y:a},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,s=[{type:"center",getBox(a,u){return{max:{x:i+a,y:u-e},min:{x:a-i,y:u}}}},{type:"left",getBox(a,u){return{max:{x:a,y:u-o},min:{x:a-t,y:u+o}}}},{type:"leftTop",getBox(a,u){return{max:{x:a,y:u-e},min:{x:a-t,y:u}}}},{type:"top",getBox(a,u){return{max:{x:a+i,y:u-e},min:{x:a-i,y:u}}}},{type:"rightTop",getBox(a,u){return{max:{x:a+t,y:u-e},min:{x:a,y:u}}}},{type:"right",getBox(a,u){return{max:{x:a+t,y:u-o},min:{x:a,y:u+o}}}},{type:"rightBottom",getBox(a,u){return{max:{x:a+t,y:u},min:{x:a,y:u+e}}}},{type:"bottom",getBox(a,u){return{max:{x:a+i,y:u},min:{x:a-i,y:u+e}}}},{type:"leftBottom",getBox(a,u){return{max:{x:a,y:u},min:{x:a-t,y:u+o}}}}];for(let a=0;a<s.length;a++){let u=s[a],l=n[u.type],{max:c,min:h}=u.getBox(l.x,l.y);if(this.checkOverflow(c,h))return{type:u.type,position:l}}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 yt.Box3().setFromObject(this.element).getCenter(new yt.Vector3):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:s}=this.context.clientSize;if(this.div){if(this.options.appendToBody){this.div.style.left=""+o+"px",this.div.style.top=""+(s+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:s}=B(e,this.context.camera,n,i);this.clientPos.x===o&&this.clientPos.y===s&&!t||this._updatePosition(o,s)}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 yt.Vector3,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=R({},rZ,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var iZ={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},_r=class extends T0.EventDispatcher{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return T(this,null,function*(){if(yield wc(),!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:s,y:a}=this.overlay.clientPos;return{left:s-i/2,right:s+i/2,top:this.options.icon?a-o:a-o/2,bottom:this.options.icon?a:a+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 T0.Vector3,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=zr(R({},iZ,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 ni(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",s=>{let{x:a,y:u,height:l}=s;this.overlay.div.style.transform="translate3d(calc("+a+"px - 50%), calc("+(-l+u)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",s=>{let{value:a}=s;a?this.img?this.img.setAttribute("src",a):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",s=>{let{value:a}=s,u=this.textDiv;if(u){let l=this.initText();this.div.replaceChild(l,u)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",s=>{let{value:a}=s;this.overlay.setOpacity(a)}),this.addEventListener("change-icon_size",s=>{let{value:a}=s;this.img&&(this.img.style.width=""+((a==null?void 0:a[0])||32)+"px",this.img.style.height=""+((a==null?void 0:a[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",s=>{let{value:a}=s;this.img&&(this.img.style.opacity=""+a)}),this.addEventListener("change-icon_border",s=>{let{value:a}=s;this.img&&(this.img.style.border=a.width+"px solid "+a.color)}),this.addEventListener("change-background",s=>{let{value:a}=s;this.div.style.background=a})}};var tH=v(L(),1),eH=v($e(),1),nH=v(tn(),1),rH=v(en(),1),iH=v(nn(),1),oH=v(rn(),1),sH=v(on(),1),aH=v(sn(),1),pe=require("three");var Lt=require("three"),YS=require("@mars3d/heatmap.js"),Ar=require("@turf/turf"),As=class extends Lt.Object3D{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:n,leftTop:i,center:o}=this.getBox(t);this.heatmap=(0,YS.create)(R({width:e,height:n,container:this.div},this.context.config.heatMap)),this.heatmap.setData(this.transformData(t,i)),this.initPlane(e,n),this.position.set(o[0],o[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let n=new Lt.PlaneGeometry(t,e),i=new Lt.Texture(this.div.firstChild);i.needsUpdate=!0;let o=new Lt.MeshBasicMaterial({transparent:!0,side:Lt.DoubleSide,map:i});o.needsUpdate=!0,this.plane=new Lt.Mesh(n,o),this.add(this.plane)}getTransMatrix(t){let{x:e,y:n}=t;return new Lt.Matrix3().makeScale(1,-1).multiply(new Lt.Matrix3().makeTranslation(0-e,0-n))}transformData(t,e){let n=this.getTransMatrix(e);return{data:t.data.map(o=>{let s=new Lt.Vector2(o.x,o.y).applyMatrix3(n);return{x:s.x,y:s.y,value:o.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,Ar.featureCollection)(t.data.map(u=>(0,Ar.point)([u.x,u.y]))),n=(0,Ar.bbox)(e),i=n[2]-n[0],o=n[3]-n[1],s={x:n[0],y:n[3]},a=(0,Ar.center)(e);return{width:i,height:o,leftTop:s,center:a.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}constructor(t){super(),this.context=t,this.div=document.createElement("div")}};var w0=require("three");var xs=class extends w0.Object3D{loadModel(){return T(this,null,function*(){let t=yield Ht.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){st(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new w0.Vector3(0,0,0)),this.loadModel()}};var k7=v(L(),1);var j0=require("three");var RS=require("three");var xt=class extends RS.Object3D{dispose(){st(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t}};var Ss=class extends xt{getCenter(){return new j0.Box3().setFromObject(this).getCenter(new j0.Vector3)}createGraphic(t){let e=new wt(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 wt){let s=o.raycast(t);if(s){let{distance:a}=s;if(a<i.distance)return{distance:s.distance,position:s.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=R({},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 q7=v(E0(),1),$7=v(Q(),1);var OS=require("lodash");var bs=class extends xt{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 _r(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 _r&&i.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,i)=>{let{left:o,right:s,top:a,bottom:u}=n.getBox();if(i===0||!n.options.collision_enable){t.push({left:o,right:s,top:a,bottom:u}),n.parentSetVisible(!0);return}let l=t.some(c=>c.left<s&&c.right>o&&c.top<u&&c.bottom>a);n.parentSetVisible(!l),l||t.push({left:o,right:s,top:a,bottom:u})})}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 ft,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,OS.debounce)(this.collisionDetection,10)}};var i8=v(E0(),1),o8=v(Q(),1);var cf=require("lodash");var I0=require("three"),ri=class extends xt{clear(){return this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new Mt(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}pushPoi(t){if(this.add(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceChangeParkingSpaceVisibleByZoom(),this.debounceCollisionDetection()}),!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 I0.Vector2(t,e);return this.pois.filter(o=>o instanceof Mt&&o.canSelect&&o.box.containsPoint(n))}collisionDetection(){let t=[],{camera:e}=this.context;e.updateMatrixWorld();let n=l=>l<=1&&l>=-1,i=e.projectionMatrix.clone();i.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom,s=25/30,a=Math.min(25,Math.max(1,o*s));this.pois.filter(l=>{if(l.visible){var c,h;if(!(a<=l.options.maxWeight&&a>=l.options.minWeight))return l.parentSetVisible(!1),!1;let p=l.spriteIcon?(c=l.spriteIcon)==null?void 0:c.matrixWorld:((h=l.spriteText)==null?void 0:h.matrixWorld)||l.matrixWorld,f=new I0.Vector3().setFromMatrixPosition(p);return f.applyMatrix4(i),l.screenPosition=f,n(f.x)&&n(f.y)&&n(f.z)}return!1}).forEach((l,c)=>{let h=l.getBox(l.screenPosition);if(c===0||!l.options.collision_enable){t.push(h),l.parentSetVisible(!0);return}let p=t.some(f=>f.intersectsBox(h));l.parentSetVisible(!p),p||t.push(h)})}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)}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 ft,this.changeParkingSpaceVisibleByZoom=()=>{var e;let n=(e=this.parent)==null?void 0:e.parent;if(n&&n instanceof Se){let{clientSize:{width:i,height:o}}=this.context,{max:s,min:a}=n.box,l=Math.min(i/(s.x-a.x),o/(s.y-a.y))*(s.x-a.x)/60,c=this.context.camera.zoom>=l;this.pois.filter(h=>h.userData.type==="parkingSpace").map(h=>{h.visible=c,c||h.parentSetVisible(c)})}},this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=(0,cf.debounce)(this.collisionDetection,10),this.debounceChangeParkingSpaceVisibleByZoom=(0,cf.debounce)(this.changeParkingSpaceVisibleByZoom,10)}};var w8=v(L(),1);var ZS=require("three");var NS=require("three/examples/jsm/lines/LineMaterial.js"),St=require("three");function XS(r){return`${r.x}-${r.y}-${r.z}`}var be=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 St.LineBasicMaterial({color:new St.Color(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 St.MeshStandardMaterial({color:new St.Color(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 St.MeshBasicMaterial({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:s,min:a}){let u=`${t.toString()}-${XS(e)}-${n}-${i}-${XS(o)}`;if(this.shaderMaterialMap.has(u))return this.shaderMaterialMap.get(u);let l=`
3947
3947
  uniform vec3 uColor;
3948
3948
  uniform vec3 uGradualColor;
3949
3949
  uniform vec3 center;