@aibee/crc-bmap 0.8.70 → 0.8.71
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/platform/wrapper.cjs
CHANGED
|
@@ -11567,4 +11567,4 @@ void main() {
|
|
|
11567
11567
|
|
|
11568
11568
|
}\`,Ky=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let s=new Ds,c=t.properties.get(s);c.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,s=new Ca({extensions:{fragDepth:!0},vertexShader:VW,fragmentShader:WW,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new ea(new bd(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},jy=class extends Yu{constructor(t,e){super();let o=this,s=null,c=1,h=null,p="local-floor",g=1,m=null,_=null,E=null,x=null,b=null,P=null,I=new Ky,S=e.getContextAttributes(),w=null,R=null,T=[],F=[],W=new Yn,X=null,q=new ps;q.layers.enable(1),q.viewport=new Ki;let D=new ps;D.layers.enable(2),D.viewport=new Ki;let xt=[q,D],B=new Jy;B.layers.enable(1),B.layers.enable(2);let j=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getTargetRaySpace()},this.getControllerGrip=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getGripSpace()},this.getHand=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getHandSpace()};function Dt(at){let Ut=F.indexOf(at.inputSource);if(Ut===-1)return;let jt=T[Ut];jt!==void 0&&(jt.update(at.inputSource,at.frame,m||h),jt.dispatchEvent({type:at.type,data:at.inputSource}))}function Q(){s.removeEventListener("select",Dt),s.removeEventListener("selectstart",Dt),s.removeEventListener("selectend",Dt),s.removeEventListener("squeeze",Dt),s.removeEventListener("squeezestart",Dt),s.removeEventListener("squeezeend",Dt),s.removeEventListener("end",Q),s.removeEventListener("inputsourceschange",At);for(let at=0;at<T.length;at++){let Ut=F[at];Ut!==null&&(F[at]=null,T[at].disconnect(Ut))}j=null,J=null,I.reset(),t.setRenderTarget(w),b=null,x=null,E=null,s=null,R=null,ae.stop(),o.isPresenting=!1,t.setPixelRatio(X),t.setSize(W.width,W.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(at){c=at,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(at){p=at,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return m||h},this.setReferenceSpace=function(at){m=at},this.getBaseLayer=function(){return x!==null?x:b},this.getBinding=function(){return E},this.getFrame=function(){return P},this.getSession=function(){return s},this.setSession=function(at){return ec(this,null,function*(){if(s=at,s!==null){if(w=t.getRenderTarget(),s.addEventListener("select",Dt),s.addEventListener("selectstart",Dt),s.addEventListener("selectend",Dt),s.addEventListener("squeeze",Dt),s.addEventListener("squeezestart",Dt),s.addEventListener("squeezeend",Dt),s.addEventListener("end",Q),s.addEventListener("inputsourceschange",At),S.xrCompatible!==!0&&(yield e.makeXRCompatible()),X=t.getPixelRatio(),t.getSize(W),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let Ut={antialias:s.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:c};b=new XRWebGLLayer(s,e,Ut),s.updateRenderState({baseLayer:b}),t.setPixelRatio(1),t.setSize(b.framebufferWidth,b.framebufferHeight,!1),R=new hu(b.framebufferWidth,b.framebufferHeight,{format:ta,type:Wu,colorSpace:t.outputColorSpace,stencilBuffer:S.stencil})}else{let Ut=null,jt=null,ce=null;S.depth&&(ce=S.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Ut=S.stencil?Uc:Pl,jt=S.stencil?Cl:qu);let te={colorFormat:e.RGBA8,depthFormat:ce,scaleFactor:c};E=new XRWebGLBinding(s,e),x=E.createProjectionLayer(te),s.updateRenderState({layers:[x]}),t.setPixelRatio(1),t.setSize(x.textureWidth,x.textureHeight,!1),R=new hu(x.textureWidth,x.textureHeight,{format:ta,type:Wu,depthTexture:new Td(x.textureWidth,x.textureHeight,jt,void 0,void 0,void 0,void 0,void 0,void 0,Ut),stencilBuffer:S.stencil,colorSpace:t.outputColorSpace,samples:S.antialias?4:0});let $t=t.properties.get(R);$t.__ignoreDepthValues=x.ignoreDepthValues}R.isXRRenderTarget=!0,this.setFoveation(g),m=null,h=yield s.requestReferenceSpace(p),ae.setContext(s),ae.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function At(at){for(let Ut=0;Ut<at.removed.length;Ut++){let jt=at.removed[Ut],ce=F.indexOf(jt);ce>=0&&(F[ce]=null,T[ce].disconnect(jt))}for(let Ut=0;Ut<at.added.length;Ut++){let jt=at.added[Ut],ce=F.indexOf(jt);if(ce===-1){for(let $t=0;$t<T.length;$t++)if($t>=F.length){F.push(jt),ce=$t;break}else if(F[$t]===null){F[$t]=jt,ce=$t;break}if(ce===-1)break}let te=T[ce];te&&te.connect(jt)}}let Mt=new Lt,Rt=new Lt;function pt(at,Ut,jt){Mt.setFromMatrixPosition(Ut.matrixWorld),Rt.setFromMatrixPosition(jt.matrixWorld);let ce=Mt.distanceTo(Rt),te=Ut.projectionMatrix.elements,$t=jt.projectionMatrix.elements,qt=te[14]/(te[10]-1),xe=te[14]/(te[10]+1),ft=(te[9]+1)/te[5],We=(te[9]-1)/te[5],ee=(te[8]-1)/te[0],ge=($t[8]+1)/$t[0],fe=qt*ee,Te=qt*ge,be=ce/(-ee+ge),Wt=be*-ee;Ut.matrixWorld.decompose(at.position,at.quaternion,at.scale),at.translateX(Wt),at.translateZ(be),at.matrixWorld.compose(at.position,at.quaternion,at.scale),at.matrixWorldInverse.copy(at.matrixWorld).invert();let Me=qt+be,tt=xe+be,z=fe-Wt,Pt=Te+(ce-Wt),Ot=ft*xe/tt*Me,dt=We*xe/tt*Me;at.projectionMatrix.makePerspective(z,Pt,Ot,dt,Me,tt),at.projectionMatrixInverse.copy(at.projectionMatrix).invert()}function yt(at,Ut){Ut===null?at.matrixWorld.copy(at.matrix):at.matrixWorld.multiplyMatrices(Ut.matrixWorld,at.matrix),at.matrixWorldInverse.copy(at.matrixWorld).invert()}this.updateCamera=function(at){if(s===null)return;I.texture!==null&&(at.near=I.depthNear,at.far=I.depthFar),B.near=D.near=q.near=at.near,B.far=D.far=q.far=at.far,(j!==B.near||J!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),j=B.near,J=B.far,q.near=j,q.far=J,D.near=j,D.far=J,q.updateProjectionMatrix(),D.updateProjectionMatrix(),at.updateProjectionMatrix());let Ut=at.parent,jt=B.cameras;yt(B,Ut);for(let ce=0;ce<jt.length;ce++)yt(jt[ce],Ut);jt.length===2?pt(B,q,D):B.projectionMatrix.copy(q.projectionMatrix),K(at,B,Ut)};function K(at,Ut,jt){jt===null?at.matrix.copy(Ut.matrixWorld):(at.matrix.copy(jt.matrixWorld),at.matrix.invert(),at.matrix.multiply(Ut.matrixWorld)),at.matrix.decompose(at.position,at.quaternion,at.scale),at.updateMatrixWorld(!0),at.projectionMatrix.copy(Ut.projectionMatrix),at.projectionMatrixInverse.copy(Ut.projectionMatrixInverse),at.isPerspectiveCamera&&(at.fov=Oy*2*Math.atan(1/at.projectionMatrix.elements[5]),at.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(x===null&&b===null))return g},this.setFoveation=function(at){g=at,x!==null&&(x.fixedFoveation=at),b!==null&&b.fixedFoveation!==void 0&&(b.fixedFoveation=at)},this.hasDepthSensing=function(){return I.texture!==null};let Bt=null;function Gt(at,Ut){if(_=Ut.getViewerPose(m||h),P=Ut,_!==null){let jt=_.views;b!==null&&(t.setRenderTargetFramebuffer(R,b.framebuffer),t.setRenderTarget(R));let ce=!1;jt.length!==B.cameras.length&&(B.cameras.length=0,ce=!0);for(let $t=0;$t<jt.length;$t++){let qt=jt[$t],xe=null;if(b!==null)xe=b.getViewport(qt);else{let We=E.getViewSubImage(x,qt);xe=We.viewport,$t===0&&(t.setRenderTargetTextures(R,We.colorTexture,x.ignoreDepthValues?void 0:We.depthStencilTexture),t.setRenderTarget(R))}let ft=xt[$t];ft===void 0&&(ft=new ps,ft.layers.enable($t),ft.viewport=new Ki,xt[$t]=ft),ft.matrix.fromArray(qt.transform.matrix),ft.matrix.decompose(ft.position,ft.quaternion,ft.scale),ft.projectionMatrix.fromArray(qt.projectionMatrix),ft.projectionMatrixInverse.copy(ft.projectionMatrix).invert(),ft.viewport.set(xe.x,xe.y,xe.width,xe.height),$t===0&&(B.matrix.copy(ft.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),ce===!0&&B.cameras.push(ft)}let te=s.enabledFeatures;if(te&&te.includes("depth-sensing")){let $t=E.getDepthInformation(jt[0]);$t&&$t.isValid&&$t.texture&&I.init(t,$t,s.renderState)}}for(let jt=0;jt<T.length;jt++){let ce=F[jt],te=T[jt];ce!==null&&te!==void 0&&te.update(ce,Ut,m||h)}I.render(t,B),Bt&&Bt(at,Ut),Ut.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:Ut}),P=null}let ae=new WT;ae.setAnimationLoop(Gt),this.setAnimationLoop=function(at){Bt=at},this.dispose=function(){}}},Sl=new Rl,XW=new Ui;function YW(n,t){function e(S,w){S.matrixAutoUpdate===!0&&S.updateMatrix(),w.value.copy(S.matrix)}function o(S,w){w.color.getRGB(S.fogColor.value,VT(n)),w.isFog?(S.fogNear.value=w.near,S.fogFar.value=w.far):w.isFogExp2&&(S.fogDensity.value=w.density)}function s(S,w,R,T,F){w.isMeshBasicMaterial||w.isMeshLambertMaterial?c(S,w):w.isMeshToonMaterial?(c(S,w),E(S,w)):w.isMeshPhongMaterial?(c(S,w),_(S,w)):w.isMeshStandardMaterial?(c(S,w),x(S,w),w.isMeshPhysicalMaterial&&b(S,w,F)):w.isMeshMatcapMaterial?(c(S,w),P(S,w)):w.isMeshDepthMaterial?c(S,w):w.isMeshDistanceMaterial?(c(S,w),I(S,w)):w.isMeshNormalMaterial?c(S,w):w.isLineBasicMaterial?(h(S,w),w.isLineDashedMaterial&&p(S,w)):w.isPointsMaterial?g(S,w,R,T):w.isSpriteMaterial?m(S,w):w.isShadowMaterial?(S.color.value.copy(w.color),S.opacity.value=w.opacity):w.isShaderMaterial&&(w.uniformsNeedUpdate=!1)}function c(S,w){S.opacity.value=w.opacity,w.color&&S.diffuse.value.copy(w.color),w.emissive&&S.emissive.value.copy(w.emissive).multiplyScalar(w.emissiveIntensity),w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.bumpMap&&(S.bumpMap.value=w.bumpMap,e(w.bumpMap,S.bumpMapTransform),S.bumpScale.value=w.bumpScale,w.side===Yo&&(S.bumpScale.value*=-1)),w.normalMap&&(S.normalMap.value=w.normalMap,e(w.normalMap,S.normalMapTransform),S.normalScale.value.copy(w.normalScale),w.side===Yo&&S.normalScale.value.negate()),w.displacementMap&&(S.displacementMap.value=w.displacementMap,e(w.displacementMap,S.displacementMapTransform),S.displacementScale.value=w.displacementScale,S.displacementBias.value=w.displacementBias),w.emissiveMap&&(S.emissiveMap.value=w.emissiveMap,e(w.emissiveMap,S.emissiveMapTransform)),w.specularMap&&(S.specularMap.value=w.specularMap,e(w.specularMap,S.specularMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest);let R=t.get(w),T=R.envMap,F=R.envMapRotation;if(T&&(S.envMap.value=T,Sl.copy(F),Sl.x*=-1,Sl.y*=-1,Sl.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Sl.y*=-1,Sl.z*=-1),S.envMapRotation.value.setFromMatrix4(XW.makeRotationFromEuler(Sl)),S.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=w.reflectivity,S.ior.value=w.ior,S.refractionRatio.value=w.refractionRatio),w.lightMap){S.lightMap.value=w.lightMap;let W=n._useLegacyLights===!0?Math.PI:1;S.lightMapIntensity.value=w.lightMapIntensity*W,e(w.lightMap,S.lightMapTransform)}w.aoMap&&(S.aoMap.value=w.aoMap,S.aoMapIntensity.value=w.aoMapIntensity,e(w.aoMap,S.aoMapTransform))}function h(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform))}function p(S,w){S.dashSize.value=w.dashSize,S.totalSize.value=w.dashSize+w.gapSize,S.scale.value=w.scale}function g(S,w,R,T){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.size.value=w.size*R,S.scale.value=T*.5,w.map&&(S.map.value=w.map,e(w.map,S.uvTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function m(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.rotation.value=w.rotation,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function _(S,w){S.specular.value.copy(w.specular),S.shininess.value=Math.max(w.shininess,1e-4)}function E(S,w){w.gradientMap&&(S.gradientMap.value=w.gradientMap)}function x(S,w){S.metalness.value=w.metalness,w.metalnessMap&&(S.metalnessMap.value=w.metalnessMap,e(w.metalnessMap,S.metalnessMapTransform)),S.roughness.value=w.roughness,w.roughnessMap&&(S.roughnessMap.value=w.roughnessMap,e(w.roughnessMap,S.roughnessMapTransform)),t.get(w).envMap&&(S.envMapIntensity.value=w.envMapIntensity)}function b(S,w,R){S.ior.value=w.ior,w.sheen>0&&(S.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),S.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(S.sheenColorMap.value=w.sheenColorMap,e(w.sheenColorMap,S.sheenColorMapTransform)),w.sheenRoughnessMap&&(S.sheenRoughnessMap.value=w.sheenRoughnessMap,e(w.sheenRoughnessMap,S.sheenRoughnessMapTransform))),w.clearcoat>0&&(S.clearcoat.value=w.clearcoat,S.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(S.clearcoatMap.value=w.clearcoatMap,e(w.clearcoatMap,S.clearcoatMapTransform)),w.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap,e(w.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),w.clearcoatNormalMap&&(S.clearcoatNormalMap.value=w.clearcoatNormalMap,e(w.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),w.side===Yo&&S.clearcoatNormalScale.value.negate())),w.iridescence>0&&(S.iridescence.value=w.iridescence,S.iridescenceIOR.value=w.iridescenceIOR,S.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(S.iridescenceMap.value=w.iridescenceMap,e(w.iridescenceMap,S.iridescenceMapTransform)),w.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=w.iridescenceThicknessMap,e(w.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),w.transmission>0&&(S.transmission.value=w.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),w.transmissionMap&&(S.transmissionMap.value=w.transmissionMap,e(w.transmissionMap,S.transmissionMapTransform)),S.thickness.value=w.thickness,w.thicknessMap&&(S.thicknessMap.value=w.thicknessMap,e(w.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=w.attenuationDistance,S.attenuationColor.value.copy(w.attenuationColor)),w.anisotropy>0&&(S.anisotropyVector.value.set(w.anisotropy*Math.cos(w.anisotropyRotation),w.anisotropy*Math.sin(w.anisotropyRotation)),w.anisotropyMap&&(S.anisotropyMap.value=w.anisotropyMap,e(w.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=w.specularIntensity,S.specularColor.value.copy(w.specularColor),w.specularColorMap&&(S.specularColorMap.value=w.specularColorMap,e(w.specularColorMap,S.specularColorMapTransform)),w.specularIntensityMap&&(S.specularIntensityMap.value=w.specularIntensityMap,e(w.specularIntensityMap,S.specularIntensityMapTransform))}function P(S,w){w.matcap&&(S.matcap.value=w.matcap)}function I(S,w){let R=t.get(w).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:s}}function $W(n,t,e,o){let s={},c={},h=[],p=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function g(R,T){let F=T.program;o.uniformBlockBinding(R,F)}function m(R,T){let F=s[R.id];F===void 0&&(P(R),F=_(R),s[R.id]=F,R.addEventListener("dispose",S));let W=T.program;o.updateUBOMapping(R,W);let X=t.render.frame;c[R.id]!==X&&(x(R),c[R.id]=X)}function _(R){let T=E();R.__bindingPointIndex=T;let F=n.createBuffer(),W=R.__size,X=R.usage;return n.bindBuffer(n.UNIFORM_BUFFER,F),n.bufferData(n.UNIFORM_BUFFER,W,X),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,T,F),F}function E(){for(let R=0;R<p;R++)if(h.indexOf(R)===-1)return h.push(R),R;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function x(R){let T=s[R.id],F=R.uniforms,W=R.__cache;n.bindBuffer(n.UNIFORM_BUFFER,T);for(let X=0,q=F.length;X<q;X++){let D=Array.isArray(F[X])?F[X]:[F[X]];for(let xt=0,B=D.length;xt<B;xt++){let j=D[xt];if(b(j,X,xt,W)===!0){let J=j.__offset,Dt=Array.isArray(j.value)?j.value:[j.value],Q=0;for(let At=0;At<Dt.length;At++){let Mt=Dt[At],Rt=I(Mt);typeof Mt=="number"||typeof Mt=="boolean"?(j.__data[0]=Mt,n.bufferSubData(n.UNIFORM_BUFFER,J+Q,j.__data)):Mt.isMatrix3?(j.__data[0]=Mt.elements[0],j.__data[1]=Mt.elements[1],j.__data[2]=Mt.elements[2],j.__data[3]=0,j.__data[4]=Mt.elements[3],j.__data[5]=Mt.elements[4],j.__data[6]=Mt.elements[5],j.__data[7]=0,j.__data[8]=Mt.elements[6],j.__data[9]=Mt.elements[7],j.__data[10]=Mt.elements[8],j.__data[11]=0):(Mt.toArray(j.__data,Q),Q+=Rt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,J,j.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function b(R,T,F,W){let X=R.value,q=T+"_"+F;if(W[q]===void 0)return typeof X=="number"||typeof X=="boolean"?W[q]=X:W[q]=X.clone(),!0;{let D=W[q];if(typeof X=="number"||typeof X=="boolean"){if(D!==X)return W[q]=X,!0}else if(D.equals(X)===!1)return D.copy(X),!0}return!1}function P(R){let T=R.uniforms,F=0,W=16;for(let q=0,D=T.length;q<D;q++){let xt=Array.isArray(T[q])?T[q]:[T[q]];for(let B=0,j=xt.length;B<j;B++){let J=xt[B],Dt=Array.isArray(J.value)?J.value:[J.value];for(let Q=0,At=Dt.length;Q<At;Q++){let Mt=Dt[Q],Rt=I(Mt),pt=F%W;pt!==0&&W-pt<Rt.boundary&&(F+=W-pt),J.__data=new Float32Array(Rt.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=F,F+=Rt.storage}}}let X=F%W;return X>0&&(F+=W-X),R.__size=F,R.__cache={},this}function I(R){let T={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(T.boundary=4,T.storage=4):R.isVector2?(T.boundary=8,T.storage=8):R.isVector3||R.isColor?(T.boundary=16,T.storage=12):R.isVector4?(T.boundary=16,T.storage=16):R.isMatrix3?(T.boundary=48,T.storage=48):R.isMatrix4?(T.boundary=64,T.storage=64):R.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",R),T}function S(R){let T=R.target;T.removeEventListener("dispose",S);let F=h.indexOf(T.__bindingPointIndex);h.splice(F,1),n.deleteBuffer(s[T.id]),delete s[T.id],delete c[T.id]}function w(){for(let R in s)n.deleteBuffer(s[R]);h=[],s={},c={}}return{bind:g,update:m,dispose:w}}var Qy=class{constructor(t={}){let{canvas:e=K5(),context:o=null,depth:s=!0,stencil:c=!0,alpha:h=!1,antialias:p=!1,premultipliedAlpha:g=!0,preserveDrawingBuffer:m=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:E=!1}=t;this.isWebGLRenderer=!0;let x;o!==null?x=o.getContextAttributes().alpha:x=h;let b=new Uint32Array(4),P=new Int32Array(4),I=null,S=null,w=[],R=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ba,this._useLegacyLights=!1,this.toneMapping=Vu,this.toneMappingExposure=1;let T=this,F=!1,W=0,X=0,q=null,D=-1,xt=null,B=new Ki,j=new Ki,J=null,Dt=new hr(0),Q=0,At=e.width,Mt=e.height,Rt=1,pt=null,yt=null,K=new Ki(0,0,At,Mt),Bt=new Ki(0,0,At,Mt),Gt=!1,ae=new Md,at=!1,Ut=!1,jt=null,ce=new Ui,te=new Yn,$t=new Lt,qt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return q===null?Rt:1}let ft=o;function We(Z,mt){for(let It=0;It<Z.length;It++){let St=Z[It],vt=e.getContext(St,mt);if(vt!==null)return vt}return null}try{let Z={alpha:!0,depth:s,stencil:c,antialias:p,premultipliedAlpha:g,preserveDrawingBuffer:m,powerPreference:_,failIfMajorPerformanceCaveat:E};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${fv}\`),e.addEventListener("webglcontextlost",Et,!1),e.addEventListener("webglcontextrestored",G,!1),e.addEventListener("webglcontextcreationerror",ot,!1),ft===null){let mt=["webgl2","webgl","experimental-webgl"];if(T.isWebGL1Renderer===!0&&mt.shift(),ft=We(mt,Z),ft===null)throw We(mt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&ft instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ft.getShaderPrecisionFormat===void 0&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Z){throw console.error("THREE.WebGLRenderer: "+Z.message),Z}let ee,ge,fe,Te,be,Wt,Me,tt,z,Pt,Ot,dt,Ht,Ce,Vt,Zt,ne,rt,C,N,k,$,V,ht;function st(){ee=new c8(ft),ge=new i8(ft,ee,t),ee.init(ge),$=new qW(ft,ee,ge),fe=new GW(ft,ee,ge),Te=new p8(ft),be=new CW,Wt=new kW(ft,ee,fe,be,ge,$,Te),Me=new s8(T),tt=new l8(T),z=new _H(ft,ge),V=new n8(ft,ee,z,ge),Pt=new f8(ft,z,Te,V),Ot=new y8(ft,Pt,z,Te),C=new m8(ft,ge,Wt),Zt=new o8(be),dt=new TW(T,Me,tt,ee,ge,V,Zt),Ht=new YW(T,be),Ce=new IW,Vt=new FW(ee,ge),rt=new e8(T,Me,tt,fe,Ot,x,g),ne=new zW(T,Ot,ge),ht=new $W(ft,Te,ge,fe),N=new r8(ft,ee,Te,ge),k=new h8(ft,ee,Te,ge),Te.programs=dt.programs,T.capabilities=ge,T.extensions=ee,T.properties=be,T.renderLists=Ce,T.shadowMap=ne,T.state=fe,T.info=Te}st();let wt=new jy(T,ft);this.xr=wt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return Rt},this.setPixelRatio=function(Z){Z!==void 0&&(Rt=Z,this.setSize(At,Mt,!1))},this.getSize=function(Z){return Z.set(At,Mt)},this.setSize=function(Z,mt,It=!0){if(wt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}At=Z,Mt=mt,e.width=Math.floor(Z*Rt),e.height=Math.floor(mt*Rt),It===!0&&(e.style.width=Z+"px",e.style.height=mt+"px"),this.setViewport(0,0,Z,mt)},this.getDrawingBufferSize=function(Z){return Z.set(At*Rt,Mt*Rt).floor()},this.setDrawingBufferSize=function(Z,mt,It){At=Z,Mt=mt,Rt=It,e.width=Math.floor(Z*It),e.height=Math.floor(mt*It),this.setViewport(0,0,Z,mt)},this.getCurrentViewport=function(Z){return Z.copy(B)},this.getViewport=function(Z){return Z.copy(K)},this.setViewport=function(Z,mt,It,St){Z.isVector4?K.set(Z.x,Z.y,Z.z,Z.w):K.set(Z,mt,It,St),fe.viewport(B.copy(K).multiplyScalar(Rt).round())},this.getScissor=function(Z){return Z.copy(Bt)},this.setScissor=function(Z,mt,It,St){Z.isVector4?Bt.set(Z.x,Z.y,Z.z,Z.w):Bt.set(Z,mt,It,St),fe.scissor(j.copy(Bt).multiplyScalar(Rt).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(Z){fe.setScissorTest(Gt=Z)},this.setOpaqueSort=function(Z){pt=Z},this.setTransparentSort=function(Z){yt=Z},this.getClearColor=function(Z){return Z.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor.apply(rt,arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha.apply(rt,arguments)},this.clear=function(Z=!0,mt=!0,It=!0){let St=0;if(Z){let vt=!1;if(q!==null){let he=q.texture.format;vt=he===zT||he===BT||he===UT}if(vt){let he=q.texture.type,ue=he===Wu||he===qu||he===hv||he===Cl||he===DT||he===FT,we=rt.getClearColor(),de=rt.getClearAlpha(),Be=we.r,Ae=we.g,Pe=we.b;ue?(b[0]=Be,b[1]=Ae,b[2]=Pe,b[3]=de,ft.clearBufferuiv(ft.COLOR,0,b)):(P[0]=Be,P[1]=Ae,P[2]=Pe,P[3]=de,ft.clearBufferiv(ft.COLOR,0,P))}else St|=ft.COLOR_BUFFER_BIT}mt&&(St|=ft.DEPTH_BUFFER_BIT),It&&(St|=ft.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ft.clear(St)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Et,!1),e.removeEventListener("webglcontextrestored",G,!1),e.removeEventListener("webglcontextcreationerror",ot,!1),Ce.dispose(),Vt.dispose(),be.dispose(),Me.dispose(),tt.dispose(),Ot.dispose(),V.dispose(),ht.dispose(),dt.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",qe),wt.removeEventListener("sessionend",Ue),jt&&(jt.dispose(),jt=null),Xe.stop()};function Et(Z){Z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),F=!0}function G(){console.log("THREE.WebGLRenderer: Context Restored."),F=!1;let Z=Te.autoReset,mt=ne.enabled,It=ne.autoUpdate,St=ne.needsUpdate,vt=ne.type;st(),Te.autoReset=Z,ne.enabled=mt,ne.autoUpdate=It,ne.needsUpdate=St,ne.type=vt}function ot(Z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function et(Z){let mt=Z.target;mt.removeEventListener("dispose",et),ut(mt)}function ut(Z){Ft(Z),be.remove(Z)}function Ft(Z){let mt=be.get(Z).programs;mt!==void 0&&(mt.forEach(function(It){dt.releaseProgram(It)}),Z.isShaderMaterial&&dt.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,mt,It,St,vt,he){mt===null&&(mt=qt);let ue=vt.isMesh&&vt.matrixWorld.determinant()<0,we=Qn(Z,mt,It,St,vt);fe.setMaterial(St,ue);let de=It.index,Be=1;if(St.wireframe===!0){if(de=Pt.getWireframeAttribute(It),de===void 0)return;Be=2}let Ae=It.drawRange,Pe=It.attributes.position,tn=Ae.start*Be,oi=(Ae.start+Ae.count)*Be;he!==null&&(tn=Math.max(tn,he.start*Be),oi=Math.min(oi,(he.start+he.count)*Be)),de!==null?(tn=Math.max(tn,0),oi=Math.min(oi,de.count)):Pe!=null&&(tn=Math.max(tn,0),oi=Math.min(oi,Pe.count));let Mr=oi-tn;if(Mr<0||Mr===1/0)return;V.setup(vt,St,we,It,de);let Hi,sr=N;if(de!==null&&(Hi=z.get(de),sr=k,sr.setIndex(Hi)),vt.isMesh)St.wireframe===!0?(fe.setLineWidth(St.wireframeLinewidth*xe()),sr.setMode(ft.LINES)):sr.setMode(ft.TRIANGLES);else if(vt.isLine){let ye=St.linewidth;ye===void 0&&(ye=1),fe.setLineWidth(ye*xe()),vt.isLineSegments?sr.setMode(ft.LINES):vt.isLineLoop?sr.setMode(ft.LINE_LOOP):sr.setMode(ft.LINE_STRIP)}else vt.isPoints?sr.setMode(ft.POINTS):vt.isSprite&&sr.setMode(ft.TRIANGLES);if(vt.isBatchedMesh)sr.renderMultiDraw(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount);else if(vt.isInstancedMesh)sr.renderInstances(tn,Mr,vt.count);else if(It.isInstancedBufferGeometry){let ye=It._maxInstanceCount!==void 0?It._maxInstanceCount:1/0,Da=Math.min(It.instanceCount,ye);sr.renderInstances(tn,Mr,Da)}else sr.render(tn,Mr)};function Kt(Z,mt,It){Z.transparent===!0&&Z.side===uu&&Z.forceSinglePass===!1?(Z.side=Yo,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=Xu,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=uu):rr(Z,mt,It)}this.compile=function(Z,mt,It=null){It===null&&(It=Z),S=Vt.get(It),S.init(),R.push(S),It.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),Z!==It&&Z.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),S.setupLights(T._useLegacyLights);let St=new Set;return Z.traverse(function(vt){let he=vt.material;if(he)if(Array.isArray(he))for(let ue=0;ue<he.length;ue++){let we=he[ue];Kt(we,It,vt),St.add(we)}else Kt(he,It,vt),St.add(he)}),R.pop(),S=null,St},this.compileAsync=function(Z,mt,It=null){let St=this.compile(Z,mt,It);return new Promise(vt=>{function he(){if(St.forEach(function(ue){be.get(ue).currentProgram.isReady()&&St.delete(ue)}),St.size===0){vt(Z);return}setTimeout(he,10)}ee.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let me=null;function ve(Z){me&&me(Z)}function qe(){Xe.stop()}function Ue(){Xe.start()}let Xe=new WT;Xe.setAnimationLoop(ve),typeof self!="undefined"&&Xe.setContext(self),this.setAnimationLoop=function(Z){me=Z,wt.setAnimationLoop(Z),Z===null?Xe.stop():Xe.start()},wt.addEventListener("sessionstart",qe),wt.addEventListener("sessionend",Ue),this.render=function(Z,mt){if(mt!==void 0&&mt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),mt.parent===null&&mt.matrixWorldAutoUpdate===!0&&mt.updateMatrixWorld(),wt.enabled===!0&&wt.isPresenting===!0&&(wt.cameraAutoUpdate===!0&&wt.updateCamera(mt),mt=wt.getCamera()),Z.isScene===!0&&Z.onBeforeRender(T,Z,mt,q),S=Vt.get(Z,R.length),S.init(),R.push(S),ce.multiplyMatrices(mt.projectionMatrix,mt.matrixWorldInverse),ae.setFromProjectionMatrix(ce),Ut=this.localClippingEnabled,at=Zt.init(this.clippingPlanes,Ut),I=Ce.get(Z,w.length),I.init(),w.push(I),Ze(Z,mt,0,T.sortObjects),I.finish(),T.sortObjects===!0&&I.sort(pt,yt),this.info.render.frame++,at===!0&&Zt.beginShadows();let It=S.state.shadowsArray;if(ne.render(It,Z,mt),at===!0&&Zt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(wt.enabled===!1||wt.isPresenting===!1||wt.hasDepthSensing()===!1)&&rt.render(I,Z),S.setupLights(T._useLegacyLights),mt.isArrayCamera){let St=mt.cameras;for(let vt=0,he=St.length;vt<he;vt++){let ue=St[vt];Er(I,Z,ue,ue.viewport)}}else Er(I,Z,mt);q!==null&&(Wt.updateMultisampleRenderTarget(q),Wt.updateRenderTargetMipmap(q)),Z.isScene===!0&&Z.onAfterRender(T,Z,mt),V.resetDefaultState(),D=-1,xt=null,R.pop(),R.length>0?S=R[R.length-1]:S=null,w.pop(),w.length>0?I=w[w.length-1]:I=null};function Ze(Z,mt,It,St){if(Z.visible===!1)return;if(Z.layers.test(mt.layers)){if(Z.isGroup)It=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(mt);else if(Z.isLight)S.pushLight(Z),Z.castShadow&&S.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||ae.intersectsSprite(Z)){St&&$t.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(ce);let ue=Ot.update(Z),we=Z.material;we.visible&&I.push(Z,ue,we,It,$t.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||ae.intersectsObject(Z))){let ue=Ot.update(Z),we=Z.material;if(St&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),$t.copy(Z.boundingSphere.center)):(ue.boundingSphere===null&&ue.computeBoundingSphere(),$t.copy(ue.boundingSphere.center)),$t.applyMatrix4(Z.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){let de=ue.groups;for(let Be=0,Ae=de.length;Be<Ae;Be++){let Pe=de[Be],tn=we[Pe.materialIndex];tn&&tn.visible&&I.push(Z,ue,tn,It,$t.z,Pe)}}else we.visible&&I.push(Z,ue,we,It,$t.z,null)}}let he=Z.children;for(let ue=0,we=he.length;ue<we;ue++)Ze(he[ue],mt,It,St)}function Er(Z,mt,It,St){let vt=Z.opaque,he=Z.transmissive,ue=Z.transparent;S.setupLightsView(It),at===!0&&Zt.setGlobalState(T.clippingPlanes,It),he.length>0&&Zr(vt,he,mt,It),St&&fe.viewport(B.copy(St)),vt.length>0&&nr(vt,mt,It),he.length>0&&nr(he,mt,It),ue.length>0&&nr(ue,mt,It),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1)}function Zr(Z,mt,It,St){if((It.isScene===!0?It.overrideMaterial:null)!==null)return;let he=ge.isWebGL2;jt===null&&(jt=new hu(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")?Kf:Wu,minFilter:Tl,samples:he?4:0})),T.getDrawingBufferSize(te),he?jt.setSize(te.x,te.y):jt.setSize(Dy(te.x),Dy(te.y));let ue=T.getRenderTarget();T.setRenderTarget(jt),T.getClearColor(Dt),Q=T.getClearAlpha(),Q<1&&T.setClearColor(16777215,.5),T.clear();let we=T.toneMapping;T.toneMapping=Vu,nr(Z,It,St),Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt);let de=!1;for(let Be=0,Ae=mt.length;Be<Ae;Be++){let Pe=mt[Be],tn=Pe.object,oi=Pe.geometry,Mr=Pe.material,Hi=Pe.group;if(Mr.side===uu&&tn.layers.test(St.layers)){let sr=Mr.side;Mr.side=Yo,Mr.needsUpdate=!0,Ie(tn,It,St,oi,Mr,Hi),Mr.side=sr,Mr.needsUpdate=!0,de=!0}}de===!0&&(Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt)),T.setRenderTarget(ue),T.setClearColor(Dt,Q),T.toneMapping=we}function nr(Z,mt,It){let St=mt.isScene===!0?mt.overrideMaterial:null;for(let vt=0,he=Z.length;vt<he;vt++){let ue=Z[vt],we=ue.object,de=ue.geometry,Be=St===null?ue.material:St,Ae=ue.group;we.layers.test(It.layers)&&Ie(we,mt,It,de,Be,Ae)}}function Ie(Z,mt,It,St,vt,he){Z.onBeforeRender(T,mt,It,St,vt,he),Z.modelViewMatrix.multiplyMatrices(It.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),vt.onBeforeRender(T,mt,It,St,Z,he),vt.transparent===!0&&vt.side===uu&&vt.forceSinglePass===!1?(vt.side=Yo,vt.needsUpdate=!0,T.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=Xu,vt.needsUpdate=!0,T.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=uu):T.renderBufferDirect(It,mt,St,vt,Z,he),Z.onAfterRender(T,mt,It,St,vt,he)}function rr(Z,mt,It){mt.isScene!==!0&&(mt=qt);let St=be.get(Z),vt=S.state.lights,he=S.state.shadowsArray,ue=vt.state.version,we=dt.getParameters(Z,vt.state,he,mt,It),de=dt.getProgramCacheKey(we),Be=St.programs;St.environment=Z.isMeshStandardMaterial?mt.environment:null,St.fog=mt.fog,St.envMap=(Z.isMeshStandardMaterial?tt:Me).get(Z.envMap||St.environment),St.envMapRotation=St.environment!==null&&Z.envMap===null?mt.environmentRotation:Z.envMapRotation,Be===void 0&&(Z.addEventListener("dispose",et),Be=new Map,St.programs=Be);let Ae=Be.get(de);if(Ae!==void 0){if(St.currentProgram===Ae&&St.lightsStateVersion===ue)return ar(Z,we),Ae}else we.uniforms=dt.getUniforms(Z),Z.onBuild(It,we,T),Z.onBeforeCompile(we,T),Ae=dt.acquireProgram(we,de),Be.set(de,Ae),St.uniforms=we.uniforms;let Pe=St.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(Pe.clippingPlanes=Zt.uniform),ar(Z,we),St.needsLights=ii(Z),St.lightsStateVersion=ue,St.needsLights&&(Pe.ambientLightColor.value=vt.state.ambient,Pe.lightProbe.value=vt.state.probe,Pe.directionalLights.value=vt.state.directional,Pe.directionalLightShadows.value=vt.state.directionalShadow,Pe.spotLights.value=vt.state.spot,Pe.spotLightShadows.value=vt.state.spotShadow,Pe.rectAreaLights.value=vt.state.rectArea,Pe.ltc_1.value=vt.state.rectAreaLTC1,Pe.ltc_2.value=vt.state.rectAreaLTC2,Pe.pointLights.value=vt.state.point,Pe.pointLightShadows.value=vt.state.pointShadow,Pe.hemisphereLights.value=vt.state.hemi,Pe.directionalShadowMap.value=vt.state.directionalShadowMap,Pe.directionalShadowMatrix.value=vt.state.directionalShadowMatrix,Pe.spotShadowMap.value=vt.state.spotShadowMap,Pe.spotLightMatrix.value=vt.state.spotLightMatrix,Pe.spotLightMap.value=vt.state.spotLightMap,Pe.pointShadowMap.value=vt.state.pointShadowMap,Pe.pointShadowMatrix.value=vt.state.pointShadowMatrix),St.currentProgram=Ae,St.uniformsList=null,Ae}function pr(Z){if(Z.uniformsList===null){let mt=Z.currentProgram.getUniforms();Z.uniformsList=Oc.seqWithValue(mt.seq,Z.uniforms)}return Z.uniformsList}function ar(Z,mt){let It=be.get(Z);It.outputColorSpace=mt.outputColorSpace,It.batching=mt.batching,It.instancing=mt.instancing,It.instancingColor=mt.instancingColor,It.instancingMorph=mt.instancingMorph,It.skinning=mt.skinning,It.morphTargets=mt.morphTargets,It.morphNormals=mt.morphNormals,It.morphColors=mt.morphColors,It.morphTargetsCount=mt.morphTargetsCount,It.numClippingPlanes=mt.numClippingPlanes,It.numIntersection=mt.numClipIntersection,It.vertexAlphas=mt.vertexAlphas,It.vertexTangents=mt.vertexTangents,It.toneMapping=mt.toneMapping}function Qn(Z,mt,It,St,vt){mt.isScene!==!0&&(mt=qt),Wt.resetTextureUnits();let he=mt.fog,ue=St.isMeshStandardMaterial?mt.environment:null,we=q===null?T.outputColorSpace:q.isXRRenderTarget===!0?q.texture.colorSpace:Zu,de=(St.isMeshStandardMaterial?tt:Me).get(St.envMap||ue),Be=St.vertexColors===!0&&!!It.attributes.color&&It.attributes.color.itemSize===4,Ae=!!It.attributes.tangent&&(!!St.normalMap||St.anisotropy>0),Pe=!!It.morphAttributes.position,tn=!!It.morphAttributes.normal,oi=!!It.morphAttributes.color,Mr=Vu;St.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(Mr=T.toneMapping);let Hi=It.morphAttributes.position||It.morphAttributes.normal||It.morphAttributes.color,sr=Hi!==void 0?Hi.length:0,ye=be.get(St),Da=S.state.lights;if(at===!0&&(Ut===!0||Z!==xt)){let Mi=Z===xt&&St.id===D;Zt.setState(St,Z,Mi)}let en=!1;St.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==Da.state.version||ye.outputColorSpace!==we||vt.isBatchedMesh&&ye.batching===!1||!vt.isBatchedMesh&&ye.batching===!0||vt.isInstancedMesh&&ye.instancing===!1||!vt.isInstancedMesh&&ye.instancing===!0||vt.isSkinnedMesh&&ye.skinning===!1||!vt.isSkinnedMesh&&ye.skinning===!0||vt.isInstancedMesh&&ye.instancingColor===!0&&vt.instanceColor===null||vt.isInstancedMesh&&ye.instancingColor===!1&&vt.instanceColor!==null||vt.isInstancedMesh&&ye.instancingMorph===!0&&vt.morphTexture===null||vt.isInstancedMesh&&ye.instancingMorph===!1&&vt.morphTexture!==null||ye.envMap!==de||St.fog===!0&&ye.fog!==he||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==Zt.numPlanes||ye.numIntersection!==Zt.numIntersection)||ye.vertexAlphas!==Be||ye.vertexTangents!==Ae||ye.morphTargets!==Pe||ye.morphNormals!==tn||ye.morphColors!==oi||ye.toneMapping!==Mr||ge.isWebGL2===!0&&ye.morphTargetsCount!==sr)&&(en=!0):(en=!0,ye.__version=St.version);let co=ye.currentProgram;en===!0&&(co=rr(St,mt,vt));let rl=!1,ze=!1,gs=!1,ir=co.getUniforms(),Ko=ye.uniforms;if(fe.useProgram(co.program)&&(rl=!0,ze=!0,gs=!0),St.id!==D&&(D=St.id,ze=!0),rl||xt!==Z){ir.setValue(ft,"projectionMatrix",Z.projectionMatrix),ir.setValue(ft,"viewMatrix",Z.matrixWorldInverse);let Mi=ir.map.cameraPosition;Mi!==void 0&&Mi.setValue(ft,$t.setFromMatrixPosition(Z.matrixWorld)),ge.logarithmicDepthBuffer&&ir.setValue(ft,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(St.isMeshPhongMaterial||St.isMeshToonMaterial||St.isMeshLambertMaterial||St.isMeshBasicMaterial||St.isMeshStandardMaterial||St.isShaderMaterial)&&ir.setValue(ft,"isOrthographic",Z.isOrthographicCamera===!0),xt!==Z&&(xt=Z,ze=!0,gs=!0)}if(vt.isSkinnedMesh){ir.setOptional(ft,vt,"bindMatrix"),ir.setOptional(ft,vt,"bindMatrixInverse");let Mi=vt.skeleton;Mi&&(ge.floatVertexTextures?(Mi.boneTexture===null&&Mi.computeBoneTexture(),ir.setValue(ft,"boneTexture",Mi.boneTexture,Wt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}vt.isBatchedMesh&&(ir.setOptional(ft,vt,"batchingTexture"),ir.setValue(ft,"batchingTexture",vt._matricesTexture,Wt));let Le=It.morphAttributes;if((Le.position!==void 0||Le.normal!==void 0||Le.color!==void 0&&ge.isWebGL2===!0)&&C.update(vt,It,co),(ze||ye.receiveShadow!==vt.receiveShadow)&&(ye.receiveShadow=vt.receiveShadow,ir.setValue(ft,"receiveShadow",vt.receiveShadow)),St.isMeshGouraudMaterial&&St.envMap!==null&&(Ko.envMap.value=de,Ko.flipEnvMap.value=de.isCubeTexture&&de.isRenderTargetTexture===!1?-1:1),ze&&(ir.setValue(ft,"toneMappingExposure",T.toneMappingExposure),ye.needsLights&&Si(Ko,gs),he&&St.fog===!0&&Ht.refreshFogUniforms(Ko,he),Ht.refreshMaterialUniforms(Ko,St,Rt,Mt,jt),Oc.upload(ft,pr(ye),Ko,Wt)),St.isShaderMaterial&&St.uniformsNeedUpdate===!0&&(Oc.upload(ft,pr(ye),Ko,Wt),St.uniformsNeedUpdate=!1),St.isSpriteMaterial&&ir.setValue(ft,"center",vt.center),ir.setValue(ft,"modelViewMatrix",vt.modelViewMatrix),ir.setValue(ft,"normalMatrix",vt.normalMatrix),ir.setValue(ft,"modelMatrix",vt.matrixWorld),St.isShaderMaterial||St.isRawShaderMaterial){let Mi=St.uniformsGroups;for(let Fa=0,du=Mi.length;Fa<du;Fa++)if(ge.isWebGL2){let bi=Mi[Fa];ht.update(bi,co),ht.bind(bi,co)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return co}function Si(Z,mt){Z.ambientLightColor.needsUpdate=mt,Z.lightProbe.needsUpdate=mt,Z.directionalLights.needsUpdate=mt,Z.directionalLightShadows.needsUpdate=mt,Z.pointLights.needsUpdate=mt,Z.pointLightShadows.needsUpdate=mt,Z.spotLights.needsUpdate=mt,Z.spotLightShadows.needsUpdate=mt,Z.rectAreaLights.needsUpdate=mt,Z.hemisphereLights.needsUpdate=mt}function ii(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(Z,mt,It){be.get(Z.texture).__webglTexture=mt,be.get(Z.depthTexture).__webglTexture=It;let St=be.get(Z);St.__hasExternalTextures=!0,St.__autoAllocateDepthBuffer=It===void 0,St.__autoAllocateDepthBuffer||ee.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),St.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Z,mt){let It=be.get(Z);It.__webglFramebuffer=mt,It.__useDefaultFramebuffer=mt===void 0},this.setRenderTarget=function(Z,mt=0,It=0){q=Z,W=mt,X=It;let St=!0,vt=null,he=!1,ue=!1;if(Z){let de=be.get(Z);de.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(ft.FRAMEBUFFER,null),St=!1):de.__webglFramebuffer===void 0?Wt.setupRenderTarget(Z):de.__hasExternalTextures&&Wt.rebindTextures(Z,be.get(Z.texture).__webglTexture,be.get(Z.depthTexture).__webglTexture);let Be=Z.texture;(Be.isData3DTexture||Be.isDataArrayTexture||Be.isCompressedArrayTexture)&&(ue=!0);let Ae=be.get(Z).__webglFramebuffer;Z.isWebGLCubeRenderTarget?(Array.isArray(Ae[mt])?vt=Ae[mt][It]:vt=Ae[mt],he=!0):ge.isWebGL2&&Z.samples>0&&Wt.useMultisampledRTT(Z)===!1?vt=be.get(Z).__webglMultisampledFramebuffer:Array.isArray(Ae)?vt=Ae[It]:vt=Ae,B.copy(Z.viewport),j.copy(Z.scissor),J=Z.scissorTest}else B.copy(K).multiplyScalar(Rt).floor(),j.copy(Bt).multiplyScalar(Rt).floor(),J=Gt;if(fe.bindFramebuffer(ft.FRAMEBUFFER,vt)&&ge.drawBuffers&&St&&fe.drawBuffers(Z,vt),fe.viewport(B),fe.scissor(j),fe.setScissorTest(J),he){let de=be.get(Z.texture);ft.framebufferTexture2D(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,ft.TEXTURE_CUBE_MAP_POSITIVE_X+mt,de.__webglTexture,It)}else if(ue){let de=be.get(Z.texture),Be=mt||0;ft.framebufferTextureLayer(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,de.__webglTexture,It||0,Be)}D=-1},this.readRenderTargetPixels=function(Z,mt,It,St,vt,he,ue){if(!(Z&&Z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=be.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ue!==void 0&&(we=we[ue]),we){fe.bindFramebuffer(ft.FRAMEBUFFER,we);try{let de=Z.texture,Be=de.format,Ae=de.type;if(Be!==ta&&$.convert(Be)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Pe=Ae===Kf&&(ee.has("EXT_color_buffer_half_float")||ge.isWebGL2&&ee.has("EXT_color_buffer_float"));if(Ae!==Wu&&$.convert(Ae)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ae===lu&&(ge.isWebGL2||ee.has("OES_texture_float")||ee.has("WEBGL_color_buffer_float")))&&!Pe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}mt>=0&&mt<=Z.width-St&&It>=0&&It<=Z.height-vt&&ft.readPixels(mt,It,St,vt,$.convert(Be),$.convert(Ae),he)}finally{let de=q!==null?be.get(q).__webglFramebuffer:null;fe.bindFramebuffer(ft.FRAMEBUFFER,de)}}},this.copyFramebufferToTexture=function(Z,mt,It=0){let St=Math.pow(2,-It),vt=Math.floor(mt.image.width*St),he=Math.floor(mt.image.height*St);Wt.setTexture2D(mt,0),ft.copyTexSubImage2D(ft.TEXTURE_2D,It,0,0,Z.x,Z.y,vt,he),fe.unbindTexture()},this.copyTextureToTexture=function(Z,mt,It,St=0){let vt=mt.image.width,he=mt.image.height,ue=$.convert(It.format),we=$.convert(It.type);Wt.setTexture2D(It,0),ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,It.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,It.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,It.unpackAlignment),mt.isDataTexture?ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,vt,he,ue,we,mt.image.data):mt.isCompressedTexture?ft.compressedTexSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,mt.mipmaps[0].width,mt.mipmaps[0].height,ue,mt.mipmaps[0].data):ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,ue,we,mt.image),St===0&&It.generateMipmaps&&ft.generateMipmap(ft.TEXTURE_2D),fe.unbindTexture()},this.copyTextureToTexture3D=function(Z,mt,It,St,vt=0){if(T.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let he=Math.round(Z.max.x-Z.min.x),ue=Math.round(Z.max.y-Z.min.y),we=Z.max.z-Z.min.z+1,de=$.convert(St.format),Be=$.convert(St.type),Ae;if(St.isData3DTexture)Wt.setTexture3D(St,0),Ae=ft.TEXTURE_3D;else if(St.isDataArrayTexture||St.isCompressedArrayTexture)Wt.setTexture2DArray(St,0),Ae=ft.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,St.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,St.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,St.unpackAlignment);let Pe=ft.getParameter(ft.UNPACK_ROW_LENGTH),tn=ft.getParameter(ft.UNPACK_IMAGE_HEIGHT),oi=ft.getParameter(ft.UNPACK_SKIP_PIXELS),Mr=ft.getParameter(ft.UNPACK_SKIP_ROWS),Hi=ft.getParameter(ft.UNPACK_SKIP_IMAGES),sr=It.isCompressedTexture?It.mipmaps[vt]:It.image;ft.pixelStorei(ft.UNPACK_ROW_LENGTH,sr.width),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,sr.height),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,Z.min.x),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Z.min.y),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Z.min.z),It.isDataTexture||It.isData3DTexture?ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr.data):St.isCompressedArrayTexture?ft.compressedTexSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,sr.data):ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr),ft.pixelStorei(ft.UNPACK_ROW_LENGTH,Pe),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,tn),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,oi),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Mr),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Hi),vt===0&&St.generateMipmaps&&ft.generateMipmap(Ae),fe.unbindTexture()},this.initTexture=function(Z){Z.isCubeTexture?Wt.setTextureCube(Z,0):Z.isData3DTexture?Wt.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?Wt.setTexture2DArray(Z,0):Wt.setTexture2D(Z,0),fe.unbindTexture()},this.resetState=function(){W=0,X=0,q=null,fe.reset(),V.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return cu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===pv?"display-p3":"srgb",e.unpackColorSpace=_r.workingColorSpace===Pd?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},tv=class extends Qy{};tv.prototype.isWebGL1Renderer=!0;function sd(n,t,e){return!n||!e&&n.constructor===t?n:typeof t.BYTES_PER_ELEMENT=="number"?new t(n):Array.prototype.slice.call(n)}function ZW(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Gc=class{constructor(t,e,o,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,s=e[o],c=e[o-1];t:{e:{let h;n:{r:if(!(t<s)){for(let p=o+2;;){if(s===void 0){if(t<c)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===p)break;if(c=s,s=e[++o],t<s)break e}h=e.length;break n}if(!(t>=c)){let p=e[1];t<p&&(o=2,c=p);for(let g=o-2;;){if(c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===g)break;if(s=c,c=e[--o-1],t>=c)break e}h=o,o=0;break n}break t}for(;o<h;){let p=o+h>>>1;t<e[p]?h=p:o=p+1}if(s=e[o],c=e[o-1],c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,c,s)}return this.interpolate_(o,c,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,s=this.valueSize,c=t*s;for(let h=0;h!==s;++h)e[h]=o[c+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},ev=class extends Gc{constructor(t,e,o,s){super(t,e,o,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:zA,endingEnd:zA}}intervalChanged_(t,e,o){let s=this.parameterPositions,c=t-2,h=t+1,p=s[c],g=s[h];if(p===void 0)switch(this.getSettings_().endingStart){case GA:c=t,p=2*e-o;break;case kA:c=s.length-2,p=e+s[c]-s[c+1];break;default:c=t,p=o}if(g===void 0)switch(this.getSettings_().endingEnd){case GA:h=t,g=2*o-e;break;case kA:h=1,g=o+s[1]-s[0];break;default:h=t-1,g=e}let m=(o-e)*.5,_=this.valueSize;this._weightPrev=m/(e-p),this._weightNext=m/(g-o),this._offsetPrev=c*_,this._offsetNext=h*_}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=t*p,m=g-p,_=this._offsetPrev,E=this._offsetNext,x=this._weightPrev,b=this._weightNext,P=(o-e)/(s-e),I=P*P,S=I*P,w=-x*S+2*x*I-x*P,R=(1+x)*S+(-1.5-2*x)*I+(-.5+x)*P+1,T=(-1-b)*S+(1.5+b)*I+.5*P,F=b*S-b*I;for(let W=0;W!==p;++W)c[W]=w*h[_+W]+R*h[m+W]+T*h[g+W]+F*h[E+W];return c}},nv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=t*p,m=g-p,_=(o-e)/(s-e),E=1-_;for(let x=0;x!==p;++x)c[x]=h[m+x]*E+h[g+x]*_;return c}},rv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t){return this.copySampleValue_(t-1)}},na=class{constructor(t,e,o,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=sd(e,this.TimeBufferType),this.values=sd(o,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:sd(t.times,Array),values:sd(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(o.interpolation=s)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new rv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new nv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new ev(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ud:e=this.InterpolantFactoryMethodDiscrete;break;case ld:e=this.InterpolantFactoryMethodLinear;break;case ty:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ud;case this.InterpolantFactoryMethodLinear:return ld;case this.InterpolantFactoryMethodSmooth:return ty}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]*=t}return this}trim(t,e){let o=this.times,s=o.length,c=0,h=s-1;for(;c!==s&&o[c]<t;)++c;for(;h!==-1&&o[h]>e;)--h;if(++h,c!==0||h!==s){c>=h&&(h=Math.max(h,1),c=h-1);let p=this.getValueSize();this.times=o.slice(c,h),this.values=this.values.slice(c*p,h*p)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,s=this.values,c=o.length;c===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let h=null;for(let p=0;p!==c;p++){let g=o[p];if(typeof g=="number"&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,p,g),t=!1;break}if(h!==null&&h>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,p,g,h),t=!1;break}h=g}if(s!==void 0&&ZW(s))for(let p=0,g=s.length;p!==g;++p){let m=s[p];if(isNaN(m)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,p,m),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),s=this.getInterpolation()===ty,c=t.length-1,h=1;for(let p=1;p<c;++p){let g=!1,m=t[p],_=t[p+1];if(m!==_&&(p!==1||m!==t[0]))if(s)g=!0;else{let E=p*o,x=E-o,b=E+o;for(let P=0;P!==o;++P){let I=e[E+P];if(I!==e[x+P]||I!==e[b+P]){g=!0;break}}}if(g){if(p!==h){t[h]=t[p];let E=p*o,x=h*o;for(let b=0;b!==o;++b)e[x+b]=e[E+b]}++h}}if(c>0){t[h]=t[c];for(let p=c*o,g=h*o,m=0;m!==o;++m)e[g+m]=e[p+m];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,s=new o(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};na.prototype.TimeBufferType=Float32Array;na.prototype.ValueBufferType=Float32Array;na.prototype.DefaultInterpolation=ld;var Nl=class extends na{};Nl.prototype.ValueTypeName="bool";Nl.prototype.ValueBufferType=Array;Nl.prototype.DefaultInterpolation=ud;Nl.prototype.InterpolantFactoryMethodLinear=void 0;Nl.prototype.InterpolantFactoryMethodSmooth=void 0;var iv=class extends na{};iv.prototype.ValueTypeName="color";var ov=class extends na{};ov.prototype.ValueTypeName="number";var sv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=(o-e)/(s-e),m=t*p;for(let _=m+p;m!==_;m+=4)$u.slerpFlat(c,0,h,m-p,h,m,g);return c}},th=class extends na{InterpolantFactoryMethodLinear(t){return new sv(this.times,this.values,this.getValueSize(),t)}};th.prototype.ValueTypeName="quaternion";th.prototype.DefaultInterpolation=ld;th.prototype.InterpolantFactoryMethodSmooth=void 0;var Ol=class extends na{};Ol.prototype.ValueTypeName="string";Ol.prototype.ValueBufferType=Array;Ol.prototype.DefaultInterpolation=ud;Ol.prototype.InterpolantFactoryMethodLinear=void 0;Ol.prototype.InterpolantFactoryMethodSmooth=void 0;var av=class extends na{};av.prototype.ValueTypeName="vector";var uv=class{constructor(t,e,o){let s=this,c=!1,h=0,p=0,g,m=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(_){p++,c===!1&&s.onStart!==void 0&&s.onStart(_,h,p),c=!0},this.itemEnd=function(_){h++,s.onProgress!==void 0&&s.onProgress(_,h,p),h===p&&(c=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(_){s.onError!==void 0&&s.onError(_)},this.resolveURL=function(_){return g?g(_):_},this.setURLModifier=function(_){return g=_,this},this.addHandler=function(_,E){return m.push(_,E),this},this.removeHandler=function(_){let E=m.indexOf(_);return E!==-1&&m.splice(E,2),this},this.getHandler=function(_){for(let E=0,x=m.length;E<x;E+=2){let b=m[E],P=m[E+1];if(b.global&&(b.lastIndex=0),b.test(_))return P}return null}}},JW=new uv,lv=class{constructor(t){this.manager=t!==void 0?t:JW,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(s,c){o.load(t,s,e,c)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};lv.DEFAULT_MATERIAL_NAME="__DEFAULT";var gv="\\\\[\\\\]\\\\.:\\\\/",KW=new RegExp("["+gv+"]","g"),mv="[^"+gv+"]",jW="[^"+gv.replace("\\\\.","")+"]",QW=/((?:WC+[\\/:])*)/.source.replace("WC",mv),t9=/(WCOD+)?/.source.replace("WCOD",jW),e9=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",mv),n9=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",mv),r9=new RegExp("^"+QW+t9+e9+n9+"$"),i9=["material","materials","bones","map"],cv=class{constructor(t,e,o){let s=o||Nr.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,s=this._bindings[o];s!==void 0&&s.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let s=this._targetGroup.nCachedObjects_,c=o.length;s!==c;++s)o[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Nr=class n{constructor(t,e,o){this.path=e,this.parsedPath=o||n.parseTrackName(e),this.node=n.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,o):new n(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(KW,"")}static parseTrackName(t){let e=r9.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=o.nodeName&&o.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let c=o.nodeName.substring(s+1);i9.indexOf(c)!==-1&&(o.nodeName=o.nodeName.substring(0,s),o.objectName=c)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(c){for(let h=0;h<c.length;h++){let p=c[h];if(p.name===e||p.uuid===e)return p;let g=o(p.children);if(g)return g}return null},s=o(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)t[e++]=o[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,s=e.propertyName,c=e.propertyIndex;if(t||(t=n.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let m=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let _=0;_<t.length;_++)if(t[_].name===m){m=_;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(m!==void 0){if(t[m]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[m]}}let h=t[s];if(h===void 0){let m=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+m+"."+s+" but it wasn't found.",t);return}let p=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?p=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(p=this.Versioning.MatrixWorldNeedsUpdate);let g=this.BindingType.Direct;if(c!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[c]!==void 0&&(c=t.morphTargetDictionary[c])}g=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=c}else h.fromArray!==void 0&&h.toArray!==void 0?(g=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(g=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=s;this.getValue=this.GetterByBindingType[g],this.setValue=this.SetterByBindingTypeAndVersioning[g][p]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Nr.Composite=cv;Nr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Nr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Nr.prototype.GetterByBindingType=[Nr.prototype._getValue_direct,Nr.prototype._getValue_array,Nr.prototype._getValue_arrayElement,Nr.prototype._getValue_toArray];Nr.prototype.SetterByBindingTypeAndVersioning=[[Nr.prototype._setValue_direct,Nr.prototype._setValue_direct_setNeedsUpdate,Nr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_array,Nr.prototype._setValue_array_setNeedsUpdate,Nr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_arrayElement,Nr.prototype._setValue_arrayElement_setNeedsUpdate,Nr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_fromArray,Nr.prototype._setValue_fromArray_setNeedsUpdate,Nr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var pQ=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:fv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=fv);var Bi=63710088e-1,mQ={centimeters:Bi*100,centimetres:Bi*100,degrees:Bi/111325,feet:Bi*3.28084,inches:Bi*39.37,kilometers:Bi/1e3,kilometres:Bi/1e3,meters:Bi,metres:Bi,miles:Bi/1609.344,millimeters:Bi*1e3,millimetres:Bi*1e3,nauticalmiles:Bi/1852,radians:1,yards:Bi*1.0936},yQ={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Bi,yards:1.0936133};function So(n,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=n,o}function Cr(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pa(n[0])||!Pa(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return So(o,t,e)}function Or(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var c=s[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:n};return So(p,t,e)}function zi(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return So(o,t,e)}function yv(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return So(o,t,e)}function Pa(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function _i(n,t,e){if(n!==null)for(var o,s,c,h,p,g,m,_=0,E=0,x,b=n.type,P=b==="FeatureCollection",I=b==="Feature",S=P?n.features.length:1,w=0;w<S;w++){m=P?n.features[w].geometry:I?n.geometry:n,x=m?m.type==="GeometryCollection":!1,p=x?m.geometries.length:1;for(var R=0;R<p;R++){var T=0,F=0;if(h=x?m.geometries[R]:m,h!==null){g=h.coordinates;var W=h.type;switch(_=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,E,w,T,F)===!1)return!1;E++,T++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],E,w,T,F)===!1)return!1;E++,W==="MultiPoint"&&T++}W==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-_;s++){if(t(g[o][s],E,w,T,F)===!1)return!1;E++}W==="MultiLineString"&&T++,W==="Polygon"&&F++}W==="Polygon"&&T++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(c=0;c<g[o][s].length-_;c++){if(t(g[o][s][c],E,w,T,F)===!1)return!1;E++}F++}T++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(_i(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function KT(n,t,e,o){var s=e;return _i(n,function(c,h,p,g,m){h===0&&e===void 0?s=c:s=t(s,c,h,p,g,m)},o),s}function Ju(n,t){var e,o,s,c,h,p,g,m,_,E,x=0,b=n.type==="FeatureCollection",P=n.type==="Feature",I=b?n.features.length:1;for(e=0;e<I;e++){for(p=b?n.features[e].geometry:P?n.geometry:n,m=b?n.features[e].properties:P?n.properties:{},_=b?n.features[e].bbox:P?n.bbox:void 0,E=b?n.features[e].id:P?n.id:void 0,g=p?p.type==="GeometryCollection":!1,h=g?p.geometries.length:1,s=0;s<h;s++){if(c=g?p.geometries[s]:p,c===null){if(t(null,x,m,_,E)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,m,_,E)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,m,_,E)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function ds(n,t){Ju(n,function(e,o,s,c,h){var p=e===null?null:e.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return t(So(e,s,{bbox:c,id:h}),o,0)===!1?!1:void 0}var g;switch(p){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var _=e.coordinates[m],E={type:g,coordinates:_};if(t(So(E,s),o,m)===!1)return!1}})}function vv(n){var t=[1/0,1/0,-1/0,-1/0];return _i(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}vv.default=vv;var Mo=vv;function ji(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function _v(n,t,e){if(!n)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!n.geometry||n.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+n.geometry.type)}function Qi(n){return n.type==="Feature"?n.geometry:n}var h9=on(Rd(),1);var w9=on(gC(),1);function Gi(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=ji(n),s=Qi(t),c=s.type,h=t.bbox,p=s.coordinates;if(h&&S9(o,h)===!1)return!1;c==="Polygon"&&(p=[p]);for(var g=!1,m=0;m<p.length&&!g;m++)if(mC(o,p[m][0],e.ignoreBoundary)){for(var _=!1,E=1;E<p[m].length&&!_;)mC(o,p[m][E],!e.ignoreBoundary)&&(_=!0),E++;_||(g=!0)}return g}function mC(n,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var s=0,c=t.length-1;s<t.length;c=s++){var h=t[s][0],p=t[s][1],g=t[c][0],m=t[c][1],_=n[1]*(h-g)+p*(g-n[0])+m*(n[0]-h)===0&&(h-n[0])*(g-n[0])<=0&&(p-n[1])*(m-n[1])<=0;if(_)return!e;var E=p>n[1]!=m>n[1]&&n[0]<(g-h)*(n[1]-p)/(m-p)+h;E&&(o=!o)}return o}function S9(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var _C=new ArrayBuffer(16),Xtt=new Float64Array(_C),Ytt=new Uint32Array(_C);var B9=on(Dv(),1);var Ent=function(){function n(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],s=this.points[e+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var c=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,h=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,p=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+p)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+p)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return n.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var c=this.pos(s),h=Math.sqrt((c.x-o.x)*(c.x-o.x)+(c.y-o.y)*(c.y-o.y)+(c.z-o.z)*(c.z-o.z));h>t&&(e.push(s),o=c)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},n.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*o),c=(this.length-1)*o-s;return z9(c,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function z9(n,t,e,o,s){var c=G9(n),h={x:s.x*c[0]+o.x*c[1]+e.x*c[2]+t.x*c[3],y:s.y*c[0]+o.y*c[1]+e.y*c[2]+t.y*c[3],z:s.z*c[0]+o.z*c[1]+e.z*c[2]+t.z*c[3]};return h}function G9(n){var t=n*n,e=t*n;return[e,3*t*(1-n),3*n*(1-n)*(1-n),(1-n)*(1-n)*(1-n)]}function oh(n,t){t===void 0&&(t={});var e=Number(n[0]),o=Number(n[1]),s=Number(n[2]),c=Number(n[3]);if(n.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[e,o],p=[e,c],g=[s,c],m=[s,o];return Or([[h,m,g,p,h]],t.properties,{bbox:n,id:t.id})}function k9(n){return oh(Mo(n))}var Fv=k9;var iX=on(IC(),1);var RX=on($d(),1);var NX=on(Rd(),1);var FX=on(Dv(),1);var $C=Math.PI/180,ZC=180/Math.PI,hh=function(n,t){this.lon=n,this.lat=t,this.x=$C*n,this.y=$C*t};hh.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};hh.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new hh(t,n)};var JC=function(){this.coords=[],this.length=0};JC.prototype.move_to=function(n){this.length++,this.coords.push(n)};var n_=function(n){this.properties=n||{},this.geometries=[]};n_.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var n=[],t=0;t<this.geometries.length;t++)n.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:n},type:"Feature",properties:this.properties}};n_.prototype.wkt=function(){for(var n="",t="LINESTRING(",e=function(c){t+=c[0]+" "+c[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[o].coords;s.forEach(e),n+=t.substring(0,t.length-1)+")"}return n};var KC=function(n,t,e){if(!n||n.x===void 0||n.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new hh(n.x,n.y),this.end=new hh(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,s=this.start.y-this.end.y,c=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(c)),this.g===Math.PI)throw new Error("it appears "+n.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+n+" and "+t)};KC.prototype.interpolate=function(n){var t=Math.sin((1-n)*this.g)/Math.sin(this.g),e=Math.sin(n*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),s=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),c=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),h=ZC*Math.atan2(c,Math.sqrt(Math.pow(o,2)+Math.pow(s,2))),p=ZC*Math.atan2(s,o);return[p,h]};KC.prototype.Arc=function(n,t){var e=[];if(!n||n<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(n-1),s=0;s<n;++s){var c=o*s,h=this.interpolate(c);e.push(h)}for(var p=!1,g=0,m=t&&t.offset?t.offset:10,_=180-m,E=-180+m,x=360-m,b=1;b<e.length;++b){var P=e[b-1][0],I=e[b][0],S=Math.abs(I-P);S>x&&(I>_&&P<E||P>_&&I<E)?p=!0:S>g&&(g=S)}var w=[];if(p&&g<m){var R=[];w.push(R);for(var T=0;T<e.length;++T){var F=parseFloat(e[T][0]);if(T>0&&Math.abs(F-e[T-1][0])>x){var W=parseFloat(e[T-1][0]),X=parseFloat(e[T-1][1]),q=parseFloat(e[T][0]),D=parseFloat(e[T][1]);if(W>-180&&W<E&&q===180&&T+1<e.length&&e[T-1][0]>-180&&e[T-1][0]<E){R.push([-180,e[T][1]]),T++,R.push([e[T][0],e[T][1]]);continue}else if(W>_&&W<180&&q===-180&&T+1<e.length&&e[T-1][0]>_&&e[T-1][0]<180){R.push([180,e[T][1]]),T++,R.push([e[T][0],e[T][1]]);continue}if(W<E&&q>_){var xt=W;W=q,q=xt;var B=X;X=D,D=B}if(W>_&&q<E&&(q+=360),W<=180&&q>=180&&W<q){var j=(180-W)/(q-W),J=j*D+(1-j)*X;R.push([e[T-1][0]>_?180:-180,J]),R=[],R.push([e[T-1][0]>_?-180:180,J]),w.push(R)}else R=[],w.push(R);R.push([F,e[T][1]])}else R.push([e[T][0],e[T][1]])}}else{var Dt=[];w.push(Dt);for(var Q=0;Q<e.length;++Q)Dt.push([e[Q][0],e[Q][1]])}for(var At=new n_(this.properties),Mt=0;Mt<w.length;++Mt){var Rt=new JC;At.geometries.push(Rt);for(var pt=w[Mt],yt=0;yt<pt.length;++yt)Rt.move_to(pt[yt])}return At};var zX=on($d(),1);var vY=on($d(),1);var _Y=on(M_(),1);var wY=on(Rd(),1);var un=[],ln=[],cn=[],fn=[],hn=[],pn=[],dn=[],gn=[],mn=[],yn=[],vn=[],_n=[],xn=[],En=[],wn=[],Sn=[],Mn=[],bn=[],An=[],Tn=[],Cn=[],Pn=[],In=[],Rn=[];dn[85]=yn[85]=-1;gn[85]=vn[85]=0;mn[85]=_n[85]=1;An[85]=Pn[85]=1;Tn[85]=In[85]=0;Cn[85]=Rn[85]=1;un[85]=fn[85]=0;ln[85]=hn[85]=-1;cn[85]=wn[85]=0;Sn[85]=xn[85]=0;Mn[85]=En[85]=1;pn[85]=bn[85]=1;Pn[1]=Pn[169]=0;In[1]=In[169]=-1;Rn[1]=Rn[169]=0;xn[1]=xn[169]=-1;En[1]=En[169]=0;wn[1]=wn[169]=0;yn[4]=yn[166]=0;vn[4]=vn[166]=-1;_n[4]=_n[166]=1;Sn[4]=Sn[166]=1;Mn[4]=Mn[166]=0;bn[4]=bn[166]=0;dn[16]=dn[154]=0;gn[16]=gn[154]=1;mn[16]=mn[154]=1;fn[16]=fn[154]=1;hn[16]=hn[154]=0;pn[16]=pn[154]=1;An[64]=An[106]=0;Tn[64]=Tn[106]=1;Cn[64]=Cn[106]=0;un[64]=un[106]=-1;ln[64]=ln[106]=0;cn[64]=cn[106]=1;An[2]=An[168]=0;Tn[2]=Tn[168]=-1;Cn[2]=Cn[168]=1;Pn[2]=Pn[168]=0;In[2]=In[168]=-1;Rn[2]=Rn[168]=0;xn[2]=xn[168]=-1;En[2]=En[168]=0;wn[2]=wn[168]=0;Sn[2]=Sn[168]=-1;Mn[2]=Mn[168]=0;bn[2]=bn[168]=1;dn[8]=dn[162]=0;gn[8]=gn[162]=-1;mn[8]=mn[162]=0;yn[8]=yn[162]=0;vn[8]=vn[162]=-1;_n[8]=_n[162]=1;xn[8]=xn[162]=1;En[8]=En[162]=0;wn[8]=wn[162]=1;Sn[8]=Sn[162]=1;Mn[8]=Mn[162]=0;bn[8]=bn[162]=0;dn[32]=dn[138]=0;gn[32]=gn[138]=1;mn[32]=mn[138]=1;yn[32]=yn[138]=0;vn[32]=vn[138]=1;_n[32]=_n[138]=0;un[32]=un[138]=1;ln[32]=ln[138]=0;cn[32]=cn[138]=0;fn[32]=fn[138]=1;hn[32]=hn[138]=0;pn[32]=pn[138]=1;Pn[128]=Pn[42]=0;In[128]=In[42]=1;Rn[128]=Rn[42]=1;An[128]=An[42]=0;Tn[128]=Tn[42]=1;Cn[128]=Cn[42]=0;un[128]=un[42]=-1;ln[128]=ln[42]=0;cn[128]=cn[42]=1;fn[128]=fn[42]=-1;hn[128]=hn[42]=0;pn[128]=pn[42]=0;yn[5]=yn[165]=-1;vn[5]=vn[165]=0;_n[5]=_n[165]=0;Pn[5]=Pn[165]=1;In[5]=In[165]=0;Rn[5]=Rn[165]=0;Sn[20]=Sn[150]=0;Mn[20]=Mn[150]=1;bn[20]=bn[150]=1;fn[20]=fn[150]=0;hn[20]=hn[150]=-1;pn[20]=pn[150]=1;dn[80]=dn[90]=-1;gn[80]=gn[90]=0;mn[80]=mn[90]=1;An[80]=An[90]=1;Tn[80]=Tn[90]=0;Cn[80]=Cn[90]=1;xn[65]=xn[105]=0;En[65]=En[105]=1;wn[65]=wn[105]=0;un[65]=un[105]=0;ln[65]=ln[105]=-1;cn[65]=cn[105]=0;dn[160]=dn[10]=-1;gn[160]=gn[10]=0;mn[160]=mn[10]=1;yn[160]=yn[10]=-1;vn[160]=vn[10]=0;_n[160]=_n[10]=0;Pn[160]=Pn[10]=1;In[160]=In[10]=0;Rn[160]=Rn[10]=0;An[160]=An[10]=1;Tn[160]=Tn[10]=0;Cn[160]=Cn[10]=1;Sn[130]=Sn[40]=0;Mn[130]=Mn[40]=1;bn[130]=bn[40]=1;xn[130]=xn[40]=0;En[130]=En[40]=1;wn[130]=wn[40]=0;un[130]=un[40]=0;ln[130]=ln[40]=-1;cn[130]=cn[40]=0;fn[130]=fn[40]=0;hn[130]=hn[40]=-1;pn[130]=pn[40]=1;yn[37]=yn[133]=0;vn[37]=vn[133]=1;_n[37]=_n[133]=1;Pn[37]=Pn[133]=0;In[37]=In[133]=1;Rn[37]=Rn[133]=0;un[37]=un[133]=-1;ln[37]=ln[133]=0;cn[37]=cn[133]=0;fn[37]=fn[133]=1;hn[37]=hn[133]=0;pn[37]=pn[133]=0;Sn[148]=Sn[22]=-1;Mn[148]=Mn[22]=0;bn[148]=bn[22]=0;Pn[148]=Pn[22]=0;In[148]=In[22]=-1;Rn[148]=Rn[22]=1;An[148]=An[22]=0;Tn[148]=Tn[22]=1;Cn[148]=Cn[22]=1;fn[148]=fn[22]=-1;hn[148]=hn[22]=0;pn[148]=pn[22]=1;dn[82]=dn[88]=0;gn[82]=gn[88]=-1;mn[82]=mn[88]=1;Sn[82]=Sn[88]=1;Mn[82]=Mn[88]=0;bn[82]=bn[88]=1;xn[82]=xn[88]=-1;En[82]=En[88]=0;wn[82]=wn[88]=1;An[82]=An[88]=0;Tn[82]=Tn[88]=-1;Cn[82]=Cn[88]=0;dn[73]=dn[97]=0;gn[73]=gn[97]=1;mn[73]=mn[97]=0;yn[73]=yn[97]=0;vn[73]=vn[97]=-1;_n[73]=_n[97]=0;xn[73]=xn[97]=1;En[73]=En[97]=0;wn[73]=wn[97]=0;un[73]=un[97]=1;ln[73]=ln[97]=0;cn[73]=cn[97]=1;dn[145]=dn[25]=0;gn[145]=gn[25]=-1;mn[145]=mn[25]=0;xn[145]=xn[25]=1;En[145]=En[25]=0;wn[145]=wn[25]=1;Pn[145]=Pn[25]=0;In[145]=In[25]=1;Rn[145]=Rn[25]=1;fn[145]=fn[25]=-1;hn[145]=hn[25]=0;pn[145]=pn[25]=0;yn[70]=yn[100]=0;vn[70]=vn[100]=1;_n[70]=_n[100]=0;Sn[70]=Sn[100]=-1;Mn[70]=Mn[100]=0;bn[70]=bn[100]=1;An[70]=An[100]=0;Tn[70]=Tn[100]=-1;Cn[70]=Cn[100]=1;un[70]=un[100]=1;ln[70]=ln[100]=0;cn[70]=cn[100]=0;yn[101]=yn[69]=0;vn[101]=vn[69]=1;_n[101]=_n[69]=0;un[101]=un[69]=1;ln[101]=ln[69]=0;cn[101]=cn[69]=0;Pn[149]=Pn[21]=0;In[149]=In[21]=1;Rn[149]=Rn[21]=1;fn[149]=fn[21]=-1;hn[149]=hn[21]=0;pn[149]=pn[21]=0;Sn[86]=Sn[84]=-1;Mn[86]=Mn[84]=0;bn[86]=bn[84]=1;An[86]=An[84]=0;Tn[86]=Tn[84]=-1;Cn[86]=Cn[84]=1;dn[89]=dn[81]=0;gn[89]=gn[81]=-1;mn[89]=mn[81]=0;xn[89]=xn[81]=1;En[89]=En[81]=0;wn[89]=wn[81]=1;dn[96]=dn[74]=0;gn[96]=gn[74]=1;mn[96]=mn[74]=0;yn[96]=yn[74]=-1;vn[96]=vn[74]=0;_n[96]=_n[74]=1;An[96]=An[74]=1;Tn[96]=Tn[74]=0;Cn[96]=Cn[74]=0;un[96]=un[74]=1;ln[96]=ln[74]=0;cn[96]=cn[74]=1;dn[24]=dn[146]=0;gn[24]=gn[146]=-1;mn[24]=mn[146]=1;Sn[24]=Sn[146]=1;Mn[24]=Mn[146]=0;bn[24]=bn[146]=1;xn[24]=xn[146]=0;En[24]=En[146]=1;wn[24]=wn[146]=1;fn[24]=fn[146]=0;hn[24]=hn[146]=-1;pn[24]=pn[146]=0;yn[6]=yn[164]=-1;vn[6]=vn[164]=0;_n[6]=_n[164]=1;Sn[6]=Sn[164]=-1;Mn[6]=Mn[164]=0;bn[6]=bn[164]=0;Pn[6]=Pn[164]=0;In[6]=In[164]=-1;Rn[6]=Rn[164]=1;An[6]=An[164]=1;Tn[6]=Tn[164]=0;Cn[6]=Cn[164]=0;xn[129]=xn[41]=0;En[129]=En[41]=1;wn[129]=wn[41]=1;Pn[129]=Pn[41]=0;In[129]=In[41]=1;Rn[129]=Rn[41]=0;un[129]=un[41]=-1;ln[129]=ln[41]=0;cn[129]=cn[41]=0;fn[129]=fn[41]=0;hn[129]=hn[41]=-1;pn[129]=pn[41]=0;Sn[66]=Sn[104]=0;Mn[66]=Mn[104]=1;bn[66]=bn[104]=0;xn[66]=xn[104]=-1;En[66]=En[104]=0;wn[66]=wn[104]=1;An[66]=An[104]=0;Tn[66]=Tn[104]=-1;Cn[66]=Cn[104]=0;un[66]=un[104]=0;ln[66]=ln[104]=-1;cn[66]=cn[104]=1;dn[144]=dn[26]=-1;gn[144]=gn[26]=0;mn[144]=mn[26]=0;Pn[144]=Pn[26]=1;In[144]=In[26]=0;Rn[144]=Rn[26]=1;An[144]=An[26]=0;Tn[144]=Tn[26]=1;Cn[144]=Cn[26]=1;fn[144]=fn[26]=-1;hn[144]=hn[26]=0;pn[144]=pn[26]=1;yn[36]=yn[134]=0;vn[36]=vn[134]=1;_n[36]=_n[134]=1;Sn[36]=Sn[134]=0;Mn[36]=Mn[134]=1;bn[36]=bn[134]=0;un[36]=un[134]=0;ln[36]=ln[134]=-1;cn[36]=cn[134]=1;fn[36]=fn[134]=1;hn[36]=hn[134]=0;pn[36]=pn[134]=0;dn[9]=dn[161]=-1;gn[9]=gn[161]=0;mn[9]=mn[161]=0;yn[9]=yn[161]=0;vn[9]=vn[161]=-1;_n[9]=_n[161]=0;xn[9]=xn[161]=1;En[9]=En[161]=0;wn[9]=wn[161]=0;Pn[9]=Pn[161]=1;In[9]=In[161]=0;Rn[9]=Rn[161]=1;dn[136]=0;gn[136]=1;mn[136]=1;yn[136]=0;vn[136]=1;_n[136]=0;Sn[136]=-1;Mn[136]=0;bn[136]=1;xn[136]=-1;En[136]=0;wn[136]=0;Pn[136]=0;In[136]=-1;Rn[136]=0;An[136]=0;Tn[136]=-1;Cn[136]=1;un[136]=1;ln[136]=0;cn[136]=0;fn[136]=1;hn[136]=0;pn[136]=1;dn[34]=0;gn[34]=-1;mn[34]=0;yn[34]=0;vn[34]=-1;_n[34]=1;Sn[34]=1;Mn[34]=0;bn[34]=0;xn[34]=1;En[34]=0;wn[34]=1;Pn[34]=0;In[34]=1;Rn[34]=1;An[34]=0;Tn[34]=1;Cn[34]=0;un[34]=-1;ln[34]=0;cn[34]=1;fn[34]=-1;hn[34]=0;pn[34]=0;dn[35]=0;gn[35]=1;mn[35]=1;yn[35]=0;vn[35]=-1;_n[35]=1;Sn[35]=1;Mn[35]=0;bn[35]=0;xn[35]=-1;En[35]=0;wn[35]=0;Pn[35]=0;In[35]=-1;Rn[35]=0;An[35]=0;Tn[35]=1;Cn[35]=0;un[35]=-1;ln[35]=0;cn[35]=1;fn[35]=1;hn[35]=0;pn[35]=1;dn[153]=0;gn[153]=1;mn[153]=1;xn[153]=-1;En[153]=0;wn[153]=0;Pn[153]=0;In[153]=-1;Rn[153]=0;fn[153]=1;hn[153]=0;pn[153]=1;yn[102]=0;vn[102]=-1;_n[102]=1;Sn[102]=1;Mn[102]=0;bn[102]=0;An[102]=0;Tn[102]=1;Cn[102]=0;un[102]=-1;ln[102]=0;cn[102]=1;dn[155]=0;gn[155]=-1;mn[155]=0;xn[155]=1;En[155]=0;wn[155]=1;Pn[155]=0;In[155]=1;Rn[155]=1;fn[155]=-1;hn[155]=0;pn[155]=0;yn[103]=0;vn[103]=1;_n[103]=0;Sn[103]=-1;Mn[103]=0;bn[103]=1;An[103]=0;Tn[103]=-1;Cn[103]=1;un[103]=1;ln[103]=0;cn[103]=0;dn[152]=0;gn[152]=1;mn[152]=1;Sn[152]=-1;Mn[152]=0;bn[152]=1;xn[152]=-1;En[152]=0;wn[152]=0;Pn[152]=0;In[152]=-1;Rn[152]=0;An[152]=0;Tn[152]=-1;Cn[152]=1;fn[152]=1;hn[152]=0;pn[152]=1;dn[156]=0;gn[156]=-1;mn[156]=1;Sn[156]=1;Mn[156]=0;bn[156]=1;xn[156]=-1;En[156]=0;wn[156]=0;Pn[156]=0;In[156]=-1;Rn[156]=0;An[156]=0;Tn[156]=1;Cn[156]=1;fn[156]=-1;hn[156]=0;pn[156]=1;dn[137]=0;gn[137]=1;mn[137]=1;yn[137]=0;vn[137]=1;_n[137]=0;xn[137]=-1;En[137]=0;wn[137]=0;Pn[137]=0;In[137]=-1;Rn[137]=0;un[137]=1;ln[137]=0;cn[137]=0;fn[137]=1;hn[137]=0;pn[137]=1;dn[139]=0;gn[139]=1;mn[139]=1;yn[139]=0;vn[139]=-1;_n[139]=0;xn[139]=1;En[139]=0;wn[139]=0;Pn[139]=0;In[139]=1;Rn[139]=0;un[139]=-1;ln[139]=0;cn[139]=0;fn[139]=1;hn[139]=0;pn[139]=1;dn[98]=0;gn[98]=-1;mn[98]=0;yn[98]=0;vn[98]=-1;_n[98]=1;Sn[98]=1;Mn[98]=0;bn[98]=0;xn[98]=1;En[98]=0;wn[98]=1;An[98]=0;Tn[98]=1;Cn[98]=0;un[98]=-1;ln[98]=0;cn[98]=1;dn[99]=0;gn[99]=1;mn[99]=0;yn[99]=0;vn[99]=-1;_n[99]=1;Sn[99]=1;Mn[99]=0;bn[99]=0;xn[99]=-1;En[99]=0;wn[99]=1;An[99]=0;Tn[99]=-1;Cn[99]=0;un[99]=1;ln[99]=0;cn[99]=1;yn[38]=0;vn[38]=-1;_n[38]=1;Sn[38]=1;Mn[38]=0;bn[38]=0;Pn[38]=0;In[38]=1;Rn[38]=1;An[38]=0;Tn[38]=1;Cn[38]=0;un[38]=-1;ln[38]=0;cn[38]=1;fn[38]=-1;hn[38]=0;pn[38]=0;yn[39]=0;vn[39]=1;_n[39]=1;Sn[39]=-1;Mn[39]=0;bn[39]=0;Pn[39]=0;In[39]=-1;Rn[39]=1;An[39]=0;Tn[39]=1;Cn[39]=0;un[39]=-1;ln[39]=0;cn[39]=1;fn[39]=1;hn[39]=0;pn[39]=0;var b_=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},A_=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},T_=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},C_=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},P_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},I_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},R_=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},L_=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},SY=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},MY=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},bY=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},AY=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},TY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},CY=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},PY=function(){return[[0,0],[0,1],[1,1],[1,0]]},IY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},RY=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},LY=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},NY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},OY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},DY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},FY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},UY=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},BY=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},zY=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},GY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},kY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},qY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},HY=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},VY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},WY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},XY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},YY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},$Y=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},ZY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},JY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},KY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},jY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},QY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},t$=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},Dn=[],Fn=[],Un=[],Bn=[],zn=[],Gn=[],kn=[],qn=[];Bn[1]=zn[1]=18;Bn[169]=zn[169]=18;Un[4]=Fn[4]=12;Un[166]=Fn[166]=12;Dn[16]=qn[16]=4;Dn[154]=qn[154]=4;Gn[64]=kn[64]=22;Gn[106]=kn[106]=22;Un[2]=Gn[2]=17;Bn[2]=zn[2]=18;Un[168]=Gn[168]=17;Bn[168]=zn[168]=18;Dn[8]=Bn[8]=9;Fn[8]=Un[8]=12;Dn[162]=Bn[162]=9;Fn[162]=Un[162]=12;Dn[32]=qn[32]=4;Fn[32]=kn[32]=1;Dn[138]=qn[138]=4;Fn[138]=kn[138]=1;zn[128]=qn[128]=21;Gn[128]=kn[128]=22;zn[42]=qn[42]=21;Gn[42]=kn[42]=22;Fn[5]=zn[5]=14;Fn[165]=zn[165]=14;Un[20]=qn[20]=6;Un[150]=qn[150]=6;Dn[80]=Gn[80]=11;Dn[90]=Gn[90]=11;Bn[65]=kn[65]=3;Bn[105]=kn[105]=3;Dn[160]=Gn[160]=11;Fn[160]=zn[160]=14;Dn[10]=Gn[10]=11;Fn[10]=zn[10]=14;Un[130]=qn[130]=6;Bn[130]=kn[130]=3;Un[40]=qn[40]=6;Bn[40]=kn[40]=3;Fn[101]=kn[101]=1;Fn[69]=kn[69]=1;zn[149]=qn[149]=21;zn[21]=qn[21]=21;Un[86]=Gn[86]=17;Un[84]=Gn[84]=17;Dn[89]=Bn[89]=9;Dn[81]=Bn[81]=9;Dn[96]=kn[96]=0;Fn[96]=Gn[96]=15;Dn[74]=kn[74]=0;Fn[74]=Gn[74]=15;Dn[24]=Un[24]=8;Bn[24]=qn[24]=7;Dn[146]=Un[146]=8;Bn[146]=qn[146]=7;Fn[6]=Gn[6]=15;Un[6]=zn[6]=16;Fn[164]=Gn[164]=15;Un[164]=zn[164]=16;Bn[129]=qn[129]=7;zn[129]=kn[129]=20;Bn[41]=qn[41]=7;zn[41]=kn[41]=20;Un[66]=kn[66]=2;Bn[66]=Gn[66]=19;Un[104]=kn[104]=2;Bn[104]=Gn[104]=19;Dn[144]=zn[144]=10;Gn[144]=qn[144]=23;Dn[26]=zn[26]=10;Gn[26]=qn[26]=23;Fn[36]=qn[36]=5;Un[36]=kn[36]=2;Fn[134]=qn[134]=5;Un[134]=kn[134]=2;Dn[9]=zn[9]=10;Fn[9]=Bn[9]=13;Dn[161]=zn[161]=10;Fn[161]=Bn[161]=13;Fn[37]=qn[37]=5;zn[37]=kn[37]=20;Fn[133]=qn[133]=5;zn[133]=kn[133]=20;Un[148]=zn[148]=16;Gn[148]=qn[148]=23;Un[22]=zn[22]=16;Gn[22]=qn[22]=23;Dn[82]=Un[82]=8;Bn[82]=Gn[82]=19;Dn[88]=Un[88]=8;Bn[88]=Gn[88]=19;Dn[73]=kn[73]=0;Fn[73]=Bn[73]=13;Dn[97]=kn[97]=0;Fn[97]=Bn[97]=13;Dn[145]=Bn[145]=9;zn[145]=qn[145]=21;Dn[25]=Bn[25]=9;zn[25]=qn[25]=21;Fn[70]=kn[70]=1;Un[70]=Gn[70]=17;Fn[100]=kn[100]=1;Un[100]=Gn[100]=17;Dn[34]=Bn[34]=9;Fn[34]=Un[34]=12;zn[34]=qn[34]=21;Gn[34]=kn[34]=22;Dn[136]=qn[136]=4;Fn[136]=kn[136]=1;Un[136]=Gn[136]=17;Bn[136]=zn[136]=18;Dn[35]=qn[35]=4;Fn[35]=Un[35]=12;Bn[35]=zn[35]=18;Gn[35]=kn[35]=22;Dn[153]=qn[153]=4;Bn[153]=zn[153]=18;Fn[102]=Un[102]=12;Gn[102]=kn[102]=22;Dn[155]=Bn[155]=9;zn[155]=qn[155]=23;Fn[103]=kn[103]=1;Un[103]=Gn[103]=17;Dn[152]=qn[152]=4;Un[152]=Gn[152]=17;Bn[152]=zn[152]=18;Dn[156]=Un[156]=8;Bn[156]=zn[156]=18;Gn[156]=qn[156]=23;Dn[137]=qn[137]=4;Fn[137]=kn[137]=1;Bn[137]=zn[137]=18;Dn[139]=qn[139]=4;Fn[139]=Bn[139]=13;zn[139]=kn[139]=20;Dn[98]=Bn[98]=9;Fn[98]=Un[98]=12;Gn[98]=kn[98]=22;Dn[99]=kn[99]=0;Fn[99]=Un[99]=12;Bn[99]=Gn[99]=19;Fn[38]=Un[38]=12;zn[38]=qn[38]=21;Gn[38]=kn[38]=22;Fn[39]=qn[39]=5;Un[39]=zn[39]=16;Gn[39]=kn[39]=22;var re=[];re[1]=re[169]=b_;re[4]=re[166]=A_;re[16]=re[154]=T_;re[64]=re[106]=C_;re[168]=re[2]=P_;re[162]=re[8]=I_;re[138]=re[32]=R_;re[42]=re[128]=L_;re[5]=re[165]=SY;re[20]=re[150]=MY;re[80]=re[90]=bY;re[65]=re[105]=AY;re[160]=re[10]=TY;re[130]=re[40]=CY;re[85]=PY;re[101]=re[69]=IY;re[149]=re[21]=RY;re[86]=re[84]=LY;re[89]=re[81]=NY;re[96]=re[74]=OY;re[24]=re[146]=DY;re[6]=re[164]=FY;re[129]=re[41]=UY;re[66]=re[104]=BY;re[144]=re[26]=zY;re[36]=re[134]=GY;re[9]=re[161]=kY;re[37]=re[133]=qY;re[148]=re[22]=HY;re[82]=re[88]=VY;re[73]=re[97]=WY;re[145]=re[25]=XY;re[70]=re[100]=YY;re[34]=function(n){return[L_(n),I_(n)]};re[35]=$Y;re[136]=function(n){return[R_(n),P_(n)]};re[153]=function(n){return[T_(n),b_(n)]};re[102]=function(n){return[A_(n),C_(n)]};re[155]=ZY;re[103]=JY;re[152]=function(n){return[T_(n),P_(n)]};re[156]=KY;re[137]=function(n){return[R_(n),b_(n)]};re[139]=jY;re[98]=function(n){return[I_(n),C_(n)]};re[99]=QY;re[38]=function(n){return[A_(n),L_(n)]};re[39]=t$;function n$(n){return(n>0)-(n<0)||+n}function rf(n,t,e){var o=t[0]-n[0],s=t[1]-n[1],c=e[0]-t[0],h=e[1]-t[1];return n$(o*h-c*s)}function rR(n,t){var e=n.geometry.coordinates[0].map(function(h){return h[0]}),o=n.geometry.coordinates[0].map(function(h){return h[1]}),s=t.geometry.coordinates[0].map(function(h){return h[0]}),c=t.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,o)===Math.max.apply(null,c)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,o)===Math.min.apply(null,c)}function N_(n,t){return t.geometry.coordinates[0].every(function(e){return Gi(Cr(e),n)})}function iR(n,t){return n[0]===t[0]&&n[1]===t[1]}var r$=function(){function n(t){this.id=n.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return n.buildId=function(t){return t.join(",")},n.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},n.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},n.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},n.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var s=e.to,c=o.to;if(s.coordinates[0]-t.coordinates[0]>=0&&c.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&c.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&c.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||c.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-c.coordinates[1]:c.coordinates[1]-s.coordinates[1];var h=rf(t.coordinates,s.coordinates,c.coordinates);if(h<0)return 1;if(h>0)return-1;var p=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),g=Math.pow(c.coordinates[0]-t.coordinates[0],2)+Math.pow(c.coordinates[1]-t.coordinates[1],2);return p-g}),this.outerEdgesSorted=!0)},n.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},n.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},n.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},n}(),O_=r$;var i$=function(){function n(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return n.prototype.getSymetric=function(){return this.symetric||(this.symetric=new n(this.to,this.from),this.symetric.symetric=this),this.symetric},n.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},n.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},n.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},n.prototype.toLineString=function(){return zi([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return rf(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),oR=i$;var o$=function(){function n(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return n.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},n.prototype.get=function(t){return this.edges[t]},Object.defineProperty(n.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),n.prototype.forEach=function(t){this.edges.forEach(t)},n.prototype.map=function(t){return this.edges.map(t)},n.prototype.some=function(t){return this.edges.some(t)},n.prototype.isValid=function(){return!0},n.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(h,p,g){return p.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=g),h},0),o=(e===0?this.length:e)-1,s=(e+1)%this.length,c=rf(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return c===0?this.edges[o].from.coordinates[0]>this.edges[s].from.coordinates[0]:c>0},n.prototype.toMultiPoint=function(){return yv(this.edges.map(function(t){return t.from.coordinates}))},n.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Or([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Fv(this.toPolygon())},n.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),s,c;return e.forEach(function(h){var p=h.getEnvelope();if(c&&(s=c.getEnvelope()),!rR(p,o)&&N_(p,o)){for(var g=t.map(function(P){return P.from.coordinates}),m=void 0,_=function(P){h.some(function(I){return iR(P,I.from.coordinates)})||(m=P)},E=0,x=g;E<x.length;E++){var b=x[E];_(b)}m&&h.inside(Cr(m))&&(!c||N_(s,p))&&(c=h)}}),c},n.prototype.inside=function(t){return Gi(t,this.toPolygon())},n}(),D_=o$;function s$(n){if(!n)throw new Error("No geojson passed");if(n.type!=="FeatureCollection"&&n.type!=="GeometryCollection"&&n.type!=="MultiLineString"&&n.type!=="LineString"&&n.type!=="Feature")throw new Error("Invalid input type '"+n.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var cut=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){s$(t);var e=new n;return ds(t,function(o){_v(o,"LineString","Graph::fromGeoJson"),KT(o,function(s,c){if(s){var h=e.getNode(s),p=e.getNode(c);e.addEdge(h,p)}return c})}),e},n.prototype.getNode=function(t){var e=O_.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new O_(t)),o},n.prototype.addEdge=function(t,e){var o=new oR(t,e),s=o.getSymetric();this.edges.push(o),this.edges.push(s)},n.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},n.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),o.forEach(function(s){return e._removeIfDangle(s)})}},n.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},n.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=o})},n.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),s,c,h=o.length-1;h>=0;--h){var p=o[h],g=p.symetric,m=void 0,_=void 0;p.label===e&&(m=p),g.label===e&&(_=g),!(!m||!_)&&(_&&(c=_),m&&(c&&(c.next=m,c=void 0),s||(s=m)))}c&&(c.next=s)},n.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var s=o;do s.label=e,s=s.next;while(!o.isEqual(s));e++}}),t},n.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(s){t._computeNextCCWEdges(s,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},n.prototype._findIntersectionNodes=function(t){var e=[],o=t,s=function(){var c=0;o.from.getOuterEdges().forEach(function(h){h.label===t.label&&++c}),c>1&&e.push(o.from),o=o.next};do s();while(!t.isEqual(o));return e},n.prototype._findEdgeRing=function(t){var e=t,o=new D_;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},n.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},n.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},n}();var c$=on(F_(),1);var f$=on(F_(),1);var p$=on(dR(),1);var x$=on(MR(),1);function AR(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function w$(){return new TR(function(n){return n.f})}var G_={search:function(n,t,e,o){n.cleanDirty(),o=o||{};var s=o.heuristic||G_.heuristics.manhattan,c=o.closest||!1,h=w$(),p=t;for(t.h=s(t,e),h.push(t);h.size()>0;){var g=h.pop();if(g===e)return AR(g);g.closed=!0;for(var m=n.neighbors(g),_=0,E=m.length;_<E;++_){var x=m[_];if(!(x.closed||x.isWall())){var b=g.g+x.getCost(g),P=x.visited;(!P||b<x.g)&&(x.visited=!0,x.parent=g,x.h=x.h||s(x,e),x.g=b,x.f=x.g+x.h,n.markDirty(x),c&&(x.h<p.h||x.h===p.h&&x.g<p.g)&&(p=x),P?h.rescoreElement(x):h.push(x))}}}return c?AR(p):[]},heuristics:{manhattan:function(n,t){var e=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);return e+o},diagonal:function(n,t){var e=1,o=Math.sqrt(2),s=Math.abs(t.x-n.x),c=Math.abs(t.y-n.y);return e*(s+c)+(o-2*e)*Math.min(s,c)}},cleanNode:function(n){n.f=0,n.g=0,n.h=0,n.visited=!1,n.closed=!1,n.parent=null}};function vh(n,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<n.length;e++){this.grid[e]=[];for(var o=0,s=n[e];o<s.length;o++){var c=new Eg(e,o,s[o]);this.grid[e][o]=c,this.nodes.push(c)}}this.init()}vh.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)G_.cleanNode(this.nodes[n])};vh.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)G_.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};vh.prototype.markDirty=function(n){this.dirtyNodes.push(n)};vh.prototype.neighbors=function(n){var t=[],e=n.x,o=n.y,s=this.grid;return s[e-1]&&s[e-1][o]&&t.push(s[e-1][o]),s[e+1]&&s[e+1][o]&&t.push(s[e+1][o]),s[e]&&s[e][o-1]&&t.push(s[e][o-1]),s[e]&&s[e][o+1]&&t.push(s[e][o+1]),this.diagonal&&(s[e-1]&&s[e-1][o-1]&&t.push(s[e-1][o-1]),s[e+1]&&s[e+1][o-1]&&t.push(s[e+1][o-1]),s[e-1]&&s[e-1][o+1]&&t.push(s[e-1][o+1]),s[e+1]&&s[e+1][o+1]&&t.push(s[e+1][o+1])),t};vh.prototype.toString=function(){for(var n=[],t=this.grid,e,o,s,c,h=0,p=t.length;h<p;h++){for(e=[],o=t[h],s=0,c=o.length;s<c;s++)e.push(o[s].weight);n.push(e.join(" "))}return n.join(\`
|
|
11569
11569
|
\`)};function Eg(n,t,e){this.x=n,this.y=t,this.weight=e}Eg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Eg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Eg.prototype.isWall=function(){return this.weight===0};function TR(n){this.content=[],this.scoreFunction=n}TR.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,c=s-1,h=null,p;if(c<t){var g=this.content[c];p=this.scoreFunction(g),p<o&&(h=c)}if(s<t){var m=this.content[s],_=this.scoreFunction(m);_<(h===null?o:p)&&(h=s)}if(h!==null)this.content[n]=this.content[h],this.content[h]=e,n=h;else break}}};function k_(){this._=null}function sf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}k_.prototype={constructor:k_,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=CR(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(_h(this,e),n=e,e=n.U),e.C=!1,o.C=!0,xh(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(xh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,_h(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,c,h;if(o?s?c=CR(s):c=o:c=s,t?t.L===n?t.L=c:t.R=c:this._=c,o&&s?(h=c.C,c.C=n.C,c.L=o,o.U=c,c!==s?(t=c.U,c.U=n.U,n=c.R,t.L=n,c.R=s,s.U=c):(c.U=t,t=c,n=c.R)):(h=n.C,n=c),n&&(n.U=t),!h){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,_h(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,xh(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,_h(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,xh(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,_h(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,xh(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function _h(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function xh(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function CR(n){for(;n.L;)n=n.L;return n}var q_=k_;function af(n,t,e,o){var s=[null,null],c=qi.push(s)-1;return s.left=n,s.right=t,e&&Eh(s,n,t,e),o&&Eh(s,t,n,o),bo[n.index].halfedges.push(c),bo[t.index].halfedges.push(c),s}function uf(n,t,e){var o=[t,e];return o.left=n,o}function Eh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function S$(n,t,e,o,s){var c=n[0],h=n[1],p=c[0],g=c[1],m=h[0],_=h[1],E=0,x=1,b=m-p,P=_-g,I;if(I=t-p,!(!b&&I>0)){if(I/=b,b<0){if(I<E)return;I<x&&(x=I)}else if(b>0){if(I>x)return;I>E&&(E=I)}if(I=o-p,!(!b&&I<0)){if(I/=b,b<0){if(I>x)return;I>E&&(E=I)}else if(b>0){if(I<E)return;I<x&&(x=I)}if(I=e-g,!(!P&&I>0)){if(I/=P,P<0){if(I<E)return;I<x&&(x=I)}else if(P>0){if(I>x)return;I>E&&(E=I)}if(I=s-g,!(!P&&I<0)){if(I/=P,P<0){if(I>x)return;I>E&&(E=I)}else if(P>0){if(I<E)return;I<x&&(x=I)}return!(E>0)&&!(x<1)||(E>0&&(n[0]=[p+E*b,g+E*P]),x<1&&(n[1]=[p+x*b,g+x*P])),!0}}}}}function M$(n,t,e,o,s){var c=n[1];if(c)return!0;var h=n[0],p=n.left,g=n.right,m=p[0],_=p[1],E=g[0],x=g[1],b=(m+E)/2,P=(_+x)/2,I,S;if(x===_){if(b<t||b>=o)return;if(m>E){if(!h)h=[b,e];else if(h[1]>=s)return;c=[b,s]}else{if(!h)h=[b,s];else if(h[1]<e)return;c=[b,e]}}else if(I=(m-E)/(x-_),S=P-I*b,I<-1||I>1)if(m>E){if(!h)h=[(e-S)/I,e];else if(h[1]>=s)return;c=[(s-S)/I,s]}else{if(!h)h=[(s-S)/I,s];else if(h[1]<e)return;c=[(e-S)/I,e]}else if(_<x){if(!h)h=[t,I*t+S];else if(h[0]>=o)return;c=[o,I*o+S]}else{if(!h)h=[o,I*o+S];else if(h[0]<t)return;c=[t,I*t+S]}return n[0]=h,n[1]=c,!0}function PR(n,t,e,o){for(var s=qi.length,c;s--;)(!M$(c=qi[s],n,t,e,o)||!S$(c,n,t,e,o)||!(Math.abs(c[0][0]-c[1][0])>xr||Math.abs(c[0][1]-c[1][1])>xr))&&delete qi[s]}function IR(n){return bo[n.index]={site:n,halfedges:[]}}function b$(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function H_(n,t){return t[+(t.left!==n.site)]}function A$(n,t){return t[+(t.left===n.site)]}function RR(){for(var n=0,t=bo.length,e,o,s,c;n<t;++n)if((e=bo[n])&&(c=(o=e.halfedges).length)){var h=new Array(c),p=new Array(c);for(s=0;s<c;++s)h[s]=s,p[s]=b$(e,qi[o[s]]);for(h.sort(function(g,m){return p[m]-p[g]}),s=0;s<c;++s)p[s]=o[h[s]];for(s=0;s<c;++s)o[s]=p[s]}}function LR(n,t,e,o){var s=bo.length,c,h,p,g,m,_,E,x,b,P,I,S,w=!0;for(c=0;c<s;++c)if(h=bo[c]){for(p=h.site,m=h.halfedges,g=m.length;g--;)qi[m[g]]||m.splice(g,1);for(g=0,_=m.length;g<_;)P=A$(h,qi[m[g]]),I=P[0],S=P[1],E=H_(h,qi[m[++g%_]]),x=E[0],b=E[1],(Math.abs(I-x)>xr||Math.abs(S-b)>xr)&&(m.splice(g,0,qi.push(uf(p,P,Math.abs(I-n)<xr&&o-S>xr?[n,Math.abs(x-n)<xr?b:o]:Math.abs(S-o)<xr&&e-I>xr?[Math.abs(b-o)<xr?x:e,o]:Math.abs(I-e)<xr&&S-t>xr?[e,Math.abs(x-e)<xr?b:t]:Math.abs(S-t)<xr&&I-n>xr?[Math.abs(b-t)<xr?x:n,t]:null))-1),++_);_&&(w=!1)}if(w){var R,T,F,W=1/0;for(c=0,w=null;c<s;++c)(h=bo[c])&&(p=h.site,R=p[0]-n,T=p[1]-t,F=R*R+T*T,F<W&&(W=F,w=h));if(w){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];w.halfedges.push(qi.push(uf(p=w.site,X,q))-1,qi.push(uf(p,q,D))-1,qi.push(uf(p,D,xt))-1,qi.push(uf(p,xt,X))-1)}}for(c=0;c<s;++c)(h=bo[c])&&(h.halfedges.length||delete bo[c])}var NR=[],wg;function T$(){sf(this),this.x=this.y=this.arc=this.site=this.cy=null}function zl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,c=e.site;if(o!==c){var h=s[0],p=s[1],g=o[0]-h,m=o[1]-p,_=c[0]-h,E=c[1]-p,x=2*(g*E-m*_);if(!(x>=-OR)){var b=g*g+m*m,P=_*_+E*E,I=(E*b-m*P)/x,S=(g*P-_*b)/x,w=NR.pop()||new T$;w.arc=n,w.site=s,w.x=I+h,w.y=(w.cy=S+p)+Math.sqrt(I*I+S*S),n.circle=w;for(var R=null,T=lf._;T;)if(w.y<T.y||w.y===T.y&&w.x<=T.x)if(T.L)T=T.L;else{R=T.P;break}else if(T.R)T=T.R;else{R=T;break}lf.insert(R,w),R||(wg=w)}}}}function Gl(n){var t=n.circle;t&&(t.P||(wg=t.N),lf.remove(t),NR.push(t),sf(t),n.circle=null)}var FR=[];function C$(){sf(this),this.edge=this.site=this.circle=null}function DR(n){var t=FR.pop()||new C$;return t.site=n,t}function V_(n){Gl(n),kl.remove(n),FR.push(n),sf(n)}function UR(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],c=n.P,h=n.N,p=[n];V_(n);for(var g=c;g.circle&&Math.abs(e-g.circle.x)<xr&&Math.abs(o-g.circle.cy)<xr;)c=g.P,p.unshift(g),V_(g),g=c;p.unshift(g),Gl(g);for(var m=h;m.circle&&Math.abs(e-m.circle.x)<xr&&Math.abs(o-m.circle.cy)<xr;)h=m.N,p.push(m),V_(m),m=h;p.push(m),Gl(m);var _=p.length,E;for(E=1;E<_;++E)m=p[E],g=p[E-1],Eh(m.edge,g.site,m.site,s);g=p[0],m=p[_-1],m.edge=af(g.site,m.site,null,s),zl(g),zl(m)}function BR(n){for(var t=n[0],e=n[1],o,s,c,h,p=kl._;p;)if(c=zR(p,e)-t,c>xr)p=p.L;else if(h=t-P$(p,e),h>xr){if(!p.R){o=p;break}p=p.R}else{c>-xr?(o=p.P,s=p):h>-xr?(o=p,s=p.N):o=s=p;break}IR(n);var g=DR(n);if(kl.insert(o,g),!(!o&&!s)){if(o===s){Gl(o),s=DR(o.site),kl.insert(g,s),g.edge=s.edge=af(o.site,g.site),zl(o),zl(s);return}if(!s){g.edge=af(o.site,g.site);return}Gl(o),Gl(s);var m=o.site,_=m[0],E=m[1],x=n[0]-_,b=n[1]-E,P=s.site,I=P[0]-_,S=P[1]-E,w=2*(x*S-b*I),R=x*x+b*b,T=I*I+S*S,F=[(S*R-b*T)/w+_,(x*T-I*R)/w+E];Eh(s.edge,m,P,F),g.edge=af(m,n,null,F),s.edge=af(n,P,null,F),zl(o),zl(s)}}function zR(n,t){var e=n.site,o=e[0],s=e[1],c=s-t;if(!c)return o;var h=n.P;if(!h)return-1/0;e=h.site;var p=e[0],g=e[1],m=g-t;if(!m)return p;var _=p-o,E=1/c-1/m,x=_/m;return E?(-x+Math.sqrt(x*x-2*E*(_*_/(-2*m)-g+m/2+s-c/2)))/E+o:(o+p)/2}function P$(n,t){var e=n.N;if(e)return zR(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var xr=1e-6,OR=1e-12,kl,bo,lf,qi;function I$(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function R$(n,t){return t[1]-n[1]||t[0]-n[0]}function Sg(n,t){var e=n.sort(R$).pop(),o,s,c;for(qi=[],bo=new Array(n.length),kl=new q_,lf=new q_;;)if(c=wg,e&&(!c||e[1]<c.y||e[1]===c.y&&e[0]<c.x))(e[0]!==o||e[1]!==s)&&(BR(e),o=e[0],s=e[1]),e=n.pop();else if(c)UR(c.arc);else break;if(RR(),t){var h=+t[0][0],p=+t[0][1],g=+t[1][0],m=+t[1][1];PR(h,p,g,m),LR(h,p,g,m)}this.edges=qi,this.cells=bo,kl=lf=qi=bo=null}Sg.prototype={constructor:Sg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return H_(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(p=(c=e.halfedges).length)for(var s=e.site,c,h=-1,p,g,m=t[c[p-1]],_=m.left===s?m.right:m.left;++h<p;)g=_,m=t[c[h]],_=m.left===s?m.right:m.left,g&&_&&o<g.index&&o<_.index&&I$(s,g,_)<0&&n.push([s.data,g.data,_.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,c=o._found||0,h=o.cells.length,p;!(p=o.cells[c]);)if(++c>=h)return null;var g=n-p.site[0],m=t-p.site[1],_=g*g+m*m;do p=o.cells[s=c],c=null,p.halfedges.forEach(function(E){var x=o.edges[E],b=x.left;if(!((b===p.site||!b)&&!(b=x.right))){var P=n-b[0],I=t-b[1],S=P*P+I*I;S<_&&(_=S,c=b.index)}});while(c!==null);return o._found=s,e==null||_<=e*e?p.site:null}};var z$=on(cf(),1);var o1=on(HR(),1);function $o(){return new Ag}function Ag(){this.reset()}Ag.prototype={constructor:Ag,reset:function(){this.s=this.t=0},add:function(n){VR(bg,n,this.t),VR(this,bg.s,this.s),this.s?this.t+=bg.t:this.s=bg.t},valueOf:function(){return this.s}};var bg=new Ag;function VR(n,t,e){var o=n.s=t+e,s=o-t,c=o-s;n.t=t-c+(e-s)}var er=1e-6;var gr=Math.PI,wi=gr/2,Tg=gr/4,Na=gr*2,ql=180/gr,Zo=gr/180,$r=Math.abs,ia=Math.atan,Jo=Math.atan2,Vn=Math.cos;var Cg=Math.exp;var wh=Math.log;var sn=Math.sin;var eo=Math.sqrt,Sh=Math.tan;function Y_(n){return n>1?0:n<-1?gr:Math.acos(n)}function Ao(n){return n>1?wi:n<-1?-wi:Math.asin(n)}function oa(){}var G$=$o(),ift=$o();function Hl(n){var t=n[0],e=n[1],o=Vn(e);return[o*Vn(t),o*sn(t),sn(e)]}function Mh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function bh(n){var t=eo(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var dft=$o();function XR(n,t){return[n>gr?n-Na:n<-gr?n+Na:n,t]}XR.invert=XR;function $_(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:oa,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Z_(n,t){return $r(n[0]-t[0])<er&&$r(n[1]-t[1])<er}function Pg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function J_(n,t,e,o,s){var c=[],h=[],p,g;if(n.forEach(function(P){if(!((I=P.length-1)<=0)){var I,S=P[0],w=P[I],R;if(Z_(S,w)){for(s.lineStart(),p=0;p<I;++p)s.point((S=P[p])[0],S[1]);s.lineEnd();return}c.push(R=new Pg(S,P,null,!0)),h.push(R.o=new Pg(S,null,R,!1)),c.push(R=new Pg(w,P,null,!1)),h.push(R.o=new Pg(w,null,R,!0))}}),!!c.length){for(h.sort(t),YR(c),YR(h),p=0,g=h.length;p<g;++p)h[p].e=e=!e;for(var m=c[0],_,E;;){for(var x=m,b=!0;x.v;)if((x=x.n)===m)return;_=x.z,s.lineStart();do{if(x.v=x.o.v=!0,x.e){if(b)for(p=0,g=_.length;p<g;++p)s.point((E=_[p])[0],E[1]);else o(x.x,x.n.x,1,s);x=x.n}else{if(b)for(_=x.p.z,p=_.length-1;p>=0;--p)s.point((E=_[p])[0],E[1]);else o(x.x,x.p.x,-1,s);x=x.p}x=x.o,_=x.z,b=!b}while(!x.v);s.lineEnd()}}}function YR(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function el(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function K_(n){return n.length===1&&(n=H$(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)<0?o=c+1:s=c}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)>0?s=c:o=c+1}return o}}}function H$(n){return function(t,e){return el(n(t),e)}}var $R=K_(el),V$=$R.right,W$=$R.left;var ZR=Array.prototype,Y$=ZR.slice,$$=ZR.map;var sht=Math.sqrt(50),aht=Math.sqrt(10),uht=Math.sqrt(2);function Rg(n){for(var t=n.length,e,o=-1,s=0,c,h;++o<t;)s+=n[o].length;for(c=new Array(s);--t>=0;)for(h=n[t],e=h.length;--e>=0;)c[--s]=h[e];return c}var nZ=1e9,Wpt=-nZ;var j_=$o();function Q_(n,t){var e=t[0],o=t[1],s=[sn(e),-Vn(e),0],c=0,h=0;j_.reset();for(var p=0,g=n.length;p<g;++p)if(_=(m=n[p]).length)for(var m,_,E=m[_-1],x=E[0],b=E[1]/2+Tg,P=sn(b),I=Vn(b),S=0;S<_;++S,x=R,P=F,I=W,E=w){var w=m[S],R=w[0],T=w[1]/2+Tg,F=sn(T),W=Vn(T),X=R-x,q=X>=0?1:-1,D=q*X,xt=D>gr,B=P*F;if(j_.add(Jo(B*q*sn(D),I*W+B*Vn(D))),c+=xt?X+q*Na:X,xt^x>=e^R>=e){var j=Mh(Hl(E),Hl(w));bh(j);var J=Mh(s,j);bh(J);var Dt=(xt^X>=0?-1:1)*Ao(J[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(h+=xt^X>=0?1:-1)}}return(c<-er||c<er&&j_<-er)^h&1}var edt=$o();var xdt=$o(),Edt=$o();var oZ=1/0;var Mdt=-oZ;function t1(n){this._context=n}t1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Na);break}}},result:oa};var Odt=$o();function e1(){this._string=[]}e1.prototype={_radius:4.5,_circle:jR(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=jR(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function jR(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function n1(n,t,e,o){return function(s,c){var h=t(c),p=s.invert(o[0],o[1]),g=$_(),m=t(g),_=!1,E,x,b,P={point:I,lineStart:w,lineEnd:R,polygonStart:function(){P.point=T,P.lineStart=F,P.lineEnd=W,x=[],E=[]},polygonEnd:function(){P.point=I,P.lineStart=w,P.lineEnd=R,x=Rg(x);var X=Q_(E,p);x.length?(_||(c.polygonStart(),_=!0),J_(x,uZ,X,e,c)):X&&(_||(c.polygonStart(),_=!0),c.lineStart(),e(null,null,1,c),c.lineEnd()),_&&(c.polygonEnd(),_=!1),x=E=null},sphere:function(){c.polygonStart(),c.lineStart(),e(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function I(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&c.point(X,q)}function S(X,q){var D=s(X,q);h.point(D[0],D[1])}function w(){P.point=S,h.lineStart()}function R(){P.point=I,h.lineEnd()}function T(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function W(){T(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,J;if(b.pop(),E.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(_||(c.polygonStart(),_=!0),c.lineStart(),D=0;D<B;++D)c.point((J=j[D])[0],J[1]);c.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),x.push(q.filter(aZ))}}return P}}function aZ(n){return n.length>1}function uZ(n,t){return((n=n.x)[0]<0?n[1]-wi-er:wi-n[1])-((t=t.x)[0]<0?t[1]-wi-er:wi-t[1])}var lZ=n1(function(){return!0},cZ,hZ,[-gr,-wi]);function cZ(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(c,h){var p=c>0?gr:-gr,g=$r(c-t);$r(g-gr)<er?(n.point(t,e=(e+h)/2>0?wi:-wi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(p,e),n.point(c,e),s=0):o!==p&&g>=gr&&($r(t-o)<er&&(t-=o*er),$r(c-p)<er&&(c-=p*er),e=fZ(t,e,c,h),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(p,e),s=0),n.point(t=c,e=h),o=p},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function fZ(n,t,e,o){var s,c,h=sn(n-e);return $r(h)>er?ia((sn(t)*(c=Vn(o))*sn(e)-sn(o)*(s=Vn(t))*sn(n))/(s*c*h)):(t+o)/2}function hZ(n,t,e,o){var s;if(n==null)s=e*wi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if($r(n[0]-t[0])>er){var c=n[0]<t[0]?gr:-gr;s=e*c/2,o.point(-c,s),o.point(0,s),o.point(c,s)}else o.point(t[0],t[1])}function Lg(n){return function(t){var e=new r1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function r1(){}r1.prototype={constructor:r1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Egt=Vn(30*Zo);var Dgt=Lg({point:function(n,t){this.stream.point(n*Zo,t*Zo)}});function Ng(n){return function(t,e){var o=Vn(t),s=Vn(e),c=n(o*s);return[c*s*sn(t),c*sn(e)]}}function Oa(n){return function(t,e){var o=eo(t*t+e*e),s=n(o),c=sn(s),h=Vn(s);return[Jo(t*c,o*h),Ao(o&&e*c/o)]}}var oL=Ng(function(n){return eo(2/(1+n))});oL.invert=Oa(function(n){return 2*Ao(n/2)});var sL=Ng(function(n){return(n=Y_(n))&&n/sn(n)});sL.invert=Oa(function(n){return n});function i1(n,t){return[n,wh(Sh((wi+t)/2))]}i1.invert=function(n,t){return[n,2*ia(Cg(t))-wi]};function Og(n,t){return[n,t]}Og.invert=Og;function aL(n,t){var e=Vn(t),o=Vn(n)*e;return[e*sn(n)/o,sn(t)/o]}aL.invert=Oa(ia);function uL(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}uL.invert=function(n,t){var e=t,o=25,s;do{var c=e*e,h=c*c;e-=s=(e*(1.007226+c*(.015085+h*(-.044475+.028874*c-.005916*h)))-t)/(1.007226+c*(.015085*3+h*(-.044475*7+.028874*9*c-.005916*11*h)))}while($r(s)>er&&--o>0);return[n/(.8707+(c=e*e)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),e]};function lL(n,t){return[Vn(t)*sn(n),sn(t)]}lL.invert=Oa(Ao);function cL(n,t){var e=Vn(t),o=1+Vn(n)*e;return[e*sn(n)/o,sn(t)/o]}cL.invert=Oa(function(n){return 2*ia(n)});function fL(n,t){return[wh(Sh((wi+t)/2)),-n]}fL.invert=function(n,t){return[-t,2*ia(Cg(n))-wi]};var vZ=on(cf(),1);var _Z=on(cf(),1);var EZ=on(cf(),1);var wZ=on(cf(),1);function Dg(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function pL(n){let t=0;for(let e=0;e<n.length-1;e++)t+=Dg(n[e],n[e+1]);return t}var Fs=on(dL(),1);var $n="___",Fg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(c){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(c){s=[]}return Iu({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+$n+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+$n+e,s=this.nodeMap.get(o);if(!s)return null;let c=this.pointMap.get(s);return c!=null?c:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(c=>{(c.points||[]).filter(h=>h.openStatus!==!1).filter(h=>{if(!h.startTime||!h.endTime)return!0;let[p,g]=h.startTime.split(":").map(b=>+b),[m,_]=h.endTime.split(":").map(b=>+b),E=p*60+g,x=m*60+_;return s>=E&&s<=x}).forEach(h=>{h.floor=c.floor;let p=""+c.floor+$n+h.id;if(this.nodeMap.set(""+c.floor+$n+h.nodeId,""+c.floor+$n+(h.relatedId||h.id)),this.pointMap.set(p,h),this.isFacilityByType(h.type)){let g=this.facilities.find(m=>m.id===+h.targetId);if(g){switch(g.entry_infra_type){case"straightLadder":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.straightLadderMap.get(h.targetId)||[];x.push(Iu({},h)),this.straightLadderMap.set(h.targetId,x)}break;case"staircase":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.staircaseMap.get(h.targetId)||[];x.push(Iu({},h)),this.staircaseMap.set(h.targetId,x)}break;case"escalator":let _=this.escalatorMap.get(h.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=h:_.push({start:h})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=h:_.push({end:h})}this.escalatorMap.set(h.targetId,_);break;case"ramp":let E=this.rampMap.get(h.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=E.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=h:E.push({start:h})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=E.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=h:E.push({end:h})}this.rampMap.set(h.targetId,E);break;case"connectionPoint":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.connectionPointMap.get(h.targetId)||[];x.push(Iu({},h)),this.connectionPointMap.set(h.targetId,x)}break}let m=this.facilityMap.get(h.targetId)||[];m.push(Iu({},h)),this.facilityMap.set(h.targetId,m)}}h.type==="parkingSpace"&&this.parkingMap.set(""+c.floor+$n+h.name,h)}),(c.lines||[]).filter(h=>h.to!==h.from).forEach(h=>{let p=""+c.floor+$n+h.from,g=""+c.floor+$n+h.to,m=this.pointMap.get(p),_=this.pointMap.get(g);if(!m||!_)return;let E=m.cds,x=_.cds,b=Dg(E,x);if(!m.permission&&!_.permission){switch(this.addLineItem(p,g,b),this.addLineItem(g,p,b),h.direction){case"double":this.addLineItem(p,g,b,this.forwardLineMap),this.addLineItem(g,p,b,this.forwardLineMap);break;case"single":this.addLineItem(p,g,b,this.forwardLineMap);break;case"back":this.addLineItem(g,p,b,this.forwardLineMap);break}(m.type==="parkingSpace"||_.type==="parkingSpace")&&h.direction==="noDir"&&(this.addLineItem(p,g,b,this.forwardLineMap),this.addLineItem(g,p,b,this.forwardLineMap))}else m.permission&&(this.setPermissionLine(p,g,m.permission,b,""),this.setPermissionLine(g,p,m.permission,b,"")),_.permission&&_.permission!==m.permission&&(this.setPermissionLine(p,g,_.permission,b,""),this.setPermissionLine(g,p,_.permission,b,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,c){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:c})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"straightLadder"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"staircase"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&(h.permission&&this.setPermissionLine(s,c,h.permission,1,"escalator"),p.permission&&p.permission!==h.permission&&this.setPermissionLine(s,c,p.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&(h.permission&&this.setPermissionLine(s,c,h.permission,10,"ramp"),p.permission&&p.permission!==h.permission&&this.setPermissionLine(s,c,p.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"connectionPoint"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,o,s){let c=this.getPermissionMap(t);console.log(c),c.forEach(h=>{e.includes(h.type)&&(h.type===""?this.addLineItem(h.fromKey,h.toKey,h.distance,o):this.addLineItem(h.fromKey,h.toKey,s.get(h.type),o))})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let c=s.get(t)||new Map;c.set(e,o),s.set(t,c)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(c=>{let[h,p]=c;if(!(p.length<2))for(let g=0;g<p.length;g++){let m=""+p[g].floor+$n+p[g].id,_=this.pointMap.get(m);if(!(!_||_.permission)){for(let E=0;E<p.length;E++)if(g!==E){let x=""+p[E].floor+$n+p[E].id,b=this.pointMap.get(x);if(!b||b.permission)continue;if(p[g].type==="straightLadder"){let P=e;this.addLineItem(m,x,P,s)}else{let P=o;this.addLineItem(m,x,P,s)}}}}}),this.escalatorMap.forEach((c,h)=>{c.forEach(p=>{if(p.start&&p.end){let g=""+p.start.floor+$n+p.start.id,m=""+p.end.floor+$n+p.end.id,_=this.pointMap.get(g),E=this.pointMap.get(m);if(_&&E&&!_.permission&&!E.permission){let x=t;this.addLineItem(g,m,x,s)}}})}),this.connectionPointMap.forEach((c,h)=>{if(!(c.length<2))for(let p=0;p<c.length;p++){let g=""+c[p].floor+$n+c[p].id,m=this.pointMap.get(g);if(!(!m||m.permission)){for(let _=0;_<c.length;_++)if(p!==_){let E=""+c[_].floor+$n+c[_].id,x=this.pointMap.get(E);if(!x||x.permission)continue;this.addLineItem(g,E,100,s)}}}})}initBaseRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new no.default(t)}initEscalatorRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new no.default(t)}initStraightLadderRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new no.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&!h.permission&&!p.permission&&this.addLineItem(s,c,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(!(!c||c.permission)){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g||g.permission)continue;this.addLineItem(s,p,100,this.forwardLineMap)}}}}),this.forwardRoute=new no.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e){var o;if(t.nodeId){let s=this.nodeMap.get(""+t.floor+$n+t.nodeId);if(s){let[c,h]=s.split($n);return{floor:c,id:h}}}if((o=t.coord)!=null&&o.length){let s=this.roadInfo.find(h=>h.floor===t.floor);if(!s)return null;let c=s.points.reduce((h,p)=>{if(p.relatedId)return h;let g=""+p.floor+$n+p.id;if(e==="forward"){if(!this.forwardLineMap.has(g))return h}else if(!this.lineMap.has(g))return h;let m=Dg(t.coord,p.cds);return m<h.min&&(h.min=m,h.point=p),h},{min:1/0,point:s.points[0]});return{floor:s.floor,id:c.point.id}}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+$n+t.parkingSpace);if(s)return{floor:t.floor,id:s.id}}let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(c=>+c.type_id==+t.facility).map(c=>c.id).map(c=>this.facilityMap.get(""+c)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,c){if(o===void 0&&(o=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let h=this.transformStart(t,o);if(!h)return"no-start";let p=this.transformEnd(e,o);if(!p)return"no-end";let g;switch(o){case"escalator":g=this.getEscalatorPath.bind(this);break;case"straightLadder":g=this.getStraightLadderPath.bind(this);break;case"forward":g=this.getForwardPath.bind(this);break;default:g=this.getBasePath.bind(this);break}if(p.id)return g(h,p,s,c);if(p.facility){let _=this.facilities.filter(x=>+x.type_id==+e.facility).map(x=>x.id).map(x=>this.facilityMap.get(""+x)).flat(2).filter(x=>x).filter(x=>p.floor?x.floor===p.floor:!0);if(!_.length)return null;let E=_.map(x=>g(h,{floor:x.floor,id:x.id},s,c)).filter(x=>!!x);return E.reduce((x,b)=>{let P=b[0].consume;return P<x.distance&&(x.distance=P,x.path=b),x},{distance:1/0,path:E[0]}).path}}getRoutePath(t,e,o){let s=""+t.floor+$n+t.id,c=""+e.floor+$n+e.id,h=o.path(s,c);if(!h)return null;let p=[],g=h.reduce((m,_,E,x)=>{if(E===0)return 0;let b=x[E-1],P=o.graph.get(b).get(_);return m+P},0);return h.map(m=>{let _=this.pointMap.get(m);if(_){var E;let{floor:x}=_,b=_.type;if(this.isFacilityByType(_.type)){let P=this.facilities.find(I=>I.id===+_.targetId);P&&(b=P.entry_infra_type)}if(((E=p[p.length-1])==null?void 0:E.floor)===x){let P=p[p.length-1];P.points.push(_.cds),P.pointInfos.push(_),P.endType=b,P.destId=_.nodeId,P.distance=pL(P.points)}else p.push({floor:x,points:[_.cds],pointInfos:[_],endType:b,destId:_.nodeId,distance:0,consume:g})}}),p}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let s=(0,Fs.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let c=new no.default(s);return this.getRoutePath(t,e,c)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let s=(0,Fs.cloneDeep)(this.escalatorRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",1*c],["connectionPoint",100],["straightLadder",this.lift_priority*c],["staircase",3e4*c]]));let h=new no.default(s);return this.getRoutePath(t,e,h)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let s=(0,Fs.cloneDeep)(this.straightLadderRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*c],["connectionPoint",100],["straightLadder",1*c],["staircase",3e4*c]]));let h=new no.default(s);return this.getRoutePath(t,e,h)}getForwardPath(t,e,o,s){let c=new Map,h=x=>{let b=this.forwardRoute.graph.get(g);x.forEach(P=>{let I=b.get(P);(0,Fs.isNil)(I)||(c.set(P,I),b.delete(P))})},p=()=>{let x=this.forwardRoute.graph.get(g);c.forEach((b,P)=>{x.set(P,b)})},g=""+t.floor+$n+t.id;if(!(0,Fs.isNil)(s)){let x=this.forwardLineMap.get(g),b=this.pointMap.get(g);if(b&&(x!=null&&x.size)&&x.size>1){let P=new Yn(b.cds[0],b.cds[1]),I=new Map;x.forEach((w,R)=>{let T=this.pointMap.get(R);if(T){let F=new Yn(T.cds[0],T.cds[1]),X=360-(new Yn().subVectors(F,P).angle()/Math.PI*180-90+360)%360;I.set(R,X)}});let S=Array.from(I).filter(w=>{let[R,T]=w;return Math.abs(T-s)<=60}).map(w=>{let[R]=w;return R});if(S.length)S.forEach(w=>I.delete(w)),h([...I.keys()]);else{let w=Array.from(I).reduce((R,T)=>{let F=Math.abs(T[1]-s);return F<R.diff?{diff:F,key:T[0]}:R},{diff:1/0,key:""});I.delete(w.key),h([...I.keys()])}}}if(!o){let x=this.getRoutePath(t,e,this.forwardRoute);return p(),x||this.getRoutePath(t,e,this.forwardRoute)}let m=(0,Fs.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],m,new Map([["ramp",10]]));let _=new no.default(m),E=this.getRoutePath(t,e,_);if(p(),E)return E;{let x=(0,Fs.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],x,new Map([["ramp",10]]));let b=new no.default(x);return this.getRoutePath(t,e,b)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new no.default,this.escalatorRoute=new no.default,this.straightLadderRoute=new no.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new no.default,this.escalatorRoute=new no.default,this.straightLadderRoute=new no.default,this.forwardLineMap=new Map,this.forwardRoute=new no.default}};var lxt=on(kL(),1),cxt=on(Fp(),1);function qL(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function HL(n){let t={};for(let o in n)o.startsWith("on")&&(t[qL(o.slice(2))]=n[o]);let e=o=>ec(this,null,function*(){let{data:s}=o;if(t[s.type])try{let c=yield t[s.type](s.data);self.postMessage({type:""+s.type+"_result",key:s.key,data:c})}catch(c){self.postMessage({type:""+s.type+"_result",key:s.key,error:c})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var sa=new Fg,VL,yJ=new Promise(n=>{VL=n});function WL(n,t,e){let{floor:o,coord:s}=n,c=null;return(t||[]).forEach(h=>{let p=sa.getPath({floor:o,coord:s},{floor:h.floor,parkingSpace:h.lot_id},"forward",0,e);if(!p||typeof p=="string")return;let g={floor:h.floor,spaceNo:h.lot_id,distance:p[0].consume};c||(c=g),c.distance>g.distance&&(c=g)}),c}function vJ(n,t,e,o,s){let c=WL({floor:n,coord:t},e[n],s);return c||_J(n,t,e,o,s)}function _J(n,t,e,o,s){let c=o.indexOf(n);c===-1&&(c=o.length);let h=1,p=null;for(;h<=o.length;){if(o.filter((m,_)=>_===c-1||_===c+1).forEach(m=>{let _=WL({floor:n,coord:t},e[m],s);p?_&&p.distance>_.distance&&(p=_):p=_}),p)return p;h++}return p}function xJ(n,t,e,o,s){let c=p1(n,t,t.floor,e,s);if(c)return c;let h=p1(n,t,n.floor,e,s);return h||EJ(n,t,n.floor,e,o,s)}function p1(n,t,e,o,s){let c=o[e]||[];if(!c.length)return null;let h=null;return c.forEach(p=>{let g={floor:p.floor,parkingSpace:p.lot_id},m=sa.getPath(n,g,"forward",0,s);if(!m||typeof m=="string")return;let _=sa.getParkingSpaceInfo(p.floor,p.lot_id);if(!_)return;let E=sa.getPath({floor:p.floor,coord:_.cds},t,"",0);if(!E||typeof E=="string")return;let x={floor:p.floor,spaceNo:p.lot_id,distance:E[0].consume};h?h.distance>x.distance&&(h=x):h=x}),h}function EJ(n,t,e,o,s,c){let h=s.indexOf(e);h===-1&&(h=s.length);let p=1,g=null;for(;p<=s.length;){if(s.filter((_,E)=>E===h-1||E===h+1).forEach(_=>{let E=p1(n,t,_,o,c);g?E&&g.distance>E.distance&&(g=E):g=E}),g)return g;p++}return g}function wJ(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=sa.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}return null}function SJ(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=sa.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}if(n.parkingSpace){let t=sa.getParkingSpaceInfo(n.floor,n.parkingSpace);if(t)return{floor:t.floor,coord:t.cds}}return null}HL({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;sa.initRoute(t,e),VL(!0)},onGetPath(n){let{start:t,end:e,type:o,permission:s,travelDirection:c}=n;return sa.getPath(t,e,o,s,c)},onRecommend(n){return ec(this,null,function*(){let{start:t,end:e,travelDirection:o,carLotStatus:s}=n;yield yJ;let c=s.reduce((m,_)=>(m[_.floor]?m[_.floor].push(_):m[_.floor]=[_],m),{}),h=sa.roadInfo.map(m=>m.floor),p=wJ(t);if(!p)return null;let g=e?SJ(e):null;return g?xJ(p,g,c,h,o):vJ(p.floor,p.coord,c,h,o)})},onClear(){sa.clear()}});
|
|
11570
|
-
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var q9={placeId:0,catLotStatusApi:"https://nav.aibee.cn/aether-walker/parking/cat-lot-status"},Eh=class{setRoadData(t,e){return Wt(this.worker,"set_road_data",{roadData:t,facilities:e})}recommend(t){return j(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(n=>n.json()).then(n=>n.data.filter(i=>i.status===0));return Wt(this.worker,"recommend",T({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=Yh(),this.options=T({},q9,t)}};var Dh=class extends Fa{showMyPosition(t,e){let n=this.getGraphicByNodeId(t);if(n){let i=new er(this.context,{autoUpdate:!0,appendToBody:!0});i.div.appendChild(e),i.bindElement(n),this.myPositionOverlay=i}}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40]}),t.map(i=>this.getPoiById(i)).filter(i=>!!i).forEach(i=>{var o;(o=i.userData).restore||(o.restore={});for(let u in e)if(u in i.options){var s,a;(s=i.userData.restore)[a=u]||(s[a]=i.options[u]),i.options[u]=e[u]}})}restorePoi(t){t.map(n=>this.getPoiById(n)).filter(n=>!!n).forEach(n=>{console.log("poi.userData.restore",n.userData.restore);for(let i in n.userData.restore)i in n.options&&(n.options[i]=n.userData.restore[i]);n.userData.restore={}})}dispose(){this.hideMyPosition(),super.dispose()}constructor(...t){super(...t),this.myPositionOverlay=null}};
|
|
11570
|
+
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var q9={placeId:0,catLotStatusApi:"https://nav.aibee.cn/aether-walker/parking/cat-lot-status"},Eh=class{setRoadData(t,e){return Wt(this.worker,"set_road_data",{roadData:t,facilities:e})}recommend(t){return j(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(n=>n.json()).then(n=>n.data.filter(i=>i.status===0));return Wt(this.worker,"recommend",T({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=Yh(),this.options=T({},q9,t)}};var Dh=class extends Fa{showMyPosition(t,e){let n=this.getGraphicByNodeId(t);if(n){let i=new er(this.context,{autoUpdate:!0,appendToBody:!0});i.div.appendChild(e),i.bindElement(n),this.myPositionOverlay=i}}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40],collision_enable:!1}),t.map(i=>this.getPoiById(i)).filter(i=>!!i).forEach(i=>{var o;(o=i.userData).restore||(o.restore={});for(let u in e)if(u in i.options){var s,a;(s=i.userData.restore)[a=u]||(s[a]=i.options[u]),i.options[u]=e[u]}})}restorePoi(t){t.map(n=>this.getPoiById(n)).filter(n=>!!n).forEach(n=>{console.log("poi.userData.restore",n.userData.restore);for(let i in n.userData.restore)i in n.options&&(n.options[i]=n.userData.restore[i]);n.userData.restore={}})}dispose(){this.hideMyPosition(),super.dispose()}constructor(...t){super(...t),this.myPositionOverlay=null}};
|
|
@@ -23265,7 +23265,8 @@ var BMap2 = class extends BMap {
|
|
|
23265
23265
|
icon_size: [
|
|
23266
23266
|
40,
|
|
23267
23267
|
40
|
|
23268
|
-
]
|
|
23268
|
+
],
|
|
23269
|
+
collision_enable: false
|
|
23269
23270
|
};
|
|
23270
23271
|
const pois = nodeIds.map((id) => this.getPoiById(id)).filter((poi) => !!poi);
|
|
23271
23272
|
pois.forEach((poi) => {
|
|
@@ -11567,4 +11567,4 @@ void main() {
|
|
|
11567
11567
|
|
|
11568
11568
|
}\`,Ky=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let s=new Ds,c=t.properties.get(s);c.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,s=new Ca({extensions:{fragDepth:!0},vertexShader:VW,fragmentShader:WW,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new ea(new bd(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},jy=class extends Yu{constructor(t,e){super();let o=this,s=null,c=1,h=null,p="local-floor",g=1,m=null,_=null,E=null,x=null,b=null,P=null,I=new Ky,S=e.getContextAttributes(),w=null,R=null,T=[],F=[],W=new Yn,X=null,q=new ps;q.layers.enable(1),q.viewport=new Ki;let D=new ps;D.layers.enable(2),D.viewport=new Ki;let xt=[q,D],B=new Jy;B.layers.enable(1),B.layers.enable(2);let j=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getTargetRaySpace()},this.getControllerGrip=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getGripSpace()},this.getHand=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getHandSpace()};function Dt(at){let Ut=F.indexOf(at.inputSource);if(Ut===-1)return;let jt=T[Ut];jt!==void 0&&(jt.update(at.inputSource,at.frame,m||h),jt.dispatchEvent({type:at.type,data:at.inputSource}))}function Q(){s.removeEventListener("select",Dt),s.removeEventListener("selectstart",Dt),s.removeEventListener("selectend",Dt),s.removeEventListener("squeeze",Dt),s.removeEventListener("squeezestart",Dt),s.removeEventListener("squeezeend",Dt),s.removeEventListener("end",Q),s.removeEventListener("inputsourceschange",At);for(let at=0;at<T.length;at++){let Ut=F[at];Ut!==null&&(F[at]=null,T[at].disconnect(Ut))}j=null,J=null,I.reset(),t.setRenderTarget(w),b=null,x=null,E=null,s=null,R=null,ae.stop(),o.isPresenting=!1,t.setPixelRatio(X),t.setSize(W.width,W.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(at){c=at,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(at){p=at,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return m||h},this.setReferenceSpace=function(at){m=at},this.getBaseLayer=function(){return x!==null?x:b},this.getBinding=function(){return E},this.getFrame=function(){return P},this.getSession=function(){return s},this.setSession=function(at){return ec(this,null,function*(){if(s=at,s!==null){if(w=t.getRenderTarget(),s.addEventListener("select",Dt),s.addEventListener("selectstart",Dt),s.addEventListener("selectend",Dt),s.addEventListener("squeeze",Dt),s.addEventListener("squeezestart",Dt),s.addEventListener("squeezeend",Dt),s.addEventListener("end",Q),s.addEventListener("inputsourceschange",At),S.xrCompatible!==!0&&(yield e.makeXRCompatible()),X=t.getPixelRatio(),t.getSize(W),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let Ut={antialias:s.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:c};b=new XRWebGLLayer(s,e,Ut),s.updateRenderState({baseLayer:b}),t.setPixelRatio(1),t.setSize(b.framebufferWidth,b.framebufferHeight,!1),R=new hu(b.framebufferWidth,b.framebufferHeight,{format:ta,type:Wu,colorSpace:t.outputColorSpace,stencilBuffer:S.stencil})}else{let Ut=null,jt=null,ce=null;S.depth&&(ce=S.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Ut=S.stencil?Uc:Pl,jt=S.stencil?Cl:qu);let te={colorFormat:e.RGBA8,depthFormat:ce,scaleFactor:c};E=new XRWebGLBinding(s,e),x=E.createProjectionLayer(te),s.updateRenderState({layers:[x]}),t.setPixelRatio(1),t.setSize(x.textureWidth,x.textureHeight,!1),R=new hu(x.textureWidth,x.textureHeight,{format:ta,type:Wu,depthTexture:new Td(x.textureWidth,x.textureHeight,jt,void 0,void 0,void 0,void 0,void 0,void 0,Ut),stencilBuffer:S.stencil,colorSpace:t.outputColorSpace,samples:S.antialias?4:0});let $t=t.properties.get(R);$t.__ignoreDepthValues=x.ignoreDepthValues}R.isXRRenderTarget=!0,this.setFoveation(g),m=null,h=yield s.requestReferenceSpace(p),ae.setContext(s),ae.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function At(at){for(let Ut=0;Ut<at.removed.length;Ut++){let jt=at.removed[Ut],ce=F.indexOf(jt);ce>=0&&(F[ce]=null,T[ce].disconnect(jt))}for(let Ut=0;Ut<at.added.length;Ut++){let jt=at.added[Ut],ce=F.indexOf(jt);if(ce===-1){for(let $t=0;$t<T.length;$t++)if($t>=F.length){F.push(jt),ce=$t;break}else if(F[$t]===null){F[$t]=jt,ce=$t;break}if(ce===-1)break}let te=T[ce];te&&te.connect(jt)}}let Mt=new Lt,Rt=new Lt;function pt(at,Ut,jt){Mt.setFromMatrixPosition(Ut.matrixWorld),Rt.setFromMatrixPosition(jt.matrixWorld);let ce=Mt.distanceTo(Rt),te=Ut.projectionMatrix.elements,$t=jt.projectionMatrix.elements,qt=te[14]/(te[10]-1),xe=te[14]/(te[10]+1),ft=(te[9]+1)/te[5],We=(te[9]-1)/te[5],ee=(te[8]-1)/te[0],ge=($t[8]+1)/$t[0],fe=qt*ee,Te=qt*ge,be=ce/(-ee+ge),Wt=be*-ee;Ut.matrixWorld.decompose(at.position,at.quaternion,at.scale),at.translateX(Wt),at.translateZ(be),at.matrixWorld.compose(at.position,at.quaternion,at.scale),at.matrixWorldInverse.copy(at.matrixWorld).invert();let Me=qt+be,tt=xe+be,z=fe-Wt,Pt=Te+(ce-Wt),Ot=ft*xe/tt*Me,dt=We*xe/tt*Me;at.projectionMatrix.makePerspective(z,Pt,Ot,dt,Me,tt),at.projectionMatrixInverse.copy(at.projectionMatrix).invert()}function yt(at,Ut){Ut===null?at.matrixWorld.copy(at.matrix):at.matrixWorld.multiplyMatrices(Ut.matrixWorld,at.matrix),at.matrixWorldInverse.copy(at.matrixWorld).invert()}this.updateCamera=function(at){if(s===null)return;I.texture!==null&&(at.near=I.depthNear,at.far=I.depthFar),B.near=D.near=q.near=at.near,B.far=D.far=q.far=at.far,(j!==B.near||J!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),j=B.near,J=B.far,q.near=j,q.far=J,D.near=j,D.far=J,q.updateProjectionMatrix(),D.updateProjectionMatrix(),at.updateProjectionMatrix());let Ut=at.parent,jt=B.cameras;yt(B,Ut);for(let ce=0;ce<jt.length;ce++)yt(jt[ce],Ut);jt.length===2?pt(B,q,D):B.projectionMatrix.copy(q.projectionMatrix),K(at,B,Ut)};function K(at,Ut,jt){jt===null?at.matrix.copy(Ut.matrixWorld):(at.matrix.copy(jt.matrixWorld),at.matrix.invert(),at.matrix.multiply(Ut.matrixWorld)),at.matrix.decompose(at.position,at.quaternion,at.scale),at.updateMatrixWorld(!0),at.projectionMatrix.copy(Ut.projectionMatrix),at.projectionMatrixInverse.copy(Ut.projectionMatrixInverse),at.isPerspectiveCamera&&(at.fov=Oy*2*Math.atan(1/at.projectionMatrix.elements[5]),at.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(x===null&&b===null))return g},this.setFoveation=function(at){g=at,x!==null&&(x.fixedFoveation=at),b!==null&&b.fixedFoveation!==void 0&&(b.fixedFoveation=at)},this.hasDepthSensing=function(){return I.texture!==null};let Bt=null;function Gt(at,Ut){if(_=Ut.getViewerPose(m||h),P=Ut,_!==null){let jt=_.views;b!==null&&(t.setRenderTargetFramebuffer(R,b.framebuffer),t.setRenderTarget(R));let ce=!1;jt.length!==B.cameras.length&&(B.cameras.length=0,ce=!0);for(let $t=0;$t<jt.length;$t++){let qt=jt[$t],xe=null;if(b!==null)xe=b.getViewport(qt);else{let We=E.getViewSubImage(x,qt);xe=We.viewport,$t===0&&(t.setRenderTargetTextures(R,We.colorTexture,x.ignoreDepthValues?void 0:We.depthStencilTexture),t.setRenderTarget(R))}let ft=xt[$t];ft===void 0&&(ft=new ps,ft.layers.enable($t),ft.viewport=new Ki,xt[$t]=ft),ft.matrix.fromArray(qt.transform.matrix),ft.matrix.decompose(ft.position,ft.quaternion,ft.scale),ft.projectionMatrix.fromArray(qt.projectionMatrix),ft.projectionMatrixInverse.copy(ft.projectionMatrix).invert(),ft.viewport.set(xe.x,xe.y,xe.width,xe.height),$t===0&&(B.matrix.copy(ft.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),ce===!0&&B.cameras.push(ft)}let te=s.enabledFeatures;if(te&&te.includes("depth-sensing")){let $t=E.getDepthInformation(jt[0]);$t&&$t.isValid&&$t.texture&&I.init(t,$t,s.renderState)}}for(let jt=0;jt<T.length;jt++){let ce=F[jt],te=T[jt];ce!==null&&te!==void 0&&te.update(ce,Ut,m||h)}I.render(t,B),Bt&&Bt(at,Ut),Ut.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:Ut}),P=null}let ae=new WT;ae.setAnimationLoop(Gt),this.setAnimationLoop=function(at){Bt=at},this.dispose=function(){}}},Sl=new Rl,XW=new Ui;function YW(n,t){function e(S,w){S.matrixAutoUpdate===!0&&S.updateMatrix(),w.value.copy(S.matrix)}function o(S,w){w.color.getRGB(S.fogColor.value,VT(n)),w.isFog?(S.fogNear.value=w.near,S.fogFar.value=w.far):w.isFogExp2&&(S.fogDensity.value=w.density)}function s(S,w,R,T,F){w.isMeshBasicMaterial||w.isMeshLambertMaterial?c(S,w):w.isMeshToonMaterial?(c(S,w),E(S,w)):w.isMeshPhongMaterial?(c(S,w),_(S,w)):w.isMeshStandardMaterial?(c(S,w),x(S,w),w.isMeshPhysicalMaterial&&b(S,w,F)):w.isMeshMatcapMaterial?(c(S,w),P(S,w)):w.isMeshDepthMaterial?c(S,w):w.isMeshDistanceMaterial?(c(S,w),I(S,w)):w.isMeshNormalMaterial?c(S,w):w.isLineBasicMaterial?(h(S,w),w.isLineDashedMaterial&&p(S,w)):w.isPointsMaterial?g(S,w,R,T):w.isSpriteMaterial?m(S,w):w.isShadowMaterial?(S.color.value.copy(w.color),S.opacity.value=w.opacity):w.isShaderMaterial&&(w.uniformsNeedUpdate=!1)}function c(S,w){S.opacity.value=w.opacity,w.color&&S.diffuse.value.copy(w.color),w.emissive&&S.emissive.value.copy(w.emissive).multiplyScalar(w.emissiveIntensity),w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.bumpMap&&(S.bumpMap.value=w.bumpMap,e(w.bumpMap,S.bumpMapTransform),S.bumpScale.value=w.bumpScale,w.side===Yo&&(S.bumpScale.value*=-1)),w.normalMap&&(S.normalMap.value=w.normalMap,e(w.normalMap,S.normalMapTransform),S.normalScale.value.copy(w.normalScale),w.side===Yo&&S.normalScale.value.negate()),w.displacementMap&&(S.displacementMap.value=w.displacementMap,e(w.displacementMap,S.displacementMapTransform),S.displacementScale.value=w.displacementScale,S.displacementBias.value=w.displacementBias),w.emissiveMap&&(S.emissiveMap.value=w.emissiveMap,e(w.emissiveMap,S.emissiveMapTransform)),w.specularMap&&(S.specularMap.value=w.specularMap,e(w.specularMap,S.specularMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest);let R=t.get(w),T=R.envMap,F=R.envMapRotation;if(T&&(S.envMap.value=T,Sl.copy(F),Sl.x*=-1,Sl.y*=-1,Sl.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Sl.y*=-1,Sl.z*=-1),S.envMapRotation.value.setFromMatrix4(XW.makeRotationFromEuler(Sl)),S.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=w.reflectivity,S.ior.value=w.ior,S.refractionRatio.value=w.refractionRatio),w.lightMap){S.lightMap.value=w.lightMap;let W=n._useLegacyLights===!0?Math.PI:1;S.lightMapIntensity.value=w.lightMapIntensity*W,e(w.lightMap,S.lightMapTransform)}w.aoMap&&(S.aoMap.value=w.aoMap,S.aoMapIntensity.value=w.aoMapIntensity,e(w.aoMap,S.aoMapTransform))}function h(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform))}function p(S,w){S.dashSize.value=w.dashSize,S.totalSize.value=w.dashSize+w.gapSize,S.scale.value=w.scale}function g(S,w,R,T){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.size.value=w.size*R,S.scale.value=T*.5,w.map&&(S.map.value=w.map,e(w.map,S.uvTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function m(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.rotation.value=w.rotation,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function _(S,w){S.specular.value.copy(w.specular),S.shininess.value=Math.max(w.shininess,1e-4)}function E(S,w){w.gradientMap&&(S.gradientMap.value=w.gradientMap)}function x(S,w){S.metalness.value=w.metalness,w.metalnessMap&&(S.metalnessMap.value=w.metalnessMap,e(w.metalnessMap,S.metalnessMapTransform)),S.roughness.value=w.roughness,w.roughnessMap&&(S.roughnessMap.value=w.roughnessMap,e(w.roughnessMap,S.roughnessMapTransform)),t.get(w).envMap&&(S.envMapIntensity.value=w.envMapIntensity)}function b(S,w,R){S.ior.value=w.ior,w.sheen>0&&(S.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),S.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(S.sheenColorMap.value=w.sheenColorMap,e(w.sheenColorMap,S.sheenColorMapTransform)),w.sheenRoughnessMap&&(S.sheenRoughnessMap.value=w.sheenRoughnessMap,e(w.sheenRoughnessMap,S.sheenRoughnessMapTransform))),w.clearcoat>0&&(S.clearcoat.value=w.clearcoat,S.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(S.clearcoatMap.value=w.clearcoatMap,e(w.clearcoatMap,S.clearcoatMapTransform)),w.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap,e(w.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),w.clearcoatNormalMap&&(S.clearcoatNormalMap.value=w.clearcoatNormalMap,e(w.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),w.side===Yo&&S.clearcoatNormalScale.value.negate())),w.iridescence>0&&(S.iridescence.value=w.iridescence,S.iridescenceIOR.value=w.iridescenceIOR,S.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(S.iridescenceMap.value=w.iridescenceMap,e(w.iridescenceMap,S.iridescenceMapTransform)),w.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=w.iridescenceThicknessMap,e(w.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),w.transmission>0&&(S.transmission.value=w.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),w.transmissionMap&&(S.transmissionMap.value=w.transmissionMap,e(w.transmissionMap,S.transmissionMapTransform)),S.thickness.value=w.thickness,w.thicknessMap&&(S.thicknessMap.value=w.thicknessMap,e(w.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=w.attenuationDistance,S.attenuationColor.value.copy(w.attenuationColor)),w.anisotropy>0&&(S.anisotropyVector.value.set(w.anisotropy*Math.cos(w.anisotropyRotation),w.anisotropy*Math.sin(w.anisotropyRotation)),w.anisotropyMap&&(S.anisotropyMap.value=w.anisotropyMap,e(w.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=w.specularIntensity,S.specularColor.value.copy(w.specularColor),w.specularColorMap&&(S.specularColorMap.value=w.specularColorMap,e(w.specularColorMap,S.specularColorMapTransform)),w.specularIntensityMap&&(S.specularIntensityMap.value=w.specularIntensityMap,e(w.specularIntensityMap,S.specularIntensityMapTransform))}function P(S,w){w.matcap&&(S.matcap.value=w.matcap)}function I(S,w){let R=t.get(w).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:s}}function $W(n,t,e,o){let s={},c={},h=[],p=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function g(R,T){let F=T.program;o.uniformBlockBinding(R,F)}function m(R,T){let F=s[R.id];F===void 0&&(P(R),F=_(R),s[R.id]=F,R.addEventListener("dispose",S));let W=T.program;o.updateUBOMapping(R,W);let X=t.render.frame;c[R.id]!==X&&(x(R),c[R.id]=X)}function _(R){let T=E();R.__bindingPointIndex=T;let F=n.createBuffer(),W=R.__size,X=R.usage;return n.bindBuffer(n.UNIFORM_BUFFER,F),n.bufferData(n.UNIFORM_BUFFER,W,X),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,T,F),F}function E(){for(let R=0;R<p;R++)if(h.indexOf(R)===-1)return h.push(R),R;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function x(R){let T=s[R.id],F=R.uniforms,W=R.__cache;n.bindBuffer(n.UNIFORM_BUFFER,T);for(let X=0,q=F.length;X<q;X++){let D=Array.isArray(F[X])?F[X]:[F[X]];for(let xt=0,B=D.length;xt<B;xt++){let j=D[xt];if(b(j,X,xt,W)===!0){let J=j.__offset,Dt=Array.isArray(j.value)?j.value:[j.value],Q=0;for(let At=0;At<Dt.length;At++){let Mt=Dt[At],Rt=I(Mt);typeof Mt=="number"||typeof Mt=="boolean"?(j.__data[0]=Mt,n.bufferSubData(n.UNIFORM_BUFFER,J+Q,j.__data)):Mt.isMatrix3?(j.__data[0]=Mt.elements[0],j.__data[1]=Mt.elements[1],j.__data[2]=Mt.elements[2],j.__data[3]=0,j.__data[4]=Mt.elements[3],j.__data[5]=Mt.elements[4],j.__data[6]=Mt.elements[5],j.__data[7]=0,j.__data[8]=Mt.elements[6],j.__data[9]=Mt.elements[7],j.__data[10]=Mt.elements[8],j.__data[11]=0):(Mt.toArray(j.__data,Q),Q+=Rt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,J,j.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function b(R,T,F,W){let X=R.value,q=T+"_"+F;if(W[q]===void 0)return typeof X=="number"||typeof X=="boolean"?W[q]=X:W[q]=X.clone(),!0;{let D=W[q];if(typeof X=="number"||typeof X=="boolean"){if(D!==X)return W[q]=X,!0}else if(D.equals(X)===!1)return D.copy(X),!0}return!1}function P(R){let T=R.uniforms,F=0,W=16;for(let q=0,D=T.length;q<D;q++){let xt=Array.isArray(T[q])?T[q]:[T[q]];for(let B=0,j=xt.length;B<j;B++){let J=xt[B],Dt=Array.isArray(J.value)?J.value:[J.value];for(let Q=0,At=Dt.length;Q<At;Q++){let Mt=Dt[Q],Rt=I(Mt),pt=F%W;pt!==0&&W-pt<Rt.boundary&&(F+=W-pt),J.__data=new Float32Array(Rt.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=F,F+=Rt.storage}}}let X=F%W;return X>0&&(F+=W-X),R.__size=F,R.__cache={},this}function I(R){let T={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(T.boundary=4,T.storage=4):R.isVector2?(T.boundary=8,T.storage=8):R.isVector3||R.isColor?(T.boundary=16,T.storage=12):R.isVector4?(T.boundary=16,T.storage=16):R.isMatrix3?(T.boundary=48,T.storage=48):R.isMatrix4?(T.boundary=64,T.storage=64):R.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",R),T}function S(R){let T=R.target;T.removeEventListener("dispose",S);let F=h.indexOf(T.__bindingPointIndex);h.splice(F,1),n.deleteBuffer(s[T.id]),delete s[T.id],delete c[T.id]}function w(){for(let R in s)n.deleteBuffer(s[R]);h=[],s={},c={}}return{bind:g,update:m,dispose:w}}var Qy=class{constructor(t={}){let{canvas:e=K5(),context:o=null,depth:s=!0,stencil:c=!0,alpha:h=!1,antialias:p=!1,premultipliedAlpha:g=!0,preserveDrawingBuffer:m=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:E=!1}=t;this.isWebGLRenderer=!0;let x;o!==null?x=o.getContextAttributes().alpha:x=h;let b=new Uint32Array(4),P=new Int32Array(4),I=null,S=null,w=[],R=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ba,this._useLegacyLights=!1,this.toneMapping=Vu,this.toneMappingExposure=1;let T=this,F=!1,W=0,X=0,q=null,D=-1,xt=null,B=new Ki,j=new Ki,J=null,Dt=new hr(0),Q=0,At=e.width,Mt=e.height,Rt=1,pt=null,yt=null,K=new Ki(0,0,At,Mt),Bt=new Ki(0,0,At,Mt),Gt=!1,ae=new Md,at=!1,Ut=!1,jt=null,ce=new Ui,te=new Yn,$t=new Lt,qt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return q===null?Rt:1}let ft=o;function We(Z,mt){for(let It=0;It<Z.length;It++){let St=Z[It],vt=e.getContext(St,mt);if(vt!==null)return vt}return null}try{let Z={alpha:!0,depth:s,stencil:c,antialias:p,premultipliedAlpha:g,preserveDrawingBuffer:m,powerPreference:_,failIfMajorPerformanceCaveat:E};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${fv}\`),e.addEventListener("webglcontextlost",Et,!1),e.addEventListener("webglcontextrestored",G,!1),e.addEventListener("webglcontextcreationerror",ot,!1),ft===null){let mt=["webgl2","webgl","experimental-webgl"];if(T.isWebGL1Renderer===!0&&mt.shift(),ft=We(mt,Z),ft===null)throw We(mt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&ft instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ft.getShaderPrecisionFormat===void 0&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Z){throw console.error("THREE.WebGLRenderer: "+Z.message),Z}let ee,ge,fe,Te,be,Wt,Me,tt,z,Pt,Ot,dt,Ht,Ce,Vt,Zt,ne,rt,C,N,k,$,V,ht;function st(){ee=new c8(ft),ge=new i8(ft,ee,t),ee.init(ge),$=new qW(ft,ee,ge),fe=new GW(ft,ee,ge),Te=new p8(ft),be=new CW,Wt=new kW(ft,ee,fe,be,ge,$,Te),Me=new s8(T),tt=new l8(T),z=new _H(ft,ge),V=new n8(ft,ee,z,ge),Pt=new f8(ft,z,Te,V),Ot=new y8(ft,Pt,z,Te),C=new m8(ft,ge,Wt),Zt=new o8(be),dt=new TW(T,Me,tt,ee,ge,V,Zt),Ht=new YW(T,be),Ce=new IW,Vt=new FW(ee,ge),rt=new e8(T,Me,tt,fe,Ot,x,g),ne=new zW(T,Ot,ge),ht=new $W(ft,Te,ge,fe),N=new r8(ft,ee,Te,ge),k=new h8(ft,ee,Te,ge),Te.programs=dt.programs,T.capabilities=ge,T.extensions=ee,T.properties=be,T.renderLists=Ce,T.shadowMap=ne,T.state=fe,T.info=Te}st();let wt=new jy(T,ft);this.xr=wt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return Rt},this.setPixelRatio=function(Z){Z!==void 0&&(Rt=Z,this.setSize(At,Mt,!1))},this.getSize=function(Z){return Z.set(At,Mt)},this.setSize=function(Z,mt,It=!0){if(wt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}At=Z,Mt=mt,e.width=Math.floor(Z*Rt),e.height=Math.floor(mt*Rt),It===!0&&(e.style.width=Z+"px",e.style.height=mt+"px"),this.setViewport(0,0,Z,mt)},this.getDrawingBufferSize=function(Z){return Z.set(At*Rt,Mt*Rt).floor()},this.setDrawingBufferSize=function(Z,mt,It){At=Z,Mt=mt,Rt=It,e.width=Math.floor(Z*It),e.height=Math.floor(mt*It),this.setViewport(0,0,Z,mt)},this.getCurrentViewport=function(Z){return Z.copy(B)},this.getViewport=function(Z){return Z.copy(K)},this.setViewport=function(Z,mt,It,St){Z.isVector4?K.set(Z.x,Z.y,Z.z,Z.w):K.set(Z,mt,It,St),fe.viewport(B.copy(K).multiplyScalar(Rt).round())},this.getScissor=function(Z){return Z.copy(Bt)},this.setScissor=function(Z,mt,It,St){Z.isVector4?Bt.set(Z.x,Z.y,Z.z,Z.w):Bt.set(Z,mt,It,St),fe.scissor(j.copy(Bt).multiplyScalar(Rt).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(Z){fe.setScissorTest(Gt=Z)},this.setOpaqueSort=function(Z){pt=Z},this.setTransparentSort=function(Z){yt=Z},this.getClearColor=function(Z){return Z.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor.apply(rt,arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha.apply(rt,arguments)},this.clear=function(Z=!0,mt=!0,It=!0){let St=0;if(Z){let vt=!1;if(q!==null){let he=q.texture.format;vt=he===zT||he===BT||he===UT}if(vt){let he=q.texture.type,ue=he===Wu||he===qu||he===hv||he===Cl||he===DT||he===FT,we=rt.getClearColor(),de=rt.getClearAlpha(),Be=we.r,Ae=we.g,Pe=we.b;ue?(b[0]=Be,b[1]=Ae,b[2]=Pe,b[3]=de,ft.clearBufferuiv(ft.COLOR,0,b)):(P[0]=Be,P[1]=Ae,P[2]=Pe,P[3]=de,ft.clearBufferiv(ft.COLOR,0,P))}else St|=ft.COLOR_BUFFER_BIT}mt&&(St|=ft.DEPTH_BUFFER_BIT),It&&(St|=ft.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ft.clear(St)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Et,!1),e.removeEventListener("webglcontextrestored",G,!1),e.removeEventListener("webglcontextcreationerror",ot,!1),Ce.dispose(),Vt.dispose(),be.dispose(),Me.dispose(),tt.dispose(),Ot.dispose(),V.dispose(),ht.dispose(),dt.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",qe),wt.removeEventListener("sessionend",Ue),jt&&(jt.dispose(),jt=null),Xe.stop()};function Et(Z){Z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),F=!0}function G(){console.log("THREE.WebGLRenderer: Context Restored."),F=!1;let Z=Te.autoReset,mt=ne.enabled,It=ne.autoUpdate,St=ne.needsUpdate,vt=ne.type;st(),Te.autoReset=Z,ne.enabled=mt,ne.autoUpdate=It,ne.needsUpdate=St,ne.type=vt}function ot(Z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function et(Z){let mt=Z.target;mt.removeEventListener("dispose",et),ut(mt)}function ut(Z){Ft(Z),be.remove(Z)}function Ft(Z){let mt=be.get(Z).programs;mt!==void 0&&(mt.forEach(function(It){dt.releaseProgram(It)}),Z.isShaderMaterial&&dt.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,mt,It,St,vt,he){mt===null&&(mt=qt);let ue=vt.isMesh&&vt.matrixWorld.determinant()<0,we=Qn(Z,mt,It,St,vt);fe.setMaterial(St,ue);let de=It.index,Be=1;if(St.wireframe===!0){if(de=Pt.getWireframeAttribute(It),de===void 0)return;Be=2}let Ae=It.drawRange,Pe=It.attributes.position,tn=Ae.start*Be,oi=(Ae.start+Ae.count)*Be;he!==null&&(tn=Math.max(tn,he.start*Be),oi=Math.min(oi,(he.start+he.count)*Be)),de!==null?(tn=Math.max(tn,0),oi=Math.min(oi,de.count)):Pe!=null&&(tn=Math.max(tn,0),oi=Math.min(oi,Pe.count));let Mr=oi-tn;if(Mr<0||Mr===1/0)return;V.setup(vt,St,we,It,de);let Hi,sr=N;if(de!==null&&(Hi=z.get(de),sr=k,sr.setIndex(Hi)),vt.isMesh)St.wireframe===!0?(fe.setLineWidth(St.wireframeLinewidth*xe()),sr.setMode(ft.LINES)):sr.setMode(ft.TRIANGLES);else if(vt.isLine){let ye=St.linewidth;ye===void 0&&(ye=1),fe.setLineWidth(ye*xe()),vt.isLineSegments?sr.setMode(ft.LINES):vt.isLineLoop?sr.setMode(ft.LINE_LOOP):sr.setMode(ft.LINE_STRIP)}else vt.isPoints?sr.setMode(ft.POINTS):vt.isSprite&&sr.setMode(ft.TRIANGLES);if(vt.isBatchedMesh)sr.renderMultiDraw(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount);else if(vt.isInstancedMesh)sr.renderInstances(tn,Mr,vt.count);else if(It.isInstancedBufferGeometry){let ye=It._maxInstanceCount!==void 0?It._maxInstanceCount:1/0,Da=Math.min(It.instanceCount,ye);sr.renderInstances(tn,Mr,Da)}else sr.render(tn,Mr)};function Kt(Z,mt,It){Z.transparent===!0&&Z.side===uu&&Z.forceSinglePass===!1?(Z.side=Yo,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=Xu,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=uu):rr(Z,mt,It)}this.compile=function(Z,mt,It=null){It===null&&(It=Z),S=Vt.get(It),S.init(),R.push(S),It.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),Z!==It&&Z.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),S.setupLights(T._useLegacyLights);let St=new Set;return Z.traverse(function(vt){let he=vt.material;if(he)if(Array.isArray(he))for(let ue=0;ue<he.length;ue++){let we=he[ue];Kt(we,It,vt),St.add(we)}else Kt(he,It,vt),St.add(he)}),R.pop(),S=null,St},this.compileAsync=function(Z,mt,It=null){let St=this.compile(Z,mt,It);return new Promise(vt=>{function he(){if(St.forEach(function(ue){be.get(ue).currentProgram.isReady()&&St.delete(ue)}),St.size===0){vt(Z);return}setTimeout(he,10)}ee.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let me=null;function ve(Z){me&&me(Z)}function qe(){Xe.stop()}function Ue(){Xe.start()}let Xe=new WT;Xe.setAnimationLoop(ve),typeof self!="undefined"&&Xe.setContext(self),this.setAnimationLoop=function(Z){me=Z,wt.setAnimationLoop(Z),Z===null?Xe.stop():Xe.start()},wt.addEventListener("sessionstart",qe),wt.addEventListener("sessionend",Ue),this.render=function(Z,mt){if(mt!==void 0&&mt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),mt.parent===null&&mt.matrixWorldAutoUpdate===!0&&mt.updateMatrixWorld(),wt.enabled===!0&&wt.isPresenting===!0&&(wt.cameraAutoUpdate===!0&&wt.updateCamera(mt),mt=wt.getCamera()),Z.isScene===!0&&Z.onBeforeRender(T,Z,mt,q),S=Vt.get(Z,R.length),S.init(),R.push(S),ce.multiplyMatrices(mt.projectionMatrix,mt.matrixWorldInverse),ae.setFromProjectionMatrix(ce),Ut=this.localClippingEnabled,at=Zt.init(this.clippingPlanes,Ut),I=Ce.get(Z,w.length),I.init(),w.push(I),Ze(Z,mt,0,T.sortObjects),I.finish(),T.sortObjects===!0&&I.sort(pt,yt),this.info.render.frame++,at===!0&&Zt.beginShadows();let It=S.state.shadowsArray;if(ne.render(It,Z,mt),at===!0&&Zt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(wt.enabled===!1||wt.isPresenting===!1||wt.hasDepthSensing()===!1)&&rt.render(I,Z),S.setupLights(T._useLegacyLights),mt.isArrayCamera){let St=mt.cameras;for(let vt=0,he=St.length;vt<he;vt++){let ue=St[vt];Er(I,Z,ue,ue.viewport)}}else Er(I,Z,mt);q!==null&&(Wt.updateMultisampleRenderTarget(q),Wt.updateRenderTargetMipmap(q)),Z.isScene===!0&&Z.onAfterRender(T,Z,mt),V.resetDefaultState(),D=-1,xt=null,R.pop(),R.length>0?S=R[R.length-1]:S=null,w.pop(),w.length>0?I=w[w.length-1]:I=null};function Ze(Z,mt,It,St){if(Z.visible===!1)return;if(Z.layers.test(mt.layers)){if(Z.isGroup)It=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(mt);else if(Z.isLight)S.pushLight(Z),Z.castShadow&&S.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||ae.intersectsSprite(Z)){St&&$t.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(ce);let ue=Ot.update(Z),we=Z.material;we.visible&&I.push(Z,ue,we,It,$t.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||ae.intersectsObject(Z))){let ue=Ot.update(Z),we=Z.material;if(St&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),$t.copy(Z.boundingSphere.center)):(ue.boundingSphere===null&&ue.computeBoundingSphere(),$t.copy(ue.boundingSphere.center)),$t.applyMatrix4(Z.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){let de=ue.groups;for(let Be=0,Ae=de.length;Be<Ae;Be++){let Pe=de[Be],tn=we[Pe.materialIndex];tn&&tn.visible&&I.push(Z,ue,tn,It,$t.z,Pe)}}else we.visible&&I.push(Z,ue,we,It,$t.z,null)}}let he=Z.children;for(let ue=0,we=he.length;ue<we;ue++)Ze(he[ue],mt,It,St)}function Er(Z,mt,It,St){let vt=Z.opaque,he=Z.transmissive,ue=Z.transparent;S.setupLightsView(It),at===!0&&Zt.setGlobalState(T.clippingPlanes,It),he.length>0&&Zr(vt,he,mt,It),St&&fe.viewport(B.copy(St)),vt.length>0&&nr(vt,mt,It),he.length>0&&nr(he,mt,It),ue.length>0&&nr(ue,mt,It),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1)}function Zr(Z,mt,It,St){if((It.isScene===!0?It.overrideMaterial:null)!==null)return;let he=ge.isWebGL2;jt===null&&(jt=new hu(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")?Kf:Wu,minFilter:Tl,samples:he?4:0})),T.getDrawingBufferSize(te),he?jt.setSize(te.x,te.y):jt.setSize(Dy(te.x),Dy(te.y));let ue=T.getRenderTarget();T.setRenderTarget(jt),T.getClearColor(Dt),Q=T.getClearAlpha(),Q<1&&T.setClearColor(16777215,.5),T.clear();let we=T.toneMapping;T.toneMapping=Vu,nr(Z,It,St),Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt);let de=!1;for(let Be=0,Ae=mt.length;Be<Ae;Be++){let Pe=mt[Be],tn=Pe.object,oi=Pe.geometry,Mr=Pe.material,Hi=Pe.group;if(Mr.side===uu&&tn.layers.test(St.layers)){let sr=Mr.side;Mr.side=Yo,Mr.needsUpdate=!0,Ie(tn,It,St,oi,Mr,Hi),Mr.side=sr,Mr.needsUpdate=!0,de=!0}}de===!0&&(Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt)),T.setRenderTarget(ue),T.setClearColor(Dt,Q),T.toneMapping=we}function nr(Z,mt,It){let St=mt.isScene===!0?mt.overrideMaterial:null;for(let vt=0,he=Z.length;vt<he;vt++){let ue=Z[vt],we=ue.object,de=ue.geometry,Be=St===null?ue.material:St,Ae=ue.group;we.layers.test(It.layers)&&Ie(we,mt,It,de,Be,Ae)}}function Ie(Z,mt,It,St,vt,he){Z.onBeforeRender(T,mt,It,St,vt,he),Z.modelViewMatrix.multiplyMatrices(It.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),vt.onBeforeRender(T,mt,It,St,Z,he),vt.transparent===!0&&vt.side===uu&&vt.forceSinglePass===!1?(vt.side=Yo,vt.needsUpdate=!0,T.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=Xu,vt.needsUpdate=!0,T.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=uu):T.renderBufferDirect(It,mt,St,vt,Z,he),Z.onAfterRender(T,mt,It,St,vt,he)}function rr(Z,mt,It){mt.isScene!==!0&&(mt=qt);let St=be.get(Z),vt=S.state.lights,he=S.state.shadowsArray,ue=vt.state.version,we=dt.getParameters(Z,vt.state,he,mt,It),de=dt.getProgramCacheKey(we),Be=St.programs;St.environment=Z.isMeshStandardMaterial?mt.environment:null,St.fog=mt.fog,St.envMap=(Z.isMeshStandardMaterial?tt:Me).get(Z.envMap||St.environment),St.envMapRotation=St.environment!==null&&Z.envMap===null?mt.environmentRotation:Z.envMapRotation,Be===void 0&&(Z.addEventListener("dispose",et),Be=new Map,St.programs=Be);let Ae=Be.get(de);if(Ae!==void 0){if(St.currentProgram===Ae&&St.lightsStateVersion===ue)return ar(Z,we),Ae}else we.uniforms=dt.getUniforms(Z),Z.onBuild(It,we,T),Z.onBeforeCompile(we,T),Ae=dt.acquireProgram(we,de),Be.set(de,Ae),St.uniforms=we.uniforms;let Pe=St.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(Pe.clippingPlanes=Zt.uniform),ar(Z,we),St.needsLights=ii(Z),St.lightsStateVersion=ue,St.needsLights&&(Pe.ambientLightColor.value=vt.state.ambient,Pe.lightProbe.value=vt.state.probe,Pe.directionalLights.value=vt.state.directional,Pe.directionalLightShadows.value=vt.state.directionalShadow,Pe.spotLights.value=vt.state.spot,Pe.spotLightShadows.value=vt.state.spotShadow,Pe.rectAreaLights.value=vt.state.rectArea,Pe.ltc_1.value=vt.state.rectAreaLTC1,Pe.ltc_2.value=vt.state.rectAreaLTC2,Pe.pointLights.value=vt.state.point,Pe.pointLightShadows.value=vt.state.pointShadow,Pe.hemisphereLights.value=vt.state.hemi,Pe.directionalShadowMap.value=vt.state.directionalShadowMap,Pe.directionalShadowMatrix.value=vt.state.directionalShadowMatrix,Pe.spotShadowMap.value=vt.state.spotShadowMap,Pe.spotLightMatrix.value=vt.state.spotLightMatrix,Pe.spotLightMap.value=vt.state.spotLightMap,Pe.pointShadowMap.value=vt.state.pointShadowMap,Pe.pointShadowMatrix.value=vt.state.pointShadowMatrix),St.currentProgram=Ae,St.uniformsList=null,Ae}function pr(Z){if(Z.uniformsList===null){let mt=Z.currentProgram.getUniforms();Z.uniformsList=Oc.seqWithValue(mt.seq,Z.uniforms)}return Z.uniformsList}function ar(Z,mt){let It=be.get(Z);It.outputColorSpace=mt.outputColorSpace,It.batching=mt.batching,It.instancing=mt.instancing,It.instancingColor=mt.instancingColor,It.instancingMorph=mt.instancingMorph,It.skinning=mt.skinning,It.morphTargets=mt.morphTargets,It.morphNormals=mt.morphNormals,It.morphColors=mt.morphColors,It.morphTargetsCount=mt.morphTargetsCount,It.numClippingPlanes=mt.numClippingPlanes,It.numIntersection=mt.numClipIntersection,It.vertexAlphas=mt.vertexAlphas,It.vertexTangents=mt.vertexTangents,It.toneMapping=mt.toneMapping}function Qn(Z,mt,It,St,vt){mt.isScene!==!0&&(mt=qt),Wt.resetTextureUnits();let he=mt.fog,ue=St.isMeshStandardMaterial?mt.environment:null,we=q===null?T.outputColorSpace:q.isXRRenderTarget===!0?q.texture.colorSpace:Zu,de=(St.isMeshStandardMaterial?tt:Me).get(St.envMap||ue),Be=St.vertexColors===!0&&!!It.attributes.color&&It.attributes.color.itemSize===4,Ae=!!It.attributes.tangent&&(!!St.normalMap||St.anisotropy>0),Pe=!!It.morphAttributes.position,tn=!!It.morphAttributes.normal,oi=!!It.morphAttributes.color,Mr=Vu;St.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(Mr=T.toneMapping);let Hi=It.morphAttributes.position||It.morphAttributes.normal||It.morphAttributes.color,sr=Hi!==void 0?Hi.length:0,ye=be.get(St),Da=S.state.lights;if(at===!0&&(Ut===!0||Z!==xt)){let Mi=Z===xt&&St.id===D;Zt.setState(St,Z,Mi)}let en=!1;St.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==Da.state.version||ye.outputColorSpace!==we||vt.isBatchedMesh&&ye.batching===!1||!vt.isBatchedMesh&&ye.batching===!0||vt.isInstancedMesh&&ye.instancing===!1||!vt.isInstancedMesh&&ye.instancing===!0||vt.isSkinnedMesh&&ye.skinning===!1||!vt.isSkinnedMesh&&ye.skinning===!0||vt.isInstancedMesh&&ye.instancingColor===!0&&vt.instanceColor===null||vt.isInstancedMesh&&ye.instancingColor===!1&&vt.instanceColor!==null||vt.isInstancedMesh&&ye.instancingMorph===!0&&vt.morphTexture===null||vt.isInstancedMesh&&ye.instancingMorph===!1&&vt.morphTexture!==null||ye.envMap!==de||St.fog===!0&&ye.fog!==he||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==Zt.numPlanes||ye.numIntersection!==Zt.numIntersection)||ye.vertexAlphas!==Be||ye.vertexTangents!==Ae||ye.morphTargets!==Pe||ye.morphNormals!==tn||ye.morphColors!==oi||ye.toneMapping!==Mr||ge.isWebGL2===!0&&ye.morphTargetsCount!==sr)&&(en=!0):(en=!0,ye.__version=St.version);let co=ye.currentProgram;en===!0&&(co=rr(St,mt,vt));let rl=!1,ze=!1,gs=!1,ir=co.getUniforms(),Ko=ye.uniforms;if(fe.useProgram(co.program)&&(rl=!0,ze=!0,gs=!0),St.id!==D&&(D=St.id,ze=!0),rl||xt!==Z){ir.setValue(ft,"projectionMatrix",Z.projectionMatrix),ir.setValue(ft,"viewMatrix",Z.matrixWorldInverse);let Mi=ir.map.cameraPosition;Mi!==void 0&&Mi.setValue(ft,$t.setFromMatrixPosition(Z.matrixWorld)),ge.logarithmicDepthBuffer&&ir.setValue(ft,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(St.isMeshPhongMaterial||St.isMeshToonMaterial||St.isMeshLambertMaterial||St.isMeshBasicMaterial||St.isMeshStandardMaterial||St.isShaderMaterial)&&ir.setValue(ft,"isOrthographic",Z.isOrthographicCamera===!0),xt!==Z&&(xt=Z,ze=!0,gs=!0)}if(vt.isSkinnedMesh){ir.setOptional(ft,vt,"bindMatrix"),ir.setOptional(ft,vt,"bindMatrixInverse");let Mi=vt.skeleton;Mi&&(ge.floatVertexTextures?(Mi.boneTexture===null&&Mi.computeBoneTexture(),ir.setValue(ft,"boneTexture",Mi.boneTexture,Wt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}vt.isBatchedMesh&&(ir.setOptional(ft,vt,"batchingTexture"),ir.setValue(ft,"batchingTexture",vt._matricesTexture,Wt));let Le=It.morphAttributes;if((Le.position!==void 0||Le.normal!==void 0||Le.color!==void 0&&ge.isWebGL2===!0)&&C.update(vt,It,co),(ze||ye.receiveShadow!==vt.receiveShadow)&&(ye.receiveShadow=vt.receiveShadow,ir.setValue(ft,"receiveShadow",vt.receiveShadow)),St.isMeshGouraudMaterial&&St.envMap!==null&&(Ko.envMap.value=de,Ko.flipEnvMap.value=de.isCubeTexture&&de.isRenderTargetTexture===!1?-1:1),ze&&(ir.setValue(ft,"toneMappingExposure",T.toneMappingExposure),ye.needsLights&&Si(Ko,gs),he&&St.fog===!0&&Ht.refreshFogUniforms(Ko,he),Ht.refreshMaterialUniforms(Ko,St,Rt,Mt,jt),Oc.upload(ft,pr(ye),Ko,Wt)),St.isShaderMaterial&&St.uniformsNeedUpdate===!0&&(Oc.upload(ft,pr(ye),Ko,Wt),St.uniformsNeedUpdate=!1),St.isSpriteMaterial&&ir.setValue(ft,"center",vt.center),ir.setValue(ft,"modelViewMatrix",vt.modelViewMatrix),ir.setValue(ft,"normalMatrix",vt.normalMatrix),ir.setValue(ft,"modelMatrix",vt.matrixWorld),St.isShaderMaterial||St.isRawShaderMaterial){let Mi=St.uniformsGroups;for(let Fa=0,du=Mi.length;Fa<du;Fa++)if(ge.isWebGL2){let bi=Mi[Fa];ht.update(bi,co),ht.bind(bi,co)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return co}function Si(Z,mt){Z.ambientLightColor.needsUpdate=mt,Z.lightProbe.needsUpdate=mt,Z.directionalLights.needsUpdate=mt,Z.directionalLightShadows.needsUpdate=mt,Z.pointLights.needsUpdate=mt,Z.pointLightShadows.needsUpdate=mt,Z.spotLights.needsUpdate=mt,Z.spotLightShadows.needsUpdate=mt,Z.rectAreaLights.needsUpdate=mt,Z.hemisphereLights.needsUpdate=mt}function ii(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(Z,mt,It){be.get(Z.texture).__webglTexture=mt,be.get(Z.depthTexture).__webglTexture=It;let St=be.get(Z);St.__hasExternalTextures=!0,St.__autoAllocateDepthBuffer=It===void 0,St.__autoAllocateDepthBuffer||ee.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),St.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Z,mt){let It=be.get(Z);It.__webglFramebuffer=mt,It.__useDefaultFramebuffer=mt===void 0},this.setRenderTarget=function(Z,mt=0,It=0){q=Z,W=mt,X=It;let St=!0,vt=null,he=!1,ue=!1;if(Z){let de=be.get(Z);de.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(ft.FRAMEBUFFER,null),St=!1):de.__webglFramebuffer===void 0?Wt.setupRenderTarget(Z):de.__hasExternalTextures&&Wt.rebindTextures(Z,be.get(Z.texture).__webglTexture,be.get(Z.depthTexture).__webglTexture);let Be=Z.texture;(Be.isData3DTexture||Be.isDataArrayTexture||Be.isCompressedArrayTexture)&&(ue=!0);let Ae=be.get(Z).__webglFramebuffer;Z.isWebGLCubeRenderTarget?(Array.isArray(Ae[mt])?vt=Ae[mt][It]:vt=Ae[mt],he=!0):ge.isWebGL2&&Z.samples>0&&Wt.useMultisampledRTT(Z)===!1?vt=be.get(Z).__webglMultisampledFramebuffer:Array.isArray(Ae)?vt=Ae[It]:vt=Ae,B.copy(Z.viewport),j.copy(Z.scissor),J=Z.scissorTest}else B.copy(K).multiplyScalar(Rt).floor(),j.copy(Bt).multiplyScalar(Rt).floor(),J=Gt;if(fe.bindFramebuffer(ft.FRAMEBUFFER,vt)&&ge.drawBuffers&&St&&fe.drawBuffers(Z,vt),fe.viewport(B),fe.scissor(j),fe.setScissorTest(J),he){let de=be.get(Z.texture);ft.framebufferTexture2D(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,ft.TEXTURE_CUBE_MAP_POSITIVE_X+mt,de.__webglTexture,It)}else if(ue){let de=be.get(Z.texture),Be=mt||0;ft.framebufferTextureLayer(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,de.__webglTexture,It||0,Be)}D=-1},this.readRenderTargetPixels=function(Z,mt,It,St,vt,he,ue){if(!(Z&&Z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=be.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ue!==void 0&&(we=we[ue]),we){fe.bindFramebuffer(ft.FRAMEBUFFER,we);try{let de=Z.texture,Be=de.format,Ae=de.type;if(Be!==ta&&$.convert(Be)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Pe=Ae===Kf&&(ee.has("EXT_color_buffer_half_float")||ge.isWebGL2&&ee.has("EXT_color_buffer_float"));if(Ae!==Wu&&$.convert(Ae)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ae===lu&&(ge.isWebGL2||ee.has("OES_texture_float")||ee.has("WEBGL_color_buffer_float")))&&!Pe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}mt>=0&&mt<=Z.width-St&&It>=0&&It<=Z.height-vt&&ft.readPixels(mt,It,St,vt,$.convert(Be),$.convert(Ae),he)}finally{let de=q!==null?be.get(q).__webglFramebuffer:null;fe.bindFramebuffer(ft.FRAMEBUFFER,de)}}},this.copyFramebufferToTexture=function(Z,mt,It=0){let St=Math.pow(2,-It),vt=Math.floor(mt.image.width*St),he=Math.floor(mt.image.height*St);Wt.setTexture2D(mt,0),ft.copyTexSubImage2D(ft.TEXTURE_2D,It,0,0,Z.x,Z.y,vt,he),fe.unbindTexture()},this.copyTextureToTexture=function(Z,mt,It,St=0){let vt=mt.image.width,he=mt.image.height,ue=$.convert(It.format),we=$.convert(It.type);Wt.setTexture2D(It,0),ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,It.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,It.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,It.unpackAlignment),mt.isDataTexture?ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,vt,he,ue,we,mt.image.data):mt.isCompressedTexture?ft.compressedTexSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,mt.mipmaps[0].width,mt.mipmaps[0].height,ue,mt.mipmaps[0].data):ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,ue,we,mt.image),St===0&&It.generateMipmaps&&ft.generateMipmap(ft.TEXTURE_2D),fe.unbindTexture()},this.copyTextureToTexture3D=function(Z,mt,It,St,vt=0){if(T.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let he=Math.round(Z.max.x-Z.min.x),ue=Math.round(Z.max.y-Z.min.y),we=Z.max.z-Z.min.z+1,de=$.convert(St.format),Be=$.convert(St.type),Ae;if(St.isData3DTexture)Wt.setTexture3D(St,0),Ae=ft.TEXTURE_3D;else if(St.isDataArrayTexture||St.isCompressedArrayTexture)Wt.setTexture2DArray(St,0),Ae=ft.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,St.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,St.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,St.unpackAlignment);let Pe=ft.getParameter(ft.UNPACK_ROW_LENGTH),tn=ft.getParameter(ft.UNPACK_IMAGE_HEIGHT),oi=ft.getParameter(ft.UNPACK_SKIP_PIXELS),Mr=ft.getParameter(ft.UNPACK_SKIP_ROWS),Hi=ft.getParameter(ft.UNPACK_SKIP_IMAGES),sr=It.isCompressedTexture?It.mipmaps[vt]:It.image;ft.pixelStorei(ft.UNPACK_ROW_LENGTH,sr.width),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,sr.height),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,Z.min.x),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Z.min.y),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Z.min.z),It.isDataTexture||It.isData3DTexture?ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr.data):St.isCompressedArrayTexture?ft.compressedTexSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,sr.data):ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr),ft.pixelStorei(ft.UNPACK_ROW_LENGTH,Pe),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,tn),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,oi),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Mr),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Hi),vt===0&&St.generateMipmaps&&ft.generateMipmap(Ae),fe.unbindTexture()},this.initTexture=function(Z){Z.isCubeTexture?Wt.setTextureCube(Z,0):Z.isData3DTexture?Wt.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?Wt.setTexture2DArray(Z,0):Wt.setTexture2D(Z,0),fe.unbindTexture()},this.resetState=function(){W=0,X=0,q=null,fe.reset(),V.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return cu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===pv?"display-p3":"srgb",e.unpackColorSpace=_r.workingColorSpace===Pd?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},tv=class extends Qy{};tv.prototype.isWebGL1Renderer=!0;function sd(n,t,e){return!n||!e&&n.constructor===t?n:typeof t.BYTES_PER_ELEMENT=="number"?new t(n):Array.prototype.slice.call(n)}function ZW(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Gc=class{constructor(t,e,o,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,s=e[o],c=e[o-1];t:{e:{let h;n:{r:if(!(t<s)){for(let p=o+2;;){if(s===void 0){if(t<c)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===p)break;if(c=s,s=e[++o],t<s)break e}h=e.length;break n}if(!(t>=c)){let p=e[1];t<p&&(o=2,c=p);for(let g=o-2;;){if(c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===g)break;if(s=c,c=e[--o-1],t>=c)break e}h=o,o=0;break n}break t}for(;o<h;){let p=o+h>>>1;t<e[p]?h=p:o=p+1}if(s=e[o],c=e[o-1],c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,c,s)}return this.interpolate_(o,c,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,s=this.valueSize,c=t*s;for(let h=0;h!==s;++h)e[h]=o[c+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},ev=class extends Gc{constructor(t,e,o,s){super(t,e,o,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:zA,endingEnd:zA}}intervalChanged_(t,e,o){let s=this.parameterPositions,c=t-2,h=t+1,p=s[c],g=s[h];if(p===void 0)switch(this.getSettings_().endingStart){case GA:c=t,p=2*e-o;break;case kA:c=s.length-2,p=e+s[c]-s[c+1];break;default:c=t,p=o}if(g===void 0)switch(this.getSettings_().endingEnd){case GA:h=t,g=2*o-e;break;case kA:h=1,g=o+s[1]-s[0];break;default:h=t-1,g=e}let m=(o-e)*.5,_=this.valueSize;this._weightPrev=m/(e-p),this._weightNext=m/(g-o),this._offsetPrev=c*_,this._offsetNext=h*_}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=t*p,m=g-p,_=this._offsetPrev,E=this._offsetNext,x=this._weightPrev,b=this._weightNext,P=(o-e)/(s-e),I=P*P,S=I*P,w=-x*S+2*x*I-x*P,R=(1+x)*S+(-1.5-2*x)*I+(-.5+x)*P+1,T=(-1-b)*S+(1.5+b)*I+.5*P,F=b*S-b*I;for(let W=0;W!==p;++W)c[W]=w*h[_+W]+R*h[m+W]+T*h[g+W]+F*h[E+W];return c}},nv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=t*p,m=g-p,_=(o-e)/(s-e),E=1-_;for(let x=0;x!==p;++x)c[x]=h[m+x]*E+h[g+x]*_;return c}},rv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t){return this.copySampleValue_(t-1)}},na=class{constructor(t,e,o,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=sd(e,this.TimeBufferType),this.values=sd(o,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:sd(t.times,Array),values:sd(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(o.interpolation=s)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new rv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new nv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new ev(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ud:e=this.InterpolantFactoryMethodDiscrete;break;case ld:e=this.InterpolantFactoryMethodLinear;break;case ty:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ud;case this.InterpolantFactoryMethodLinear:return ld;case this.InterpolantFactoryMethodSmooth:return ty}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]*=t}return this}trim(t,e){let o=this.times,s=o.length,c=0,h=s-1;for(;c!==s&&o[c]<t;)++c;for(;h!==-1&&o[h]>e;)--h;if(++h,c!==0||h!==s){c>=h&&(h=Math.max(h,1),c=h-1);let p=this.getValueSize();this.times=o.slice(c,h),this.values=this.values.slice(c*p,h*p)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,s=this.values,c=o.length;c===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let h=null;for(let p=0;p!==c;p++){let g=o[p];if(typeof g=="number"&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,p,g),t=!1;break}if(h!==null&&h>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,p,g,h),t=!1;break}h=g}if(s!==void 0&&ZW(s))for(let p=0,g=s.length;p!==g;++p){let m=s[p];if(isNaN(m)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,p,m),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),s=this.getInterpolation()===ty,c=t.length-1,h=1;for(let p=1;p<c;++p){let g=!1,m=t[p],_=t[p+1];if(m!==_&&(p!==1||m!==t[0]))if(s)g=!0;else{let E=p*o,x=E-o,b=E+o;for(let P=0;P!==o;++P){let I=e[E+P];if(I!==e[x+P]||I!==e[b+P]){g=!0;break}}}if(g){if(p!==h){t[h]=t[p];let E=p*o,x=h*o;for(let b=0;b!==o;++b)e[x+b]=e[E+b]}++h}}if(c>0){t[h]=t[c];for(let p=c*o,g=h*o,m=0;m!==o;++m)e[g+m]=e[p+m];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,s=new o(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};na.prototype.TimeBufferType=Float32Array;na.prototype.ValueBufferType=Float32Array;na.prototype.DefaultInterpolation=ld;var Nl=class extends na{};Nl.prototype.ValueTypeName="bool";Nl.prototype.ValueBufferType=Array;Nl.prototype.DefaultInterpolation=ud;Nl.prototype.InterpolantFactoryMethodLinear=void 0;Nl.prototype.InterpolantFactoryMethodSmooth=void 0;var iv=class extends na{};iv.prototype.ValueTypeName="color";var ov=class extends na{};ov.prototype.ValueTypeName="number";var sv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=(o-e)/(s-e),m=t*p;for(let _=m+p;m!==_;m+=4)$u.slerpFlat(c,0,h,m-p,h,m,g);return c}},th=class extends na{InterpolantFactoryMethodLinear(t){return new sv(this.times,this.values,this.getValueSize(),t)}};th.prototype.ValueTypeName="quaternion";th.prototype.DefaultInterpolation=ld;th.prototype.InterpolantFactoryMethodSmooth=void 0;var Ol=class extends na{};Ol.prototype.ValueTypeName="string";Ol.prototype.ValueBufferType=Array;Ol.prototype.DefaultInterpolation=ud;Ol.prototype.InterpolantFactoryMethodLinear=void 0;Ol.prototype.InterpolantFactoryMethodSmooth=void 0;var av=class extends na{};av.prototype.ValueTypeName="vector";var uv=class{constructor(t,e,o){let s=this,c=!1,h=0,p=0,g,m=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(_){p++,c===!1&&s.onStart!==void 0&&s.onStart(_,h,p),c=!0},this.itemEnd=function(_){h++,s.onProgress!==void 0&&s.onProgress(_,h,p),h===p&&(c=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(_){s.onError!==void 0&&s.onError(_)},this.resolveURL=function(_){return g?g(_):_},this.setURLModifier=function(_){return g=_,this},this.addHandler=function(_,E){return m.push(_,E),this},this.removeHandler=function(_){let E=m.indexOf(_);return E!==-1&&m.splice(E,2),this},this.getHandler=function(_){for(let E=0,x=m.length;E<x;E+=2){let b=m[E],P=m[E+1];if(b.global&&(b.lastIndex=0),b.test(_))return P}return null}}},JW=new uv,lv=class{constructor(t){this.manager=t!==void 0?t:JW,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(s,c){o.load(t,s,e,c)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};lv.DEFAULT_MATERIAL_NAME="__DEFAULT";var gv="\\\\[\\\\]\\\\.:\\\\/",KW=new RegExp("["+gv+"]","g"),mv="[^"+gv+"]",jW="[^"+gv.replace("\\\\.","")+"]",QW=/((?:WC+[\\/:])*)/.source.replace("WC",mv),t9=/(WCOD+)?/.source.replace("WCOD",jW),e9=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",mv),n9=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",mv),r9=new RegExp("^"+QW+t9+e9+n9+"$"),i9=["material","materials","bones","map"],cv=class{constructor(t,e,o){let s=o||Nr.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,s=this._bindings[o];s!==void 0&&s.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let s=this._targetGroup.nCachedObjects_,c=o.length;s!==c;++s)o[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Nr=class n{constructor(t,e,o){this.path=e,this.parsedPath=o||n.parseTrackName(e),this.node=n.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,o):new n(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(KW,"")}static parseTrackName(t){let e=r9.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=o.nodeName&&o.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let c=o.nodeName.substring(s+1);i9.indexOf(c)!==-1&&(o.nodeName=o.nodeName.substring(0,s),o.objectName=c)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(c){for(let h=0;h<c.length;h++){let p=c[h];if(p.name===e||p.uuid===e)return p;let g=o(p.children);if(g)return g}return null},s=o(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)t[e++]=o[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,s=e.propertyName,c=e.propertyIndex;if(t||(t=n.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let m=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let _=0;_<t.length;_++)if(t[_].name===m){m=_;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(m!==void 0){if(t[m]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[m]}}let h=t[s];if(h===void 0){let m=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+m+"."+s+" but it wasn't found.",t);return}let p=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?p=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(p=this.Versioning.MatrixWorldNeedsUpdate);let g=this.BindingType.Direct;if(c!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[c]!==void 0&&(c=t.morphTargetDictionary[c])}g=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=c}else h.fromArray!==void 0&&h.toArray!==void 0?(g=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(g=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=s;this.getValue=this.GetterByBindingType[g],this.setValue=this.SetterByBindingTypeAndVersioning[g][p]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Nr.Composite=cv;Nr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Nr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Nr.prototype.GetterByBindingType=[Nr.prototype._getValue_direct,Nr.prototype._getValue_array,Nr.prototype._getValue_arrayElement,Nr.prototype._getValue_toArray];Nr.prototype.SetterByBindingTypeAndVersioning=[[Nr.prototype._setValue_direct,Nr.prototype._setValue_direct_setNeedsUpdate,Nr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_array,Nr.prototype._setValue_array_setNeedsUpdate,Nr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_arrayElement,Nr.prototype._setValue_arrayElement_setNeedsUpdate,Nr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_fromArray,Nr.prototype._setValue_fromArray_setNeedsUpdate,Nr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var pQ=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:fv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=fv);var Bi=63710088e-1,mQ={centimeters:Bi*100,centimetres:Bi*100,degrees:Bi/111325,feet:Bi*3.28084,inches:Bi*39.37,kilometers:Bi/1e3,kilometres:Bi/1e3,meters:Bi,metres:Bi,miles:Bi/1609.344,millimeters:Bi*1e3,millimetres:Bi*1e3,nauticalmiles:Bi/1852,radians:1,yards:Bi*1.0936},yQ={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Bi,yards:1.0936133};function So(n,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=n,o}function Cr(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pa(n[0])||!Pa(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return So(o,t,e)}function Or(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var c=s[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:n};return So(p,t,e)}function zi(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return So(o,t,e)}function yv(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return So(o,t,e)}function Pa(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function _i(n,t,e){if(n!==null)for(var o,s,c,h,p,g,m,_=0,E=0,x,b=n.type,P=b==="FeatureCollection",I=b==="Feature",S=P?n.features.length:1,w=0;w<S;w++){m=P?n.features[w].geometry:I?n.geometry:n,x=m?m.type==="GeometryCollection":!1,p=x?m.geometries.length:1;for(var R=0;R<p;R++){var T=0,F=0;if(h=x?m.geometries[R]:m,h!==null){g=h.coordinates;var W=h.type;switch(_=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,E,w,T,F)===!1)return!1;E++,T++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],E,w,T,F)===!1)return!1;E++,W==="MultiPoint"&&T++}W==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-_;s++){if(t(g[o][s],E,w,T,F)===!1)return!1;E++}W==="MultiLineString"&&T++,W==="Polygon"&&F++}W==="Polygon"&&T++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(c=0;c<g[o][s].length-_;c++){if(t(g[o][s][c],E,w,T,F)===!1)return!1;E++}F++}T++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(_i(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function KT(n,t,e,o){var s=e;return _i(n,function(c,h,p,g,m){h===0&&e===void 0?s=c:s=t(s,c,h,p,g,m)},o),s}function Ju(n,t){var e,o,s,c,h,p,g,m,_,E,x=0,b=n.type==="FeatureCollection",P=n.type==="Feature",I=b?n.features.length:1;for(e=0;e<I;e++){for(p=b?n.features[e].geometry:P?n.geometry:n,m=b?n.features[e].properties:P?n.properties:{},_=b?n.features[e].bbox:P?n.bbox:void 0,E=b?n.features[e].id:P?n.id:void 0,g=p?p.type==="GeometryCollection":!1,h=g?p.geometries.length:1,s=0;s<h;s++){if(c=g?p.geometries[s]:p,c===null){if(t(null,x,m,_,E)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,m,_,E)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,m,_,E)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function ds(n,t){Ju(n,function(e,o,s,c,h){var p=e===null?null:e.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return t(So(e,s,{bbox:c,id:h}),o,0)===!1?!1:void 0}var g;switch(p){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var _=e.coordinates[m],E={type:g,coordinates:_};if(t(So(E,s),o,m)===!1)return!1}})}function vv(n){var t=[1/0,1/0,-1/0,-1/0];return _i(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}vv.default=vv;var Mo=vv;function ji(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function _v(n,t,e){if(!n)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!n.geometry||n.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+n.geometry.type)}function Qi(n){return n.type==="Feature"?n.geometry:n}var h9=on(Rd(),1);var w9=on(gC(),1);function Gi(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=ji(n),s=Qi(t),c=s.type,h=t.bbox,p=s.coordinates;if(h&&S9(o,h)===!1)return!1;c==="Polygon"&&(p=[p]);for(var g=!1,m=0;m<p.length&&!g;m++)if(mC(o,p[m][0],e.ignoreBoundary)){for(var _=!1,E=1;E<p[m].length&&!_;)mC(o,p[m][E],!e.ignoreBoundary)&&(_=!0),E++;_||(g=!0)}return g}function mC(n,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var s=0,c=t.length-1;s<t.length;c=s++){var h=t[s][0],p=t[s][1],g=t[c][0],m=t[c][1],_=n[1]*(h-g)+p*(g-n[0])+m*(n[0]-h)===0&&(h-n[0])*(g-n[0])<=0&&(p-n[1])*(m-n[1])<=0;if(_)return!e;var E=p>n[1]!=m>n[1]&&n[0]<(g-h)*(n[1]-p)/(m-p)+h;E&&(o=!o)}return o}function S9(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var _C=new ArrayBuffer(16),Xtt=new Float64Array(_C),Ytt=new Uint32Array(_C);var B9=on(Dv(),1);var Ent=function(){function n(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],s=this.points[e+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var c=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,h=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,p=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+p)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+p)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return n.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var c=this.pos(s),h=Math.sqrt((c.x-o.x)*(c.x-o.x)+(c.y-o.y)*(c.y-o.y)+(c.z-o.z)*(c.z-o.z));h>t&&(e.push(s),o=c)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},n.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*o),c=(this.length-1)*o-s;return z9(c,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function z9(n,t,e,o,s){var c=G9(n),h={x:s.x*c[0]+o.x*c[1]+e.x*c[2]+t.x*c[3],y:s.y*c[0]+o.y*c[1]+e.y*c[2]+t.y*c[3],z:s.z*c[0]+o.z*c[1]+e.z*c[2]+t.z*c[3]};return h}function G9(n){var t=n*n,e=t*n;return[e,3*t*(1-n),3*n*(1-n)*(1-n),(1-n)*(1-n)*(1-n)]}function oh(n,t){t===void 0&&(t={});var e=Number(n[0]),o=Number(n[1]),s=Number(n[2]),c=Number(n[3]);if(n.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[e,o],p=[e,c],g=[s,c],m=[s,o];return Or([[h,m,g,p,h]],t.properties,{bbox:n,id:t.id})}function k9(n){return oh(Mo(n))}var Fv=k9;var iX=on(IC(),1);var RX=on($d(),1);var NX=on(Rd(),1);var FX=on(Dv(),1);var $C=Math.PI/180,ZC=180/Math.PI,hh=function(n,t){this.lon=n,this.lat=t,this.x=$C*n,this.y=$C*t};hh.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};hh.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new hh(t,n)};var JC=function(){this.coords=[],this.length=0};JC.prototype.move_to=function(n){this.length++,this.coords.push(n)};var n_=function(n){this.properties=n||{},this.geometries=[]};n_.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var n=[],t=0;t<this.geometries.length;t++)n.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:n},type:"Feature",properties:this.properties}};n_.prototype.wkt=function(){for(var n="",t="LINESTRING(",e=function(c){t+=c[0]+" "+c[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[o].coords;s.forEach(e),n+=t.substring(0,t.length-1)+")"}return n};var KC=function(n,t,e){if(!n||n.x===void 0||n.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new hh(n.x,n.y),this.end=new hh(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,s=this.start.y-this.end.y,c=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(c)),this.g===Math.PI)throw new Error("it appears "+n.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+n+" and "+t)};KC.prototype.interpolate=function(n){var t=Math.sin((1-n)*this.g)/Math.sin(this.g),e=Math.sin(n*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),s=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),c=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),h=ZC*Math.atan2(c,Math.sqrt(Math.pow(o,2)+Math.pow(s,2))),p=ZC*Math.atan2(s,o);return[p,h]};KC.prototype.Arc=function(n,t){var e=[];if(!n||n<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(n-1),s=0;s<n;++s){var c=o*s,h=this.interpolate(c);e.push(h)}for(var p=!1,g=0,m=t&&t.offset?t.offset:10,_=180-m,E=-180+m,x=360-m,b=1;b<e.length;++b){var P=e[b-1][0],I=e[b][0],S=Math.abs(I-P);S>x&&(I>_&&P<E||P>_&&I<E)?p=!0:S>g&&(g=S)}var w=[];if(p&&g<m){var R=[];w.push(R);for(var T=0;T<e.length;++T){var F=parseFloat(e[T][0]);if(T>0&&Math.abs(F-e[T-1][0])>x){var W=parseFloat(e[T-1][0]),X=parseFloat(e[T-1][1]),q=parseFloat(e[T][0]),D=parseFloat(e[T][1]);if(W>-180&&W<E&&q===180&&T+1<e.length&&e[T-1][0]>-180&&e[T-1][0]<E){R.push([-180,e[T][1]]),T++,R.push([e[T][0],e[T][1]]);continue}else if(W>_&&W<180&&q===-180&&T+1<e.length&&e[T-1][0]>_&&e[T-1][0]<180){R.push([180,e[T][1]]),T++,R.push([e[T][0],e[T][1]]);continue}if(W<E&&q>_){var xt=W;W=q,q=xt;var B=X;X=D,D=B}if(W>_&&q<E&&(q+=360),W<=180&&q>=180&&W<q){var j=(180-W)/(q-W),J=j*D+(1-j)*X;R.push([e[T-1][0]>_?180:-180,J]),R=[],R.push([e[T-1][0]>_?-180:180,J]),w.push(R)}else R=[],w.push(R);R.push([F,e[T][1]])}else R.push([e[T][0],e[T][1]])}}else{var Dt=[];w.push(Dt);for(var Q=0;Q<e.length;++Q)Dt.push([e[Q][0],e[Q][1]])}for(var At=new n_(this.properties),Mt=0;Mt<w.length;++Mt){var Rt=new JC;At.geometries.push(Rt);for(var pt=w[Mt],yt=0;yt<pt.length;++yt)Rt.move_to(pt[yt])}return At};var zX=on($d(),1);var vY=on($d(),1);var _Y=on(M_(),1);var wY=on(Rd(),1);var un=[],ln=[],cn=[],fn=[],hn=[],pn=[],dn=[],gn=[],mn=[],yn=[],vn=[],_n=[],xn=[],En=[],wn=[],Sn=[],Mn=[],bn=[],An=[],Tn=[],Cn=[],Pn=[],In=[],Rn=[];dn[85]=yn[85]=-1;gn[85]=vn[85]=0;mn[85]=_n[85]=1;An[85]=Pn[85]=1;Tn[85]=In[85]=0;Cn[85]=Rn[85]=1;un[85]=fn[85]=0;ln[85]=hn[85]=-1;cn[85]=wn[85]=0;Sn[85]=xn[85]=0;Mn[85]=En[85]=1;pn[85]=bn[85]=1;Pn[1]=Pn[169]=0;In[1]=In[169]=-1;Rn[1]=Rn[169]=0;xn[1]=xn[169]=-1;En[1]=En[169]=0;wn[1]=wn[169]=0;yn[4]=yn[166]=0;vn[4]=vn[166]=-1;_n[4]=_n[166]=1;Sn[4]=Sn[166]=1;Mn[4]=Mn[166]=0;bn[4]=bn[166]=0;dn[16]=dn[154]=0;gn[16]=gn[154]=1;mn[16]=mn[154]=1;fn[16]=fn[154]=1;hn[16]=hn[154]=0;pn[16]=pn[154]=1;An[64]=An[106]=0;Tn[64]=Tn[106]=1;Cn[64]=Cn[106]=0;un[64]=un[106]=-1;ln[64]=ln[106]=0;cn[64]=cn[106]=1;An[2]=An[168]=0;Tn[2]=Tn[168]=-1;Cn[2]=Cn[168]=1;Pn[2]=Pn[168]=0;In[2]=In[168]=-1;Rn[2]=Rn[168]=0;xn[2]=xn[168]=-1;En[2]=En[168]=0;wn[2]=wn[168]=0;Sn[2]=Sn[168]=-1;Mn[2]=Mn[168]=0;bn[2]=bn[168]=1;dn[8]=dn[162]=0;gn[8]=gn[162]=-1;mn[8]=mn[162]=0;yn[8]=yn[162]=0;vn[8]=vn[162]=-1;_n[8]=_n[162]=1;xn[8]=xn[162]=1;En[8]=En[162]=0;wn[8]=wn[162]=1;Sn[8]=Sn[162]=1;Mn[8]=Mn[162]=0;bn[8]=bn[162]=0;dn[32]=dn[138]=0;gn[32]=gn[138]=1;mn[32]=mn[138]=1;yn[32]=yn[138]=0;vn[32]=vn[138]=1;_n[32]=_n[138]=0;un[32]=un[138]=1;ln[32]=ln[138]=0;cn[32]=cn[138]=0;fn[32]=fn[138]=1;hn[32]=hn[138]=0;pn[32]=pn[138]=1;Pn[128]=Pn[42]=0;In[128]=In[42]=1;Rn[128]=Rn[42]=1;An[128]=An[42]=0;Tn[128]=Tn[42]=1;Cn[128]=Cn[42]=0;un[128]=un[42]=-1;ln[128]=ln[42]=0;cn[128]=cn[42]=1;fn[128]=fn[42]=-1;hn[128]=hn[42]=0;pn[128]=pn[42]=0;yn[5]=yn[165]=-1;vn[5]=vn[165]=0;_n[5]=_n[165]=0;Pn[5]=Pn[165]=1;In[5]=In[165]=0;Rn[5]=Rn[165]=0;Sn[20]=Sn[150]=0;Mn[20]=Mn[150]=1;bn[20]=bn[150]=1;fn[20]=fn[150]=0;hn[20]=hn[150]=-1;pn[20]=pn[150]=1;dn[80]=dn[90]=-1;gn[80]=gn[90]=0;mn[80]=mn[90]=1;An[80]=An[90]=1;Tn[80]=Tn[90]=0;Cn[80]=Cn[90]=1;xn[65]=xn[105]=0;En[65]=En[105]=1;wn[65]=wn[105]=0;un[65]=un[105]=0;ln[65]=ln[105]=-1;cn[65]=cn[105]=0;dn[160]=dn[10]=-1;gn[160]=gn[10]=0;mn[160]=mn[10]=1;yn[160]=yn[10]=-1;vn[160]=vn[10]=0;_n[160]=_n[10]=0;Pn[160]=Pn[10]=1;In[160]=In[10]=0;Rn[160]=Rn[10]=0;An[160]=An[10]=1;Tn[160]=Tn[10]=0;Cn[160]=Cn[10]=1;Sn[130]=Sn[40]=0;Mn[130]=Mn[40]=1;bn[130]=bn[40]=1;xn[130]=xn[40]=0;En[130]=En[40]=1;wn[130]=wn[40]=0;un[130]=un[40]=0;ln[130]=ln[40]=-1;cn[130]=cn[40]=0;fn[130]=fn[40]=0;hn[130]=hn[40]=-1;pn[130]=pn[40]=1;yn[37]=yn[133]=0;vn[37]=vn[133]=1;_n[37]=_n[133]=1;Pn[37]=Pn[133]=0;In[37]=In[133]=1;Rn[37]=Rn[133]=0;un[37]=un[133]=-1;ln[37]=ln[133]=0;cn[37]=cn[133]=0;fn[37]=fn[133]=1;hn[37]=hn[133]=0;pn[37]=pn[133]=0;Sn[148]=Sn[22]=-1;Mn[148]=Mn[22]=0;bn[148]=bn[22]=0;Pn[148]=Pn[22]=0;In[148]=In[22]=-1;Rn[148]=Rn[22]=1;An[148]=An[22]=0;Tn[148]=Tn[22]=1;Cn[148]=Cn[22]=1;fn[148]=fn[22]=-1;hn[148]=hn[22]=0;pn[148]=pn[22]=1;dn[82]=dn[88]=0;gn[82]=gn[88]=-1;mn[82]=mn[88]=1;Sn[82]=Sn[88]=1;Mn[82]=Mn[88]=0;bn[82]=bn[88]=1;xn[82]=xn[88]=-1;En[82]=En[88]=0;wn[82]=wn[88]=1;An[82]=An[88]=0;Tn[82]=Tn[88]=-1;Cn[82]=Cn[88]=0;dn[73]=dn[97]=0;gn[73]=gn[97]=1;mn[73]=mn[97]=0;yn[73]=yn[97]=0;vn[73]=vn[97]=-1;_n[73]=_n[97]=0;xn[73]=xn[97]=1;En[73]=En[97]=0;wn[73]=wn[97]=0;un[73]=un[97]=1;ln[73]=ln[97]=0;cn[73]=cn[97]=1;dn[145]=dn[25]=0;gn[145]=gn[25]=-1;mn[145]=mn[25]=0;xn[145]=xn[25]=1;En[145]=En[25]=0;wn[145]=wn[25]=1;Pn[145]=Pn[25]=0;In[145]=In[25]=1;Rn[145]=Rn[25]=1;fn[145]=fn[25]=-1;hn[145]=hn[25]=0;pn[145]=pn[25]=0;yn[70]=yn[100]=0;vn[70]=vn[100]=1;_n[70]=_n[100]=0;Sn[70]=Sn[100]=-1;Mn[70]=Mn[100]=0;bn[70]=bn[100]=1;An[70]=An[100]=0;Tn[70]=Tn[100]=-1;Cn[70]=Cn[100]=1;un[70]=un[100]=1;ln[70]=ln[100]=0;cn[70]=cn[100]=0;yn[101]=yn[69]=0;vn[101]=vn[69]=1;_n[101]=_n[69]=0;un[101]=un[69]=1;ln[101]=ln[69]=0;cn[101]=cn[69]=0;Pn[149]=Pn[21]=0;In[149]=In[21]=1;Rn[149]=Rn[21]=1;fn[149]=fn[21]=-1;hn[149]=hn[21]=0;pn[149]=pn[21]=0;Sn[86]=Sn[84]=-1;Mn[86]=Mn[84]=0;bn[86]=bn[84]=1;An[86]=An[84]=0;Tn[86]=Tn[84]=-1;Cn[86]=Cn[84]=1;dn[89]=dn[81]=0;gn[89]=gn[81]=-1;mn[89]=mn[81]=0;xn[89]=xn[81]=1;En[89]=En[81]=0;wn[89]=wn[81]=1;dn[96]=dn[74]=0;gn[96]=gn[74]=1;mn[96]=mn[74]=0;yn[96]=yn[74]=-1;vn[96]=vn[74]=0;_n[96]=_n[74]=1;An[96]=An[74]=1;Tn[96]=Tn[74]=0;Cn[96]=Cn[74]=0;un[96]=un[74]=1;ln[96]=ln[74]=0;cn[96]=cn[74]=1;dn[24]=dn[146]=0;gn[24]=gn[146]=-1;mn[24]=mn[146]=1;Sn[24]=Sn[146]=1;Mn[24]=Mn[146]=0;bn[24]=bn[146]=1;xn[24]=xn[146]=0;En[24]=En[146]=1;wn[24]=wn[146]=1;fn[24]=fn[146]=0;hn[24]=hn[146]=-1;pn[24]=pn[146]=0;yn[6]=yn[164]=-1;vn[6]=vn[164]=0;_n[6]=_n[164]=1;Sn[6]=Sn[164]=-1;Mn[6]=Mn[164]=0;bn[6]=bn[164]=0;Pn[6]=Pn[164]=0;In[6]=In[164]=-1;Rn[6]=Rn[164]=1;An[6]=An[164]=1;Tn[6]=Tn[164]=0;Cn[6]=Cn[164]=0;xn[129]=xn[41]=0;En[129]=En[41]=1;wn[129]=wn[41]=1;Pn[129]=Pn[41]=0;In[129]=In[41]=1;Rn[129]=Rn[41]=0;un[129]=un[41]=-1;ln[129]=ln[41]=0;cn[129]=cn[41]=0;fn[129]=fn[41]=0;hn[129]=hn[41]=-1;pn[129]=pn[41]=0;Sn[66]=Sn[104]=0;Mn[66]=Mn[104]=1;bn[66]=bn[104]=0;xn[66]=xn[104]=-1;En[66]=En[104]=0;wn[66]=wn[104]=1;An[66]=An[104]=0;Tn[66]=Tn[104]=-1;Cn[66]=Cn[104]=0;un[66]=un[104]=0;ln[66]=ln[104]=-1;cn[66]=cn[104]=1;dn[144]=dn[26]=-1;gn[144]=gn[26]=0;mn[144]=mn[26]=0;Pn[144]=Pn[26]=1;In[144]=In[26]=0;Rn[144]=Rn[26]=1;An[144]=An[26]=0;Tn[144]=Tn[26]=1;Cn[144]=Cn[26]=1;fn[144]=fn[26]=-1;hn[144]=hn[26]=0;pn[144]=pn[26]=1;yn[36]=yn[134]=0;vn[36]=vn[134]=1;_n[36]=_n[134]=1;Sn[36]=Sn[134]=0;Mn[36]=Mn[134]=1;bn[36]=bn[134]=0;un[36]=un[134]=0;ln[36]=ln[134]=-1;cn[36]=cn[134]=1;fn[36]=fn[134]=1;hn[36]=hn[134]=0;pn[36]=pn[134]=0;dn[9]=dn[161]=-1;gn[9]=gn[161]=0;mn[9]=mn[161]=0;yn[9]=yn[161]=0;vn[9]=vn[161]=-1;_n[9]=_n[161]=0;xn[9]=xn[161]=1;En[9]=En[161]=0;wn[9]=wn[161]=0;Pn[9]=Pn[161]=1;In[9]=In[161]=0;Rn[9]=Rn[161]=1;dn[136]=0;gn[136]=1;mn[136]=1;yn[136]=0;vn[136]=1;_n[136]=0;Sn[136]=-1;Mn[136]=0;bn[136]=1;xn[136]=-1;En[136]=0;wn[136]=0;Pn[136]=0;In[136]=-1;Rn[136]=0;An[136]=0;Tn[136]=-1;Cn[136]=1;un[136]=1;ln[136]=0;cn[136]=0;fn[136]=1;hn[136]=0;pn[136]=1;dn[34]=0;gn[34]=-1;mn[34]=0;yn[34]=0;vn[34]=-1;_n[34]=1;Sn[34]=1;Mn[34]=0;bn[34]=0;xn[34]=1;En[34]=0;wn[34]=1;Pn[34]=0;In[34]=1;Rn[34]=1;An[34]=0;Tn[34]=1;Cn[34]=0;un[34]=-1;ln[34]=0;cn[34]=1;fn[34]=-1;hn[34]=0;pn[34]=0;dn[35]=0;gn[35]=1;mn[35]=1;yn[35]=0;vn[35]=-1;_n[35]=1;Sn[35]=1;Mn[35]=0;bn[35]=0;xn[35]=-1;En[35]=0;wn[35]=0;Pn[35]=0;In[35]=-1;Rn[35]=0;An[35]=0;Tn[35]=1;Cn[35]=0;un[35]=-1;ln[35]=0;cn[35]=1;fn[35]=1;hn[35]=0;pn[35]=1;dn[153]=0;gn[153]=1;mn[153]=1;xn[153]=-1;En[153]=0;wn[153]=0;Pn[153]=0;In[153]=-1;Rn[153]=0;fn[153]=1;hn[153]=0;pn[153]=1;yn[102]=0;vn[102]=-1;_n[102]=1;Sn[102]=1;Mn[102]=0;bn[102]=0;An[102]=0;Tn[102]=1;Cn[102]=0;un[102]=-1;ln[102]=0;cn[102]=1;dn[155]=0;gn[155]=-1;mn[155]=0;xn[155]=1;En[155]=0;wn[155]=1;Pn[155]=0;In[155]=1;Rn[155]=1;fn[155]=-1;hn[155]=0;pn[155]=0;yn[103]=0;vn[103]=1;_n[103]=0;Sn[103]=-1;Mn[103]=0;bn[103]=1;An[103]=0;Tn[103]=-1;Cn[103]=1;un[103]=1;ln[103]=0;cn[103]=0;dn[152]=0;gn[152]=1;mn[152]=1;Sn[152]=-1;Mn[152]=0;bn[152]=1;xn[152]=-1;En[152]=0;wn[152]=0;Pn[152]=0;In[152]=-1;Rn[152]=0;An[152]=0;Tn[152]=-1;Cn[152]=1;fn[152]=1;hn[152]=0;pn[152]=1;dn[156]=0;gn[156]=-1;mn[156]=1;Sn[156]=1;Mn[156]=0;bn[156]=1;xn[156]=-1;En[156]=0;wn[156]=0;Pn[156]=0;In[156]=-1;Rn[156]=0;An[156]=0;Tn[156]=1;Cn[156]=1;fn[156]=-1;hn[156]=0;pn[156]=1;dn[137]=0;gn[137]=1;mn[137]=1;yn[137]=0;vn[137]=1;_n[137]=0;xn[137]=-1;En[137]=0;wn[137]=0;Pn[137]=0;In[137]=-1;Rn[137]=0;un[137]=1;ln[137]=0;cn[137]=0;fn[137]=1;hn[137]=0;pn[137]=1;dn[139]=0;gn[139]=1;mn[139]=1;yn[139]=0;vn[139]=-1;_n[139]=0;xn[139]=1;En[139]=0;wn[139]=0;Pn[139]=0;In[139]=1;Rn[139]=0;un[139]=-1;ln[139]=0;cn[139]=0;fn[139]=1;hn[139]=0;pn[139]=1;dn[98]=0;gn[98]=-1;mn[98]=0;yn[98]=0;vn[98]=-1;_n[98]=1;Sn[98]=1;Mn[98]=0;bn[98]=0;xn[98]=1;En[98]=0;wn[98]=1;An[98]=0;Tn[98]=1;Cn[98]=0;un[98]=-1;ln[98]=0;cn[98]=1;dn[99]=0;gn[99]=1;mn[99]=0;yn[99]=0;vn[99]=-1;_n[99]=1;Sn[99]=1;Mn[99]=0;bn[99]=0;xn[99]=-1;En[99]=0;wn[99]=1;An[99]=0;Tn[99]=-1;Cn[99]=0;un[99]=1;ln[99]=0;cn[99]=1;yn[38]=0;vn[38]=-1;_n[38]=1;Sn[38]=1;Mn[38]=0;bn[38]=0;Pn[38]=0;In[38]=1;Rn[38]=1;An[38]=0;Tn[38]=1;Cn[38]=0;un[38]=-1;ln[38]=0;cn[38]=1;fn[38]=-1;hn[38]=0;pn[38]=0;yn[39]=0;vn[39]=1;_n[39]=1;Sn[39]=-1;Mn[39]=0;bn[39]=0;Pn[39]=0;In[39]=-1;Rn[39]=1;An[39]=0;Tn[39]=1;Cn[39]=0;un[39]=-1;ln[39]=0;cn[39]=1;fn[39]=1;hn[39]=0;pn[39]=0;var b_=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},A_=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},T_=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},C_=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},P_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},I_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},R_=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},L_=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},SY=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},MY=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},bY=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},AY=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},TY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},CY=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},PY=function(){return[[0,0],[0,1],[1,1],[1,0]]},IY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},RY=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},LY=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},NY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},OY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},DY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},FY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},UY=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},BY=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},zY=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},GY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},kY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},qY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},HY=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},VY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},WY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},XY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},YY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},$Y=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},ZY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},JY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},KY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},jY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},QY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},t$=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},Dn=[],Fn=[],Un=[],Bn=[],zn=[],Gn=[],kn=[],qn=[];Bn[1]=zn[1]=18;Bn[169]=zn[169]=18;Un[4]=Fn[4]=12;Un[166]=Fn[166]=12;Dn[16]=qn[16]=4;Dn[154]=qn[154]=4;Gn[64]=kn[64]=22;Gn[106]=kn[106]=22;Un[2]=Gn[2]=17;Bn[2]=zn[2]=18;Un[168]=Gn[168]=17;Bn[168]=zn[168]=18;Dn[8]=Bn[8]=9;Fn[8]=Un[8]=12;Dn[162]=Bn[162]=9;Fn[162]=Un[162]=12;Dn[32]=qn[32]=4;Fn[32]=kn[32]=1;Dn[138]=qn[138]=4;Fn[138]=kn[138]=1;zn[128]=qn[128]=21;Gn[128]=kn[128]=22;zn[42]=qn[42]=21;Gn[42]=kn[42]=22;Fn[5]=zn[5]=14;Fn[165]=zn[165]=14;Un[20]=qn[20]=6;Un[150]=qn[150]=6;Dn[80]=Gn[80]=11;Dn[90]=Gn[90]=11;Bn[65]=kn[65]=3;Bn[105]=kn[105]=3;Dn[160]=Gn[160]=11;Fn[160]=zn[160]=14;Dn[10]=Gn[10]=11;Fn[10]=zn[10]=14;Un[130]=qn[130]=6;Bn[130]=kn[130]=3;Un[40]=qn[40]=6;Bn[40]=kn[40]=3;Fn[101]=kn[101]=1;Fn[69]=kn[69]=1;zn[149]=qn[149]=21;zn[21]=qn[21]=21;Un[86]=Gn[86]=17;Un[84]=Gn[84]=17;Dn[89]=Bn[89]=9;Dn[81]=Bn[81]=9;Dn[96]=kn[96]=0;Fn[96]=Gn[96]=15;Dn[74]=kn[74]=0;Fn[74]=Gn[74]=15;Dn[24]=Un[24]=8;Bn[24]=qn[24]=7;Dn[146]=Un[146]=8;Bn[146]=qn[146]=7;Fn[6]=Gn[6]=15;Un[6]=zn[6]=16;Fn[164]=Gn[164]=15;Un[164]=zn[164]=16;Bn[129]=qn[129]=7;zn[129]=kn[129]=20;Bn[41]=qn[41]=7;zn[41]=kn[41]=20;Un[66]=kn[66]=2;Bn[66]=Gn[66]=19;Un[104]=kn[104]=2;Bn[104]=Gn[104]=19;Dn[144]=zn[144]=10;Gn[144]=qn[144]=23;Dn[26]=zn[26]=10;Gn[26]=qn[26]=23;Fn[36]=qn[36]=5;Un[36]=kn[36]=2;Fn[134]=qn[134]=5;Un[134]=kn[134]=2;Dn[9]=zn[9]=10;Fn[9]=Bn[9]=13;Dn[161]=zn[161]=10;Fn[161]=Bn[161]=13;Fn[37]=qn[37]=5;zn[37]=kn[37]=20;Fn[133]=qn[133]=5;zn[133]=kn[133]=20;Un[148]=zn[148]=16;Gn[148]=qn[148]=23;Un[22]=zn[22]=16;Gn[22]=qn[22]=23;Dn[82]=Un[82]=8;Bn[82]=Gn[82]=19;Dn[88]=Un[88]=8;Bn[88]=Gn[88]=19;Dn[73]=kn[73]=0;Fn[73]=Bn[73]=13;Dn[97]=kn[97]=0;Fn[97]=Bn[97]=13;Dn[145]=Bn[145]=9;zn[145]=qn[145]=21;Dn[25]=Bn[25]=9;zn[25]=qn[25]=21;Fn[70]=kn[70]=1;Un[70]=Gn[70]=17;Fn[100]=kn[100]=1;Un[100]=Gn[100]=17;Dn[34]=Bn[34]=9;Fn[34]=Un[34]=12;zn[34]=qn[34]=21;Gn[34]=kn[34]=22;Dn[136]=qn[136]=4;Fn[136]=kn[136]=1;Un[136]=Gn[136]=17;Bn[136]=zn[136]=18;Dn[35]=qn[35]=4;Fn[35]=Un[35]=12;Bn[35]=zn[35]=18;Gn[35]=kn[35]=22;Dn[153]=qn[153]=4;Bn[153]=zn[153]=18;Fn[102]=Un[102]=12;Gn[102]=kn[102]=22;Dn[155]=Bn[155]=9;zn[155]=qn[155]=23;Fn[103]=kn[103]=1;Un[103]=Gn[103]=17;Dn[152]=qn[152]=4;Un[152]=Gn[152]=17;Bn[152]=zn[152]=18;Dn[156]=Un[156]=8;Bn[156]=zn[156]=18;Gn[156]=qn[156]=23;Dn[137]=qn[137]=4;Fn[137]=kn[137]=1;Bn[137]=zn[137]=18;Dn[139]=qn[139]=4;Fn[139]=Bn[139]=13;zn[139]=kn[139]=20;Dn[98]=Bn[98]=9;Fn[98]=Un[98]=12;Gn[98]=kn[98]=22;Dn[99]=kn[99]=0;Fn[99]=Un[99]=12;Bn[99]=Gn[99]=19;Fn[38]=Un[38]=12;zn[38]=qn[38]=21;Gn[38]=kn[38]=22;Fn[39]=qn[39]=5;Un[39]=zn[39]=16;Gn[39]=kn[39]=22;var re=[];re[1]=re[169]=b_;re[4]=re[166]=A_;re[16]=re[154]=T_;re[64]=re[106]=C_;re[168]=re[2]=P_;re[162]=re[8]=I_;re[138]=re[32]=R_;re[42]=re[128]=L_;re[5]=re[165]=SY;re[20]=re[150]=MY;re[80]=re[90]=bY;re[65]=re[105]=AY;re[160]=re[10]=TY;re[130]=re[40]=CY;re[85]=PY;re[101]=re[69]=IY;re[149]=re[21]=RY;re[86]=re[84]=LY;re[89]=re[81]=NY;re[96]=re[74]=OY;re[24]=re[146]=DY;re[6]=re[164]=FY;re[129]=re[41]=UY;re[66]=re[104]=BY;re[144]=re[26]=zY;re[36]=re[134]=GY;re[9]=re[161]=kY;re[37]=re[133]=qY;re[148]=re[22]=HY;re[82]=re[88]=VY;re[73]=re[97]=WY;re[145]=re[25]=XY;re[70]=re[100]=YY;re[34]=function(n){return[L_(n),I_(n)]};re[35]=$Y;re[136]=function(n){return[R_(n),P_(n)]};re[153]=function(n){return[T_(n),b_(n)]};re[102]=function(n){return[A_(n),C_(n)]};re[155]=ZY;re[103]=JY;re[152]=function(n){return[T_(n),P_(n)]};re[156]=KY;re[137]=function(n){return[R_(n),b_(n)]};re[139]=jY;re[98]=function(n){return[I_(n),C_(n)]};re[99]=QY;re[38]=function(n){return[A_(n),L_(n)]};re[39]=t$;function n$(n){return(n>0)-(n<0)||+n}function rf(n,t,e){var o=t[0]-n[0],s=t[1]-n[1],c=e[0]-t[0],h=e[1]-t[1];return n$(o*h-c*s)}function rR(n,t){var e=n.geometry.coordinates[0].map(function(h){return h[0]}),o=n.geometry.coordinates[0].map(function(h){return h[1]}),s=t.geometry.coordinates[0].map(function(h){return h[0]}),c=t.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,o)===Math.max.apply(null,c)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,o)===Math.min.apply(null,c)}function N_(n,t){return t.geometry.coordinates[0].every(function(e){return Gi(Cr(e),n)})}function iR(n,t){return n[0]===t[0]&&n[1]===t[1]}var r$=function(){function n(t){this.id=n.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return n.buildId=function(t){return t.join(",")},n.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},n.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},n.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},n.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var s=e.to,c=o.to;if(s.coordinates[0]-t.coordinates[0]>=0&&c.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&c.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&c.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||c.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-c.coordinates[1]:c.coordinates[1]-s.coordinates[1];var h=rf(t.coordinates,s.coordinates,c.coordinates);if(h<0)return 1;if(h>0)return-1;var p=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),g=Math.pow(c.coordinates[0]-t.coordinates[0],2)+Math.pow(c.coordinates[1]-t.coordinates[1],2);return p-g}),this.outerEdgesSorted=!0)},n.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},n.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},n.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},n}(),O_=r$;var i$=function(){function n(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return n.prototype.getSymetric=function(){return this.symetric||(this.symetric=new n(this.to,this.from),this.symetric.symetric=this),this.symetric},n.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},n.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},n.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},n.prototype.toLineString=function(){return zi([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return rf(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),oR=i$;var o$=function(){function n(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return n.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},n.prototype.get=function(t){return this.edges[t]},Object.defineProperty(n.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),n.prototype.forEach=function(t){this.edges.forEach(t)},n.prototype.map=function(t){return this.edges.map(t)},n.prototype.some=function(t){return this.edges.some(t)},n.prototype.isValid=function(){return!0},n.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(h,p,g){return p.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=g),h},0),o=(e===0?this.length:e)-1,s=(e+1)%this.length,c=rf(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return c===0?this.edges[o].from.coordinates[0]>this.edges[s].from.coordinates[0]:c>0},n.prototype.toMultiPoint=function(){return yv(this.edges.map(function(t){return t.from.coordinates}))},n.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Or([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Fv(this.toPolygon())},n.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),s,c;return e.forEach(function(h){var p=h.getEnvelope();if(c&&(s=c.getEnvelope()),!rR(p,o)&&N_(p,o)){for(var g=t.map(function(P){return P.from.coordinates}),m=void 0,_=function(P){h.some(function(I){return iR(P,I.from.coordinates)})||(m=P)},E=0,x=g;E<x.length;E++){var b=x[E];_(b)}m&&h.inside(Cr(m))&&(!c||N_(s,p))&&(c=h)}}),c},n.prototype.inside=function(t){return Gi(t,this.toPolygon())},n}(),D_=o$;function s$(n){if(!n)throw new Error("No geojson passed");if(n.type!=="FeatureCollection"&&n.type!=="GeometryCollection"&&n.type!=="MultiLineString"&&n.type!=="LineString"&&n.type!=="Feature")throw new Error("Invalid input type '"+n.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var cut=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){s$(t);var e=new n;return ds(t,function(o){_v(o,"LineString","Graph::fromGeoJson"),KT(o,function(s,c){if(s){var h=e.getNode(s),p=e.getNode(c);e.addEdge(h,p)}return c})}),e},n.prototype.getNode=function(t){var e=O_.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new O_(t)),o},n.prototype.addEdge=function(t,e){var o=new oR(t,e),s=o.getSymetric();this.edges.push(o),this.edges.push(s)},n.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},n.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),o.forEach(function(s){return e._removeIfDangle(s)})}},n.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},n.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=o})},n.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),s,c,h=o.length-1;h>=0;--h){var p=o[h],g=p.symetric,m=void 0,_=void 0;p.label===e&&(m=p),g.label===e&&(_=g),!(!m||!_)&&(_&&(c=_),m&&(c&&(c.next=m,c=void 0),s||(s=m)))}c&&(c.next=s)},n.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var s=o;do s.label=e,s=s.next;while(!o.isEqual(s));e++}}),t},n.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(s){t._computeNextCCWEdges(s,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},n.prototype._findIntersectionNodes=function(t){var e=[],o=t,s=function(){var c=0;o.from.getOuterEdges().forEach(function(h){h.label===t.label&&++c}),c>1&&e.push(o.from),o=o.next};do s();while(!t.isEqual(o));return e},n.prototype._findEdgeRing=function(t){var e=t,o=new D_;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},n.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},n.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},n}();var c$=on(F_(),1);var f$=on(F_(),1);var p$=on(dR(),1);var x$=on(MR(),1);function AR(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function w$(){return new TR(function(n){return n.f})}var G_={search:function(n,t,e,o){n.cleanDirty(),o=o||{};var s=o.heuristic||G_.heuristics.manhattan,c=o.closest||!1,h=w$(),p=t;for(t.h=s(t,e),h.push(t);h.size()>0;){var g=h.pop();if(g===e)return AR(g);g.closed=!0;for(var m=n.neighbors(g),_=0,E=m.length;_<E;++_){var x=m[_];if(!(x.closed||x.isWall())){var b=g.g+x.getCost(g),P=x.visited;(!P||b<x.g)&&(x.visited=!0,x.parent=g,x.h=x.h||s(x,e),x.g=b,x.f=x.g+x.h,n.markDirty(x),c&&(x.h<p.h||x.h===p.h&&x.g<p.g)&&(p=x),P?h.rescoreElement(x):h.push(x))}}}return c?AR(p):[]},heuristics:{manhattan:function(n,t){var e=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);return e+o},diagonal:function(n,t){var e=1,o=Math.sqrt(2),s=Math.abs(t.x-n.x),c=Math.abs(t.y-n.y);return e*(s+c)+(o-2*e)*Math.min(s,c)}},cleanNode:function(n){n.f=0,n.g=0,n.h=0,n.visited=!1,n.closed=!1,n.parent=null}};function vh(n,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<n.length;e++){this.grid[e]=[];for(var o=0,s=n[e];o<s.length;o++){var c=new Eg(e,o,s[o]);this.grid[e][o]=c,this.nodes.push(c)}}this.init()}vh.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)G_.cleanNode(this.nodes[n])};vh.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)G_.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};vh.prototype.markDirty=function(n){this.dirtyNodes.push(n)};vh.prototype.neighbors=function(n){var t=[],e=n.x,o=n.y,s=this.grid;return s[e-1]&&s[e-1][o]&&t.push(s[e-1][o]),s[e+1]&&s[e+1][o]&&t.push(s[e+1][o]),s[e]&&s[e][o-1]&&t.push(s[e][o-1]),s[e]&&s[e][o+1]&&t.push(s[e][o+1]),this.diagonal&&(s[e-1]&&s[e-1][o-1]&&t.push(s[e-1][o-1]),s[e+1]&&s[e+1][o-1]&&t.push(s[e+1][o-1]),s[e-1]&&s[e-1][o+1]&&t.push(s[e-1][o+1]),s[e+1]&&s[e+1][o+1]&&t.push(s[e+1][o+1])),t};vh.prototype.toString=function(){for(var n=[],t=this.grid,e,o,s,c,h=0,p=t.length;h<p;h++){for(e=[],o=t[h],s=0,c=o.length;s<c;s++)e.push(o[s].weight);n.push(e.join(" "))}return n.join(\`
|
|
11569
11569
|
\`)};function Eg(n,t,e){this.x=n,this.y=t,this.weight=e}Eg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Eg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Eg.prototype.isWall=function(){return this.weight===0};function TR(n){this.content=[],this.scoreFunction=n}TR.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,c=s-1,h=null,p;if(c<t){var g=this.content[c];p=this.scoreFunction(g),p<o&&(h=c)}if(s<t){var m=this.content[s],_=this.scoreFunction(m);_<(h===null?o:p)&&(h=s)}if(h!==null)this.content[n]=this.content[h],this.content[h]=e,n=h;else break}}};function k_(){this._=null}function sf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}k_.prototype={constructor:k_,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=CR(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(_h(this,e),n=e,e=n.U),e.C=!1,o.C=!0,xh(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(xh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,_h(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,c,h;if(o?s?c=CR(s):c=o:c=s,t?t.L===n?t.L=c:t.R=c:this._=c,o&&s?(h=c.C,c.C=n.C,c.L=o,o.U=c,c!==s?(t=c.U,c.U=n.U,n=c.R,t.L=n,c.R=s,s.U=c):(c.U=t,t=c,n=c.R)):(h=n.C,n=c),n&&(n.U=t),!h){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,_h(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,xh(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,_h(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,xh(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,_h(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,xh(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function _h(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function xh(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function CR(n){for(;n.L;)n=n.L;return n}var q_=k_;function af(n,t,e,o){var s=[null,null],c=qi.push(s)-1;return s.left=n,s.right=t,e&&Eh(s,n,t,e),o&&Eh(s,t,n,o),bo[n.index].halfedges.push(c),bo[t.index].halfedges.push(c),s}function uf(n,t,e){var o=[t,e];return o.left=n,o}function Eh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function S$(n,t,e,o,s){var c=n[0],h=n[1],p=c[0],g=c[1],m=h[0],_=h[1],E=0,x=1,b=m-p,P=_-g,I;if(I=t-p,!(!b&&I>0)){if(I/=b,b<0){if(I<E)return;I<x&&(x=I)}else if(b>0){if(I>x)return;I>E&&(E=I)}if(I=o-p,!(!b&&I<0)){if(I/=b,b<0){if(I>x)return;I>E&&(E=I)}else if(b>0){if(I<E)return;I<x&&(x=I)}if(I=e-g,!(!P&&I>0)){if(I/=P,P<0){if(I<E)return;I<x&&(x=I)}else if(P>0){if(I>x)return;I>E&&(E=I)}if(I=s-g,!(!P&&I<0)){if(I/=P,P<0){if(I>x)return;I>E&&(E=I)}else if(P>0){if(I<E)return;I<x&&(x=I)}return!(E>0)&&!(x<1)||(E>0&&(n[0]=[p+E*b,g+E*P]),x<1&&(n[1]=[p+x*b,g+x*P])),!0}}}}}function M$(n,t,e,o,s){var c=n[1];if(c)return!0;var h=n[0],p=n.left,g=n.right,m=p[0],_=p[1],E=g[0],x=g[1],b=(m+E)/2,P=(_+x)/2,I,S;if(x===_){if(b<t||b>=o)return;if(m>E){if(!h)h=[b,e];else if(h[1]>=s)return;c=[b,s]}else{if(!h)h=[b,s];else if(h[1]<e)return;c=[b,e]}}else if(I=(m-E)/(x-_),S=P-I*b,I<-1||I>1)if(m>E){if(!h)h=[(e-S)/I,e];else if(h[1]>=s)return;c=[(s-S)/I,s]}else{if(!h)h=[(s-S)/I,s];else if(h[1]<e)return;c=[(e-S)/I,e]}else if(_<x){if(!h)h=[t,I*t+S];else if(h[0]>=o)return;c=[o,I*o+S]}else{if(!h)h=[o,I*o+S];else if(h[0]<t)return;c=[t,I*t+S]}return n[0]=h,n[1]=c,!0}function PR(n,t,e,o){for(var s=qi.length,c;s--;)(!M$(c=qi[s],n,t,e,o)||!S$(c,n,t,e,o)||!(Math.abs(c[0][0]-c[1][0])>xr||Math.abs(c[0][1]-c[1][1])>xr))&&delete qi[s]}function IR(n){return bo[n.index]={site:n,halfedges:[]}}function b$(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function H_(n,t){return t[+(t.left!==n.site)]}function A$(n,t){return t[+(t.left===n.site)]}function RR(){for(var n=0,t=bo.length,e,o,s,c;n<t;++n)if((e=bo[n])&&(c=(o=e.halfedges).length)){var h=new Array(c),p=new Array(c);for(s=0;s<c;++s)h[s]=s,p[s]=b$(e,qi[o[s]]);for(h.sort(function(g,m){return p[m]-p[g]}),s=0;s<c;++s)p[s]=o[h[s]];for(s=0;s<c;++s)o[s]=p[s]}}function LR(n,t,e,o){var s=bo.length,c,h,p,g,m,_,E,x,b,P,I,S,w=!0;for(c=0;c<s;++c)if(h=bo[c]){for(p=h.site,m=h.halfedges,g=m.length;g--;)qi[m[g]]||m.splice(g,1);for(g=0,_=m.length;g<_;)P=A$(h,qi[m[g]]),I=P[0],S=P[1],E=H_(h,qi[m[++g%_]]),x=E[0],b=E[1],(Math.abs(I-x)>xr||Math.abs(S-b)>xr)&&(m.splice(g,0,qi.push(uf(p,P,Math.abs(I-n)<xr&&o-S>xr?[n,Math.abs(x-n)<xr?b:o]:Math.abs(S-o)<xr&&e-I>xr?[Math.abs(b-o)<xr?x:e,o]:Math.abs(I-e)<xr&&S-t>xr?[e,Math.abs(x-e)<xr?b:t]:Math.abs(S-t)<xr&&I-n>xr?[Math.abs(b-t)<xr?x:n,t]:null))-1),++_);_&&(w=!1)}if(w){var R,T,F,W=1/0;for(c=0,w=null;c<s;++c)(h=bo[c])&&(p=h.site,R=p[0]-n,T=p[1]-t,F=R*R+T*T,F<W&&(W=F,w=h));if(w){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];w.halfedges.push(qi.push(uf(p=w.site,X,q))-1,qi.push(uf(p,q,D))-1,qi.push(uf(p,D,xt))-1,qi.push(uf(p,xt,X))-1)}}for(c=0;c<s;++c)(h=bo[c])&&(h.halfedges.length||delete bo[c])}var NR=[],wg;function T$(){sf(this),this.x=this.y=this.arc=this.site=this.cy=null}function zl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,c=e.site;if(o!==c){var h=s[0],p=s[1],g=o[0]-h,m=o[1]-p,_=c[0]-h,E=c[1]-p,x=2*(g*E-m*_);if(!(x>=-OR)){var b=g*g+m*m,P=_*_+E*E,I=(E*b-m*P)/x,S=(g*P-_*b)/x,w=NR.pop()||new T$;w.arc=n,w.site=s,w.x=I+h,w.y=(w.cy=S+p)+Math.sqrt(I*I+S*S),n.circle=w;for(var R=null,T=lf._;T;)if(w.y<T.y||w.y===T.y&&w.x<=T.x)if(T.L)T=T.L;else{R=T.P;break}else if(T.R)T=T.R;else{R=T;break}lf.insert(R,w),R||(wg=w)}}}}function Gl(n){var t=n.circle;t&&(t.P||(wg=t.N),lf.remove(t),NR.push(t),sf(t),n.circle=null)}var FR=[];function C$(){sf(this),this.edge=this.site=this.circle=null}function DR(n){var t=FR.pop()||new C$;return t.site=n,t}function V_(n){Gl(n),kl.remove(n),FR.push(n),sf(n)}function UR(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],c=n.P,h=n.N,p=[n];V_(n);for(var g=c;g.circle&&Math.abs(e-g.circle.x)<xr&&Math.abs(o-g.circle.cy)<xr;)c=g.P,p.unshift(g),V_(g),g=c;p.unshift(g),Gl(g);for(var m=h;m.circle&&Math.abs(e-m.circle.x)<xr&&Math.abs(o-m.circle.cy)<xr;)h=m.N,p.push(m),V_(m),m=h;p.push(m),Gl(m);var _=p.length,E;for(E=1;E<_;++E)m=p[E],g=p[E-1],Eh(m.edge,g.site,m.site,s);g=p[0],m=p[_-1],m.edge=af(g.site,m.site,null,s),zl(g),zl(m)}function BR(n){for(var t=n[0],e=n[1],o,s,c,h,p=kl._;p;)if(c=zR(p,e)-t,c>xr)p=p.L;else if(h=t-P$(p,e),h>xr){if(!p.R){o=p;break}p=p.R}else{c>-xr?(o=p.P,s=p):h>-xr?(o=p,s=p.N):o=s=p;break}IR(n);var g=DR(n);if(kl.insert(o,g),!(!o&&!s)){if(o===s){Gl(o),s=DR(o.site),kl.insert(g,s),g.edge=s.edge=af(o.site,g.site),zl(o),zl(s);return}if(!s){g.edge=af(o.site,g.site);return}Gl(o),Gl(s);var m=o.site,_=m[0],E=m[1],x=n[0]-_,b=n[1]-E,P=s.site,I=P[0]-_,S=P[1]-E,w=2*(x*S-b*I),R=x*x+b*b,T=I*I+S*S,F=[(S*R-b*T)/w+_,(x*T-I*R)/w+E];Eh(s.edge,m,P,F),g.edge=af(m,n,null,F),s.edge=af(n,P,null,F),zl(o),zl(s)}}function zR(n,t){var e=n.site,o=e[0],s=e[1],c=s-t;if(!c)return o;var h=n.P;if(!h)return-1/0;e=h.site;var p=e[0],g=e[1],m=g-t;if(!m)return p;var _=p-o,E=1/c-1/m,x=_/m;return E?(-x+Math.sqrt(x*x-2*E*(_*_/(-2*m)-g+m/2+s-c/2)))/E+o:(o+p)/2}function P$(n,t){var e=n.N;if(e)return zR(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var xr=1e-6,OR=1e-12,kl,bo,lf,qi;function I$(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function R$(n,t){return t[1]-n[1]||t[0]-n[0]}function Sg(n,t){var e=n.sort(R$).pop(),o,s,c;for(qi=[],bo=new Array(n.length),kl=new q_,lf=new q_;;)if(c=wg,e&&(!c||e[1]<c.y||e[1]===c.y&&e[0]<c.x))(e[0]!==o||e[1]!==s)&&(BR(e),o=e[0],s=e[1]),e=n.pop();else if(c)UR(c.arc);else break;if(RR(),t){var h=+t[0][0],p=+t[0][1],g=+t[1][0],m=+t[1][1];PR(h,p,g,m),LR(h,p,g,m)}this.edges=qi,this.cells=bo,kl=lf=qi=bo=null}Sg.prototype={constructor:Sg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return H_(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(p=(c=e.halfedges).length)for(var s=e.site,c,h=-1,p,g,m=t[c[p-1]],_=m.left===s?m.right:m.left;++h<p;)g=_,m=t[c[h]],_=m.left===s?m.right:m.left,g&&_&&o<g.index&&o<_.index&&I$(s,g,_)<0&&n.push([s.data,g.data,_.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,c=o._found||0,h=o.cells.length,p;!(p=o.cells[c]);)if(++c>=h)return null;var g=n-p.site[0],m=t-p.site[1],_=g*g+m*m;do p=o.cells[s=c],c=null,p.halfedges.forEach(function(E){var x=o.edges[E],b=x.left;if(!((b===p.site||!b)&&!(b=x.right))){var P=n-b[0],I=t-b[1],S=P*P+I*I;S<_&&(_=S,c=b.index)}});while(c!==null);return o._found=s,e==null||_<=e*e?p.site:null}};var z$=on(cf(),1);var o1=on(HR(),1);function $o(){return new Ag}function Ag(){this.reset()}Ag.prototype={constructor:Ag,reset:function(){this.s=this.t=0},add:function(n){VR(bg,n,this.t),VR(this,bg.s,this.s),this.s?this.t+=bg.t:this.s=bg.t},valueOf:function(){return this.s}};var bg=new Ag;function VR(n,t,e){var o=n.s=t+e,s=o-t,c=o-s;n.t=t-c+(e-s)}var er=1e-6;var gr=Math.PI,wi=gr/2,Tg=gr/4,Na=gr*2,ql=180/gr,Zo=gr/180,$r=Math.abs,ia=Math.atan,Jo=Math.atan2,Vn=Math.cos;var Cg=Math.exp;var wh=Math.log;var sn=Math.sin;var eo=Math.sqrt,Sh=Math.tan;function Y_(n){return n>1?0:n<-1?gr:Math.acos(n)}function Ao(n){return n>1?wi:n<-1?-wi:Math.asin(n)}function oa(){}var G$=$o(),ift=$o();function Hl(n){var t=n[0],e=n[1],o=Vn(e);return[o*Vn(t),o*sn(t),sn(e)]}function Mh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function bh(n){var t=eo(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var dft=$o();function XR(n,t){return[n>gr?n-Na:n<-gr?n+Na:n,t]}XR.invert=XR;function $_(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:oa,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Z_(n,t){return $r(n[0]-t[0])<er&&$r(n[1]-t[1])<er}function Pg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function J_(n,t,e,o,s){var c=[],h=[],p,g;if(n.forEach(function(P){if(!((I=P.length-1)<=0)){var I,S=P[0],w=P[I],R;if(Z_(S,w)){for(s.lineStart(),p=0;p<I;++p)s.point((S=P[p])[0],S[1]);s.lineEnd();return}c.push(R=new Pg(S,P,null,!0)),h.push(R.o=new Pg(S,null,R,!1)),c.push(R=new Pg(w,P,null,!1)),h.push(R.o=new Pg(w,null,R,!0))}}),!!c.length){for(h.sort(t),YR(c),YR(h),p=0,g=h.length;p<g;++p)h[p].e=e=!e;for(var m=c[0],_,E;;){for(var x=m,b=!0;x.v;)if((x=x.n)===m)return;_=x.z,s.lineStart();do{if(x.v=x.o.v=!0,x.e){if(b)for(p=0,g=_.length;p<g;++p)s.point((E=_[p])[0],E[1]);else o(x.x,x.n.x,1,s);x=x.n}else{if(b)for(_=x.p.z,p=_.length-1;p>=0;--p)s.point((E=_[p])[0],E[1]);else o(x.x,x.p.x,-1,s);x=x.p}x=x.o,_=x.z,b=!b}while(!x.v);s.lineEnd()}}}function YR(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function el(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function K_(n){return n.length===1&&(n=H$(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)<0?o=c+1:s=c}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)>0?s=c:o=c+1}return o}}}function H$(n){return function(t,e){return el(n(t),e)}}var $R=K_(el),V$=$R.right,W$=$R.left;var ZR=Array.prototype,Y$=ZR.slice,$$=ZR.map;var sht=Math.sqrt(50),aht=Math.sqrt(10),uht=Math.sqrt(2);function Rg(n){for(var t=n.length,e,o=-1,s=0,c,h;++o<t;)s+=n[o].length;for(c=new Array(s);--t>=0;)for(h=n[t],e=h.length;--e>=0;)c[--s]=h[e];return c}var nZ=1e9,Wpt=-nZ;var j_=$o();function Q_(n,t){var e=t[0],o=t[1],s=[sn(e),-Vn(e),0],c=0,h=0;j_.reset();for(var p=0,g=n.length;p<g;++p)if(_=(m=n[p]).length)for(var m,_,E=m[_-1],x=E[0],b=E[1]/2+Tg,P=sn(b),I=Vn(b),S=0;S<_;++S,x=R,P=F,I=W,E=w){var w=m[S],R=w[0],T=w[1]/2+Tg,F=sn(T),W=Vn(T),X=R-x,q=X>=0?1:-1,D=q*X,xt=D>gr,B=P*F;if(j_.add(Jo(B*q*sn(D),I*W+B*Vn(D))),c+=xt?X+q*Na:X,xt^x>=e^R>=e){var j=Mh(Hl(E),Hl(w));bh(j);var J=Mh(s,j);bh(J);var Dt=(xt^X>=0?-1:1)*Ao(J[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(h+=xt^X>=0?1:-1)}}return(c<-er||c<er&&j_<-er)^h&1}var edt=$o();var xdt=$o(),Edt=$o();var oZ=1/0;var Mdt=-oZ;function t1(n){this._context=n}t1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Na);break}}},result:oa};var Odt=$o();function e1(){this._string=[]}e1.prototype={_radius:4.5,_circle:jR(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=jR(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function jR(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function n1(n,t,e,o){return function(s,c){var h=t(c),p=s.invert(o[0],o[1]),g=$_(),m=t(g),_=!1,E,x,b,P={point:I,lineStart:w,lineEnd:R,polygonStart:function(){P.point=T,P.lineStart=F,P.lineEnd=W,x=[],E=[]},polygonEnd:function(){P.point=I,P.lineStart=w,P.lineEnd=R,x=Rg(x);var X=Q_(E,p);x.length?(_||(c.polygonStart(),_=!0),J_(x,uZ,X,e,c)):X&&(_||(c.polygonStart(),_=!0),c.lineStart(),e(null,null,1,c),c.lineEnd()),_&&(c.polygonEnd(),_=!1),x=E=null},sphere:function(){c.polygonStart(),c.lineStart(),e(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function I(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&c.point(X,q)}function S(X,q){var D=s(X,q);h.point(D[0],D[1])}function w(){P.point=S,h.lineStart()}function R(){P.point=I,h.lineEnd()}function T(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function W(){T(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,J;if(b.pop(),E.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(_||(c.polygonStart(),_=!0),c.lineStart(),D=0;D<B;++D)c.point((J=j[D])[0],J[1]);c.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),x.push(q.filter(aZ))}}return P}}function aZ(n){return n.length>1}function uZ(n,t){return((n=n.x)[0]<0?n[1]-wi-er:wi-n[1])-((t=t.x)[0]<0?t[1]-wi-er:wi-t[1])}var lZ=n1(function(){return!0},cZ,hZ,[-gr,-wi]);function cZ(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(c,h){var p=c>0?gr:-gr,g=$r(c-t);$r(g-gr)<er?(n.point(t,e=(e+h)/2>0?wi:-wi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(p,e),n.point(c,e),s=0):o!==p&&g>=gr&&($r(t-o)<er&&(t-=o*er),$r(c-p)<er&&(c-=p*er),e=fZ(t,e,c,h),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(p,e),s=0),n.point(t=c,e=h),o=p},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function fZ(n,t,e,o){var s,c,h=sn(n-e);return $r(h)>er?ia((sn(t)*(c=Vn(o))*sn(e)-sn(o)*(s=Vn(t))*sn(n))/(s*c*h)):(t+o)/2}function hZ(n,t,e,o){var s;if(n==null)s=e*wi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if($r(n[0]-t[0])>er){var c=n[0]<t[0]?gr:-gr;s=e*c/2,o.point(-c,s),o.point(0,s),o.point(c,s)}else o.point(t[0],t[1])}function Lg(n){return function(t){var e=new r1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function r1(){}r1.prototype={constructor:r1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Egt=Vn(30*Zo);var Dgt=Lg({point:function(n,t){this.stream.point(n*Zo,t*Zo)}});function Ng(n){return function(t,e){var o=Vn(t),s=Vn(e),c=n(o*s);return[c*s*sn(t),c*sn(e)]}}function Oa(n){return function(t,e){var o=eo(t*t+e*e),s=n(o),c=sn(s),h=Vn(s);return[Jo(t*c,o*h),Ao(o&&e*c/o)]}}var oL=Ng(function(n){return eo(2/(1+n))});oL.invert=Oa(function(n){return 2*Ao(n/2)});var sL=Ng(function(n){return(n=Y_(n))&&n/sn(n)});sL.invert=Oa(function(n){return n});function i1(n,t){return[n,wh(Sh((wi+t)/2))]}i1.invert=function(n,t){return[n,2*ia(Cg(t))-wi]};function Og(n,t){return[n,t]}Og.invert=Og;function aL(n,t){var e=Vn(t),o=Vn(n)*e;return[e*sn(n)/o,sn(t)/o]}aL.invert=Oa(ia);function uL(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}uL.invert=function(n,t){var e=t,o=25,s;do{var c=e*e,h=c*c;e-=s=(e*(1.007226+c*(.015085+h*(-.044475+.028874*c-.005916*h)))-t)/(1.007226+c*(.015085*3+h*(-.044475*7+.028874*9*c-.005916*11*h)))}while($r(s)>er&&--o>0);return[n/(.8707+(c=e*e)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),e]};function lL(n,t){return[Vn(t)*sn(n),sn(t)]}lL.invert=Oa(Ao);function cL(n,t){var e=Vn(t),o=1+Vn(n)*e;return[e*sn(n)/o,sn(t)/o]}cL.invert=Oa(function(n){return 2*ia(n)});function fL(n,t){return[wh(Sh((wi+t)/2)),-n]}fL.invert=function(n,t){return[-t,2*ia(Cg(n))-wi]};var vZ=on(cf(),1);var _Z=on(cf(),1);var EZ=on(cf(),1);var wZ=on(cf(),1);function Dg(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function pL(n){let t=0;for(let e=0;e<n.length-1;e++)t+=Dg(n[e],n[e+1]);return t}var Fs=on(dL(),1);var $n="___",Fg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(c){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(c){s=[]}return Iu({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+$n+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+$n+e,s=this.nodeMap.get(o);if(!s)return null;let c=this.pointMap.get(s);return c!=null?c:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(c=>{(c.points||[]).filter(h=>h.openStatus!==!1).filter(h=>{if(!h.startTime||!h.endTime)return!0;let[p,g]=h.startTime.split(":").map(b=>+b),[m,_]=h.endTime.split(":").map(b=>+b),E=p*60+g,x=m*60+_;return s>=E&&s<=x}).forEach(h=>{h.floor=c.floor;let p=""+c.floor+$n+h.id;if(this.nodeMap.set(""+c.floor+$n+h.nodeId,""+c.floor+$n+(h.relatedId||h.id)),this.pointMap.set(p,h),this.isFacilityByType(h.type)){let g=this.facilities.find(m=>m.id===+h.targetId);if(g){switch(g.entry_infra_type){case"straightLadder":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.straightLadderMap.get(h.targetId)||[];x.push(Iu({},h)),this.straightLadderMap.set(h.targetId,x)}break;case"staircase":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.staircaseMap.get(h.targetId)||[];x.push(Iu({},h)),this.staircaseMap.set(h.targetId,x)}break;case"escalator":let _=this.escalatorMap.get(h.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=h:_.push({start:h})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=h:_.push({end:h})}this.escalatorMap.set(h.targetId,_);break;case"ramp":let E=this.rampMap.get(h.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=E.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=h:E.push({start:h})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=E.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=h:E.push({end:h})}this.rampMap.set(h.targetId,E);break;case"connectionPoint":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.connectionPointMap.get(h.targetId)||[];x.push(Iu({},h)),this.connectionPointMap.set(h.targetId,x)}break}let m=this.facilityMap.get(h.targetId)||[];m.push(Iu({},h)),this.facilityMap.set(h.targetId,m)}}h.type==="parkingSpace"&&this.parkingMap.set(""+c.floor+$n+h.name,h)}),(c.lines||[]).filter(h=>h.to!==h.from).forEach(h=>{let p=""+c.floor+$n+h.from,g=""+c.floor+$n+h.to,m=this.pointMap.get(p),_=this.pointMap.get(g);if(!m||!_)return;let E=m.cds,x=_.cds,b=Dg(E,x);if(!m.permission&&!_.permission){switch(this.addLineItem(p,g,b),this.addLineItem(g,p,b),h.direction){case"double":this.addLineItem(p,g,b,this.forwardLineMap),this.addLineItem(g,p,b,this.forwardLineMap);break;case"single":this.addLineItem(p,g,b,this.forwardLineMap);break;case"back":this.addLineItem(g,p,b,this.forwardLineMap);break}(m.type==="parkingSpace"||_.type==="parkingSpace")&&h.direction==="noDir"&&(this.addLineItem(p,g,b,this.forwardLineMap),this.addLineItem(g,p,b,this.forwardLineMap))}else m.permission&&(this.setPermissionLine(p,g,m.permission,b,""),this.setPermissionLine(g,p,m.permission,b,"")),_.permission&&_.permission!==m.permission&&(this.setPermissionLine(p,g,_.permission,b,""),this.setPermissionLine(g,p,_.permission,b,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,c){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:c})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"straightLadder"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"staircase"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&(h.permission&&this.setPermissionLine(s,c,h.permission,1,"escalator"),p.permission&&p.permission!==h.permission&&this.setPermissionLine(s,c,p.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&(h.permission&&this.setPermissionLine(s,c,h.permission,10,"ramp"),p.permission&&p.permission!==h.permission&&this.setPermissionLine(s,c,p.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"connectionPoint"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,o,s){let c=this.getPermissionMap(t);console.log(c),c.forEach(h=>{e.includes(h.type)&&(h.type===""?this.addLineItem(h.fromKey,h.toKey,h.distance,o):this.addLineItem(h.fromKey,h.toKey,s.get(h.type),o))})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let c=s.get(t)||new Map;c.set(e,o),s.set(t,c)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(c=>{let[h,p]=c;if(!(p.length<2))for(let g=0;g<p.length;g++){let m=""+p[g].floor+$n+p[g].id,_=this.pointMap.get(m);if(!(!_||_.permission)){for(let E=0;E<p.length;E++)if(g!==E){let x=""+p[E].floor+$n+p[E].id,b=this.pointMap.get(x);if(!b||b.permission)continue;if(p[g].type==="straightLadder"){let P=e;this.addLineItem(m,x,P,s)}else{let P=o;this.addLineItem(m,x,P,s)}}}}}),this.escalatorMap.forEach((c,h)=>{c.forEach(p=>{if(p.start&&p.end){let g=""+p.start.floor+$n+p.start.id,m=""+p.end.floor+$n+p.end.id,_=this.pointMap.get(g),E=this.pointMap.get(m);if(_&&E&&!_.permission&&!E.permission){let x=t;this.addLineItem(g,m,x,s)}}})}),this.connectionPointMap.forEach((c,h)=>{if(!(c.length<2))for(let p=0;p<c.length;p++){let g=""+c[p].floor+$n+c[p].id,m=this.pointMap.get(g);if(!(!m||m.permission)){for(let _=0;_<c.length;_++)if(p!==_){let E=""+c[_].floor+$n+c[_].id,x=this.pointMap.get(E);if(!x||x.permission)continue;this.addLineItem(g,E,100,s)}}}})}initBaseRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new no.default(t)}initEscalatorRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new no.default(t)}initStraightLadderRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new no.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&!h.permission&&!p.permission&&this.addLineItem(s,c,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(!(!c||c.permission)){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g||g.permission)continue;this.addLineItem(s,p,100,this.forwardLineMap)}}}}),this.forwardRoute=new no.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e){var o;if(t.nodeId){let s=this.nodeMap.get(""+t.floor+$n+t.nodeId);if(s){let[c,h]=s.split($n);return{floor:c,id:h}}}if((o=t.coord)!=null&&o.length){let s=this.roadInfo.find(h=>h.floor===t.floor);if(!s)return null;let c=s.points.reduce((h,p)=>{if(p.relatedId)return h;let g=""+p.floor+$n+p.id;if(e==="forward"){if(!this.forwardLineMap.has(g))return h}else if(!this.lineMap.has(g))return h;let m=Dg(t.coord,p.cds);return m<h.min&&(h.min=m,h.point=p),h},{min:1/0,point:s.points[0]});return{floor:s.floor,id:c.point.id}}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+$n+t.parkingSpace);if(s)return{floor:t.floor,id:s.id}}let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(c=>+c.type_id==+t.facility).map(c=>c.id).map(c=>this.facilityMap.get(""+c)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,c){if(o===void 0&&(o=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let h=this.transformStart(t,o);if(!h)return"no-start";let p=this.transformEnd(e,o);if(!p)return"no-end";let g;switch(o){case"escalator":g=this.getEscalatorPath.bind(this);break;case"straightLadder":g=this.getStraightLadderPath.bind(this);break;case"forward":g=this.getForwardPath.bind(this);break;default:g=this.getBasePath.bind(this);break}if(p.id)return g(h,p,s,c);if(p.facility){let _=this.facilities.filter(x=>+x.type_id==+e.facility).map(x=>x.id).map(x=>this.facilityMap.get(""+x)).flat(2).filter(x=>x).filter(x=>p.floor?x.floor===p.floor:!0);if(!_.length)return null;let E=_.map(x=>g(h,{floor:x.floor,id:x.id},s,c)).filter(x=>!!x);return E.reduce((x,b)=>{let P=b[0].consume;return P<x.distance&&(x.distance=P,x.path=b),x},{distance:1/0,path:E[0]}).path}}getRoutePath(t,e,o){let s=""+t.floor+$n+t.id,c=""+e.floor+$n+e.id,h=o.path(s,c);if(!h)return null;let p=[],g=h.reduce((m,_,E,x)=>{if(E===0)return 0;let b=x[E-1],P=o.graph.get(b).get(_);return m+P},0);return h.map(m=>{let _=this.pointMap.get(m);if(_){var E;let{floor:x}=_,b=_.type;if(this.isFacilityByType(_.type)){let P=this.facilities.find(I=>I.id===+_.targetId);P&&(b=P.entry_infra_type)}if(((E=p[p.length-1])==null?void 0:E.floor)===x){let P=p[p.length-1];P.points.push(_.cds),P.pointInfos.push(_),P.endType=b,P.destId=_.nodeId,P.distance=pL(P.points)}else p.push({floor:x,points:[_.cds],pointInfos:[_],endType:b,destId:_.nodeId,distance:0,consume:g})}}),p}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let s=(0,Fs.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let c=new no.default(s);return this.getRoutePath(t,e,c)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let s=(0,Fs.cloneDeep)(this.escalatorRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",1*c],["connectionPoint",100],["straightLadder",this.lift_priority*c],["staircase",3e4*c]]));let h=new no.default(s);return this.getRoutePath(t,e,h)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let s=(0,Fs.cloneDeep)(this.straightLadderRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*c],["connectionPoint",100],["straightLadder",1*c],["staircase",3e4*c]]));let h=new no.default(s);return this.getRoutePath(t,e,h)}getForwardPath(t,e,o,s){let c=new Map,h=x=>{let b=this.forwardRoute.graph.get(g);x.forEach(P=>{let I=b.get(P);(0,Fs.isNil)(I)||(c.set(P,I),b.delete(P))})},p=()=>{let x=this.forwardRoute.graph.get(g);c.forEach((b,P)=>{x.set(P,b)})},g=""+t.floor+$n+t.id;if(!(0,Fs.isNil)(s)){let x=this.forwardLineMap.get(g),b=this.pointMap.get(g);if(b&&(x!=null&&x.size)&&x.size>1){let P=new Yn(b.cds[0],b.cds[1]),I=new Map;x.forEach((w,R)=>{let T=this.pointMap.get(R);if(T){let F=new Yn(T.cds[0],T.cds[1]),X=360-(new Yn().subVectors(F,P).angle()/Math.PI*180-90+360)%360;I.set(R,X)}});let S=Array.from(I).filter(w=>{let[R,T]=w;return Math.abs(T-s)<=60}).map(w=>{let[R]=w;return R});if(S.length)S.forEach(w=>I.delete(w)),h([...I.keys()]);else{let w=Array.from(I).reduce((R,T)=>{let F=Math.abs(T[1]-s);return F<R.diff?{diff:F,key:T[0]}:R},{diff:1/0,key:""});I.delete(w.key),h([...I.keys()])}}}if(!o){let x=this.getRoutePath(t,e,this.forwardRoute);return p(),x||this.getRoutePath(t,e,this.forwardRoute)}let m=(0,Fs.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],m,new Map([["ramp",10]]));let _=new no.default(m),E=this.getRoutePath(t,e,_);if(p(),E)return E;{let x=(0,Fs.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],x,new Map([["ramp",10]]));let b=new no.default(x);return this.getRoutePath(t,e,b)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new no.default,this.escalatorRoute=new no.default,this.straightLadderRoute=new no.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new no.default,this.escalatorRoute=new no.default,this.straightLadderRoute=new no.default,this.forwardLineMap=new Map,this.forwardRoute=new no.default}};var lxt=on(kL(),1),cxt=on(Fp(),1);function qL(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function HL(n){let t={};for(let o in n)o.startsWith("on")&&(t[qL(o.slice(2))]=n[o]);let e=o=>ec(this,null,function*(){let{data:s}=o;if(t[s.type])try{let c=yield t[s.type](s.data);self.postMessage({type:""+s.type+"_result",key:s.key,data:c})}catch(c){self.postMessage({type:""+s.type+"_result",key:s.key,error:c})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var sa=new Fg,VL,yJ=new Promise(n=>{VL=n});function WL(n,t,e){let{floor:o,coord:s}=n,c=null;return(t||[]).forEach(h=>{let p=sa.getPath({floor:o,coord:s},{floor:h.floor,parkingSpace:h.lot_id},"forward",0,e);if(!p||typeof p=="string")return;let g={floor:h.floor,spaceNo:h.lot_id,distance:p[0].consume};c||(c=g),c.distance>g.distance&&(c=g)}),c}function vJ(n,t,e,o,s){let c=WL({floor:n,coord:t},e[n],s);return c||_J(n,t,e,o,s)}function _J(n,t,e,o,s){let c=o.indexOf(n);c===-1&&(c=o.length);let h=1,p=null;for(;h<=o.length;){if(o.filter((m,_)=>_===c-1||_===c+1).forEach(m=>{let _=WL({floor:n,coord:t},e[m],s);p?_&&p.distance>_.distance&&(p=_):p=_}),p)return p;h++}return p}function xJ(n,t,e,o,s){let c=p1(n,t,t.floor,e,s);if(c)return c;let h=p1(n,t,n.floor,e,s);return h||EJ(n,t,n.floor,e,o,s)}function p1(n,t,e,o,s){let c=o[e]||[];if(!c.length)return null;let h=null;return c.forEach(p=>{let g={floor:p.floor,parkingSpace:p.lot_id},m=sa.getPath(n,g,"forward",0,s);if(!m||typeof m=="string")return;let _=sa.getParkingSpaceInfo(p.floor,p.lot_id);if(!_)return;let E=sa.getPath({floor:p.floor,coord:_.cds},t,"",0);if(!E||typeof E=="string")return;let x={floor:p.floor,spaceNo:p.lot_id,distance:E[0].consume};h?h.distance>x.distance&&(h=x):h=x}),h}function EJ(n,t,e,o,s,c){let h=s.indexOf(e);h===-1&&(h=s.length);let p=1,g=null;for(;p<=s.length;){if(s.filter((_,E)=>E===h-1||E===h+1).forEach(_=>{let E=p1(n,t,_,o,c);g?E&&g.distance>E.distance&&(g=E):g=E}),g)return g;p++}return g}function wJ(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=sa.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}return null}function SJ(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=sa.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}if(n.parkingSpace){let t=sa.getParkingSpaceInfo(n.floor,n.parkingSpace);if(t)return{floor:t.floor,coord:t.cds}}return null}HL({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;sa.initRoute(t,e),VL(!0)},onGetPath(n){let{start:t,end:e,type:o,permission:s,travelDirection:c}=n;return sa.getPath(t,e,o,s,c)},onRecommend(n){return ec(this,null,function*(){let{start:t,end:e,travelDirection:o,carLotStatus:s}=n;yield yJ;let c=s.reduce((m,_)=>(m[_.floor]?m[_.floor].push(_):m[_.floor]=[_],m),{}),h=sa.roadInfo.map(m=>m.floor),p=wJ(t);if(!p)return null;let g=e?SJ(e):null;return g?xJ(p,g,c,h,o):vJ(p.floor,p.coord,c,h,o)})},onClear(){sa.clear()}});
|
|
11570
|
-
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var UR={placeId:0,catLotStatusApi:"https://nav.aibee.cn/aether-walker/parking/cat-lot-status"},L1=class{setRoadData(t,e){return At(this.worker,"set_road_data",{roadData:t,facilities:e})}recommend(t){return j(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(n=>n.json()).then(n=>n.data.filter(i=>i.status===0));return At(this.worker,"recommend",T({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=Cc(),this.options=T({},UR,t)}};var B1=class extends fa{showMyPosition(t,e){let n=this.getGraphicByNodeId(t);if(n){let i=new fr(this.context,{autoUpdate:!0,appendToBody:!0});i.div.appendChild(e),i.bindElement(n),this.myPositionOverlay=i}}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40]}),t.map(i=>this.getPoiById(i)).filter(i=>!!i).forEach(i=>{var o;(o=i.userData).restore||(o.restore={});for(let u in e)if(u in i.options){var s,a;(s=i.userData.restore)[a=u]||(s[a]=i.options[u]),i.options[u]=e[u]}})}restorePoi(t){t.map(n=>this.getPoiById(n)).filter(n=>!!n).forEach(n=>{console.log("poi.userData.restore",n.userData.restore);for(let i in n.userData.restore)i in n.options&&(n.options[i]=n.userData.restore[i]);n.userData.restore={}})}dispose(){this.hideMyPosition(),super.dispose()}constructor(...t){super(...t),this.myPositionOverlay=null}};export{pa as AibeeLoader,B1 as BMap,C1 as BMapSelect,zt as BaseSvg,J1 as CarInertialPosition,Fo as ClickHelper,ua as Context,S1 as CrLoader,Z1 as CrNavPath,b1 as Equipment,I2 as Events,Ft as Floor,Us as GlbModel,Q as Graphic,Xs as GraphicLayer,mr as GroundTexture,Es as HeatmapElement,at as HooksName,Qs as HoverHelper,Gs as Lane,q as Layer,Js as LineElement,ZH as MapTypePolar,gr as MergeGraphic,Ds as Model,N1 as MulFloorNavigation,U1 as MulFloorSelect,D1 as MulFloors,X1 as NavPath,E1 as Navigation,fr as Overlay,Os as ParkingLayer,We as PathDirection,R1 as PdrPosition,Wn as Poi,$ as Poi2,Cs as PoiLayer,dr as PoiLayer2,L1 as RecommendParkingSpace,Pg as RoadNetwork,Og as RoadNetwork2,GA as SelectBox,Bs as Selection,ya as Sensor,Ys as Shadow,Fs as SvgLine,zs as SvgPolygon,Hn as TaskQueue,Vs as TextTexture,H as Timer,tn as TweenUtil,x2 as UA,Ns as Wall,SU as addAlphaToHexColor,Wo as calc_angle,l0 as calc_direction,pet as calculateInstantaneousSpeed,va as calculateLineDirection,Kg as convertToSnakeCase,Jr as createCircle,Eo as createLine,Be as createRect,Hm as createSvg,Yo as createSvgElement,hk as createThreeBox,ck as createThreeLine,_e as darkenColor,hK as defaultConfig,gc as defaultGraphicOptions,N9 as defaultOptions,yO as defaultTextTextureOptions,FN as deviceToVector3,L as dispose,rg as distancePointToSegment,Ln as generatorKeyByObj,vY as getAngle,_o as getCenter,g1 as getConfig,sG as getDirectPath,ig as getDistanceByPathPos,K as getLength,zN as getLongestSideDir,jm as getMinEdgeSquare,xt as getPathLength,ve as getPointEdgeIndex,Bn as getPosByPathDistance,zu as hasChinese,e0 as hexToRgb,um as initDirectionalLight,am as initLight,he as initShape,_U as isAndroid,Le as isContain,Jn as isControl,Br as isIphone,Vn as isMac,Am as isPointInPolygon,T1 as loadBuildingGround,pH as loadExternalStreet,w1 as loadGraphics,oG as moveOnRoute,Oi as predictFuturePosition,fet as predictFutureSpeed,Gn as proxyOptions,det as removeOutliers,WY as removeWeightPath,An as setCirclePosition,Lt as setLineStartEnd,st as setRectPosition,Ko as simplifyPath,$m as sleepByRf,qm as sleepOnePromise,Do as sleepOneRf,ng as smoothPath,wU as strToNumber,It as timeoutPromise,sk as toWebWorker,pt as transformGraphicData,Zc as transformSpeed,Qn as translatePosToCenter,At as triggerWorker,W as vector3ToDevice,HU as xhrGet};
|
|
11570
|
+
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var UR={placeId:0,catLotStatusApi:"https://nav.aibee.cn/aether-walker/parking/cat-lot-status"},L1=class{setRoadData(t,e){return At(this.worker,"set_road_data",{roadData:t,facilities:e})}recommend(t){return j(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(n=>n.json()).then(n=>n.data.filter(i=>i.status===0));return At(this.worker,"recommend",T({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=Cc(),this.options=T({},UR,t)}};var B1=class extends fa{showMyPosition(t,e){let n=this.getGraphicByNodeId(t);if(n){let i=new fr(this.context,{autoUpdate:!0,appendToBody:!0});i.div.appendChild(e),i.bindElement(n),this.myPositionOverlay=i}}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40],collision_enable:!1}),t.map(i=>this.getPoiById(i)).filter(i=>!!i).forEach(i=>{var o;(o=i.userData).restore||(o.restore={});for(let u in e)if(u in i.options){var s,a;(s=i.userData.restore)[a=u]||(s[a]=i.options[u]),i.options[u]=e[u]}})}restorePoi(t){t.map(n=>this.getPoiById(n)).filter(n=>!!n).forEach(n=>{console.log("poi.userData.restore",n.userData.restore);for(let i in n.userData.restore)i in n.options&&(n.options[i]=n.userData.restore[i]);n.userData.restore={}})}dispose(){this.hideMyPosition(),super.dispose()}constructor(...t){super(...t),this.myPositionOverlay=null}};export{pa as AibeeLoader,B1 as BMap,C1 as BMapSelect,zt as BaseSvg,J1 as CarInertialPosition,Fo as ClickHelper,ua as Context,S1 as CrLoader,Z1 as CrNavPath,b1 as Equipment,I2 as Events,Ft as Floor,Us as GlbModel,Q as Graphic,Xs as GraphicLayer,mr as GroundTexture,Es as HeatmapElement,at as HooksName,Qs as HoverHelper,Gs as Lane,q as Layer,Js as LineElement,ZH as MapTypePolar,gr as MergeGraphic,Ds as Model,N1 as MulFloorNavigation,U1 as MulFloorSelect,D1 as MulFloors,X1 as NavPath,E1 as Navigation,fr as Overlay,Os as ParkingLayer,We as PathDirection,R1 as PdrPosition,Wn as Poi,$ as Poi2,Cs as PoiLayer,dr as PoiLayer2,L1 as RecommendParkingSpace,Pg as RoadNetwork,Og as RoadNetwork2,GA as SelectBox,Bs as Selection,ya as Sensor,Ys as Shadow,Fs as SvgLine,zs as SvgPolygon,Hn as TaskQueue,Vs as TextTexture,H as Timer,tn as TweenUtil,x2 as UA,Ns as Wall,SU as addAlphaToHexColor,Wo as calc_angle,l0 as calc_direction,pet as calculateInstantaneousSpeed,va as calculateLineDirection,Kg as convertToSnakeCase,Jr as createCircle,Eo as createLine,Be as createRect,Hm as createSvg,Yo as createSvgElement,hk as createThreeBox,ck as createThreeLine,_e as darkenColor,hK as defaultConfig,gc as defaultGraphicOptions,N9 as defaultOptions,yO as defaultTextTextureOptions,FN as deviceToVector3,L as dispose,rg as distancePointToSegment,Ln as generatorKeyByObj,vY as getAngle,_o as getCenter,g1 as getConfig,sG as getDirectPath,ig as getDistanceByPathPos,K as getLength,zN as getLongestSideDir,jm as getMinEdgeSquare,xt as getPathLength,ve as getPointEdgeIndex,Bn as getPosByPathDistance,zu as hasChinese,e0 as hexToRgb,um as initDirectionalLight,am as initLight,he as initShape,_U as isAndroid,Le as isContain,Jn as isControl,Br as isIphone,Vn as isMac,Am as isPointInPolygon,T1 as loadBuildingGround,pH as loadExternalStreet,w1 as loadGraphics,oG as moveOnRoute,Oi as predictFuturePosition,fet as predictFutureSpeed,Gn as proxyOptions,det as removeOutliers,WY as removeWeightPath,An as setCirclePosition,Lt as setLineStartEnd,st as setRectPosition,Ko as simplifyPath,$m as sleepByRf,qm as sleepOnePromise,Do as sleepOneRf,ng as smoothPath,wU as strToNumber,It as timeoutPromise,sk as toWebWorker,pt as transformGraphicData,Zc as transformSpeed,Qn as translatePosToCenter,At as triggerWorker,W as vector3ToDevice,HU as xhrGet};
|
package/lib/platform/wrapper.js
CHANGED
|
@@ -11567,4 +11567,4 @@ void main() {
|
|
|
11567
11567
|
|
|
11568
11568
|
}\`,Ky=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let s=new Ds,c=t.properties.get(s);c.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,s=new Ca({extensions:{fragDepth:!0},vertexShader:VW,fragmentShader:WW,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new ea(new bd(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},jy=class extends Yu{constructor(t,e){super();let o=this,s=null,c=1,h=null,p="local-floor",g=1,m=null,_=null,E=null,x=null,b=null,P=null,I=new Ky,S=e.getContextAttributes(),w=null,R=null,T=[],F=[],W=new Yn,X=null,q=new ps;q.layers.enable(1),q.viewport=new Ki;let D=new ps;D.layers.enable(2),D.viewport=new Ki;let xt=[q,D],B=new Jy;B.layers.enable(1),B.layers.enable(2);let j=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getTargetRaySpace()},this.getControllerGrip=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getGripSpace()},this.getHand=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getHandSpace()};function Dt(at){let Ut=F.indexOf(at.inputSource);if(Ut===-1)return;let jt=T[Ut];jt!==void 0&&(jt.update(at.inputSource,at.frame,m||h),jt.dispatchEvent({type:at.type,data:at.inputSource}))}function Q(){s.removeEventListener("select",Dt),s.removeEventListener("selectstart",Dt),s.removeEventListener("selectend",Dt),s.removeEventListener("squeeze",Dt),s.removeEventListener("squeezestart",Dt),s.removeEventListener("squeezeend",Dt),s.removeEventListener("end",Q),s.removeEventListener("inputsourceschange",At);for(let at=0;at<T.length;at++){let Ut=F[at];Ut!==null&&(F[at]=null,T[at].disconnect(Ut))}j=null,J=null,I.reset(),t.setRenderTarget(w),b=null,x=null,E=null,s=null,R=null,ae.stop(),o.isPresenting=!1,t.setPixelRatio(X),t.setSize(W.width,W.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(at){c=at,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(at){p=at,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return m||h},this.setReferenceSpace=function(at){m=at},this.getBaseLayer=function(){return x!==null?x:b},this.getBinding=function(){return E},this.getFrame=function(){return P},this.getSession=function(){return s},this.setSession=function(at){return ec(this,null,function*(){if(s=at,s!==null){if(w=t.getRenderTarget(),s.addEventListener("select",Dt),s.addEventListener("selectstart",Dt),s.addEventListener("selectend",Dt),s.addEventListener("squeeze",Dt),s.addEventListener("squeezestart",Dt),s.addEventListener("squeezeend",Dt),s.addEventListener("end",Q),s.addEventListener("inputsourceschange",At),S.xrCompatible!==!0&&(yield e.makeXRCompatible()),X=t.getPixelRatio(),t.getSize(W),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let Ut={antialias:s.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:c};b=new XRWebGLLayer(s,e,Ut),s.updateRenderState({baseLayer:b}),t.setPixelRatio(1),t.setSize(b.framebufferWidth,b.framebufferHeight,!1),R=new hu(b.framebufferWidth,b.framebufferHeight,{format:ta,type:Wu,colorSpace:t.outputColorSpace,stencilBuffer:S.stencil})}else{let Ut=null,jt=null,ce=null;S.depth&&(ce=S.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Ut=S.stencil?Uc:Pl,jt=S.stencil?Cl:qu);let te={colorFormat:e.RGBA8,depthFormat:ce,scaleFactor:c};E=new XRWebGLBinding(s,e),x=E.createProjectionLayer(te),s.updateRenderState({layers:[x]}),t.setPixelRatio(1),t.setSize(x.textureWidth,x.textureHeight,!1),R=new hu(x.textureWidth,x.textureHeight,{format:ta,type:Wu,depthTexture:new Td(x.textureWidth,x.textureHeight,jt,void 0,void 0,void 0,void 0,void 0,void 0,Ut),stencilBuffer:S.stencil,colorSpace:t.outputColorSpace,samples:S.antialias?4:0});let $t=t.properties.get(R);$t.__ignoreDepthValues=x.ignoreDepthValues}R.isXRRenderTarget=!0,this.setFoveation(g),m=null,h=yield s.requestReferenceSpace(p),ae.setContext(s),ae.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function At(at){for(let Ut=0;Ut<at.removed.length;Ut++){let jt=at.removed[Ut],ce=F.indexOf(jt);ce>=0&&(F[ce]=null,T[ce].disconnect(jt))}for(let Ut=0;Ut<at.added.length;Ut++){let jt=at.added[Ut],ce=F.indexOf(jt);if(ce===-1){for(let $t=0;$t<T.length;$t++)if($t>=F.length){F.push(jt),ce=$t;break}else if(F[$t]===null){F[$t]=jt,ce=$t;break}if(ce===-1)break}let te=T[ce];te&&te.connect(jt)}}let Mt=new Lt,Rt=new Lt;function pt(at,Ut,jt){Mt.setFromMatrixPosition(Ut.matrixWorld),Rt.setFromMatrixPosition(jt.matrixWorld);let ce=Mt.distanceTo(Rt),te=Ut.projectionMatrix.elements,$t=jt.projectionMatrix.elements,qt=te[14]/(te[10]-1),xe=te[14]/(te[10]+1),ft=(te[9]+1)/te[5],We=(te[9]-1)/te[5],ee=(te[8]-1)/te[0],ge=($t[8]+1)/$t[0],fe=qt*ee,Te=qt*ge,be=ce/(-ee+ge),Wt=be*-ee;Ut.matrixWorld.decompose(at.position,at.quaternion,at.scale),at.translateX(Wt),at.translateZ(be),at.matrixWorld.compose(at.position,at.quaternion,at.scale),at.matrixWorldInverse.copy(at.matrixWorld).invert();let Me=qt+be,tt=xe+be,z=fe-Wt,Pt=Te+(ce-Wt),Ot=ft*xe/tt*Me,dt=We*xe/tt*Me;at.projectionMatrix.makePerspective(z,Pt,Ot,dt,Me,tt),at.projectionMatrixInverse.copy(at.projectionMatrix).invert()}function yt(at,Ut){Ut===null?at.matrixWorld.copy(at.matrix):at.matrixWorld.multiplyMatrices(Ut.matrixWorld,at.matrix),at.matrixWorldInverse.copy(at.matrixWorld).invert()}this.updateCamera=function(at){if(s===null)return;I.texture!==null&&(at.near=I.depthNear,at.far=I.depthFar),B.near=D.near=q.near=at.near,B.far=D.far=q.far=at.far,(j!==B.near||J!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),j=B.near,J=B.far,q.near=j,q.far=J,D.near=j,D.far=J,q.updateProjectionMatrix(),D.updateProjectionMatrix(),at.updateProjectionMatrix());let Ut=at.parent,jt=B.cameras;yt(B,Ut);for(let ce=0;ce<jt.length;ce++)yt(jt[ce],Ut);jt.length===2?pt(B,q,D):B.projectionMatrix.copy(q.projectionMatrix),K(at,B,Ut)};function K(at,Ut,jt){jt===null?at.matrix.copy(Ut.matrixWorld):(at.matrix.copy(jt.matrixWorld),at.matrix.invert(),at.matrix.multiply(Ut.matrixWorld)),at.matrix.decompose(at.position,at.quaternion,at.scale),at.updateMatrixWorld(!0),at.projectionMatrix.copy(Ut.projectionMatrix),at.projectionMatrixInverse.copy(Ut.projectionMatrixInverse),at.isPerspectiveCamera&&(at.fov=Oy*2*Math.atan(1/at.projectionMatrix.elements[5]),at.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(x===null&&b===null))return g},this.setFoveation=function(at){g=at,x!==null&&(x.fixedFoveation=at),b!==null&&b.fixedFoveation!==void 0&&(b.fixedFoveation=at)},this.hasDepthSensing=function(){return I.texture!==null};let Bt=null;function Gt(at,Ut){if(_=Ut.getViewerPose(m||h),P=Ut,_!==null){let jt=_.views;b!==null&&(t.setRenderTargetFramebuffer(R,b.framebuffer),t.setRenderTarget(R));let ce=!1;jt.length!==B.cameras.length&&(B.cameras.length=0,ce=!0);for(let $t=0;$t<jt.length;$t++){let qt=jt[$t],xe=null;if(b!==null)xe=b.getViewport(qt);else{let We=E.getViewSubImage(x,qt);xe=We.viewport,$t===0&&(t.setRenderTargetTextures(R,We.colorTexture,x.ignoreDepthValues?void 0:We.depthStencilTexture),t.setRenderTarget(R))}let ft=xt[$t];ft===void 0&&(ft=new ps,ft.layers.enable($t),ft.viewport=new Ki,xt[$t]=ft),ft.matrix.fromArray(qt.transform.matrix),ft.matrix.decompose(ft.position,ft.quaternion,ft.scale),ft.projectionMatrix.fromArray(qt.projectionMatrix),ft.projectionMatrixInverse.copy(ft.projectionMatrix).invert(),ft.viewport.set(xe.x,xe.y,xe.width,xe.height),$t===0&&(B.matrix.copy(ft.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),ce===!0&&B.cameras.push(ft)}let te=s.enabledFeatures;if(te&&te.includes("depth-sensing")){let $t=E.getDepthInformation(jt[0]);$t&&$t.isValid&&$t.texture&&I.init(t,$t,s.renderState)}}for(let jt=0;jt<T.length;jt++){let ce=F[jt],te=T[jt];ce!==null&&te!==void 0&&te.update(ce,Ut,m||h)}I.render(t,B),Bt&&Bt(at,Ut),Ut.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:Ut}),P=null}let ae=new WT;ae.setAnimationLoop(Gt),this.setAnimationLoop=function(at){Bt=at},this.dispose=function(){}}},Sl=new Rl,XW=new Ui;function YW(n,t){function e(S,w){S.matrixAutoUpdate===!0&&S.updateMatrix(),w.value.copy(S.matrix)}function o(S,w){w.color.getRGB(S.fogColor.value,VT(n)),w.isFog?(S.fogNear.value=w.near,S.fogFar.value=w.far):w.isFogExp2&&(S.fogDensity.value=w.density)}function s(S,w,R,T,F){w.isMeshBasicMaterial||w.isMeshLambertMaterial?c(S,w):w.isMeshToonMaterial?(c(S,w),E(S,w)):w.isMeshPhongMaterial?(c(S,w),_(S,w)):w.isMeshStandardMaterial?(c(S,w),x(S,w),w.isMeshPhysicalMaterial&&b(S,w,F)):w.isMeshMatcapMaterial?(c(S,w),P(S,w)):w.isMeshDepthMaterial?c(S,w):w.isMeshDistanceMaterial?(c(S,w),I(S,w)):w.isMeshNormalMaterial?c(S,w):w.isLineBasicMaterial?(h(S,w),w.isLineDashedMaterial&&p(S,w)):w.isPointsMaterial?g(S,w,R,T):w.isSpriteMaterial?m(S,w):w.isShadowMaterial?(S.color.value.copy(w.color),S.opacity.value=w.opacity):w.isShaderMaterial&&(w.uniformsNeedUpdate=!1)}function c(S,w){S.opacity.value=w.opacity,w.color&&S.diffuse.value.copy(w.color),w.emissive&&S.emissive.value.copy(w.emissive).multiplyScalar(w.emissiveIntensity),w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.bumpMap&&(S.bumpMap.value=w.bumpMap,e(w.bumpMap,S.bumpMapTransform),S.bumpScale.value=w.bumpScale,w.side===Yo&&(S.bumpScale.value*=-1)),w.normalMap&&(S.normalMap.value=w.normalMap,e(w.normalMap,S.normalMapTransform),S.normalScale.value.copy(w.normalScale),w.side===Yo&&S.normalScale.value.negate()),w.displacementMap&&(S.displacementMap.value=w.displacementMap,e(w.displacementMap,S.displacementMapTransform),S.displacementScale.value=w.displacementScale,S.displacementBias.value=w.displacementBias),w.emissiveMap&&(S.emissiveMap.value=w.emissiveMap,e(w.emissiveMap,S.emissiveMapTransform)),w.specularMap&&(S.specularMap.value=w.specularMap,e(w.specularMap,S.specularMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest);let R=t.get(w),T=R.envMap,F=R.envMapRotation;if(T&&(S.envMap.value=T,Sl.copy(F),Sl.x*=-1,Sl.y*=-1,Sl.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Sl.y*=-1,Sl.z*=-1),S.envMapRotation.value.setFromMatrix4(XW.makeRotationFromEuler(Sl)),S.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=w.reflectivity,S.ior.value=w.ior,S.refractionRatio.value=w.refractionRatio),w.lightMap){S.lightMap.value=w.lightMap;let W=n._useLegacyLights===!0?Math.PI:1;S.lightMapIntensity.value=w.lightMapIntensity*W,e(w.lightMap,S.lightMapTransform)}w.aoMap&&(S.aoMap.value=w.aoMap,S.aoMapIntensity.value=w.aoMapIntensity,e(w.aoMap,S.aoMapTransform))}function h(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform))}function p(S,w){S.dashSize.value=w.dashSize,S.totalSize.value=w.dashSize+w.gapSize,S.scale.value=w.scale}function g(S,w,R,T){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.size.value=w.size*R,S.scale.value=T*.5,w.map&&(S.map.value=w.map,e(w.map,S.uvTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function m(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.rotation.value=w.rotation,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function _(S,w){S.specular.value.copy(w.specular),S.shininess.value=Math.max(w.shininess,1e-4)}function E(S,w){w.gradientMap&&(S.gradientMap.value=w.gradientMap)}function x(S,w){S.metalness.value=w.metalness,w.metalnessMap&&(S.metalnessMap.value=w.metalnessMap,e(w.metalnessMap,S.metalnessMapTransform)),S.roughness.value=w.roughness,w.roughnessMap&&(S.roughnessMap.value=w.roughnessMap,e(w.roughnessMap,S.roughnessMapTransform)),t.get(w).envMap&&(S.envMapIntensity.value=w.envMapIntensity)}function b(S,w,R){S.ior.value=w.ior,w.sheen>0&&(S.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),S.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(S.sheenColorMap.value=w.sheenColorMap,e(w.sheenColorMap,S.sheenColorMapTransform)),w.sheenRoughnessMap&&(S.sheenRoughnessMap.value=w.sheenRoughnessMap,e(w.sheenRoughnessMap,S.sheenRoughnessMapTransform))),w.clearcoat>0&&(S.clearcoat.value=w.clearcoat,S.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(S.clearcoatMap.value=w.clearcoatMap,e(w.clearcoatMap,S.clearcoatMapTransform)),w.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap,e(w.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),w.clearcoatNormalMap&&(S.clearcoatNormalMap.value=w.clearcoatNormalMap,e(w.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),w.side===Yo&&S.clearcoatNormalScale.value.negate())),w.iridescence>0&&(S.iridescence.value=w.iridescence,S.iridescenceIOR.value=w.iridescenceIOR,S.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(S.iridescenceMap.value=w.iridescenceMap,e(w.iridescenceMap,S.iridescenceMapTransform)),w.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=w.iridescenceThicknessMap,e(w.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),w.transmission>0&&(S.transmission.value=w.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),w.transmissionMap&&(S.transmissionMap.value=w.transmissionMap,e(w.transmissionMap,S.transmissionMapTransform)),S.thickness.value=w.thickness,w.thicknessMap&&(S.thicknessMap.value=w.thicknessMap,e(w.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=w.attenuationDistance,S.attenuationColor.value.copy(w.attenuationColor)),w.anisotropy>0&&(S.anisotropyVector.value.set(w.anisotropy*Math.cos(w.anisotropyRotation),w.anisotropy*Math.sin(w.anisotropyRotation)),w.anisotropyMap&&(S.anisotropyMap.value=w.anisotropyMap,e(w.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=w.specularIntensity,S.specularColor.value.copy(w.specularColor),w.specularColorMap&&(S.specularColorMap.value=w.specularColorMap,e(w.specularColorMap,S.specularColorMapTransform)),w.specularIntensityMap&&(S.specularIntensityMap.value=w.specularIntensityMap,e(w.specularIntensityMap,S.specularIntensityMapTransform))}function P(S,w){w.matcap&&(S.matcap.value=w.matcap)}function I(S,w){let R=t.get(w).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:s}}function $W(n,t,e,o){let s={},c={},h=[],p=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function g(R,T){let F=T.program;o.uniformBlockBinding(R,F)}function m(R,T){let F=s[R.id];F===void 0&&(P(R),F=_(R),s[R.id]=F,R.addEventListener("dispose",S));let W=T.program;o.updateUBOMapping(R,W);let X=t.render.frame;c[R.id]!==X&&(x(R),c[R.id]=X)}function _(R){let T=E();R.__bindingPointIndex=T;let F=n.createBuffer(),W=R.__size,X=R.usage;return n.bindBuffer(n.UNIFORM_BUFFER,F),n.bufferData(n.UNIFORM_BUFFER,W,X),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,T,F),F}function E(){for(let R=0;R<p;R++)if(h.indexOf(R)===-1)return h.push(R),R;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function x(R){let T=s[R.id],F=R.uniforms,W=R.__cache;n.bindBuffer(n.UNIFORM_BUFFER,T);for(let X=0,q=F.length;X<q;X++){let D=Array.isArray(F[X])?F[X]:[F[X]];for(let xt=0,B=D.length;xt<B;xt++){let j=D[xt];if(b(j,X,xt,W)===!0){let J=j.__offset,Dt=Array.isArray(j.value)?j.value:[j.value],Q=0;for(let At=0;At<Dt.length;At++){let Mt=Dt[At],Rt=I(Mt);typeof Mt=="number"||typeof Mt=="boolean"?(j.__data[0]=Mt,n.bufferSubData(n.UNIFORM_BUFFER,J+Q,j.__data)):Mt.isMatrix3?(j.__data[0]=Mt.elements[0],j.__data[1]=Mt.elements[1],j.__data[2]=Mt.elements[2],j.__data[3]=0,j.__data[4]=Mt.elements[3],j.__data[5]=Mt.elements[4],j.__data[6]=Mt.elements[5],j.__data[7]=0,j.__data[8]=Mt.elements[6],j.__data[9]=Mt.elements[7],j.__data[10]=Mt.elements[8],j.__data[11]=0):(Mt.toArray(j.__data,Q),Q+=Rt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,J,j.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function b(R,T,F,W){let X=R.value,q=T+"_"+F;if(W[q]===void 0)return typeof X=="number"||typeof X=="boolean"?W[q]=X:W[q]=X.clone(),!0;{let D=W[q];if(typeof X=="number"||typeof X=="boolean"){if(D!==X)return W[q]=X,!0}else if(D.equals(X)===!1)return D.copy(X),!0}return!1}function P(R){let T=R.uniforms,F=0,W=16;for(let q=0,D=T.length;q<D;q++){let xt=Array.isArray(T[q])?T[q]:[T[q]];for(let B=0,j=xt.length;B<j;B++){let J=xt[B],Dt=Array.isArray(J.value)?J.value:[J.value];for(let Q=0,At=Dt.length;Q<At;Q++){let Mt=Dt[Q],Rt=I(Mt),pt=F%W;pt!==0&&W-pt<Rt.boundary&&(F+=W-pt),J.__data=new Float32Array(Rt.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=F,F+=Rt.storage}}}let X=F%W;return X>0&&(F+=W-X),R.__size=F,R.__cache={},this}function I(R){let T={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(T.boundary=4,T.storage=4):R.isVector2?(T.boundary=8,T.storage=8):R.isVector3||R.isColor?(T.boundary=16,T.storage=12):R.isVector4?(T.boundary=16,T.storage=16):R.isMatrix3?(T.boundary=48,T.storage=48):R.isMatrix4?(T.boundary=64,T.storage=64):R.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",R),T}function S(R){let T=R.target;T.removeEventListener("dispose",S);let F=h.indexOf(T.__bindingPointIndex);h.splice(F,1),n.deleteBuffer(s[T.id]),delete s[T.id],delete c[T.id]}function w(){for(let R in s)n.deleteBuffer(s[R]);h=[],s={},c={}}return{bind:g,update:m,dispose:w}}var Qy=class{constructor(t={}){let{canvas:e=K5(),context:o=null,depth:s=!0,stencil:c=!0,alpha:h=!1,antialias:p=!1,premultipliedAlpha:g=!0,preserveDrawingBuffer:m=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:E=!1}=t;this.isWebGLRenderer=!0;let x;o!==null?x=o.getContextAttributes().alpha:x=h;let b=new Uint32Array(4),P=new Int32Array(4),I=null,S=null,w=[],R=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ba,this._useLegacyLights=!1,this.toneMapping=Vu,this.toneMappingExposure=1;let T=this,F=!1,W=0,X=0,q=null,D=-1,xt=null,B=new Ki,j=new Ki,J=null,Dt=new hr(0),Q=0,At=e.width,Mt=e.height,Rt=1,pt=null,yt=null,K=new Ki(0,0,At,Mt),Bt=new Ki(0,0,At,Mt),Gt=!1,ae=new Md,at=!1,Ut=!1,jt=null,ce=new Ui,te=new Yn,$t=new Lt,qt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return q===null?Rt:1}let ft=o;function We(Z,mt){for(let It=0;It<Z.length;It++){let St=Z[It],vt=e.getContext(St,mt);if(vt!==null)return vt}return null}try{let Z={alpha:!0,depth:s,stencil:c,antialias:p,premultipliedAlpha:g,preserveDrawingBuffer:m,powerPreference:_,failIfMajorPerformanceCaveat:E};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${fv}\`),e.addEventListener("webglcontextlost",Et,!1),e.addEventListener("webglcontextrestored",G,!1),e.addEventListener("webglcontextcreationerror",ot,!1),ft===null){let mt=["webgl2","webgl","experimental-webgl"];if(T.isWebGL1Renderer===!0&&mt.shift(),ft=We(mt,Z),ft===null)throw We(mt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&ft instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ft.getShaderPrecisionFormat===void 0&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Z){throw console.error("THREE.WebGLRenderer: "+Z.message),Z}let ee,ge,fe,Te,be,Wt,Me,tt,z,Pt,Ot,dt,Ht,Ce,Vt,Zt,ne,rt,C,N,k,$,V,ht;function st(){ee=new c8(ft),ge=new i8(ft,ee,t),ee.init(ge),$=new qW(ft,ee,ge),fe=new GW(ft,ee,ge),Te=new p8(ft),be=new CW,Wt=new kW(ft,ee,fe,be,ge,$,Te),Me=new s8(T),tt=new l8(T),z=new _H(ft,ge),V=new n8(ft,ee,z,ge),Pt=new f8(ft,z,Te,V),Ot=new y8(ft,Pt,z,Te),C=new m8(ft,ge,Wt),Zt=new o8(be),dt=new TW(T,Me,tt,ee,ge,V,Zt),Ht=new YW(T,be),Ce=new IW,Vt=new FW(ee,ge),rt=new e8(T,Me,tt,fe,Ot,x,g),ne=new zW(T,Ot,ge),ht=new $W(ft,Te,ge,fe),N=new r8(ft,ee,Te,ge),k=new h8(ft,ee,Te,ge),Te.programs=dt.programs,T.capabilities=ge,T.extensions=ee,T.properties=be,T.renderLists=Ce,T.shadowMap=ne,T.state=fe,T.info=Te}st();let wt=new jy(T,ft);this.xr=wt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return Rt},this.setPixelRatio=function(Z){Z!==void 0&&(Rt=Z,this.setSize(At,Mt,!1))},this.getSize=function(Z){return Z.set(At,Mt)},this.setSize=function(Z,mt,It=!0){if(wt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}At=Z,Mt=mt,e.width=Math.floor(Z*Rt),e.height=Math.floor(mt*Rt),It===!0&&(e.style.width=Z+"px",e.style.height=mt+"px"),this.setViewport(0,0,Z,mt)},this.getDrawingBufferSize=function(Z){return Z.set(At*Rt,Mt*Rt).floor()},this.setDrawingBufferSize=function(Z,mt,It){At=Z,Mt=mt,Rt=It,e.width=Math.floor(Z*It),e.height=Math.floor(mt*It),this.setViewport(0,0,Z,mt)},this.getCurrentViewport=function(Z){return Z.copy(B)},this.getViewport=function(Z){return Z.copy(K)},this.setViewport=function(Z,mt,It,St){Z.isVector4?K.set(Z.x,Z.y,Z.z,Z.w):K.set(Z,mt,It,St),fe.viewport(B.copy(K).multiplyScalar(Rt).round())},this.getScissor=function(Z){return Z.copy(Bt)},this.setScissor=function(Z,mt,It,St){Z.isVector4?Bt.set(Z.x,Z.y,Z.z,Z.w):Bt.set(Z,mt,It,St),fe.scissor(j.copy(Bt).multiplyScalar(Rt).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(Z){fe.setScissorTest(Gt=Z)},this.setOpaqueSort=function(Z){pt=Z},this.setTransparentSort=function(Z){yt=Z},this.getClearColor=function(Z){return Z.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor.apply(rt,arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha.apply(rt,arguments)},this.clear=function(Z=!0,mt=!0,It=!0){let St=0;if(Z){let vt=!1;if(q!==null){let he=q.texture.format;vt=he===zT||he===BT||he===UT}if(vt){let he=q.texture.type,ue=he===Wu||he===qu||he===hv||he===Cl||he===DT||he===FT,we=rt.getClearColor(),de=rt.getClearAlpha(),Be=we.r,Ae=we.g,Pe=we.b;ue?(b[0]=Be,b[1]=Ae,b[2]=Pe,b[3]=de,ft.clearBufferuiv(ft.COLOR,0,b)):(P[0]=Be,P[1]=Ae,P[2]=Pe,P[3]=de,ft.clearBufferiv(ft.COLOR,0,P))}else St|=ft.COLOR_BUFFER_BIT}mt&&(St|=ft.DEPTH_BUFFER_BIT),It&&(St|=ft.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ft.clear(St)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Et,!1),e.removeEventListener("webglcontextrestored",G,!1),e.removeEventListener("webglcontextcreationerror",ot,!1),Ce.dispose(),Vt.dispose(),be.dispose(),Me.dispose(),tt.dispose(),Ot.dispose(),V.dispose(),ht.dispose(),dt.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",qe),wt.removeEventListener("sessionend",Ue),jt&&(jt.dispose(),jt=null),Xe.stop()};function Et(Z){Z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),F=!0}function G(){console.log("THREE.WebGLRenderer: Context Restored."),F=!1;let Z=Te.autoReset,mt=ne.enabled,It=ne.autoUpdate,St=ne.needsUpdate,vt=ne.type;st(),Te.autoReset=Z,ne.enabled=mt,ne.autoUpdate=It,ne.needsUpdate=St,ne.type=vt}function ot(Z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function et(Z){let mt=Z.target;mt.removeEventListener("dispose",et),ut(mt)}function ut(Z){Ft(Z),be.remove(Z)}function Ft(Z){let mt=be.get(Z).programs;mt!==void 0&&(mt.forEach(function(It){dt.releaseProgram(It)}),Z.isShaderMaterial&&dt.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,mt,It,St,vt,he){mt===null&&(mt=qt);let ue=vt.isMesh&&vt.matrixWorld.determinant()<0,we=Qn(Z,mt,It,St,vt);fe.setMaterial(St,ue);let de=It.index,Be=1;if(St.wireframe===!0){if(de=Pt.getWireframeAttribute(It),de===void 0)return;Be=2}let Ae=It.drawRange,Pe=It.attributes.position,tn=Ae.start*Be,oi=(Ae.start+Ae.count)*Be;he!==null&&(tn=Math.max(tn,he.start*Be),oi=Math.min(oi,(he.start+he.count)*Be)),de!==null?(tn=Math.max(tn,0),oi=Math.min(oi,de.count)):Pe!=null&&(tn=Math.max(tn,0),oi=Math.min(oi,Pe.count));let Mr=oi-tn;if(Mr<0||Mr===1/0)return;V.setup(vt,St,we,It,de);let Hi,sr=N;if(de!==null&&(Hi=z.get(de),sr=k,sr.setIndex(Hi)),vt.isMesh)St.wireframe===!0?(fe.setLineWidth(St.wireframeLinewidth*xe()),sr.setMode(ft.LINES)):sr.setMode(ft.TRIANGLES);else if(vt.isLine){let ye=St.linewidth;ye===void 0&&(ye=1),fe.setLineWidth(ye*xe()),vt.isLineSegments?sr.setMode(ft.LINES):vt.isLineLoop?sr.setMode(ft.LINE_LOOP):sr.setMode(ft.LINE_STRIP)}else vt.isPoints?sr.setMode(ft.POINTS):vt.isSprite&&sr.setMode(ft.TRIANGLES);if(vt.isBatchedMesh)sr.renderMultiDraw(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount);else if(vt.isInstancedMesh)sr.renderInstances(tn,Mr,vt.count);else if(It.isInstancedBufferGeometry){let ye=It._maxInstanceCount!==void 0?It._maxInstanceCount:1/0,Da=Math.min(It.instanceCount,ye);sr.renderInstances(tn,Mr,Da)}else sr.render(tn,Mr)};function Kt(Z,mt,It){Z.transparent===!0&&Z.side===uu&&Z.forceSinglePass===!1?(Z.side=Yo,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=Xu,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=uu):rr(Z,mt,It)}this.compile=function(Z,mt,It=null){It===null&&(It=Z),S=Vt.get(It),S.init(),R.push(S),It.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),Z!==It&&Z.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),S.setupLights(T._useLegacyLights);let St=new Set;return Z.traverse(function(vt){let he=vt.material;if(he)if(Array.isArray(he))for(let ue=0;ue<he.length;ue++){let we=he[ue];Kt(we,It,vt),St.add(we)}else Kt(he,It,vt),St.add(he)}),R.pop(),S=null,St},this.compileAsync=function(Z,mt,It=null){let St=this.compile(Z,mt,It);return new Promise(vt=>{function he(){if(St.forEach(function(ue){be.get(ue).currentProgram.isReady()&&St.delete(ue)}),St.size===0){vt(Z);return}setTimeout(he,10)}ee.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let me=null;function ve(Z){me&&me(Z)}function qe(){Xe.stop()}function Ue(){Xe.start()}let Xe=new WT;Xe.setAnimationLoop(ve),typeof self!="undefined"&&Xe.setContext(self),this.setAnimationLoop=function(Z){me=Z,wt.setAnimationLoop(Z),Z===null?Xe.stop():Xe.start()},wt.addEventListener("sessionstart",qe),wt.addEventListener("sessionend",Ue),this.render=function(Z,mt){if(mt!==void 0&&mt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),mt.parent===null&&mt.matrixWorldAutoUpdate===!0&&mt.updateMatrixWorld(),wt.enabled===!0&&wt.isPresenting===!0&&(wt.cameraAutoUpdate===!0&&wt.updateCamera(mt),mt=wt.getCamera()),Z.isScene===!0&&Z.onBeforeRender(T,Z,mt,q),S=Vt.get(Z,R.length),S.init(),R.push(S),ce.multiplyMatrices(mt.projectionMatrix,mt.matrixWorldInverse),ae.setFromProjectionMatrix(ce),Ut=this.localClippingEnabled,at=Zt.init(this.clippingPlanes,Ut),I=Ce.get(Z,w.length),I.init(),w.push(I),Ze(Z,mt,0,T.sortObjects),I.finish(),T.sortObjects===!0&&I.sort(pt,yt),this.info.render.frame++,at===!0&&Zt.beginShadows();let It=S.state.shadowsArray;if(ne.render(It,Z,mt),at===!0&&Zt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(wt.enabled===!1||wt.isPresenting===!1||wt.hasDepthSensing()===!1)&&rt.render(I,Z),S.setupLights(T._useLegacyLights),mt.isArrayCamera){let St=mt.cameras;for(let vt=0,he=St.length;vt<he;vt++){let ue=St[vt];Er(I,Z,ue,ue.viewport)}}else Er(I,Z,mt);q!==null&&(Wt.updateMultisampleRenderTarget(q),Wt.updateRenderTargetMipmap(q)),Z.isScene===!0&&Z.onAfterRender(T,Z,mt),V.resetDefaultState(),D=-1,xt=null,R.pop(),R.length>0?S=R[R.length-1]:S=null,w.pop(),w.length>0?I=w[w.length-1]:I=null};function Ze(Z,mt,It,St){if(Z.visible===!1)return;if(Z.layers.test(mt.layers)){if(Z.isGroup)It=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(mt);else if(Z.isLight)S.pushLight(Z),Z.castShadow&&S.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||ae.intersectsSprite(Z)){St&&$t.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(ce);let ue=Ot.update(Z),we=Z.material;we.visible&&I.push(Z,ue,we,It,$t.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||ae.intersectsObject(Z))){let ue=Ot.update(Z),we=Z.material;if(St&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),$t.copy(Z.boundingSphere.center)):(ue.boundingSphere===null&&ue.computeBoundingSphere(),$t.copy(ue.boundingSphere.center)),$t.applyMatrix4(Z.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){let de=ue.groups;for(let Be=0,Ae=de.length;Be<Ae;Be++){let Pe=de[Be],tn=we[Pe.materialIndex];tn&&tn.visible&&I.push(Z,ue,tn,It,$t.z,Pe)}}else we.visible&&I.push(Z,ue,we,It,$t.z,null)}}let he=Z.children;for(let ue=0,we=he.length;ue<we;ue++)Ze(he[ue],mt,It,St)}function Er(Z,mt,It,St){let vt=Z.opaque,he=Z.transmissive,ue=Z.transparent;S.setupLightsView(It),at===!0&&Zt.setGlobalState(T.clippingPlanes,It),he.length>0&&Zr(vt,he,mt,It),St&&fe.viewport(B.copy(St)),vt.length>0&&nr(vt,mt,It),he.length>0&&nr(he,mt,It),ue.length>0&&nr(ue,mt,It),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1)}function Zr(Z,mt,It,St){if((It.isScene===!0?It.overrideMaterial:null)!==null)return;let he=ge.isWebGL2;jt===null&&(jt=new hu(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")?Kf:Wu,minFilter:Tl,samples:he?4:0})),T.getDrawingBufferSize(te),he?jt.setSize(te.x,te.y):jt.setSize(Dy(te.x),Dy(te.y));let ue=T.getRenderTarget();T.setRenderTarget(jt),T.getClearColor(Dt),Q=T.getClearAlpha(),Q<1&&T.setClearColor(16777215,.5),T.clear();let we=T.toneMapping;T.toneMapping=Vu,nr(Z,It,St),Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt);let de=!1;for(let Be=0,Ae=mt.length;Be<Ae;Be++){let Pe=mt[Be],tn=Pe.object,oi=Pe.geometry,Mr=Pe.material,Hi=Pe.group;if(Mr.side===uu&&tn.layers.test(St.layers)){let sr=Mr.side;Mr.side=Yo,Mr.needsUpdate=!0,Ie(tn,It,St,oi,Mr,Hi),Mr.side=sr,Mr.needsUpdate=!0,de=!0}}de===!0&&(Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt)),T.setRenderTarget(ue),T.setClearColor(Dt,Q),T.toneMapping=we}function nr(Z,mt,It){let St=mt.isScene===!0?mt.overrideMaterial:null;for(let vt=0,he=Z.length;vt<he;vt++){let ue=Z[vt],we=ue.object,de=ue.geometry,Be=St===null?ue.material:St,Ae=ue.group;we.layers.test(It.layers)&&Ie(we,mt,It,de,Be,Ae)}}function Ie(Z,mt,It,St,vt,he){Z.onBeforeRender(T,mt,It,St,vt,he),Z.modelViewMatrix.multiplyMatrices(It.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),vt.onBeforeRender(T,mt,It,St,Z,he),vt.transparent===!0&&vt.side===uu&&vt.forceSinglePass===!1?(vt.side=Yo,vt.needsUpdate=!0,T.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=Xu,vt.needsUpdate=!0,T.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=uu):T.renderBufferDirect(It,mt,St,vt,Z,he),Z.onAfterRender(T,mt,It,St,vt,he)}function rr(Z,mt,It){mt.isScene!==!0&&(mt=qt);let St=be.get(Z),vt=S.state.lights,he=S.state.shadowsArray,ue=vt.state.version,we=dt.getParameters(Z,vt.state,he,mt,It),de=dt.getProgramCacheKey(we),Be=St.programs;St.environment=Z.isMeshStandardMaterial?mt.environment:null,St.fog=mt.fog,St.envMap=(Z.isMeshStandardMaterial?tt:Me).get(Z.envMap||St.environment),St.envMapRotation=St.environment!==null&&Z.envMap===null?mt.environmentRotation:Z.envMapRotation,Be===void 0&&(Z.addEventListener("dispose",et),Be=new Map,St.programs=Be);let Ae=Be.get(de);if(Ae!==void 0){if(St.currentProgram===Ae&&St.lightsStateVersion===ue)return ar(Z,we),Ae}else we.uniforms=dt.getUniforms(Z),Z.onBuild(It,we,T),Z.onBeforeCompile(we,T),Ae=dt.acquireProgram(we,de),Be.set(de,Ae),St.uniforms=we.uniforms;let Pe=St.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(Pe.clippingPlanes=Zt.uniform),ar(Z,we),St.needsLights=ii(Z),St.lightsStateVersion=ue,St.needsLights&&(Pe.ambientLightColor.value=vt.state.ambient,Pe.lightProbe.value=vt.state.probe,Pe.directionalLights.value=vt.state.directional,Pe.directionalLightShadows.value=vt.state.directionalShadow,Pe.spotLights.value=vt.state.spot,Pe.spotLightShadows.value=vt.state.spotShadow,Pe.rectAreaLights.value=vt.state.rectArea,Pe.ltc_1.value=vt.state.rectAreaLTC1,Pe.ltc_2.value=vt.state.rectAreaLTC2,Pe.pointLights.value=vt.state.point,Pe.pointLightShadows.value=vt.state.pointShadow,Pe.hemisphereLights.value=vt.state.hemi,Pe.directionalShadowMap.value=vt.state.directionalShadowMap,Pe.directionalShadowMatrix.value=vt.state.directionalShadowMatrix,Pe.spotShadowMap.value=vt.state.spotShadowMap,Pe.spotLightMatrix.value=vt.state.spotLightMatrix,Pe.spotLightMap.value=vt.state.spotLightMap,Pe.pointShadowMap.value=vt.state.pointShadowMap,Pe.pointShadowMatrix.value=vt.state.pointShadowMatrix),St.currentProgram=Ae,St.uniformsList=null,Ae}function pr(Z){if(Z.uniformsList===null){let mt=Z.currentProgram.getUniforms();Z.uniformsList=Oc.seqWithValue(mt.seq,Z.uniforms)}return Z.uniformsList}function ar(Z,mt){let It=be.get(Z);It.outputColorSpace=mt.outputColorSpace,It.batching=mt.batching,It.instancing=mt.instancing,It.instancingColor=mt.instancingColor,It.instancingMorph=mt.instancingMorph,It.skinning=mt.skinning,It.morphTargets=mt.morphTargets,It.morphNormals=mt.morphNormals,It.morphColors=mt.morphColors,It.morphTargetsCount=mt.morphTargetsCount,It.numClippingPlanes=mt.numClippingPlanes,It.numIntersection=mt.numClipIntersection,It.vertexAlphas=mt.vertexAlphas,It.vertexTangents=mt.vertexTangents,It.toneMapping=mt.toneMapping}function Qn(Z,mt,It,St,vt){mt.isScene!==!0&&(mt=qt),Wt.resetTextureUnits();let he=mt.fog,ue=St.isMeshStandardMaterial?mt.environment:null,we=q===null?T.outputColorSpace:q.isXRRenderTarget===!0?q.texture.colorSpace:Zu,de=(St.isMeshStandardMaterial?tt:Me).get(St.envMap||ue),Be=St.vertexColors===!0&&!!It.attributes.color&&It.attributes.color.itemSize===4,Ae=!!It.attributes.tangent&&(!!St.normalMap||St.anisotropy>0),Pe=!!It.morphAttributes.position,tn=!!It.morphAttributes.normal,oi=!!It.morphAttributes.color,Mr=Vu;St.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(Mr=T.toneMapping);let Hi=It.morphAttributes.position||It.morphAttributes.normal||It.morphAttributes.color,sr=Hi!==void 0?Hi.length:0,ye=be.get(St),Da=S.state.lights;if(at===!0&&(Ut===!0||Z!==xt)){let Mi=Z===xt&&St.id===D;Zt.setState(St,Z,Mi)}let en=!1;St.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==Da.state.version||ye.outputColorSpace!==we||vt.isBatchedMesh&&ye.batching===!1||!vt.isBatchedMesh&&ye.batching===!0||vt.isInstancedMesh&&ye.instancing===!1||!vt.isInstancedMesh&&ye.instancing===!0||vt.isSkinnedMesh&&ye.skinning===!1||!vt.isSkinnedMesh&&ye.skinning===!0||vt.isInstancedMesh&&ye.instancingColor===!0&&vt.instanceColor===null||vt.isInstancedMesh&&ye.instancingColor===!1&&vt.instanceColor!==null||vt.isInstancedMesh&&ye.instancingMorph===!0&&vt.morphTexture===null||vt.isInstancedMesh&&ye.instancingMorph===!1&&vt.morphTexture!==null||ye.envMap!==de||St.fog===!0&&ye.fog!==he||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==Zt.numPlanes||ye.numIntersection!==Zt.numIntersection)||ye.vertexAlphas!==Be||ye.vertexTangents!==Ae||ye.morphTargets!==Pe||ye.morphNormals!==tn||ye.morphColors!==oi||ye.toneMapping!==Mr||ge.isWebGL2===!0&&ye.morphTargetsCount!==sr)&&(en=!0):(en=!0,ye.__version=St.version);let co=ye.currentProgram;en===!0&&(co=rr(St,mt,vt));let rl=!1,ze=!1,gs=!1,ir=co.getUniforms(),Ko=ye.uniforms;if(fe.useProgram(co.program)&&(rl=!0,ze=!0,gs=!0),St.id!==D&&(D=St.id,ze=!0),rl||xt!==Z){ir.setValue(ft,"projectionMatrix",Z.projectionMatrix),ir.setValue(ft,"viewMatrix",Z.matrixWorldInverse);let Mi=ir.map.cameraPosition;Mi!==void 0&&Mi.setValue(ft,$t.setFromMatrixPosition(Z.matrixWorld)),ge.logarithmicDepthBuffer&&ir.setValue(ft,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(St.isMeshPhongMaterial||St.isMeshToonMaterial||St.isMeshLambertMaterial||St.isMeshBasicMaterial||St.isMeshStandardMaterial||St.isShaderMaterial)&&ir.setValue(ft,"isOrthographic",Z.isOrthographicCamera===!0),xt!==Z&&(xt=Z,ze=!0,gs=!0)}if(vt.isSkinnedMesh){ir.setOptional(ft,vt,"bindMatrix"),ir.setOptional(ft,vt,"bindMatrixInverse");let Mi=vt.skeleton;Mi&&(ge.floatVertexTextures?(Mi.boneTexture===null&&Mi.computeBoneTexture(),ir.setValue(ft,"boneTexture",Mi.boneTexture,Wt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}vt.isBatchedMesh&&(ir.setOptional(ft,vt,"batchingTexture"),ir.setValue(ft,"batchingTexture",vt._matricesTexture,Wt));let Le=It.morphAttributes;if((Le.position!==void 0||Le.normal!==void 0||Le.color!==void 0&&ge.isWebGL2===!0)&&C.update(vt,It,co),(ze||ye.receiveShadow!==vt.receiveShadow)&&(ye.receiveShadow=vt.receiveShadow,ir.setValue(ft,"receiveShadow",vt.receiveShadow)),St.isMeshGouraudMaterial&&St.envMap!==null&&(Ko.envMap.value=de,Ko.flipEnvMap.value=de.isCubeTexture&&de.isRenderTargetTexture===!1?-1:1),ze&&(ir.setValue(ft,"toneMappingExposure",T.toneMappingExposure),ye.needsLights&&Si(Ko,gs),he&&St.fog===!0&&Ht.refreshFogUniforms(Ko,he),Ht.refreshMaterialUniforms(Ko,St,Rt,Mt,jt),Oc.upload(ft,pr(ye),Ko,Wt)),St.isShaderMaterial&&St.uniformsNeedUpdate===!0&&(Oc.upload(ft,pr(ye),Ko,Wt),St.uniformsNeedUpdate=!1),St.isSpriteMaterial&&ir.setValue(ft,"center",vt.center),ir.setValue(ft,"modelViewMatrix",vt.modelViewMatrix),ir.setValue(ft,"normalMatrix",vt.normalMatrix),ir.setValue(ft,"modelMatrix",vt.matrixWorld),St.isShaderMaterial||St.isRawShaderMaterial){let Mi=St.uniformsGroups;for(let Fa=0,du=Mi.length;Fa<du;Fa++)if(ge.isWebGL2){let bi=Mi[Fa];ht.update(bi,co),ht.bind(bi,co)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return co}function Si(Z,mt){Z.ambientLightColor.needsUpdate=mt,Z.lightProbe.needsUpdate=mt,Z.directionalLights.needsUpdate=mt,Z.directionalLightShadows.needsUpdate=mt,Z.pointLights.needsUpdate=mt,Z.pointLightShadows.needsUpdate=mt,Z.spotLights.needsUpdate=mt,Z.spotLightShadows.needsUpdate=mt,Z.rectAreaLights.needsUpdate=mt,Z.hemisphereLights.needsUpdate=mt}function ii(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(Z,mt,It){be.get(Z.texture).__webglTexture=mt,be.get(Z.depthTexture).__webglTexture=It;let St=be.get(Z);St.__hasExternalTextures=!0,St.__autoAllocateDepthBuffer=It===void 0,St.__autoAllocateDepthBuffer||ee.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),St.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Z,mt){let It=be.get(Z);It.__webglFramebuffer=mt,It.__useDefaultFramebuffer=mt===void 0},this.setRenderTarget=function(Z,mt=0,It=0){q=Z,W=mt,X=It;let St=!0,vt=null,he=!1,ue=!1;if(Z){let de=be.get(Z);de.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(ft.FRAMEBUFFER,null),St=!1):de.__webglFramebuffer===void 0?Wt.setupRenderTarget(Z):de.__hasExternalTextures&&Wt.rebindTextures(Z,be.get(Z.texture).__webglTexture,be.get(Z.depthTexture).__webglTexture);let Be=Z.texture;(Be.isData3DTexture||Be.isDataArrayTexture||Be.isCompressedArrayTexture)&&(ue=!0);let Ae=be.get(Z).__webglFramebuffer;Z.isWebGLCubeRenderTarget?(Array.isArray(Ae[mt])?vt=Ae[mt][It]:vt=Ae[mt],he=!0):ge.isWebGL2&&Z.samples>0&&Wt.useMultisampledRTT(Z)===!1?vt=be.get(Z).__webglMultisampledFramebuffer:Array.isArray(Ae)?vt=Ae[It]:vt=Ae,B.copy(Z.viewport),j.copy(Z.scissor),J=Z.scissorTest}else B.copy(K).multiplyScalar(Rt).floor(),j.copy(Bt).multiplyScalar(Rt).floor(),J=Gt;if(fe.bindFramebuffer(ft.FRAMEBUFFER,vt)&&ge.drawBuffers&&St&&fe.drawBuffers(Z,vt),fe.viewport(B),fe.scissor(j),fe.setScissorTest(J),he){let de=be.get(Z.texture);ft.framebufferTexture2D(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,ft.TEXTURE_CUBE_MAP_POSITIVE_X+mt,de.__webglTexture,It)}else if(ue){let de=be.get(Z.texture),Be=mt||0;ft.framebufferTextureLayer(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,de.__webglTexture,It||0,Be)}D=-1},this.readRenderTargetPixels=function(Z,mt,It,St,vt,he,ue){if(!(Z&&Z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=be.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ue!==void 0&&(we=we[ue]),we){fe.bindFramebuffer(ft.FRAMEBUFFER,we);try{let de=Z.texture,Be=de.format,Ae=de.type;if(Be!==ta&&$.convert(Be)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Pe=Ae===Kf&&(ee.has("EXT_color_buffer_half_float")||ge.isWebGL2&&ee.has("EXT_color_buffer_float"));if(Ae!==Wu&&$.convert(Ae)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ae===lu&&(ge.isWebGL2||ee.has("OES_texture_float")||ee.has("WEBGL_color_buffer_float")))&&!Pe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}mt>=0&&mt<=Z.width-St&&It>=0&&It<=Z.height-vt&&ft.readPixels(mt,It,St,vt,$.convert(Be),$.convert(Ae),he)}finally{let de=q!==null?be.get(q).__webglFramebuffer:null;fe.bindFramebuffer(ft.FRAMEBUFFER,de)}}},this.copyFramebufferToTexture=function(Z,mt,It=0){let St=Math.pow(2,-It),vt=Math.floor(mt.image.width*St),he=Math.floor(mt.image.height*St);Wt.setTexture2D(mt,0),ft.copyTexSubImage2D(ft.TEXTURE_2D,It,0,0,Z.x,Z.y,vt,he),fe.unbindTexture()},this.copyTextureToTexture=function(Z,mt,It,St=0){let vt=mt.image.width,he=mt.image.height,ue=$.convert(It.format),we=$.convert(It.type);Wt.setTexture2D(It,0),ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,It.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,It.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,It.unpackAlignment),mt.isDataTexture?ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,vt,he,ue,we,mt.image.data):mt.isCompressedTexture?ft.compressedTexSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,mt.mipmaps[0].width,mt.mipmaps[0].height,ue,mt.mipmaps[0].data):ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,ue,we,mt.image),St===0&&It.generateMipmaps&&ft.generateMipmap(ft.TEXTURE_2D),fe.unbindTexture()},this.copyTextureToTexture3D=function(Z,mt,It,St,vt=0){if(T.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let he=Math.round(Z.max.x-Z.min.x),ue=Math.round(Z.max.y-Z.min.y),we=Z.max.z-Z.min.z+1,de=$.convert(St.format),Be=$.convert(St.type),Ae;if(St.isData3DTexture)Wt.setTexture3D(St,0),Ae=ft.TEXTURE_3D;else if(St.isDataArrayTexture||St.isCompressedArrayTexture)Wt.setTexture2DArray(St,0),Ae=ft.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,St.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,St.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,St.unpackAlignment);let Pe=ft.getParameter(ft.UNPACK_ROW_LENGTH),tn=ft.getParameter(ft.UNPACK_IMAGE_HEIGHT),oi=ft.getParameter(ft.UNPACK_SKIP_PIXELS),Mr=ft.getParameter(ft.UNPACK_SKIP_ROWS),Hi=ft.getParameter(ft.UNPACK_SKIP_IMAGES),sr=It.isCompressedTexture?It.mipmaps[vt]:It.image;ft.pixelStorei(ft.UNPACK_ROW_LENGTH,sr.width),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,sr.height),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,Z.min.x),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Z.min.y),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Z.min.z),It.isDataTexture||It.isData3DTexture?ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr.data):St.isCompressedArrayTexture?ft.compressedTexSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,sr.data):ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr),ft.pixelStorei(ft.UNPACK_ROW_LENGTH,Pe),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,tn),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,oi),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Mr),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Hi),vt===0&&St.generateMipmaps&&ft.generateMipmap(Ae),fe.unbindTexture()},this.initTexture=function(Z){Z.isCubeTexture?Wt.setTextureCube(Z,0):Z.isData3DTexture?Wt.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?Wt.setTexture2DArray(Z,0):Wt.setTexture2D(Z,0),fe.unbindTexture()},this.resetState=function(){W=0,X=0,q=null,fe.reset(),V.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return cu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===pv?"display-p3":"srgb",e.unpackColorSpace=_r.workingColorSpace===Pd?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},tv=class extends Qy{};tv.prototype.isWebGL1Renderer=!0;function sd(n,t,e){return!n||!e&&n.constructor===t?n:typeof t.BYTES_PER_ELEMENT=="number"?new t(n):Array.prototype.slice.call(n)}function ZW(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Gc=class{constructor(t,e,o,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,s=e[o],c=e[o-1];t:{e:{let h;n:{r:if(!(t<s)){for(let p=o+2;;){if(s===void 0){if(t<c)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===p)break;if(c=s,s=e[++o],t<s)break e}h=e.length;break n}if(!(t>=c)){let p=e[1];t<p&&(o=2,c=p);for(let g=o-2;;){if(c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===g)break;if(s=c,c=e[--o-1],t>=c)break e}h=o,o=0;break n}break t}for(;o<h;){let p=o+h>>>1;t<e[p]?h=p:o=p+1}if(s=e[o],c=e[o-1],c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,c,s)}return this.interpolate_(o,c,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,s=this.valueSize,c=t*s;for(let h=0;h!==s;++h)e[h]=o[c+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},ev=class extends Gc{constructor(t,e,o,s){super(t,e,o,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:zA,endingEnd:zA}}intervalChanged_(t,e,o){let s=this.parameterPositions,c=t-2,h=t+1,p=s[c],g=s[h];if(p===void 0)switch(this.getSettings_().endingStart){case GA:c=t,p=2*e-o;break;case kA:c=s.length-2,p=e+s[c]-s[c+1];break;default:c=t,p=o}if(g===void 0)switch(this.getSettings_().endingEnd){case GA:h=t,g=2*o-e;break;case kA:h=1,g=o+s[1]-s[0];break;default:h=t-1,g=e}let m=(o-e)*.5,_=this.valueSize;this._weightPrev=m/(e-p),this._weightNext=m/(g-o),this._offsetPrev=c*_,this._offsetNext=h*_}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=t*p,m=g-p,_=this._offsetPrev,E=this._offsetNext,x=this._weightPrev,b=this._weightNext,P=(o-e)/(s-e),I=P*P,S=I*P,w=-x*S+2*x*I-x*P,R=(1+x)*S+(-1.5-2*x)*I+(-.5+x)*P+1,T=(-1-b)*S+(1.5+b)*I+.5*P,F=b*S-b*I;for(let W=0;W!==p;++W)c[W]=w*h[_+W]+R*h[m+W]+T*h[g+W]+F*h[E+W];return c}},nv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=t*p,m=g-p,_=(o-e)/(s-e),E=1-_;for(let x=0;x!==p;++x)c[x]=h[m+x]*E+h[g+x]*_;return c}},rv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t){return this.copySampleValue_(t-1)}},na=class{constructor(t,e,o,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=sd(e,this.TimeBufferType),this.values=sd(o,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:sd(t.times,Array),values:sd(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(o.interpolation=s)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new rv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new nv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new ev(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ud:e=this.InterpolantFactoryMethodDiscrete;break;case ld:e=this.InterpolantFactoryMethodLinear;break;case ty:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ud;case this.InterpolantFactoryMethodLinear:return ld;case this.InterpolantFactoryMethodSmooth:return ty}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]*=t}return this}trim(t,e){let o=this.times,s=o.length,c=0,h=s-1;for(;c!==s&&o[c]<t;)++c;for(;h!==-1&&o[h]>e;)--h;if(++h,c!==0||h!==s){c>=h&&(h=Math.max(h,1),c=h-1);let p=this.getValueSize();this.times=o.slice(c,h),this.values=this.values.slice(c*p,h*p)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,s=this.values,c=o.length;c===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let h=null;for(let p=0;p!==c;p++){let g=o[p];if(typeof g=="number"&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,p,g),t=!1;break}if(h!==null&&h>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,p,g,h),t=!1;break}h=g}if(s!==void 0&&ZW(s))for(let p=0,g=s.length;p!==g;++p){let m=s[p];if(isNaN(m)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,p,m),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),s=this.getInterpolation()===ty,c=t.length-1,h=1;for(let p=1;p<c;++p){let g=!1,m=t[p],_=t[p+1];if(m!==_&&(p!==1||m!==t[0]))if(s)g=!0;else{let E=p*o,x=E-o,b=E+o;for(let P=0;P!==o;++P){let I=e[E+P];if(I!==e[x+P]||I!==e[b+P]){g=!0;break}}}if(g){if(p!==h){t[h]=t[p];let E=p*o,x=h*o;for(let b=0;b!==o;++b)e[x+b]=e[E+b]}++h}}if(c>0){t[h]=t[c];for(let p=c*o,g=h*o,m=0;m!==o;++m)e[g+m]=e[p+m];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,s=new o(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};na.prototype.TimeBufferType=Float32Array;na.prototype.ValueBufferType=Float32Array;na.prototype.DefaultInterpolation=ld;var Nl=class extends na{};Nl.prototype.ValueTypeName="bool";Nl.prototype.ValueBufferType=Array;Nl.prototype.DefaultInterpolation=ud;Nl.prototype.InterpolantFactoryMethodLinear=void 0;Nl.prototype.InterpolantFactoryMethodSmooth=void 0;var iv=class extends na{};iv.prototype.ValueTypeName="color";var ov=class extends na{};ov.prototype.ValueTypeName="number";var sv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=(o-e)/(s-e),m=t*p;for(let _=m+p;m!==_;m+=4)$u.slerpFlat(c,0,h,m-p,h,m,g);return c}},th=class extends na{InterpolantFactoryMethodLinear(t){return new sv(this.times,this.values,this.getValueSize(),t)}};th.prototype.ValueTypeName="quaternion";th.prototype.DefaultInterpolation=ld;th.prototype.InterpolantFactoryMethodSmooth=void 0;var Ol=class extends na{};Ol.prototype.ValueTypeName="string";Ol.prototype.ValueBufferType=Array;Ol.prototype.DefaultInterpolation=ud;Ol.prototype.InterpolantFactoryMethodLinear=void 0;Ol.prototype.InterpolantFactoryMethodSmooth=void 0;var av=class extends na{};av.prototype.ValueTypeName="vector";var uv=class{constructor(t,e,o){let s=this,c=!1,h=0,p=0,g,m=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(_){p++,c===!1&&s.onStart!==void 0&&s.onStart(_,h,p),c=!0},this.itemEnd=function(_){h++,s.onProgress!==void 0&&s.onProgress(_,h,p),h===p&&(c=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(_){s.onError!==void 0&&s.onError(_)},this.resolveURL=function(_){return g?g(_):_},this.setURLModifier=function(_){return g=_,this},this.addHandler=function(_,E){return m.push(_,E),this},this.removeHandler=function(_){let E=m.indexOf(_);return E!==-1&&m.splice(E,2),this},this.getHandler=function(_){for(let E=0,x=m.length;E<x;E+=2){let b=m[E],P=m[E+1];if(b.global&&(b.lastIndex=0),b.test(_))return P}return null}}},JW=new uv,lv=class{constructor(t){this.manager=t!==void 0?t:JW,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(s,c){o.load(t,s,e,c)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};lv.DEFAULT_MATERIAL_NAME="__DEFAULT";var gv="\\\\[\\\\]\\\\.:\\\\/",KW=new RegExp("["+gv+"]","g"),mv="[^"+gv+"]",jW="[^"+gv.replace("\\\\.","")+"]",QW=/((?:WC+[\\/:])*)/.source.replace("WC",mv),t9=/(WCOD+)?/.source.replace("WCOD",jW),e9=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",mv),n9=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",mv),r9=new RegExp("^"+QW+t9+e9+n9+"$"),i9=["material","materials","bones","map"],cv=class{constructor(t,e,o){let s=o||Nr.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,s=this._bindings[o];s!==void 0&&s.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let s=this._targetGroup.nCachedObjects_,c=o.length;s!==c;++s)o[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Nr=class n{constructor(t,e,o){this.path=e,this.parsedPath=o||n.parseTrackName(e),this.node=n.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,o):new n(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(KW,"")}static parseTrackName(t){let e=r9.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=o.nodeName&&o.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let c=o.nodeName.substring(s+1);i9.indexOf(c)!==-1&&(o.nodeName=o.nodeName.substring(0,s),o.objectName=c)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(c){for(let h=0;h<c.length;h++){let p=c[h];if(p.name===e||p.uuid===e)return p;let g=o(p.children);if(g)return g}return null},s=o(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)t[e++]=o[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,s=e.propertyName,c=e.propertyIndex;if(t||(t=n.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let m=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let _=0;_<t.length;_++)if(t[_].name===m){m=_;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(m!==void 0){if(t[m]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[m]}}let h=t[s];if(h===void 0){let m=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+m+"."+s+" but it wasn't found.",t);return}let p=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?p=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(p=this.Versioning.MatrixWorldNeedsUpdate);let g=this.BindingType.Direct;if(c!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[c]!==void 0&&(c=t.morphTargetDictionary[c])}g=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=c}else h.fromArray!==void 0&&h.toArray!==void 0?(g=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(g=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=s;this.getValue=this.GetterByBindingType[g],this.setValue=this.SetterByBindingTypeAndVersioning[g][p]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Nr.Composite=cv;Nr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Nr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Nr.prototype.GetterByBindingType=[Nr.prototype._getValue_direct,Nr.prototype._getValue_array,Nr.prototype._getValue_arrayElement,Nr.prototype._getValue_toArray];Nr.prototype.SetterByBindingTypeAndVersioning=[[Nr.prototype._setValue_direct,Nr.prototype._setValue_direct_setNeedsUpdate,Nr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_array,Nr.prototype._setValue_array_setNeedsUpdate,Nr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_arrayElement,Nr.prototype._setValue_arrayElement_setNeedsUpdate,Nr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_fromArray,Nr.prototype._setValue_fromArray_setNeedsUpdate,Nr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var pQ=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:fv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=fv);var Bi=63710088e-1,mQ={centimeters:Bi*100,centimetres:Bi*100,degrees:Bi/111325,feet:Bi*3.28084,inches:Bi*39.37,kilometers:Bi/1e3,kilometres:Bi/1e3,meters:Bi,metres:Bi,miles:Bi/1609.344,millimeters:Bi*1e3,millimetres:Bi*1e3,nauticalmiles:Bi/1852,radians:1,yards:Bi*1.0936},yQ={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Bi,yards:1.0936133};function So(n,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=n,o}function Cr(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pa(n[0])||!Pa(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return So(o,t,e)}function Or(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var c=s[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:n};return So(p,t,e)}function zi(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return So(o,t,e)}function yv(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return So(o,t,e)}function Pa(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function _i(n,t,e){if(n!==null)for(var o,s,c,h,p,g,m,_=0,E=0,x,b=n.type,P=b==="FeatureCollection",I=b==="Feature",S=P?n.features.length:1,w=0;w<S;w++){m=P?n.features[w].geometry:I?n.geometry:n,x=m?m.type==="GeometryCollection":!1,p=x?m.geometries.length:1;for(var R=0;R<p;R++){var T=0,F=0;if(h=x?m.geometries[R]:m,h!==null){g=h.coordinates;var W=h.type;switch(_=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,E,w,T,F)===!1)return!1;E++,T++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],E,w,T,F)===!1)return!1;E++,W==="MultiPoint"&&T++}W==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-_;s++){if(t(g[o][s],E,w,T,F)===!1)return!1;E++}W==="MultiLineString"&&T++,W==="Polygon"&&F++}W==="Polygon"&&T++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(c=0;c<g[o][s].length-_;c++){if(t(g[o][s][c],E,w,T,F)===!1)return!1;E++}F++}T++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(_i(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function KT(n,t,e,o){var s=e;return _i(n,function(c,h,p,g,m){h===0&&e===void 0?s=c:s=t(s,c,h,p,g,m)},o),s}function Ju(n,t){var e,o,s,c,h,p,g,m,_,E,x=0,b=n.type==="FeatureCollection",P=n.type==="Feature",I=b?n.features.length:1;for(e=0;e<I;e++){for(p=b?n.features[e].geometry:P?n.geometry:n,m=b?n.features[e].properties:P?n.properties:{},_=b?n.features[e].bbox:P?n.bbox:void 0,E=b?n.features[e].id:P?n.id:void 0,g=p?p.type==="GeometryCollection":!1,h=g?p.geometries.length:1,s=0;s<h;s++){if(c=g?p.geometries[s]:p,c===null){if(t(null,x,m,_,E)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,m,_,E)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,m,_,E)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function ds(n,t){Ju(n,function(e,o,s,c,h){var p=e===null?null:e.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return t(So(e,s,{bbox:c,id:h}),o,0)===!1?!1:void 0}var g;switch(p){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var _=e.coordinates[m],E={type:g,coordinates:_};if(t(So(E,s),o,m)===!1)return!1}})}function vv(n){var t=[1/0,1/0,-1/0,-1/0];return _i(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}vv.default=vv;var Mo=vv;function ji(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function _v(n,t,e){if(!n)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!n.geometry||n.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+n.geometry.type)}function Qi(n){return n.type==="Feature"?n.geometry:n}var h9=on(Rd(),1);var w9=on(gC(),1);function Gi(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=ji(n),s=Qi(t),c=s.type,h=t.bbox,p=s.coordinates;if(h&&S9(o,h)===!1)return!1;c==="Polygon"&&(p=[p]);for(var g=!1,m=0;m<p.length&&!g;m++)if(mC(o,p[m][0],e.ignoreBoundary)){for(var _=!1,E=1;E<p[m].length&&!_;)mC(o,p[m][E],!e.ignoreBoundary)&&(_=!0),E++;_||(g=!0)}return g}function mC(n,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var s=0,c=t.length-1;s<t.length;c=s++){var h=t[s][0],p=t[s][1],g=t[c][0],m=t[c][1],_=n[1]*(h-g)+p*(g-n[0])+m*(n[0]-h)===0&&(h-n[0])*(g-n[0])<=0&&(p-n[1])*(m-n[1])<=0;if(_)return!e;var E=p>n[1]!=m>n[1]&&n[0]<(g-h)*(n[1]-p)/(m-p)+h;E&&(o=!o)}return o}function S9(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var _C=new ArrayBuffer(16),Xtt=new Float64Array(_C),Ytt=new Uint32Array(_C);var B9=on(Dv(),1);var Ent=function(){function n(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],s=this.points[e+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var c=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,h=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,p=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+p)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+p)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return n.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var c=this.pos(s),h=Math.sqrt((c.x-o.x)*(c.x-o.x)+(c.y-o.y)*(c.y-o.y)+(c.z-o.z)*(c.z-o.z));h>t&&(e.push(s),o=c)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},n.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*o),c=(this.length-1)*o-s;return z9(c,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function z9(n,t,e,o,s){var c=G9(n),h={x:s.x*c[0]+o.x*c[1]+e.x*c[2]+t.x*c[3],y:s.y*c[0]+o.y*c[1]+e.y*c[2]+t.y*c[3],z:s.z*c[0]+o.z*c[1]+e.z*c[2]+t.z*c[3]};return h}function G9(n){var t=n*n,e=t*n;return[e,3*t*(1-n),3*n*(1-n)*(1-n),(1-n)*(1-n)*(1-n)]}function oh(n,t){t===void 0&&(t={});var e=Number(n[0]),o=Number(n[1]),s=Number(n[2]),c=Number(n[3]);if(n.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[e,o],p=[e,c],g=[s,c],m=[s,o];return Or([[h,m,g,p,h]],t.properties,{bbox:n,id:t.id})}function k9(n){return oh(Mo(n))}var Fv=k9;var iX=on(IC(),1);var RX=on($d(),1);var NX=on(Rd(),1);var FX=on(Dv(),1);var $C=Math.PI/180,ZC=180/Math.PI,hh=function(n,t){this.lon=n,this.lat=t,this.x=$C*n,this.y=$C*t};hh.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};hh.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new hh(t,n)};var JC=function(){this.coords=[],this.length=0};JC.prototype.move_to=function(n){this.length++,this.coords.push(n)};var n_=function(n){this.properties=n||{},this.geometries=[]};n_.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var n=[],t=0;t<this.geometries.length;t++)n.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:n},type:"Feature",properties:this.properties}};n_.prototype.wkt=function(){for(var n="",t="LINESTRING(",e=function(c){t+=c[0]+" "+c[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[o].coords;s.forEach(e),n+=t.substring(0,t.length-1)+")"}return n};var KC=function(n,t,e){if(!n||n.x===void 0||n.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new hh(n.x,n.y),this.end=new hh(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,s=this.start.y-this.end.y,c=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(c)),this.g===Math.PI)throw new Error("it appears "+n.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+n+" and "+t)};KC.prototype.interpolate=function(n){var t=Math.sin((1-n)*this.g)/Math.sin(this.g),e=Math.sin(n*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),s=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),c=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),h=ZC*Math.atan2(c,Math.sqrt(Math.pow(o,2)+Math.pow(s,2))),p=ZC*Math.atan2(s,o);return[p,h]};KC.prototype.Arc=function(n,t){var e=[];if(!n||n<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(n-1),s=0;s<n;++s){var c=o*s,h=this.interpolate(c);e.push(h)}for(var p=!1,g=0,m=t&&t.offset?t.offset:10,_=180-m,E=-180+m,x=360-m,b=1;b<e.length;++b){var P=e[b-1][0],I=e[b][0],S=Math.abs(I-P);S>x&&(I>_&&P<E||P>_&&I<E)?p=!0:S>g&&(g=S)}var w=[];if(p&&g<m){var R=[];w.push(R);for(var T=0;T<e.length;++T){var F=parseFloat(e[T][0]);if(T>0&&Math.abs(F-e[T-1][0])>x){var W=parseFloat(e[T-1][0]),X=parseFloat(e[T-1][1]),q=parseFloat(e[T][0]),D=parseFloat(e[T][1]);if(W>-180&&W<E&&q===180&&T+1<e.length&&e[T-1][0]>-180&&e[T-1][0]<E){R.push([-180,e[T][1]]),T++,R.push([e[T][0],e[T][1]]);continue}else if(W>_&&W<180&&q===-180&&T+1<e.length&&e[T-1][0]>_&&e[T-1][0]<180){R.push([180,e[T][1]]),T++,R.push([e[T][0],e[T][1]]);continue}if(W<E&&q>_){var xt=W;W=q,q=xt;var B=X;X=D,D=B}if(W>_&&q<E&&(q+=360),W<=180&&q>=180&&W<q){var j=(180-W)/(q-W),J=j*D+(1-j)*X;R.push([e[T-1][0]>_?180:-180,J]),R=[],R.push([e[T-1][0]>_?-180:180,J]),w.push(R)}else R=[],w.push(R);R.push([F,e[T][1]])}else R.push([e[T][0],e[T][1]])}}else{var Dt=[];w.push(Dt);for(var Q=0;Q<e.length;++Q)Dt.push([e[Q][0],e[Q][1]])}for(var At=new n_(this.properties),Mt=0;Mt<w.length;++Mt){var Rt=new JC;At.geometries.push(Rt);for(var pt=w[Mt],yt=0;yt<pt.length;++yt)Rt.move_to(pt[yt])}return At};var zX=on($d(),1);var vY=on($d(),1);var _Y=on(M_(),1);var wY=on(Rd(),1);var un=[],ln=[],cn=[],fn=[],hn=[],pn=[],dn=[],gn=[],mn=[],yn=[],vn=[],_n=[],xn=[],En=[],wn=[],Sn=[],Mn=[],bn=[],An=[],Tn=[],Cn=[],Pn=[],In=[],Rn=[];dn[85]=yn[85]=-1;gn[85]=vn[85]=0;mn[85]=_n[85]=1;An[85]=Pn[85]=1;Tn[85]=In[85]=0;Cn[85]=Rn[85]=1;un[85]=fn[85]=0;ln[85]=hn[85]=-1;cn[85]=wn[85]=0;Sn[85]=xn[85]=0;Mn[85]=En[85]=1;pn[85]=bn[85]=1;Pn[1]=Pn[169]=0;In[1]=In[169]=-1;Rn[1]=Rn[169]=0;xn[1]=xn[169]=-1;En[1]=En[169]=0;wn[1]=wn[169]=0;yn[4]=yn[166]=0;vn[4]=vn[166]=-1;_n[4]=_n[166]=1;Sn[4]=Sn[166]=1;Mn[4]=Mn[166]=0;bn[4]=bn[166]=0;dn[16]=dn[154]=0;gn[16]=gn[154]=1;mn[16]=mn[154]=1;fn[16]=fn[154]=1;hn[16]=hn[154]=0;pn[16]=pn[154]=1;An[64]=An[106]=0;Tn[64]=Tn[106]=1;Cn[64]=Cn[106]=0;un[64]=un[106]=-1;ln[64]=ln[106]=0;cn[64]=cn[106]=1;An[2]=An[168]=0;Tn[2]=Tn[168]=-1;Cn[2]=Cn[168]=1;Pn[2]=Pn[168]=0;In[2]=In[168]=-1;Rn[2]=Rn[168]=0;xn[2]=xn[168]=-1;En[2]=En[168]=0;wn[2]=wn[168]=0;Sn[2]=Sn[168]=-1;Mn[2]=Mn[168]=0;bn[2]=bn[168]=1;dn[8]=dn[162]=0;gn[8]=gn[162]=-1;mn[8]=mn[162]=0;yn[8]=yn[162]=0;vn[8]=vn[162]=-1;_n[8]=_n[162]=1;xn[8]=xn[162]=1;En[8]=En[162]=0;wn[8]=wn[162]=1;Sn[8]=Sn[162]=1;Mn[8]=Mn[162]=0;bn[8]=bn[162]=0;dn[32]=dn[138]=0;gn[32]=gn[138]=1;mn[32]=mn[138]=1;yn[32]=yn[138]=0;vn[32]=vn[138]=1;_n[32]=_n[138]=0;un[32]=un[138]=1;ln[32]=ln[138]=0;cn[32]=cn[138]=0;fn[32]=fn[138]=1;hn[32]=hn[138]=0;pn[32]=pn[138]=1;Pn[128]=Pn[42]=0;In[128]=In[42]=1;Rn[128]=Rn[42]=1;An[128]=An[42]=0;Tn[128]=Tn[42]=1;Cn[128]=Cn[42]=0;un[128]=un[42]=-1;ln[128]=ln[42]=0;cn[128]=cn[42]=1;fn[128]=fn[42]=-1;hn[128]=hn[42]=0;pn[128]=pn[42]=0;yn[5]=yn[165]=-1;vn[5]=vn[165]=0;_n[5]=_n[165]=0;Pn[5]=Pn[165]=1;In[5]=In[165]=0;Rn[5]=Rn[165]=0;Sn[20]=Sn[150]=0;Mn[20]=Mn[150]=1;bn[20]=bn[150]=1;fn[20]=fn[150]=0;hn[20]=hn[150]=-1;pn[20]=pn[150]=1;dn[80]=dn[90]=-1;gn[80]=gn[90]=0;mn[80]=mn[90]=1;An[80]=An[90]=1;Tn[80]=Tn[90]=0;Cn[80]=Cn[90]=1;xn[65]=xn[105]=0;En[65]=En[105]=1;wn[65]=wn[105]=0;un[65]=un[105]=0;ln[65]=ln[105]=-1;cn[65]=cn[105]=0;dn[160]=dn[10]=-1;gn[160]=gn[10]=0;mn[160]=mn[10]=1;yn[160]=yn[10]=-1;vn[160]=vn[10]=0;_n[160]=_n[10]=0;Pn[160]=Pn[10]=1;In[160]=In[10]=0;Rn[160]=Rn[10]=0;An[160]=An[10]=1;Tn[160]=Tn[10]=0;Cn[160]=Cn[10]=1;Sn[130]=Sn[40]=0;Mn[130]=Mn[40]=1;bn[130]=bn[40]=1;xn[130]=xn[40]=0;En[130]=En[40]=1;wn[130]=wn[40]=0;un[130]=un[40]=0;ln[130]=ln[40]=-1;cn[130]=cn[40]=0;fn[130]=fn[40]=0;hn[130]=hn[40]=-1;pn[130]=pn[40]=1;yn[37]=yn[133]=0;vn[37]=vn[133]=1;_n[37]=_n[133]=1;Pn[37]=Pn[133]=0;In[37]=In[133]=1;Rn[37]=Rn[133]=0;un[37]=un[133]=-1;ln[37]=ln[133]=0;cn[37]=cn[133]=0;fn[37]=fn[133]=1;hn[37]=hn[133]=0;pn[37]=pn[133]=0;Sn[148]=Sn[22]=-1;Mn[148]=Mn[22]=0;bn[148]=bn[22]=0;Pn[148]=Pn[22]=0;In[148]=In[22]=-1;Rn[148]=Rn[22]=1;An[148]=An[22]=0;Tn[148]=Tn[22]=1;Cn[148]=Cn[22]=1;fn[148]=fn[22]=-1;hn[148]=hn[22]=0;pn[148]=pn[22]=1;dn[82]=dn[88]=0;gn[82]=gn[88]=-1;mn[82]=mn[88]=1;Sn[82]=Sn[88]=1;Mn[82]=Mn[88]=0;bn[82]=bn[88]=1;xn[82]=xn[88]=-1;En[82]=En[88]=0;wn[82]=wn[88]=1;An[82]=An[88]=0;Tn[82]=Tn[88]=-1;Cn[82]=Cn[88]=0;dn[73]=dn[97]=0;gn[73]=gn[97]=1;mn[73]=mn[97]=0;yn[73]=yn[97]=0;vn[73]=vn[97]=-1;_n[73]=_n[97]=0;xn[73]=xn[97]=1;En[73]=En[97]=0;wn[73]=wn[97]=0;un[73]=un[97]=1;ln[73]=ln[97]=0;cn[73]=cn[97]=1;dn[145]=dn[25]=0;gn[145]=gn[25]=-1;mn[145]=mn[25]=0;xn[145]=xn[25]=1;En[145]=En[25]=0;wn[145]=wn[25]=1;Pn[145]=Pn[25]=0;In[145]=In[25]=1;Rn[145]=Rn[25]=1;fn[145]=fn[25]=-1;hn[145]=hn[25]=0;pn[145]=pn[25]=0;yn[70]=yn[100]=0;vn[70]=vn[100]=1;_n[70]=_n[100]=0;Sn[70]=Sn[100]=-1;Mn[70]=Mn[100]=0;bn[70]=bn[100]=1;An[70]=An[100]=0;Tn[70]=Tn[100]=-1;Cn[70]=Cn[100]=1;un[70]=un[100]=1;ln[70]=ln[100]=0;cn[70]=cn[100]=0;yn[101]=yn[69]=0;vn[101]=vn[69]=1;_n[101]=_n[69]=0;un[101]=un[69]=1;ln[101]=ln[69]=0;cn[101]=cn[69]=0;Pn[149]=Pn[21]=0;In[149]=In[21]=1;Rn[149]=Rn[21]=1;fn[149]=fn[21]=-1;hn[149]=hn[21]=0;pn[149]=pn[21]=0;Sn[86]=Sn[84]=-1;Mn[86]=Mn[84]=0;bn[86]=bn[84]=1;An[86]=An[84]=0;Tn[86]=Tn[84]=-1;Cn[86]=Cn[84]=1;dn[89]=dn[81]=0;gn[89]=gn[81]=-1;mn[89]=mn[81]=0;xn[89]=xn[81]=1;En[89]=En[81]=0;wn[89]=wn[81]=1;dn[96]=dn[74]=0;gn[96]=gn[74]=1;mn[96]=mn[74]=0;yn[96]=yn[74]=-1;vn[96]=vn[74]=0;_n[96]=_n[74]=1;An[96]=An[74]=1;Tn[96]=Tn[74]=0;Cn[96]=Cn[74]=0;un[96]=un[74]=1;ln[96]=ln[74]=0;cn[96]=cn[74]=1;dn[24]=dn[146]=0;gn[24]=gn[146]=-1;mn[24]=mn[146]=1;Sn[24]=Sn[146]=1;Mn[24]=Mn[146]=0;bn[24]=bn[146]=1;xn[24]=xn[146]=0;En[24]=En[146]=1;wn[24]=wn[146]=1;fn[24]=fn[146]=0;hn[24]=hn[146]=-1;pn[24]=pn[146]=0;yn[6]=yn[164]=-1;vn[6]=vn[164]=0;_n[6]=_n[164]=1;Sn[6]=Sn[164]=-1;Mn[6]=Mn[164]=0;bn[6]=bn[164]=0;Pn[6]=Pn[164]=0;In[6]=In[164]=-1;Rn[6]=Rn[164]=1;An[6]=An[164]=1;Tn[6]=Tn[164]=0;Cn[6]=Cn[164]=0;xn[129]=xn[41]=0;En[129]=En[41]=1;wn[129]=wn[41]=1;Pn[129]=Pn[41]=0;In[129]=In[41]=1;Rn[129]=Rn[41]=0;un[129]=un[41]=-1;ln[129]=ln[41]=0;cn[129]=cn[41]=0;fn[129]=fn[41]=0;hn[129]=hn[41]=-1;pn[129]=pn[41]=0;Sn[66]=Sn[104]=0;Mn[66]=Mn[104]=1;bn[66]=bn[104]=0;xn[66]=xn[104]=-1;En[66]=En[104]=0;wn[66]=wn[104]=1;An[66]=An[104]=0;Tn[66]=Tn[104]=-1;Cn[66]=Cn[104]=0;un[66]=un[104]=0;ln[66]=ln[104]=-1;cn[66]=cn[104]=1;dn[144]=dn[26]=-1;gn[144]=gn[26]=0;mn[144]=mn[26]=0;Pn[144]=Pn[26]=1;In[144]=In[26]=0;Rn[144]=Rn[26]=1;An[144]=An[26]=0;Tn[144]=Tn[26]=1;Cn[144]=Cn[26]=1;fn[144]=fn[26]=-1;hn[144]=hn[26]=0;pn[144]=pn[26]=1;yn[36]=yn[134]=0;vn[36]=vn[134]=1;_n[36]=_n[134]=1;Sn[36]=Sn[134]=0;Mn[36]=Mn[134]=1;bn[36]=bn[134]=0;un[36]=un[134]=0;ln[36]=ln[134]=-1;cn[36]=cn[134]=1;fn[36]=fn[134]=1;hn[36]=hn[134]=0;pn[36]=pn[134]=0;dn[9]=dn[161]=-1;gn[9]=gn[161]=0;mn[9]=mn[161]=0;yn[9]=yn[161]=0;vn[9]=vn[161]=-1;_n[9]=_n[161]=0;xn[9]=xn[161]=1;En[9]=En[161]=0;wn[9]=wn[161]=0;Pn[9]=Pn[161]=1;In[9]=In[161]=0;Rn[9]=Rn[161]=1;dn[136]=0;gn[136]=1;mn[136]=1;yn[136]=0;vn[136]=1;_n[136]=0;Sn[136]=-1;Mn[136]=0;bn[136]=1;xn[136]=-1;En[136]=0;wn[136]=0;Pn[136]=0;In[136]=-1;Rn[136]=0;An[136]=0;Tn[136]=-1;Cn[136]=1;un[136]=1;ln[136]=0;cn[136]=0;fn[136]=1;hn[136]=0;pn[136]=1;dn[34]=0;gn[34]=-1;mn[34]=0;yn[34]=0;vn[34]=-1;_n[34]=1;Sn[34]=1;Mn[34]=0;bn[34]=0;xn[34]=1;En[34]=0;wn[34]=1;Pn[34]=0;In[34]=1;Rn[34]=1;An[34]=0;Tn[34]=1;Cn[34]=0;un[34]=-1;ln[34]=0;cn[34]=1;fn[34]=-1;hn[34]=0;pn[34]=0;dn[35]=0;gn[35]=1;mn[35]=1;yn[35]=0;vn[35]=-1;_n[35]=1;Sn[35]=1;Mn[35]=0;bn[35]=0;xn[35]=-1;En[35]=0;wn[35]=0;Pn[35]=0;In[35]=-1;Rn[35]=0;An[35]=0;Tn[35]=1;Cn[35]=0;un[35]=-1;ln[35]=0;cn[35]=1;fn[35]=1;hn[35]=0;pn[35]=1;dn[153]=0;gn[153]=1;mn[153]=1;xn[153]=-1;En[153]=0;wn[153]=0;Pn[153]=0;In[153]=-1;Rn[153]=0;fn[153]=1;hn[153]=0;pn[153]=1;yn[102]=0;vn[102]=-1;_n[102]=1;Sn[102]=1;Mn[102]=0;bn[102]=0;An[102]=0;Tn[102]=1;Cn[102]=0;un[102]=-1;ln[102]=0;cn[102]=1;dn[155]=0;gn[155]=-1;mn[155]=0;xn[155]=1;En[155]=0;wn[155]=1;Pn[155]=0;In[155]=1;Rn[155]=1;fn[155]=-1;hn[155]=0;pn[155]=0;yn[103]=0;vn[103]=1;_n[103]=0;Sn[103]=-1;Mn[103]=0;bn[103]=1;An[103]=0;Tn[103]=-1;Cn[103]=1;un[103]=1;ln[103]=0;cn[103]=0;dn[152]=0;gn[152]=1;mn[152]=1;Sn[152]=-1;Mn[152]=0;bn[152]=1;xn[152]=-1;En[152]=0;wn[152]=0;Pn[152]=0;In[152]=-1;Rn[152]=0;An[152]=0;Tn[152]=-1;Cn[152]=1;fn[152]=1;hn[152]=0;pn[152]=1;dn[156]=0;gn[156]=-1;mn[156]=1;Sn[156]=1;Mn[156]=0;bn[156]=1;xn[156]=-1;En[156]=0;wn[156]=0;Pn[156]=0;In[156]=-1;Rn[156]=0;An[156]=0;Tn[156]=1;Cn[156]=1;fn[156]=-1;hn[156]=0;pn[156]=1;dn[137]=0;gn[137]=1;mn[137]=1;yn[137]=0;vn[137]=1;_n[137]=0;xn[137]=-1;En[137]=0;wn[137]=0;Pn[137]=0;In[137]=-1;Rn[137]=0;un[137]=1;ln[137]=0;cn[137]=0;fn[137]=1;hn[137]=0;pn[137]=1;dn[139]=0;gn[139]=1;mn[139]=1;yn[139]=0;vn[139]=-1;_n[139]=0;xn[139]=1;En[139]=0;wn[139]=0;Pn[139]=0;In[139]=1;Rn[139]=0;un[139]=-1;ln[139]=0;cn[139]=0;fn[139]=1;hn[139]=0;pn[139]=1;dn[98]=0;gn[98]=-1;mn[98]=0;yn[98]=0;vn[98]=-1;_n[98]=1;Sn[98]=1;Mn[98]=0;bn[98]=0;xn[98]=1;En[98]=0;wn[98]=1;An[98]=0;Tn[98]=1;Cn[98]=0;un[98]=-1;ln[98]=0;cn[98]=1;dn[99]=0;gn[99]=1;mn[99]=0;yn[99]=0;vn[99]=-1;_n[99]=1;Sn[99]=1;Mn[99]=0;bn[99]=0;xn[99]=-1;En[99]=0;wn[99]=1;An[99]=0;Tn[99]=-1;Cn[99]=0;un[99]=1;ln[99]=0;cn[99]=1;yn[38]=0;vn[38]=-1;_n[38]=1;Sn[38]=1;Mn[38]=0;bn[38]=0;Pn[38]=0;In[38]=1;Rn[38]=1;An[38]=0;Tn[38]=1;Cn[38]=0;un[38]=-1;ln[38]=0;cn[38]=1;fn[38]=-1;hn[38]=0;pn[38]=0;yn[39]=0;vn[39]=1;_n[39]=1;Sn[39]=-1;Mn[39]=0;bn[39]=0;Pn[39]=0;In[39]=-1;Rn[39]=1;An[39]=0;Tn[39]=1;Cn[39]=0;un[39]=-1;ln[39]=0;cn[39]=1;fn[39]=1;hn[39]=0;pn[39]=0;var b_=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},A_=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},T_=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},C_=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},P_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},I_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},R_=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},L_=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},SY=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},MY=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},bY=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},AY=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},TY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},CY=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},PY=function(){return[[0,0],[0,1],[1,1],[1,0]]},IY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},RY=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},LY=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},NY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},OY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},DY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},FY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},UY=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},BY=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},zY=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},GY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},kY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},qY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},HY=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},VY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},WY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},XY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},YY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},$Y=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},ZY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},JY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},KY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},jY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},QY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},t$=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},Dn=[],Fn=[],Un=[],Bn=[],zn=[],Gn=[],kn=[],qn=[];Bn[1]=zn[1]=18;Bn[169]=zn[169]=18;Un[4]=Fn[4]=12;Un[166]=Fn[166]=12;Dn[16]=qn[16]=4;Dn[154]=qn[154]=4;Gn[64]=kn[64]=22;Gn[106]=kn[106]=22;Un[2]=Gn[2]=17;Bn[2]=zn[2]=18;Un[168]=Gn[168]=17;Bn[168]=zn[168]=18;Dn[8]=Bn[8]=9;Fn[8]=Un[8]=12;Dn[162]=Bn[162]=9;Fn[162]=Un[162]=12;Dn[32]=qn[32]=4;Fn[32]=kn[32]=1;Dn[138]=qn[138]=4;Fn[138]=kn[138]=1;zn[128]=qn[128]=21;Gn[128]=kn[128]=22;zn[42]=qn[42]=21;Gn[42]=kn[42]=22;Fn[5]=zn[5]=14;Fn[165]=zn[165]=14;Un[20]=qn[20]=6;Un[150]=qn[150]=6;Dn[80]=Gn[80]=11;Dn[90]=Gn[90]=11;Bn[65]=kn[65]=3;Bn[105]=kn[105]=3;Dn[160]=Gn[160]=11;Fn[160]=zn[160]=14;Dn[10]=Gn[10]=11;Fn[10]=zn[10]=14;Un[130]=qn[130]=6;Bn[130]=kn[130]=3;Un[40]=qn[40]=6;Bn[40]=kn[40]=3;Fn[101]=kn[101]=1;Fn[69]=kn[69]=1;zn[149]=qn[149]=21;zn[21]=qn[21]=21;Un[86]=Gn[86]=17;Un[84]=Gn[84]=17;Dn[89]=Bn[89]=9;Dn[81]=Bn[81]=9;Dn[96]=kn[96]=0;Fn[96]=Gn[96]=15;Dn[74]=kn[74]=0;Fn[74]=Gn[74]=15;Dn[24]=Un[24]=8;Bn[24]=qn[24]=7;Dn[146]=Un[146]=8;Bn[146]=qn[146]=7;Fn[6]=Gn[6]=15;Un[6]=zn[6]=16;Fn[164]=Gn[164]=15;Un[164]=zn[164]=16;Bn[129]=qn[129]=7;zn[129]=kn[129]=20;Bn[41]=qn[41]=7;zn[41]=kn[41]=20;Un[66]=kn[66]=2;Bn[66]=Gn[66]=19;Un[104]=kn[104]=2;Bn[104]=Gn[104]=19;Dn[144]=zn[144]=10;Gn[144]=qn[144]=23;Dn[26]=zn[26]=10;Gn[26]=qn[26]=23;Fn[36]=qn[36]=5;Un[36]=kn[36]=2;Fn[134]=qn[134]=5;Un[134]=kn[134]=2;Dn[9]=zn[9]=10;Fn[9]=Bn[9]=13;Dn[161]=zn[161]=10;Fn[161]=Bn[161]=13;Fn[37]=qn[37]=5;zn[37]=kn[37]=20;Fn[133]=qn[133]=5;zn[133]=kn[133]=20;Un[148]=zn[148]=16;Gn[148]=qn[148]=23;Un[22]=zn[22]=16;Gn[22]=qn[22]=23;Dn[82]=Un[82]=8;Bn[82]=Gn[82]=19;Dn[88]=Un[88]=8;Bn[88]=Gn[88]=19;Dn[73]=kn[73]=0;Fn[73]=Bn[73]=13;Dn[97]=kn[97]=0;Fn[97]=Bn[97]=13;Dn[145]=Bn[145]=9;zn[145]=qn[145]=21;Dn[25]=Bn[25]=9;zn[25]=qn[25]=21;Fn[70]=kn[70]=1;Un[70]=Gn[70]=17;Fn[100]=kn[100]=1;Un[100]=Gn[100]=17;Dn[34]=Bn[34]=9;Fn[34]=Un[34]=12;zn[34]=qn[34]=21;Gn[34]=kn[34]=22;Dn[136]=qn[136]=4;Fn[136]=kn[136]=1;Un[136]=Gn[136]=17;Bn[136]=zn[136]=18;Dn[35]=qn[35]=4;Fn[35]=Un[35]=12;Bn[35]=zn[35]=18;Gn[35]=kn[35]=22;Dn[153]=qn[153]=4;Bn[153]=zn[153]=18;Fn[102]=Un[102]=12;Gn[102]=kn[102]=22;Dn[155]=Bn[155]=9;zn[155]=qn[155]=23;Fn[103]=kn[103]=1;Un[103]=Gn[103]=17;Dn[152]=qn[152]=4;Un[152]=Gn[152]=17;Bn[152]=zn[152]=18;Dn[156]=Un[156]=8;Bn[156]=zn[156]=18;Gn[156]=qn[156]=23;Dn[137]=qn[137]=4;Fn[137]=kn[137]=1;Bn[137]=zn[137]=18;Dn[139]=qn[139]=4;Fn[139]=Bn[139]=13;zn[139]=kn[139]=20;Dn[98]=Bn[98]=9;Fn[98]=Un[98]=12;Gn[98]=kn[98]=22;Dn[99]=kn[99]=0;Fn[99]=Un[99]=12;Bn[99]=Gn[99]=19;Fn[38]=Un[38]=12;zn[38]=qn[38]=21;Gn[38]=kn[38]=22;Fn[39]=qn[39]=5;Un[39]=zn[39]=16;Gn[39]=kn[39]=22;var re=[];re[1]=re[169]=b_;re[4]=re[166]=A_;re[16]=re[154]=T_;re[64]=re[106]=C_;re[168]=re[2]=P_;re[162]=re[8]=I_;re[138]=re[32]=R_;re[42]=re[128]=L_;re[5]=re[165]=SY;re[20]=re[150]=MY;re[80]=re[90]=bY;re[65]=re[105]=AY;re[160]=re[10]=TY;re[130]=re[40]=CY;re[85]=PY;re[101]=re[69]=IY;re[149]=re[21]=RY;re[86]=re[84]=LY;re[89]=re[81]=NY;re[96]=re[74]=OY;re[24]=re[146]=DY;re[6]=re[164]=FY;re[129]=re[41]=UY;re[66]=re[104]=BY;re[144]=re[26]=zY;re[36]=re[134]=GY;re[9]=re[161]=kY;re[37]=re[133]=qY;re[148]=re[22]=HY;re[82]=re[88]=VY;re[73]=re[97]=WY;re[145]=re[25]=XY;re[70]=re[100]=YY;re[34]=function(n){return[L_(n),I_(n)]};re[35]=$Y;re[136]=function(n){return[R_(n),P_(n)]};re[153]=function(n){return[T_(n),b_(n)]};re[102]=function(n){return[A_(n),C_(n)]};re[155]=ZY;re[103]=JY;re[152]=function(n){return[T_(n),P_(n)]};re[156]=KY;re[137]=function(n){return[R_(n),b_(n)]};re[139]=jY;re[98]=function(n){return[I_(n),C_(n)]};re[99]=QY;re[38]=function(n){return[A_(n),L_(n)]};re[39]=t$;function n$(n){return(n>0)-(n<0)||+n}function rf(n,t,e){var o=t[0]-n[0],s=t[1]-n[1],c=e[0]-t[0],h=e[1]-t[1];return n$(o*h-c*s)}function rR(n,t){var e=n.geometry.coordinates[0].map(function(h){return h[0]}),o=n.geometry.coordinates[0].map(function(h){return h[1]}),s=t.geometry.coordinates[0].map(function(h){return h[0]}),c=t.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,o)===Math.max.apply(null,c)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,o)===Math.min.apply(null,c)}function N_(n,t){return t.geometry.coordinates[0].every(function(e){return Gi(Cr(e),n)})}function iR(n,t){return n[0]===t[0]&&n[1]===t[1]}var r$=function(){function n(t){this.id=n.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return n.buildId=function(t){return t.join(",")},n.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},n.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},n.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},n.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var s=e.to,c=o.to;if(s.coordinates[0]-t.coordinates[0]>=0&&c.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&c.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&c.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||c.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-c.coordinates[1]:c.coordinates[1]-s.coordinates[1];var h=rf(t.coordinates,s.coordinates,c.coordinates);if(h<0)return 1;if(h>0)return-1;var p=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),g=Math.pow(c.coordinates[0]-t.coordinates[0],2)+Math.pow(c.coordinates[1]-t.coordinates[1],2);return p-g}),this.outerEdgesSorted=!0)},n.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},n.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},n.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},n}(),O_=r$;var i$=function(){function n(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return n.prototype.getSymetric=function(){return this.symetric||(this.symetric=new n(this.to,this.from),this.symetric.symetric=this),this.symetric},n.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},n.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},n.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},n.prototype.toLineString=function(){return zi([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return rf(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),oR=i$;var o$=function(){function n(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return n.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},n.prototype.get=function(t){return this.edges[t]},Object.defineProperty(n.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),n.prototype.forEach=function(t){this.edges.forEach(t)},n.prototype.map=function(t){return this.edges.map(t)},n.prototype.some=function(t){return this.edges.some(t)},n.prototype.isValid=function(){return!0},n.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(h,p,g){return p.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=g),h},0),o=(e===0?this.length:e)-1,s=(e+1)%this.length,c=rf(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return c===0?this.edges[o].from.coordinates[0]>this.edges[s].from.coordinates[0]:c>0},n.prototype.toMultiPoint=function(){return yv(this.edges.map(function(t){return t.from.coordinates}))},n.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Or([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Fv(this.toPolygon())},n.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),s,c;return e.forEach(function(h){var p=h.getEnvelope();if(c&&(s=c.getEnvelope()),!rR(p,o)&&N_(p,o)){for(var g=t.map(function(P){return P.from.coordinates}),m=void 0,_=function(P){h.some(function(I){return iR(P,I.from.coordinates)})||(m=P)},E=0,x=g;E<x.length;E++){var b=x[E];_(b)}m&&h.inside(Cr(m))&&(!c||N_(s,p))&&(c=h)}}),c},n.prototype.inside=function(t){return Gi(t,this.toPolygon())},n}(),D_=o$;function s$(n){if(!n)throw new Error("No geojson passed");if(n.type!=="FeatureCollection"&&n.type!=="GeometryCollection"&&n.type!=="MultiLineString"&&n.type!=="LineString"&&n.type!=="Feature")throw new Error("Invalid input type '"+n.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var cut=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){s$(t);var e=new n;return ds(t,function(o){_v(o,"LineString","Graph::fromGeoJson"),KT(o,function(s,c){if(s){var h=e.getNode(s),p=e.getNode(c);e.addEdge(h,p)}return c})}),e},n.prototype.getNode=function(t){var e=O_.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new O_(t)),o},n.prototype.addEdge=function(t,e){var o=new oR(t,e),s=o.getSymetric();this.edges.push(o),this.edges.push(s)},n.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},n.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),o.forEach(function(s){return e._removeIfDangle(s)})}},n.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},n.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=o})},n.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),s,c,h=o.length-1;h>=0;--h){var p=o[h],g=p.symetric,m=void 0,_=void 0;p.label===e&&(m=p),g.label===e&&(_=g),!(!m||!_)&&(_&&(c=_),m&&(c&&(c.next=m,c=void 0),s||(s=m)))}c&&(c.next=s)},n.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var s=o;do s.label=e,s=s.next;while(!o.isEqual(s));e++}}),t},n.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(s){t._computeNextCCWEdges(s,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},n.prototype._findIntersectionNodes=function(t){var e=[],o=t,s=function(){var c=0;o.from.getOuterEdges().forEach(function(h){h.label===t.label&&++c}),c>1&&e.push(o.from),o=o.next};do s();while(!t.isEqual(o));return e},n.prototype._findEdgeRing=function(t){var e=t,o=new D_;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},n.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},n.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},n}();var c$=on(F_(),1);var f$=on(F_(),1);var p$=on(dR(),1);var x$=on(MR(),1);function AR(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function w$(){return new TR(function(n){return n.f})}var G_={search:function(n,t,e,o){n.cleanDirty(),o=o||{};var s=o.heuristic||G_.heuristics.manhattan,c=o.closest||!1,h=w$(),p=t;for(t.h=s(t,e),h.push(t);h.size()>0;){var g=h.pop();if(g===e)return AR(g);g.closed=!0;for(var m=n.neighbors(g),_=0,E=m.length;_<E;++_){var x=m[_];if(!(x.closed||x.isWall())){var b=g.g+x.getCost(g),P=x.visited;(!P||b<x.g)&&(x.visited=!0,x.parent=g,x.h=x.h||s(x,e),x.g=b,x.f=x.g+x.h,n.markDirty(x),c&&(x.h<p.h||x.h===p.h&&x.g<p.g)&&(p=x),P?h.rescoreElement(x):h.push(x))}}}return c?AR(p):[]},heuristics:{manhattan:function(n,t){var e=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);return e+o},diagonal:function(n,t){var e=1,o=Math.sqrt(2),s=Math.abs(t.x-n.x),c=Math.abs(t.y-n.y);return e*(s+c)+(o-2*e)*Math.min(s,c)}},cleanNode:function(n){n.f=0,n.g=0,n.h=0,n.visited=!1,n.closed=!1,n.parent=null}};function vh(n,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<n.length;e++){this.grid[e]=[];for(var o=0,s=n[e];o<s.length;o++){var c=new Eg(e,o,s[o]);this.grid[e][o]=c,this.nodes.push(c)}}this.init()}vh.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)G_.cleanNode(this.nodes[n])};vh.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)G_.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};vh.prototype.markDirty=function(n){this.dirtyNodes.push(n)};vh.prototype.neighbors=function(n){var t=[],e=n.x,o=n.y,s=this.grid;return s[e-1]&&s[e-1][o]&&t.push(s[e-1][o]),s[e+1]&&s[e+1][o]&&t.push(s[e+1][o]),s[e]&&s[e][o-1]&&t.push(s[e][o-1]),s[e]&&s[e][o+1]&&t.push(s[e][o+1]),this.diagonal&&(s[e-1]&&s[e-1][o-1]&&t.push(s[e-1][o-1]),s[e+1]&&s[e+1][o-1]&&t.push(s[e+1][o-1]),s[e-1]&&s[e-1][o+1]&&t.push(s[e-1][o+1]),s[e+1]&&s[e+1][o+1]&&t.push(s[e+1][o+1])),t};vh.prototype.toString=function(){for(var n=[],t=this.grid,e,o,s,c,h=0,p=t.length;h<p;h++){for(e=[],o=t[h],s=0,c=o.length;s<c;s++)e.push(o[s].weight);n.push(e.join(" "))}return n.join(\`
|
|
11569
11569
|
\`)};function Eg(n,t,e){this.x=n,this.y=t,this.weight=e}Eg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Eg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Eg.prototype.isWall=function(){return this.weight===0};function TR(n){this.content=[],this.scoreFunction=n}TR.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,c=s-1,h=null,p;if(c<t){var g=this.content[c];p=this.scoreFunction(g),p<o&&(h=c)}if(s<t){var m=this.content[s],_=this.scoreFunction(m);_<(h===null?o:p)&&(h=s)}if(h!==null)this.content[n]=this.content[h],this.content[h]=e,n=h;else break}}};function k_(){this._=null}function sf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}k_.prototype={constructor:k_,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=CR(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(_h(this,e),n=e,e=n.U),e.C=!1,o.C=!0,xh(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(xh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,_h(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,c,h;if(o?s?c=CR(s):c=o:c=s,t?t.L===n?t.L=c:t.R=c:this._=c,o&&s?(h=c.C,c.C=n.C,c.L=o,o.U=c,c!==s?(t=c.U,c.U=n.U,n=c.R,t.L=n,c.R=s,s.U=c):(c.U=t,t=c,n=c.R)):(h=n.C,n=c),n&&(n.U=t),!h){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,_h(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,xh(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,_h(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,xh(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,_h(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,xh(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function _h(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function xh(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function CR(n){for(;n.L;)n=n.L;return n}var q_=k_;function af(n,t,e,o){var s=[null,null],c=qi.push(s)-1;return s.left=n,s.right=t,e&&Eh(s,n,t,e),o&&Eh(s,t,n,o),bo[n.index].halfedges.push(c),bo[t.index].halfedges.push(c),s}function uf(n,t,e){var o=[t,e];return o.left=n,o}function Eh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function S$(n,t,e,o,s){var c=n[0],h=n[1],p=c[0],g=c[1],m=h[0],_=h[1],E=0,x=1,b=m-p,P=_-g,I;if(I=t-p,!(!b&&I>0)){if(I/=b,b<0){if(I<E)return;I<x&&(x=I)}else if(b>0){if(I>x)return;I>E&&(E=I)}if(I=o-p,!(!b&&I<0)){if(I/=b,b<0){if(I>x)return;I>E&&(E=I)}else if(b>0){if(I<E)return;I<x&&(x=I)}if(I=e-g,!(!P&&I>0)){if(I/=P,P<0){if(I<E)return;I<x&&(x=I)}else if(P>0){if(I>x)return;I>E&&(E=I)}if(I=s-g,!(!P&&I<0)){if(I/=P,P<0){if(I>x)return;I>E&&(E=I)}else if(P>0){if(I<E)return;I<x&&(x=I)}return!(E>0)&&!(x<1)||(E>0&&(n[0]=[p+E*b,g+E*P]),x<1&&(n[1]=[p+x*b,g+x*P])),!0}}}}}function M$(n,t,e,o,s){var c=n[1];if(c)return!0;var h=n[0],p=n.left,g=n.right,m=p[0],_=p[1],E=g[0],x=g[1],b=(m+E)/2,P=(_+x)/2,I,S;if(x===_){if(b<t||b>=o)return;if(m>E){if(!h)h=[b,e];else if(h[1]>=s)return;c=[b,s]}else{if(!h)h=[b,s];else if(h[1]<e)return;c=[b,e]}}else if(I=(m-E)/(x-_),S=P-I*b,I<-1||I>1)if(m>E){if(!h)h=[(e-S)/I,e];else if(h[1]>=s)return;c=[(s-S)/I,s]}else{if(!h)h=[(s-S)/I,s];else if(h[1]<e)return;c=[(e-S)/I,e]}else if(_<x){if(!h)h=[t,I*t+S];else if(h[0]>=o)return;c=[o,I*o+S]}else{if(!h)h=[o,I*o+S];else if(h[0]<t)return;c=[t,I*t+S]}return n[0]=h,n[1]=c,!0}function PR(n,t,e,o){for(var s=qi.length,c;s--;)(!M$(c=qi[s],n,t,e,o)||!S$(c,n,t,e,o)||!(Math.abs(c[0][0]-c[1][0])>xr||Math.abs(c[0][1]-c[1][1])>xr))&&delete qi[s]}function IR(n){return bo[n.index]={site:n,halfedges:[]}}function b$(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function H_(n,t){return t[+(t.left!==n.site)]}function A$(n,t){return t[+(t.left===n.site)]}function RR(){for(var n=0,t=bo.length,e,o,s,c;n<t;++n)if((e=bo[n])&&(c=(o=e.halfedges).length)){var h=new Array(c),p=new Array(c);for(s=0;s<c;++s)h[s]=s,p[s]=b$(e,qi[o[s]]);for(h.sort(function(g,m){return p[m]-p[g]}),s=0;s<c;++s)p[s]=o[h[s]];for(s=0;s<c;++s)o[s]=p[s]}}function LR(n,t,e,o){var s=bo.length,c,h,p,g,m,_,E,x,b,P,I,S,w=!0;for(c=0;c<s;++c)if(h=bo[c]){for(p=h.site,m=h.halfedges,g=m.length;g--;)qi[m[g]]||m.splice(g,1);for(g=0,_=m.length;g<_;)P=A$(h,qi[m[g]]),I=P[0],S=P[1],E=H_(h,qi[m[++g%_]]),x=E[0],b=E[1],(Math.abs(I-x)>xr||Math.abs(S-b)>xr)&&(m.splice(g,0,qi.push(uf(p,P,Math.abs(I-n)<xr&&o-S>xr?[n,Math.abs(x-n)<xr?b:o]:Math.abs(S-o)<xr&&e-I>xr?[Math.abs(b-o)<xr?x:e,o]:Math.abs(I-e)<xr&&S-t>xr?[e,Math.abs(x-e)<xr?b:t]:Math.abs(S-t)<xr&&I-n>xr?[Math.abs(b-t)<xr?x:n,t]:null))-1),++_);_&&(w=!1)}if(w){var R,T,F,W=1/0;for(c=0,w=null;c<s;++c)(h=bo[c])&&(p=h.site,R=p[0]-n,T=p[1]-t,F=R*R+T*T,F<W&&(W=F,w=h));if(w){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];w.halfedges.push(qi.push(uf(p=w.site,X,q))-1,qi.push(uf(p,q,D))-1,qi.push(uf(p,D,xt))-1,qi.push(uf(p,xt,X))-1)}}for(c=0;c<s;++c)(h=bo[c])&&(h.halfedges.length||delete bo[c])}var NR=[],wg;function T$(){sf(this),this.x=this.y=this.arc=this.site=this.cy=null}function zl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,c=e.site;if(o!==c){var h=s[0],p=s[1],g=o[0]-h,m=o[1]-p,_=c[0]-h,E=c[1]-p,x=2*(g*E-m*_);if(!(x>=-OR)){var b=g*g+m*m,P=_*_+E*E,I=(E*b-m*P)/x,S=(g*P-_*b)/x,w=NR.pop()||new T$;w.arc=n,w.site=s,w.x=I+h,w.y=(w.cy=S+p)+Math.sqrt(I*I+S*S),n.circle=w;for(var R=null,T=lf._;T;)if(w.y<T.y||w.y===T.y&&w.x<=T.x)if(T.L)T=T.L;else{R=T.P;break}else if(T.R)T=T.R;else{R=T;break}lf.insert(R,w),R||(wg=w)}}}}function Gl(n){var t=n.circle;t&&(t.P||(wg=t.N),lf.remove(t),NR.push(t),sf(t),n.circle=null)}var FR=[];function C$(){sf(this),this.edge=this.site=this.circle=null}function DR(n){var t=FR.pop()||new C$;return t.site=n,t}function V_(n){Gl(n),kl.remove(n),FR.push(n),sf(n)}function UR(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],c=n.P,h=n.N,p=[n];V_(n);for(var g=c;g.circle&&Math.abs(e-g.circle.x)<xr&&Math.abs(o-g.circle.cy)<xr;)c=g.P,p.unshift(g),V_(g),g=c;p.unshift(g),Gl(g);for(var m=h;m.circle&&Math.abs(e-m.circle.x)<xr&&Math.abs(o-m.circle.cy)<xr;)h=m.N,p.push(m),V_(m),m=h;p.push(m),Gl(m);var _=p.length,E;for(E=1;E<_;++E)m=p[E],g=p[E-1],Eh(m.edge,g.site,m.site,s);g=p[0],m=p[_-1],m.edge=af(g.site,m.site,null,s),zl(g),zl(m)}function BR(n){for(var t=n[0],e=n[1],o,s,c,h,p=kl._;p;)if(c=zR(p,e)-t,c>xr)p=p.L;else if(h=t-P$(p,e),h>xr){if(!p.R){o=p;break}p=p.R}else{c>-xr?(o=p.P,s=p):h>-xr?(o=p,s=p.N):o=s=p;break}IR(n);var g=DR(n);if(kl.insert(o,g),!(!o&&!s)){if(o===s){Gl(o),s=DR(o.site),kl.insert(g,s),g.edge=s.edge=af(o.site,g.site),zl(o),zl(s);return}if(!s){g.edge=af(o.site,g.site);return}Gl(o),Gl(s);var m=o.site,_=m[0],E=m[1],x=n[0]-_,b=n[1]-E,P=s.site,I=P[0]-_,S=P[1]-E,w=2*(x*S-b*I),R=x*x+b*b,T=I*I+S*S,F=[(S*R-b*T)/w+_,(x*T-I*R)/w+E];Eh(s.edge,m,P,F),g.edge=af(m,n,null,F),s.edge=af(n,P,null,F),zl(o),zl(s)}}function zR(n,t){var e=n.site,o=e[0],s=e[1],c=s-t;if(!c)return o;var h=n.P;if(!h)return-1/0;e=h.site;var p=e[0],g=e[1],m=g-t;if(!m)return p;var _=p-o,E=1/c-1/m,x=_/m;return E?(-x+Math.sqrt(x*x-2*E*(_*_/(-2*m)-g+m/2+s-c/2)))/E+o:(o+p)/2}function P$(n,t){var e=n.N;if(e)return zR(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var xr=1e-6,OR=1e-12,kl,bo,lf,qi;function I$(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function R$(n,t){return t[1]-n[1]||t[0]-n[0]}function Sg(n,t){var e=n.sort(R$).pop(),o,s,c;for(qi=[],bo=new Array(n.length),kl=new q_,lf=new q_;;)if(c=wg,e&&(!c||e[1]<c.y||e[1]===c.y&&e[0]<c.x))(e[0]!==o||e[1]!==s)&&(BR(e),o=e[0],s=e[1]),e=n.pop();else if(c)UR(c.arc);else break;if(RR(),t){var h=+t[0][0],p=+t[0][1],g=+t[1][0],m=+t[1][1];PR(h,p,g,m),LR(h,p,g,m)}this.edges=qi,this.cells=bo,kl=lf=qi=bo=null}Sg.prototype={constructor:Sg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return H_(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(p=(c=e.halfedges).length)for(var s=e.site,c,h=-1,p,g,m=t[c[p-1]],_=m.left===s?m.right:m.left;++h<p;)g=_,m=t[c[h]],_=m.left===s?m.right:m.left,g&&_&&o<g.index&&o<_.index&&I$(s,g,_)<0&&n.push([s.data,g.data,_.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,c=o._found||0,h=o.cells.length,p;!(p=o.cells[c]);)if(++c>=h)return null;var g=n-p.site[0],m=t-p.site[1],_=g*g+m*m;do p=o.cells[s=c],c=null,p.halfedges.forEach(function(E){var x=o.edges[E],b=x.left;if(!((b===p.site||!b)&&!(b=x.right))){var P=n-b[0],I=t-b[1],S=P*P+I*I;S<_&&(_=S,c=b.index)}});while(c!==null);return o._found=s,e==null||_<=e*e?p.site:null}};var z$=on(cf(),1);var o1=on(HR(),1);function $o(){return new Ag}function Ag(){this.reset()}Ag.prototype={constructor:Ag,reset:function(){this.s=this.t=0},add:function(n){VR(bg,n,this.t),VR(this,bg.s,this.s),this.s?this.t+=bg.t:this.s=bg.t},valueOf:function(){return this.s}};var bg=new Ag;function VR(n,t,e){var o=n.s=t+e,s=o-t,c=o-s;n.t=t-c+(e-s)}var er=1e-6;var gr=Math.PI,wi=gr/2,Tg=gr/4,Na=gr*2,ql=180/gr,Zo=gr/180,$r=Math.abs,ia=Math.atan,Jo=Math.atan2,Vn=Math.cos;var Cg=Math.exp;var wh=Math.log;var sn=Math.sin;var eo=Math.sqrt,Sh=Math.tan;function Y_(n){return n>1?0:n<-1?gr:Math.acos(n)}function Ao(n){return n>1?wi:n<-1?-wi:Math.asin(n)}function oa(){}var G$=$o(),ift=$o();function Hl(n){var t=n[0],e=n[1],o=Vn(e);return[o*Vn(t),o*sn(t),sn(e)]}function Mh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function bh(n){var t=eo(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var dft=$o();function XR(n,t){return[n>gr?n-Na:n<-gr?n+Na:n,t]}XR.invert=XR;function $_(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:oa,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Z_(n,t){return $r(n[0]-t[0])<er&&$r(n[1]-t[1])<er}function Pg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function J_(n,t,e,o,s){var c=[],h=[],p,g;if(n.forEach(function(P){if(!((I=P.length-1)<=0)){var I,S=P[0],w=P[I],R;if(Z_(S,w)){for(s.lineStart(),p=0;p<I;++p)s.point((S=P[p])[0],S[1]);s.lineEnd();return}c.push(R=new Pg(S,P,null,!0)),h.push(R.o=new Pg(S,null,R,!1)),c.push(R=new Pg(w,P,null,!1)),h.push(R.o=new Pg(w,null,R,!0))}}),!!c.length){for(h.sort(t),YR(c),YR(h),p=0,g=h.length;p<g;++p)h[p].e=e=!e;for(var m=c[0],_,E;;){for(var x=m,b=!0;x.v;)if((x=x.n)===m)return;_=x.z,s.lineStart();do{if(x.v=x.o.v=!0,x.e){if(b)for(p=0,g=_.length;p<g;++p)s.point((E=_[p])[0],E[1]);else o(x.x,x.n.x,1,s);x=x.n}else{if(b)for(_=x.p.z,p=_.length-1;p>=0;--p)s.point((E=_[p])[0],E[1]);else o(x.x,x.p.x,-1,s);x=x.p}x=x.o,_=x.z,b=!b}while(!x.v);s.lineEnd()}}}function YR(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function el(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function K_(n){return n.length===1&&(n=H$(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)<0?o=c+1:s=c}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)>0?s=c:o=c+1}return o}}}function H$(n){return function(t,e){return el(n(t),e)}}var $R=K_(el),V$=$R.right,W$=$R.left;var ZR=Array.prototype,Y$=ZR.slice,$$=ZR.map;var sht=Math.sqrt(50),aht=Math.sqrt(10),uht=Math.sqrt(2);function Rg(n){for(var t=n.length,e,o=-1,s=0,c,h;++o<t;)s+=n[o].length;for(c=new Array(s);--t>=0;)for(h=n[t],e=h.length;--e>=0;)c[--s]=h[e];return c}var nZ=1e9,Wpt=-nZ;var j_=$o();function Q_(n,t){var e=t[0],o=t[1],s=[sn(e),-Vn(e),0],c=0,h=0;j_.reset();for(var p=0,g=n.length;p<g;++p)if(_=(m=n[p]).length)for(var m,_,E=m[_-1],x=E[0],b=E[1]/2+Tg,P=sn(b),I=Vn(b),S=0;S<_;++S,x=R,P=F,I=W,E=w){var w=m[S],R=w[0],T=w[1]/2+Tg,F=sn(T),W=Vn(T),X=R-x,q=X>=0?1:-1,D=q*X,xt=D>gr,B=P*F;if(j_.add(Jo(B*q*sn(D),I*W+B*Vn(D))),c+=xt?X+q*Na:X,xt^x>=e^R>=e){var j=Mh(Hl(E),Hl(w));bh(j);var J=Mh(s,j);bh(J);var Dt=(xt^X>=0?-1:1)*Ao(J[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(h+=xt^X>=0?1:-1)}}return(c<-er||c<er&&j_<-er)^h&1}var edt=$o();var xdt=$o(),Edt=$o();var oZ=1/0;var Mdt=-oZ;function t1(n){this._context=n}t1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Na);break}}},result:oa};var Odt=$o();function e1(){this._string=[]}e1.prototype={_radius:4.5,_circle:jR(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=jR(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function jR(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function n1(n,t,e,o){return function(s,c){var h=t(c),p=s.invert(o[0],o[1]),g=$_(),m=t(g),_=!1,E,x,b,P={point:I,lineStart:w,lineEnd:R,polygonStart:function(){P.point=T,P.lineStart=F,P.lineEnd=W,x=[],E=[]},polygonEnd:function(){P.point=I,P.lineStart=w,P.lineEnd=R,x=Rg(x);var X=Q_(E,p);x.length?(_||(c.polygonStart(),_=!0),J_(x,uZ,X,e,c)):X&&(_||(c.polygonStart(),_=!0),c.lineStart(),e(null,null,1,c),c.lineEnd()),_&&(c.polygonEnd(),_=!1),x=E=null},sphere:function(){c.polygonStart(),c.lineStart(),e(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function I(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&c.point(X,q)}function S(X,q){var D=s(X,q);h.point(D[0],D[1])}function w(){P.point=S,h.lineStart()}function R(){P.point=I,h.lineEnd()}function T(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function W(){T(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,J;if(b.pop(),E.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(_||(c.polygonStart(),_=!0),c.lineStart(),D=0;D<B;++D)c.point((J=j[D])[0],J[1]);c.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),x.push(q.filter(aZ))}}return P}}function aZ(n){return n.length>1}function uZ(n,t){return((n=n.x)[0]<0?n[1]-wi-er:wi-n[1])-((t=t.x)[0]<0?t[1]-wi-er:wi-t[1])}var lZ=n1(function(){return!0},cZ,hZ,[-gr,-wi]);function cZ(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(c,h){var p=c>0?gr:-gr,g=$r(c-t);$r(g-gr)<er?(n.point(t,e=(e+h)/2>0?wi:-wi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(p,e),n.point(c,e),s=0):o!==p&&g>=gr&&($r(t-o)<er&&(t-=o*er),$r(c-p)<er&&(c-=p*er),e=fZ(t,e,c,h),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(p,e),s=0),n.point(t=c,e=h),o=p},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function fZ(n,t,e,o){var s,c,h=sn(n-e);return $r(h)>er?ia((sn(t)*(c=Vn(o))*sn(e)-sn(o)*(s=Vn(t))*sn(n))/(s*c*h)):(t+o)/2}function hZ(n,t,e,o){var s;if(n==null)s=e*wi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if($r(n[0]-t[0])>er){var c=n[0]<t[0]?gr:-gr;s=e*c/2,o.point(-c,s),o.point(0,s),o.point(c,s)}else o.point(t[0],t[1])}function Lg(n){return function(t){var e=new r1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function r1(){}r1.prototype={constructor:r1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Egt=Vn(30*Zo);var Dgt=Lg({point:function(n,t){this.stream.point(n*Zo,t*Zo)}});function Ng(n){return function(t,e){var o=Vn(t),s=Vn(e),c=n(o*s);return[c*s*sn(t),c*sn(e)]}}function Oa(n){return function(t,e){var o=eo(t*t+e*e),s=n(o),c=sn(s),h=Vn(s);return[Jo(t*c,o*h),Ao(o&&e*c/o)]}}var oL=Ng(function(n){return eo(2/(1+n))});oL.invert=Oa(function(n){return 2*Ao(n/2)});var sL=Ng(function(n){return(n=Y_(n))&&n/sn(n)});sL.invert=Oa(function(n){return n});function i1(n,t){return[n,wh(Sh((wi+t)/2))]}i1.invert=function(n,t){return[n,2*ia(Cg(t))-wi]};function Og(n,t){return[n,t]}Og.invert=Og;function aL(n,t){var e=Vn(t),o=Vn(n)*e;return[e*sn(n)/o,sn(t)/o]}aL.invert=Oa(ia);function uL(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}uL.invert=function(n,t){var e=t,o=25,s;do{var c=e*e,h=c*c;e-=s=(e*(1.007226+c*(.015085+h*(-.044475+.028874*c-.005916*h)))-t)/(1.007226+c*(.015085*3+h*(-.044475*7+.028874*9*c-.005916*11*h)))}while($r(s)>er&&--o>0);return[n/(.8707+(c=e*e)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),e]};function lL(n,t){return[Vn(t)*sn(n),sn(t)]}lL.invert=Oa(Ao);function cL(n,t){var e=Vn(t),o=1+Vn(n)*e;return[e*sn(n)/o,sn(t)/o]}cL.invert=Oa(function(n){return 2*ia(n)});function fL(n,t){return[wh(Sh((wi+t)/2)),-n]}fL.invert=function(n,t){return[-t,2*ia(Cg(n))-wi]};var vZ=on(cf(),1);var _Z=on(cf(),1);var EZ=on(cf(),1);var wZ=on(cf(),1);function Dg(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function pL(n){let t=0;for(let e=0;e<n.length-1;e++)t+=Dg(n[e],n[e+1]);return t}var Fs=on(dL(),1);var $n="___",Fg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(c){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(c){s=[]}return Iu({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+$n+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+$n+e,s=this.nodeMap.get(o);if(!s)return null;let c=this.pointMap.get(s);return c!=null?c:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(c=>{(c.points||[]).filter(h=>h.openStatus!==!1).filter(h=>{if(!h.startTime||!h.endTime)return!0;let[p,g]=h.startTime.split(":").map(b=>+b),[m,_]=h.endTime.split(":").map(b=>+b),E=p*60+g,x=m*60+_;return s>=E&&s<=x}).forEach(h=>{h.floor=c.floor;let p=""+c.floor+$n+h.id;if(this.nodeMap.set(""+c.floor+$n+h.nodeId,""+c.floor+$n+(h.relatedId||h.id)),this.pointMap.set(p,h),this.isFacilityByType(h.type)){let g=this.facilities.find(m=>m.id===+h.targetId);if(g){switch(g.entry_infra_type){case"straightLadder":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.straightLadderMap.get(h.targetId)||[];x.push(Iu({},h)),this.straightLadderMap.set(h.targetId,x)}break;case"staircase":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.staircaseMap.get(h.targetId)||[];x.push(Iu({},h)),this.staircaseMap.set(h.targetId,x)}break;case"escalator":let _=this.escalatorMap.get(h.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=h:_.push({start:h})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=h:_.push({end:h})}this.escalatorMap.set(h.targetId,_);break;case"ramp":let E=this.rampMap.get(h.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=E.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=h:E.push({start:h})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=E.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=h:E.push({end:h})}this.rampMap.set(h.targetId,E);break;case"connectionPoint":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.connectionPointMap.get(h.targetId)||[];x.push(Iu({},h)),this.connectionPointMap.set(h.targetId,x)}break}let m=this.facilityMap.get(h.targetId)||[];m.push(Iu({},h)),this.facilityMap.set(h.targetId,m)}}h.type==="parkingSpace"&&this.parkingMap.set(""+c.floor+$n+h.name,h)}),(c.lines||[]).filter(h=>h.to!==h.from).forEach(h=>{let p=""+c.floor+$n+h.from,g=""+c.floor+$n+h.to,m=this.pointMap.get(p),_=this.pointMap.get(g);if(!m||!_)return;let E=m.cds,x=_.cds,b=Dg(E,x);if(!m.permission&&!_.permission){switch(this.addLineItem(p,g,b),this.addLineItem(g,p,b),h.direction){case"double":this.addLineItem(p,g,b,this.forwardLineMap),this.addLineItem(g,p,b,this.forwardLineMap);break;case"single":this.addLineItem(p,g,b,this.forwardLineMap);break;case"back":this.addLineItem(g,p,b,this.forwardLineMap);break}(m.type==="parkingSpace"||_.type==="parkingSpace")&&h.direction==="noDir"&&(this.addLineItem(p,g,b,this.forwardLineMap),this.addLineItem(g,p,b,this.forwardLineMap))}else m.permission&&(this.setPermissionLine(p,g,m.permission,b,""),this.setPermissionLine(g,p,m.permission,b,"")),_.permission&&_.permission!==m.permission&&(this.setPermissionLine(p,g,_.permission,b,""),this.setPermissionLine(g,p,_.permission,b,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,c){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:c})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"straightLadder"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"staircase"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&(h.permission&&this.setPermissionLine(s,c,h.permission,1,"escalator"),p.permission&&p.permission!==h.permission&&this.setPermissionLine(s,c,p.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&(h.permission&&this.setPermissionLine(s,c,h.permission,10,"ramp"),p.permission&&p.permission!==h.permission&&this.setPermissionLine(s,c,p.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"connectionPoint"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,o,s){let c=this.getPermissionMap(t);console.log(c),c.forEach(h=>{e.includes(h.type)&&(h.type===""?this.addLineItem(h.fromKey,h.toKey,h.distance,o):this.addLineItem(h.fromKey,h.toKey,s.get(h.type),o))})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let c=s.get(t)||new Map;c.set(e,o),s.set(t,c)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(c=>{let[h,p]=c;if(!(p.length<2))for(let g=0;g<p.length;g++){let m=""+p[g].floor+$n+p[g].id,_=this.pointMap.get(m);if(!(!_||_.permission)){for(let E=0;E<p.length;E++)if(g!==E){let x=""+p[E].floor+$n+p[E].id,b=this.pointMap.get(x);if(!b||b.permission)continue;if(p[g].type==="straightLadder"){let P=e;this.addLineItem(m,x,P,s)}else{let P=o;this.addLineItem(m,x,P,s)}}}}}),this.escalatorMap.forEach((c,h)=>{c.forEach(p=>{if(p.start&&p.end){let g=""+p.start.floor+$n+p.start.id,m=""+p.end.floor+$n+p.end.id,_=this.pointMap.get(g),E=this.pointMap.get(m);if(_&&E&&!_.permission&&!E.permission){let x=t;this.addLineItem(g,m,x,s)}}})}),this.connectionPointMap.forEach((c,h)=>{if(!(c.length<2))for(let p=0;p<c.length;p++){let g=""+c[p].floor+$n+c[p].id,m=this.pointMap.get(g);if(!(!m||m.permission)){for(let _=0;_<c.length;_++)if(p!==_){let E=""+c[_].floor+$n+c[_].id,x=this.pointMap.get(E);if(!x||x.permission)continue;this.addLineItem(g,E,100,s)}}}})}initBaseRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new no.default(t)}initEscalatorRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new no.default(t)}initStraightLadderRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new no.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&!h.permission&&!p.permission&&this.addLineItem(s,c,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(!(!c||c.permission)){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g||g.permission)continue;this.addLineItem(s,p,100,this.forwardLineMap)}}}}),this.forwardRoute=new no.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e){var o;if(t.nodeId){let s=this.nodeMap.get(""+t.floor+$n+t.nodeId);if(s){let[c,h]=s.split($n);return{floor:c,id:h}}}if((o=t.coord)!=null&&o.length){let s=this.roadInfo.find(h=>h.floor===t.floor);if(!s)return null;let c=s.points.reduce((h,p)=>{if(p.relatedId)return h;let g=""+p.floor+$n+p.id;if(e==="forward"){if(!this.forwardLineMap.has(g))return h}else if(!this.lineMap.has(g))return h;let m=Dg(t.coord,p.cds);return m<h.min&&(h.min=m,h.point=p),h},{min:1/0,point:s.points[0]});return{floor:s.floor,id:c.point.id}}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+$n+t.parkingSpace);if(s)return{floor:t.floor,id:s.id}}let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(c=>+c.type_id==+t.facility).map(c=>c.id).map(c=>this.facilityMap.get(""+c)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,c){if(o===void 0&&(o=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let h=this.transformStart(t,o);if(!h)return"no-start";let p=this.transformEnd(e,o);if(!p)return"no-end";let g;switch(o){case"escalator":g=this.getEscalatorPath.bind(this);break;case"straightLadder":g=this.getStraightLadderPath.bind(this);break;case"forward":g=this.getForwardPath.bind(this);break;default:g=this.getBasePath.bind(this);break}if(p.id)return g(h,p,s,c);if(p.facility){let _=this.facilities.filter(x=>+x.type_id==+e.facility).map(x=>x.id).map(x=>this.facilityMap.get(""+x)).flat(2).filter(x=>x).filter(x=>p.floor?x.floor===p.floor:!0);if(!_.length)return null;let E=_.map(x=>g(h,{floor:x.floor,id:x.id},s,c)).filter(x=>!!x);return E.reduce((x,b)=>{let P=b[0].consume;return P<x.distance&&(x.distance=P,x.path=b),x},{distance:1/0,path:E[0]}).path}}getRoutePath(t,e,o){let s=""+t.floor+$n+t.id,c=""+e.floor+$n+e.id,h=o.path(s,c);if(!h)return null;let p=[],g=h.reduce((m,_,E,x)=>{if(E===0)return 0;let b=x[E-1],P=o.graph.get(b).get(_);return m+P},0);return h.map(m=>{let _=this.pointMap.get(m);if(_){var E;let{floor:x}=_,b=_.type;if(this.isFacilityByType(_.type)){let P=this.facilities.find(I=>I.id===+_.targetId);P&&(b=P.entry_infra_type)}if(((E=p[p.length-1])==null?void 0:E.floor)===x){let P=p[p.length-1];P.points.push(_.cds),P.pointInfos.push(_),P.endType=b,P.destId=_.nodeId,P.distance=pL(P.points)}else p.push({floor:x,points:[_.cds],pointInfos:[_],endType:b,destId:_.nodeId,distance:0,consume:g})}}),p}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let s=(0,Fs.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let c=new no.default(s);return this.getRoutePath(t,e,c)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let s=(0,Fs.cloneDeep)(this.escalatorRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",1*c],["connectionPoint",100],["straightLadder",this.lift_priority*c],["staircase",3e4*c]]));let h=new no.default(s);return this.getRoutePath(t,e,h)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let s=(0,Fs.cloneDeep)(this.straightLadderRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*c],["connectionPoint",100],["straightLadder",1*c],["staircase",3e4*c]]));let h=new no.default(s);return this.getRoutePath(t,e,h)}getForwardPath(t,e,o,s){let c=new Map,h=x=>{let b=this.forwardRoute.graph.get(g);x.forEach(P=>{let I=b.get(P);(0,Fs.isNil)(I)||(c.set(P,I),b.delete(P))})},p=()=>{let x=this.forwardRoute.graph.get(g);c.forEach((b,P)=>{x.set(P,b)})},g=""+t.floor+$n+t.id;if(!(0,Fs.isNil)(s)){let x=this.forwardLineMap.get(g),b=this.pointMap.get(g);if(b&&(x!=null&&x.size)&&x.size>1){let P=new Yn(b.cds[0],b.cds[1]),I=new Map;x.forEach((w,R)=>{let T=this.pointMap.get(R);if(T){let F=new Yn(T.cds[0],T.cds[1]),X=360-(new Yn().subVectors(F,P).angle()/Math.PI*180-90+360)%360;I.set(R,X)}});let S=Array.from(I).filter(w=>{let[R,T]=w;return Math.abs(T-s)<=60}).map(w=>{let[R]=w;return R});if(S.length)S.forEach(w=>I.delete(w)),h([...I.keys()]);else{let w=Array.from(I).reduce((R,T)=>{let F=Math.abs(T[1]-s);return F<R.diff?{diff:F,key:T[0]}:R},{diff:1/0,key:""});I.delete(w.key),h([...I.keys()])}}}if(!o){let x=this.getRoutePath(t,e,this.forwardRoute);return p(),x||this.getRoutePath(t,e,this.forwardRoute)}let m=(0,Fs.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],m,new Map([["ramp",10]]));let _=new no.default(m),E=this.getRoutePath(t,e,_);if(p(),E)return E;{let x=(0,Fs.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],x,new Map([["ramp",10]]));let b=new no.default(x);return this.getRoutePath(t,e,b)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new no.default,this.escalatorRoute=new no.default,this.straightLadderRoute=new no.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new no.default,this.escalatorRoute=new no.default,this.straightLadderRoute=new no.default,this.forwardLineMap=new Map,this.forwardRoute=new no.default}};var lxt=on(kL(),1),cxt=on(Fp(),1);function qL(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function HL(n){let t={};for(let o in n)o.startsWith("on")&&(t[qL(o.slice(2))]=n[o]);let e=o=>ec(this,null,function*(){let{data:s}=o;if(t[s.type])try{let c=yield t[s.type](s.data);self.postMessage({type:""+s.type+"_result",key:s.key,data:c})}catch(c){self.postMessage({type:""+s.type+"_result",key:s.key,error:c})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var sa=new Fg,VL,yJ=new Promise(n=>{VL=n});function WL(n,t,e){let{floor:o,coord:s}=n,c=null;return(t||[]).forEach(h=>{let p=sa.getPath({floor:o,coord:s},{floor:h.floor,parkingSpace:h.lot_id},"forward",0,e);if(!p||typeof p=="string")return;let g={floor:h.floor,spaceNo:h.lot_id,distance:p[0].consume};c||(c=g),c.distance>g.distance&&(c=g)}),c}function vJ(n,t,e,o,s){let c=WL({floor:n,coord:t},e[n],s);return c||_J(n,t,e,o,s)}function _J(n,t,e,o,s){let c=o.indexOf(n);c===-1&&(c=o.length);let h=1,p=null;for(;h<=o.length;){if(o.filter((m,_)=>_===c-1||_===c+1).forEach(m=>{let _=WL({floor:n,coord:t},e[m],s);p?_&&p.distance>_.distance&&(p=_):p=_}),p)return p;h++}return p}function xJ(n,t,e,o,s){let c=p1(n,t,t.floor,e,s);if(c)return c;let h=p1(n,t,n.floor,e,s);return h||EJ(n,t,n.floor,e,o,s)}function p1(n,t,e,o,s){let c=o[e]||[];if(!c.length)return null;let h=null;return c.forEach(p=>{let g={floor:p.floor,parkingSpace:p.lot_id},m=sa.getPath(n,g,"forward",0,s);if(!m||typeof m=="string")return;let _=sa.getParkingSpaceInfo(p.floor,p.lot_id);if(!_)return;let E=sa.getPath({floor:p.floor,coord:_.cds},t,"",0);if(!E||typeof E=="string")return;let x={floor:p.floor,spaceNo:p.lot_id,distance:E[0].consume};h?h.distance>x.distance&&(h=x):h=x}),h}function EJ(n,t,e,o,s,c){let h=s.indexOf(e);h===-1&&(h=s.length);let p=1,g=null;for(;p<=s.length;){if(s.filter((_,E)=>E===h-1||E===h+1).forEach(_=>{let E=p1(n,t,_,o,c);g?E&&g.distance>E.distance&&(g=E):g=E}),g)return g;p++}return g}function wJ(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=sa.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}return null}function SJ(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=sa.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}if(n.parkingSpace){let t=sa.getParkingSpaceInfo(n.floor,n.parkingSpace);if(t)return{floor:t.floor,coord:t.cds}}return null}HL({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;sa.initRoute(t,e),VL(!0)},onGetPath(n){let{start:t,end:e,type:o,permission:s,travelDirection:c}=n;return sa.getPath(t,e,o,s,c)},onRecommend(n){return ec(this,null,function*(){let{start:t,end:e,travelDirection:o,carLotStatus:s}=n;yield yJ;let c=s.reduce((m,_)=>(m[_.floor]?m[_.floor].push(_):m[_.floor]=[_],m),{}),h=sa.roadInfo.map(m=>m.floor),p=wJ(t);if(!p)return null;let g=e?SJ(e):null;return g?xJ(p,g,c,h,o):vJ(p.floor,p.coord,c,h,o)})},onClear(){sa.clear()}});
|
|
11570
|
-
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var $9={placeId:0,catLotStatusApi:"https://nav.aibee.cn/aether-walker/parking/cat-lot-status"},Dh=class{setRoadData(t,e){return xt(this.worker,"set_road_data",{roadData:t,facilities:e})}recommend(t){return j(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(n=>n.json()).then(n=>n.data.filter(i=>i.status===0));return xt(this.worker,"recommend",w({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=Eh(),this.options=w({},$9,t)}};var Xh=class extends za{showMyPosition(t,e){let n=this.getGraphicByNodeId(t);if(n){let i=new nr(this.context,{autoUpdate:!0,appendToBody:!0});i.div.appendChild(e),i.bindElement(n),this.myPositionOverlay=i}}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40]}),t.map(i=>this.getPoiById(i)).filter(i=>!!i).forEach(i=>{var o;(o=i.userData).restore||(o.restore={});for(let u in e)if(u in i.options){var s,a;(s=i.userData.restore)[a=u]||(s[a]=i.options[u]),i.options[u]=e[u]}})}restorePoi(t){t.map(n=>this.getPoiById(n)).filter(n=>!!n).forEach(n=>{console.log("poi.userData.restore",n.userData.restore);for(let i in n.userData.restore)i in n.options&&(n.options[i]=n.userData.restore[i]);n.userData.restore={}})}dispose(){this.hideMyPosition(),super.dispose()}constructor(...t){super(...t),this.myPositionOverlay=null}};return QT(tO);})();
|
|
11570
|
+
`],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var $9={placeId:0,catLotStatusApi:"https://nav.aibee.cn/aether-walker/parking/cat-lot-status"},Dh=class{setRoadData(t,e){return xt(this.worker,"set_road_data",{roadData:t,facilities:e})}recommend(t){return j(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(n=>n.json()).then(n=>n.data.filter(i=>i.status===0));return xt(this.worker,"recommend",w({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=Eh(),this.options=w({},$9,t)}};var Xh=class extends za{showMyPosition(t,e){let n=this.getGraphicByNodeId(t);if(n){let i=new nr(this.context,{autoUpdate:!0,appendToBody:!0});i.div.appendChild(e),i.bindElement(n),this.myPositionOverlay=i}}hideMyPosition(){this.myPositionOverlay&&(this.myPositionOverlay.dispose(),this.myPositionOverlay=null)}highlightPoi(t,e){e===void 0&&(e={icon_size:[40,40],collision_enable:!1}),t.map(i=>this.getPoiById(i)).filter(i=>!!i).forEach(i=>{var o;(o=i.userData).restore||(o.restore={});for(let u in e)if(u in i.options){var s,a;(s=i.userData.restore)[a=u]||(s[a]=i.options[u]),i.options[u]=e[u]}})}restorePoi(t){t.map(n=>this.getPoiById(n)).filter(n=>!!n).forEach(n=>{console.log("poi.userData.restore",n.userData.restore);for(let i in n.userData.restore)i in n.options&&(n.options[i]=n.userData.restore[i]);n.userData.restore={}})}dispose(){this.hideMyPosition(),super.dispose()}constructor(...t){super(...t),this.myPositionOverlay=null}};return QT(tO);})();
|