mobility-toolbox-js 2.1.0 → 2.2.0-beta.0

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/mbt.min.js CHANGED
@@ -1072,7 +1072,7 @@ uniform ${se} ${fe} u_${xe};
1072
1072
  `),yt=X.createShader(X.FRAGMENT_SHADER);if(X.isContextLost())return void(this.failedToCreate=!0);X.shaderSource(yt,ht),X.compileShader(yt),X.attachShader(this.program,yt);let pt=X.createShader(X.VERTEX_SHADER);if(X.isContextLost())return void(this.failedToCreate=!0);X.shaderSource(pt,Ge),X.compileShader(pt),X.attachShader(this.program,pt),this.attributes={};let vt={};this.numAttributes=fe.length;for(let St=0;St<this.numAttributes;St++)fe[St]&&(X.bindAttribLocation(this.program,St,fe[St]),this.attributes[fe[St]]=St);X.linkProgram(this.program),X.deleteShader(pt),X.deleteShader(yt);for(let St=0;St<Qe.length;St++){let kt=Qe[St];if(kt&&!vt[kt]){let xt=X.getUniformLocation(this.program,kt);xt&&(vt[kt]=xt)}}this.fixedUniforms=P(r,vt),this.terrainUniforms=((St,kt)=>({u_depth:new l.Uniform1i(St,kt.u_depth),u_terrain:new l.Uniform1i(St,kt.u_terrain),u_terrain_dim:new l.Uniform1f(St,kt.u_terrain_dim),u_terrain_matrix:new l.UniformMatrix4f(St,kt.u_terrain_matrix),u_terrain_unpack:new l.Uniform4f(St,kt.u_terrain_unpack),u_terrain_offset:new l.Uniform1f(St,kt.u_terrain_offset),u_terrain_exaggeration:new l.Uniform1f(St,kt.u_terrain_exaggeration)}))(r,vt),this.binderUniforms=E?E.getUniforms(r,vt):[]}draw(r,d,x,E,P,U,G,X,Y,se,fe,xe,je,Le,Ue,Qe,at,ht){let Ge=r.gl;if(this.failedToCreate)return;if(r.program.set(this.program),r.setDepthMode(x),r.setStencilMode(E),r.setColorMode(P),r.setCullFace(U),X){r.activeTexture.set(Ge.TEXTURE2),Ge.bindTexture(Ge.TEXTURE_2D,X.depthTexture),r.activeTexture.set(Ge.TEXTURE3),Ge.bindTexture(Ge.TEXTURE_2D,X.texture);for(let pt in this.terrainUniforms)this.terrainUniforms[pt].set(X[pt])}for(let pt in this.fixedUniforms)this.fixedUniforms[pt].set(G[pt]);Ue&&Ue.setUniforms(r,this.binderUniforms,je,{zoom:Le});let yt=0;switch(d){case Ge.LINES:yt=2;break;case Ge.TRIANGLES:yt=3;break;case Ge.LINE_STRIP:yt=1}for(let pt of xe.get()){let vt=pt.vaos||(pt.vaos={});(vt[Y]||(vt[Y]=new Ms)).bind(r,this,se,Ue?Ue.getPaintVertexBuffers():[],fe,pt.vertexOffset,Qe,at,ht),Ge.drawElements(d,pt.primitiveLength*yt,Ge.UNSIGNED_SHORT,pt.primitiveOffset*yt*2)}}}function Xn(S,r,d){let x=1/ie(d,1,r.transform.tileZoom),E=Math.pow(2,d.tileID.overscaledZ),P=d.tileSize*Math.pow(2,r.transform.tileZoom)/E,U=P*(d.tileID.canonical.x+d.tileID.wrap*E),G=P*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[x,S.fromScale,S.toScale],u_fade:S.t,u_pixel_coord_upper:[U>>16,G>>16],u_pixel_coord_lower:[65535&U,65535&G]}}let gn=(S,r,d,x)=>{let E=r.style.light,P=E.properties.get("position"),U=[P.x,P.y,P.z],G=l.create$1();E.properties.get("anchor")==="viewport"&&l.fromRotation(G,-r.transform.angle),l.transformMat3(U,U,G);let X=E.properties.get("color");return{u_matrix:S,u_lightpos:U,u_lightintensity:E.properties.get("intensity"),u_lightcolor:[X.r,X.g,X.b],u_vertical_gradient:+d,u_opacity:x}},$o=(S,r,d,x,E,P,U)=>l.extend(gn(S,r,d,x),Xn(P,r,U),{u_height_factor:-Math.pow(2,E.overscaledZ)/U.tileSize/8}),br=S=>({u_matrix:S}),Lo=(S,r,d,x)=>l.extend(br(S),Xn(d,r,x)),Eo=(S,r)=>({u_matrix:S,u_world:r}),Ru=(S,r,d,x,E)=>l.extend(Lo(S,r,d,x),{u_world:E}),zo=(S,r,d,x)=>{let E=S.transform,P,U;if(x.paint.get("circle-pitch-alignment")==="map"){let G=ie(d,1,E.zoom);P=!0,U=[G,G]}else P=!1,U=E.pixelsToGLUnits;return{u_camera_to_center_distance:E.cameraToCenterDistance,u_scale_with_map:+(x.paint.get("circle-pitch-scale")==="map"),u_matrix:S.translatePosMatrix(r.posMatrix,d,x.paint.get("circle-translate"),x.paint.get("circle-translate-anchor")),u_pitch_with_map:+P,u_device_pixel_ratio:S.pixelRatio,u_extrude_scale:U}},Ps=(S,r,d)=>{let x=ie(d,1,r.zoom),E=Math.pow(2,r.zoom-d.tileID.overscaledZ),P=d.tileID.overscaleFactor();return{u_matrix:S,u_camera_to_center_distance:r.cameraToCenterDistance,u_pixels_to_tile_units:x,u_extrude_scale:[r.pixelsToGLUnits[0]/(x*E),r.pixelsToGLUnits[1]/(x*E)],u_overscale_factor:P}},Do=(S,r,d=1)=>({u_matrix:S,u_color:r,u_overlay:0,u_overlay_scale:d}),an=S=>({u_matrix:S}),Fo=(S,r,d,x)=>({u_matrix:S,u_extrude_scale:ie(r,1,d),u_intensity:x});function Pn(S,r){let d=Math.pow(2,r.canonical.z),x=r.canonical.y;return[new l.MercatorCoordinate(0,x/d).toLngLat().lat,new l.MercatorCoordinate(0,(x+1)/d).toLngLat().lat]}let Ko=(S,r,d,x)=>{let E=S.transform;return{u_matrix:el(S,r,d,x),u_ratio:1/ie(r,1,E.zoom),u_device_pixel_ratio:S.pixelRatio,u_units_to_pixels:[1/E.pixelsToGLUnits[0],1/E.pixelsToGLUnits[1]]}},Lu=(S,r,d,x,E)=>l.extend(Ko(S,r,d,E),{u_image:0,u_image_height:x}),Kl=(S,r,d,x,E)=>{let P=S.transform,U=$r(r,P);return{u_matrix:el(S,r,d,E),u_texsize:r.imageAtlasTexture.size,u_ratio:1/ie(r,1,P.zoom),u_device_pixel_ratio:S.pixelRatio,u_image:0,u_scale:[U,x.fromScale,x.toScale],u_fade:x.t,u_units_to_pixels:[1/P.pixelsToGLUnits[0],1/P.pixelsToGLUnits[1]]}},ks=(S,r,d,x,E,P)=>{let U=S.lineAtlas,G=$r(r,S.transform),X=d.layout.get("line-cap")==="round",Y=U.getDash(x.from,X),se=U.getDash(x.to,X),fe=Y.width*E.fromScale,xe=se.width*E.toScale;return l.extend(Ko(S,r,d,P),{u_patternscale_a:[G/fe,-Y.height/2],u_patternscale_b:[G/xe,-se.height/2],u_sdfgamma:U.width/(256*Math.min(fe,xe)*S.pixelRatio)/2,u_image:0,u_tex_y_a:Y.y,u_tex_y_b:se.y,u_mix:E.t})};function $r(S,r){return 1/ie(S,1,r.tileZoom)}function el(S,r,d,x){return S.translatePosMatrix(x?x.posMatrix:r.tileID.posMatrix,r,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}let xc=(S,r,d,x,E)=>{return{u_matrix:S,u_tl_parent:r,u_scale_parent:d,u_buffer_scale:1,u_fade_t:x.mix,u_opacity:x.opacity*E.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:E.paint.get("raster-brightness-min"),u_brightness_high:E.paint.get("raster-brightness-max"),u_saturation_factor:(U=E.paint.get("raster-saturation"),U>0?1-1/(1.001-U):-U),u_contrast_factor:(P=E.paint.get("raster-contrast"),P>0?1/(1-P):1+P),u_spin_weights:zu(E.paint.get("raster-hue-rotate"))};var P,U};function zu(S){S*=Math.PI/180;let r=Math.sin(S),d=Math.cos(S);return[(2*d+1)/3,(-Math.sqrt(3)*r-d+1)/3,(Math.sqrt(3)*r-d+1)/3]}let Hl=(S,r,d,x,E,P,U,G,X,Y)=>{let se=E.transform;return{u_is_size_zoom_constant:+(S==="constant"||S==="source"),u_is_size_feature_constant:+(S==="constant"||S==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:se.cameraToCenterDistance,u_pitch:se.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:se.width/se.height,u_fade_change:E.options.fadeDuration?E.symbolFadeChange:1,u_matrix:P,u_label_plane_matrix:U,u_coord_matrix:G,u_is_text:+X,u_pitch_with_map:+x,u_texsize:Y,u_texture:0}},Oa=(S,r,d,x,E,P,U,G,X,Y,se)=>{let fe=E.transform;return l.extend(Hl(S,r,d,x,E,P,U,G,X,Y),{u_gamma_scale:x?Math.cos(fe._pitch)*fe.cameraToCenterDistance:1,u_device_pixel_ratio:E.pixelRatio,u_is_halo:+se})},Yl=(S,r,d,x,E,P,U,G,X,Y)=>l.extend(Oa(S,r,d,x,E,P,U,G,!0,X,!0),{u_texsize_icon:Y,u_texture_icon:1}),El=(S,r,d)=>({u_matrix:S,u_opacity:r,u_color:d}),bc=(S,r,d,x,E,P)=>l.extend(function(U,G,X,Y){let se=X.imageManager.getPattern(U.from.toString()),fe=X.imageManager.getPattern(U.to.toString()),{width:xe,height:je}=X.imageManager.getPixelSize(),Le=Math.pow(2,Y.tileID.overscaledZ),Ue=Y.tileSize*Math.pow(2,X.transform.tileZoom)/Le,Qe=Ue*(Y.tileID.canonical.x+Y.tileID.wrap*Le),at=Ue*Y.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:se.tl,u_pattern_br_a:se.br,u_pattern_tl_b:fe.tl,u_pattern_br_b:fe.br,u_texsize:[xe,je],u_mix:G.t,u_pattern_size_a:se.displaySize,u_pattern_size_b:fe.displaySize,u_scale_a:G.fromScale,u_scale_b:G.toScale,u_tile_units_to_pixels:1/ie(Y,1,X.transform.tileZoom),u_pixel_coord_upper:[Qe>>16,at>>16],u_pixel_coord_lower:[65535&Qe,65535&at]}}(x,P,d,E),{u_matrix:S,u_opacity:r}),tl={fillExtrusion:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_lightpos:new l.Uniform3f(S,r.u_lightpos),u_lightintensity:new l.Uniform1f(S,r.u_lightintensity),u_lightcolor:new l.Uniform3f(S,r.u_lightcolor),u_vertical_gradient:new l.Uniform1f(S,r.u_vertical_gradient),u_opacity:new l.Uniform1f(S,r.u_opacity)}),fillExtrusionPattern:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_lightpos:new l.Uniform3f(S,r.u_lightpos),u_lightintensity:new l.Uniform1f(S,r.u_lightintensity),u_lightcolor:new l.Uniform3f(S,r.u_lightcolor),u_vertical_gradient:new l.Uniform1f(S,r.u_vertical_gradient),u_height_factor:new l.Uniform1f(S,r.u_height_factor),u_image:new l.Uniform1i(S,r.u_image),u_texsize:new l.Uniform2f(S,r.u_texsize),u_pixel_coord_upper:new l.Uniform2f(S,r.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(S,r.u_pixel_coord_lower),u_scale:new l.Uniform3f(S,r.u_scale),u_fade:new l.Uniform1f(S,r.u_fade),u_opacity:new l.Uniform1f(S,r.u_opacity)}),fill:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix)}),fillPattern:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_image:new l.Uniform1i(S,r.u_image),u_texsize:new l.Uniform2f(S,r.u_texsize),u_pixel_coord_upper:new l.Uniform2f(S,r.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(S,r.u_pixel_coord_lower),u_scale:new l.Uniform3f(S,r.u_scale),u_fade:new l.Uniform1f(S,r.u_fade)}),fillOutline:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_world:new l.Uniform2f(S,r.u_world)}),fillOutlinePattern:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_world:new l.Uniform2f(S,r.u_world),u_image:new l.Uniform1i(S,r.u_image),u_texsize:new l.Uniform2f(S,r.u_texsize),u_pixel_coord_upper:new l.Uniform2f(S,r.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(S,r.u_pixel_coord_lower),u_scale:new l.Uniform3f(S,r.u_scale),u_fade:new l.Uniform1f(S,r.u_fade)}),circle:(S,r)=>({u_camera_to_center_distance:new l.Uniform1f(S,r.u_camera_to_center_distance),u_scale_with_map:new l.Uniform1i(S,r.u_scale_with_map),u_pitch_with_map:new l.Uniform1i(S,r.u_pitch_with_map),u_extrude_scale:new l.Uniform2f(S,r.u_extrude_scale),u_device_pixel_ratio:new l.Uniform1f(S,r.u_device_pixel_ratio),u_matrix:new l.UniformMatrix4f(S,r.u_matrix)}),collisionBox:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_camera_to_center_distance:new l.Uniform1f(S,r.u_camera_to_center_distance),u_pixels_to_tile_units:new l.Uniform1f(S,r.u_pixels_to_tile_units),u_extrude_scale:new l.Uniform2f(S,r.u_extrude_scale),u_overscale_factor:new l.Uniform1f(S,r.u_overscale_factor)}),collisionCircle:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_inv_matrix:new l.UniformMatrix4f(S,r.u_inv_matrix),u_camera_to_center_distance:new l.Uniform1f(S,r.u_camera_to_center_distance),u_viewport_size:new l.Uniform2f(S,r.u_viewport_size)}),debug:(S,r)=>({u_color:new l.UniformColor(S,r.u_color),u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_overlay:new l.Uniform1i(S,r.u_overlay),u_overlay_scale:new l.Uniform1f(S,r.u_overlay_scale)}),clippingMask:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix)}),heatmap:(S,r)=>({u_extrude_scale:new l.Uniform1f(S,r.u_extrude_scale),u_intensity:new l.Uniform1f(S,r.u_intensity),u_matrix:new l.UniformMatrix4f(S,r.u_matrix)}),heatmapTexture:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_world:new l.Uniform2f(S,r.u_world),u_image:new l.Uniform1i(S,r.u_image),u_color_ramp:new l.Uniform1i(S,r.u_color_ramp),u_opacity:new l.Uniform1f(S,r.u_opacity)}),hillshade:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_image:new l.Uniform1i(S,r.u_image),u_latrange:new l.Uniform2f(S,r.u_latrange),u_light:new l.Uniform2f(S,r.u_light),u_shadow:new l.UniformColor(S,r.u_shadow),u_highlight:new l.UniformColor(S,r.u_highlight),u_accent:new l.UniformColor(S,r.u_accent)}),hillshadePrepare:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_image:new l.Uniform1i(S,r.u_image),u_dimension:new l.Uniform2f(S,r.u_dimension),u_zoom:new l.Uniform1f(S,r.u_zoom),u_unpack:new l.Uniform4f(S,r.u_unpack)}),line:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_ratio:new l.Uniform1f(S,r.u_ratio),u_device_pixel_ratio:new l.Uniform1f(S,r.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(S,r.u_units_to_pixels)}),lineGradient:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_ratio:new l.Uniform1f(S,r.u_ratio),u_device_pixel_ratio:new l.Uniform1f(S,r.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(S,r.u_units_to_pixels),u_image:new l.Uniform1i(S,r.u_image),u_image_height:new l.Uniform1f(S,r.u_image_height)}),linePattern:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_texsize:new l.Uniform2f(S,r.u_texsize),u_ratio:new l.Uniform1f(S,r.u_ratio),u_device_pixel_ratio:new l.Uniform1f(S,r.u_device_pixel_ratio),u_image:new l.Uniform1i(S,r.u_image),u_units_to_pixels:new l.Uniform2f(S,r.u_units_to_pixels),u_scale:new l.Uniform3f(S,r.u_scale),u_fade:new l.Uniform1f(S,r.u_fade)}),lineSDF:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_ratio:new l.Uniform1f(S,r.u_ratio),u_device_pixel_ratio:new l.Uniform1f(S,r.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(S,r.u_units_to_pixels),u_patternscale_a:new l.Uniform2f(S,r.u_patternscale_a),u_patternscale_b:new l.Uniform2f(S,r.u_patternscale_b),u_sdfgamma:new l.Uniform1f(S,r.u_sdfgamma),u_image:new l.Uniform1i(S,r.u_image),u_tex_y_a:new l.Uniform1f(S,r.u_tex_y_a),u_tex_y_b:new l.Uniform1f(S,r.u_tex_y_b),u_mix:new l.Uniform1f(S,r.u_mix)}),raster:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_tl_parent:new l.Uniform2f(S,r.u_tl_parent),u_scale_parent:new l.Uniform1f(S,r.u_scale_parent),u_buffer_scale:new l.Uniform1f(S,r.u_buffer_scale),u_fade_t:new l.Uniform1f(S,r.u_fade_t),u_opacity:new l.Uniform1f(S,r.u_opacity),u_image0:new l.Uniform1i(S,r.u_image0),u_image1:new l.Uniform1i(S,r.u_image1),u_brightness_low:new l.Uniform1f(S,r.u_brightness_low),u_brightness_high:new l.Uniform1f(S,r.u_brightness_high),u_saturation_factor:new l.Uniform1f(S,r.u_saturation_factor),u_contrast_factor:new l.Uniform1f(S,r.u_contrast_factor),u_spin_weights:new l.Uniform3f(S,r.u_spin_weights)}),symbolIcon:(S,r)=>({u_is_size_zoom_constant:new l.Uniform1i(S,r.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(S,r.u_is_size_feature_constant),u_size_t:new l.Uniform1f(S,r.u_size_t),u_size:new l.Uniform1f(S,r.u_size),u_camera_to_center_distance:new l.Uniform1f(S,r.u_camera_to_center_distance),u_pitch:new l.Uniform1f(S,r.u_pitch),u_rotate_symbol:new l.Uniform1i(S,r.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(S,r.u_aspect_ratio),u_fade_change:new l.Uniform1f(S,r.u_fade_change),u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(S,r.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(S,r.u_coord_matrix),u_is_text:new l.Uniform1i(S,r.u_is_text),u_pitch_with_map:new l.Uniform1i(S,r.u_pitch_with_map),u_texsize:new l.Uniform2f(S,r.u_texsize),u_texture:new l.Uniform1i(S,r.u_texture)}),symbolSDF:(S,r)=>({u_is_size_zoom_constant:new l.Uniform1i(S,r.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(S,r.u_is_size_feature_constant),u_size_t:new l.Uniform1f(S,r.u_size_t),u_size:new l.Uniform1f(S,r.u_size),u_camera_to_center_distance:new l.Uniform1f(S,r.u_camera_to_center_distance),u_pitch:new l.Uniform1f(S,r.u_pitch),u_rotate_symbol:new l.Uniform1i(S,r.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(S,r.u_aspect_ratio),u_fade_change:new l.Uniform1f(S,r.u_fade_change),u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(S,r.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(S,r.u_coord_matrix),u_is_text:new l.Uniform1i(S,r.u_is_text),u_pitch_with_map:new l.Uniform1i(S,r.u_pitch_with_map),u_texsize:new l.Uniform2f(S,r.u_texsize),u_texture:new l.Uniform1i(S,r.u_texture),u_gamma_scale:new l.Uniform1f(S,r.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(S,r.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(S,r.u_is_halo)}),symbolTextAndIcon:(S,r)=>({u_is_size_zoom_constant:new l.Uniform1i(S,r.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(S,r.u_is_size_feature_constant),u_size_t:new l.Uniform1f(S,r.u_size_t),u_size:new l.Uniform1f(S,r.u_size),u_camera_to_center_distance:new l.Uniform1f(S,r.u_camera_to_center_distance),u_pitch:new l.Uniform1f(S,r.u_pitch),u_rotate_symbol:new l.Uniform1i(S,r.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(S,r.u_aspect_ratio),u_fade_change:new l.Uniform1f(S,r.u_fade_change),u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(S,r.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(S,r.u_coord_matrix),u_is_text:new l.Uniform1i(S,r.u_is_text),u_pitch_with_map:new l.Uniform1i(S,r.u_pitch_with_map),u_texsize:new l.Uniform2f(S,r.u_texsize),u_texsize_icon:new l.Uniform2f(S,r.u_texsize_icon),u_texture:new l.Uniform1i(S,r.u_texture),u_texture_icon:new l.Uniform1i(S,r.u_texture_icon),u_gamma_scale:new l.Uniform1f(S,r.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(S,r.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(S,r.u_is_halo)}),background:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_opacity:new l.Uniform1f(S,r.u_opacity),u_color:new l.UniformColor(S,r.u_color)}),backgroundPattern:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_opacity:new l.Uniform1f(S,r.u_opacity),u_image:new l.Uniform1i(S,r.u_image),u_pattern_tl_a:new l.Uniform2f(S,r.u_pattern_tl_a),u_pattern_br_a:new l.Uniform2f(S,r.u_pattern_br_a),u_pattern_tl_b:new l.Uniform2f(S,r.u_pattern_tl_b),u_pattern_br_b:new l.Uniform2f(S,r.u_pattern_br_b),u_texsize:new l.Uniform2f(S,r.u_texsize),u_mix:new l.Uniform1f(S,r.u_mix),u_pattern_size_a:new l.Uniform2f(S,r.u_pattern_size_a),u_pattern_size_b:new l.Uniform2f(S,r.u_pattern_size_b),u_scale_a:new l.Uniform1f(S,r.u_scale_a),u_scale_b:new l.Uniform1f(S,r.u_scale_b),u_pixel_coord_upper:new l.Uniform2f(S,r.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(S,r.u_pixel_coord_lower),u_tile_units_to_pixels:new l.Uniform1f(S,r.u_tile_units_to_pixels)}),terrain:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_texture:new l.Uniform1i(S,r.u_texture)}),terrainDepth:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix)}),terrainCoords:(S,r)=>({u_matrix:new l.UniformMatrix4f(S,r.u_matrix),u_texture:new l.Uniform1i(S,r.u_texture),u_terrain_coords_id:new l.Uniform1f(S,r.u_terrain_coords_id)})};class To{constructor(r,d,x){this.context=r;let E=r.gl;this.buffer=E.createBuffer(),this.dynamicDraw=!!x,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),E.bufferData(E.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?E.DYNAMIC_DRAW:E.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){let d=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Sa={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ea{constructor(r,d,x,E){this.length=d.length,this.attributes=x,this.itemSize=d.bytesPerElement,this.dynamicDraw=E,this.context=r;let P=r.gl;this.buffer=P.createBuffer(),r.bindVertexBuffer.set(this.buffer),P.bufferData(P.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?P.DYNAMIC_DRAW:P.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){if(r.length!==this.length)throw new Error(`Length of new data is ${r.length}, which doesn't match current length of ${this.length}`);let d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,d){for(let x=0;x<this.attributes.length;x++){let E=d.attributes[this.attributes[x].name];E!==void 0&&r.enableVertexAttribArray(E)}}setVertexAttribPointers(r,d,x){for(let E=0;E<this.attributes.length;E++){let P=this.attributes[E],U=d.attributes[P.name];U!==void 0&&r.vertexAttribPointer(U,P.components,r[Sa[P.type]],!1,this.itemSize,P.offset+this.itemSize*(x||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class tr{constructor(r){this.gl=r.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(r){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Ba extends tr{getDefault(){return l.Color.transparent}set(r){let d=this.current;(r.r!==d.r||r.g!==d.g||r.b!==d.b||r.a!==d.a||this.dirty)&&(this.gl.clearColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class is extends tr{getDefault(){return 1}set(r){(r!==this.current||this.dirty)&&(this.gl.clearDepth(r),this.current=r,this.dirty=!1)}}class rs extends tr{getDefault(){return 0}set(r){(r!==this.current||this.dirty)&&(this.gl.clearStencil(r),this.current=r,this.dirty=!1)}}class On extends tr{getDefault(){return[!0,!0,!0,!0]}set(r){let d=this.current;(r[0]!==d[0]||r[1]!==d[1]||r[2]!==d[2]||r[3]!==d[3]||this.dirty)&&(this.gl.colorMask(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class sn extends tr{getDefault(){return!0}set(r){(r!==this.current||this.dirty)&&(this.gl.depthMask(r),this.current=r,this.dirty=!1)}}class Bn extends tr{getDefault(){return 255}set(r){(r!==this.current||this.dirty)&&(this.gl.stencilMask(r),this.current=r,this.dirty=!1)}}class Jl extends tr{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(r){let d=this.current;(r.func!==d.func||r.ref!==d.ref||r.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(r.func,r.ref,r.mask),this.current=r,this.dirty=!1)}}class Ql extends tr{getDefault(){let r=this.gl;return[r.KEEP,r.KEEP,r.KEEP]}set(r){let d=this.current;(r[0]!==d[0]||r[1]!==d[1]||r[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(r[0],r[1],r[2]),this.current=r,this.dirty=!1)}}class eu extends tr{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;r?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=r,this.dirty=!1}}class Tl extends tr{getDefault(){return[0,1]}set(r){let d=this.current;(r[0]!==d[0]||r[1]!==d[1]||this.dirty)&&(this.gl.depthRange(r[0],r[1]),this.current=r,this.dirty=!1)}}class Il extends tr{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;r?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=r,this.dirty=!1}}class il extends tr{getDefault(){return this.gl.LESS}set(r){(r!==this.current||this.dirty)&&(this.gl.depthFunc(r),this.current=r,this.dirty=!1)}}class Cl extends tr{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;r?d.enable(d.BLEND):d.disable(d.BLEND),this.current=r,this.dirty=!1}}class tu extends tr{getDefault(){let r=this.gl;return[r.ONE,r.ZERO]}set(r){let d=this.current;(r[0]!==d[0]||r[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(r[0],r[1]),this.current=r,this.dirty=!1)}}class Al extends tr{getDefault(){return l.Color.transparent}set(r){let d=this.current;(r.r!==d.r||r.g!==d.g||r.b!==d.b||r.a!==d.a||this.dirty)&&(this.gl.blendColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class wc extends tr{getDefault(){return this.gl.FUNC_ADD}set(r){(r!==this.current||this.dirty)&&(this.gl.blendEquation(r),this.current=r,this.dirty=!1)}}class rl extends tr{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;r?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=r,this.dirty=!1}}class Ta extends tr{getDefault(){return this.gl.BACK}set(r){(r!==this.current||this.dirty)&&(this.gl.cullFace(r),this.current=r,this.dirty=!1)}}class Sc extends tr{getDefault(){return this.gl.CCW}set(r){(r!==this.current||this.dirty)&&(this.gl.frontFace(r),this.current=r,this.dirty=!1)}}class Un extends tr{getDefault(){return null}set(r){(r!==this.current||this.dirty)&&(this.gl.useProgram(r),this.current=r,this.dirty=!1)}}class Du extends tr{getDefault(){return this.gl.TEXTURE0}set(r){(r!==this.current||this.dirty)&&(this.gl.activeTexture(r),this.current=r,this.dirty=!1)}}class ns extends tr{getDefault(){let r=this.gl;return[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}set(r){let d=this.current;(r[0]!==d[0]||r[1]!==d[1]||r[2]!==d[2]||r[3]!==d[3]||this.dirty)&&(this.gl.viewport(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class os extends tr{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,r),this.current=r,this.dirty=!1}}class Rs extends tr{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class Ua extends tr{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;d.bindTexture(d.TEXTURE_2D,r),this.current=r,this.dirty=!1}}class sa extends tr{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class Va extends tr{getDefault(){return null}set(r){let d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class Na extends tr{constructor(r){super(r),this.vao=r.extVertexArrayObject}getDefault(){return null}set(r){this.vao&&(r!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(r),this.current=r,this.dirty=!1)}}class Oo extends tr{getDefault(){return 4}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,r),this.current=r,this.dirty=!1}}class Fu extends tr{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this.current=r,this.dirty=!1}}class Ou extends tr{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;let d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,r),this.current=r,this.dirty=!1}}class lr extends tr{constructor(r,d){super(r),this.context=r,this.parent=d}getDefault(){return null}}class Ls extends lr{setDirty(){this.dirty=!0}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class Ml extends lr{set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class zs{constructor(r,d,x,E){this.context=r,this.width=d,this.height=x;let P=r.gl,U=this.framebuffer=P.createFramebuffer();if(this.colorAttachment=new Ls(r,U),E&&(this.depthAttachment=new Ml(r,U)),P.checkFramebufferStatus(P.FRAMEBUFFER)!==P.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let r=this.context.gl,d=this.colorAttachment.get();if(d&&r.deleteTexture(d),this.depthAttachment){let x=this.depthAttachment.get();x&&r.deleteRenderbuffer(x)}r.deleteFramebuffer(this.framebuffer)}}class Dr{constructor(r,d,x){this.blendFunction=r,this.blendColor=d,this.mask=x}}Dr.Replace=[1,0],Dr.disabled=new Dr(Dr.Replace,l.Color.transparent,[!1,!1,!1,!1]),Dr.unblended=new Dr(Dr.Replace,l.Color.transparent,[!0,!0,!0,!0]),Dr.alphaBlended=new Dr([1,771],l.Color.transparent,[!0,!0,!0,!0]);class Bu{constructor(r){this.gl=r,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Ba(this),this.clearDepth=new is(this),this.clearStencil=new rs(this),this.colorMask=new On(this),this.depthMask=new sn(this),this.stencilMask=new Bn(this),this.stencilFunc=new Jl(this),this.stencilOp=new Ql(this),this.stencilTest=new eu(this),this.depthRange=new Tl(this),this.depthTest=new Il(this),this.depthFunc=new il(this),this.blend=new Cl(this),this.blendFunc=new tu(this),this.blendColor=new Al(this),this.blendEquation=new wc(this),this.cullFace=new rl(this),this.cullFaceSide=new Ta(this),this.frontFace=new Sc(this),this.program=new Un(this),this.activeTexture=new Du(this),this.viewport=new ns(this),this.bindFramebuffer=new os(this),this.bindRenderbuffer=new Rs(this),this.bindTexture=new Ua(this),this.bindVertexBuffer=new sa(this),this.bindElementBuffer=new Va(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Na(this),this.pixelStoreUnpack=new Oo(this),this.pixelStoreUnpackPremultiplyAlpha=new Fu(this),this.pixelStoreUnpackFlipY=new Ou(this),this.extTextureFilterAnisotropic=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=r.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=r.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(r.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=r.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=r.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(r,d){return new To(this,r,d)}createVertexBuffer(r,d,x){return new Ea(this,r,d,x)}createRenderbuffer(r,d,x){let E=this.gl,P=E.createRenderbuffer();return this.bindRenderbuffer.set(P),E.renderbufferStorage(E.RENDERBUFFER,r,d,x),this.bindRenderbuffer.set(null),P}createFramebuffer(r,d,x){return new zs(this,r,d,x)}clear({color:r,depth:d}){let x=this.gl,E=0;r&&(E|=x.COLOR_BUFFER_BIT,this.clearColor.set(r),this.colorMask.set([!0,!0,!0,!0])),d!==void 0&&(E|=x.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(d),this.depthMask.set(!0)),x.clear(E)}setCullFace(r){r.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(r.mode),this.frontFace.set(r.frontFace))}setDepthMode(r){r.func!==this.gl.ALWAYS||r.mask?(this.depthTest.set(!0),this.depthFunc.set(r.func),this.depthMask.set(r.mask),this.depthRange.set(r.range)):this.depthTest.set(!1)}setStencilMode(r){r.test.func!==this.gl.ALWAYS||r.mask?(this.stencilTest.set(!0),this.stencilMask.set(r.mask),this.stencilOp.set([r.fail,r.depthFail,r.pass]),this.stencilFunc.set({func:r.test.func,ref:r.ref,mask:r.test.mask})):this.stencilTest.set(!1)}setColorMode(r){q(r.blendFunction,Dr.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor)),this.colorMask.set(r.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Qi{constructor(r,d,x){this.func=r,this.mask=d,this.range=x}}Qi.ReadOnly=!1,Qi.ReadWrite=!0,Qi.disabled=new Qi(519,Qi.ReadOnly,[0,1]);let ir=7680;class ur{constructor(r,d,x,E,P,U){this.test=r,this.ref=d,this.mask=x,this.fail=E,this.depthFail=P,this.pass=U}}ur.disabled=new ur({func:519,mask:0},0,0,ir,ir,ir);class xr{constructor(r,d,x){this.enable=r,this.mode=d,this.frontFace=x}}let nl;function Ds(S,r,d,x,E,P,U){let G=S.context,X=G.gl,Y=S.useProgram("collisionBox"),se=[],fe=0,xe=0;for(let Ge=0;Ge<x.length;Ge++){let yt=x[Ge],pt=r.getTile(yt),vt=pt.getBucket(d);if(!vt)continue;let St=yt.posMatrix;E[0]===0&&E[1]===0||(St=S.translatePosMatrix(yt.posMatrix,pt,E,P));let kt=U?vt.textCollisionBox:vt.iconCollisionBox,xt=vt.collisionCircleArray;if(xt.length>0){let ii=l.create(),h=St;l.mul(ii,vt.placementInvProjMatrix,S.transform.glCoordMatrix),l.mul(ii,ii,vt.placementViewportMatrix),se.push({circleArray:xt,circleOffset:xe,transform:h,invTransform:ii,coord:yt}),fe+=xt.length/4,xe=fe}kt&&Y.draw(G,X.LINES,Qi.disabled,ur.disabled,S.colorModeForRenderPass(),xr.disabled,Ps(St,S.transform,pt),S.style.terrain&&S.style.terrain.getTerrainData(yt),d.id,kt.layoutVertexBuffer,kt.indexBuffer,kt.segments,null,S.transform.zoom,null,null,kt.collisionVertexBuffer)}if(!U||!se.length)return;let je=S.useProgram("collisionCircle"),Le=new l.CollisionCircleLayoutArray;Le.resize(4*fe),Le._trim();let Ue=0;for(let Ge of se)for(let yt=0;yt<Ge.circleArray.length/4;yt++){let pt=4*yt,vt=Ge.circleArray[pt+0],St=Ge.circleArray[pt+1],kt=Ge.circleArray[pt+2],xt=Ge.circleArray[pt+3];Le.emplace(Ue++,vt,St,kt,xt,0),Le.emplace(Ue++,vt,St,kt,xt,1),Le.emplace(Ue++,vt,St,kt,xt,2),Le.emplace(Ue++,vt,St,kt,xt,3)}(!nl||nl.length<2*fe)&&(nl=function(Ge){let yt=2*Ge,pt=new l.QuadTriangleArray;pt.resize(yt),pt._trim();for(let vt=0;vt<yt;vt++){let St=6*vt;pt.uint16[St+0]=4*vt+0,pt.uint16[St+1]=4*vt+1,pt.uint16[St+2]=4*vt+2,pt.uint16[St+3]=4*vt+2,pt.uint16[St+4]=4*vt+3,pt.uint16[St+5]=4*vt+0}return pt}(fe));let Qe=G.createIndexBuffer(nl,!0),at=G.createVertexBuffer(Le,l.collisionCircleLayout.members,!0);for(let Ge of se){let yt={u_matrix:Ge.transform,u_inv_matrix:Ge.invTransform,u_camera_to_center_distance:(ht=S.transform).cameraToCenterDistance,u_viewport_size:[ht.width,ht.height]};je.draw(G,X.TRIANGLES,Qi.disabled,ur.disabled,S.colorModeForRenderPass(),xr.disabled,yt,S.style.terrain&&S.style.terrain.getTerrainData(Ge.coord),d.id,at,Qe,l.SegmentVector.simpleSegment(0,2*Ge.circleOffset,Ge.circleArray.length,Ge.circleArray.length/2),null,S.transform.zoom,null,null,null)}var ht;at.destroy(),Qe.destroy()}xr.disabled=new xr(!1,1029,2305),xr.backCCW=new xr(!0,1029,2305);let Uu=l.identity(new Float32Array(16));function Fs(S,r,d,x,E,P){let{horizontalAlign:U,verticalAlign:G}=l.getAnchorAlignment(S),X=-(U-.5)*r,Y=-(G-.5)*d,se=l.evaluateVariableOffset(S,x);return new l.pointGeometry((X/E+se[0])*P,(Y/E+se[1])*P)}function Vu(S,r,d,x,E,P,U,G,X,Y,se){let fe=S.text.placedSymbolArray,xe=S.text.dynamicLayoutVertexArray,je=S.icon.dynamicLayoutVertexArray,Le={};xe.clear();for(let Ue=0;Ue<fe.length;Ue++){let Qe=fe.get(Ue),at=S.allowVerticalPlacement&&!Qe.placedOrientation,ht=Qe.hidden||!Qe.crossTileID||at?null:x[Qe.crossTileID];if(ht){let Ge=new l.pointGeometry(Qe.anchorX,Qe.anchorY),yt=Hi(Ge,d?U:P,se),pt=bn(E.cameraToCenterDistance,yt.signedDistanceFromCamera),vt=l.evaluateSizeForFeature(S.textSizeData,X,Qe)*pt/l.ONE_EM;d&&(vt*=S.tilePixelRatio/G);let{width:St,height:kt,anchor:xt,textOffset:ii,textBoxScale:h}=ht,f=Fs(xt,St,kt,ii,h,vt),p=d?Hi(Ge.add(f),P,se).point:yt.point.add(r?f.rotate(-E.angle):f),_=S.allowVerticalPlacement&&Qe.placedOrientation===l.WritingMode.vertical?Math.PI/2:0;for(let I=0;I<Qe.numGlyphs;I++)l.addDynamicAttributes(xe,p,_);Y&&Qe.associatedIconIndex>=0&&(Le[Qe.associatedIconIndex]={shiftedAnchor:p,angle:_})}else bi(Qe.numGlyphs,xe)}if(Y){je.clear();let Ue=S.icon.placedSymbolArray;for(let Qe=0;Qe<Ue.length;Qe++){let at=Ue.get(Qe);if(at.hidden)bi(at.numGlyphs,je);else{let ht=Le[Qe];if(ht)for(let Ge=0;Ge<at.numGlyphs;Ge++)l.addDynamicAttributes(je,ht.shiftedAnchor,ht.angle);else bi(at.numGlyphs,je)}}S.icon.dynamicLayoutVertexBuffer.updateData(je)}S.text.dynamicLayoutVertexBuffer.updateData(xe)}function Os(S,r,d){return d.iconsInText&&r?"symbolTextAndIcon":S?"symbolSDF":"symbolIcon"}function Ia(S,r,d,x,E,P,U,G,X,Y,se,fe){let xe=S.context,je=xe.gl,Le=S.transform,Ue=G==="map",Qe=X==="map",at=G!=="viewport"&&d.layout.get("symbol-placement")!=="point",ht=Ue&&!Qe&&!at,Ge=!d.layout.get("symbol-sort-key").isConstant(),yt=!1,pt=S.depthModeForSublayer(0,Qi.ReadOnly),vt=d.layout.get("text-variable-anchor"),St=[];for(let kt of x){let xt=r.getTile(kt),ii=xt.getBucket(d);if(!ii)continue;let h=E?ii.text:ii.icon;if(!h||!h.segments.get().length)continue;let f=h.programConfigurations.get(d.id),p=E||ii.sdfIcons,_=E?ii.textSizeData:ii.iconSizeData,I=Qe||Le.pitch!==0,R=S.useProgram(Os(p,E,ii),f),F=l.evaluateSizeForZoom(_,Le.zoom),N=S.style.terrain&&S.style.terrain.getTerrainData(kt),K,ne,ye,be,Ee=[0,0],Be=null;if(E){if(ne=xt.glyphAtlasTexture,ye=je.LINEAR,K=xt.glyphAtlasTexture.size,ii.iconsInText){Ee=xt.imageAtlasTexture.size,Be=xt.imageAtlasTexture;let At=_.kind==="composite"||_.kind==="camera";be=I||S.options.rotating||S.options.zooming||At?je.LINEAR:je.NEAREST}}else{let At=d.layout.get("icon-size").constantOr(0)!==1||ii.iconsNeedLinear;ne=xt.imageAtlasTexture,ye=p||S.options.rotating||S.options.zooming||At||I?je.LINEAR:je.NEAREST,K=xt.imageAtlasTexture.size}let De=ie(xt,1,S.transform.zoom),Ze=eo(kt.posMatrix,Qe,Ue,S.transform,De),ke=Fn(kt.posMatrix,Qe,Ue,S.transform,De),We=vt&&ii.hasTextData(),Je=d.layout.get("icon-text-fit")!=="none"&&We&&ii.hasIconData();if(at){let At=S.style.terrain?(di,fi)=>S.style.terrain.getElevation(kt,di,fi):null,Xt=d.layout.get("text-rotation-alignment")==="map";mn(ii,kt.posMatrix,S,E,Ze,ke,Qe,Y,Xt,At)}let tt=S.translatePosMatrix(kt.posMatrix,xt,P,U),ot=at||E&&vt||Je?Uu:Ze,st=S.translatePosMatrix(ke,xt,P,U,!0),dt=p&&d.paint.get(E?"text-halo-width":"icon-halo-width").constantOr(1)!==0,wt;wt=p?ii.iconsInText?Yl(_.kind,F,ht,Qe,S,tt,ot,st,K,Ee):Oa(_.kind,F,ht,Qe,S,tt,ot,st,E,K,!0):Hl(_.kind,F,ht,Qe,S,tt,ot,st,E,K);let Et={program:R,buffers:h,uniformValues:wt,atlasTexture:ne,atlasTextureIcon:Be,atlasInterpolation:ye,atlasInterpolationIcon:be,isSDF:p,hasHalo:dt};if(Ge&&ii.canOverlap){yt=!0;let At=h.segments.get();for(let Xt of At)St.push({segments:new l.SegmentVector([Xt]),sortKey:Xt.sortKey,state:Et,terrainData:N})}else St.push({segments:h.segments,sortKey:0,state:Et,terrainData:N})}yt&&St.sort((kt,xt)=>kt.sortKey-xt.sortKey);for(let kt of St){let xt=kt.state;if(xe.activeTexture.set(je.TEXTURE0),xt.atlasTexture.bind(xt.atlasInterpolation,je.CLAMP_TO_EDGE),xt.atlasTextureIcon&&(xe.activeTexture.set(je.TEXTURE1),xt.atlasTextureIcon&&xt.atlasTextureIcon.bind(xt.atlasInterpolationIcon,je.CLAMP_TO_EDGE)),xt.isSDF){let ii=xt.uniformValues;xt.hasHalo&&(ii.u_is_halo=1,ol(xt.buffers,kt.segments,d,S,xt.program,pt,se,fe,ii,kt.terrainData)),ii.u_is_halo=0}ol(xt.buffers,kt.segments,d,S,xt.program,pt,se,fe,xt.uniformValues,kt.terrainData)}}function ol(S,r,d,x,E,P,U,G,X,Y){let se=x.context;E.draw(se,se.gl.TRIANGLES,P,U,G,xr.disabled,X,Y,d.id,S.layoutVertexBuffer,S.indexBuffer,r,d.paint,x.transform.zoom,S.programConfigurations.get(d.id),S.dynamicLayoutVertexBuffer,S.opacityVertexBuffer)}function ja(S,r,d,x,E,P,U){let G=S.context.gl,X=d.paint.get("fill-pattern"),Y=X&&X.constantOr(1),se=d.getCrossfadeParameters(),fe,xe,je,Le,Ue;U?(xe=Y&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",fe=G.LINES):(xe=Y?"fillPattern":"fill",fe=G.TRIANGLES);for(let Qe of x){let at=r.getTile(Qe);if(Y&&!at.patternsLoaded())continue;let ht=at.getBucket(d);if(!ht)continue;let Ge=ht.programConfigurations.get(d.id),yt=S.useProgram(xe,Ge),pt=S.style.terrain&&S.style.terrain.getTerrainData(Qe);Y&&(S.context.activeTexture.set(G.TEXTURE0),at.imageAtlasTexture.bind(G.LINEAR,G.CLAMP_TO_EDGE),Ge.updatePaintBuffers(se));let vt=X.constantOr(null);if(vt&&at.imageAtlas){let xt=at.imageAtlas,ii=xt.patternPositions[vt.to.toString()],h=xt.patternPositions[vt.from.toString()];ii&&h&&Ge.setConstantPatternPositions(ii,h)}let St=pt?Qe:null,kt=S.translatePosMatrix(St?St.posMatrix:Qe.posMatrix,at,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(U){Le=ht.indexBuffer2,Ue=ht.segments2;let xt=[G.drawingBufferWidth,G.drawingBufferHeight];je=xe==="fillOutlinePattern"&&Y?Ru(kt,S,se,at,xt):Eo(kt,xt)}else Le=ht.indexBuffer,Ue=ht.segments,je=Y?Lo(kt,S,se,at):br(kt);yt.draw(S.context,fe,E,S.stencilModeForClipping(Qe),P,xr.disabled,je,pt,d.id,ht.layoutVertexBuffer,Le,Ue,d.paint,S.transform.zoom,Ge)}}function dr(S,r,d,x,E,P,U){let G=S.context,X=G.gl,Y=d.paint.get("fill-extrusion-pattern"),se=Y.constantOr(1),fe=d.getCrossfadeParameters(),xe=d.paint.get("fill-extrusion-opacity");for(let je of x){let Le=r.getTile(je),Ue=Le.getBucket(d);if(!Ue)continue;let Qe=S.style.terrain&&S.style.terrain.getTerrainData(je),at=Ue.programConfigurations.get(d.id),ht=S.useProgram(se?"fillExtrusionPattern":"fillExtrusion",at);se&&(S.context.activeTexture.set(X.TEXTURE0),Le.imageAtlasTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE),at.updatePaintBuffers(fe));let Ge=Y.constantOr(null);if(Ge&&Le.imageAtlas){let St=Le.imageAtlas,kt=St.patternPositions[Ge.to.toString()],xt=St.patternPositions[Ge.from.toString()];kt&&xt&&at.setConstantPatternPositions(kt,xt)}let yt=S.translatePosMatrix(je.posMatrix,Le,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),pt=d.paint.get("fill-extrusion-vertical-gradient"),vt=se?$o(yt,S,pt,xe,je,fe,Le):gn(yt,S,pt,xe);ht.draw(G,G.gl.TRIANGLES,E,P,U,xr.backCCW,vt,Qe,d.id,Ue.layoutVertexBuffer,Ue.indexBuffer,Ue.segments,d.paint,S.transform.zoom,at,S.style.terrain&&Ue.centroidVertexBuffer)}}function al(S,r,d,x,E,P,U){let G=S.context,X=G.gl,Y=d.fbo;if(!Y)return;let se=S.useProgram("hillshade"),fe=S.style.terrain&&S.style.terrain.getTerrainData(r);G.activeTexture.set(X.TEXTURE0),X.bindTexture(X.TEXTURE_2D,Y.colorAttachment.get()),se.draw(G,X.TRIANGLES,E,P,U,xr.disabled,((xe,je,Le,Ue)=>{let Qe=Le.paint.get("hillshade-shadow-color"),at=Le.paint.get("hillshade-highlight-color"),ht=Le.paint.get("hillshade-accent-color"),Ge=Le.paint.get("hillshade-illumination-direction")*(Math.PI/180);Le.paint.get("hillshade-illumination-anchor")==="viewport"&&(Ge-=xe.transform.angle);let yt=!xe.options.moving;return{u_matrix:Ue?Ue.posMatrix:xe.transform.calculatePosMatrix(je.tileID.toUnwrapped(),yt),u_image:0,u_latrange:Pn(0,je.tileID),u_light:[Le.paint.get("hillshade-exaggeration"),Ge],u_shadow:Qe,u_highlight:at,u_accent:ht}})(S,d,x,fe?r:null),fe,x.id,S.rasterBoundsBuffer,S.quadTriangleIndexBuffer,S.rasterBoundsSegments)}function Ec(S,r,d,x,E,P){let U=S.context,G=U.gl,X=r.dem;if(X&&X.data){let Y=X.dim,se=X.stride,fe=X.getPixels();if(U.activeTexture.set(G.TEXTURE1),U.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||S.getTileTexture(se),r.demTexture){let je=r.demTexture;je.update(fe,{premultiply:!1}),je.bind(G.NEAREST,G.CLAMP_TO_EDGE)}else r.demTexture=new Ie(U,fe,G.RGBA,{premultiply:!1}),r.demTexture.bind(G.NEAREST,G.CLAMP_TO_EDGE);U.activeTexture.set(G.TEXTURE0);let xe=r.fbo;if(!xe){let je=new Ie(U,{width:Y,height:Y,data:null},G.RGBA);je.bind(G.LINEAR,G.CLAMP_TO_EDGE),xe=r.fbo=U.createFramebuffer(Y,Y,!0),xe.colorAttachment.set(je.texture)}U.bindFramebuffer.set(xe.framebuffer),U.viewport.set([0,0,Y,Y]),S.useProgram("hillshadePrepare").draw(U,G.TRIANGLES,x,E,P,xr.disabled,((je,Le)=>{let Ue=Le.stride,Qe=l.create();return l.ortho(Qe,0,l.EXTENT,-l.EXTENT,0,0,1),l.translate(Qe,Qe,[0,-l.EXTENT,0]),{u_matrix:Qe,u_image:1,u_dimension:[Ue,Ue],u_zoom:je.overscaledZ,u_unpack:Le.getUnpackVector()}})(r.tileID,X),null,d.id,S.rasterBoundsBuffer,S.quadTriangleIndexBuffer,S.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function Ga(S,r,d,x,E,P){let U=x.paint.get("raster-fade-duration");if(!P&&U>0){let G=l.exported.now(),X=(G-S.timeAdded)/U,Y=r?(G-r.timeAdded)/U:-1,se=d.getSource(),fe=E.coveringZoomLevel({tileSize:se.tileSize,roundZoom:se.roundZoom}),xe=!r||Math.abs(r.tileID.overscaledZ-fe)>Math.abs(S.tileID.overscaledZ-fe),je=xe&&S.refreshedUponExpiration?1:l.clamp(xe?X:1-Y,0,1);return S.refreshedUponExpiration&&X>=1&&(S.refreshedUponExpiration=!1),r?{opacity:1,mix:1-je}:{opacity:je,mix:0}}return{opacity:1,mix:0}}let Pl=new l.Color(1,0,0,1),la=new l.Color(0,1,0,1),Nu=new l.Color(0,0,1,1),sl=new l.Color(1,0,1,1),Bs=new l.Color(0,1,1,1);function ua(S,r,d,x){Ca(S,0,r+d/2,S.transform.width,d,x)}function as(S,r,d,x){Ca(S,r-d/2,0,d,S.transform.height,x)}function Ca(S,r,d,x,E,P){let U=S.context,G=U.gl;G.enable(G.SCISSOR_TEST),G.scissor(r*S.pixelRatio,d*S.pixelRatio,x*S.pixelRatio,E*S.pixelRatio),U.clear({color:P}),G.disable(G.SCISSOR_TEST)}function ll(S,r,d){let x=S.context,E=x.gl,P=d.posMatrix,U=S.useProgram("debug"),G=Qi.disabled,X=ur.disabled,Y=S.colorModeForRenderPass(),se="$debug",fe=S.style.terrain&&S.style.terrain.getTerrainData(d);x.activeTexture.set(E.TEXTURE0),S.emptyTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE);let xe=r.getTileByID(d.key).latestRawTileData,je=Math.floor((xe&&xe.byteLength||0)/1024),Le=r.getTile(d).tileSize,Ue=512/Math.min(Le,512)*(d.overscaledZ/S.transform.zoom)*.5,Qe=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(Qe+=` => ${d.overscaledZ}`),function(at,ht){at.initDebugOverlayCanvas();let Ge=at.debugOverlayCanvas,yt=at.context.gl,pt=at.debugOverlayCanvas.getContext("2d");pt.clearRect(0,0,Ge.width,Ge.height),pt.shadowColor="white",pt.shadowBlur=2,pt.lineWidth=1.5,pt.strokeStyle="white",pt.textBaseline="top",pt.font="bold 36px Open Sans, sans-serif",pt.fillText(ht,5,5),pt.strokeText(ht,5,5),at.debugOverlayTexture.update(Ge),at.debugOverlayTexture.bind(yt.LINEAR,yt.CLAMP_TO_EDGE)}(S,`${Qe} ${je}kB`),U.draw(x,E.TRIANGLES,G,X,Dr.alphaBlended,xr.disabled,Do(P,l.Color.transparent,Ue),null,se,S.debugBuffer,S.quadTriangleIndexBuffer,S.debugSegments),U.draw(x,E.LINE_STRIP,G,X,Y,xr.disabled,Do(P,l.Color.red),fe,se,S.debugBuffer,S.tileBorderIndexBuffer,S.debugSegments)}function kl(S,r,d){let x=S.context,E=x.gl,P=S.colorModeForRenderPass(),U=new Qi(E.LEQUAL,Qi.ReadWrite,S.depthRangeFor3D),G=S.useProgram("terrain"),X=r.getTerrainMesh(),Y=r.getTerrainData(d.tileID);x.bindFramebuffer.set(null),x.viewport.set([0,0,S.width,S.height]),x.activeTexture.set(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,r.getRTTFramebuffer().colorAttachment.get());let se=S.transform.calculatePosMatrix(d.tileID.toUnwrapped());G.draw(x,E.TRIANGLES,U,ur.disabled,P,xr.backCCW,{u_matrix:se,u_texture:0},Y,"terrain",X.vertexBuffer,X.indexBuffer,X.segments)}function Us(S,r,d,x){let E=S.context,P=d.tileSize*r.qualityFactor;d.textures[x]||(d.textures[x]=S.getTileTexture(P)||new Ie(E,{width:P,height:P,data:null},E.gl.RGBA),d.textures[x].bind(E.gl.LINEAR,E.gl.CLAMP_TO_EDGE),x===0&&r.sourceCache.renderHistory.unshift(d.tileID.key));let U=r.getRTTFramebuffer();U.colorAttachment.set(d.textures[x].texture),E.bindFramebuffer.set(U.framebuffer),E.viewport.set([0,0,P,P])}class Ho{constructor(r){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=r,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=r.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){let r=this.painter.style,d=r.terrain;for(let x in r.sourceCaches){this._coordsDescendingInv[x]={};let E=r.sourceCaches[x].getVisibleCoordinates();for(let P of E){let U=d.sourceCache.getTerrainCoords(P);for(let G in U)this._coordsDescendingInv[x][G]||(this._coordsDescendingInv[x][G]=[]),this._coordsDescendingInv[x][G].push(U[G])}}for(let x of r._order){let E=r._layers[x],P=E.source;if(this._renderToTexture[E.type]&&!this._coordsDescendingInvStr[P]){this._coordsDescendingInvStr[P]={};for(let U in this._coordsDescendingInv[P])this._coordsDescendingInvStr[P][U]=this._coordsDescendingInv[P][U].map(G=>G.key).sort().join()}}return this._renderableTiles.forEach(x=>{for(let E in this._coordsDescendingInvStr){let P=this._coordsDescendingInvStr[E][x.tileID.key];P&&P!==x.textureCoords[E]&&x.clearTextures(this.painter),d.needsRerender(E,x.tileID)&&x.clearTextures(this.painter)}this._rerender[x.tileID.key]=!x.textures.length}),d.clearRerenderCache(),d.sourceCache.removeOutdated(this.painter),this}renderLayer(r){let d=r.type,x=this.painter,E=x.style._order,P=x.currentLayer,U=P+1===E.length;if(this._renderToTexture[d]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(E[P]),!U))return!0;if(this._renderToTexture[this._prevType]||d==="hillshade"||this._renderToTexture[d]&&U){this._prevType=d;let G=this._stacks.length-1,X=this._stacks[G]||[];for(let Y of this._renderableTiles){if(Us(x,x.style.terrain,Y,G),this._rerender[Y.tileID.key]){x.context.clear({color:l.Color.transparent});for(let se=0;se<X.length;se++){let fe=x.style._layers[X[se]],xe=fe.source?this._coordsDescendingInv[fe.source][Y.tileID.key]:[Y.tileID];x._renderTileClippingMasks(fe,xe),x.renderLayer(x,x.style.sourceCaches[fe.source],fe,xe),fe.source&&(Y.textureCoords[fe.source]=this._coordsDescendingInvStr[fe.source][Y.tileID.key])}}kl(x,x.style.terrain,Y)}if(d==="hillshade"){this._stacks.push([E[P]]);for(let Y of this._renderableTiles){let se=this._coordsDescendingInv[r.source][Y.tileID.key];Us(x,x.style.terrain,Y,this._stacks.length-1),x.context.clear({color:l.Color.transparent}),x._renderTileClippingMasks(r,se),x.renderLayer(x,x.style.sourceCaches[r.source],r,se),kl(x,x.style.terrain,Y)}return!0}return this._renderToTexture[d]}return!1}}let ul={symbol:function(S,r,d,x,E){if(S.renderPass!=="translucent")return;let P=ur.disabled,U=S.colorModeForRenderPass();d.layout.get("text-variable-anchor")&&function(G,X,Y,se,fe,xe,je){let Le=X.transform,Ue=fe==="map",Qe=xe==="map";for(let at of G){let ht=se.getTile(at),Ge=ht.getBucket(Y);if(!Ge||!Ge.text||!Ge.text.segments.get().length)continue;let yt=l.evaluateSizeForZoom(Ge.textSizeData,Le.zoom),pt=ie(ht,1,X.transform.zoom),vt=eo(at.posMatrix,Qe,Ue,X.transform,pt),St=Y.layout.get("icon-text-fit")!=="none"&&Ge.hasIconData();if(yt){let kt=Math.pow(2,Le.zoom-ht.tileID.overscaledZ);Vu(Ge,Ue,Qe,je,Le,vt,at.posMatrix,kt,yt,St,X.style.terrain?(xt,ii)=>X.style.terrain.getElevation(at,xt,ii):null)}}}(x,S,d,r,d.layout.get("text-rotation-alignment"),d.layout.get("text-pitch-alignment"),E),d.paint.get("icon-opacity").constantOr(1)!==0&&Ia(S,r,d,x,!1,d.paint.get("icon-translate"),d.paint.get("icon-translate-anchor"),d.layout.get("icon-rotation-alignment"),d.layout.get("icon-pitch-alignment"),d.layout.get("icon-keep-upright"),P,U),d.paint.get("text-opacity").constantOr(1)!==0&&Ia(S,r,d,x,!0,d.paint.get("text-translate"),d.paint.get("text-translate-anchor"),d.layout.get("text-rotation-alignment"),d.layout.get("text-pitch-alignment"),d.layout.get("text-keep-upright"),P,U),r.map.showCollisionBoxes&&(Ds(S,r,d,x,d.paint.get("text-translate"),d.paint.get("text-translate-anchor"),!0),Ds(S,r,d,x,d.paint.get("icon-translate"),d.paint.get("icon-translate-anchor"),!1))},circle:function(S,r,d,x){if(S.renderPass!=="translucent")return;let E=d.paint.get("circle-opacity"),P=d.paint.get("circle-stroke-width"),U=d.paint.get("circle-stroke-opacity"),G=!d.layout.get("circle-sort-key").isConstant();if(E.constantOr(1)===0&&(P.constantOr(1)===0||U.constantOr(1)===0))return;let X=S.context,Y=X.gl,se=S.depthModeForSublayer(0,Qi.ReadOnly),fe=ur.disabled,xe=S.colorModeForRenderPass(),je=[];for(let Le=0;Le<x.length;Le++){let Ue=x[Le],Qe=r.getTile(Ue),at=Qe.getBucket(d);if(!at)continue;let ht=at.programConfigurations.get(d.id),Ge=S.useProgram("circle",ht),yt=at.layoutVertexBuffer,pt=at.indexBuffer,vt=S.style.terrain&&S.style.terrain.getTerrainData(Ue),St={programConfiguration:ht,program:Ge,layoutVertexBuffer:yt,indexBuffer:pt,uniformValues:zo(S,Ue,Qe,d),terrainData:vt};if(G){let kt=at.segments.get();for(let xt of kt)je.push({segments:new l.SegmentVector([xt]),sortKey:xt.sortKey,state:St})}else je.push({segments:at.segments,sortKey:0,state:St})}G&&je.sort((Le,Ue)=>Le.sortKey-Ue.sortKey);for(let Le of je){let{programConfiguration:Ue,program:Qe,layoutVertexBuffer:at,indexBuffer:ht,uniformValues:Ge,terrainData:yt}=Le.state;Qe.draw(X,Y.TRIANGLES,se,fe,xe,xr.disabled,Ge,yt,d.id,at,ht,Le.segments,d.paint,S.transform.zoom,Ue)}},heatmap:function(S,r,d,x){if(d.paint.get("heatmap-opacity")!==0)if(S.renderPass==="offscreen"){let E=S.context,P=E.gl,U=ur.disabled,G=new Dr([P.ONE,P.ONE],l.Color.transparent,[!0,!0,!0,!0]);(function(X,Y,se){let fe=X.gl;X.activeTexture.set(fe.TEXTURE1),X.viewport.set([0,0,Y.width/4,Y.height/4]);let xe=se.heatmapFbo;if(xe)fe.bindTexture(fe.TEXTURE_2D,xe.colorAttachment.get()),X.bindFramebuffer.set(xe.framebuffer);else{let je=fe.createTexture();fe.bindTexture(fe.TEXTURE_2D,je),fe.texParameteri(fe.TEXTURE_2D,fe.TEXTURE_WRAP_S,fe.CLAMP_TO_EDGE),fe.texParameteri(fe.TEXTURE_2D,fe.TEXTURE_WRAP_T,fe.CLAMP_TO_EDGE),fe.texParameteri(fe.TEXTURE_2D,fe.TEXTURE_MIN_FILTER,fe.LINEAR),fe.texParameteri(fe.TEXTURE_2D,fe.TEXTURE_MAG_FILTER,fe.LINEAR),xe=se.heatmapFbo=X.createFramebuffer(Y.width/4,Y.height/4,!1),function(Le,Ue,Qe,at){let ht=Le.gl;ht.texImage2D(ht.TEXTURE_2D,0,ht.RGBA,Ue.width/4,Ue.height/4,0,ht.RGBA,Le.extRenderToTextureHalfFloat?Le.extTextureHalfFloat.HALF_FLOAT_OES:ht.UNSIGNED_BYTE,null),at.colorAttachment.set(Qe)}(X,Y,je,xe)}})(E,S,d),E.clear({color:l.Color.transparent});for(let X=0;X<x.length;X++){let Y=x[X];if(r.hasRenderableParent(Y))continue;let se=r.getTile(Y),fe=se.getBucket(d);if(!fe)continue;let xe=fe.programConfigurations.get(d.id),je=S.useProgram("heatmap",xe),{zoom:Le}=S.transform;je.draw(E,P.TRIANGLES,Qi.disabled,U,G,xr.disabled,Fo(Y.posMatrix,se,Le,d.paint.get("heatmap-intensity")),null,d.id,fe.layoutVertexBuffer,fe.indexBuffer,fe.segments,d.paint,S.transform.zoom,xe)}E.viewport.set([0,0,S.width,S.height])}else S.renderPass==="translucent"&&(S.context.setColorMode(S.colorModeForRenderPass()),function(E,P){let U=E.context,G=U.gl,X=P.heatmapFbo;if(!X)return;U.activeTexture.set(G.TEXTURE0),G.bindTexture(G.TEXTURE_2D,X.colorAttachment.get()),U.activeTexture.set(G.TEXTURE1);let Y=P.colorRampTexture;Y||(Y=P.colorRampTexture=new Ie(U,P.colorRamp,G.RGBA)),Y.bind(G.LINEAR,G.CLAMP_TO_EDGE),E.useProgram("heatmapTexture").draw(U,G.TRIANGLES,Qi.disabled,ur.disabled,E.colorModeForRenderPass(),xr.disabled,((se,fe,xe,je)=>{let Le=l.create();l.ortho(Le,0,se.width,se.height,0,0,1);let Ue=se.context.gl;return{u_matrix:Le,u_world:[Ue.drawingBufferWidth,Ue.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:fe.paint.get("heatmap-opacity")}})(E,P),null,P.id,E.viewportBuffer,E.quadTriangleIndexBuffer,E.viewportSegments,P.paint,E.transform.zoom)}(S,d))},line:function(S,r,d,x){if(S.renderPass!=="translucent")return;let E=d.paint.get("line-opacity"),P=d.paint.get("line-width");if(E.constantOr(1)===0||P.constantOr(1)===0)return;let U=S.depthModeForSublayer(0,Qi.ReadOnly),G=S.colorModeForRenderPass(),X=d.paint.get("line-dasharray"),Y=d.paint.get("line-pattern"),se=Y.constantOr(1),fe=d.paint.get("line-gradient"),xe=d.getCrossfadeParameters(),je=se?"linePattern":X?"lineSDF":fe?"lineGradient":"line",Le=S.context,Ue=Le.gl,Qe=!0;for(let at of x){let ht=r.getTile(at);if(se&&!ht.patternsLoaded())continue;let Ge=ht.getBucket(d);if(!Ge)continue;let yt=Ge.programConfigurations.get(d.id),pt=S.context.program.get(),vt=S.useProgram(je,yt),St=Qe||vt.program!==pt,kt=S.style.terrain&&S.style.terrain.getTerrainData(at),xt=Y.constantOr(null);if(xt&&ht.imageAtlas){let f=ht.imageAtlas,p=f.patternPositions[xt.to.toString()],_=f.patternPositions[xt.from.toString()];p&&_&&yt.setConstantPatternPositions(p,_)}let ii=kt?at:null,h=se?Kl(S,ht,d,xe,ii):X?ks(S,ht,d,X,xe,ii):fe?Lu(S,ht,d,Ge.lineClipsArray.length,ii):Ko(S,ht,d,ii);if(se)Le.activeTexture.set(Ue.TEXTURE0),ht.imageAtlasTexture.bind(Ue.LINEAR,Ue.CLAMP_TO_EDGE),yt.updatePaintBuffers(xe);else if(X&&(St||S.lineAtlas.dirty))Le.activeTexture.set(Ue.TEXTURE0),S.lineAtlas.bind(Le);else if(fe){let f=Ge.gradients[d.id],p=f.texture;if(d.gradientVersion!==f.version){let _=256;if(d.stepInterpolant){let I=r.getSource().maxzoom,R=at.canonical.z===I?Math.ceil(1<<S.transform.maxZoom-at.canonical.z):1;_=l.clamp(l.nextPowerOfTwo(Ge.maxLineLength/l.EXTENT*1024*R),256,Le.maxTextureSize)}f.gradient=l.renderColorRamp({expression:d.gradientExpression(),evaluationKey:"lineProgress",resolution:_,image:f.gradient||void 0,clips:Ge.lineClipsArray}),f.texture?f.texture.update(f.gradient):f.texture=new Ie(Le,f.gradient,Ue.RGBA),f.version=d.gradientVersion,p=f.texture}Le.activeTexture.set(Ue.TEXTURE0),p.bind(d.stepInterpolant?Ue.NEAREST:Ue.LINEAR,Ue.CLAMP_TO_EDGE)}vt.draw(Le,Ue.TRIANGLES,U,S.stencilModeForClipping(at),G,xr.disabled,h,kt,d.id,Ge.layoutVertexBuffer,Ge.indexBuffer,Ge.segments,d.paint,S.transform.zoom,yt,Ge.layoutVertexBuffer2),Qe=!1}},fill:function(S,r,d,x){let E=d.paint.get("fill-color"),P=d.paint.get("fill-opacity");if(P.constantOr(1)===0)return;let U=S.colorModeForRenderPass(),G=d.paint.get("fill-pattern"),X=S.opaquePassEnabledForLayer()&&!G.constantOr(1)&&E.constantOr(l.Color.transparent).a===1&&P.constantOr(0)===1?"opaque":"translucent";if(S.renderPass===X){let Y=S.depthModeForSublayer(1,S.renderPass==="opaque"?Qi.ReadWrite:Qi.ReadOnly);ja(S,r,d,x,Y,U,!1)}if(S.renderPass==="translucent"&&d.paint.get("fill-antialias")){let Y=S.depthModeForSublayer(d.getPaintProperty("fill-outline-color")?2:0,Qi.ReadOnly);ja(S,r,d,x,Y,U,!0)}},"fill-extrusion":function(S,r,d,x){let E=d.paint.get("fill-extrusion-opacity");if(E!==0&&S.renderPass==="translucent"){let P=new Qi(S.context.gl.LEQUAL,Qi.ReadWrite,S.depthRangeFor3D);if(E!==1||d.paint.get("fill-extrusion-pattern").constantOr(1))dr(S,r,d,x,P,ur.disabled,Dr.disabled),dr(S,r,d,x,P,S.stencilModeFor3D(),S.colorModeForRenderPass());else{let U=S.colorModeForRenderPass();dr(S,r,d,x,P,ur.disabled,U)}}},hillshade:function(S,r,d,x){if(S.renderPass!=="offscreen"&&S.renderPass!=="translucent")return;let E=S.context,P=S.depthModeForSublayer(0,Qi.ReadOnly),U=S.colorModeForRenderPass(),[G,X]=S.renderPass==="translucent"?S.stencilConfigForOverlap(x):[{},x];for(let Y of X){let se=r.getTile(Y);se.needsHillshadePrepare!==void 0&&se.needsHillshadePrepare&&S.renderPass==="offscreen"?Ec(S,se,d,P,ur.disabled,U):S.renderPass==="translucent"&&al(S,Y,se,d,P,G[Y.overscaledZ],U)}E.viewport.set([0,0,S.width,S.height])},raster:function(S,r,d,x){if(S.renderPass!=="translucent"||d.paint.get("raster-opacity")===0||!x.length)return;let E=S.context,P=E.gl,U=r.getSource(),G=S.useProgram("raster"),X=S.colorModeForRenderPass(),[Y,se]=U instanceof Ei?[{},x]:S.stencilConfigForOverlap(x),fe=se[se.length-1].overscaledZ,xe=!S.options.moving;for(let je of se){let Le=S.depthModeForSublayer(je.overscaledZ-fe,d.paint.get("raster-opacity")===1?Qi.ReadWrite:Qi.ReadOnly,P.LESS),Ue=r.getTile(je);Ue.registerFadeDuration(d.paint.get("raster-fade-duration"));let Qe=r.findLoadedParent(je,0),at=Ga(Ue,Qe,r,d,S.transform,S.style.terrain),ht,Ge,yt=d.paint.get("raster-resampling")==="nearest"?P.NEAREST:P.LINEAR;E.activeTexture.set(P.TEXTURE0),Ue.texture.bind(yt,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(P.TEXTURE1),Qe?(Qe.texture.bind(yt,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),ht=Math.pow(2,Qe.tileID.overscaledZ-Ue.tileID.overscaledZ),Ge=[Ue.tileID.canonical.x*ht%1,Ue.tileID.canonical.y*ht%1]):Ue.texture.bind(yt,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST);let pt=S.style.terrain&&S.style.terrain.getTerrainData(je),vt=pt?je:null,St=vt?vt.posMatrix:S.transform.calculatePosMatrix(je.toUnwrapped(),xe),kt=xc(St,Ge||[0,0],ht||1,at,d);U instanceof Ei?G.draw(E,P.TRIANGLES,Le,ur.disabled,X,xr.disabled,kt,pt,d.id,U.boundsBuffer,S.quadTriangleIndexBuffer,U.boundsSegments):G.draw(E,P.TRIANGLES,Le,Y[je.overscaledZ],X,xr.disabled,kt,pt,d.id,S.rasterBoundsBuffer,S.quadTriangleIndexBuffer,S.rasterBoundsSegments)}},background:function(S,r,d,x){let E=d.paint.get("background-color"),P=d.paint.get("background-opacity");if(P===0)return;let U=S.context,G=U.gl,X=S.transform,Y=X.tileSize,se=d.paint.get("background-pattern");if(S.isPatternMissing(se))return;let fe=!se&&E.a===1&&P===1&&S.opaquePassEnabledForLayer()?"opaque":"translucent";if(S.renderPass!==fe)return;let xe=ur.disabled,je=S.depthModeForSublayer(0,fe==="opaque"?Qi.ReadWrite:Qi.ReadOnly),Le=S.colorModeForRenderPass(),Ue=S.useProgram(se?"backgroundPattern":"background"),Qe=x||X.coveringTiles({tileSize:Y,terrain:S.style.terrain});se&&(U.activeTexture.set(G.TEXTURE0),S.imageManager.bind(S.context));let at=d.getCrossfadeParameters();for(let ht of Qe){let Ge=x?ht.posMatrix:S.transform.calculatePosMatrix(ht.toUnwrapped()),yt=se?bc(Ge,P,S,se,{tileID:ht,tileSize:Y},at):El(Ge,P,E),pt=S.style.terrain&&S.style.terrain.getTerrainData(ht);Ue.draw(U,G.TRIANGLES,je,xe,Le,xr.disabled,yt,pt,d.id,S.tileExtentBuffer,S.quadTriangleIndexBuffer,S.tileExtentSegments)}},debug:function(S,r,d){for(let x=0;x<d.length;x++)ll(S,r,d[x])},custom:function(S,r,d){let x=S.context,E=d.implementation;if(S.renderPass==="offscreen"){let P=E.prerender;P&&(S.setCustomLayerDefaults(),x.setColorMode(S.colorModeForRenderPass()),P.call(E,x.gl,S.transform.customLayerMatrix()),x.setDirty(),S.setBaseState())}else if(S.renderPass==="translucent"){S.setCustomLayerDefaults(),x.setColorMode(S.colorModeForRenderPass()),x.setStencilMode(ur.disabled);let P=E.renderingMode==="3d"?new Qi(S.context.gl.LEQUAL,Qi.ReadWrite,S.depthRangeFor3D):S.depthModeForSublayer(0,Qi.ReadOnly);x.setDepthMode(P),E.render(x.gl,S.transform.customLayerMatrix()),x.setDirty(),S.setBaseState(),x.bindFramebuffer.set(null)}}};class iu{constructor(r,d){this.context=new Bu(r),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.create(),renderTime:0},this.setup(),this.numSublayers=Fi.maxUnderzooming+Fi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Wt,this.gpuTimers={}}resize(r,d,x){if(this.width=r*x,this.height=d*x,this.pixelRatio=x,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let E of this.style._order)this.style._layers[E].resize()}setup(){let r=this.context,d=new l.PosArray;d.emplaceBack(0,0),d.emplaceBack(l.EXTENT,0),d.emplaceBack(0,l.EXTENT),d.emplaceBack(l.EXTENT,l.EXTENT),this.tileExtentBuffer=r.createVertexBuffer(d,Oi.members),this.tileExtentSegments=l.SegmentVector.simpleSegment(0,0,4,2);let x=new l.PosArray;x.emplaceBack(0,0),x.emplaceBack(l.EXTENT,0),x.emplaceBack(0,l.EXTENT),x.emplaceBack(l.EXTENT,l.EXTENT),this.debugBuffer=r.createVertexBuffer(x,Oi.members),this.debugSegments=l.SegmentVector.simpleSegment(0,0,4,5);let E=new l.RasterBoundsArray;E.emplaceBack(0,0,0,0),E.emplaceBack(l.EXTENT,0,l.EXTENT,0),E.emplaceBack(0,l.EXTENT,0,l.EXTENT),E.emplaceBack(l.EXTENT,l.EXTENT,l.EXTENT,l.EXTENT),this.rasterBoundsBuffer=r.createVertexBuffer(E,Jt.members),this.rasterBoundsSegments=l.SegmentVector.simpleSegment(0,0,4,2);let P=new l.PosArray;P.emplaceBack(0,0),P.emplaceBack(1,0),P.emplaceBack(0,1),P.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(P,Oi.members),this.viewportSegments=l.SegmentVector.simpleSegment(0,0,4,2);let U=new l.LineStripIndexArray;U.emplaceBack(0),U.emplaceBack(1),U.emplaceBack(3),U.emplaceBack(2),U.emplaceBack(0),this.tileBorderIndexBuffer=r.createIndexBuffer(U);let G=new l.TriangleIndexArray;G.emplaceBack(0,1,2),G.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(G),this.emptyTexture=new Ie(r,{width:1,height:1,data:new Uint8Array([0,0,0,0])},r.gl.RGBA);let X=this.context.gl;this.stencilClearMode=new ur({func:X.ALWAYS,mask:0},0,255,X.ZERO,X.ZERO,X.ZERO)}clearStencil(){let r=this.context,d=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let x=l.create();l.ortho(x,0,this.width,this.height,0,0,1),l.scale(x,x,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(r,d.TRIANGLES,Qi.disabled,this.stencilClearMode,Dr.disabled,xr.disabled,an(x),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(r,d){if(this.currentStencilSource===r.source||!r.isTileClipped()||!d||!d.length)return;this.currentStencilSource=r.source;let x=this.context,E=x.gl;this.nextStencilID+d.length>256&&this.clearStencil(),x.setColorMode(Dr.disabled),x.setDepthMode(Qi.disabled);let P=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let U of d){let G=this._tileClippingMaskIDs[U.key]=this.nextStencilID++,X=this.style.terrain&&this.style.terrain.getTerrainData(U);P.draw(x,E.TRIANGLES,Qi.disabled,new ur({func:E.ALWAYS,mask:0},G,255,E.KEEP,E.KEEP,E.REPLACE),Dr.disabled,xr.disabled,an(U.posMatrix),X,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let r=this.nextStencilID++,d=this.context.gl;return new ur({func:d.NOTEQUAL,mask:255},r,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(r){let d=this.context.gl;return new ur({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(r){let d=this.context.gl,x=r.sort((U,G)=>G.overscaledZ-U.overscaledZ),E=x[x.length-1].overscaledZ,P=x[0].overscaledZ-E+1;if(P>1){this.currentStencilSource=void 0,this.nextStencilID+P>256&&this.clearStencil();let U={};for(let G=0;G<P;G++)U[G+E]=new ur({func:d.GEQUAL,mask:255},G+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=P,[U,x]}return[{[E]:ur.disabled},x]}colorModeForRenderPass(){let r=this.context.gl;return this._showOverdrawInspector?new Dr([r.CONSTANT_COLOR,r.ONE],new l.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Dr.unblended:Dr.alphaBlended}depthModeForSublayer(r,d,x){if(!this.opaquePassEnabledForLayer())return Qi.disabled;let E=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new Qi(x||this.context.gl.LEQUAL,d,[E,E])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(r,d){this.style=r,this.options=d,this.lineAtlas=r.lineAtlas,this.imageManager=r.imageManager,this.glyphManager=r.glyphManager,this.symbolFadeChange=r.placement.symbolFadeChange(l.exported.now()),this.imageManager.beginFrame();let x=this.style._order,E=this.style.sourceCaches,P=this.style.terrain&&new Ho(this);for(let Y in E){let se=E[Y];se.used&&se.prepare(this.context)}let U={},G={},X={};for(let Y in E){let se=E[Y];U[Y]=se.getVisibleCoordinates(),G[Y]=U[Y].slice().reverse(),X[Y]=se.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let Y=0;Y<x.length;Y++)if(this.style._layers[x[Y]].is3D()){this.opaquePassCutoff=Y;break}if(P){this.opaquePassCutoff=0;let Y=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!l.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||Y.length)&&(l.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(se,fe){let xe=se.context,je=xe.gl,Le=Dr.unblended,Ue=new Qi(je.LEQUAL,Qi.ReadWrite,[0,1]),Qe=fe.getTerrainMesh(),at=fe.sourceCache.getRenderableTiles(),ht=se.useProgram("terrainDepth");xe.bindFramebuffer.set(fe.getFramebuffer("depth").framebuffer),xe.viewport.set([0,0,se.width/devicePixelRatio,se.height/devicePixelRatio]),xe.clear({color:l.Color.transparent,depth:1});for(let Ge of at){let yt=fe.getTerrainData(Ge.tileID),pt=se.transform.calculatePosMatrix(Ge.tileID.toUnwrapped());ht.draw(xe,je.TRIANGLES,Ue,ur.disabled,Le,xr.backCCW,{u_matrix:pt},yt,"terrain",Qe.vertexBuffer,Qe.indexBuffer,Qe.segments)}xe.bindFramebuffer.set(null),xe.viewport.set([0,0,se.width,se.height])}(this,this.style.terrain),function(se,fe){let xe=se.context,je=xe.gl,Le=Dr.unblended,Ue=new Qi(je.LEQUAL,Qi.ReadWrite,[0,1]),Qe=fe.getTerrainMesh(),at=fe.getCoordsTexture(),ht=fe.sourceCache.getRenderableTiles(),Ge=se.useProgram("terrainCoords");xe.bindFramebuffer.set(fe.getFramebuffer("coords").framebuffer),xe.viewport.set([0,0,se.width/devicePixelRatio,se.height/devicePixelRatio]),xe.clear({color:l.Color.transparent,depth:1}),fe.coordsIndex=[];for(let yt of ht){let pt=fe.getTerrainData(yt.tileID);xe.activeTexture.set(je.TEXTURE0),je.bindTexture(je.TEXTURE_2D,at.texture);let vt=se.transform.calculatePosMatrix(yt.tileID.toUnwrapped());Ge.draw(xe,je.TRIANGLES,Ue,ur.disabled,Le,xr.backCCW,{u_matrix:vt,u_terrain_coords_id:(255-fe.coordsIndex.length)/255,u_texture:0},pt,"terrain",Qe.vertexBuffer,Qe.indexBuffer,Qe.segments),fe.coordsIndex.push(yt.tileID.key)}xe.bindFramebuffer.set(null),xe.viewport.set([0,0,se.width,se.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(let Y of x){let se=this.style._layers[Y];if(!se.hasOffscreenPass()||se.isHidden(this.transform.zoom))continue;let fe=G[se.source];(se.type==="custom"||fe.length)&&this.renderLayer(this,E[se.source],se,fe)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:d.showOverdrawInspector?l.Color.black:l.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(r._order.length+2)*this.numSublayers*this.depthEpsilon],!P)for(this.renderPass="opaque",this.currentLayer=x.length-1;this.currentLayer>=0;this.currentLayer--){let Y=this.style._layers[x[this.currentLayer]],se=E[Y.source],fe=U[Y.source];this._renderTileClippingMasks(Y,fe),this.renderLayer(this,se,Y,fe)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<x.length;this.currentLayer++){let Y=this.style._layers[x[this.currentLayer]],se=E[Y.source];if(P&&P.renderLayer(Y))continue;let fe=(Y.type==="symbol"?X:G)[Y.source];this._renderTileClippingMasks(Y,U[Y.source]),this.renderLayer(this,se,Y,fe)}if(this.options.showTileBoundaries){let Y,se;Object.values(this.style._layers).forEach(fe=>{fe.source&&!fe.isHidden(this.transform.zoom)&&(fe.source!==(se&&se.id)&&(se=this.style.sourceCaches[fe.source]),(!Y||Y.getSource().maxzoom<se.getSource().maxzoom)&&(Y=se))}),Y&&ul.debug(this,Y,Y.getVisibleCoordinates())}this.options.showPadding&&function(Y){let se=Y.transform.padding;ua(Y,Y.transform.height-(se.top||0),3,Pl),ua(Y,se.bottom||0,3,la),as(Y,se.left||0,3,Nu),as(Y,Y.transform.width-(se.right||0),3,sl);let fe=Y.transform.centerPoint;(function(xe,je,Le,Ue){Ca(xe,je-1,Le-10,2,20,Ue),Ca(xe,je-10,Le-1,20,2,Ue)})(Y,fe.x,Y.transform.height-fe.y,Bs)}(this),this.context.setDefault()}renderLayer(r,d,x,E){x.isHidden(this.transform.zoom)||(x.type==="background"||x.type==="custom"||(E||[]).length)&&(this.id=x.id,this.gpuTimingStart(x),ul[x.type](r,d,x,E,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(r){if(!this.options.gpuTiming)return;let d=this.context.extTimerQuery,x=this.gpuTimers[r.id];x||(x=this.gpuTimers[r.id]={calls:0,cpuTime:0,query:d.createQueryEXT()}),x.calls++,d.beginQueryEXT(d.TIME_ELAPSED_EXT,x.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;let r=this.context.extTimerQuery;r.endQueryEXT(r.TIME_ELAPSED_EXT)}collectGpuTimers(){let r=this.gpuTimers;return this.gpuTimers={},r}queryGpuTimers(r){let d={};for(let x in r){let E=r[x],P=this.context.extTimerQuery,U=P.getQueryObjectEXT(E.query,P.QUERY_RESULT_EXT)/1e6;P.deleteQueryEXT(E.query),d[x]=U}return d}translatePosMatrix(r,d,x,E,P){if(!x[0]&&!x[1])return r;let U=P?E==="map"?this.transform.angle:0:E==="viewport"?-this.transform.angle:0;if(U){let Y=Math.sin(U),se=Math.cos(U);x=[x[0]*se-x[1]*Y,x[0]*Y+x[1]*se]}let G=[P?x[0]:ie(d,x[0],this.transform.zoom),P?x[1]:ie(d,x[1],this.transform.zoom),0],X=new Float32Array(16);return l.translate(X,r,G),X}saveTileTexture(r){let d=this._tileTextures[r.size[0]];d?d.push(r):this._tileTextures[r.size[0]]=[r]}getTileTexture(r){let d=this._tileTextures[r];return d&&d.length>0?d.pop():null}isPatternMissing(r){if(!r)return!1;if(!r.from||!r.to)return!0;let d=this.imageManager.getPattern(r.from.toString()),x=this.imageManager.getPattern(r.to.toString());return!d||!x}useProgram(r,d){this.cache=this.cache||{};let x=r+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[x]||(this.cache[x]=new Qs(this.context,r,Mn[r],d,tl[r],this._showOverdrawInspector,this.style.terrain)),this.cache[x]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ie(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Rl{constructor(r,d){this.points=r,this.planes=d}static fromInvProjectionMatrix(r,d,x){let E=Math.pow(2,x),P=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(G=>{let X=1/(G=l.transformMat4([],G,r))[3]/d*E;return l.mul$1(G,G,[X,X,1/G[3],X])}),U=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(G=>{let X=l.sub([],P[G[0]],P[G[1]]),Y=l.sub([],P[G[2]],P[G[1]]),se=l.normalize([],l.cross([],X,Y)),fe=-l.dot(se,P[G[1]]);return se.concat(fe)});return new Rl(P,U)}}class ca{constructor(r,d){this.min=r,this.max=d,this.center=l.scale$1([],l.add([],this.min,this.max),.5)}quadrant(r){let d=[r%2==0,r<2],x=l.clone$2(this.min),E=l.clone$2(this.max);for(let P=0;P<d.length;P++)x[P]=d[P]?this.min[P]:this.center[P],E[P]=d[P]?this.center[P]:this.max[P];return E[2]=this.max[2],new ca(x,E)}distanceX(r){return Math.max(Math.min(this.max[0],r[0]),this.min[0])-r[0]}distanceY(r){return Math.max(Math.min(this.max[1],r[1]),this.min[1])-r[1]}intersects(r){let d=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],x=!0;for(let E=0;E<r.planes.length;E++){let P=r.planes[E],U=0;for(let G=0;G<d.length;G++)l.dot$1(P,d[G])>=0&&U++;if(U===0)return 0;U!==d.length&&(x=!1)}if(x)return 2;for(let E=0;E<3;E++){let P=Number.MAX_VALUE,U=-Number.MAX_VALUE;for(let G=0;G<r.points.length;G++){let X=r.points[G][E]-this.min[E];P=Math.min(P,X),U=Math.max(U,X)}if(U<0||P>this.max[E]-this.min[E])return 0}return 1}}class Aa{constructor(r=0,d=0,x=0,E=0){if(isNaN(r)||r<0||isNaN(d)||d<0||isNaN(x)||x<0||isNaN(E)||E<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=d,this.left=x,this.right=E}interpolate(r,d,x){return d.top!=null&&r.top!=null&&(this.top=l.number(r.top,d.top,x)),d.bottom!=null&&r.bottom!=null&&(this.bottom=l.number(r.bottom,d.bottom,x)),d.left!=null&&r.left!=null&&(this.left=l.number(r.left,d.left,x)),d.right!=null&&r.right!=null&&(this.right=l.number(r.right,d.right,x)),this}getCenter(r,d){let x=l.clamp((this.left+r-this.right)/2,0,r),E=l.clamp((this.top+d-this.bottom)/2,0,d);return new l.pointGeometry(x,E)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new Aa(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ss{constructor(r,d,x,E,P){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=P===void 0||!!P,this._minZoom=r||0,this._maxZoom=d||22,this._minPitch=x??0,this._maxPitch=E??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Aa,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let r=new ss(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return r.tileSize=this.tileSize,r.latRange=this.latRange,r.width=this.width,r.height=this.height,r._center=this._center,r._elevation=this._elevation,r.zoom=this.zoom,r.angle=this.angle,r._fov=this._fov,r._pitch=this._pitch,r._unmodified=this._unmodified,r._edgeInsets=this._edgeInsets.clone(),r._calcMatrices(),r}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(r){let d=-l.wrap(r,-180,180)*Math.PI/180;var x;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=(x=new l.ARRAY_TYPE(4),l.ARRAY_TYPE!=Float32Array&&(x[1]=0,x[2]=0),x[0]=1,x[3]=1,x),function(E,P,U){var G=P[0],X=P[1],Y=P[2],se=P[3],fe=Math.sin(U),xe=Math.cos(U);E[0]=G*xe+Y*fe,E[1]=X*xe+se*fe,E[2]=G*-fe+Y*xe,E[3]=X*-fe+se*xe}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){let d=l.clamp(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=r/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(r){let d=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.scale=this.zoomScale(d),this.tileZoom=Math.floor(d),this.zoomFraction=d-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(r){r.lat===this._center.lat&&r.lng===this._center.lng||(this._unmodified=!1,this._center=r,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(r){r!==this._elevation&&(this._elevation=r,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(r){this._edgeInsets.equals(r)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,r,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(r){return this._edgeInsets.equals(r)}interpolatePadding(r,d,x){this._unmodified=!1,this._edgeInsets.interpolate(r,d,x),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){let d=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(r){let d=[new l.UnwrappedTileID(0,r)];if(this._renderWorldCopies){let x=this.pointCoordinate(new l.pointGeometry(0,0)),E=this.pointCoordinate(new l.pointGeometry(this.width,0)),P=this.pointCoordinate(new l.pointGeometry(this.width,this.height)),U=this.pointCoordinate(new l.pointGeometry(0,this.height)),G=Math.floor(Math.min(x.x,E.x,P.x,U.x)),X=Math.floor(Math.max(x.x,E.x,P.x,U.x)),Y=1;for(let se=G-Y;se<=X+Y;se++)se!==0&&d.push(new l.UnwrappedTileID(se,r))}return d}coveringTiles(r){var d,x;let E=this.coveringZoomLevel(r),P=E;if(r.minzoom!==void 0&&E<r.minzoom)return[];r.maxzoom!==void 0&&E>r.maxzoom&&(E=r.maxzoom);let U=this.pointCoordinate(this.getCameraPoint()),G=l.MercatorCoordinate.fromLngLat(this.center),X=Math.pow(2,E),Y=[X*U.x,X*U.y,0],se=[X*G.x,X*G.y,0],fe=Rl.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,E),xe=r.minzoom||0;!r.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(xe=E);let je=r.terrain?2/Math.min(this.tileSize,r.tileSize)*this.tileSize:3,Le=Ge=>({aabb:new ca([Ge*X,0,0],[(Ge+1)*X,X,0]),zoom:0,x:0,y:0,wrap:Ge,fullyVisible:!1}),Ue=[],Qe=[],at=E,ht=r.reparseOverscaled?P:E;if(this._renderWorldCopies)for(let Ge=1;Ge<=3;Ge++)Ue.push(Le(-Ge)),Ue.push(Le(Ge));for(Ue.push(Le(0));Ue.length>0;){let Ge=Ue.pop(),yt=Ge.x,pt=Ge.y,vt=Ge.fullyVisible;if(!vt){let f=Ge.aabb.intersects(fe);if(f===0)continue;vt=f===2}let St=r.terrain?Y:se,kt=Ge.aabb.distanceX(St),xt=Ge.aabb.distanceY(St),ii=Math.max(Math.abs(kt),Math.abs(xt)),h=je+(1<<at-Ge.zoom)-2;if(Ge.zoom===at||ii>h&&Ge.zoom>=xe){let f=at-Ge.zoom,p=Y[0]-.5-(yt<<f),_=Y[1]-.5-(pt<<f);Qe.push({tileID:new l.OverscaledTileID(Ge.zoom===at?ht:Ge.zoom,Ge.wrap,Ge.zoom,yt,pt),distanceSq:l.sqrLen([se[0]-.5-yt,se[1]-.5-pt]),tileDistanceToCamera:Math.sqrt(p*p+_*_)})}else for(let f=0;f<4;f++){let p=(yt<<1)+f%2,_=(pt<<1)+(f>>1),I=Ge.zoom+1,R=Ge.aabb.quadrant(f);if(r.terrain){let F=new l.OverscaledTileID(I,Ge.wrap,I,p,_),N=r.terrain.getMinMaxElevation(F),K=(d=N.minElevation)!==null&&d!==void 0?d:this.elevation,ne=(x=N.maxElevation)!==null&&x!==void 0?x:this.elevation;R=new ca([R.min[0],R.min[1],K],[R.max[0],R.max[1],ne])}Ue.push({aabb:R,zoom:I,x:p,y:_,wrap:Ge.wrap,fullyVisible:vt})}}return Qe.sort((Ge,yt)=>Ge.distanceSq-yt.distanceSq).map(Ge=>Ge.tileID)}resize(r,d){this.width=r,this.height=d,this.pixelsToGLUnits=[2/r,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){let d=l.clamp(r.lat,-this.maxValidLatitude,this.maxValidLatitude);return new l.pointGeometry(l.mercatorXfromLng(r.lng)*this.worldSize,l.mercatorYfromLat(d)*this.worldSize)}unproject(r){return new l.MercatorCoordinate(r.x/this.worldSize,r.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(r){this.freezeElevation||(this.elevation=r?this.getElevation(this._center,r):0)}getElevation(r,d){let x=l.MercatorCoordinate.fromLngLat(r),E=(1<<this.tileZoom)*l.EXTENT,P=x.x*E,U=x.y*E,G=Math.floor(P/l.EXTENT),X=Math.floor(U/l.EXTENT),Y=new l.OverscaledTileID(this.tileZoom,0,this.tileZoom,G,X);return d.getElevation(Y,P%l.EXTENT,U%l.EXTENT,l.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(r){let d=this.pointLocation(this.centerPoint,r),x=this.getElevation(d,r);if(!(this.elevation-x))return;let E=this.getCameraPosition(),P=l.MercatorCoordinate.fromLngLat(E.lngLat,E.altitude),U=l.MercatorCoordinate.fromLngLat(d,x),G=P.x-U.x,X=P.y-U.y,Y=P.z-U.z,se=Math.sqrt(G*G+X*X+Y*Y),fe=this.scaleZoom(this.cameraToCenterDistance/se/this.tileSize);this._elevation=x,this._center=d,this.zoom=fe}setLocationAtPoint(r,d){let x=this.pointCoordinate(d),E=this.pointCoordinate(this.centerPoint),P=this.locationCoordinate(r),U=new l.MercatorCoordinate(P.x-(x.x-E.x),P.y-(x.y-E.y));this.center=this.coordinateLocation(U),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(r,d){return d?this.coordinatePoint(this.locationCoordinate(r),this.getElevation(r,d),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(r))}pointLocation(r,d){return this.coordinateLocation(this.pointCoordinate(r,d))}locationCoordinate(r){return l.MercatorCoordinate.fromLngLat(r)}coordinateLocation(r){return r&&r.toLngLat()}pointCoordinate(r,d){if(d){let xe=d.pointCoordinate(r);if(xe!=null)return xe}let x=[r.x,r.y,0,1],E=[r.x,r.y,1,1];l.transformMat4(x,x,this.pixelMatrixInverse),l.transformMat4(E,E,this.pixelMatrixInverse);let P=x[3],U=E[3],G=x[1]/P,X=E[1]/U,Y=x[2]/P,se=E[2]/U,fe=Y===se?0:(0-Y)/(se-Y);return new l.MercatorCoordinate(l.number(x[0]/P,E[0]/U,fe)/this.worldSize,l.number(G,X,fe)/this.worldSize)}coordinatePoint(r,d=0,x=this.pixelMatrix){let E=[r.x*this.worldSize,r.y*this.worldSize,d,1];return l.transformMat4(E,E,x),new l.pointGeometry(E[0]/E[3],E[1]/E[3])}getBounds(){let r=Math.max(0,this.height/2-this.getHorizon());return new l.LngLatBounds().extend(this.pointLocation(new l.pointGeometry(0,r))).extend(this.pointLocation(new l.pointGeometry(this.width,r))).extend(this.pointLocation(new l.pointGeometry(this.width,this.height))).extend(this.pointLocation(new l.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new l.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(r){r?(this.lngRange=[r.getWest(),r.getEast()],this.latRange=[r.getSouth(),r.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(r,d=!1){let x=r.key,E=d?this._alignedPosMatrixCache:this._posMatrixCache;if(E[x])return E[x];let P=r.canonical,U=this.worldSize/this.zoomScale(P.z),G=P.x+Math.pow(2,P.z)*r.wrap,X=l.identity(new Float64Array(16));return l.translate(X,X,[G*U,P.y*U,0]),l.scale(X,X,[U/l.EXTENT,U/l.EXTENT,1]),l.multiply(X,d?this.alignedProjMatrix:this.projMatrix,X),E[x]=new Float32Array(X),E[x]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let r,d,x,E,P=-90,U=90,G=-180,X=180,Y=this.size,se=this._unmodified;if(this.latRange){let je=this.latRange;P=l.mercatorYfromLat(je[1])*this.worldSize,U=l.mercatorYfromLat(je[0])*this.worldSize,r=U-P<Y.y?Y.y/(U-P):0}if(this.lngRange){let je=this.lngRange;G=l.wrap(l.mercatorXfromLng(je[0])*this.worldSize,0,this.worldSize),X=l.wrap(l.mercatorXfromLng(je[1])*this.worldSize,0,this.worldSize),X<G&&(X+=this.worldSize),d=X-G<Y.x?Y.x/(X-G):0}let fe=this.point,xe=Math.max(d||0,r||0);if(xe)return this.center=this.unproject(new l.pointGeometry(d?(X+G)/2:fe.x,r?(U+P)/2:fe.y)),this.zoom+=this.scaleZoom(xe),this._unmodified=se,void(this._constraining=!1);if(this.latRange){let je=fe.y,Le=Y.y/2;je-Le<P&&(E=P+Le),je+Le>U&&(E=U-Le)}if(this.lngRange){let je=(G+X)/2,Le=l.wrap(fe.x,je-this.worldSize/2,je+this.worldSize/2),Ue=Y.x/2;Le-Ue<G&&(x=G+Ue),Le+Ue>X&&(x=X-Ue)}x===void 0&&E===void 0||(this.center=this.unproject(new l.pointGeometry(x!==void 0?x:fe.x,E!==void 0?E:fe.y)).wrap()),this._unmodified=se,this._constraining=!1}_calcMatrices(){if(!this.height)return;let r=this.centerOffset,d=this.point.x,x=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let E=l.identity(new Float64Array(16));l.scale(E,E,[this.width/2,-this.height/2,1]),l.translate(E,E,[1,-1,0]),this.labelPlaneMatrix=E,E=l.identity(new Float64Array(16)),l.scale(E,E,[1,-1,1]),l.translate(E,E,[-1,-1,0]),l.scale(E,E,[2/this.width,2/this.height,1]),this.glCoordMatrix=E,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);let P=Math.PI/2+this._pitch,U=this._fov*(.5+r.y/this.height),G=Math.sin(U)*this.cameraToSeaLevelDistance/Math.sin(l.clamp(Math.PI-P-U,.01,Math.PI-.01)),X=this.getHorizon(),Y=2*Math.atan(X/this.cameraToCenterDistance)*(.5+r.y/(2*X)),se=Math.sin(Y)*this.cameraToSeaLevelDistance/Math.sin(l.clamp(Math.PI-P-Y,.01,Math.PI-.01)),fe=Math.cos(Math.PI/2-this._pitch)*G+this.cameraToSeaLevelDistance,xe=Math.cos(Math.PI/2-this._pitch)*se+this.cameraToSeaLevelDistance,je=1.01*Math.min(fe,xe),Le=this.height/50;E=new Float64Array(16),l.perspective(E,this._fov,this.width/this.height,Le,je),E[8]=2*-r.x/this.width,E[9]=2*r.y/this.height,l.scale(E,E,[1,-1,1]),l.translate(E,E,[0,0,-this.cameraToCenterDistance]),l.rotateX(E,E,this._pitch),l.rotateZ(E,E,this.angle),l.translate(E,E,[-d,-x,0]),this.mercatorMatrix=l.scale([],E,[this.worldSize,this.worldSize,this.worldSize]),l.scale(E,E,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.multiply(new Float64Array(16),this.labelPlaneMatrix,E),l.translate(E,E,[0,0,-this.elevation]),this.projMatrix=E,this.invProjMatrix=l.invert([],E),this.pixelMatrix3D=l.multiply(new Float64Array(16),this.labelPlaneMatrix,E);let Ue=this.width%2/2,Qe=this.height%2/2,at=Math.cos(this.angle),ht=Math.sin(this.angle),Ge=d-Math.round(d)+at*Ue+ht*Qe,yt=x-Math.round(x)+at*Qe+ht*Ue,pt=new Float64Array(E);if(l.translate(pt,pt,[Ge>.5?Ge-1:Ge,yt>.5?yt-1:yt,0]),this.alignedProjMatrix=pt,E=l.invert(new Float64Array(16),this.pixelMatrix),!E)throw new Error("failed to invert matrix");this.pixelMatrixInverse=E,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let r=this.pointCoordinate(new l.pointGeometry(0,0)),d=[r.x*this.worldSize,r.y*this.worldSize,0,1];return l.transformMat4(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.pointGeometry(0,r))}getCameraQueryGeometry(r){let d=this.getCameraPoint();if(r.length===1)return[r[0],d];{let x=d.x,E=d.y,P=d.x,U=d.y;for(let G of r)x=Math.min(x,G.x),E=Math.min(E,G.y),P=Math.max(P,G.x),U=Math.max(U,G.y);return[new l.pointGeometry(x,E),new l.pointGeometry(P,E),new l.pointGeometry(P,U),new l.pointGeometry(x,U),new l.pointGeometry(x,E)]}}}class ru{constructor(r){this._hashName=r&&encodeURIComponent(r),l.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(d,x){let E=!1,P=null,U=()=>{P=null,E&&(d(),P=setTimeout(U,300),E=!1)};return()=>(E=!0,P||U(),P)}(this._updateHashUnthrottled.bind(this))}addTo(r){return this._map=r,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(r){let d=this._map.getCenter(),x=Math.round(100*this._map.getZoom())/100,E=Math.ceil((x*Math.LN2+Math.log(512/360/.5))/Math.LN10),P=Math.pow(10,E),U=Math.round(d.lng*P)/P,G=Math.round(d.lat*P)/P,X=this._map.getBearing(),Y=this._map.getPitch(),se="";if(se+=r?`/${U}/${G}/${x}`:`${x}/${G}/${U}`,(X||Y)&&(se+="/"+Math.round(10*X)/10),Y&&(se+=`/${Math.round(Y)}`),this._hashName){let fe=this._hashName,xe=!1,je=window.location.hash.slice(1).split("&").map(Le=>{let Ue=Le.split("=")[0];return Ue===fe?(xe=!0,`${Ue}=${se}`):Le}).filter(Le=>Le);return xe||je.push(`${fe}=${se}`),`#${je.join("&")}`}return`#${se}`}_getCurrentHash(){let r=window.location.hash.replace("#","");if(this._hashName){let d;return r.split("&").map(x=>x.split("=")).forEach(x=>{x[0]===this._hashName&&(d=x)}),(d&&d[1]||"").split("/")}return r.split("/")}_onHashChange(){let r=this._getCurrentHash();if(r.length>=3&&!r.some(d=>isNaN(d))){let d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(r[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:d,pitch:+(r[4]||0)}),!0}return!1}_updateHashUnthrottled(){let r=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,r)}catch{}}}let ls={linearity:.3,easing:l.bezier(0,0,.3,1)},Tc=l.extend({deceleration:2500,maxSpeed:1400},ls),Ll=l.extend({deceleration:20,maxSpeed:1400},ls),nu=l.extend({deceleration:1e3,maxSpeed:360},ls),Vs=l.extend({deceleration:1e3,maxSpeed:90},ls);class ju{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l.exported.now(),settings:r})}_drainInertiaBuffer(){let r=this._inertiaBuffer,d=l.exported.now();for(;r.length>0&&d-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let d={zoom:0,bearing:0,pitch:0,pan:new l.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(let{settings:P}of this._inertiaBuffer)d.zoom+=P.zoomDelta||0,d.bearing+=P.bearingDelta||0,d.pitch+=P.pitchDelta||0,P.panDelta&&d.pan._add(P.panDelta),P.around&&(d.around=P.around),P.pinchAround&&(d.pinchAround=P.pinchAround);let x=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,E={};if(d.pan.mag()){let P=Ns(d.pan.mag(),x,l.extend({},Tc,r||{}));E.offset=d.pan.mult(P.amount/d.pan.mag()),E.center=this._map.transform.center,us(E,P)}if(d.zoom){let P=Ns(d.zoom,x,Ll);E.zoom=this._map.transform.zoom+P.amount,us(E,P)}if(d.bearing){let P=Ns(d.bearing,x,nu);E.bearing=this._map.transform.bearing+l.clamp(P.amount,-179,179),us(E,P)}if(d.pitch){let P=Ns(d.pitch,x,Vs);E.pitch=this._map.transform.pitch+P.amount,us(E,P)}if(E.zoom||E.bearing){let P=d.pinchAround===void 0?d.around:d.pinchAround;E.around=P?this._map.unproject(P):this._map.getCenter()}return this.clear(),l.extend(E,{noMoveStart:!0})}}function us(S,r){(!S.duration||S.duration<r.duration)&&(S.duration=r.duration,S.easing=r.easing)}function Ns(S,r,d){let{maxSpeed:x,linearity:E,deceleration:P}=d,U=l.clamp(S*E/(r/1e3),-x,x),G=Math.abs(U)/(P*E);return{easing:d.easing,duration:1e3*G,amount:U*(G/2)}}class po extends l.Event{constructor(r,d,x,E={}){let P=V.mousePos(d.getCanvasContainer(),x),U=d.unproject(P);super(r,l.extend({point:P,lngLat:U,originalEvent:x},E)),this._defaultPrevented=!1,this.target=d}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class js extends l.Event{constructor(r,d,x){let E=r==="touchend"?x.changedTouches:x.touches,P=V.touchPos(d.getCanvasContainer(),E),U=P.map(X=>d.unproject(X)),G=P.reduce((X,Y,se,fe)=>X.add(Y.div(fe.length)),new l.pointGeometry(0,0));super(r,{points:P,point:G,lngLats:U,lngLat:d.unproject(G),originalEvent:x}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class $n extends l.Event{constructor(r,d,x){super(r,{originalEvent:x}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Ic{constructor(r,d){this._map=r,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(r){return this._firePreventable(new $n(r.type,this._map,r))}mousedown(r,d){return this._mousedownPos=d,this._firePreventable(new po(r.type,this._map,r))}mouseup(r){this._map.fire(new po(r.type,this._map,r))}click(r,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new po(r.type,this._map,r))}dblclick(r){return this._firePreventable(new po(r.type,this._map,r))}mouseover(r){this._map.fire(new po(r.type,this._map,r))}mouseout(r){this._map.fire(new po(r.type,this._map,r))}touchstart(r){return this._firePreventable(new js(r.type,this._map,r))}touchmove(r){this._map.fire(new js(r.type,this._map,r))}touchend(r){this._map.fire(new js(r.type,this._map,r))}touchcancel(r){this._map.fire(new js(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Io{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(r){this._map.fire(new po(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new po("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._ignoreContextMenu||this._map.fire(new po(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class kr{constructor(r,d){this._map=r,this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,d){this.isEnabled()&&r.shiftKey&&r.button===0&&(V.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(r,d){if(!this._active)return;let x=d;if(this._lastPos.equals(x)||!this._box&&x.dist(this._startPos)<this._clickTolerance)return;let E=this._startPos;this._lastPos=x,this._box||(this._box=V.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",r));let P=Math.min(E.x,x.x),U=Math.max(E.x,x.x),G=Math.min(E.y,x.y),X=Math.max(E.y,x.y);V.setTransform(this._box,`translate(${P}px,${G}px)`),this._box.style.width=U-P+"px",this._box.style.height=X-G+"px"}mouseupWindow(r,d){if(!this._active||r.button!==0)return;let x=this._startPos,E=d;if(this.reset(),V.suppressClick(),x.x!==E.x||x.y!==E.y)return this._map.fire(new l.Event("boxzoomend",{originalEvent:r})),{cameraAnimation:P=>P.fitScreenCoordinates(x,E,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",r)}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(V.remove(this._box),this._box=null),V.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,d){return this._map.fire(new l.Event(r,{originalEvent:d}))}}function Yo(S,r){if(S.length!==r.length)throw new Error(`The number of touches and points are not equal - touches ${S.length}, points ${r.length}`);let d={};for(let x=0;x<S.length;x++)d[S[x].identifier]=r[x];return d}class ha{constructor(r){this.reset(),this.numTouches=r.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(r,d,x){(this.centroid||x.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=r.timeStamp),x.length===this.numTouches&&(this.centroid=function(E){let P=new l.pointGeometry(0,0);for(let U of E)P._add(U);return P.div(E.length)}(d),this.touches=Yo(x,d)))}touchmove(r,d,x){if(this.aborted||!this.centroid)return;let E=Yo(x,d);for(let P in this.touches){let U=this.touches[P],G=E[P];(!G||G.dist(U)>30)&&(this.aborted=!0)}}touchend(r,d,x){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),x.length===0){let E=!this.aborted&&this.centroid;if(this.reset(),E)return E}}}class Ma{constructor(r){this.singleTap=new ha(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(r,d,x){this.singleTap.touchstart(r,d,x)}touchmove(r,d,x){this.singleTap.touchmove(r,d,x)}touchend(r,d,x){let E=this.singleTap.touchend(r,d,x);if(E){let P=r.timeStamp-this.lastTime<500,U=!this.lastTap||this.lastTap.dist(E)<30;if(P&&U||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=E,this.count===this.numTaps)return this.reset(),E}}}class Yi{constructor(){this._zoomIn=new Ma({numTouches:1,numTaps:2}),this._zoomOut=new Ma({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,d,x){this._zoomIn.touchstart(r,d,x),this._zoomOut.touchstart(r,d,x)}touchmove(r,d,x){this._zoomIn.touchmove(r,d,x),this._zoomOut.touchmove(r,d,x)}touchend(r,d,x){let E=this._zoomIn.touchend(r,d,x),P=this._zoomOut.touchend(r,d,x);return E?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:U=>U.easeTo({duration:300,zoom:U.getZoom()+1,around:U.unproject(E)},{originalEvent:r})}):P?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:U=>U.easeTo({duration:300,zoom:U.getZoom()-1,around:U.unproject(P)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let Cr={0:1,2:2};class to{constructor(r){this.reset(),this._clickTolerance=r.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(r,d){return!1}_move(r,d){return{}}mousedown(r,d){if(this._lastPoint)return;let x=V.mouseButton(r);this._correctButton(r,x)&&(this._lastPoint=d,this._eventButton=x)}mousemoveWindow(r,d){let x=this._lastPoint;if(x){if(r.preventDefault(),function(E,P){let U=Cr[P];return E.buttons===void 0||(E.buttons&U)!==U}(r,this._eventButton))this.reset();else if(this._moved||!(d.dist(x)<this._clickTolerance))return this._moved=!0,this._lastPoint=d,this._move(x,d)}}mouseupWindow(r){this._lastPoint&&V.mouseButton(r)===this._eventButton&&(this._moved&&V.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qa extends to{mousedown(r,d){super.mousedown(r,d),this._lastPoint&&(this._active=!0)}_correctButton(r,d){return d===0&&!r.ctrlKey}_move(r,d){return{around:d,panDelta:d.sub(r)}}}class Co extends to{_correctButton(r,d){return d===0&&r.ctrlKey||d===2}_move(r,d){let x=.8*(d.x-r.x);if(x)return this._active=!0,{bearingDelta:x}}contextmenu(r){r.preventDefault()}}class ai extends to{_correctButton(r,d){return d===0&&r.ctrlKey||d===2}_move(r,d){let x=-.5*(d.y-r.y);if(x)return this._active=!0,{pitchDelta:x}}contextmenu(r){r.preventDefault()}}class Cc{constructor(r,d){this._minTouches=r.cooperativeGestures?2:1,this._clickTolerance=r.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(r,d,x){return this._calculateTransform(r,d,x)}touchmove(r,d,x){if(this._map._cooperativeGestures&&(this._minTouches===2&&x.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(r,!1,x.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(x.length<this._minTouches))return r.preventDefault(),this._calculateTransform(r,d,x)}touchend(r,d,x){this._calculateTransform(r,d,x),this._active&&x.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,d,x){x.length>0&&(this._active=!0);let E=Yo(x,d),P=new l.pointGeometry(0,0),U=new l.pointGeometry(0,0),G=0;for(let Y in E){let se=E[Y],fe=this._touches[Y];fe&&(P._add(se),U._add(se.sub(fe)),G++,E[Y]=se)}if(this._touches=E,G<this._minTouches||!U.mag())return;let X=U.div(G);return this._sum._add(X),this._sum.mag()<this._clickTolerance?void 0:{around:P.div(G),panDelta:X}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gs{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(r){}_move(r,d,x){return{}}touchstart(r,d,x){this._firstTwoTouches||x.length<2||(this._firstTwoTouches=[x[0].identifier,x[1].identifier],this._start([d[0],d[1]]))}touchmove(r,d,x){if(!this._firstTwoTouches)return;r.preventDefault();let[E,P]=this._firstTwoTouches,U=Jo(x,d,E),G=Jo(x,d,P);if(!U||!G)return;let X=this._aroundCenter?null:U.add(G).div(2);return this._move([U,G],X,r)}touchend(r,d,x){if(!this._firstTwoTouches)return;let[E,P]=this._firstTwoTouches,U=Jo(x,d,E),G=Jo(x,d,P);U&&G||(this._active&&V.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(r){this._enabled=!0,this._aroundCenter=!!r&&r.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Jo(S,r,d){for(let x=0;x<S.length;x++)if(S[x].identifier===d)return r[x]}function qs(S,r){return Math.log(S/r)/Math.LN2}class Yt extends Gs{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(r){this._startDistance=this._distance=r[0].dist(r[1])}_move(r,d){let x=this._distance;if(this._distance=r[0].dist(r[1]),this._active||!(Math.abs(qs(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:qs(this._distance,x),pinchAround:d}}}function Qr(S,r){return 180*S.angleWith(r)/Math.PI}class zl extends Gs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(r){this._startVector=this._vector=r[0].sub(r[1]),this._minDiameter=r[0].dist(r[1])}_move(r,d){let x=this._vector;if(this._vector=r[0].sub(r[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Qr(this._vector,x),pinchAround:d}}_isBelowThreshold(r){this._minDiameter=Math.min(this._minDiameter,r.mag());let d=25/(Math.PI*this._minDiameter)*360,x=Qr(r,this._startVector);return Math.abs(x)<d}}function ou(S){return Math.abs(S.y)>Math.abs(S.x)}class en extends Gs{constructor(r){super(),this._map=r}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(r,d,x){super.touchstart(r,d,x),this._currentTouchCount=x.length}_start(r){this._lastPoints=r,ou(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,d,x){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;let E=r[0].sub(this._lastPoints[0]),P=r[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(E,P,x.timeStamp),this._valid?(this._lastPoints=r,this._active=!0,{pitchDelta:(E.y+P.y)/2*-.5}):void 0}gestureBeginsVertically(r,d,x){if(this._valid!==void 0)return this._valid;let E=r.mag()>=2,P=d.mag()>=2;if(!E&&!P)return;if(!E||!P)return this._firstMove===void 0&&(this._firstMove=x),x-this._firstMove<100&&void 0;let U=r.y>0==d.y>0;return ou(r)&&ou(d)&&U}}let ti={panStep:100,bearingStep:15,pitchStep:10};class fo{constructor(){let r=ti;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let d=0,x=0,E=0,P=0,U=0;switch(r.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:r.shiftKey?x=-1:(r.preventDefault(),P=-1);break;case 39:r.shiftKey?x=1:(r.preventDefault(),P=1);break;case 38:r.shiftKey?E=1:(r.preventDefault(),U=-1);break;case 40:r.shiftKey?E=-1:(r.preventDefault(),U=1);break;default:return}return this._rotationDisabled&&(x=0,E=0),{cameraAnimation:G=>{let X=G.getZoom();G.easeTo({duration:300,easeId:"keyboardHandler",easing:au,zoom:d?Math.round(X)+d*(r.shiftKey?2:1):X,bearing:G.getBearing()+x*this._bearingStep,pitch:G.getPitch()+E*this._pitchStep,offset:[-P*this._panStep,-U*this._panStep],center:G.getCenter()},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function au(S){return S*(2-S)}let Zs=4.000244140625;class Bo{constructor(r,d){this._map=r,this._el=r.getCanvasContainer(),this._handler=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,l.bindAll(["_onTimeout"],this)}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=r&&r.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;r.preventDefault()}let d=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY,x=l.exported.now(),E=x-(this._lastWheelEventTime||0);this._lastWheelEventTime=x,d!==0&&d%Zs==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":E>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(E*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),r.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=r,this._delta-=d,this._active||this._start(r)),r.preventDefault()}_onTimeout(r){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)}_start(r){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let d=V.mousePos(this._el,r);this._around=l.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(d)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let r=this._map.transform;if(this._delta!==0){let G=this._type==="wheel"&&Math.abs(this._delta)>Zs?this._wheelZoomRate:this._defaultZoomRate,X=2/(1+Math.exp(-Math.abs(this._delta*G)));this._delta<0&&X!==0&&(X=1/X);let Y=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(Y*X))),this._type==="wheel"&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let d=typeof this._targetZoom=="number"?this._targetZoom:r.zoom,x=this._startZoom,E=this._easing,P,U=!1;if(this._type==="wheel"&&x&&E){let G=Math.min((l.exported.now()-this._lastWheelEventTime)/200,1),X=E(G);P=l.number(x,d,X),G<1?this._frameId||(this._frameId=!0):U=!0}else P=d,U=!0;return this._active=!0,U&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!U,zoomDelta:P-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let d=l.ease;if(this._prevEase){let x=this._prevEase,E=(l.exported.now()-x.start)/x.duration,P=x.easing(E+.01)-x.easing(E),U=.27/Math.sqrt(P*P+1e-4)*.01,G=Math.sqrt(.0729-U*U);d=l.bezier(U,G,.25,1)}return this._prevEase={start:l.exported.now(),duration:r,easing:d},d}reset(){this._active=!1}}class io{constructor(r,d){this._clickZoom=r,this._tapZoom=d}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Dl{constructor(){this.reset()}reset(){this._active=!1}dblclick(r,d){return r.preventDefault(),{cameraAnimation:x=>{x.easeTo({duration:300,zoom:x.getZoom()+(r.shiftKey?-1:1),around:x.unproject(d)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nt{constructor(){this._tap=new Ma({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(r,d,x){this._swipePoint||(this._tapTime&&r.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?x.length>0&&(this._swipePoint=d[0],this._swipeTouch=x[0].identifier):this._tap.touchstart(r,d,x))}touchmove(r,d,x){if(this._tapTime){if(this._swipePoint){if(x[0].identifier!==this._swipeTouch)return;let E=d[0],P=E.y-this._swipePoint.y;return this._swipePoint=E,r.preventDefault(),this._active=!0,{zoomDelta:P/128}}}else this._tap.touchmove(r,d,x)}touchend(r,d,x){this._tapTime?this._swipePoint&&x.length===0&&this.reset():this._tap.touchend(r,d,x)&&(this._tapTime=r.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ro{constructor(r,d,x){this._el=r,this._mousePan=d,this._touchPan=x}enable(r){this._inertiaOptions=r||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class pa{constructor(r,d,x){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=d,this._mousePitch=x}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class su{constructor(r,d,x,E){this._el=r,this._touchZoom=d,this._touchRotate=x,this._tapDragZoom=E,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let Kn=S=>S.zoom||S.drag||S.pitch||S.rotate;class no extends l.Event{}function cs(S){return S.panDelta&&S.panDelta.mag()||S.zoomDelta||S.bearingDelta||S.pitchDelta}class Fl{constructor(r,d){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ju(r),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d),l.bindAll(["handleEvent","handleWindowEvent"],this);let x=this._el;this._listeners=[[x,"touchstart",{passive:!0}],[x,"touchmove",{passive:!1}],[x,"touchend",void 0],[x,"touchcancel",void 0],[x,"mousedown",void 0],[x,"mousemove",void 0],[x,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[x,"mouseover",void 0],[x,"mouseout",void 0],[x,"dblclick",void 0],[x,"click",void 0],[x,"keydown",{capture:!1}],[x,"keyup",void 0],[x,"wheel",{passive:!1}],[x,"contextmenu",void 0],[window,"blur",void 0]];for(let[E,P,U]of this._listeners)V.addEventListener(E,P,E===document?this.handleWindowEvent:this.handleEvent,U)}destroy(){for(let[r,d,x]of this._listeners)V.removeEventListener(r,d,r===document?this.handleWindowEvent:this.handleEvent,x)}_addDefaultHandlers(r){let d=this._map,x=d.getCanvasContainer();this._add("mapEvent",new Ic(d,r));let E=d.boxZoom=new kr(d,r);this._add("boxZoom",E);let P=new Yi,U=new Dl;d.doubleClickZoom=new io(U,P),this._add("tapZoom",P),this._add("clickZoom",U);let G=new Nt;this._add("tapDragZoom",G);let X=d.touchPitch=new en(d);this._add("touchPitch",X);let Y=new Co(r),se=new ai(r);d.dragRotate=new pa(r,Y,se),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",se,["mouseRotate"]);let fe=new qa(r),xe=new Cc(r,d);d.dragPan=new ro(x,fe,xe),this._add("mousePan",fe),this._add("touchPan",xe,["touchZoom","touchRotate"]);let je=new zl,Le=new Yt;d.touchZoomRotate=new su(x,Le,je,G),this._add("touchRotate",je,["touchPan","touchZoom"]),this._add("touchZoom",Le,["touchPan","touchRotate"]);let Ue=d.scrollZoom=new Bo(d,this);this._add("scrollZoom",Ue,["mousePan"]);let Qe=d.keyboard=new fo;this._add("keyboard",Qe),this._add("blockableMapEvent",new Io(d));for(let at of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])r.interactive&&r[at]&&d[at].enable(r[at])}_add(r,d,x){this._handlers.push({handlerName:r,handler:d,allowed:x}),this._handlersById[r]=d}stop(r){if(!this._updatingCamera){for(let{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[]}}isActive(){for(let{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Kn(this._eventsInProgress)||this.isZooming()}_blockedByActive(r,d,x){for(let E in r)if(E!==x&&(!d||d.indexOf(E)<0))return!0;return!1}handleWindowEvent(r){this.handleEvent(r,`${r.type}Window`)}_getMapTouches(r){let d=[];for(let x of r)this._el.contains(x.target)&&d.push(x);return d}handleEvent(r,d){if(r.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let x=r.type==="renderFrame"?void 0:r,E={needsRenderFrame:!1},P={},U={},G=r.touches,X=G?this._getMapTouches(G):void 0,Y=X?V.touchPos(this._el,X):V.mousePos(this._el,r);for(let{handlerName:xe,handler:je,allowed:Le}of this._handlers){if(!je.isEnabled())continue;let Ue;this._blockedByActive(U,Le,xe)?je.reset():je[d||r.type]&&(Ue=je[d||r.type](r,Y,X),this.mergeHandlerResult(E,P,Ue,xe,x),Ue&&Ue.needsRenderFrame&&this._triggerRenderFrame()),(Ue||je.isActive())&&(U[xe]=je)}let se={};for(let xe in this._previousActiveHandlers)U[xe]||(se[xe]=x);this._previousActiveHandlers=U,(Object.keys(se).length||cs(E))&&(this._changes.push([E,P,se]),this._triggerRenderFrame()),(Object.keys(U).length||cs(E))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:fe}=E;fe&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],fe(this._map))}mergeHandlerResult(r,d,x,E,P){if(!x)return;l.extend(r,x);let U={handlerName:E,originalEvent:x.originalEvent||P};x.zoomDelta!==void 0&&(d.zoom=U),x.panDelta!==void 0&&(d.drag=U),x.pitchDelta!==void 0&&(d.pitch=U),x.bearingDelta!==void 0&&(d.rotate=U)}_applyChanges(){let r={},d={},x={};for(let[E,P,U]of this._changes)E.panDelta&&(r.panDelta=(r.panDelta||new l.pointGeometry(0,0))._add(E.panDelta)),E.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+E.zoomDelta),E.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+E.bearingDelta),E.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+E.pitchDelta),E.around!==void 0&&(r.around=E.around),E.pinchAround!==void 0&&(r.pinchAround=E.pinchAround),E.noInertia&&(r.noInertia=E.noInertia),l.extend(d,P),l.extend(x,U);this._updateMapTransform(r,d,x),this._changes=[]}_updateMapTransform(r,d,x){let E=this._map,P=E.transform,U=E.style&&E.style.terrain;if(!(cs(r)||U&&this._drag))return this._fireEvents(d,x,!0);let{panDelta:G,zoomDelta:X,bearingDelta:Y,pitchDelta:se,around:fe,pinchAround:xe}=r;xe!==void 0&&(fe=xe),E._stop(!0),fe=fe||E.transform.centerPoint;let je=P.pointLocation(G?fe.sub(G):fe);Y&&(P.bearing+=Y),se&&(P.pitch+=se),X&&(P.zoom+=X),U?d.drag&&!this._drag?(this._drag={center:P.centerPoint,lngLat:P.pointLocation(fe),point:fe,handlerName:d.drag.handlerName},E.fire(new l.Event("freezeElevation",{freeze:!0}))):this._drag&&x[this._drag.handlerName]?(E.fire(new l.Event("freezeElevation",{freeze:!1})),this._drag=null):d.drag&&this._drag&&(P.center=P.pointLocation(P.centerPoint.sub(G))):P.setLocationAtPoint(je,fe),this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(d,x,!0)}_fireEvents(r,d,x){let E=Kn(this._eventsInProgress),P=Kn(r),U={};for(let se in r){let{originalEvent:fe}=r[se];this._eventsInProgress[se]||(U[`${se}start`]=fe),this._eventsInProgress[se]=r[se]}!E&&P&&this._fireEvent("movestart",P.originalEvent);for(let se in U)this._fireEvent(se,U[se]);P&&this._fireEvent("move",P.originalEvent);for(let se in r){let{originalEvent:fe}=r[se];this._fireEvent(se,fe)}let G={},X;for(let se in this._eventsInProgress){let{handlerName:fe,originalEvent:xe}=this._eventsInProgress[se];this._handlersById[fe].isActive()||(delete this._eventsInProgress[se],X=d[fe]||xe,G[`${se}end`]=X)}for(let se in G)this._fireEvent(se,G[se]);let Y=Kn(this._eventsInProgress);if(x&&(E||P)&&!Y){this._updatingCamera=!0;let se=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),fe=xe=>xe!==0&&-this._bearingSnap<xe&&xe<this._bearingSnap;se?(fe(se.bearing||this._map.getBearing())&&(se.bearing=0),this._map.easeTo(se,{originalEvent:X})):(this._map.fire(new l.Event("moveend",{originalEvent:X})),fe(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,d){this._map.fire(new l.Event(r,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(r=>{delete this._frameId,this.handleEvent(new no("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}let Kr={extend:(S,...r)=>l.extend(S,...r),run(S){S()},logToElement(S,r=!1,d="log"){let x=window.document.getElementById(d);x&&(r&&(x.innerHTML=""),x.innerHTML+=`<br>${S}`)}};class fr extends l.Evented{constructor(r,d){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=d.bearingSnap,l.bindAll(["_renderFrameCallback"],this)}getCenter(){return new l.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(r,d){return this.jumpTo({center:r},d)}panBy(r,d,x){return r=l.pointGeometry.convert(r).mult(-1),this.panTo(this.transform.center,l.extend({offset:r},d),x)}panTo(r,d,x){return this.easeTo(l.extend({center:r},d),x)}getZoom(){return this.transform.zoom}setZoom(r,d){return this.jumpTo({zoom:r},d),this}zoomTo(r,d,x){return this.easeTo(l.extend({zoom:r},d),x)}zoomIn(r,d){return this.zoomTo(this.getZoom()+1,r,d),this}zoomOut(r,d){return this.zoomTo(this.getZoom()-1,r,d),this}getBearing(){return this.transform.bearing}setBearing(r,d){return this.jumpTo({bearing:r},d),this}getPadding(){return this.transform.padding}setPadding(r,d){return this.jumpTo({padding:r},d),this}rotateTo(r,d,x){return this.easeTo(l.extend({bearing:r},d),x)}resetNorth(r,d){return this.rotateTo(0,l.extend({duration:1e3},r),d),this}resetNorthPitch(r,d){return this.easeTo(l.extend({bearing:0,pitch:0,duration:1e3},r),d),this}snapToNorth(r,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(r,d):this}getPitch(){return this.transform.pitch}setPitch(r,d){return this.jumpTo({pitch:r},d),this}cameraForBounds(r,d){r=l.LngLatBounds.convert(r);let x=d&&d.bearing||0;return this._cameraForBoxAndBearing(r.getNorthWest(),r.getSouthEast(),x,d)}_cameraForBoxAndBearing(r,d,x,E){let P={top:0,bottom:0,right:0,left:0};if(typeof(E=l.extend({padding:P,offset:[0,0],maxZoom:this.transform.maxZoom},E)).padding=="number"){let pt=E.padding;E.padding={top:pt,bottom:pt,right:pt,left:pt}}E.padding=l.extend(P,E.padding);let U=this.transform,G=U.padding,X=U.project(l.LngLat.convert(r)),Y=U.project(l.LngLat.convert(d)),se=X.rotate(-x*Math.PI/180),fe=Y.rotate(-x*Math.PI/180),xe=new l.pointGeometry(Math.max(se.x,fe.x),Math.max(se.y,fe.y)),je=new l.pointGeometry(Math.min(se.x,fe.x),Math.min(se.y,fe.y)),Le=xe.sub(je),Ue=(U.width-(G.left+G.right+E.padding.left+E.padding.right))/Le.x,Qe=(U.height-(G.top+G.bottom+E.padding.top+E.padding.bottom))/Le.y;if(Qe<0||Ue<0)return void l.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let at=Math.min(U.scaleZoom(U.scale*Math.min(Ue,Qe)),E.maxZoom),ht=l.pointGeometry.convert(E.offset),Ge=new l.pointGeometry((E.padding.left-E.padding.right)/2,(E.padding.top-E.padding.bottom)/2).rotate(x*Math.PI/180),yt=ht.add(Ge).mult(U.scale/U.zoomScale(at));return{center:U.unproject(X.add(Y).div(2).sub(yt)),zoom:at,bearing:x}}fitBounds(r,d,x){return this._fitInternal(this.cameraForBounds(r,d),d,x)}fitScreenCoordinates(r,d,x,E,P){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.pointGeometry.convert(r)),this.transform.pointLocation(l.pointGeometry.convert(d)),x,E),E,P)}_fitInternal(r,d,x){return r?(delete(d=l.extend(r,d)).padding,d.linear?this.easeTo(d,x):this.flyTo(d,x)):this}jumpTo(r,d){this.stop();let x=this.transform,E=!1,P=!1,U=!1;return"zoom"in r&&x.zoom!==+r.zoom&&(E=!0,x.zoom=+r.zoom),r.center!==void 0&&(x.center=l.LngLat.convert(r.center)),"bearing"in r&&x.bearing!==+r.bearing&&(P=!0,x.bearing=+r.bearing),"pitch"in r&&x.pitch!==+r.pitch&&(U=!0,x.pitch=+r.pitch),r.padding==null||x.isPaddingEqual(r.padding)||(x.padding=r.padding),this.fire(new l.Event("movestart",d)).fire(new l.Event("move",d)),E&&this.fire(new l.Event("zoomstart",d)).fire(new l.Event("zoom",d)).fire(new l.Event("zoomend",d)),P&&this.fire(new l.Event("rotatestart",d)).fire(new l.Event("rotate",d)).fire(new l.Event("rotateend",d)),U&&this.fire(new l.Event("pitchstart",d)).fire(new l.Event("pitch",d)).fire(new l.Event("pitchend",d)),this.fire(new l.Event("moveend",d))}calculateCameraOptionsFromTo(r,d,x,E=0){let P=l.MercatorCoordinate.fromLngLat(r,d),U=l.MercatorCoordinate.fromLngLat(x,E),G=U.x-P.x,X=U.y-P.y,Y=U.z-P.z,se=Math.hypot(G,X,Y);if(se===0)throw new Error("Can't calculate camera options with same From and To");let fe=Math.hypot(G,X),xe=this.transform.scaleZoom(this.transform.cameraToCenterDistance/se/this.transform.tileSize),je=180*Math.atan2(G,-X)/Math.PI,Le=180*Math.acos(fe/se)/Math.PI;return Le=Y<0?90-Le:90+Le,{center:U.toLngLat(),zoom:xe,pitch:Le,bearing:je}}easeTo(r,d){this._stop(!1,r.easeId),((r=l.extend({offset:[0,0],duration:500,easing:l.ease},r)).animate===!1||!r.essential&&l.exported.prefersReducedMotion)&&(r.duration=0);let x=this.transform,E=this.getZoom(),P=this.getBearing(),U=this.getPitch(),G=this.getPadding(),X="zoom"in r?+r.zoom:E,Y="bearing"in r?this._normalizeBearing(r.bearing,P):P,se="pitch"in r?+r.pitch:U,fe="padding"in r?r.padding:x.padding,xe=l.pointGeometry.convert(r.offset),je=x.centerPoint.add(xe),Le=x.pointLocation(je),Ue=l.LngLat.convert(r.center||Le);this._normalizeCenter(Ue);let Qe=x.project(Le),at=x.project(Ue).sub(Qe),ht=x.zoomScale(X-E),Ge,yt;r.around&&(Ge=l.LngLat.convert(r.around),yt=x.locationPoint(Ge));let pt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||X!==E,this._rotating=this._rotating||P!==Y,this._pitching=this._pitching||se!==U,this._padding=!x.isPaddingEqual(fe),this._easeId=r.easeId,this._prepareEase(d,r.noMoveStart,pt),this._ease(vt=>{if(this._zooming&&(x.zoom=l.number(E,X,vt)),this._rotating&&(x.bearing=l.number(P,Y,vt)),this._pitching&&(x.pitch=l.number(U,se,vt)),this._padding&&(x.interpolatePadding(G,fe,vt),je=x.centerPoint.add(xe)),Ge)x.setLocationAtPoint(Ge,yt);else{let St=x.zoomScale(x.zoom-E),kt=X>E?Math.min(2,ht):Math.max(.5,ht),xt=Math.pow(kt,1-vt),ii=x.unproject(Qe.add(at.mult(vt*xt)).mult(St));x.setLocationAtPoint(x.renderWorldCopies?ii.wrap():ii,je)}this._fireMoveEvents(d)},vt=>{this._afterEase(d,vt)},r),this}_prepareEase(r,d,x={}){this._moving=!0,this.fire(new l.Event("freezeElevation",{freeze:!0})),d||x.moving||this.fire(new l.Event("movestart",r)),this._zooming&&!x.zooming&&this.fire(new l.Event("zoomstart",r)),this._rotating&&!x.rotating&&this.fire(new l.Event("rotatestart",r)),this._pitching&&!x.pitching&&this.fire(new l.Event("pitchstart",r))}_fireMoveEvents(r){this.fire(new l.Event("move",r)),this._zooming&&this.fire(new l.Event("zoom",r)),this._rotating&&this.fire(new l.Event("rotate",r)),this._pitching&&this.fire(new l.Event("pitch",r))}_afterEase(r,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId,this.fire(new l.Event("freezeElevation",{freeze:!1}));let x=this._zooming,E=this._rotating,P=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,x&&this.fire(new l.Event("zoomend",r)),E&&this.fire(new l.Event("rotateend",r)),P&&this.fire(new l.Event("pitchend",r)),this.fire(new l.Event("moveend",r))}flyTo(r,d){if(!r.essential&&l.exported.prefersReducedMotion){let I=l.pick(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(I,d)}this.stop(),r=l.extend({offset:[0,0],speed:1.2,curve:1.42,easing:l.ease},r);let x=this.transform,E=this.getZoom(),P=this.getBearing(),U=this.getPitch(),G=this.getPadding(),X="zoom"in r?l.clamp(+r.zoom,x.minZoom,x.maxZoom):E,Y="bearing"in r?this._normalizeBearing(r.bearing,P):P,se="pitch"in r?+r.pitch:U,fe="padding"in r?r.padding:x.padding,xe=x.zoomScale(X-E),je=l.pointGeometry.convert(r.offset),Le=x.centerPoint.add(je),Ue=x.pointLocation(Le),Qe=l.LngLat.convert(r.center||Ue);this._normalizeCenter(Qe);let at=x.project(Ue),ht=x.project(Qe).sub(at),Ge=r.curve,yt=Math.max(x.width,x.height),pt=yt/xe,vt=ht.mag();if("minZoom"in r){let I=l.clamp(Math.min(r.minZoom,E,X),x.minZoom,x.maxZoom),R=yt/x.zoomScale(I-E);Ge=Math.sqrt(R/vt*2)}let St=Ge*Ge;function kt(I){let R=(pt*pt-yt*yt+(I?-1:1)*St*St*vt*vt)/(2*(I?pt:yt)*St*vt);return Math.log(Math.sqrt(R*R+1)-R)}function xt(I){return(Math.exp(I)-Math.exp(-I))/2}function ii(I){return(Math.exp(I)+Math.exp(-I))/2}let h=kt(0),f=function(I){return ii(h)/ii(h+Ge*I)},p=function(I){return yt*((ii(h)*(xt(R=h+Ge*I)/ii(R))-xt(h))/St)/vt;var R},_=(kt(1)-h)/Ge;if(Math.abs(vt)<1e-6||!isFinite(_)){if(Math.abs(yt-pt)<1e-6)return this.easeTo(r,d);let I=pt<yt?-1:1;_=Math.abs(Math.log(pt/yt))/Ge,p=function(){return 0},f=function(R){return Math.exp(I*Ge*R)}}return r.duration="duration"in r?+r.duration:1e3*_/("screenSpeed"in r?+r.screenSpeed/Ge:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0),this._zooming=!0,this._rotating=P!==Y,this._pitching=se!==U,this._padding=!x.isPaddingEqual(fe),this._prepareEase(d,!1),this._ease(I=>{let R=I*_,F=1/f(R);x.zoom=I===1?X:E+x.scaleZoom(F),this._rotating&&(x.bearing=l.number(P,Y,I)),this._pitching&&(x.pitch=l.number(U,se,I)),this._padding&&(x.interpolatePadding(G,fe,I),Le=x.centerPoint.add(je));let N=I===1?Qe:x.unproject(at.add(ht.mult(p(R))).mult(F));x.setLocationAtPoint(x.renderWorldCopies?N.wrap():N,Le),this._fireMoveEvents(d)},()=>this._afterEase(d),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(r,d){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let x=this._onEaseEnd;delete this._onEaseEnd,x.call(this,d)}if(!r){let x=this.handlers;x&&x.stop(!1)}return this}_ease(r,d,x){x.animate===!1||x.duration===0?(r(1),d()):(this._easeStart=l.exported.now(),this._easeOptions=x,this._onEaseFrame=r,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let r=Math.min((l.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,d){r=l.wrap(r,-180,180);let x=Math.abs(r-d);return Math.abs(r-360-d)<x&&(r-=360),Math.abs(r+360-d)<x&&(r+=360),r}_normalizeCenter(r){let d=this.transform;if(!d.renderWorldCopies||d.lngRange)return;let x=r.lng-d.center.lng;r.lng+=x>180?-360:x<-180?360:0}}class cl{constructor(r={}){this.options=r,l.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(r){return this._map=r,this._compact=this.options&&this.options.compact,this._container=V.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=V.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=V.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){V.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(r,d){let x=this._map._getUIString(`AttributionControl.${d}`);r.title=x,r.setAttribute("aria-label",x)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(r){!r||r.sourceDataType!=="metadata"&&r.sourceDataType!=="visibility"&&r.dataType!=="style"&&r.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let r=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=r.concat(this.options.customAttribution.map(E=>typeof E!="string"?"":E)):typeof this.options.customAttribution=="string"&&r.push(this.options.customAttribution)),this._map.style.stylesheet){let E=this._map.style.stylesheet;this.styleOwner=E.owner,this.styleId=E.id}let d=this._map.style.sourceCaches;for(let E in d){let P=d[E];if(P.used||P.usedForTerrain){let U=P.getSource();U.attribution&&r.indexOf(U.attribution)<0&&r.push(U.attribution)}}r=r.filter(E=>String(E).trim()),r.sort((E,P)=>E.length-P.length),r=r.filter((E,P)=>{for(let U=P+1;U<r.length;U++)if(r[U].indexOf(E)>=0)return!1;return!0});let x=r.join(" | ");x!==this._attribHTML&&(this._attribHTML=x,r.length?(this._innerContainer.innerHTML=x,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class hs{constructor(r={}){this.options=r,l.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(r){this._map=r,this._compact=this.options&&this.options.compact,this._container=V.create("div","maplibregl-ctrl mapboxgl-ctrl");let d=V.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return d.target="_blank",d.rel="noopener nofollow",d.href="https://maplibre.org/",d.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),d.setAttribute("rel","noopener nofollow"),this._container.appendChild(d),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){V.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){let r=this._container.children;if(r.length){let d=r[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact","mapboxgl-compact"):d.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class lu{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){let d=++this._id;return this._queue.push({callback:r,id:d,cancelled:!1}),d}remove(r){let d=this._currentlyRunning,x=d?this._queue.concat(d):this._queue;for(let E of x)if(E.id===r)return void(E.cancelled=!0)}run(r=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let d=this._currentlyRunning=this._queue;this._queue=[];for(let x of d)if(!x.cancelled&&(x.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let uu={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Qo={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Uo={showCompass:!0,showZoom:!0,visualizePitch:!1};class Di{constructor(r,d,x=!1){this._clickTolerance=10,this.element=d,this.mouseRotate=new Co({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,x&&(this.mousePitch=new ai({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),l.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),V.addEventListener(d,"mousedown",this.mousedown),V.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),V.addEventListener(d,"touchmove",this.touchmove),V.addEventListener(d,"touchend",this.touchend),V.addEventListener(d,"touchcancel",this.reset)}down(r,d){this.mouseRotate.mousedown(r,d),this.mousePitch&&this.mousePitch.mousedown(r,d),V.disableDrag()}move(r,d){let x=this.map,E=this.mouseRotate.mousemoveWindow(r,d);if(E&&E.bearingDelta&&x.setBearing(x.getBearing()+E.bearingDelta),this.mousePitch){let P=this.mousePitch.mousemoveWindow(r,d);P&&P.pitchDelta&&x.setPitch(x.getPitch()+P.pitchDelta)}}off(){let r=this.element;V.removeEventListener(r,"mousedown",this.mousedown),V.removeEventListener(r,"touchstart",this.touchstart,{passive:!1}),V.removeEventListener(r,"touchmove",this.touchmove),V.removeEventListener(r,"touchend",this.touchend),V.removeEventListener(r,"touchcancel",this.reset),this.offTemp()}offTemp(){V.enableDrag(),V.removeEventListener(window,"mousemove",this.mousemove),V.removeEventListener(window,"mouseup",this.mouseup)}mousedown(r){this.down(l.extend({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),V.mousePos(this.element,r)),V.addEventListener(window,"mousemove",this.mousemove),V.addEventListener(window,"mouseup",this.mouseup)}mousemove(r){this.move(r,V.mousePos(this.element,r))}mouseup(r){this.mouseRotate.mouseupWindow(r),this.mousePitch&&this.mousePitch.mouseupWindow(r),this.offTemp()}touchstart(r){r.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=V.touchPos(this.element,r.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>r.preventDefault()},this._startPos))}touchmove(r){r.targetTouches.length!==1?this.reset():(this._lastPos=V.touchPos(this.element,r.targetTouches)[0],this.move({preventDefault:()=>r.preventDefault()},this._lastPos))}touchend(r){r.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Ao(S,r,d){if(S=new l.LngLat(S.lng,S.lat),r){let x=new l.LngLat(S.lng-360,S.lat),E=new l.LngLat(S.lng+360,S.lat),P=d.locationPoint(S).distSqr(r);d.locationPoint(x).distSqr(r)<P?S=x:d.locationPoint(E).distSqr(r)<P&&(S=E)}for(;Math.abs(S.lng-d.center.lng)>180;){let x=d.locationPoint(S);if(x.x>=0&&x.y>=0&&x.x<=d.width&&x.y<=d.height)break;S.lng>d.center.lng?S.lng-=360:S.lng+=360}return S}let si={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function hi(S,r,d){let x=S.classList;for(let E in si)x.remove(`maplibregl-${d}-anchor-${E}`,`mapboxgl-${d}-anchor-${E}`);x.add(`maplibregl-${d}-anchor-${r}`,`mapboxgl-${d}-anchor-${r}`)}class ea extends l.Evented{constructor(r,d){if(super(),(r instanceof HTMLElement||d)&&(r=l.extend({element:r},d)),l.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment!=="auto"?r.pitchAlignment:this._rotationAlignment,r&&r.element)this._element=r.element,this._offset=l.pointGeometry.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=V.create("div"),this._element.setAttribute("aria-label","Map marker");let x=V.createNS("http://www.w3.org/2000/svg","svg"),E=41,P=27;x.setAttributeNS(null,"display","block"),x.setAttributeNS(null,"height",`${E}px`),x.setAttributeNS(null,"width",`${P}px`),x.setAttributeNS(null,"viewBox",`0 0 ${P} ${E}`);let U=V.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"stroke","none"),U.setAttributeNS(null,"stroke-width","1"),U.setAttributeNS(null,"fill","none"),U.setAttributeNS(null,"fill-rule","evenodd");let G=V.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"fill-rule","nonzero");let X=V.createNS("http://www.w3.org/2000/svg","g");X.setAttributeNS(null,"transform","translate(3.0, 29.0)"),X.setAttributeNS(null,"fill","#000000");let Y=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let ht of Y){let Ge=V.createNS("http://www.w3.org/2000/svg","ellipse");Ge.setAttributeNS(null,"opacity","0.04"),Ge.setAttributeNS(null,"cx","10.5"),Ge.setAttributeNS(null,"cy","5.80029008"),Ge.setAttributeNS(null,"rx",ht.rx),Ge.setAttributeNS(null,"ry",ht.ry),X.appendChild(Ge)}let se=V.createNS("http://www.w3.org/2000/svg","g");se.setAttributeNS(null,"fill",this._color);let fe=V.createNS("http://www.w3.org/2000/svg","path");fe.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),se.appendChild(fe);let xe=V.createNS("http://www.w3.org/2000/svg","g");xe.setAttributeNS(null,"opacity","0.25"),xe.setAttributeNS(null,"fill","#000000");let je=V.createNS("http://www.w3.org/2000/svg","path");je.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),xe.appendChild(je);let Le=V.createNS("http://www.w3.org/2000/svg","g");Le.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Le.setAttributeNS(null,"fill","#FFFFFF");let Ue=V.createNS("http://www.w3.org/2000/svg","g");Ue.setAttributeNS(null,"transform","translate(8.0, 8.0)");let Qe=V.createNS("http://www.w3.org/2000/svg","circle");Qe.setAttributeNS(null,"fill","#000000"),Qe.setAttributeNS(null,"opacity","0.25"),Qe.setAttributeNS(null,"cx","5.5"),Qe.setAttributeNS(null,"cy","5.5"),Qe.setAttributeNS(null,"r","5.4999962");let at=V.createNS("http://www.w3.org/2000/svg","circle");at.setAttributeNS(null,"fill","#FFFFFF"),at.setAttributeNS(null,"cx","5.5"),at.setAttributeNS(null,"cy","5.5"),at.setAttributeNS(null,"r","5.4999962"),Ue.appendChild(Qe),Ue.appendChild(at),G.appendChild(X),G.appendChild(se),G.appendChild(xe),G.appendChild(Le),G.appendChild(Ue),x.appendChild(G),x.setAttributeNS(null,"height",E*this._scale+"px"),x.setAttributeNS(null,"width",P*this._scale+"px"),this._element.appendChild(x),this._offset=l.pointGeometry.convert(r&&r.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",x=>{x.preventDefault()}),this._element.addEventListener("mousedown",x=>{x.preventDefault()}),hi(this._element,this._anchor,"marker"),this._popup=null}addTo(r){return this.remove(),this._map=r,r.getCanvasContainer().appendChild(this._element),r.on("move",this._update),r.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),V.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=l.LngLat.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(r){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),r){if(!("offset"in r.options)){let E=Math.sqrt(Math.pow(13.5,2)/2);r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[E,-1*(38.1-13.5+E)],"bottom-right":[-E,-1*(38.1-13.5+E)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(r){let d=r.code,x=r.charCode||r.keyCode;d!=="Space"&&d!=="Enter"&&x!==32&&x!==13||this.togglePopup()}_onMapClick(r){let d=r.originalEvent.target,x=this._element;this._popup&&(d===x||x.contains(d))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let r=this._popup;return r?(r.isOpen()?r.remove():r.addTo(this._map),this):this}_update(r){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Ao(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let d="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?d=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(d=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let x="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?x="rotateX(0deg)":this._pitchAlignment==="map"&&(x=`rotateX(${this._map.getPitch()}deg)`),r&&r.type!=="moveend"||(this._pos=this._pos.round()),V.setTransform(this._element,`${si[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${x} ${d}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{let E=this._map.unproject(this._pos),P=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=E.distanceTo(this._lngLat)>20*P?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(r){return this._offset=l.pointGeometry.convert(r),this._update(),this}_onMove(r){if(!this._isDragging){let d=this._clickTolerance||this._map._clickTolerance;this._isDragging=r.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=r.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new l.Event("dragstart"))),this.fire(new l.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.Event("dragend")),this._state="inactive"}_addDragHandler(r){this._element.contains(r.originalEvent.target)&&(r.preventDefault(),this._positionDelta=r.point.sub(this._pos).add(this._offset),this._pointerdownPos=r.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(r){return this._draggable=!!r,this._map&&(r?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(r){return this._rotation=r||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r&&r!=="auto"?r:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}let Pa={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Vn,yr=0,ta=!1,ui={maxWidth:100,unit:"metric"};function li(S,r,d){let x=d&&d.maxWidth||100,E=S._container.clientHeight/2,P=S.unproject([0,E]),U=S.unproject([x,E]),G=P.distanceTo(U);if(d&&d.unit==="imperial"){let X=3.2808*G;X>5280?da(r,x,X/5280,S._getUIString("ScaleControl.Miles")):da(r,x,X,S._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?da(r,x,G/1852,S._getUIString("ScaleControl.NauticalMiles")):G>=1e3?da(r,x,G/1e3,S._getUIString("ScaleControl.Kilometers")):da(r,x,G,S._getUIString("ScaleControl.Meters"))}function da(S,r,d,x){let E=function(P){let U=Math.pow(10,`${Math.floor(P)}`.length-1),G=P/U;return G=G>=10?10:G>=5?5:G>=3?3:G>=2?2:G>=1?1:function(X){let Y=Math.pow(10,Math.ceil(-Math.log(X)/Math.LN10));return Math.round(X*Y)/Y}(G),U*G}(d);S.style.width=r*(E/d)+"px",S.innerHTML=`${E}&nbsp;${x}`}let nr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},wr=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Tn(S){if(S){if(typeof S=="number"){let r=Math.round(Math.sqrt(.5*Math.pow(S,2)));return{center:new l.pointGeometry(0,0),top:new l.pointGeometry(0,S),"top-left":new l.pointGeometry(r,r),"top-right":new l.pointGeometry(-r,r),bottom:new l.pointGeometry(0,-S),"bottom-left":new l.pointGeometry(r,-r),"bottom-right":new l.pointGeometry(-r,-r),left:new l.pointGeometry(S,0),right:new l.pointGeometry(-S,0)}}if(S instanceof l.pointGeometry||Array.isArray(S)){let r=l.pointGeometry.convert(S);return{center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return{center:l.pointGeometry.convert(S.center||[0,0]),top:l.pointGeometry.convert(S.top||[0,0]),"top-left":l.pointGeometry.convert(S["top-left"]||[0,0]),"top-right":l.pointGeometry.convert(S["top-right"]||[0,0]),bottom:l.pointGeometry.convert(S.bottom||[0,0]),"bottom-left":l.pointGeometry.convert(S["bottom-left"]||[0,0]),"bottom-right":l.pointGeometry.convert(S["bottom-right"]||[0,0]),left:l.pointGeometry.convert(S.left||[0,0]),right:l.pointGeometry.convert(S.right||[0,0])}}return Tn(new l.pointGeometry(0,0))}let oo={supported:M,setRTLTextPlugin:l.setRTLTextPlugin,getRTLTextPluginStatus:l.getRTLTextPluginStatus,Map:class extends fr{constructor(S){var r;if(l.PerformanceUtils.mark(l.PerformanceMarkers.create),(S=l.extend({},Qo,S)).minZoom!=null&&S.maxZoom!=null&&S.minZoom>S.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(S.minPitch!=null&&S.maxPitch!=null&&S.minPitch>S.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(S.minPitch!=null&&S.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(S.maxPitch!=null&&S.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ss(S.minZoom,S.maxZoom,S.minPitch,S.maxPitch,S.renderWorldCopies),{bearingSnap:S.bearingSnap}),this._interactive=S.interactive,this._cooperativeGestures=S.cooperativeGestures,this._maxTileCacheSize=S.maxTileCacheSize,this._failIfMajorPerformanceCaveat=S.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=S.preserveDrawingBuffer,this._antialias=S.antialias,this._trackResize=S.trackResize,this._bearingSnap=S.bearingSnap,this._refreshExpiredTiles=S.refreshExpiredTiles,this._fadeDuration=S.fadeDuration,this._crossSourceCollisions=S.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=S.collectResourceTiming,this._renderTaskQueue=new lu,this._controls=[],this._mapId=l.uniqueId(),this._locale=l.extend({},uu,S.locale),this._clickTolerance=S.clickTolerance,this._pixelRatio=(r=S.pixelRatio)!==null&&r!==void 0?r:devicePixelRatio,this._requestManager=new de(S.transformRequest),typeof S.container=="string"){if(this._container=document.getElementById(S.container),!this._container)throw new Error(`Container '${S.container}' not found.`)}else{if(!(S.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=S.container}if(S.maxBounds&&this.setMaxBounds(S.maxBounds),l.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Fl(this,S),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=S.hash&&new ru(typeof S.hash=="string"&&S.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:S.center,zoom:S.zoom,bearing:S.bearing,pitch:S.pitch}),S.bounds&&(this.resize(),this.fitBounds(S.bounds,l.extend({},S.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=S.localIdeographFontFamily,S.style&&this.setStyle(S.style,{localIdeographFontFamily:S.localIdeographFontFamily}),S.attributionControl&&this.addControl(new cl({customAttribution:S.customAttribution})),S.maplibreLogo&&this.addControl(new hs,S.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",d=>{this._update(d.dataType==="style"),this.fire(new l.Event(`${d.dataType}data`,d))}),this.on("dataloading",d=>{this.fire(new l.Event(`${d.dataType}dataloading`,d))}),this.on("dataabort",d=>{this.fire(new l.Event("sourcedataabort",d))})}_getMapId(){return this._mapId}addControl(S,r){if(r===void 0&&(r=S.getDefaultPosition?S.getDefaultPosition():"top-right"),!S||!S.onAdd)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let d=S.onAdd(this);this._controls.push(S);let x=this._controlPositions[r];return r.indexOf("bottom")!==-1?x.insertBefore(d,x.firstChild):x.appendChild(d),this}removeControl(S){if(!S||!S.onRemove)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(S);return r>-1&&this._controls.splice(r,1),S.onRemove(this),this}hasControl(S){return this._controls.indexOf(S)>-1}calculateCameraOptionsFromTo(S,r,d,x){return x==null&&this.style.terrain&&(x=this.transform.getElevation(d,this.style.terrain)),super.calculateCameraOptionsFromTo(S,r,d,x)}resize(S){let r=this._containerDimensions(),d=r[0],x=r[1];this._resizeCanvas(d,x,this.getPixelRatio()),this.transform.resize(d,x),this.painter.resize(d,x,this.getPixelRatio());let E=!this._moving;return E&&(this.stop(),this.fire(new l.Event("movestart",S)).fire(new l.Event("move",S))),this.fire(new l.Event("resize",S)),E&&this.fire(new l.Event("moveend",S)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(S){let[r,d]=this._containerDimensions();this._pixelRatio=S,this._resizeCanvas(r,d,S),this.painter.resize(r,d,S)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(S){return this.transform.setMaxBounds(l.LngLatBounds.convert(S)),this._update()}setMinZoom(S){if((S=S??-2)>=-2&&S<=this.transform.maxZoom)return this.transform.minZoom=S,this._update(),this.getZoom()<S&&this.setZoom(S),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(S){if((S=S??22)>=this.transform.minZoom)return this.transform.maxZoom=S,this._update(),this.getZoom()>S&&this.setZoom(S),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(S){if((S=S??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(S>=0&&S<=this.transform.maxPitch)return this.transform.minPitch=S,this._update(),this.getPitch()<S&&this.setPitch(S),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(S){if((S=S??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(S>=this.transform.minPitch)return this.transform.maxPitch=S,this._update(),this.getPitch()>S&&this.setPitch(S),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(S){return this.transform.renderWorldCopies=S,this._update()}project(S){return this.transform.locationPoint(l.LngLat.convert(S),this.style&&this.style.terrain)}unproject(S){return this.transform.pointLocation(l.pointGeometry.convert(S),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(S,r,d){if(S==="mouseenter"||S==="mouseover"){let x=!1;return{layer:r,listener:d,delegates:{mousemove:P=>{let U=this.getLayer(r)?this.queryRenderedFeatures(P.point,{layers:[r]}):[];U.length?x||(x=!0,d.call(this,new po(S,this,P.originalEvent,{features:U}))):x=!1},mouseout:()=>{x=!1}}}}if(S==="mouseleave"||S==="mouseout"){let x=!1;return{layer:r,listener:d,delegates:{mousemove:U=>{(this.getLayer(r)?this.queryRenderedFeatures(U.point,{layers:[r]}):[]).length?x=!0:x&&(x=!1,d.call(this,new po(S,this,U.originalEvent)))},mouseout:U=>{x&&(x=!1,d.call(this,new po(S,this,U.originalEvent)))}}}}{let x=E=>{let P=this.getLayer(r)?this.queryRenderedFeatures(E.point,{layers:[r]}):[];P.length&&(E.features=P,d.call(this,E),delete E.features)};return{layer:r,listener:d,delegates:{[S]:x}}}}on(S,r,d){if(d===void 0)return super.on(S,r);let x=this._createDelegatedListener(S,r,d);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[S]=this._delegatedListeners[S]||[],this._delegatedListeners[S].push(x);for(let E in x.delegates)this.on(E,x.delegates[E]);return this}once(S,r,d){if(d===void 0)return super.once(S,r);let x=this._createDelegatedListener(S,r,d);for(let E in x.delegates)this.once(E,x.delegates[E]);return this}off(S,r,d){return d===void 0?super.off(S,r):(this._delegatedListeners&&this._delegatedListeners[S]&&(x=>{let E=this._delegatedListeners[S];for(let P=0;P<E.length;P++){let U=E[P];if(U.layer===r&&U.listener===d){for(let G in U.delegates)this.off(G,U.delegates[G]);return E.splice(P,1),this}}})(),this)}queryRenderedFeatures(S,r){if(!this.style)return[];let d;if(r!==void 0||S===void 0||S instanceof l.pointGeometry||Array.isArray(S)||(r=S,S=void 0),r=r||{},(S=S||[[0,0],[this.transform.width,this.transform.height]])instanceof l.pointGeometry||typeof S[0]=="number")d=[l.pointGeometry.convert(S)];else{let x=l.pointGeometry.convert(S[0]),E=l.pointGeometry.convert(S[1]);d=[x,new l.pointGeometry(E.x,x.y),E,new l.pointGeometry(x.x,E.y),x]}return this.style.queryRenderedFeatures(d,r,this.transform)}querySourceFeatures(S,r){return this.style.querySourceFeatures(S,r)}setStyle(S,r){return(r=l.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},r)).diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&S?(this._diffStyle(S,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(S,r))}setTransformRequest(S){return this._requestManager.setTransformRequest(S),this}_getUIString(S){let r=this._locale[S];if(r==null)throw new Error(`Missing UI string '${S}'`);return r}_updateStyle(S,r){return this.style&&(this.style.setEventedParent(null),this.style._remove()),S?(this.style=new En(this,r||{}),this.style.setEventedParent(this,{style:this.style}),typeof S=="string"?this.style.loadURL(S):this.style.loadJSON(S),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new En(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(S,r){if(typeof S=="string"){let d=this._requestManager.transformRequest(S,l.ResourceType.Style);l.getJSON(d,(x,E)=>{x?this.fire(new l.ErrorEvent(x)):E&&this._updateDiff(E,r)})}else typeof S=="object"&&this._updateDiff(S,r)}_updateDiff(S,r){try{this.style.setState(S)&&this._update(!0)}catch(d){l.warnOnce(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(S,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.warnOnce("There is no style added to the map.")}addSource(S,r){return this._lazyInitEmptyStyle(),this.style.addSource(S,r),this._update(!0)}isSourceLoaded(S){let r=this.style&&this.style.sourceCaches[S];if(r!==void 0)return r.loaded();this.fire(new l.ErrorEvent(new Error(`There is no source with ID '${S}'`)))}setTerrain(S){return this.style.setTerrain(S),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){let S=this.style&&this.style.sourceCaches;for(let r in S){let d=S[r]._tiles;for(let x in d){let E=d[x];if(E.state!=="loaded"&&E.state!=="errored")return!1}}return!0}addSourceType(S,r,d){return this._lazyInitEmptyStyle(),this.style.addSourceType(S,r,d)}removeSource(S){return this.style.removeSource(S),this._update(!0)}getSource(S){return this.style.getSource(S)}addImage(S,r,{pixelRatio:d=1,sdf:x=!1,stretchX:E,stretchY:P,content:U}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||l.isImageBitmap(r)){let{width:G,height:X,data:Y}=l.exported.getImageData(r);this.style.addImage(S,{data:new l.RGBAImage({width:G,height:X},Y),pixelRatio:d,stretchX:E,stretchY:P,content:U,sdf:x,version:0})}else{if(r.width===void 0||r.height===void 0)return this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:G,height:X,data:Y}=r,se=r;this.style.addImage(S,{data:new l.RGBAImage({width:G,height:X},new Uint8Array(Y)),pixelRatio:d,stretchX:E,stretchY:P,content:U,sdf:x,version:0,userImage:se}),se.onAdd&&se.onAdd(this,S)}}}updateImage(S,r){let d=this.style.getImage(S);if(!d)return this.fire(new l.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let x=r instanceof HTMLImageElement||l.isImageBitmap(r)?l.exported.getImageData(r):r,{width:E,height:P,data:U}=x;if(E===void 0||P===void 0)return this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(E!==d.data.width||P!==d.data.height)return this.fire(new l.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));let G=!(r instanceof HTMLImageElement||l.isImageBitmap(r));d.data.replace(U,G),this.style.updateImage(S,d)}hasImage(S){return S?!!this.style.getImage(S):(this.fire(new l.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(S){this.style.removeImage(S)}loadImage(S,r){l.getImage(this._requestManager.transformRequest(S,l.ResourceType.Image),r)}listImages(){return this.style.listImages()}addLayer(S,r){return this._lazyInitEmptyStyle(),this.style.addLayer(S,r),this._update(!0)}moveLayer(S,r){return this.style.moveLayer(S,r),this._update(!0)}removeLayer(S){return this.style.removeLayer(S),this._update(!0)}getLayer(S){return this.style.getLayer(S)}setLayerZoomRange(S,r,d){return this.style.setLayerZoomRange(S,r,d),this._update(!0)}setFilter(S,r,d={}){return this.style.setFilter(S,r,d),this._update(!0)}getFilter(S){return this.style.getFilter(S)}setPaintProperty(S,r,d,x={}){return this.style.setPaintProperty(S,r,d,x),this._update(!0)}getPaintProperty(S,r){return this.style.getPaintProperty(S,r)}setLayoutProperty(S,r,d,x={}){return this.style.setLayoutProperty(S,r,d,x),this._update(!0)}getLayoutProperty(S,r){return this.style.getLayoutProperty(S,r)}setLight(S,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(S,r),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(S,r){return this.style.setFeatureState(S,r),this._update()}removeFeatureState(S,r){return this.style.removeFeatureState(S,r),this._update()}getFeatureState(S){return this.style.getFeatureState(S)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let S=0,r=0;return this._container&&(S=this._container.clientWidth||400,r=this._container.clientHeight||300),[S,r]}_setupContainer(){let S=this._container;S.classList.add("maplibregl-map","mapboxgl-map");let r=this._canvasContainer=V.create("div","maplibregl-canvas-container mapboxgl-canvas-container",S);this._interactive&&r.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=V.create("canvas","maplibregl-canvas mapboxgl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");let d=this._containerDimensions();this._resizeCanvas(d[0],d[1],this.getPixelRatio());let x=this._controlContainer=V.create("div","maplibregl-control-container mapboxgl-control-container",S),E=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(P=>{E[P]=V.create("div",`maplibregl-ctrl-${P} mapboxgl-ctrl-${P}`,x)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){let S=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=V.create("div","maplibregl-cooperative-gesture-screen",S);let r="Control",d=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(d=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",r="Meta"),this._cooperativeGesturesScreen.innerHTML=`
1073
1073
  <div class="maplibregl-desktop-message">${d}</div>
1074
1074
  <div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
1075
- `,document.addEventListener("keydown",x=>{x.key===r&&(this._metaPress=!0)}),document.addEventListener("keyup",x=>{x.key===r&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",x=>{this._onCooperativeGesture(x,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(S,r,d){this._canvas.width=d*S,this._canvas.height=d*r,this._canvas.style.width=`${S}px`,this._canvas.style.height=`${r}px`}_setupPainter(){let S=l.extend({},M.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl",S)||this._canvas.getContext("experimental-webgl",S);r?(this.painter=new iu(r,this.transform),l.exported$1.testSupport(r)):this.fire(new l.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(S){S.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.Event("webglcontextlost",{originalEvent:S}))}_contextRestored(S){this._setupPainter(),this.resize(),this._update(),this.fire(new l.Event("webglcontextrestored",{originalEvent:S}))}_onMapScroll(S){if(S.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(S,r,d){return!r&&d<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(S){return this.style?(this._styleDirty=this._styleDirty||S,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(S){return this._update(),this._renderTaskQueue.add(S)}_cancelRenderFrame(S){this._renderTaskQueue.remove(S)}_render(S){let r,d=0,x=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(r=x.createQueryEXT(),x.beginQueryEXT(x.TIME_ELAPSED_EXT,r),d=l.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(S),this._removed)return;let E=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let U=this.transform.zoom,G=l.exported.now();this.style.zoomHistory.update(U,G);let X=new l.EvaluationParameters(U,{now:G,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Y=X.crossFadingFactor();Y===1&&Y===this._crossFadingFactor||(E=!0,this._crossFadingFactor=Y),this.style.update(X)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new l.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.load),this.fire(new l.Event("load"))),this.style&&(this.style.hasTransitions()||E)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){let U=l.exported.now()-d;x.endQueryEXT(x.TIME_ELAPSED_EXT,r),setTimeout(()=>{let G=x.getQueryObjectEXT(r,x.QUERY_RESULT_EXT)/1e6;x.deleteQueryEXT(r),this.fire(new l.Event("gpu-timing-frame",{cpuTime:U,gpuTime:G}))},50)}if(this.listens("gpu-timing-layer")){let U=this.painter.collectGpuTimers();setTimeout(()=>{let G=this.painter.queryGpuTimers(U);this.fire(new l.Event("gpu-timing-layer",{layerTimes:G}))},50)}let P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.Event("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let r of this._controls)r.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));let S=this.painter.context.gl.getExtension("WEBGL_lose_context");S&&S.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),V.remove(this._canvasContainer),V.remove(this._controlContainer),this._cooperativeGestures&&V.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),l.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new l.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=l.exported.frame(S=>{l.PerformanceUtils.frame(S),this._frame=null,this._render(S)}))}_onWindowOnline(){this._update()}_onWindowResize(S){this._trackResize&&this.resize({originalEvent:S})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(S){this._showTileBoundaries!==S&&(this._showTileBoundaries=S,this._update())}get showPadding(){return!!this._showPadding}set showPadding(S){this._showPadding!==S&&(this._showPadding=S,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(S){this._showCollisionBoxes!==S&&(this._showCollisionBoxes=S,S?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(S){this._showOverdrawInspector!==S&&(this._showOverdrawInspector=S,this._update())}get repaint(){return!!this._repaint}set repaint(S){this._repaint!==S&&(this._repaint=S,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(S){this._vertices=S,this._update()}_setCacheLimits(S,r){l.setCacheLimits(S,r)}get version(){return"2.4.0"}},NavigationControl:class{constructor(S){this.options=l.extend({},Uo,S),this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(l.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",r=>this._map.zoomIn({},{originalEvent:r})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",r=>this._map.zoomOut({},{originalEvent:r})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(l.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",r=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:r}):this._map.resetNorth({},{originalEvent:r})}),this._compassIcon=V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let S=this._map.getZoom(),r=S===this._map.getMaxZoom(),d=S===this._map.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())}_rotateCompassArrow(){let S=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=S}onAdd(S){return this._map=S,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Di(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){V.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(S,r){let d=V.create("button",S,this._container);return d.type="button",d.addEventListener("click",r),d}_setButtonTitle(S,r){let d=this._map._getUIString(`NavigationControl.${r}`);S.title=d,S.setAttribute("aria-label",d)}},GeolocateControl:class extends l.Evented{constructor(S){super(),this.options=l.extend({},Pa,S),l.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(S){var r;return this._map=S,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),r=this._setupUI,Vn!==void 0?r(Vn):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Vn=d.state!=="denied",r(Vn)}):(Vn=!!window.navigator.geolocation,r(Vn)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),V.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,yr=0,ta=!1}_isOutOfMapMaxBounds(S){let r=this._map.getMaxBounds(),d=S.coords;return r&&(d.longitude<r.getWest()||d.longitude>r.getEast()||d.latitude<r.getSouth()||d.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(S){if(this._map){if(this._isOutOfMapMaxBounds(S))return this._setErrorState(),this.fire(new l.Event("outofmaxbounds",S)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=S,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(S),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(S),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("geolocate",S)),this._finish()}}_updateCamera(S){let r=new l.LngLat(S.coords.longitude,S.coords.latitude),d=S.coords.accuracy,x=this._map.getBearing(),E=l.extend({bearing:x},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(d),E,{geolocateSource:!0})}_updateMarker(S){if(S){let r=new l.LngLat(S.coords.longitude,S.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=S.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let S=this._map._container.clientHeight/2,r=this._map.unproject([0,S]),d=this._map.unproject([1,S]),x=r.distanceTo(d),E=Math.ceil(2*this._accuracy/x);this._circleElement.style.width=`${E}px`,this._circleElement.style.height=`${E}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(S){if(this._map){if(this.options.trackUserLocation)if(S.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(S.code===3&&ta)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("error",S)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(S){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=V.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",S===!1){l.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}else{let r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=V.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new ea(this._dotElement),this._circleElement=V.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ea({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||this._watchState!=="ACTIVE_LOCK"||r.originalEvent&&r.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new l.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return l.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":yr--,ta=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new l.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let S;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),yr++,yr>1?(S={maximumAge:6e5,timeout:0},ta=!0):(S=this.options.positionOptions,ta=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,S)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:cl,LogoControl:hs,ScaleControl:class{constructor(S){this.options=l.extend({},ui,S),l.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){li(this._map,this._container,this.options)}onAdd(S){return this._map=S,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",S.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){V.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(S){this.options.unit=S,li(this._map,this._container,this.options)}},FullscreenControl:class{constructor(S){this._fullscreen=!1,S&&S.container&&(S.container instanceof HTMLElement?this._container=S.container:l.warnOnce("Full screen control 'container' must be a DOM element.")),l.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(S){return this._map=S,this._container||(this._container=this._map.getContainer()),this._controlContainer=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",l.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){V.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let S=this._fullscreenButton=V.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",S).setAttribute("aria-hidden","true"),S.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let S=this._getTitle();this._fullscreenButton.setAttribute("aria-label",S),this._fullscreenButton.title=S}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(S){this.options=S,l.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(S){return this._map=S,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=V.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){V.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends l.Evented{constructor(S){super(),this.options=l.extend(Object.create(nr),S),l.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(S){return this._map&&this.remove(),this._map=S,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new l.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&V.remove(this._content),this._container&&(V.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new l.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(S){return this._lngLat=l.LngLat.convert(S),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(S){return this.setDOMContent(document.createTextNode(S))}setHTML(S){let r=document.createDocumentFragment(),d=document.createElement("body"),x;for(d.innerHTML=S;x=d.firstChild,x;)r.appendChild(x);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(S){return this.options.maxWidth=S,this._update(),this}setDOMContent(S){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=V.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(S),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(S){this._container&&this._container.classList.add(S)}removeClassName(S){this._container&&this._container.classList.remove(S)}setOffset(S){return this.options.offset=S,this._update(),this}toggleClassName(S){if(this._container)return this._container.classList.toggle(S)}_createCloseButton(){this.options.closeButton&&(this._closeButton=V.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(S){this._update(S.point)}_onMouseMove(S){this._update(S.point)}_onDrag(S){this._update(S.point)}_update(S){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=V.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=V.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(P=>this._container.classList.add(P)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ao(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!S))return;let r=this._pos=this._trackPointer&&S?S:this._map.project(this._lngLat),d=this.options.anchor,x=Tn(this.options.offset);if(!d){let P=this._container.offsetWidth,U=this._container.offsetHeight,G;G=r.y+x.bottom.y<U?["top"]:r.y>this._map.transform.height-U?["bottom"]:[],r.x<P/2?G.push("left"):r.x>this._map.transform.width-P/2&&G.push("right"),d=G.length===0?"bottom":G.join("-")}let E=r.add(x[d]).round();V.setTransform(this._container,`${si[d]} translate(${E.x}px,${E.y}px)`),hi(this._container,d,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let S=this._container.querySelector(wr);S&&S.focus()}_onClose(){this.remove()}},Marker:ea,Style:En,LngLat:l.LngLat,LngLatBounds:l.LngLatBounds,Point:l.pointGeometry,MercatorCoordinate:l.MercatorCoordinate,Evented:l.Evented,AJAXError:l.AJAXError,config:l.config,CanvasSource:Ui,GeoJSONSource:ci,ImageSource:Ei,RasterDEMTileSource:$t,RasterTileSource:mi,VectorTileSource:Vt,VideoSource:ni,prewarm:function(){pr().acquire(qr)},clearPrewarmedResources:function(){let S=Ir;S&&(S.isPreloaded()&&S.numActive()===1?(S.release(qr),Ir=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Ai.workerCount},set workerCount(S){Ai.workerCount=S},get maxParallelImageRequests(){return l.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(S){l.config.MAX_PARALLEL_IMAGE_REQUESTS=S},clearStorage(S){l.clearTileCache(S)},workerUrl:"",addProtocol(S,r){l.config.REGISTERED_PROTOCOLS[S]=r},removeProtocol(S){delete l.config.REGISTERED_PROTOCOLS[S]}};return Kr.extend(oo,{isSafari:l.isSafari,getPerformanceMetrics:l.PerformanceUtils.getPerformanceMetrics}),oo});var a=u;return a})});var Sb=Wd((OO,wb)=>{var sS="Expected a function",xb=NaN,lS="[object Symbol]",uS=/^\s+|\s+$/g,cS=/^[-+]0x[0-9a-f]+$/i,hS=/^0b[01]+$/i,pS=/^0o[0-7]+$/i,dS=parseInt,fS=typeof global=="object"&&global&&global.Object===Object&&global,mS=typeof self=="object"&&self&&self.Object===Object&&self,gS=fS||mS||Function("return this")(),yS=Object.prototype,_S=yS.toString,vS=Math.max,xS=Math.min,$v=function(){return gS.Date.now()};function bS(v,i,u){var m,a,l,M,z,D,q=0,V=!1,de=!1,pe=!0;if(typeof v!="function")throw new TypeError(sS);i=bb(i)||0,Kv(u)&&(V=!!u.leading,de="maxWait"in u,l=de?vS(bb(u.maxWait)||0,i):l,pe="trailing"in u?!!u.trailing:pe);function Ie(ft){var It=m,Mt=a;return m=a=void 0,q=ft,M=v.apply(Mt,It),M}function Ne(ft){return q=ft,z=setTimeout(Pe,i),V?Ie(ft):M}function nt(ft){var It=ft-D,Mt=ft-q,zt=i-It;return de?xS(zt,l-Mt):zt}function we(ft){var It=ft-D,Mt=ft-q;return D===void 0||It>=i||It<0||de&&Mt>=l}function Pe(){var ft=$v();if(we(ft))return et(ft);z=setTimeout(Pe,nt(ft))}function et(ft){return z=void 0,pe&&m?Ie(ft):(m=a=void 0,M)}function ut(){z!==void 0&&clearTimeout(z),q=0,m=D=a=z=void 0}function mt(){return z===void 0?M:et($v())}function ct(){var ft=$v(),It=we(ft);if(m=arguments,a=this,D=ft,It){if(z===void 0)return Ne(D);if(de)return z=setTimeout(Pe,i),Ie(D)}return z===void 0&&(z=setTimeout(Pe,i)),M}return ct.cancel=ut,ct.flush=mt,ct}function Kv(v){var i=typeof v;return!!v&&(i=="object"||i=="function")}function wS(v){return!!v&&typeof v=="object"}function SS(v){return typeof v=="symbol"||wS(v)&&_S.call(v)==lS}function bb(v){if(typeof v=="number")return v;if(SS(v))return xb;if(Kv(v)){var i=typeof v.valueOf=="function"?v.valueOf():v;v=Kv(i)?i+"":i}if(typeof v!="string")return v===0?v:+v;v=v.replace(uS,"");var u=hS.test(v);return u||pS.test(v)?dS(v.slice(2),u?2:8):cS.test(v)?xb:+v}wb.exports=bS});var Ab=Wd((BO,Cb)=>{var Ib="Expected a function",Eb=NaN,ES="[object Symbol]",TS=/^\s+|\s+$/g,IS=/^[-+]0x[0-9a-f]+$/i,CS=/^0b[01]+$/i,AS=/^0o[0-7]+$/i,MS=parseInt,PS=typeof global=="object"&&global&&global.Object===Object&&global,kS=typeof self=="object"&&self&&self.Object===Object&&self,RS=PS||kS||Function("return this")(),LS=Object.prototype,zS=LS.toString,DS=Math.max,FS=Math.min,Hv=function(){return RS.Date.now()};function OS(v,i,u){var m,a,l,M,z,D,q=0,V=!1,de=!1,pe=!0;if(typeof v!="function")throw new TypeError(Ib);i=Tb(i)||0,kg(u)&&(V=!!u.leading,de="maxWait"in u,l=de?DS(Tb(u.maxWait)||0,i):l,pe="trailing"in u?!!u.trailing:pe);function Ie(ft){var It=m,Mt=a;return m=a=void 0,q=ft,M=v.apply(Mt,It),M}function Ne(ft){return q=ft,z=setTimeout(Pe,i),V?Ie(ft):M}function nt(ft){var It=ft-D,Mt=ft-q,zt=i-It;return de?FS(zt,l-Mt):zt}function we(ft){var It=ft-D,Mt=ft-q;return D===void 0||It>=i||It<0||de&&Mt>=l}function Pe(){var ft=Hv();if(we(ft))return et(ft);z=setTimeout(Pe,nt(ft))}function et(ft){return z=void 0,pe&&m?Ie(ft):(m=a=void 0,M)}function ut(){z!==void 0&&clearTimeout(z),q=0,m=D=a=z=void 0}function mt(){return z===void 0?M:et(Hv())}function ct(){var ft=Hv(),It=we(ft);if(m=arguments,a=this,D=ft,It){if(z===void 0)return Ne(D);if(de)return z=setTimeout(Pe,i),Ie(D)}return z===void 0&&(z=setTimeout(Pe,i)),M}return ct.cancel=ut,ct.flush=mt,ct}function BS(v,i,u){var m=!0,a=!0;if(typeof v!="function")throw new TypeError(Ib);return kg(u)&&(m="leading"in u?!!u.leading:m,a="trailing"in u?!!u.trailing:a),OS(v,i,{leading:m,maxWait:i,trailing:a})}function kg(v){var i=typeof v;return!!v&&(i=="object"||i=="function")}function US(v){return!!v&&typeof v=="object"}function VS(v){return typeof v=="symbol"||US(v)&&zS.call(v)==ES}function Tb(v){if(typeof v=="number")return v;if(VS(v))return Eb;if(kg(v)){var i=typeof v.valueOf=="function"?v.valueOf():v;v=kg(i)?i+"":i}if(typeof v!="string")return v===0?v:+v;v=v.replace(TS,"");var u=CS.test(v);return u||AS.test(v)?MS(v.slice(2),u?2:8):IS.test(v)?Eb:+v}Cb.exports=BS});var zg={};wy(zg,{CopyrightControl:()=>n1,Layer:()=>As,MapboxLayer:()=>ip,MapboxStyleLayer:()=>vb,MaplibreLayer:()=>rp,RealtimeAPI:()=>Hd,RealtimeLayer:()=>Pb,RealtimeModes:()=>Go,RoutingAPI:()=>Xd,RoutingControl:()=>hb,RoutingLayer:()=>Ag,StopFinderControl:()=>db,StopsAPI:()=>$d,VectorLayer:()=>kb,WMSLayer:()=>Rb,compareDepartures:()=>yf,createCanvas:()=>Xl,createRealtimeFilters:()=>ky,debounceDeparturesMessages:()=>u_,debounceWebsocketMessages:()=>Kd,fullTrajectoryDelayStyle:()=>Mb,fullTrajectoryStyle:()=>Lg,getCircleCanvas:()=>y_,getDelayBgCanvas:()=>m_,getDelayTextCanvas:()=>g_,getHoursAndMinutes:()=>Fx,getLayersAsFlatArray:()=>Yd,getMapboxMapCopyrights:()=>sc,getMapboxRender:()=>nd,getMaplibreRender:()=>rd,getTextCanvas:()=>__,getUTCDateString:()=>zx,getUTCTimeString:()=>Dx,getUrlWithParams:()=>Gh,pad:()=>$m,realtimeConfig:()=>od,realtimeDefaultStyle:()=>$h,realtimeDelayStyle:()=>v_,realtimeSimpleStyle:()=>x_,removeDuplicate:()=>qh,renderTrajectories:()=>gf,sortAndFilterDepartures:()=>_f,sortByDelay:()=>Ry});var Sy=class{constructor(i){this.propagationStopped,this.defaultPrevented,this.type=i,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var nn=Sy;var Np={PROPERTYCHANGE:"propertychange"};var Ey=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Ax=Ey;function Mx(v,i,u){let m,a;u=u||rh;let l=0,M=v.length,z=!1;for(;l<M;)m=l+(M-l>>1),a=+u(v[m],i),a<0?l=m+1:(M=m,z=!a);return z?l:~l}function rh(v,i){return v>i?1:v<i?-1:0}function jm(v,i,u){let m=v.length;if(v[0]<=i)return 0;if(i<=v[m-1])return m-1;let a;if(u>0){for(a=1;a<m;++a)if(v[a]<i)return a-1}else if(u<0){for(a=1;a<m;++a)if(v[a]<=i)return a}else for(a=1;a<m;++a){if(v[a]==i)return a;if(v[a]<i)return typeof u=="function"?u(i,v[a-1],v[a])>0?a-1:a:v[a-1]-i<i-v[a]?a-1:a}return m-1}function Px(v,i,u){for(;i<u;){let m=v[i];v[i]=v[u],v[u]=m,++i,--u}}function Ya(v,i){let u=Array.isArray(i)?i:[i],m=u.length;for(let a=0;a<m;a++)v[v.length]=u[a]}function xs(v,i){let u=v.length;if(u!==i.length)return!1;for(let m=0;m<u;m++)if(v[m]!==i[m])return!1;return!0}function Gm(){return!0}function ac(){}function kx(v){let i=!1,u,m,a;return function(){let l=Array.prototype.slice.call(arguments);return(!i||this!==a||!xs(l,m))&&(i=!0,a=this,m=l,u=v.apply(this,arguments)),u}}function nh(v){for(let i in v)delete v[i]}function Gl(v){let i;for(i in v)return!1;return!i}var Ty=class extends Ax{constructor(i){super(),this.eventTarget_=i,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(i,u){if(!i||!u)return;let m=this.listeners_||(this.listeners_={}),a=m[i]||(m[i]=[]);a.includes(u)||a.push(u)}dispatchEvent(i){let u=typeof i=="string",m=u?i:i.type,a=this.listeners_&&this.listeners_[m];if(!a)return;let l=u?new nn(i):i;l.target||(l.target=this.eventTarget_||this);let M=this.dispatching_||(this.dispatching_={}),z=this.pendingRemovals_||(this.pendingRemovals_={});m in M||(M[m]=0,z[m]=0),++M[m];let D;for(let q=0,V=a.length;q<V;++q)if("handleEvent"in a[q]?D=a[q].handleEvent(l):D=a[q].call(this,l),D===!1||l.propagationStopped){D=!1;break}if(--M[m]===0){let q=z[m];for(delete z[m];q--;)this.removeEventListener(m,ac);delete M[m]}return D}disposeInternal(){this.listeners_&&nh(this.listeners_)}getListeners(i){return this.listeners_&&this.listeners_[i]||void 0}hasListener(i){return this.listeners_?i?i in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(i,u){let m=this.listeners_&&this.listeners_[i];if(m){let a=m.indexOf(u);a!==-1&&(this.pendingRemovals_&&i in this.pendingRemovals_?(m[a]=ac,++this.pendingRemovals_[i]):(m.splice(a,1),m.length===0&&delete this.listeners_[i]))}}},qm=Ty;var cn={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function so(v,i,u,m,a){if(m&&m!==v&&(u=u.bind(m)),a){let M=u;u=function(){v.removeEventListener(i,u),M.apply(this,arguments)}}let l={target:v,type:i,listener:u};return v.addEventListener(i,u),l}function jp(v,i,u,m){return so(v,i,u,m,!0)}function Po(v){v&&v.target&&(v.target.removeEventListener(v.type,v.listener),nh(v))}var Gp=class extends qm{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(cn.CHANGE)}getRevision(){return this.revision_}onInternal(i,u){if(Array.isArray(i)){let m=i.length,a=new Array(m);for(let l=0;l<m;++l)a[l]=so(this,i[l],u);return a}return so(this,i,u)}onceInternal(i,u){let m;if(Array.isArray(i)){let a=i.length;m=new Array(a);for(let l=0;l<a;++l)m[l]=jp(this,i[l],u)}else m=jp(this,i,u);return u.ol_key=m,m}unInternal(i,u){let m=u.ol_key;if(m)Ja(m);else if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)this.removeEventListener(i[a],u);else this.removeEventListener(i,u)}};Gp.prototype.on;Gp.prototype.once;Gp.prototype.un;function Ja(v){if(Array.isArray(v))for(let i=0,u=v.length;i<u;++i)Po(v[i]);else Po(v)}var Zm=Gp;function Xi(){throw new Error("Unimplemented abstract method.")}var hw=0;function Tr(v){return v.ol_uid||(v.ol_uid=String(++hw))}var Wm=class extends nn{constructor(i,u,m){super(i),this.key=u,this.oldValue=m}},Iy=class extends Zm{constructor(i){super(),this.on,this.once,this.un,Tr(this),this.values_=null,i!==void 0&&this.setProperties(i)}get(i){let u;return this.values_&&this.values_.hasOwnProperty(i)&&(u=this.values_[i]),u}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(i,u){let m;m=`change:${i}`,this.hasListener(m)&&this.dispatchEvent(new Wm(m,i,u)),m=Np.PROPERTYCHANGE,this.hasListener(m)&&this.dispatchEvent(new Wm(m,i,u))}addChangeListener(i,u){this.addEventListener(`change:${i}`,u)}removeChangeListener(i,u){this.removeEventListener(`change:${i}`,u)}set(i,u,m){let a=this.values_||(this.values_={});if(m)a[i]=u;else{let l=a[i];a[i]=u,l!==u&&this.notify(i,l)}}setProperties(i,u){for(let m in i)this.set(m,i[m],u)}applyProperties(i){i.values_&&Object.assign(this.values_||(this.values_={}),i.values_)}unset(i,u){if(this.values_&&i in this.values_){let m=this.values_[i];delete this.values_[i],Gl(this.values_)&&(this.values_=null),u||this.notify(i,m)}}},lo=Iy;var pw=(v,i)=>{let u=new URL(v);return Object.entries(i||{}).forEach(([a,l])=>{l!=null&&u.searchParams.set(a,l)}),u},Gh=pw;var Cy=class extends lo{constructor(u){super();this.url=u.url,this.apiKey=u.apiKey}fetch(u,m,a){if(!this.url)return Promise.reject(new Error(`No url defined for request to ${this.url}/${u}`));if(!this.url&&!this.apiKey&&!/key=/.test(this.url))return Promise.reject(new Error(`No apiKey defined for request to ${this.url}`));let l=m||{},M=Gh(`${this.url}${u||""}`,{key:this.apiKey,...l});return fetch(M.toString(),a).then(z=>{try{return z.json().then(D=>{if(D.error)throw new Error(D.error);return D})}catch(D){return Promise.reject(new Error(D))}})}},Xm=Cy;var Ay=class extends Xm{constructor(i={}){super({url:"https://api.geops.io/routing/v1/",...i})}route(i,u){return this.fetch("",i,u)}},Xd=Ay;var My=class extends Xm{constructor(i={}){super({url:"https://api.geops.io/stops/v1/",...i})}search(i,u){return this.fetch("",i,u)}},$d=My;var qp=class{constructor(){this.defineProperties()}defineProperties(){Object.defineProperties(this,{closed:{get:()=>!this.websocket||this.websocket.readyState===this.websocket.CLOSED},closing:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSING)},connecting:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CONNECTING)},open:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.OPEN)},messagesOnOpen:{value:[],writable:!0},subscriptions:{value:[],writable:!0},subscribed:{value:{},writable:!0}})}static getRequestString(i,u={}){let m=`${i} ${u.channel}`;return m+=u.args?` ${u.args}`:"",m+=u.id?` ${u.id}`:"",m.trim()}connect(i,u=()=>{}){if(!i){this.websocket?.close();return}if(this.websocket){if(this.websocket.url===i&&(this.open||this.connecting))return;this.websocket.url!==i&&(this.open||this.connecting)&&this.websocket.close()}this.websocket=new WebSocket(i),this.open?(u(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{u(),this.subscribePreviousSubscriptions()})}close(){this.websocket&&(this.open||this.connecting)&&(this.websocket.onclose=()=>{},this.websocket.close(),this.messagesOnOpen=[])}send(i){if(!this.websocket||this.closed||this.closing)return;let u=()=>{this.websocket?.send(i)};this.open?this.messagesOnOpen.includes(i)||u():this.messagesOnOpen.includes(i)||(this.messagesOnOpen.push(i),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],u()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}addEvents(i,u){this.websocket&&(this.websocket.addEventListener("message",i),u&&(this.websocket.addEventListener("error",u),this.websocket.addEventListener("close",u)))}removeEvents(i,u){this.websocket&&(this.websocket.removeEventListener("message",i),u&&(this.websocket.removeEventListener("error",u),this.websocket.removeEventListener("close",u)))}listen(i,u,m){this.unlisten(i,u);let a=l=>{let M;try{M=JSON.parse(l.data)}catch(q){console.error("WebSocket: unable to parse JSON data",q,l.data);return}let z=i.channel;z+=i.args?` ${i.args}`:"";let D;M.source==="buffer"?D=M.content:D=[M],D.forEach(q=>{q?.source===z&&(!i.id||i.id===M.client_reference)&&u(q)})};return this.addEvents(a,m),{onMessageCb:a,onErrorCb:m}}unlisten(i,u){[...this.subscriptions||[],...this.requests||[]].filter(m=>m.params.channel===i.channel&&(!u||m.cb===u)).forEach(({onMessageCb:m,onErrorCb:a})=>{this.removeEvents(m,a)})}get(i,u,m){let a=qp.getRequestString("GET",i);this.send(a);let l=V=>(...de)=>{V(...de);let pe=this.requests.findIndex(nt=>a===nt.requestString&&u===nt.cb),{onMessageCb:Ie,onErrorCb:Ne}=this.requests[pe];this.removeEvents(Ie,Ne),this.requests.splice(pe,1)},{onMessageCb:M,onErrorCb:z}=this.listen(i,l(u),m&&l(m));this.requests||(this.requests=[]);let D=this.requests.findIndex(V=>a===V.requestString&&u===V.cb),q={params:i,requestString:a,cb:u,errorCb:m,onMessageCb:M,onErrorCb:z};D>-1?this.requests[D]=q:this.requests.push(q)}subscribe(i,u,m,a=!1){let{onMessageCb:l,onErrorCb:M}=this.listen(i,u,m),z=qp.getRequestString("",i),D=this.subscriptions.findIndex(V=>i.channel===V.params.channel&&u===V.cb),q={params:i,cb:u,errorCb:m,onMessageCb:l,onErrorCb:M,quiet:a};D>-1?this.subscriptions[D]=q:this.subscriptions.push(q),this.subscribed[z]||(q.quiet||(this.send(`GET ${z}`),this.send(`SUB ${z}`)),this.subscribed[z]=!0)}unsubscribe(i,u){let m=this.subscriptions.filter(a=>a.params.channel===i&&(!u||a.cb===u));m.forEach(({onMessageCb:a,onErrorCb:l})=>{this.removeEvents(a,l)}),this.subscriptions=this.subscriptions.filter(a=>a.params.channel!==i||u&&a.cb!==u),i&&this.subscribed[i]&&!this.subscriptions.find(a=>a.params.channel===i)&&m.find(a=>!a.quiet)&&(this.send(`DEL ${i}`),this.subscribed[i]=!1)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(i=>{this.subscribed[i]=!1}),[...this.subscriptions].forEach(i=>{this.subscribe(i.params,i.cb,i.errorCb,i.quiet)})}},Rx=qp;var dw=(v,i,u=100)=>{let m={},a={},l=[];return M=>{let{source:z,content:D}=M;m[z]&&window.clearTimeout(m[z]),i?a[i(D)]=D:l.push(D),m[z]=window.setTimeout(()=>{let q=i?Object.values(a):l;v(q)},u)}},Kd=dw;var fw=(v,i)=>v===i.SCHEMATIC?"_schematic":"",xu=fw;var Go={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},Py=class{constructor(i={}){this.defineProperties(i),this.prefix=i.prefix||"",this.onOpen=this.onOpen.bind(this)}defineProperties(i){let u=i;typeof i=="string"&&(u={url:i});let{apiKey:m}=u,{url:a,projection:l,bbox:M,buffer:z=[100,100]}=u,D=new Rx;a||(a="wss://api.geops.io/tracker-ws/v1/"),m&&(a=`${a}?key=${m}`),Object.defineProperties(this,{url:{get:()=>a,set:q=>{a!==q&&(a=q,(this.wsApi.open||this.wsApi.connecting)&&this.open())}},projection:{get:()=>l,set:q=>{q!==l&&(l=q,this.wsApi&&this.wsApi.send(`PROJECTION ${l}`))}},bbox:{get:()=>M,set:q=>{JSON.stringify(q)!==JSON.stringify(M)&&(M=q,this.wsApi&&M&&this.wsApi.send(`BBOX ${M.join(" ")}`))}},buffer:{get:()=>z,set:q=>{JSON.stringify(q)!==JSON.stringify(z)&&(z=q,this.wsApi&&this.wsApi.send(`BUFFER ${z.join(" ")}`))}},wsApi:{value:D,writable:!0},pingIntervalMs:{value:i.pingIntervalMs||1e4,writable:!0},reconnectTimeoutMs:{value:i.pingIntervalMs||100,writable:!0}})}open(){this.wsApi.connect(this.url,this.onOpen),this.wsApi.websocket&&(this.wsApi.websocket.onclose=()=>{this.onClose()})}close(){this.wsApi.close()}reset(){this.wsApi.send("RESET")}onOpen(){this.projection&&this.wsApi.send(`PROJECTION ${this.projection}`),this.bbox&&this.wsApi.send(`BBOX ${this.bbox.join(" ")}`),this.buffer&&this.wsApi.send(`BUFFER ${this.buffer.join(" ")}`),this.pingIntervalMs&&(window.clearInterval(this.pingInterval),this.pingInterval=window.setInterval(()=>{this.wsApi.send("PING")},this.pingIntervalMs))}onClose(){window.clearTimeout(this.pingInterval),window.clearTimeout(this.reconnectTimeout),this.reconnectTimeoutMs&&(this.reconnectTimeout=window.setTimeout(()=>this.open(),this.reconnectTimeoutMs))}subscribe(i,u,m=()=>{},a=!1){!i||!u||this.wsApi.subscribe({channel:i},u,m,a)}unsubscribe(i,u="",m){let a=xu(Go.SCHEMATIC,Go),l=xu(Go.TOPOGRAPHIC,Go);this.wsApi.unsubscribe(`${i}${a}${u||""}`,m),this.wsApi.unsubscribe(`${i}${l}${u||""}`,m)}subscribeDepartures(i,u,m=()=>{},a=!1){this.subscribe(`timetable_${i}`,u,m,a)}unsubscribeDepartures(i,u){this.unsubscribe(`timetable_${i}`,"",u)}subscribeDisruptions(i,u=()=>{},m=!1){this.subscribe(`${this.prefix}newsticker`,i,u,m)}unsubscribeDisruptions(i){this.unsubscribe(`${this.prefix}newsticker`,"",i)}getStation(i,u){let m={channel:`station${xu(u,Go)}`,args:i};return new Promise((a,l)=>{this.wsApi.get(m,a,l)})}getStations(i,u=100){return new Promise(m=>{this.wsApi.get({channel:`station${xu(i,Go)}`},Kd(m,void 0,u))})}subscribeStations(i,u,m=()=>{},a=!1){this.subscribe(`station${xu(i,Go)}`,u,m,a)}unsubscribeStations(i){this.unsubscribe("station","",i)}subscribeExtraGeoms(i,u=()=>{},m=!1){this.subscribe("extra_geoms",i,u,m)}unsubscribeExtraGeoms(i){this.unsubscribe("extra_geoms","",i)}subscribeTrajectory(i,u,m=()=>{},a=!1){this.unsubscribeTrajectory(u),this.subscribe(`trajectory${xu(i,Go)}`,u,m,a)}unsubscribeTrajectory(i){this.unsubscribe("trajectory","",i)}subscribeDeletedVehicles(i,u,m=()=>{},a=!1){this.unsubscribeDeletedVehicles(u),this.subscribe(`deleted_vehicles${xu(i,Go)}`,u,m,a)}unsubscribeDeletedVehicles(i){this.unsubscribe("deleted_vehicles","",i)}getFullTrajectory(i,u,m){let a=[`full_trajectory${xu(u,Go)}`];i&&a.push(i),(!u||u===Go.TOPOGRAPHIC)&&m&&a.push(`gen${m}`);let l={channel:a.join("_")};return new Promise((M,z)=>{this.wsApi.get(l,M,z)})}subscribeFullTrajectory(i,u,m,a=()=>{},l=!1){this.subscribe(`full_trajectory${xu(u,Go)}_${i}`,m,a,l)}unsubscribeFullTrajectory(i,u){this.unsubscribe("full_trajectory",`_${i}`,u)}getStopSequence(i){return new Promise((u,m)=>{this.wsApi.get({channel:`stopsequence_${i}`},u,m)})}subscribeStopSequence(i,u,m=()=>{},a=!1){this.subscribe(`stopsequence_${i}`,u,m,a)}unsubscribeStopSequence(i,u){this.unsubscribe("stopsequence",`_${i}`,u)}subscribeHealthCheck(i,u=()=>{},m=!1){this.subscribe("healthcheck",i,u,m)}unsubscribeHealthCheck(i){this.unsubscribe("healthcheck","",i)}},Hd=Py;var mw=v=>{let i=v.filter(l=>l!=null&&l.trim&&l.trim()),u=i.map(l=>l.toLowerCase());return[...new Set(u)].map(l=>i.find(M=>M.toLowerCase()===l))},qh=mw;var gw=v=>{if(!v)return[];let{style:i}=v;if(!i)return[];let{sourceCaches:u}=i,m=[];return Object.values(u).forEach(a=>{if(a.used){let l=a.getSource(),M=l.attribution||l.options&&l.options.attribution;M&&(m=m.concat(M.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),qh(m)},sc=gw;var yw=(v,i,u,m)=>{let a=[];if(!v&&!i&&!u&&!m)return null;if(m){let l=typeof m=="string"?[m]:m,M=z=>{let D=z.properties.name||z.properties.line&&z.properties.line.name||"";return D?l.some(q=>new RegExp(q,"i").test(D)):!1};a.push(M)}if(v){let M=(typeof v=="string"?v.split(","):v).map(D=>D.replace(/\s+/g,"").toUpperCase()),z=D=>{let{line:q,name:V}=D.properties,de=(V||q&&q.name||"").toUpperCase();return de?M.includes(de):!1};a.push(z)}if(i){let M=(typeof i=="string"?i.split(","):i).map(D=>parseInt(D,10)),z=D=>{let q=D.properties.route_identifier||D.properties.routeIdentifier||"",V=parseInt(q.split(".")[0],10);return M.includes(V)};a.push(z)}if(u){let l=typeof u=="string"?[u]:u,M=z=>l.some(D=>{let q=z.properties.operator||z.properties.tenant||"";return new RegExp(D,"i").test(q)});a.push(M)}return a.length?l=>{for(let M=0;M<a.length;M+=1)if(!a[M](l))return!1;return!0}:null},ky=yw;var Lx=v=>{let i=v;Array.isArray(i)||(i=[v]);let u=[];return i.forEach(m=>{u.push(m);let{children:a}=m;u=u.concat(Lx(a||[]))}),u},Yd=Lx;var zx=(v=new Date)=>{let i=(v.getUTCMonth()+1).toString();i=i.length===1?`0${i}`:i;let u=v.getUTCDate().toString();return u=u.length===1?`0${u}`:u,[v.getUTCFullYear(),i,u].join("")},Dx=v=>[v.getUTCHours(),v.getUTCMinutes(),`${v.getUTCSeconds()}.${v.getUTCMilliseconds()}`].join(":"),$m=v=>v<10?`0${v}`:`${v}`,Fx=v=>{if(!v||v<=0)return"";let i=new Date(v);return`${$m(i.getHours())}:${$m(i.getMinutes())}`};var _w=(v,i)=>{let u=v.properties,m=i.properties;return u.delay===null&&m.delay!==null?1:m.delay===null&&u.delay!==null?-1:u.cancelled&&!m.cancelled?m.delay<18e4?-1:1:m.cancelled&&!u.cancelled?u.delay<18e4?1:-1:m.delay-u.delay},Ry=_w;var oh=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",lT=oh.includes("firefox"),vw=oh.includes("safari")&&!oh.includes("chrom"),uT=vw&&(oh.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(oh)),cT=oh.includes("webkit")&&!oh.includes("edge"),hT=oh.includes("macintosh");var Zp=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Ox=typeof Image<"u"&&Image.prototype.decode,pT=function(){let v=!1;try{let i=Object.defineProperty({},"passive",{get:function(){v=!0}});window.addEventListener("_",null,i),window.removeEventListener("_",null,i)}catch{}return v}();var xw={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:'`renderMode` must be `"hybrid"` or `"vector"`',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"},Ly=class extends Error{constructor(i){let u=xw[i];super(u),this.code=i,this.name="AssertionError",this.message=u}},Km=Ly;function zr(v,i){if(!v)throw new Km(i)}var vT=new Array(6);function Da(){return[1,0,0,1,0,0]}function bw(v,i,u,m,a,l,M){return v[0]=i,v[1]=u,v[2]=m,v[3]=a,v[4]=l,v[5]=M,v}function Ux(v,i){return v[0]=i[0],v[1]=i[1],v[2]=i[2],v[3]=i[3],v[4]=i[4],v[5]=i[5],v}function qo(v,i){let u=i[0],m=i[1];return i[0]=v[0]*u+v[2]*m+v[4],i[1]=v[1]*u+v[3]*m+v[5],i}function Vx(v,i,u){return bw(v,i,0,0,u,0,0)}function Ys(v,i,u,m,a,l,M,z){let D=Math.sin(l),q=Math.cos(l);return v[0]=m*q,v[1]=a*D,v[2]=-m*D,v[3]=a*q,v[4]=M*m*q-z*m*D+i,v[5]=M*a*D+z*a*q+u,v}function Nx(v,i,u,m,a,l,M){return zy(Ys(Da(),v,i,u,m,a,l,M))}function jx(v,i){let u=ww(i);zr(u!==0,32);let m=i[0],a=i[1],l=i[2],M=i[3],z=i[4],D=i[5];return v[0]=M/u,v[1]=-a/u,v[2]=-l/u,v[3]=m/u,v[4]=(l*D-M*z)/u,v[5]=-(m*D-a*z)/u,v}function ww(v){return v[0]*v[3]-v[1]*v[2]}var Bx;function zy(v){let i="matrix("+v.join(", ")+")";if(Zp)return i;let u=Bx||(Bx=document.createElement("div"));return u.style.transform=i,u.style.transform}var ko={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function bu(v){let i=Qa();for(let u=0,m=v.length;u<m;++u)Dy(i,v[u]);return i}function Sw(v,i,u){let m=Math.min.apply(null,v),a=Math.min.apply(null,i),l=Math.max.apply(null,v),M=Math.max.apply(null,i);return uc(m,a,l,M,u)}function _l(v,i,u){return u?(u[0]=v[0]-i,u[1]=v[1]-i,u[2]=v[2]+i,u[3]=v[3]+i,u):[v[0]-i,v[1]-i,v[2]+i,v[3]+i]}function Gx(v,i){return i?(i[0]=v[0],i[1]=v[1],i[2]=v[2],i[3]=v[3],i):v.slice()}function bs(v,i,u){let m,a;return i<v[0]?m=v[0]-i:v[2]<i?m=i-v[2]:m=0,u<v[1]?a=v[1]-u:v[3]<u?a=u-v[3]:a=0,m*m+a*a}function Ym(v,i){return Jd(v,i[0],i[1])}function lc(v,i){return v[0]<=i[0]&&i[2]<=v[2]&&v[1]<=i[1]&&i[3]<=v[3]}function Jd(v,i,u){return v[0]<=i&&i<=v[2]&&v[1]<=u&&u<=v[3]}function Hm(v,i){let u=v[0],m=v[1],a=v[2],l=v[3],M=i[0],z=i[1],D=ko.UNKNOWN;return M<u?D=D|ko.LEFT:M>a&&(D=D|ko.RIGHT),z<m?D=D|ko.BELOW:z>l&&(D=D|ko.ABOVE),D===ko.UNKNOWN&&(D=ko.INTERSECTING),D}function Qa(){return[1/0,1/0,-1/0,-1/0]}function uc(v,i,u,m,a){return a?(a[0]=v,a[1]=i,a[2]=u,a[3]=m,a):[v,i,u,m]}function Wp(v){return uc(1/0,1/0,-1/0,-1/0,v)}function Xp(v,i){let u=v[0],m=v[1];return uc(u,m,u,m,i)}function Jm(v,i,u,m,a){let l=Wp(a);return Fy(l,v,i,u,m)}function Qm(v,i){return v[0]==i[0]&&v[2]==i[2]&&v[1]==i[1]&&v[3]==i[3]}function qx(v,i){return i[0]<v[0]&&(v[0]=i[0]),i[2]>v[2]&&(v[2]=i[2]),i[1]<v[1]&&(v[1]=i[1]),i[3]>v[3]&&(v[3]=i[3]),v}function Dy(v,i){i[0]<v[0]&&(v[0]=i[0]),i[0]>v[2]&&(v[2]=i[0]),i[1]<v[1]&&(v[1]=i[1]),i[1]>v[3]&&(v[3]=i[1])}function Fy(v,i,u,m,a){for(;u<m;u+=a)Ew(v,i[u],i[u+1]);return v}function Ew(v,i,u){v[0]=Math.min(v[0],i),v[1]=Math.min(v[1],u),v[2]=Math.max(v[2],i),v[3]=Math.max(v[3],u)}function Zx(v,i){let u;return u=i(Oy(v)),u||(u=i(By(v)),u)||(u=i(Vy(v)),u)||(u=i(Uy(v)),u)?u:!1}function Oy(v){return[v[0],v[1]]}function By(v){return[v[2],v[1]]}function wu(v){return[(v[0]+v[2])/2,(v[1]+v[3])/2]}function Wx(v,i,u,m,a){let[l,M,z,D,q,V,de,pe]=Tw(v,i,u,m);return uc(Math.min(l,z,q,de),Math.min(M,D,V,pe),Math.max(l,z,q,de),Math.max(M,D,V,pe),a)}function Tw(v,i,u,m){let a=i*m[0]/2,l=i*m[1]/2,M=Math.cos(u),z=Math.sin(u),D=a*M,q=a*z,V=l*M,de=l*z,pe=v[0],Ie=v[1];return[pe-D+de,Ie-q-V,pe-D-de,Ie-q+V,pe+D-de,Ie+q+V,pe+D+de,Ie+q-V,pe-D+de,Ie-q-V]}function vl(v){return v[3]-v[1]}function Xx(v,i,u){let m=u||Qa();return uo(v,i)?(v[0]>i[0]?m[0]=v[0]:m[0]=i[0],v[1]>i[1]?m[1]=v[1]:m[1]=i[1],v[2]<i[2]?m[2]=v[2]:m[2]=i[2],v[3]<i[3]?m[3]=v[3]:m[3]=i[3]):Wp(m),m}function Uy(v){return[v[0],v[3]]}function Vy(v){return[v[2],v[3]]}function bo(v){return v[2]-v[0]}function uo(v,i){return v[0]<=i[2]&&v[2]>=i[0]&&v[1]<=i[3]&&v[3]>=i[1]}function $x(v){return v[2]<v[0]||v[3]<v[1]}function Kx(v,i){return i?(i[0]=v[0],i[1]=v[1],i[2]=v[2],i[3]=v[3],i):v}function Hx(v,i,u){let m=!1,a=Hm(v,i),l=Hm(v,u);if(a===ko.INTERSECTING||l===ko.INTERSECTING)m=!0;else{let M=v[0],z=v[1],D=v[2],q=v[3],V=i[0],de=i[1],pe=u[0],Ie=u[1],Ne=(Ie-de)/(pe-V),nt,we;l&ko.ABOVE&&!(a&ko.ABOVE)&&(nt=pe-(Ie-q)/Ne,m=nt>=M&&nt<=D),!m&&l&ko.RIGHT&&!(a&ko.RIGHT)&&(we=Ie-(pe-D)*Ne,m=we>=z&&we<=q),!m&&l&ko.BELOW&&!(a&ko.BELOW)&&(nt=pe-(Ie-z)/Ne,m=nt>=M&&nt<=D),!m&&l&ko.LEFT&&!(a&ko.LEFT)&&(we=Ie-(pe-M)*Ne,m=we>=z&&we<=q)}return m}function Yx(v,i,u,m){let a=[];if(m>1){let z=v[2]-v[0],D=v[3]-v[1];for(let q=0;q<m;++q)a.push(v[0]+z*q/m,v[1],v[2],v[1]+D*q/m,v[2]-z*q/m,v[3],v[0],v[3]-D*q/m)}else a=[v[0],v[1],v[2],v[1],v[2],v[3],v[0],v[3]];i(a,a,2);let l=[],M=[];for(let z=0,D=a.length;z<D;z+=2)l.push(a[z]),M.push(a[z+1]);return Sw(l,M,u)}function Ny(v,i){let u=i.getExtent(),m=wu(v);if(i.canWrapX()&&(m[0]<u[0]||m[0]>=u[2])){let a=bo(u),M=Math.floor((m[0]-u[0])/a)*a;v[0]-=M,v[2]-=M}return v}function Jx(v,i){if(i.canWrapX()){let u=i.getExtent();if(!isFinite(v[0])||!isFinite(v[2]))return[[u[0],v[1],u[2],v[3]]];Ny(v,i);let m=bo(u);if(bo(v)>m)return[[u[0],v[1],u[2],v[3]]];if(v[0]<u[0])return[[v[0]+m,v[1],u[2],v[3]],[u[0],v[1],v[2],v[3]]];if(v[2]>u[2])return[[v[0],v[1],u[2],v[3]],[u[0],v[1],v[2]-m,v[3]]]}return[v]}var Zh={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var jy=class{constructor(i){this.code_=i.code,this.units_=i.units,this.extent_=i.extent!==void 0?i.extent:null,this.worldExtent_=i.worldExtent!==void 0?i.worldExtent:null,this.axisOrientation_=i.axisOrientation!==void 0?i.axisOrientation:"enu",this.global_=i.global!==void 0?i.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=i.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=i.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Zh[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(i){this.global_=i,this.canWrapX_=!!(i&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(i){this.defaultTileGrid_=i}setExtent(i){this.extent_=i,this.canWrapX_=!!(this.global_&&i)}setWorldExtent(i){this.worldExtent_=i}setGetPointResolution(i){this.getPointResolutionFunc_=i}getPointResolutionFunc(){return this.getPointResolutionFunc_}},eg=jy;var Qd=6378137,$p=Math.PI*Qd,Iw=[-$p,-$p,$p,$p],Cw=[-180,-85,180,85],tg=Qd*Math.log(Math.tan(Math.PI/2)),ah=class extends eg{constructor(i){super({code:i,units:"m",extent:Iw,global:!0,worldExtent:Cw,getPointResolution:function(u,m){return u/Math.cosh(m[1]/Qd)}})}},Gy=[new ah("EPSG:3857"),new ah("EPSG:102100"),new ah("EPSG:102113"),new ah("EPSG:900913"),new ah("http://www.opengis.net/def/crs/EPSG/0/3857"),new ah("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Qx(v,i,u){let m=v.length;u=u>1?u:2,i===void 0&&(u>2?i=v.slice():i=new Array(m));for(let a=0;a<m;a+=u){i[a]=$p*v[a]/180;let l=Qd*Math.log(Math.tan(Math.PI*(+v[a+1]+90)/360));l>tg?l=tg:l<-tg&&(l=-tg),i[a+1]=l}return i}function e0(v,i,u){let m=v.length;u=u>1?u:2,i===void 0&&(u>2?i=v.slice():i=new Array(m));for(let a=0;a<m;a+=u)i[a]=180*v[a]/$p,i[a+1]=360*Math.atan(Math.exp(v[a+1]/Qd))/Math.PI-90;return i}var Aw=6378137,t0=[-180,-90,180,90],Mw=Math.PI*Aw/180,cc=class extends eg{constructor(i,u){super({code:i,units:"degrees",extent:t0,axisOrientation:u,global:!0,metersPerUnit:Mw,worldExtent:t0})}},qy=[new cc("CRS:84"),new cc("EPSG:4326","neu"),new cc("urn:ogc:def:crs:OGC:1.3:CRS84"),new cc("urn:ogc:def:crs:OGC:2:84"),new cc("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new cc("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new cc("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var Zy={};function i0(v){return Zy[v]||Zy[v.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function r0(v,i){Zy[v]=i}var Kp={};function ef(v,i,u){let m=v.getCode(),a=i.getCode();m in Kp||(Kp[m]={}),Kp[m][a]=u}function n0(v,i){let u;return v in Kp&&i in Kp[v]&&(u=Kp[v][i]),u}function Jn(v,i,u){return Math.min(Math.max(v,i),u)}function o0(v,i,u,m,a,l){let M=a-u,z=l-m;if(M!==0||z!==0){let D=((v-u)*M+(i-m)*z)/(M*M+z*z);D>1?(u=a,m=l):D>0&&(u+=M*D,m+=z*D)}return ql(v,i,u,m)}function ql(v,i,u,m){let a=u-v,l=m-i;return a*a+l*l}function a0(v){return v*180/Math.PI}function s0(v){return v*Math.PI/180}function Wh(v,i){let u=v%i;return u*i<0?u+i:u}function va(v,i,u){return v+u*(i-v)}function l0(v,i){let u=Math.pow(10,i);return Math.round(v*u)/u}function u0(v,i){return v[0]+=+i[0],v[1]+=+i[1],v}function Wy(v,i){let u=v[0],m=v[1],a=i[0],l=i[1],M=a[0],z=a[1],D=l[0],q=l[1],V=D-M,de=q-z,pe=V===0&&de===0?0:(V*(u-M)+de*(m-z))/(V*V+de*de||0),Ie,Ne;return pe<=0?(Ie=M,Ne=z):pe>=1?(Ie=D,Ne=q):(Ie=M+pe*V,Ne=z+pe*de),[Ie,Ne]}function es(v,i){let u=!0;for(let m=v.length-1;m>=0;--m)if(v[m]!=i[m]){u=!1;break}return u}function c0(v,i){let u=Math.cos(i),m=Math.sin(i),a=v[0]*u-v[1]*m,l=v[1]*u+v[0]*m;return v[0]=a,v[1]=l,v}function Hp(v,i){let u=v[0]-i[0],m=v[1]-i[1];return u*u+m*m}function Xy(v,i){return Math.sqrt(Hp(v,i))}function h0(v,i){return Hp(v,Wy(v,i))}function p0(v,i){if(i.canWrapX()){let u=bo(i.getExtent()),m=d0(v,i,u);m&&(v[0]-=m*u)}return v}function d0(v,i,u){let m=i.getExtent(),a=0;return i.canWrapX()&&(v[0]<m[0]||v[0]>m[2])&&(u=u||bo(m),a=Math.floor((v[0]-m[0])/u)),a}var f0={info:1,warn:2,error:3,none:4},Pw=f0.info;function m0(...v){Pw>f0.warn||console.warn(...v)}var $y=!0;function Ky(v){$y=!(v===void 0?!0:v)}function Hy(v,i){if(i!==void 0){for(let u=0,m=v.length;u<m;++u)i[u]=v[u];i=i}else i=v.slice();return i}function kw(v,i){if(i!==void 0&&v!==i){for(let u=0,m=v.length;u<m;++u)i[u]=v[u];v=i}return v}function Rw(v){r0(v.getCode(),v),ef(v,v,Hy)}function Lw(v){v.forEach(Rw)}function Zo(v){return typeof v=="string"?i0(v):v||null}function g0(v){Lw(v),v.forEach(function(i){v.forEach(function(u){i!==u&&ef(i,u,Hy)})})}function zw(v,i,u,m){v.forEach(function(a){i.forEach(function(l){ef(a,l,u),ef(l,a,m)})})}function ig(v,i){if(v){if(typeof v=="string")return Zo(v)}else return Zo(i);return v}function co(v,i){return Ky(),ng(v,"EPSG:4326",i!==void 0?i:"EPSG:3857")}function sh(v,i){let u=ng(v,i!==void 0?i:"EPSG:3857","EPSG:4326"),m=u[0];return(m<-180||m>180)&&(u[0]=Wh(m+180,360)-180),u}function y0(v,i){if(v===i)return!0;let u=v.getUnits()===i.getUnits();return(v.getCode()===i.getCode()||rg(v,i)===Hy)&&u}function rg(v,i){let u=v.getCode(),m=i.getCode(),a=n0(u,m);return a||(a=kw),a}function tf(v,i){let u=Zo(v),m=Zo(i);return rg(u,m)}function ng(v,i,u){return tf(i,u)(v,void 0,v.length)}function rf(v,i,u,m){let a=tf(i,u);return Yx(v,a,void 0,m)}var Zl=null;function Su(){return Zl}function Yp(v,i){return Zl?ng(v,i,Zl):v}function Ro(v,i){return Zl?ng(v,Zl,i):($y&&!es(v,[0,0])&&v[0]>=-180&&v[0]<=180&&v[1]>=-90&&v[1]<=90&&($y=!1,m0("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),v)}function lh(v,i){return Zl?rf(v,i,Zl):v}function Eu(v,i){return Zl?rf(v,Zl,i):v}function _0(v,i){if(!Zl)return v;let u=Zo(i).getUnits(),m=Zl.getUnits();return u&&m?v*Zh[u]/Zh[m]:v}function Dw(){g0(Gy),g0(qy),zw(qy,Gy,Qx,e0)}Dw();function xl(v,i,u,m,a,l){l=l||[];let M=0;for(let z=i;z<u;z+=m){let D=v[z],q=v[z+1];l[M++]=a[0]*D+a[2]*q+a[4],l[M++]=a[1]*D+a[3]*q+a[5]}return l&&l.length!=M&&(l.length=M),l}function og(v,i,u,m,a,l,M){M=M||[];let z=Math.cos(a),D=Math.sin(a),q=l[0],V=l[1],de=0;for(let pe=i;pe<u;pe+=m){let Ie=v[pe]-q,Ne=v[pe+1]-V;M[de++]=q+Ie*z-Ne*D,M[de++]=V+Ie*D+Ne*z;for(let nt=pe+2;nt<pe+m;++nt)M[de++]=v[nt]}return M&&M.length!=de&&(M.length=de),M}function v0(v,i,u,m,a,l,M,z){z=z||[];let D=M[0],q=M[1],V=0;for(let de=i;de<u;de+=m){let pe=v[de]-D,Ie=v[de+1]-q;z[V++]=D+a*pe,z[V++]=q+l*Ie;for(let Ne=de+2;Ne<de+m;++Ne)z[V++]=v[Ne]}return z&&z.length!=V&&(z.length=V),z}function x0(v,i,u,m,a,l,M){M=M||[];let z=0;for(let D=i;D<u;D+=m){M[z++]=v[D]+a,M[z++]=v[D+1]+l;for(let q=D+2;q<D+m;++q)M[z++]=v[q]}return M&&M.length!=z&&(M.length=z),M}var b0=Da(),Yy=class extends lo{constructor(){super(),this.extent_=Qa(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=kx(function(i,u,m){if(!m)return this.getSimplifiedGeometry(u);let a=this.clone();return a.applyTransform(m),a.getSimplifiedGeometry(u)})}simplifyTransformed(i,u){return this.simplifyTransformedInternal(this.getRevision(),i,u)}clone(){return Xi()}closestPointXY(i,u,m,a){return Xi()}containsXY(i,u){let m=this.getClosestPoint([i,u]);return m[0]===i&&m[1]===u}getClosestPoint(i,u){return u=u||[NaN,NaN],this.closestPointXY(i[0],i[1],u,1/0),u}intersectsCoordinate(i){return this.containsXY(i[0],i[1])}computeExtent(i){return Xi()}getExtent(i){if(this.extentRevision_!=this.getRevision()){let u=this.computeExtent(this.extent_);(isNaN(u[0])||isNaN(u[1]))&&Wp(u),this.extentRevision_=this.getRevision()}return Kx(this.extent_,i)}rotate(i,u){Xi()}scale(i,u,m){Xi()}simplify(i){return this.getSimplifiedGeometry(i*i)}getSimplifiedGeometry(i){return Xi()}getType(){return Xi()}applyTransform(i){Xi()}intersectsExtent(i){return Xi()}translate(i,u){Xi()}transform(i,u){let m=Zo(i),a=m.getUnits()=="tile-pixels"?function(l,M,z){let D=m.getExtent(),q=m.getWorldExtent(),V=vl(q)/vl(D);return Ys(b0,q[0],q[3],V,-V,0,0,0),xl(l,0,l.length,z,b0,M),tf(m,u)(l,M,z)}:tf(m,u);return this.applyTransform(a),this}},ag=Yy;var Jy=class extends ag{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(i){return Jm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i)}getCoordinates(){return Xi()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(i){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),i<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&i<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let u=this.getSimplifiedGeometryInternal(i);return u.getFlatCoordinates().length<this.flatCoordinates.length?u:(this.simplifiedGeometryMaxMinSquaredTolerance=i,this)}getSimplifiedGeometryInternal(i){return this}getStride(){return this.stride}setFlatCoordinates(i,u){this.stride=w0(i),this.layout=i,this.flatCoordinates=u}setCoordinates(i,u){Xi()}setLayout(i,u,m){let a;if(i)a=w0(i);else{for(let l=0;l<m;++l){if(u.length===0){this.layout="XY",this.stride=2;return}u=u[0]}a=u.length,i=Fw(a)}this.layout=i,this.stride=a}applyTransform(i){this.flatCoordinates&&(i(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(i,u){let m=this.getFlatCoordinates();if(m){let a=this.getStride();og(m,0,m.length,a,i,u,m),this.changed()}}scale(i,u,m){u===void 0&&(u=i),m||(m=wu(this.getExtent()));let a=this.getFlatCoordinates();if(a){let l=this.getStride();v0(a,0,a.length,l,i,u,m,a),this.changed()}}translate(i,u){let m=this.getFlatCoordinates();if(m){let a=this.getStride();x0(m,0,m.length,a,i,u,m),this.changed()}}};function Fw(v){let i;return v==2?i="XY":v==3?i="XYZ":v==4&&(i="XYZM"),i}function w0(v){let i;return v=="XY"?i=2:v=="XYZ"||v=="XYM"?i=3:v=="XYZM"&&(i=4),i}function S0(v,i,u){let m=v.getFlatCoordinates();if(!m)return null;let a=v.getStride();return xl(m,0,m.length,a,i,u)}var ws=Jy;function E0(v,i,u,m){for(let a=0,l=u.length;a<l;++a)v[i++]=u[a];return i}function Xh(v,i,u,m){for(let a=0,l=u.length;a<l;++a){let M=u[a];for(let z=0;z<m;++z)v[i++]=M[z]}return i}function nf(v,i,u,m,a){a=a||[];let l=0;for(let M=0,z=u.length;M<z;++M){let D=Xh(v,i,u[M],m);a[l++]=D,i=D}return a.length=l,a}function T0(v,i,u,m,a){a=a||[];let l=0;for(let M=0,z=u.length;M<z;++M){let D=nf(v,i,u[M],m,a[l]);D.length===0&&(D[0]=i),a[l++]=D,i=D[D.length-1]}return a.length=l,a}var Jp=class extends ag{constructor(i){super(),this.geometries_=i||null,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Po),this.changeEventsKeys_.length=0}listenGeometriesChange_(){if(this.geometries_)for(let i=0,u=this.geometries_.length;i<u;++i)this.changeEventsKeys_.push(so(this.geometries_[i],cn.CHANGE,this.changed,this))}clone(){let i=new Jp(null);return i.setGeometries(this.geometries_),i.applyProperties(this),i}closestPointXY(i,u,m,a){if(a<bs(this.getExtent(),i,u))return a;let l=this.geometries_;for(let M=0,z=l.length;M<z;++M)a=l[M].closestPointXY(i,u,m,a);return a}containsXY(i,u){let m=this.geometries_;for(let a=0,l=m.length;a<l;++a)if(m[a].containsXY(i,u))return!0;return!1}computeExtent(i){Wp(i);let u=this.geometries_;for(let m=0,a=u.length;m<a;++m)qx(i,u[m].getExtent());return i}getGeometries(){return I0(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let i=[],u=this.geometries_;for(let m=0,a=u.length;m<a;++m)u[m].getType()===this.getType()?i=i.concat(u[m].getGeometriesArrayRecursive()):i.push(u[m]);return i}getSimplifiedGeometry(i){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),i<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&i<this.simplifiedGeometryMaxMinSquaredTolerance)return this;let u=[],m=this.geometries_,a=!1;for(let l=0,M=m.length;l<M;++l){let z=m[l],D=z.getSimplifiedGeometry(i);u.push(D),D!==z&&(a=!0)}if(a){let l=new Jp(null);return l.setGeometriesArray(u),l}return this.simplifiedGeometryMaxMinSquaredTolerance=i,this}getType(){return"GeometryCollection"}intersectsExtent(i){let u=this.geometries_;for(let m=0,a=u.length;m<a;++m)if(u[m].intersectsExtent(i))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(i,u){let m=this.geometries_;for(let a=0,l=m.length;a<l;++a)m[a].rotate(i,u);this.changed()}scale(i,u,m){m||(m=wu(this.getExtent()));let a=this.geometries_;for(let l=0,M=a.length;l<M;++l)a[l].scale(i,u,m);this.changed()}setGeometries(i){this.setGeometriesArray(I0(i))}setGeometriesArray(i){this.unlistenGeometriesChange_(),this.geometries_=i,this.listenGeometriesChange_(),this.changed()}applyTransform(i){let u=this.geometries_;for(let m=0,a=u.length;m<a;++m)u[m].applyTransform(i);this.changed()}translate(i,u){let m=this.geometries_;for(let a=0,l=m.length;a<l;++a)m[a].translate(i,u);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function I0(v){let i=[];for(let u=0,m=v.length;u<m;++u)i.push(v[u].clone());return i}var C0=Jp;function A0(v,i,u,m,a,l,M){let z=v[i],D=v[i+1],q=v[u]-z,V=v[u+1]-D,de;if(q===0&&V===0)de=i;else{let pe=((a-z)*q+(l-D)*V)/(q*q+V*V);if(pe>1)de=u;else if(pe>0){for(let Ie=0;Ie<m;++Ie)M[Ie]=va(v[i+Ie],v[u+Ie],pe);M.length=m;return}else de=i}for(let pe=0;pe<m;++pe)M[pe]=v[de+pe];M.length=m}function of(v,i,u,m,a){let l=v[i],M=v[i+1];for(i+=m;i<u;i+=m){let z=v[i],D=v[i+1],q=ql(l,M,z,D);q>a&&(a=q),l=z,M=D}return a}function af(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){let z=u[l];a=of(v,i,z,m,a),i=z}return a}function M0(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){let z=u[l];a=af(v,i,z,m,a),i=z[z.length-1]}return a}function sf(v,i,u,m,a,l,M,z,D,q,V){if(i==u)return q;let de,pe;if(a===0){if(pe=ql(M,z,v[i],v[i+1]),pe<q){for(de=0;de<m;++de)D[de]=v[i+de];return D.length=m,pe}return q}V=V||[NaN,NaN];let Ie=i+m;for(;Ie<u;)if(A0(v,Ie-m,Ie,m,M,z,V),pe=ql(M,z,V[0],V[1]),pe<q){for(q=pe,de=0;de<m;++de)D[de]=V[de];D.length=m,Ie+=m}else Ie+=m*Math.max((Math.sqrt(pe)-Math.sqrt(q))/a|0,1);if(l&&(A0(v,u-m,i,m,M,z,V),pe=ql(M,z,V[0],V[1]),pe<q)){for(q=pe,de=0;de<m;++de)D[de]=V[de];D.length=m}return q}function lf(v,i,u,m,a,l,M,z,D,q,V){V=V||[NaN,NaN];for(let de=0,pe=u.length;de<pe;++de){let Ie=u[de];q=sf(v,i,Ie,m,a,l,M,z,D,q,V),i=Ie}return q}function P0(v,i,u,m,a,l,M,z,D,q,V){V=V||[NaN,NaN];for(let de=0,pe=u.length;de<pe;++de){let Ie=u[de];q=lf(v,i,Ie,m,a,l,M,z,D,q,V),i=Ie[Ie.length-1]}return q}function uf(v,i,u,m,a,l,M){let z=(u-i)/m;if(z<3){for(;i<u;i+=m)l[M++]=v[i],l[M++]=v[i+1];return M}let D=new Array(z);D[0]=1,D[z-1]=1;let q=[i,u-m],V=0;for(;q.length>0;){let de=q.pop(),pe=q.pop(),Ie=0,Ne=v[pe],nt=v[pe+1],we=v[de],Pe=v[de+1];for(let et=pe+m;et<de;et+=m){let ut=v[et],mt=v[et+1],ct=o0(ut,mt,Ne,nt,we,Pe);ct>Ie&&(V=et,Ie=ct)}Ie>a&&(D[(V-i)/m]=1,pe+m<V&&q.push(pe,V),V+m<de&&q.push(V,de))}for(let de=0;de<z;++de)D[de]&&(l[M++]=v[i+de*m],l[M++]=v[i+de*m+1]);return M}function k0(v,i,u,m,a,l,M,z){for(let D=0,q=u.length;D<q;++D){let V=u[D];M=uf(v,i,V,m,a,l,M),z.push(M),i=V}return M}function uh(v,i){return i*Math.round(v/i)}function Ow(v,i,u,m,a,l,M){if(i==u)return M;let z=uh(v[i],a),D=uh(v[i+1],a);i+=m,l[M++]=z,l[M++]=D;let q,V;do if(q=uh(v[i],a),V=uh(v[i+1],a),i+=m,i==u)return l[M++]=q,l[M++]=V,M;while(q==z&&V==D);for(;i<u;){let de=uh(v[i],a),pe=uh(v[i+1],a);if(i+=m,de==q&&pe==V)continue;let Ie=q-z,Ne=V-D,nt=de-z,we=pe-D;if(Ie*we==Ne*nt&&(Ie<0&&nt<Ie||Ie==nt||Ie>0&&nt>Ie)&&(Ne<0&&we<Ne||Ne==we||Ne>0&&we>Ne)){q=de,V=pe;continue}l[M++]=q,l[M++]=V,z=q,D=V,q=de,V=pe}return l[M++]=q,l[M++]=V,M}function Qy(v,i,u,m,a,l,M,z){for(let D=0,q=u.length;D<q;++D){let V=u[D];M=Ow(v,i,V,m,a,l,M),z.push(M),i=V}return M}function R0(v,i,u,m,a,l,M,z){for(let D=0,q=u.length;D<q;++D){let V=u[D],de=[];M=Qy(v,i,V,m,a,l,M,de),z.push(de),i=V[V.length-1]}return M}function bl(v,i,u,m,a){a=a!==void 0?a:[];let l=0;for(let M=i;M<u;M+=m)a[l++]=v.slice(M,M+m);return a.length=l,a}function ch(v,i,u,m,a){a=a!==void 0?a:[];let l=0;for(let M=0,z=u.length;M<z;++M){let D=u[M];a[l++]=bl(v,i,D,m,a[l]),i=D}return a.length=l,a}function cf(v,i,u,m,a){a=a!==void 0?a:[];let l=0;for(let M=0,z=u.length;M<z;++M){let D=u[M];a[l++]=D.length===1&&D[0]===i?[]:ch(v,i,D,m,a[l]),i=D[D.length-1]}return a.length=l,a}function e_(v,i,u,m){let a=0,l=v[u-m],M=v[u-m+1];for(;i<u;i+=m){let z=v[i],D=v[i+1];a+=M*z-l*D,l=z,M=D}return a/2}function t_(v,i,u,m){let a=0;for(let l=0,M=u.length;l<M;++l){let z=u[l];a+=e_(v,i,z,m),i=z}return a}function L0(v,i,u,m){let a=0;for(let l=0,M=u.length;l<M;++l){let z=u[l];a+=t_(v,i,z,m),i=z[z.length-1]}return a}var Qp=class extends ws{constructor(i,u){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(i[0])?this.setFlatCoordinates(u,i):this.setCoordinates(i,u)}clone(){return new Qp(this.flatCoordinates.slice(),this.layout)}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(of(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),sf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,i,u,m,a))}getArea(){return e_(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(i){let u=[];return u.length=uf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i,u,0),new Qp(u,"XY")}getType(){return"LinearRing"}intersectsExtent(i){return!1}setCoordinates(i,u){this.setLayout(u,i,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Xh(this.flatCoordinates,0,i,this.stride),this.changed()}},i_=Qp;function sg(v,i,u,m,a){let l;for(i+=m;i<u;i+=m)if(l=a(v.slice(i-m,i),v.slice(i,i+m)),l)return l;return!1}function ug(v,i,u,m,a,l,M){let z,D,q=(u-i)/m;if(q===1)z=i;else if(q===2)z=i,D=a;else if(q!==0){let V=v[i],de=v[i+1],pe=0,Ie=[0];for(let we=i+m;we<u;we+=m){let Pe=v[we],et=v[we+1];pe+=Math.sqrt((Pe-V)*(Pe-V)+(et-de)*(et-de)),Ie.push(pe),V=Pe,de=et}let Ne=a*pe,nt=Mx(Ie,Ne);nt<0?(D=(Ne-Ie[-nt-2])/(Ie[-nt-1]-Ie[-nt-2]),z=i+(-nt-2)*m):z=i+nt*m}M=M>1?M:2,l=l||new Array(M);for(let V=0;V<M;++V)l[V]=z===void 0?NaN:D===void 0?v[z+V]:va(v[z+V],v[z+m+V],D);return l}function lg(v,i,u,m,a,l){if(u==i)return null;let M;if(a<v[i+m-1])return l?(M=v.slice(i,i+m),M[m-1]=a,M):null;if(v[u-1]<a)return l?(M=v.slice(u-m,u),M[m-1]=a,M):null;if(a==v[i+m-1])return v.slice(i,i+m);let z=i/m,D=u/m;for(;z<D;){let pe=z+D>>1;a<v[(pe+1)*m-1]?D=pe:z=pe+1}let q=v[z*m-1];if(a==q)return v.slice((z-1)*m,(z-1)*m+m);let V=v[(z+1)*m-1],de=(a-q)/(V-q);M=[];for(let pe=0;pe<m-1;++pe)M.push(va(v[(z-1)*m+pe],v[z*m+pe],de));return M.push(a),M}function z0(v,i,u,m,a,l,M){if(M)return lg(v,i,u[u.length-1],m,a,l);let z;if(a<v[m-1])return l?(z=v.slice(0,m),z[m-1]=a,z):null;if(v[v.length-1]<a)return l?(z=v.slice(v.length-m),z[m-1]=a,z):null;for(let D=0,q=u.length;D<q;++D){let V=u[D];if(i!=V){if(a<v[i+m-1])return null;if(a<=v[V-1])return lg(v,i,V,m,a,!1);i=V}}return null}function D0(v,i,u,m,a){return!Zx(a,function(M){return!hh(v,i,u,m,M[0],M[1])})}function hh(v,i,u,m,a,l){let M=0,z=v[u-m],D=v[u-m+1];for(;i<u;i+=m){let q=v[i],V=v[i+1];D<=l?V>l&&(q-z)*(l-D)-(a-z)*(V-D)>0&&M++:V<=l&&(q-z)*(l-D)-(a-z)*(V-D)<0&&M--,z=q,D=V}return M!==0}function hf(v,i,u,m,a,l){if(u.length===0||!hh(v,i,u[0],m,a,l))return!1;for(let M=1,z=u.length;M<z;++M)if(hh(v,u[M-1],u[M],m,a,l))return!1;return!0}function F0(v,i,u,m,a,l){if(u.length===0)return!1;for(let M=0,z=u.length;M<z;++M){let D=u[M];if(hf(v,i,D,m,a,l))return!0;i=D[D.length-1]}return!1}function pf(v,i,u,m,a){let l=Fy(Qa(),v,i,u,m);return uo(a,l)?lc(a,l)||l[0]>=a[0]&&l[2]<=a[2]||l[1]>=a[1]&&l[3]<=a[3]?!0:sg(v,i,u,m,function(M,z){return Hx(a,M,z)}):!1}function O0(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){if(pf(v,i,u[l],m,a))return!0;i=u[l]}return!1}function Bw(v,i,u,m,a){return!!(pf(v,i,u,m,a)||hh(v,i,u,m,a[0],a[1])||hh(v,i,u,m,a[0],a[3])||hh(v,i,u,m,a[2],a[1])||hh(v,i,u,m,a[2],a[3]))}function r_(v,i,u,m,a){if(!Bw(v,i,u[0],m,a))return!1;if(u.length===1)return!0;for(let l=1,M=u.length;l<M;++l)if(D0(v,u[l-1],u[l],m,a)&&!pf(v,u[l-1],u[l],m,a))return!1;return!0}function B0(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){let z=u[l];if(r_(v,i,z,m,a))return!0;i=z[z.length-1]}return!1}function cg(v,i,u,m){let a=v[i],l=v[i+1],M=0;for(let z=i+m;z<u;z+=m){let D=v[z],q=v[z+1];M+=Math.sqrt((D-a)*(D-a)+(q-l)*(q-l)),a=D,l=q}return M}var ed=class extends ws{constructor(i,u){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(i[0])?this.setFlatCoordinates(u,i):this.setCoordinates(i,u)}appendCoordinate(i){this.flatCoordinates?Ya(this.flatCoordinates,i):this.flatCoordinates=i.slice(),this.changed()}clone(){let i=new ed(this.flatCoordinates.slice(),this.layout);return i.applyProperties(this),i}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(of(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),sf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,i,u,m,a))}forEachSegment(i){return sg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i)}getCoordinateAtM(i,u){return this.layout!="XYM"&&this.layout!="XYZM"?null:(u=u!==void 0?u:!1,lg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i,u))}getCoordinates(){return bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(i,u){return ug(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i,u,this.stride)}getLength(){return cg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(i){let u=[];return u.length=uf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i,u,0),new ed(u,"XY")}getType(){return"LineString"}intersectsExtent(i){return pf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i)}setCoordinates(i,u){this.setLayout(u,i,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Xh(this.flatCoordinates,0,i,this.stride),this.changed()}},Wl=ed;var td=class extends ws{constructor(i,u,m){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(i[0]))this.setCoordinates(i,u);else if(u!==void 0&&m)this.setFlatCoordinates(u,i),this.ends_=m;else{let a=this.getLayout(),l=i,M=[],z=[];for(let D=0,q=l.length;D<q;++D){let V=l[D];D===0&&(a=V.getLayout()),Ya(M,V.getFlatCoordinates()),z.push(M.length)}this.setFlatCoordinates(a,M),this.ends_=z}}appendLineString(i){this.flatCoordinates?Ya(this.flatCoordinates,i.getFlatCoordinates().slice()):this.flatCoordinates=i.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let i=new td(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return i.applyProperties(this),i}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(af(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),lf(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,i,u,m,a))}getCoordinateAtM(i,u,m){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(u=u!==void 0?u:!1,m=m!==void 0?m:!1,z0(this.flatCoordinates,0,this.ends_,this.stride,i,u,m))}getCoordinates(){return ch(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(i){return i<0||this.ends_.length<=i?null:new Wl(this.flatCoordinates.slice(i===0?0:this.ends_[i-1],this.ends_[i]),this.layout)}getLineStrings(){let i=this.flatCoordinates,u=this.ends_,m=this.layout,a=[],l=0;for(let M=0,z=u.length;M<z;++M){let D=u[M],q=new Wl(i.slice(l,D),m);a.push(q),l=D}return a}getFlatMidpoints(){let i=[],u=this.flatCoordinates,m=0,a=this.ends_,l=this.stride;for(let M=0,z=a.length;M<z;++M){let D=a[M],q=ug(u,m,D,l,.5);Ya(i,q),m=D}return i}getSimplifiedGeometryInternal(i){let u=[],m=[];return u.length=k0(this.flatCoordinates,0,this.ends_,this.stride,i,u,0,m),new td(u,"XY",m)}getType(){return"MultiLineString"}intersectsExtent(i){return O0(this.flatCoordinates,0,this.ends_,this.stride,i)}setCoordinates(i,u){this.setLayout(u,i,2),this.flatCoordinates||(this.flatCoordinates=[]);let m=nf(this.flatCoordinates,0,i,this.stride,this.ends_);this.flatCoordinates.length=m.length===0?0:m[m.length-1],this.changed()}},U0=td;var df=class extends ws{constructor(i,u){super(),this.setCoordinates(i,u)}clone(){let i=new df(this.flatCoordinates.slice(),this.layout);return i.applyProperties(this),i}closestPointXY(i,u,m,a){let l=this.flatCoordinates,M=ql(i,u,l[0],l[1]);if(M<a){let z=this.stride;for(let D=0;D<z;++D)m[D]=l[D];return m.length=z,M}return a}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(i){return Xp(this.flatCoordinates,i)}getType(){return"Point"}intersectsExtent(i){return Jd(i,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(i,u){this.setLayout(u,i,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=E0(this.flatCoordinates,0,i,this.stride),this.changed()}},xa=df;var ff=class extends ws{constructor(i,u){super(),u&&!Array.isArray(i[0])?this.setFlatCoordinates(u,i):this.setCoordinates(i,u)}appendPoint(i){this.flatCoordinates?Ya(this.flatCoordinates,i.getFlatCoordinates()):this.flatCoordinates=i.getFlatCoordinates().slice(),this.changed()}clone(){let i=new ff(this.flatCoordinates.slice(),this.layout);return i.applyProperties(this),i}closestPointXY(i,u,m,a){if(a<bs(this.getExtent(),i,u))return a;let l=this.flatCoordinates,M=this.stride;for(let z=0,D=l.length;z<D;z+=M){let q=ql(i,u,l[z],l[z+1]);if(q<a){a=q;for(let V=0;V<M;++V)m[V]=l[z+V];m.length=M}}return a}getCoordinates(){return bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(i){let u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return i<0||u<=i?null:new xa(this.flatCoordinates.slice(i*this.stride,(i+1)*this.stride),this.layout)}getPoints(){let i=this.flatCoordinates,u=this.layout,m=this.stride,a=[];for(let l=0,M=i.length;l<M;l+=m){let z=new xa(i.slice(l,l+m),u);a.push(z)}return a}getType(){return"MultiPoint"}intersectsExtent(i){let u=this.flatCoordinates,m=this.stride;for(let a=0,l=u.length;a<l;a+=m){let M=u[a],z=u[a+1];if(Jd(i,M,z))return!0}return!1}setCoordinates(i,u){this.setLayout(u,i,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Xh(this.flatCoordinates,0,i,this.stride),this.changed()}},hg=ff;function n_(v,i,u,m,a,l,M){let z,D,q,V,de,pe,Ie,Ne=a[l+1],nt=[];for(let et=0,ut=u.length;et<ut;++et){let mt=u[et];for(V=v[mt-m],pe=v[mt-m+1],z=i;z<mt;z+=m)de=v[z],Ie=v[z+1],(Ne<=pe&&Ie<=Ne||pe<=Ne&&Ne<=Ie)&&(q=(Ne-pe)/(Ie-pe)*(de-V)+V,nt.push(q)),V=de,pe=Ie}let we=NaN,Pe=-1/0;for(nt.sort(rh),V=nt[0],z=1,D=nt.length;z<D;++z){de=nt[z];let et=Math.abs(de-V);et>Pe&&(q=(V+de)/2,hf(v,i,u,m,q,Ne)&&(we=q,Pe=et)),V=de}return isNaN(we)&&(we=a[l]),M?(M.push(we,Ne,Pe),M):[we,Ne,Pe]}function V0(v,i,u,m,a){let l=[];for(let M=0,z=u.length;M<z;++M){let D=u[M];l=n_(v,i,D,m,a,2*M,l),i=D[D.length-1]}return l}function N0(v,i,u,m){for(;i<u-m;){for(let a=0;a<m;++a){let l=v[i+a];v[i+a]=v[u-m+a],v[u-m+a]=l}i+=m,u-=m}}function j0(v,i,u,m){let a=0,l=v[u-m],M=v[u-m+1];for(;i<u;i+=m){let z=v[i],D=v[i+1];a+=(z-l)*(D+M),l=z,M=D}return a===0?void 0:a>0}function o_(v,i,u,m,a){a=a!==void 0?a:!1;for(let l=0,M=u.length;l<M;++l){let z=u[l],D=j0(v,i,z,m);if(l===0){if(a&&D||!a&&!D)return!1}else if(a&&!D||!a&&D)return!1;i=z}return!0}function G0(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){let z=u[l];if(!o_(v,i,z,m,a))return!1;z.length&&(i=z[z.length-1])}return!0}function pg(v,i,u,m,a){a=a!==void 0?a:!1;for(let l=0,M=u.length;l<M;++l){let z=u[l],D=j0(v,i,z,m);(l===0?a&&D||!a&&!D:a&&!D||!a&&D)&&N0(v,i,z,m),i=z}return i}function a_(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l)i=pg(v,i,u[l],m,a);return i}var ph=class extends ws{constructor(i,u,m){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,u!==void 0&&m?(this.setFlatCoordinates(u,i),this.ends_=m):this.setCoordinates(i,u)}appendLinearRing(i){this.flatCoordinates?Ya(this.flatCoordinates,i.getFlatCoordinates()):this.flatCoordinates=i.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let i=new ph(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return i.applyProperties(this),i}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(af(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),lf(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,i,u,m,a))}containsXY(i,u){return hf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,i,u)}getArea(){return t_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(i){let u;return i!==void 0?(u=this.getOrientedFlatCoordinates().slice(),pg(u,0,this.ends_,this.stride,i)):u=this.flatCoordinates,ch(u,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let i=wu(this.getExtent());this.flatInteriorPoint_=n_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,i,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new xa(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(i){return i<0||this.ends_.length<=i?null:new i_(this.flatCoordinates.slice(i===0?0:this.ends_[i-1],this.ends_[i]),this.layout)}getLinearRings(){let i=this.layout,u=this.flatCoordinates,m=this.ends_,a=[],l=0;for(let M=0,z=m.length;M<z;++M){let D=m[M],q=new i_(u.slice(l,D),i);a.push(q),l=D}return a}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let i=this.flatCoordinates;o_(i,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=i:(this.orientedFlatCoordinates_=i.slice(),this.orientedFlatCoordinates_.length=pg(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(i){let u=[],m=[];return u.length=Qy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(i),u,0,m),new ph(u,"XY",m)}getType(){return"Polygon"}intersectsExtent(i){return r_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,i)}setCoordinates(i,u){this.setLayout(u,i,2),this.flatCoordinates||(this.flatCoordinates=[]);let m=nf(this.flatCoordinates,0,i,this.stride,this.ends_);this.flatCoordinates.length=m.length===0?0:m[m.length-1],this.changed()}},mf=ph;function s_(v){let i=v[0],u=v[1],m=v[2],a=v[3],l=[i,u,i,a,m,a,m,u,i,u];return new ph(l,"XY",[l.length])}function l_(v,i,u){i=i||32;let m=v.getStride(),a=v.getLayout(),l=v.getCenter(),M=m*(i+1),z=new Array(M);for(let V=0;V<M;V+=m){z[V]=0,z[V+1]=0;for(let de=2;de<m;de++)z[V+de]=l[de]}let D=[z.length],q=new ph(z,a,D);return Uw(q,l,v.getRadius(),u),q}function Uw(v,i,u,m){let a=v.getFlatCoordinates(),l=v.getStride(),M=a.length/l-1,z=m||0;for(let D=0;D<=M;++D){let q=D*l,V=z+Wh(D,M)*2*Math.PI/M;a[q]=i[0]+u*Math.cos(V),a[q+1]=i[1]+u*Math.sin(V)}v.changed()}function q0(v,i,u,m){let a=[],l=Qa();for(let M=0,z=u.length;M<z;++M){let D=u[M];l=Jm(v,i,D[0],m),a.push((l[0]+l[2])/2,(l[1]+l[3])/2),i=D[D.length-1]}return a}var id=class extends ws{constructor(i,u,m){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!m&&!Array.isArray(i[0])){let a=this.getLayout(),l=i,M=[],z=[];for(let D=0,q=l.length;D<q;++D){let V=l[D];D===0&&(a=V.getLayout());let de=M.length,pe=V.getEnds();for(let Ie=0,Ne=pe.length;Ie<Ne;++Ie)pe[Ie]+=de;Ya(M,V.getFlatCoordinates()),z.push(pe)}u=a,i=M,m=z}u!==void 0&&m?(this.setFlatCoordinates(u,i),this.endss_=m):this.setCoordinates(i,u)}appendPolygon(i){let u;if(!this.flatCoordinates)this.flatCoordinates=i.getFlatCoordinates().slice(),u=i.getEnds().slice(),this.endss_.push();else{let m=this.flatCoordinates.length;Ya(this.flatCoordinates,i.getFlatCoordinates()),u=i.getEnds().slice();for(let a=0,l=u.length;a<l;++a)u[a]+=m}this.endss_.push(u),this.changed()}clone(){let i=this.endss_.length,u=new Array(i);for(let a=0;a<i;++a)u[a]=this.endss_[a].slice();let m=new id(this.flatCoordinates.slice(),this.layout,u);return m.applyProperties(this),m}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(M0(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),P0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,i,u,m,a))}containsXY(i,u){return F0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,i,u)}getArea(){return L0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(i){let u;return i!==void 0?(u=this.getOrientedFlatCoordinates().slice(),a_(u,0,this.endss_,this.stride,i)):u=this.flatCoordinates,cf(u,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let i=q0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=V0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,i),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new hg(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let i=this.flatCoordinates;G0(i,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=i:(this.orientedFlatCoordinates_=i.slice(),this.orientedFlatCoordinates_.length=a_(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(i){let u=[],m=[];return u.length=R0(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(i),u,0,m),new id(u,"XY",m)}getPolygon(i){if(i<0||this.endss_.length<=i)return null;let u;if(i===0)u=0;else{let l=this.endss_[i-1];u=l[l.length-1]}let m=this.endss_[i].slice(),a=m[m.length-1];if(u!==0)for(let l=0,M=m.length;l<M;++l)m[l]-=u;return new mf(this.flatCoordinates.slice(u,a),this.layout,m)}getPolygons(){let i=this.layout,u=this.flatCoordinates,m=this.endss_,a=[],l=0;for(let M=0,z=m.length;M<z;++M){let D=m[M].slice(),q=D[D.length-1];if(l!==0)for(let de=0,pe=D.length;de<pe;++de)D[de]-=l;let V=new mf(u.slice(l,q),i,D);a.push(V),l=q}return a}getType(){return"MultiPolygon"}intersectsExtent(i){return B0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,i)}setCoordinates(i,u){this.setLayout(u,i,3),this.flatCoordinates||(this.flatCoordinates=[]);let m=T0(this.flatCoordinates,0,i,this.stride,this.endss_);if(m.length===0)this.flatCoordinates.length=0;else{let a=m[m.length-1];this.flatCoordinates.length=a.length===0?0:a[a.length-1]}this.changed()}},Z0=id;var Vw=(v,i,u)=>{let{time_intervals:m,olGeometry:a,coordinate:l}=i.properties,{coordinates:M}=i.geometry,{type:z}=i.geometry,D=a,q,V;if(a&&(z=D.getType()),u&&l)q=l;else if(z==="Point")q=M;else if(z==="LineString"){D||(D=new Wl(M));let de=m||[[]],pe=de[0],Ie=de[de.length-1];if(v<pe[0])[,,V]=pe,q=D.getFirstCoordinate();else if(v>Ie[0])[,,V]=Ie,q=D.getLastCoordinate();else for(let Ne=0;Ne<de.length-1;Ne+=1){let[nt,we]=de[Ne],[Pe,et]=de[Ne+1];if(nt<=v&&v<=Pe){let mt=Math.min((v-nt)/(Pe-nt),1)*(et-we)+we;q=D.getCoordinateAt(mt),[,,V]=de[Ne];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",D);return{coord:q,rotation:V}},W0=Vw;var Nw=(v,i,u,m,a)=>{if(!v)return{renderedTrajectories:[]};let{time:l=Date.now(),size:M=[],center:z,resolution:D,rotation:q=0,pixelRatio:V=1}=m;if(!D||!z)return{renderedTrajectories:[]};let{noInterpolate:de=!1,hoverVehicleId:pe,selectedVehicleId:Ie,filter:Ne,getScreenPixel:nt=(zt,Qt)=>(Qt.zoom||0)<12?zt.map(Vt=>Math.floor(Vt)):zt}=a,we=v.getContext("2d");we?.clearRect(0,0,v.width,v.height);let[Pe,et]=M;Pe&&et&&(v.width!==Pe||v.height!==et)&&([v.width,v.height]=[Pe*V,et*V]);let ut=Ys(Da(),M[0]/2,M[1]/2,1/D,-1/D,-q,-z[0],-z[1]);v.style&&(v.style.width=`${v.width/V}px`,v.style.height=`${v.height/V}px`);let mt,ct,ft,It,Mt=[];for(let zt=i.length-1;zt>=0;zt-=1){let Qt=i[zt];if(Ne&&!Ne(Qt))continue;let{train_id:Vt,timeOffset:mi}=Qt.properties,{coord:Ii,rotation:$t}=W0(l-(mi||0),Qt,de);if(i[zt].properties.coordinate=Ii,i[zt].properties.rotation=$t,!Ii)continue;let ci=qo(ut,[...Ii]);if(!ci||(ci=ci.map(Ei=>Ei*V),ci[0]<0||ci[0]>v.width||ci[1]<0||ci[1]>v.height))continue;let Jt=u(Qt,m,a);if(Jt){if(pe!==Vt&&Ie!==Vt){let[Ei,ni]=nt([ci[0]-Jt.width/2,ci[1]-Jt.height/2],m);we?.drawImage(Jt,Ei,ni)}pe&&pe===Vt&&(mt=Jt,ct=ci),Ie&&Ie===Vt&&(ft=Jt,It=ci),Mt.push(Qt)}}return ft&&It&&we?.drawImage(ft,Math.floor(It[0]-ft.width/2),Math.floor(It[1]-ft.height/2)),mt&&ct&&we?.drawImage(mt,Math.floor(ct[0]-mt.width/2),Math.floor(ct[1]-mt.height/2)),{renderedTrajectories:Mt}},gf=Nw;function rd(v){let i;return u=>{let{map:m,mbMap:a,olLayer:l}=v;if(!m||!a)return i||(i=document.createElement("div")),i;let M=a.getCanvas(),{viewState:z}=u,D=l?.getOpacity()||1;return M.style.opacity=`${D}`,a.jumpTo({center:sh(z.center),zoom:z.zoom-1,bearing:a0(-z.rotation)}),M.isConnected?(M.width!==u.size[0]||M.height!==u.size[1])&&a.resize():m.render(),a.redraw(),a.getContainer()}}function nd(v){let i;return u=>{let{map:m,mbMap:a,renderState:l,olLayer:M}=v;if(!m||!a)return i||(i=document.createElement("div")),i;let z=!1,D=a.getCanvas(),{viewState:q}=u,V=M?.getVisible();l&&l?.visible!==V&&(D.style.display=V?"block":"none",l.visible=V,D.style.position="absolute");let de=M?.getOpacity();D&&l&&l.opacity!==de&&(D.style.opacity=de,l.opacity=de);let{rotation:pe}=q;l&&l.rotation!==pe&&(a.rotateTo(-(pe||0)*180/Math.PI,{animate:!1}),z=!0,l.rotation=pe),l&&l.center&&(l.zoom!==q.zoom||l.center[0]!==q.center[0]||l.center[1]!==q.center[1])&&(a.jumpTo({center:sh(q.center),zoom:q.zoom-1}),z=!0,l.zoom=q.zoom,l.center=q.center);let Ie=m.getSize()||[0,0];if(l&&l.size&&(l.size[0]!==Ie[0]||l.size[1]!==Ie[1])&&(z=!0,l.size=Ie),a&&a.style&&a.isStyleLoaded()&&z)try{a._frame&&(a._frame.cancel(),a._frame=null),a._render()}catch(Ne){console.warn(Ne)}return a.getContainer()}}var jw=(v,i,u=!1)=>{let m=["HIDDEN","LEAVING","BOARDING"],a=v.has_fzo&&m.indexOf(v.state)>-1,l=i.has_fzo&&m.indexOf(i.state)>-1;if(a||l){if(a!==l)return a?-1:1;if(v.state!==i.state)return m.indexOf(v.state)-m.indexOf(i.state)}let M=null,z=null,D=Date.now();return u?(M=new Date(v.min_arrival_time||v.time).getTime()-D,z=new Date(i.min_arrival_time||i.time).getTime()-D):(M=new Date(v.time).getTime()-D,z=new Date(i.time).getTime()-D),M-z},yf=jw;var Gw=(v,i=!1,u=30)=>{let m=Object.keys(v).map(de=>v[de]);m.sort((de,pe)=>yf(de,pe,i));let a=new Date;a.setMinutes(a.getMinutes()+u);let l=a.getTime(),M=new Date;M.setMinutes(M.getMinutes()-u);let z=M.getTime(),D=[],q=[],V=null;for(let de=m.length-1;de>=0;de-=1){let pe={...m[de]},Ie=new Date(pe.time).getTime();Ie>z&&Ie<l&&(pe.state==="BOARDING"&&(q.includes(pe.platform)?pe.state="HIDDEN":q.push(pe.platform)),V&&pe.to[0]===V.to[0]&&Math.abs(Ie-V.time)<1e3&&pe.line.name===V.line.name&&(pe.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(pe.state)&&(pe.cancelled=!0),V=pe,V.time=Ie,D.unshift(pe))}return D},_f=Gw;var qw=(v,i=!1,u=30,m=100)=>{let a={},l={};return M=>{let{source:z,content:D}=M;a[z]&&window.clearTimeout(a[z]),l[D.call_id]=D,a[z]=window.setTimeout(()=>{let q=_f(l,i||!1,u);v(q)},m)}},u_=qw;var Zw=(v,i)=>{let u=null;return typeof window>"u"?null:(typeof document<"u"&&document?.createElement?(u=document.createElement("canvas"),u.width=v,u.height=i):OffscreenCanvas?u=new OffscreenCanvas(v,i):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),u)},Xl=Zw;var od={};wy(od,{bgColors:()=>$0,getBgColor:()=>$w,getDelayColor:()=>Yw,getDelayText:()=>Jw,getRadius:()=>Xw,getTextColor:()=>Kw,getTextSize:()=>Hw,getTypeIndex:()=>dg,textColors:()=>K0,types:()=>X0});var Ww=[[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]],X0=[/^Tram/i,/^Subway( \/ Metro \/ S-Bahn)?/i,/^Train/i,/^Bus/i,/^Ferry/i,/^Cable ?Car/i,/^Gondola/i,/^Funicular/i,/^(Long distance bus|coach)/i,/^Rail/i],$0=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],K0=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],dg=v=>typeof v=="string"?X0.findIndex(i=>i.test(v)):v,Xw=(v,i)=>{try{let u=dg(v||0);return Ww[u][i]}catch{return 1}},$w=v=>{try{let i=dg(v);return $0[i]}catch{return"#ffffff"}},Kw=v=>{try{let i=dg(v);return K0[i]}catch{return"#ffffff"}},Hw=(v,i,u,m)=>{if(!v)return 0;v.font=`bold ${m}px Arial`;let a=v.measureText(u),l=25,M=0;for(;a.width>i-6&&M<l;)m-=.5,v.font=`bold ${m}px arial, sans-serif`,a=v.measureText(u),M+=1;return m},Yw=(v,i,u)=>i?u?"#ff0000":"#a0a0a0":v===null?"#a0a0a0":v>=36e5?"#ed004c":v>=5e5?"#e80000":v>=3e5?"#ff4a00":v>=18e4?"#f7bf00":"#00a00c",Jw=(v,i)=>i?String.fromCodePoint(215):v>36e5?`+${Math.round(v/36e5)}h`:v>59e3?`+${Math.round(v/6e4)}m`:v>0?`+${v}s`:"";var c_={},m_=(v,i,u)=>{let m=`${v}, ${i}, ${u}`;if(!c_[m]){let a=Xl(v*2,v*2);if(a){let l=a.getContext("2d");if(!l)return null;l.beginPath(),l.arc(v,v,i,0,2*Math.PI,!1),l.fillStyle=u,l.filter="blur(1px)",l.fill(),c_[m]=a}}return c_[m]},h_={},g_=(v,i,u,m,a="#000",l=1)=>{let M=`${v}, ${u}, ${m}, ${a}, ${l}`;if(!h_[M]){let z=Xl(Math.ceil(v.length*i),Math.ceil(i+8*l));if(z){let D=z.getContext("2d");if(!D)return null;D.font=u,D.textAlign="left",D.textBaseline="middle",D.font=u,D.fillStyle=m,D.strokeStyle=a,D.lineWidth=1.5*l,D.strokeText(v,0,i),D.fillText(v,0,i),h_[M]=z}}return h_[M]},p_={},y_=(v,i,u,m,a,l)=>{let M=`${v}, ${i}, ${u}, ${m}, ${a}, ${l}`;if(!p_[M]){let z=Xl(v*2,v*2);if(z){let D=z.getContext("2d");if(!D)return null;D.fillStyle=u,m&&(D.lineWidth=1*l,D.strokeStyle="#000000"),D.beginPath(),D.arc(v,v,i,0,2*Math.PI,!1),D.fill(),a&&D.setLineDash([5,3]),m&&D.stroke(),p_[M]=z}}return p_[M]},d_={},__=(v,i,u,m,a,l,M)=>{let z=`${v}, ${i}, ${u}, ${m},${a}, ${l}, ${M}`;if(!d_[z]){let D=Xl(i*2,i*2);if(D){let q=D.getContext("2d");if(!q)return null;l&&(q.save(),q.textBaseline="middle",q.textAlign="center",q.font=`bold ${u+2}px Arial`,q.strokeStyle=a,q.strokeText(v,i,i),q.restore()),q.textBaseline="middle",q.textAlign="center",q.fillStyle=m,q.font=`bold ${u}px Arial`,q.strokeStyle=a,q.strokeText(v,i,i),q.fillText(v,i,i),d_[z]=D}}return d_[z]},f_={},Qw=(v,i,u)=>{let{hoverVehicleId:m,selectedVehicleId:a,useDelayStyle:l,delayOutlineColor:M="#000",delayDisplay:z=3e5,getRadius:D=()=>0,getBgColor:q=()=>"#000",getDelayColor:V=()=>"#000",getDelayText:de=()=>null,getTextColor:pe=()=>"#000",getTextSize:Ie=()=>0,getMaxRadiusForText:Ne=()=>10,getMaxRadiusForStrokeAndDelay:nt=()=>7}=u,{zoom:we,pixelRatio:Pe=1}=i,{type:et}=v.properties,{train_id:ut,line:mt,delay:ct,state:ft,operator_provides_realtime_journey:It}=v.properties,{name:Mt,text_color:zt,color:Qt}=mt||{},Vt=ft==="JOURNEY_CANCELLED";et||(et="Rail"),Mt||(Mt="I"),zt||(zt="#000000"),Qt&&Qt[0]!=="#"&&(Qt=`#${Qt}`),zt[0]!=="#"&&(zt=`#${zt}`);let mi=Math.min(Math.floor(we||1),16),Ii=!!(m&&m===ut),$t=!!(a&&a===ut),ci=D(et,mi)*Pe,Jt=ci>=nt()*Pe;(Ii||$t)&&(ci=Jt?ci+5*Pe:14*Pe);let Ei=ci>Ne()*Pe,ni=`${ci}${Ii||$t}`;if(l?(ni+=`${It}${ct}`,Jt&&(ni+=`${Vt}`)):(ni+=`${Qt||et}`,Jt&&(ni+=`${Vt}${ct}`)),Ei&&(ni+=`${Mt}${zt}`),!f_[ni]){if(ci===0)return null;let Ui=1*Pe,Bi=ci+2*Pe,jr=ci*2,Ht=Bi*2+Ui*2,Br=Ht/2,Gr=null;Jt&&ct!==null&&(Gr=m_(Br,Bi,V(ct,Vt)));let or=null,on=0;if(Jt&&(Ii||(ct||0)>=z||Vt)){on=Math.max(Vt?19:14,Math.min(Vt?19:17,ci*1.2))*Pe;let pr=de(ct,Vt);pr&&(or=g_(pr,on,`bold ${on}px arial, sans-serif`,V(ct,Vt,!0),M,Pe))}let Fi;l?Fi=V(ct,Vt):Fi=Qt||q(et);let qr=y_(Br,ci,Fi,Jt||Ii||$t,!!Jt&&!!l&&ct===null&&It==="yes",Pe),Ai=Ht+(or?.width||0)*2,Ir=Xl(Ai,Ht);if(Ir){let pr=Ir.getContext("2d");if(!pr)return null;let Wn=or?.width||0;Gr&&pr.drawImage(Gr,Wn,0),qr&&pr.drawImage(qr,Wn,0);let dn=null;if(Ei){let qi=Math.max(ci,10),Zr=Ie(pr,jr,Mt,qi),An=l?"#000000":zt||pe(et);dn=__(Mt,Br,Zr,An,Fi,!!l&&ct===null&&It==="yes",Pe)}dn&&pr.drawImage(dn,Wn,0),or&&pr.drawImage(or,Wn+Math.ceil(Br+Bi)+Ui,Math.ceil(Br-on)),f_[ni]=Ir}}return f_[ni]},$h=Qw;var e2=(v,i,u)=>$h(v,i,{...u,useDelayStyle:!0}),v_=e2;var fg,t2=()=>{if(!fg){fg=Xl(15,15);let v=fg?.getContext("2d");v&&(v.arc(8,8,5,0,2*Math.PI,!1),v.fillStyle="#8ED6FF",v.fill(),v.lineWidth=3,v.strokeStyle="black",v.stroke(),v.lineWidth=3)}return fg},x_=t2;var Yr={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var b_=class extends lo{constructor(i){super(),this.on,this.once,this.un,this.background_=i.background;let u=Object.assign({},i);typeof i.properties=="object"&&(delete u.properties,Object.assign(u,i.properties)),u[Yr.OPACITY]=i.opacity!==void 0?i.opacity:1,zr(typeof u[Yr.OPACITY]=="number",64),u[Yr.VISIBLE]=i.visible!==void 0?i.visible:!0,u[Yr.Z_INDEX]=i.zIndex,u[Yr.MAX_RESOLUTION]=i.maxResolution!==void 0?i.maxResolution:1/0,u[Yr.MIN_RESOLUTION]=i.minResolution!==void 0?i.minResolution:0,u[Yr.MIN_ZOOM]=i.minZoom!==void 0?i.minZoom:-1/0,u[Yr.MAX_ZOOM]=i.maxZoom!==void 0?i.maxZoom:1/0,this.className_=u.className!==void 0?u.className:"ol-layer",delete u.className,this.setProperties(u),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(i){let u=this.state_||{layer:this,managed:i===void 0?!0:i},m=this.getZIndex();return u.opacity=Jn(Math.round(this.getOpacity()*100)/100,0,1),u.visible=this.getVisible(),u.extent=this.getExtent(),u.zIndex=m===void 0&&!u.managed?1/0:m,u.maxResolution=this.getMaxResolution(),u.minResolution=Math.max(this.getMinResolution(),0),u.minZoom=this.getMinZoom(),u.maxZoom=this.getMaxZoom(),this.state_=u,u}getLayersArray(i){return Xi()}getLayerStatesArray(i){return Xi()}getExtent(){return this.get(Yr.EXTENT)}getMaxResolution(){return this.get(Yr.MAX_RESOLUTION)}getMinResolution(){return this.get(Yr.MIN_RESOLUTION)}getMinZoom(){return this.get(Yr.MIN_ZOOM)}getMaxZoom(){return this.get(Yr.MAX_ZOOM)}getOpacity(){return this.get(Yr.OPACITY)}getSourceState(){return Xi()}getVisible(){return this.get(Yr.VISIBLE)}getZIndex(){return this.get(Yr.Z_INDEX)}setBackground(i){this.background_=i,this.changed()}setExtent(i){this.set(Yr.EXTENT,i)}setMaxResolution(i){this.set(Yr.MAX_RESOLUTION,i)}setMinResolution(i){this.set(Yr.MIN_RESOLUTION,i)}setMaxZoom(i){this.set(Yr.MAX_ZOOM,i)}setMinZoom(i){this.set(Yr.MIN_ZOOM,i)}setOpacity(i){zr(typeof i=="number",64),this.set(Yr.OPACITY,i)}setVisible(i){this.set(Yr.VISIBLE,i)}setZIndex(i){this.set(Yr.Z_INDEX,i)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},mg=b_;var vf={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Ss={ANIMATING:0,INTERACTING:1};var wl={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function w_(v,i,u){return function(m,a,l,M,z){if(!m)return;if(!a&&!i)return m;let D=i?0:l[0]*a,q=i?0:l[1]*a,V=z?z[0]:0,de=z?z[1]:0,pe=v[0]+D/2+V,Ie=v[2]-D/2+V,Ne=v[1]+q/2+de,nt=v[3]-q/2+de;pe>Ie&&(pe=(Ie+pe)/2,Ie=pe),Ne>nt&&(Ne=(nt+Ne)/2,nt=Ne);let we=Jn(m[0],pe,Ie),Pe=Jn(m[1],Ne,nt);if(M&&u&&a){let et=30*a;we+=-et*Math.log(1+Math.max(0,pe-m[0])/et)+et*Math.log(1+Math.max(0,m[0]-Ie)/et),Pe+=-et*Math.log(1+Math.max(0,Ne-m[1])/et)+et*Math.log(1+Math.max(0,m[1]-nt)/et)}return[we,Pe]}}function H0(v){return v}function S_(v,i,u,m){let a=bo(i)/u[0],l=vl(i)/u[1];return m?Math.min(v,Math.max(a,l)):Math.min(v,Math.min(a,l))}function E_(v,i,u){let m=Math.min(v,i),a=50;return m*=Math.log(1+a*Math.max(0,v/i-1))/a+1,u&&(m=Math.max(m,u),m/=Math.log(1+a*Math.max(0,u/v-1))/a+1),Jn(m,u/2,i*2)}function Y0(v,i,u,m){return i=i!==void 0?i:!0,function(a,l,M,z){if(a!==void 0){let D=v[0],q=v[v.length-1],V=u?S_(D,u,M,m):D;if(z)return i?E_(a,V,q):Jn(a,q,V);let de=Math.min(V,a),pe=Math.floor(jm(v,de,l));return v[pe]>V&&pe<v.length-1?v[pe+1]:v[pe]}}}function J0(v,i,u,m,a,l){return m=m!==void 0?m:!0,u=u!==void 0?u:0,function(M,z,D,q){if(M!==void 0){let V=a?S_(i,a,D,l):i;if(q)return m?E_(M,V,u):Jn(M,u,V);let de=1e-9,pe=Math.ceil(Math.log(i/V)/Math.log(v)-de),Ie=-z*(.5-de)+.5,Ne=Math.min(V,M),nt=Math.floor(Math.log(i/Ne)/Math.log(v)+Ie),we=Math.max(pe,nt),Pe=i/Math.pow(v,we);return Jn(Pe,u,V)}}}function T_(v,i,u,m,a){return u=u!==void 0?u:!0,function(l,M,z,D){if(l!==void 0){let q=m?S_(v,m,z,a):v;return!u||!D?Jn(l,i,q):E_(l,q,i)}}}function Q0(v){if(v!==void 0)return 0}function I_(v){if(v!==void 0)return v}function e1(v){let i=2*Math.PI/v;return function(u,m){if(m)return u;if(u!==void 0)return u=Math.floor(u/i+.5)*i,u}}function t1(v){return v=v||s0(5),function(i,u){if(u)return i;if(i!==void 0)return Math.abs(i)<=v?0:i}}function i2(v){return Math.pow(v,3)}function i1(v){return 1-i2(1-v)}function r1(v){return 3*v*v-2*v*v*v}var C_=0,M_=class extends lo{constructor(i){super(),this.on,this.once,this.un,i=Object.assign({},i),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ig(i.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,i.projection&&Ky(),i.center&&(i.center=Ro(i.center,this.projection_)),i.extent&&(i.extent=Eu(i.extent,this.projection_)),this.applyOptions_(i)}applyOptions_(i){let u=Object.assign({},i);for(let z in wl)delete u[z];this.setProperties(u,!0);let m=n2(i);this.maxResolution_=m.maxResolution,this.minResolution_=m.minResolution,this.zoomFactor_=m.zoomFactor,this.resolutions_=i.resolutions,this.padding_=i.padding,this.minZoom_=m.minZoom;let a=r2(i),l=m.constraint,M=o2(i);this.constraints_={center:a,resolution:l,rotation:M},this.setRotation(i.rotation!==void 0?i.rotation:0),this.setCenterInternal(i.center!==void 0?i.center:null),i.resolution!==void 0?this.setResolution(i.resolution):i.zoom!==void 0&&this.setZoom(i.zoom)}get padding(){return this.padding_}set padding(i){let u=this.padding_;this.padding_=i;let m=this.getCenterInternal();if(m){let a=i||[0,0,0,0];u=u||[0,0,0,0];let l=this.getResolution(),M=l/2*(a[3]-u[3]+u[1]-a[1]),z=l/2*(a[0]-u[0]+u[2]-a[2]);this.setCenterInternal([m[0]+M,m[1]-z])}}getUpdatedOptions_(i){let u=this.getProperties();return u.resolution!==void 0?u.resolution=this.getResolution():u.zoom=this.getZoom(),u.center=this.getCenterInternal(),u.rotation=this.getRotation(),Object.assign({},u,i)}animate(i){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let u=new Array(arguments.length);for(let m=0;m<u.length;++m){let a=arguments[m];a.center&&(a=Object.assign({},a),a.center=Ro(a.center,this.getProjection())),a.anchor&&(a=Object.assign({},a),a.anchor=Ro(a.anchor,this.getProjection())),u[m]=a}this.animateInternal.apply(this,u)}animateInternal(i){let u=arguments.length,m;u>1&&typeof arguments[u-1]=="function"&&(m=arguments[u-1],--u);let a=0;for(;a<u&&!this.isDef();++a){let V=arguments[a];V.center&&this.setCenterInternal(V.center),V.zoom!==void 0?this.setZoom(V.zoom):V.resolution&&this.setResolution(V.resolution),V.rotation!==void 0&&this.setRotation(V.rotation)}if(a===u){m&&gg(m,!0);return}let l=Date.now(),M=this.targetCenter_.slice(),z=this.targetResolution_,D=this.targetRotation_,q=[];for(;a<u;++a){let V=arguments[a],de={start:l,complete:!1,anchor:V.anchor,duration:V.duration!==void 0?V.duration:1e3,easing:V.easing||r1,callback:m};if(V.center&&(de.sourceCenter=M,de.targetCenter=V.center.slice(),M=de.targetCenter),V.zoom!==void 0?(de.sourceResolution=z,de.targetResolution=this.getResolutionForZoom(V.zoom),z=de.targetResolution):V.resolution&&(de.sourceResolution=z,de.targetResolution=V.resolution,z=de.targetResolution),V.rotation!==void 0){de.sourceRotation=D;let pe=Wh(V.rotation-D+Math.PI,2*Math.PI)-Math.PI;de.targetRotation=D+pe,D=de.targetRotation}a2(de)?de.complete=!0:l+=de.duration,q.push(de)}this.animations_.push(q),this.setHint(Ss.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Ss.ANIMATING]>0}getInteracting(){return this.hints_[Ss.INTERACTING]>0}cancelAnimations(){this.setHint(Ss.ANIMATING,-this.hints_[Ss.ANIMATING]);let i;for(let u=0,m=this.animations_.length;u<m;++u){let a=this.animations_[u];if(a[0].callback&&gg(a[0].callback,!1),!i)for(let l=0,M=a.length;l<M;++l){let z=a[l];if(!z.complete){i=z.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=i,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let i=Date.now(),u=!1;for(let m=this.animations_.length-1;m>=0;--m){let a=this.animations_[m],l=!0;for(let M=0,z=a.length;M<z;++M){let D=a[M];if(D.complete)continue;let q=i-D.start,V=D.duration>0?q/D.duration:1;V>=1?(D.complete=!0,V=1):l=!1;let de=D.easing(V);if(D.sourceCenter){let pe=D.sourceCenter[0],Ie=D.sourceCenter[1],Ne=D.targetCenter[0],nt=D.targetCenter[1];this.nextCenter_=D.targetCenter;let we=pe+de*(Ne-pe),Pe=Ie+de*(nt-Ie);this.targetCenter_=[we,Pe]}if(D.sourceResolution&&D.targetResolution){let pe=de===1?D.targetResolution:D.sourceResolution+de*(D.targetResolution-D.sourceResolution);if(D.anchor){let Ie=this.getViewportSize_(this.getRotation()),Ne=this.constraints_.resolution(pe,0,Ie,!0);this.targetCenter_=this.calculateCenterZoom(Ne,D.anchor)}this.nextResolution_=D.targetResolution,this.targetResolution_=pe,this.applyTargetState_(!0)}if(D.sourceRotation!==void 0&&D.targetRotation!==void 0){let pe=de===1?Wh(D.targetRotation+Math.PI,2*Math.PI)-Math.PI:D.sourceRotation+de*(D.targetRotation-D.sourceRotation);if(D.anchor){let Ie=this.constraints_.rotation(pe,!0);this.targetCenter_=this.calculateCenterRotate(Ie,D.anchor)}this.nextRotation_=D.targetRotation,this.targetRotation_=pe}if(this.applyTargetState_(!0),u=!0,!D.complete)break}if(l){this.animations_[m]=null,this.setHint(Ss.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let M=a[0].callback;M&&gg(M,!0)}}this.animations_=this.animations_.filter(Boolean),u&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(i,u){let m,a=this.getCenterInternal();return a!==void 0&&(m=[a[0]-u[0],a[1]-u[1]],c0(m,i-this.getRotation()),u0(m,u)),m}calculateCenterZoom(i,u){let m,a=this.getCenterInternal(),l=this.getResolution();if(a!==void 0&&l!==void 0){let M=u[0]-i*(u[0]-a[0])/l,z=u[1]-i*(u[1]-a[1])/l;m=[M,z]}return m}getViewportSize_(i){let u=this.viewportSize_;if(i){let m=u[0],a=u[1];return[Math.abs(m*Math.cos(i))+Math.abs(a*Math.sin(i)),Math.abs(m*Math.sin(i))+Math.abs(a*Math.cos(i))]}return u}setViewportSize(i){this.viewportSize_=Array.isArray(i)?i.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let i=this.getCenterInternal();return i&&Yp(i,this.getProjection())}getCenterInternal(){return this.get(wl.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(i){return i!==void 0?(i[0]=this.hints_[0],i[1]=this.hints_[1],i):this.hints_.slice()}calculateExtent(i){let u=this.calculateExtentInternal(i);return lh(u,this.getProjection())}calculateExtentInternal(i){i=i||this.getViewportSizeMinusPadding_();let u=this.getCenterInternal();zr(u,1);let m=this.getResolution();zr(m!==void 0,2);let a=this.getRotation();return zr(a!==void 0,3),Wx(u,m,a,i)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(i){this.applyOptions_(this.getUpdatedOptions_({maxZoom:i}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(i){this.applyOptions_(this.getUpdatedOptions_({minZoom:i}))}setConstrainResolution(i){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:i}))}getProjection(){return this.projection_}getResolution(){return this.get(wl.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(i,u){return this.getResolutionForExtentInternal(Eu(i,this.getProjection()),u)}getResolutionForExtentInternal(i,u){u=u||this.getViewportSizeMinusPadding_();let m=bo(i)/u[0],a=vl(i)/u[1];return Math.max(m,a)}getResolutionForValueFunction(i){i=i||2;let u=this.getConstrainedResolution(this.maxResolution_),m=this.minResolution_,a=Math.log(u/m)/Math.log(i);return function(l){return u/Math.pow(i,l*a)}}getRotation(){return this.get(wl.ROTATION)}getValueForResolutionFunction(i){let u=Math.log(i||2),m=this.getConstrainedResolution(this.maxResolution_),a=this.minResolution_,l=Math.log(m/a)/u;return function(M){return Math.log(m/M)/u/l}}getViewportSizeMinusPadding_(i){let u=this.getViewportSize_(i),m=this.padding_;return m&&(u=[u[0]-m[1]-m[3],u[1]-m[0]-m[2]]),u}getState(){let i=this.getProjection(),u=this.getResolution(),m=this.getRotation(),a=this.getCenterInternal(),l=this.padding_;if(l){let M=this.getViewportSizeMinusPadding_();a=A_(a,this.getViewportSize_(),[M[0]/2+l[3],M[1]/2+l[0]],u,m)}return{center:a.slice(0),projection:i!==void 0?i:null,resolution:u,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:m,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let i,u=this.getResolution();return u!==void 0&&(i=this.getZoomForResolution(u)),i}getZoomForResolution(i){let u=this.minZoom_||0,m,a;if(this.resolutions_){let l=jm(this.resolutions_,i,1);u=l,m=this.resolutions_[l],l==this.resolutions_.length-1?a=2:a=m/this.resolutions_[l+1]}else m=this.maxResolution_,a=this.zoomFactor_;return u+Math.log(m/i)/Math.log(a)}getResolutionForZoom(i){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;let u=Jn(Math.floor(i),0,this.resolutions_.length-2),m=this.resolutions_[u]/this.resolutions_[u+1];return this.resolutions_[u]/Math.pow(m,Jn(i-u,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,i-this.minZoom_)}fit(i,u){let m;if(zr(Array.isArray(i)||typeof i.getSimplifiedGeometry=="function",24),Array.isArray(i)){zr(!$x(i),25);let a=Eu(i,this.getProjection());m=s_(a)}else if(i.getType()==="Circle"){let a=Eu(i.getExtent(),this.getProjection());m=s_(a),m.rotate(this.getRotation(),wu(a))}else{let a=Su();a?m=i.clone().transform(a,this.getProjection()):m=i}this.fitInternal(m,u)}rotatedExtentForGeometry(i){let u=this.getRotation(),m=Math.cos(u),a=Math.sin(-u),l=i.getFlatCoordinates(),M=i.getStride(),z=1/0,D=1/0,q=-1/0,V=-1/0;for(let de=0,pe=l.length;de<pe;de+=M){let Ie=l[de]*m-l[de+1]*a,Ne=l[de]*a+l[de+1]*m;z=Math.min(z,Ie),D=Math.min(D,Ne),q=Math.max(q,Ie),V=Math.max(V,Ne)}return[z,D,q,V]}fitInternal(i,u){u=u||{};let m=u.size;m||(m=this.getViewportSizeMinusPadding_());let a=u.padding!==void 0?u.padding:[0,0,0,0],l=u.nearest!==void 0?u.nearest:!1,M;u.minResolution!==void 0?M=u.minResolution:u.maxZoom!==void 0?M=this.getResolutionForZoom(u.maxZoom):M=0;let z=this.rotatedExtentForGeometry(i),D=this.getResolutionForExtentInternal(z,[m[0]-a[1]-a[3],m[1]-a[0]-a[2]]);D=isNaN(D)?M:Math.max(D,M),D=this.getConstrainedResolution(D,l?0:1);let q=this.getRotation(),V=Math.sin(q),de=Math.cos(q),pe=wu(z);pe[0]+=(a[1]-a[3])/2*D,pe[1]+=(a[0]-a[2])/2*D;let Ie=pe[0]*de-pe[1]*V,Ne=pe[1]*de+pe[0]*V,nt=this.getConstrainedCenter([Ie,Ne],D),we=u.callback?u.callback:ac;u.duration!==void 0?this.animateInternal({resolution:D,center:nt,duration:u.duration,easing:u.easing},we):(this.targetResolution_=D,this.targetCenter_=nt,this.applyTargetState_(!1,!0),gg(we,!0))}centerOn(i,u,m){this.centerOnInternal(Ro(i,this.getProjection()),u,m)}centerOnInternal(i,u,m){this.setCenterInternal(A_(i,u,m,this.getResolution(),this.getRotation()))}calculateCenterShift(i,u,m,a){let l,M=this.padding_;if(M&&i){let z=this.getViewportSizeMinusPadding_(-m),D=A_(i,a,[z[0]/2+M[3],z[1]/2+M[0]],u,m);l=[i[0]-D[0],i[1]-D[1]]}return l}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(i){let u=Yp(this.targetCenter_,this.getProjection());this.setCenter([u[0]+i[0],u[1]+i[1]])}adjustCenterInternal(i){let u=this.targetCenter_;this.setCenterInternal([u[0]+i[0],u[1]+i[1]])}adjustResolution(i,u){u=u&&Ro(u,this.getProjection()),this.adjustResolutionInternal(i,u)}adjustResolutionInternal(i,u){let m=this.getAnimating()||this.getInteracting(),a=this.getViewportSize_(this.getRotation()),l=this.constraints_.resolution(this.targetResolution_*i,0,a,m);u&&(this.targetCenter_=this.calculateCenterZoom(l,u)),this.targetResolution_*=i,this.applyTargetState_()}adjustZoom(i,u){this.adjustResolution(Math.pow(this.zoomFactor_,-i),u)}adjustRotation(i,u){u&&(u=Ro(u,this.getProjection())),this.adjustRotationInternal(i,u)}adjustRotationInternal(i,u){let m=this.getAnimating()||this.getInteracting(),a=this.constraints_.rotation(this.targetRotation_+i,m);u&&(this.targetCenter_=this.calculateCenterRotate(a,u)),this.targetRotation_+=i,this.applyTargetState_()}setCenter(i){this.setCenterInternal(i&&Ro(i,this.getProjection()))}setCenterInternal(i){this.targetCenter_=i,this.applyTargetState_()}setHint(i,u){return this.hints_[i]+=u,this.changed(),this.hints_[i]}setResolution(i){this.targetResolution_=i,this.applyTargetState_()}setRotation(i){this.targetRotation_=i,this.applyTargetState_()}setZoom(i){this.setResolution(this.getResolutionForZoom(i))}applyTargetState_(i,u){let m=this.getAnimating()||this.getInteracting()||u,a=this.constraints_.rotation(this.targetRotation_,m),l=this.getViewportSize_(a),M=this.constraints_.resolution(this.targetResolution_,0,l,m),z=this.constraints_.center(this.targetCenter_,M,l,m,this.calculateCenterShift(this.targetCenter_,M,a,l));this.get(wl.ROTATION)!==a&&this.set(wl.ROTATION,a),this.get(wl.RESOLUTION)!==M&&(this.set(wl.RESOLUTION,M),this.set("zoom",this.getZoom(),!0)),(!z||!this.get(wl.CENTER)||!es(this.get(wl.CENTER),z))&&this.set(wl.CENTER,z),this.getAnimating()&&!i&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(i,u,m){i=i!==void 0?i:200;let a=u||0,l=this.constraints_.rotation(this.targetRotation_),M=this.getViewportSize_(l),z=this.constraints_.resolution(this.targetResolution_,a,M),D=this.constraints_.center(this.targetCenter_,z,M,!1,this.calculateCenterShift(this.targetCenter_,z,l,M));if(i===0&&!this.cancelAnchor_){this.targetResolution_=z,this.targetRotation_=l,this.targetCenter_=D,this.applyTargetState_();return}m=m||(i===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==z||this.getRotation()!==l||!this.getCenterInternal()||!es(this.getCenterInternal(),D))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:l,center:D,resolution:z,duration:i,easing:i1,anchor:m}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Ss.INTERACTING,1)}endInteraction(i,u,m){m=m&&Ro(m,this.getProjection()),this.endInteractionInternal(i,u,m)}endInteractionInternal(i,u,m){this.getInteracting()&&(this.setHint(Ss.INTERACTING,-1),this.resolveConstraints(i,u,m))}getConstrainedCenter(i,u){let m=this.getViewportSize_(this.getRotation());return this.constraints_.center(i,u||this.getResolution(),m)}getConstrainedZoom(i,u){let m=this.getResolutionForZoom(i);return this.getZoomForResolution(this.getConstrainedResolution(m,u))}getConstrainedResolution(i,u){u=u||0;let m=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(i,u,m)}};function gg(v,i){setTimeout(function(){v(i)},0)}function r2(v){if(v.extent!==void 0){let u=v.smoothExtentConstraint!==void 0?v.smoothExtentConstraint:!0;return w_(v.extent,v.constrainOnlyCenter,u)}let i=ig(v.projection,"EPSG:3857");if(v.multiWorld!==!0&&i.isGlobal()){let u=i.getExtent().slice();return u[0]=-1/0,u[2]=1/0,w_(u,!1,!1)}return H0}function n2(v){let i,u,m,M=v.minZoom!==void 0?v.minZoom:C_,z=v.maxZoom!==void 0?v.maxZoom:28,D=v.zoomFactor!==void 0?v.zoomFactor:2,q=v.multiWorld!==void 0?v.multiWorld:!1,V=v.smoothResolutionConstraint!==void 0?v.smoothResolutionConstraint:!0,de=v.showFullExtent!==void 0?v.showFullExtent:!1,pe=ig(v.projection,"EPSG:3857"),Ie=pe.getExtent(),Ne=v.constrainOnlyCenter,nt=v.extent;if(!q&&!nt&&pe.isGlobal()&&(Ne=!1,nt=Ie),v.resolutions!==void 0){let we=v.resolutions;u=we[M],m=we[z]!==void 0?we[z]:we[we.length-1],v.constrainResolution?i=Y0(we,V,!Ne&&nt,de):i=T_(u,m,V,!Ne&&nt,de)}else{let Pe=(Ie?Math.max(bo(Ie),vl(Ie)):360*Zh.degrees/pe.getMetersPerUnit())/256/Math.pow(2,C_),et=Pe/Math.pow(2,28-C_);u=v.maxResolution,u!==void 0?M=0:u=Pe/Math.pow(D,M),m=v.minResolution,m===void 0&&(v.maxZoom!==void 0?v.maxResolution!==void 0?m=u/Math.pow(D,z):m=Pe/Math.pow(D,z):m=et),z=M+Math.floor(Math.log(u/m)/Math.log(D)),m=u/Math.pow(D,z-M),v.constrainResolution?i=J0(D,u,m,V,!Ne&&nt,de):i=T_(u,m,V,!Ne&&nt,de)}return{constraint:i,maxResolution:u,minResolution:m,minZoom:M,zoomFactor:D}}function o2(v){if(v.enableRotation!==void 0?v.enableRotation:!0){let u=v.constrainRotation;return u===void 0||u===!0?t1():u===!1?I_:typeof u=="number"?e1(u):I_}return Q0}function a2(v){return!(v.sourceCenter&&v.targetCenter&&!es(v.sourceCenter,v.targetCenter)||v.sourceResolution!==v.targetResolution||v.sourceRotation!==v.targetRotation)}function A_(v,i,u,m,a){let l=Math.cos(-a),M=Math.sin(-a),z=v[0]*l-v[1]*M,D=v[1]*l+v[0]*M;z+=(i[0]/2-u[0])*m,D+=(u[1]-i[1]/2)*m,M=-M;let q=z*l-D*M,V=D*l+z*M;return[q,V]}var P_=M_;var k_=class extends mg{constructor(i){let u=Object.assign({},i);delete u.source,super(u),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,i.render&&(this.render=i.render),i.map&&this.setMap(i.map),this.addChangeListener(Yr.SOURCE,this.handleSourcePropertyChange_);let m=i.source?i.source:null;this.setSource(m)}getLayersArray(i){return i=i||[],i.push(this),i}getLayerStatesArray(i){return i=i||[],i.push(this.getLayerState()),i}getSource(){return this.get(Yr.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let i=this.getSource();return i?i.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Po(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let i=this.getSource();i&&(this.sourceChangeKey_=so(i,cn.CHANGE,this.handleSourceChange_,this),i.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(i){return this.renderer_?this.renderer_.getFeatures(i):Promise.resolve([])}getData(i){return!this.renderer_||!this.rendered?null:this.renderer_.getData(i)}isVisible(i){let u;i instanceof P_?u={viewState:i.getState(),extent:i.calculateExtent()}:u=i;let m=this.getExtent();return this.getVisible()&&R_(this.getLayerState(),u.viewState)&&(!m||uo(m,u.extent))}getAttributions(i){if(!this.isVisible(i))return[];let u,m=this.getSource();if(m&&(u=m.getAttributions()),!u)return[];let a=i instanceof P_?i.getViewStateAndExtent():i,l=u(a);return Array.isArray(l)||(l=[l]),l}render(i,u){let m=this.getRenderer();if(m.prepareFrame(i))return this.rendered=!0,m.renderFrame(i,u)}unrender(){this.rendered=!1}setMapInternal(i){i||this.unrender(),this.set(Yr.MAP,i)}getMapInternal(){return this.get(Yr.MAP)}setMap(i){this.mapPrecomposeKey_&&(Po(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),i||this.changed(),this.mapRenderKey_&&(Po(this.mapRenderKey_),this.mapRenderKey_=null),i&&(this.mapPrecomposeKey_=so(i,vf.PRECOMPOSE,function(u){let a=u.frameState.layerStatesArray,l=this.getLayerState(!1);zr(!a.some(function(M){return M.layer===l.layer}),67),a.push(l)},this),this.mapRenderKey_=so(this,cn.CHANGE,i.render,i),this.changed())}setSource(i){this.set(Yr.SOURCE,i)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}};function R_(v,i){if(!v.visible)return!1;let u=i.resolution;if(u<v.minResolution||u>=v.maxResolution)return!1;let m=i.zoom;return m>v.minZoom&&m<=v.maxZoom}var Kh=k_;var L_=class extends lo{constructor(u={}){super(u);this.defineProperties(u);let{active:m}={active:u.active!==!1,...u};this.active=m}defineProperties(u){let{target:m,element:a,render:l}={...u};Object.defineProperties(this,{active:{get:()=>this.get("active"),set:M=>{this.set("active",M),M?this.activate():this.deactivate(),this.render()}},map:{get:()=>this.get("map"),set:M=>{if(this.map&&this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.deactivate(),this.set("map",M),this.map){let z=this.target||this.map.getTargetElement&&this.map.getTargetElement()||this.map.getContainer&&this.map.getContainer();this.element||this.createDefaultElement(),this.element&&z.appendChild(this.element),this.active&&this.activate()}this.render()}},target:{value:m},element:{value:a,writable:!0},render:{value:l||this.render,writable:!0}})}attachToMap(u){this.map=u}detachFromMap(){this.map=void 0}activate(){this.deactivate()}deactivate(){console.error("The function deactivate() must be implemented in subclasses")}render(u){console.error("The function render() must be implemented in subclasses")}createDefaultElement(){console.error("The function createDefaultElement() must be implemented in subclasses")}},ad=L_;var z_=class extends ad{render(){this.element&&(this.element.innerHTML=this.active?this.getCopyrights().join(" | "):"")}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-copyright",Object.assign(this.element.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"})}getCopyrights(){return console.error("The getCopyrights() function must be implemented in subclasses.",this),[]}},yg=z_;var D_=class extends yg{constructor(u){super(u);this.onPostRender=this.onPostRender.bind(this)}getCopyrights(){if(!this.frameState)return[];let u=[];return this.frameState?.layerStatesArray.forEach(m=>{let{layer:a}=m;this.frameState&&R_(m,this.frameState.viewState)&&a&&a.getSource&&a.getSource()&&a.getSource().getAttributions()&&(u=u.concat(a.getSource().getAttributions()(this.frameState)))}),qh(u)}activate(){super.activate(),this.map&&this.map.on("postrender",this.onPostRender)}deactivate(){this.map&&this.map.un("postrender",this.onPostRender)}onPostRender(u){this.map&&this.element&&(this.frameState=u.frameState||void 0,this.render())}},n1=D_;var Es={ADD:"add",REMOVE:"remove"};var o1={LENGTH:"length"},sd=class extends nn{constructor(i,u,m){super(i),this.element=u,this.index=m}},F_=class extends lo{constructor(i,u){if(super(),this.on,this.once,this.un,u=u||{},this.unique_=!!u.unique,this.array_=i||[],this.unique_)for(let m=0,a=this.array_.length;m<a;++m)this.assertUnique_(this.array_[m],m);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(i){for(let u=0,m=i.length;u<m;++u)this.push(i[u]);return this}forEach(i){let u=this.array_;for(let m=0,a=u.length;m<a;++m)i(u[m],m,u)}getArray(){return this.array_}item(i){return this.array_[i]}getLength(){return this.get(o1.LENGTH)}insertAt(i,u){if(i<0||i>this.getLength())throw new Error("Index out of bounds: "+i);this.unique_&&this.assertUnique_(u),this.array_.splice(i,0,u),this.updateLength_(),this.dispatchEvent(new sd(Es.ADD,u,i))}pop(){return this.removeAt(this.getLength()-1)}push(i){this.unique_&&this.assertUnique_(i);let u=this.getLength();return this.insertAt(u,i),this.getLength()}remove(i){let u=this.array_;for(let m=0,a=u.length;m<a;++m)if(u[m]===i)return this.removeAt(m)}removeAt(i){if(i<0||i>=this.getLength())return;let u=this.array_[i];return this.array_.splice(i,1),this.updateLength_(),this.dispatchEvent(new sd(Es.REMOVE,u,i)),u}setAt(i,u){let m=this.getLength();if(i>=m){this.insertAt(i,u);return}if(i<0)throw new Error("Index out of bounds: "+i);this.unique_&&this.assertUnique_(u,i);let a=this.array_[i];this.array_[i]=u,this.dispatchEvent(new sd(Es.REMOVE,a,i)),this.dispatchEvent(new sd(Es.ADD,u,i))}updateLength_(){this.set(o1.LENGTH,this.array_.length)}assertUnique_(i,u){for(let m=0,a=this.array_.length;m<a;++m)if(this.array_[m]===i&&m!==u)throw new Km(58)}},dh=F_;var xf=class extends lo{constructor(i){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),i)if(typeof i.getSimplifiedGeometry=="function"){let u=i;this.setGeometry(u)}else{let u=i;this.setProperties(u)}}clone(){let i=new xf(this.hasProperties()?this.getProperties():null);i.setGeometryName(this.getGeometryName());let u=this.getGeometry();u&&i.setGeometry(u.clone());let m=this.getStyle();return m&&i.setStyle(m),i}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Po(this.geometryChangeKey_),this.geometryChangeKey_=null);let i=this.getGeometry();i&&(this.geometryChangeKey_=so(i,cn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(i){this.set(this.geometryName_,i)}setStyle(i){this.style_=i,this.styleFunction_=i?s2(i):void 0,this.changed()}setId(i){this.id_=i,this.changed()}setGeometryName(i){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=i,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}};function s2(v){if(typeof v=="function")return v;let i;return Array.isArray(v)?i=v:(zr(typeof v.getZIndex=="function",41),i=[v]),function(){return i}}var Tu=xf;var bf=class{constructor(i){i=i||{},this.color_=i.color!==void 0?i.color:null}clone(){let i=this.getColor();return new bf({color:Array.isArray(i)?i.slice():i||void 0})}getColor(){return this.color_}setColor(i){this.color_=i}},ba=bf;var wf=class{constructor(i){i=i||{},this.color_=i.color!==void 0?i.color:null,this.lineCap_=i.lineCap,this.lineDash_=i.lineDash!==void 0?i.lineDash:null,this.lineDashOffset_=i.lineDashOffset,this.lineJoin_=i.lineJoin,this.miterLimit_=i.miterLimit,this.width_=i.width}clone(){let i=this.getColor();return new wf({color:Array.isArray(i)?i.slice():i||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(i){this.color_=i}setLineCap(i){this.lineCap_=i}setLineDash(i){this.lineDash_=i}setLineDashOffset(i){this.lineDashOffset_=i}setLineJoin(i){this.lineJoin_=i}setMiterLimit(i){this.miterLimit_=i}setWidth(i){this.width_=i}},Wo=wf;var Zn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function ld(v,i){return Array.isArray(v)?v:(i===void 0?i=[v,v]:(i[0]=v,i[1]=v),i)}var Sf=class{constructor(i){this.opacity_=i.opacity,this.rotateWithView_=i.rotateWithView,this.rotation_=i.rotation,this.scale_=i.scale,this.scaleArray_=ld(i.scale),this.displacement_=i.displacement,this.declutterMode_=i.declutterMode}clone(){let i=this.getScale();return new Sf({opacity:this.getOpacity(),scale:Array.isArray(i)?i.slice():i,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return Xi()}getImage(i){return Xi()}getHitDetectionImage(){return Xi()}getPixelRatio(i){return 1}getImageState(){return Xi()}getImageSize(){return Xi()}getOrigin(){return Xi()}getSize(){return Xi()}setDisplacement(i){this.displacement_=i}setOpacity(i){this.opacity_=i}setRotateWithView(i){this.rotateWithView_=i}setRotation(i){this.rotation_=i}setScale(i){this.scale_=i,this.scaleArray_=ld(i)}listenImageChange(i){Xi()}load(){Xi()}unlistenImageChange(i){Xi()}},_g=Sf;var l2=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,u2=/^([a-z]*)$|^hsla?\(.*\)$/i;function vg(v){return typeof v=="string"?v:O_(v)}function c2(v){let i=document.createElement("div");if(i.style.color=v,i.style.color!==""){document.body.appendChild(i);let u=getComputedStyle(i).color;return document.body.removeChild(i),u}return""}var h2=function(){let i={},u=0;return function(m){let a;if(i.hasOwnProperty(m))a=i[m];else{if(u>=1024){let l=0;for(let M in i)l++&3||(delete i[M],--u)}a=p2(m),i[m]=a,++u}return a}}();function Hh(v){return Array.isArray(v)?v:h2(v)}function p2(v){let i,u,m,a,l;if(u2.exec(v)&&(v=c2(v)),l2.exec(v)){let M=v.length-1,z;M<=4?z=1:z=2;let D=M===4||M===8;i=parseInt(v.substr(1+0*z,z),16),u=parseInt(v.substr(1+1*z,z),16),m=parseInt(v.substr(1+2*z,z),16),D?a=parseInt(v.substr(1+3*z,z),16):a=255,z==1&&(i=(i<<4)+i,u=(u<<4)+u,m=(m<<4)+m,D&&(a=(a<<4)+a)),l=[i,u,m,a/255]}else v.startsWith("rgba(")?(l=v.slice(5,-1).split(",").map(Number),a1(l)):v.startsWith("rgb(")?(l=v.slice(4,-1).split(",").map(Number),l.push(1),a1(l)):zr(!1,14);return l}function a1(v){return v[0]=Jn(v[0]+.5|0,0,255),v[1]=Jn(v[1]+.5|0,0,255),v[2]=Jn(v[2]+.5|0,0,255),v[3]=Jn(v[3],0,1),v}function O_(v){let i=v[0];i!=(i|0)&&(i=i+.5|0);let u=v[1];u!=(u|0)&&(u=u+.5|0);let m=v[2];m!=(m|0)&&(m=m+.5|0);let a=v[3]===void 0?1:Math.round(v[3]*100)/100;return"rgba("+i+","+u+","+m+","+a+")"}function Ts(v){return Array.isArray(v)?O_(v):v}function aa(v,i,u,m){let a;return u&&u.length?a=u.shift():Zp?a=new OffscreenCanvas(v||300,i||300):a=document.createElement("canvas"),v&&(a.width=v),i&&(a.height=i),a.getContext("2d",m)}function s1(v){let i=v.canvas;i.width=1,i.height=1,v.clearRect(0,0,1,1)}var d2=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),l1=["style","variant","weight","size","lineHeight","family"],B_=function(v){let i=v.match(d2);if(!i)return null;let u={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let m=0,a=l1.length;m<a;++m){let l=i[m+1];l!==void 0&&(u[l1[m]]=l)}return u.families=u.family.split(/,\s?/),u};var bg="10px sans-serif",Is="#000",Yh="round",hc=[],pc=0,Iu="round",dc=10,fc="#000",mh="center",Jh="middle",mc=[0,0,0,0],gc=1,fh=new lo,ud=null,U_,V_={},u1=function(){let i="32px ",u=["monospace","serif"],m=u.length,a="wmytzilWMYTZIL@#/&?$%10\uF013",l,M;function z(q,V,de){let pe=!0;for(let Ie=0;Ie<m;++Ie){let Ne=u[Ie];if(M=xg(q+" "+V+" "+i+Ne,a),de!=Ne){let nt=xg(q+" "+V+" "+i+de+","+Ne,a);pe=pe&&nt!=M}}return!!pe}function D(){let q=!0,V=fh.getKeys();for(let de=0,pe=V.length;de<pe;++de){let Ie=V[de];fh.get(Ie)<100&&(z.apply(this,Ie.split(`
1075
+ `,document.addEventListener("keydown",x=>{x.key===r&&(this._metaPress=!0)}),document.addEventListener("keyup",x=>{x.key===r&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",x=>{this._onCooperativeGesture(x,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(S,r,d){this._canvas.width=d*S,this._canvas.height=d*r,this._canvas.style.width=`${S}px`,this._canvas.style.height=`${r}px`}_setupPainter(){let S=l.extend({},M.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl",S)||this._canvas.getContext("experimental-webgl",S);r?(this.painter=new iu(r,this.transform),l.exported$1.testSupport(r)):this.fire(new l.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(S){S.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.Event("webglcontextlost",{originalEvent:S}))}_contextRestored(S){this._setupPainter(),this.resize(),this._update(),this.fire(new l.Event("webglcontextrestored",{originalEvent:S}))}_onMapScroll(S){if(S.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(S,r,d){return!r&&d<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(S){return this.style?(this._styleDirty=this._styleDirty||S,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(S){return this._update(),this._renderTaskQueue.add(S)}_cancelRenderFrame(S){this._renderTaskQueue.remove(S)}_render(S){let r,d=0,x=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(r=x.createQueryEXT(),x.beginQueryEXT(x.TIME_ELAPSED_EXT,r),d=l.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(S),this._removed)return;let E=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let U=this.transform.zoom,G=l.exported.now();this.style.zoomHistory.update(U,G);let X=new l.EvaluationParameters(U,{now:G,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Y=X.crossFadingFactor();Y===1&&Y===this._crossFadingFactor||(E=!0,this._crossFadingFactor=Y),this.style.update(X)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new l.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.load),this.fire(new l.Event("load"))),this.style&&(this.style.hasTransitions()||E)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){let U=l.exported.now()-d;x.endQueryEXT(x.TIME_ELAPSED_EXT,r),setTimeout(()=>{let G=x.getQueryObjectEXT(r,x.QUERY_RESULT_EXT)/1e6;x.deleteQueryEXT(r),this.fire(new l.Event("gpu-timing-frame",{cpuTime:U,gpuTime:G}))},50)}if(this.listens("gpu-timing-layer")){let U=this.painter.collectGpuTimers();setTimeout(()=>{let G=this.painter.queryGpuTimers(U);this.fire(new l.Event("gpu-timing-layer",{layerTimes:G}))},50)}let P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.Event("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let r of this._controls)r.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));let S=this.painter.context.gl.getExtension("WEBGL_lose_context");S&&S.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),V.remove(this._canvasContainer),V.remove(this._controlContainer),this._cooperativeGestures&&V.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),l.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new l.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=l.exported.frame(S=>{l.PerformanceUtils.frame(S),this._frame=null,this._render(S)}))}_onWindowOnline(){this._update()}_onWindowResize(S){this._trackResize&&this.resize({originalEvent:S})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(S){this._showTileBoundaries!==S&&(this._showTileBoundaries=S,this._update())}get showPadding(){return!!this._showPadding}set showPadding(S){this._showPadding!==S&&(this._showPadding=S,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(S){this._showCollisionBoxes!==S&&(this._showCollisionBoxes=S,S?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(S){this._showOverdrawInspector!==S&&(this._showOverdrawInspector=S,this._update())}get repaint(){return!!this._repaint}set repaint(S){this._repaint!==S&&(this._repaint=S,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(S){this._vertices=S,this._update()}_setCacheLimits(S,r){l.setCacheLimits(S,r)}get version(){return"2.4.0"}},NavigationControl:class{constructor(S){this.options=l.extend({},Uo,S),this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(l.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",r=>this._map.zoomIn({},{originalEvent:r})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",r=>this._map.zoomOut({},{originalEvent:r})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(l.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",r=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:r}):this._map.resetNorth({},{originalEvent:r})}),this._compassIcon=V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let S=this._map.getZoom(),r=S===this._map.getMaxZoom(),d=S===this._map.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())}_rotateCompassArrow(){let S=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=S}onAdd(S){return this._map=S,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Di(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){V.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(S,r){let d=V.create("button",S,this._container);return d.type="button",d.addEventListener("click",r),d}_setButtonTitle(S,r){let d=this._map._getUIString(`NavigationControl.${r}`);S.title=d,S.setAttribute("aria-label",d)}},GeolocateControl:class extends l.Evented{constructor(S){super(),this.options=l.extend({},Pa,S),l.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(S){var r;return this._map=S,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),r=this._setupUI,Vn!==void 0?r(Vn):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Vn=d.state!=="denied",r(Vn)}):(Vn=!!window.navigator.geolocation,r(Vn)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),V.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,yr=0,ta=!1}_isOutOfMapMaxBounds(S){let r=this._map.getMaxBounds(),d=S.coords;return r&&(d.longitude<r.getWest()||d.longitude>r.getEast()||d.latitude<r.getSouth()||d.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(S){if(this._map){if(this._isOutOfMapMaxBounds(S))return this._setErrorState(),this.fire(new l.Event("outofmaxbounds",S)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=S,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(S),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(S),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("geolocate",S)),this._finish()}}_updateCamera(S){let r=new l.LngLat(S.coords.longitude,S.coords.latitude),d=S.coords.accuracy,x=this._map.getBearing(),E=l.extend({bearing:x},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(d),E,{geolocateSource:!0})}_updateMarker(S){if(S){let r=new l.LngLat(S.coords.longitude,S.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=S.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let S=this._map._container.clientHeight/2,r=this._map.unproject([0,S]),d=this._map.unproject([1,S]),x=r.distanceTo(d),E=Math.ceil(2*this._accuracy/x);this._circleElement.style.width=`${E}px`,this._circleElement.style.height=`${E}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(S){if(this._map){if(this.options.trackUserLocation)if(S.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(S.code===3&&ta)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("error",S)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(S){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=V.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",S===!1){l.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}else{let r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=V.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new ea(this._dotElement),this._circleElement=V.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ea({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||this._watchState!=="ACTIVE_LOCK"||r.originalEvent&&r.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new l.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return l.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":yr--,ta=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new l.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let S;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),yr++,yr>1?(S={maximumAge:6e5,timeout:0},ta=!0):(S=this.options.positionOptions,ta=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,S)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:cl,LogoControl:hs,ScaleControl:class{constructor(S){this.options=l.extend({},ui,S),l.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){li(this._map,this._container,this.options)}onAdd(S){return this._map=S,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",S.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){V.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(S){this.options.unit=S,li(this._map,this._container,this.options)}},FullscreenControl:class{constructor(S){this._fullscreen=!1,S&&S.container&&(S.container instanceof HTMLElement?this._container=S.container:l.warnOnce("Full screen control 'container' must be a DOM element.")),l.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(S){return this._map=S,this._container||(this._container=this._map.getContainer()),this._controlContainer=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",l.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){V.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let S=this._fullscreenButton=V.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",S).setAttribute("aria-hidden","true"),S.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let S=this._getTitle();this._fullscreenButton.setAttribute("aria-label",S),this._fullscreenButton.title=S}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(S){this.options=S,l.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(S){return this._map=S,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=V.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){V.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends l.Evented{constructor(S){super(),this.options=l.extend(Object.create(nr),S),l.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(S){return this._map&&this.remove(),this._map=S,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new l.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&V.remove(this._content),this._container&&(V.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new l.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(S){return this._lngLat=l.LngLat.convert(S),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(S){return this.setDOMContent(document.createTextNode(S))}setHTML(S){let r=document.createDocumentFragment(),d=document.createElement("body"),x;for(d.innerHTML=S;x=d.firstChild,x;)r.appendChild(x);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(S){return this.options.maxWidth=S,this._update(),this}setDOMContent(S){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=V.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(S),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(S){this._container&&this._container.classList.add(S)}removeClassName(S){this._container&&this._container.classList.remove(S)}setOffset(S){return this.options.offset=S,this._update(),this}toggleClassName(S){if(this._container)return this._container.classList.toggle(S)}_createCloseButton(){this.options.closeButton&&(this._closeButton=V.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(S){this._update(S.point)}_onMouseMove(S){this._update(S.point)}_onDrag(S){this._update(S.point)}_update(S){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=V.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=V.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(P=>this._container.classList.add(P)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ao(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!S))return;let r=this._pos=this._trackPointer&&S?S:this._map.project(this._lngLat),d=this.options.anchor,x=Tn(this.options.offset);if(!d){let P=this._container.offsetWidth,U=this._container.offsetHeight,G;G=r.y+x.bottom.y<U?["top"]:r.y>this._map.transform.height-U?["bottom"]:[],r.x<P/2?G.push("left"):r.x>this._map.transform.width-P/2&&G.push("right"),d=G.length===0?"bottom":G.join("-")}let E=r.add(x[d]).round();V.setTransform(this._container,`${si[d]} translate(${E.x}px,${E.y}px)`),hi(this._container,d,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let S=this._container.querySelector(wr);S&&S.focus()}_onClose(){this.remove()}},Marker:ea,Style:En,LngLat:l.LngLat,LngLatBounds:l.LngLatBounds,Point:l.pointGeometry,MercatorCoordinate:l.MercatorCoordinate,Evented:l.Evented,AJAXError:l.AJAXError,config:l.config,CanvasSource:Ui,GeoJSONSource:ci,ImageSource:Ei,RasterDEMTileSource:$t,RasterTileSource:mi,VectorTileSource:Vt,VideoSource:ni,prewarm:function(){pr().acquire(qr)},clearPrewarmedResources:function(){let S=Ir;S&&(S.isPreloaded()&&S.numActive()===1?(S.release(qr),Ir=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Ai.workerCount},set workerCount(S){Ai.workerCount=S},get maxParallelImageRequests(){return l.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(S){l.config.MAX_PARALLEL_IMAGE_REQUESTS=S},clearStorage(S){l.clearTileCache(S)},workerUrl:"",addProtocol(S,r){l.config.REGISTERED_PROTOCOLS[S]=r},removeProtocol(S){delete l.config.REGISTERED_PROTOCOLS[S]}};return Kr.extend(oo,{isSafari:l.isSafari,getPerformanceMetrics:l.PerformanceUtils.getPerformanceMetrics}),oo});var a=u;return a})});var Sb=Wd((OO,wb)=>{var sS="Expected a function",xb=NaN,lS="[object Symbol]",uS=/^\s+|\s+$/g,cS=/^[-+]0x[0-9a-f]+$/i,hS=/^0b[01]+$/i,pS=/^0o[0-7]+$/i,dS=parseInt,fS=typeof global=="object"&&global&&global.Object===Object&&global,mS=typeof self=="object"&&self&&self.Object===Object&&self,gS=fS||mS||Function("return this")(),yS=Object.prototype,_S=yS.toString,vS=Math.max,xS=Math.min,$v=function(){return gS.Date.now()};function bS(v,i,u){var m,a,l,M,z,D,q=0,V=!1,de=!1,pe=!0;if(typeof v!="function")throw new TypeError(sS);i=bb(i)||0,Kv(u)&&(V=!!u.leading,de="maxWait"in u,l=de?vS(bb(u.maxWait)||0,i):l,pe="trailing"in u?!!u.trailing:pe);function Ie(ft){var It=m,Mt=a;return m=a=void 0,q=ft,M=v.apply(Mt,It),M}function Ne(ft){return q=ft,z=setTimeout(Pe,i),V?Ie(ft):M}function nt(ft){var It=ft-D,Mt=ft-q,zt=i-It;return de?xS(zt,l-Mt):zt}function we(ft){var It=ft-D,Mt=ft-q;return D===void 0||It>=i||It<0||de&&Mt>=l}function Pe(){var ft=$v();if(we(ft))return et(ft);z=setTimeout(Pe,nt(ft))}function et(ft){return z=void 0,pe&&m?Ie(ft):(m=a=void 0,M)}function ut(){z!==void 0&&clearTimeout(z),q=0,m=D=a=z=void 0}function mt(){return z===void 0?M:et($v())}function ct(){var ft=$v(),It=we(ft);if(m=arguments,a=this,D=ft,It){if(z===void 0)return Ne(D);if(de)return z=setTimeout(Pe,i),Ie(D)}return z===void 0&&(z=setTimeout(Pe,i)),M}return ct.cancel=ut,ct.flush=mt,ct}function Kv(v){var i=typeof v;return!!v&&(i=="object"||i=="function")}function wS(v){return!!v&&typeof v=="object"}function SS(v){return typeof v=="symbol"||wS(v)&&_S.call(v)==lS}function bb(v){if(typeof v=="number")return v;if(SS(v))return xb;if(Kv(v)){var i=typeof v.valueOf=="function"?v.valueOf():v;v=Kv(i)?i+"":i}if(typeof v!="string")return v===0?v:+v;v=v.replace(uS,"");var u=hS.test(v);return u||pS.test(v)?dS(v.slice(2),u?2:8):cS.test(v)?xb:+v}wb.exports=bS});var Ab=Wd((BO,Cb)=>{var Ib="Expected a function",Eb=NaN,ES="[object Symbol]",TS=/^\s+|\s+$/g,IS=/^[-+]0x[0-9a-f]+$/i,CS=/^0b[01]+$/i,AS=/^0o[0-7]+$/i,MS=parseInt,PS=typeof global=="object"&&global&&global.Object===Object&&global,kS=typeof self=="object"&&self&&self.Object===Object&&self,RS=PS||kS||Function("return this")(),LS=Object.prototype,zS=LS.toString,DS=Math.max,FS=Math.min,Hv=function(){return RS.Date.now()};function OS(v,i,u){var m,a,l,M,z,D,q=0,V=!1,de=!1,pe=!0;if(typeof v!="function")throw new TypeError(Ib);i=Tb(i)||0,kg(u)&&(V=!!u.leading,de="maxWait"in u,l=de?DS(Tb(u.maxWait)||0,i):l,pe="trailing"in u?!!u.trailing:pe);function Ie(ft){var It=m,Mt=a;return m=a=void 0,q=ft,M=v.apply(Mt,It),M}function Ne(ft){return q=ft,z=setTimeout(Pe,i),V?Ie(ft):M}function nt(ft){var It=ft-D,Mt=ft-q,zt=i-It;return de?FS(zt,l-Mt):zt}function we(ft){var It=ft-D,Mt=ft-q;return D===void 0||It>=i||It<0||de&&Mt>=l}function Pe(){var ft=Hv();if(we(ft))return et(ft);z=setTimeout(Pe,nt(ft))}function et(ft){return z=void 0,pe&&m?Ie(ft):(m=a=void 0,M)}function ut(){z!==void 0&&clearTimeout(z),q=0,m=D=a=z=void 0}function mt(){return z===void 0?M:et(Hv())}function ct(){var ft=Hv(),It=we(ft);if(m=arguments,a=this,D=ft,It){if(z===void 0)return Ne(D);if(de)return z=setTimeout(Pe,i),Ie(D)}return z===void 0&&(z=setTimeout(Pe,i)),M}return ct.cancel=ut,ct.flush=mt,ct}function BS(v,i,u){var m=!0,a=!0;if(typeof v!="function")throw new TypeError(Ib);return kg(u)&&(m="leading"in u?!!u.leading:m,a="trailing"in u?!!u.trailing:a),OS(v,i,{leading:m,maxWait:i,trailing:a})}function kg(v){var i=typeof v;return!!v&&(i=="object"||i=="function")}function US(v){return!!v&&typeof v=="object"}function VS(v){return typeof v=="symbol"||US(v)&&zS.call(v)==ES}function Tb(v){if(typeof v=="number")return v;if(VS(v))return Eb;if(kg(v)){var i=typeof v.valueOf=="function"?v.valueOf():v;v=kg(i)?i+"":i}if(typeof v!="string")return v===0?v:+v;v=v.replace(TS,"");var u=CS.test(v);return u||AS.test(v)?MS(v.slice(2),u?2:8):IS.test(v)?Eb:+v}Cb.exports=BS});var zg={};wy(zg,{CopyrightControl:()=>n1,Layer:()=>As,MapboxLayer:()=>ip,MapboxStyleLayer:()=>vb,MaplibreLayer:()=>rp,RealtimeAPI:()=>Hd,RealtimeLayer:()=>Pb,RealtimeModes:()=>Go,RoutingAPI:()=>Xd,RoutingControl:()=>hb,RoutingLayer:()=>Ag,StopFinderControl:()=>db,StopsAPI:()=>$d,VectorLayer:()=>kb,WMSLayer:()=>Rb,compareDepartures:()=>yf,createCanvas:()=>Xl,createRealtimeFilters:()=>ky,debounceDeparturesMessages:()=>u_,debounceWebsocketMessages:()=>Kd,fullTrajectoryDelayStyle:()=>Mb,fullTrajectoryStyle:()=>Lg,getCircleCanvas:()=>y_,getDelayBgCanvas:()=>m_,getDelayTextCanvas:()=>g_,getHoursAndMinutes:()=>Fx,getLayersAsFlatArray:()=>Yd,getMapboxMapCopyrights:()=>sc,getMapboxRender:()=>nd,getMaplibreRender:()=>rd,getTextCanvas:()=>__,getUTCDateString:()=>zx,getUTCTimeString:()=>Dx,getUrlWithParams:()=>Gh,pad:()=>$m,realtimeConfig:()=>od,realtimeDefaultStyle:()=>$h,realtimeDelayStyle:()=>v_,realtimeSimpleStyle:()=>x_,removeDuplicate:()=>qh,renderTrajectories:()=>gf,sortAndFilterDepartures:()=>_f,sortByDelay:()=>Ry});var Sy=class{constructor(i){this.propagationStopped,this.defaultPrevented,this.type=i,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var nn=Sy;var Np={PROPERTYCHANGE:"propertychange"};var Ey=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Ax=Ey;function Mx(v,i,u){let m,a;u=u||rh;let l=0,M=v.length,z=!1;for(;l<M;)m=l+(M-l>>1),a=+u(v[m],i),a<0?l=m+1:(M=m,z=!a);return z?l:~l}function rh(v,i){return v>i?1:v<i?-1:0}function jm(v,i,u){let m=v.length;if(v[0]<=i)return 0;if(i<=v[m-1])return m-1;let a;if(u>0){for(a=1;a<m;++a)if(v[a]<i)return a-1}else if(u<0){for(a=1;a<m;++a)if(v[a]<=i)return a}else for(a=1;a<m;++a){if(v[a]==i)return a;if(v[a]<i)return typeof u=="function"?u(i,v[a-1],v[a])>0?a-1:a:v[a-1]-i<i-v[a]?a-1:a}return m-1}function Px(v,i,u){for(;i<u;){let m=v[i];v[i]=v[u],v[u]=m,++i,--u}}function Ya(v,i){let u=Array.isArray(i)?i:[i],m=u.length;for(let a=0;a<m;a++)v[v.length]=u[a]}function xs(v,i){let u=v.length;if(u!==i.length)return!1;for(let m=0;m<u;m++)if(v[m]!==i[m])return!1;return!0}function Gm(){return!0}function ac(){}function kx(v){let i=!1,u,m,a;return function(){let l=Array.prototype.slice.call(arguments);return(!i||this!==a||!xs(l,m))&&(i=!0,a=this,m=l,u=v.apply(this,arguments)),u}}function nh(v){for(let i in v)delete v[i]}function Gl(v){let i;for(i in v)return!1;return!i}var Ty=class extends Ax{constructor(i){super(),this.eventTarget_=i,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(i,u){if(!i||!u)return;let m=this.listeners_||(this.listeners_={}),a=m[i]||(m[i]=[]);a.includes(u)||a.push(u)}dispatchEvent(i){let u=typeof i=="string",m=u?i:i.type,a=this.listeners_&&this.listeners_[m];if(!a)return;let l=u?new nn(i):i;l.target||(l.target=this.eventTarget_||this);let M=this.dispatching_||(this.dispatching_={}),z=this.pendingRemovals_||(this.pendingRemovals_={});m in M||(M[m]=0,z[m]=0),++M[m];let D;for(let q=0,V=a.length;q<V;++q)if("handleEvent"in a[q]?D=a[q].handleEvent(l):D=a[q].call(this,l),D===!1||l.propagationStopped){D=!1;break}if(--M[m]===0){let q=z[m];for(delete z[m];q--;)this.removeEventListener(m,ac);delete M[m]}return D}disposeInternal(){this.listeners_&&nh(this.listeners_)}getListeners(i){return this.listeners_&&this.listeners_[i]||void 0}hasListener(i){return this.listeners_?i?i in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(i,u){let m=this.listeners_&&this.listeners_[i];if(m){let a=m.indexOf(u);a!==-1&&(this.pendingRemovals_&&i in this.pendingRemovals_?(m[a]=ac,++this.pendingRemovals_[i]):(m.splice(a,1),m.length===0&&delete this.listeners_[i]))}}},qm=Ty;var cn={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function so(v,i,u,m,a){if(m&&m!==v&&(u=u.bind(m)),a){let M=u;u=function(){v.removeEventListener(i,u),M.apply(this,arguments)}}let l={target:v,type:i,listener:u};return v.addEventListener(i,u),l}function jp(v,i,u,m){return so(v,i,u,m,!0)}function Po(v){v&&v.target&&(v.target.removeEventListener(v.type,v.listener),nh(v))}var Gp=class extends qm{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(cn.CHANGE)}getRevision(){return this.revision_}onInternal(i,u){if(Array.isArray(i)){let m=i.length,a=new Array(m);for(let l=0;l<m;++l)a[l]=so(this,i[l],u);return a}return so(this,i,u)}onceInternal(i,u){let m;if(Array.isArray(i)){let a=i.length;m=new Array(a);for(let l=0;l<a;++l)m[l]=jp(this,i[l],u)}else m=jp(this,i,u);return u.ol_key=m,m}unInternal(i,u){let m=u.ol_key;if(m)Ja(m);else if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)this.removeEventListener(i[a],u);else this.removeEventListener(i,u)}};Gp.prototype.on;Gp.prototype.once;Gp.prototype.un;function Ja(v){if(Array.isArray(v))for(let i=0,u=v.length;i<u;++i)Po(v[i]);else Po(v)}var Zm=Gp;function Xi(){throw new Error("Unimplemented abstract method.")}var hw=0;function Tr(v){return v.ol_uid||(v.ol_uid=String(++hw))}var Wm=class extends nn{constructor(i,u,m){super(i),this.key=u,this.oldValue=m}},Iy=class extends Zm{constructor(i){super(),this.on,this.once,this.un,Tr(this),this.values_=null,i!==void 0&&this.setProperties(i)}get(i){let u;return this.values_&&this.values_.hasOwnProperty(i)&&(u=this.values_[i]),u}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(i,u){let m;m=`change:${i}`,this.hasListener(m)&&this.dispatchEvent(new Wm(m,i,u)),m=Np.PROPERTYCHANGE,this.hasListener(m)&&this.dispatchEvent(new Wm(m,i,u))}addChangeListener(i,u){this.addEventListener(`change:${i}`,u)}removeChangeListener(i,u){this.removeEventListener(`change:${i}`,u)}set(i,u,m){let a=this.values_||(this.values_={});if(m)a[i]=u;else{let l=a[i];a[i]=u,l!==u&&this.notify(i,l)}}setProperties(i,u){for(let m in i)this.set(m,i[m],u)}applyProperties(i){i.values_&&Object.assign(this.values_||(this.values_={}),i.values_)}unset(i,u){if(this.values_&&i in this.values_){let m=this.values_[i];delete this.values_[i],Gl(this.values_)&&(this.values_=null),u||this.notify(i,m)}}},lo=Iy;var pw=(v,i)=>{let u=new URL(v);return Object.entries(i||{}).forEach(([a,l])=>{l!=null&&u.searchParams.set(a,l)}),u},Gh=pw;var Cy=class extends lo{constructor(u){super();this.url=u.url,this.apiKey=u.apiKey}fetch(u,m,a){if(!this.url)return Promise.reject(new Error(`No url defined for request to ${this.url}/${u}`));if(!this.url&&!this.apiKey&&!/key=/.test(this.url))return Promise.reject(new Error(`No apiKey defined for request to ${this.url}`));let l=m||{},M=Gh(`${this.url}${u||""}`,{key:this.apiKey,...l});return fetch(M.toString(),a).then(z=>{try{return z.json().then(D=>{if(D.error)throw new Error(D.error);return D})}catch(D){return Promise.reject(new Error(D))}})}},Xm=Cy;var Ay=class extends Xm{constructor(i={}){super({url:"https://api.geops.io/routing/v1/",...i})}route(i,u){return this.fetch("",i,u)}},Xd=Ay;var My=class extends Xm{constructor(i={}){super({url:"https://api.geops.io/stops/v1/",...i})}search(i,u){return this.fetch("",i,u)}},$d=My;var qp=class{constructor(){this.defineProperties()}defineProperties(){Object.defineProperties(this,{closed:{get:()=>!this.websocket||this.websocket.readyState===this.websocket.CLOSED},closing:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSING)},connecting:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CONNECTING)},open:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.OPEN)},messagesOnOpen:{value:[],writable:!0},subscriptions:{value:[],writable:!0},subscribed:{value:{},writable:!0}})}static getRequestString(i,u={}){let m=`${i} ${u.channel}`;return m+=u.args?` ${u.args}`:"",m+=u.id?` ${u.id}`:"",m.trim()}connect(i,u=()=>{}){if(!i){this.websocket?.close();return}if(this.websocket){if(this.websocket.url===i&&(this.open||this.connecting))return;this.websocket.url!==i&&(this.open||this.connecting)&&this.websocket.close()}this.websocket=new WebSocket(i),this.open?(u(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{u(),this.subscribePreviousSubscriptions()})}close(){this.websocket&&(this.open||this.connecting)&&(this.websocket.onclose=()=>{},this.websocket.close(),this.messagesOnOpen=[])}send(i){if(!this.websocket||this.closed||this.closing)return;let u=()=>{this.websocket?.send(i)};this.open?this.messagesOnOpen.includes(i)||u():this.messagesOnOpen.includes(i)||(this.messagesOnOpen.push(i),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],u()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}addEvents(i,u){this.websocket&&(this.websocket.addEventListener("message",i),u&&(this.websocket.addEventListener("error",u),this.websocket.addEventListener("close",u)))}removeEvents(i,u){this.websocket&&(this.websocket.removeEventListener("message",i),u&&(this.websocket.removeEventListener("error",u),this.websocket.removeEventListener("close",u)))}listen(i,u,m){this.unlisten(i,u);let a=l=>{let M;try{M=JSON.parse(l.data)}catch(q){console.error("WebSocket: unable to parse JSON data",q,l.data);return}let z=i.channel;z+=i.args?` ${i.args}`:"";let D;M.source==="buffer"?D=M.content:D=[M],D.forEach(q=>{q?.source===z&&(!i.id||i.id===M.client_reference)&&u(q)})};return this.addEvents(a,m),{onMessageCb:a,onErrorCb:m}}unlisten(i,u){[...this.subscriptions||[],...this.requests||[]].filter(m=>m.params.channel===i.channel&&(!u||m.cb===u)).forEach(({onMessageCb:m,onErrorCb:a})=>{this.removeEvents(m,a)})}get(i,u,m){let a=qp.getRequestString("GET",i);this.send(a);let l=V=>(...de)=>{V(...de);let pe=this.requests.findIndex(nt=>a===nt.requestString&&u===nt.cb),{onMessageCb:Ie,onErrorCb:Ne}=this.requests[pe];this.removeEvents(Ie,Ne),this.requests.splice(pe,1)},{onMessageCb:M,onErrorCb:z}=this.listen(i,l(u),m&&l(m));this.requests||(this.requests=[]);let D=this.requests.findIndex(V=>a===V.requestString&&u===V.cb),q={params:i,requestString:a,cb:u,errorCb:m,onMessageCb:M,onErrorCb:z};D>-1?this.requests[D]=q:this.requests.push(q)}subscribe(i,u,m,a=!1){let{onMessageCb:l,onErrorCb:M}=this.listen(i,u,m),z=qp.getRequestString("",i),D=this.subscriptions.findIndex(V=>i.channel===V.params.channel&&u===V.cb),q={params:i,cb:u,errorCb:m,onMessageCb:l,onErrorCb:M,quiet:a};D>-1?this.subscriptions[D]=q:this.subscriptions.push(q),this.subscribed[z]||(q.quiet||(this.send(`GET ${z}`),this.send(`SUB ${z}`)),this.subscribed[z]=!0)}unsubscribe(i,u){let m=this.subscriptions.filter(a=>a.params.channel===i&&(!u||a.cb===u));m.forEach(({onMessageCb:a,onErrorCb:l})=>{this.removeEvents(a,l)}),this.subscriptions=this.subscriptions.filter(a=>a.params.channel!==i||u&&a.cb!==u),i&&this.subscribed[i]&&!this.subscriptions.find(a=>a.params.channel===i)&&m.find(a=>!a.quiet)&&(this.send(`DEL ${i}`),this.subscribed[i]=!1)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(i=>{this.subscribed[i]=!1}),[...this.subscriptions].forEach(i=>{this.subscribe(i.params,i.cb,i.errorCb,i.quiet)})}},Rx=qp;var dw=(v,i,u=100)=>{let m={},a={},l=[];return M=>{let{source:z,content:D}=M;m[z]&&window.clearTimeout(m[z]),i?a[i(D)]=D:l.push(D),m[z]=window.setTimeout(()=>{let q=i?Object.values(a):l;v(q)},u)}},Kd=dw;var fw=(v,i)=>v===i.SCHEMATIC?"_schematic":"",xu=fw;var Go={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},Py=class{constructor(i={}){this.version="1";this.defineProperties(i),this.prefix=i.prefix||"",this.onOpen=this.onOpen.bind(this)}defineProperties(i){let u=i;typeof i=="string"&&(u={url:i});let{apiKey:m,version:a}=u,{url:l,projection:M,bbox:z,buffer:D=[100,100]}=u,q=new Rx;l||(l="wss://api.geops.io/tracker-ws/v1/"),m&&(l=`${l}?key=${m}`),Object.defineProperties(this,{url:{get:()=>l,set:V=>{l!==V&&(l=V,(this.wsApi.open||this.wsApi.connecting)&&this.open())}},projection:{get:()=>M,set:V=>{V!==M&&(M=V,this.wsApi&&this.wsApi.send(`PROJECTION ${M}`))}},bbox:{get:()=>z,set:V=>{JSON.stringify(V)!==JSON.stringify(z)&&(z=V,this.wsApi&&z&&this.wsApi.send(`BBOX ${z.join(" ")}`))}},buffer:{get:()=>D,set:V=>{JSON.stringify(V)!==JSON.stringify(D)&&(D=V,this.wsApi&&this.wsApi.send(`BUFFER ${D.join(" ")}`))}},version:{value:a,writable:!0},wsApi:{value:q,writable:!0},pingIntervalMs:{value:i.pingIntervalMs||1e4,writable:!0},reconnectTimeoutMs:{value:i.pingIntervalMs||100,writable:!0}})}open(){this.wsApi.connect(this.url,this.onOpen),this.wsApi.websocket&&(this.wsApi.websocket.onclose=()=>{this.onClose()})}close(){this.wsApi.close()}reset(){this.wsApi.send("RESET")}onOpen(){this.projection&&this.wsApi.send(`PROJECTION ${this.projection}`),this.bbox&&this.wsApi.send(`BBOX ${this.bbox.join(" ")}`),this.buffer&&this.wsApi.send(`BUFFER ${this.buffer.join(" ")}`),this.pingIntervalMs&&(window.clearInterval(this.pingInterval),this.pingInterval=window.setInterval(()=>{this.wsApi.send("PING")},this.pingIntervalMs))}onClose(){window.clearTimeout(this.pingInterval),window.clearTimeout(this.reconnectTimeout),this.reconnectTimeoutMs&&(this.reconnectTimeout=window.setTimeout(()=>this.open(),this.reconnectTimeoutMs))}subscribe(i,u,m=()=>{},a=!1){!i||!u||this.wsApi.subscribe({channel:i},u,m,a)}unsubscribe(i,u="",m){let a=xu(Go.SCHEMATIC,Go),l=xu(Go.TOPOGRAPHIC,Go);this.wsApi.unsubscribe(`${i}${a}${u||""}`,m),this.wsApi.unsubscribe(`${i}${l}${u||""}`,m)}subscribeDepartures(i,u,m=()=>{},a=!1){this.subscribe(`timetable_${i}`,u,m,a)}unsubscribeDepartures(i,u){this.unsubscribe(`timetable_${i}`,"",u)}subscribeDisruptions(i,u=()=>{},m=!1){this.subscribe(`${this.prefix}newsticker`,i,u,m)}unsubscribeDisruptions(i){this.unsubscribe(`${this.prefix}newsticker`,"",i)}getStation(i,u){let m={channel:`station${xu(u,Go)}`,args:i};return new Promise((a,l)=>{this.wsApi.get(m,a,l)})}getStations(i,u=100){return new Promise(m=>{this.wsApi.get({channel:`station${xu(i,Go)}`},Kd(m,void 0,u))})}subscribeStations(i,u,m=()=>{},a=!1){this.subscribe(`station${xu(i,Go)}`,u,m,a)}unsubscribeStations(i){this.unsubscribe("station","",i)}subscribeExtraGeoms(i,u=()=>{},m=!1){this.subscribe("extra_geoms",i,u,m)}unsubscribeExtraGeoms(i){this.unsubscribe("extra_geoms","",i)}subscribeTrajectory(i,u,m=()=>{},a=!1){this.unsubscribeTrajectory(u);let l="";this.version==="1"&&(l=xu(i,Go)),this.subscribe(`trajectory${l}`,u,m,a)}unsubscribeTrajectory(i){this.unsubscribe("trajectory","",i)}subscribeDeletedVehicles(i,u,m=()=>{},a=!1){this.unsubscribeDeletedVehicles(u);let l="";this.version==="1"&&(l=xu(i,Go)),this.subscribe(`deleted_vehicles${l}`,u,m,a)}unsubscribeDeletedVehicles(i){this.unsubscribe("deleted_vehicles","",i)}getFullTrajectory(i,u,m){let a="";this.version==="1"&&(a=xu(u,Go));let l=[`full_trajectory${a}`];i&&l.push(i),(!u||u===Go.TOPOGRAPHIC)&&m&&l.push(`gen${m}`);let M={channel:l.join("_")};return new Promise((z,D)=>{this.wsApi.get(M,z,D)})}subscribeFullTrajectory(i,u,m,a=()=>{},l=!1){let M="";this.version==="1"&&(M=xu(u,Go)),this.subscribe(`full_trajectory${M}_${i}`,m,a,l)}unsubscribeFullTrajectory(i,u){this.unsubscribe("full_trajectory",`_${i}`,u)}getStopSequence(i){return new Promise((u,m)=>{this.wsApi.get({channel:`stopsequence_${i}`},u,m)})}subscribeStopSequence(i,u,m=()=>{},a=!1){this.subscribe(`stopsequence_${i}`,u,m,a)}unsubscribeStopSequence(i,u){this.unsubscribe("stopsequence",`_${i}`,u)}subscribeHealthCheck(i,u=()=>{},m=!1){this.subscribe("healthcheck",i,u,m)}unsubscribeHealthCheck(i){this.unsubscribe("healthcheck","",i)}},Hd=Py;var mw=v=>{let i=v.filter(l=>l!=null&&l.trim&&l.trim()),u=i.map(l=>l.toLowerCase());return[...new Set(u)].map(l=>i.find(M=>M.toLowerCase()===l))},qh=mw;var gw=v=>{if(!v)return[];let{style:i}=v;if(!i)return[];let{sourceCaches:u}=i,m=[];return Object.values(u).forEach(a=>{if(a.used){let l=a.getSource(),M=l.attribution||l.options&&l.options.attribution;M&&(m=m.concat(M.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),qh(m)},sc=gw;var yw=(v,i,u,m)=>{let a=[];if(!v&&!i&&!u&&!m)return null;if(m){let l=typeof m=="string"?[m]:m,M=z=>{let D=z.properties.name||z.properties.line&&z.properties.line.name||"";return D?l.some(q=>new RegExp(q,"i").test(D)):!1};a.push(M)}if(v){let M=(typeof v=="string"?v.split(","):v).map(D=>D.replace(/\s+/g,"").toUpperCase()),z=D=>{let{line:q,name:V}=D.properties,de=(V||q&&q.name||"").toUpperCase();return de?M.includes(de):!1};a.push(z)}if(i){let M=(typeof i=="string"?i.split(","):i).map(D=>parseInt(D,10)),z=D=>{let q=D.properties.route_identifier||D.properties.routeIdentifier||"",V=parseInt(q.split(".")[0],10);return M.includes(V)};a.push(z)}if(u){let l=typeof u=="string"?[u]:u,M=z=>l.some(D=>{let q=z.properties.operator||z.properties.tenant||"";return new RegExp(D,"i").test(q)});a.push(M)}return a.length?l=>{for(let M=0;M<a.length;M+=1)if(!a[M](l))return!1;return!0}:null},ky=yw;var Lx=v=>{let i=v;Array.isArray(i)||(i=[v]);let u=[];return i.forEach(m=>{u.push(m);let{children:a}=m;u=u.concat(Lx(a||[]))}),u},Yd=Lx;var zx=(v=new Date)=>{let i=(v.getUTCMonth()+1).toString();i=i.length===1?`0${i}`:i;let u=v.getUTCDate().toString();return u=u.length===1?`0${u}`:u,[v.getUTCFullYear(),i,u].join("")},Dx=v=>[v.getUTCHours(),v.getUTCMinutes(),`${v.getUTCSeconds()}.${v.getUTCMilliseconds()}`].join(":"),$m=v=>v<10?`0${v}`:`${v}`,Fx=v=>{if(!v||v<=0)return"";let i=new Date(v);return`${$m(i.getHours())}:${$m(i.getMinutes())}`};var _w=(v,i)=>{let u=v.properties,m=i.properties;return u.delay===null&&m.delay!==null?1:m.delay===null&&u.delay!==null?-1:u.cancelled&&!m.cancelled?m.delay<18e4?-1:1:m.cancelled&&!u.cancelled?u.delay<18e4?1:-1:m.delay-u.delay},Ry=_w;var oh=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",lT=oh.includes("firefox"),vw=oh.includes("safari")&&!oh.includes("chrom"),uT=vw&&(oh.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(oh)),cT=oh.includes("webkit")&&!oh.includes("edge"),hT=oh.includes("macintosh");var Zp=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Ox=typeof Image<"u"&&Image.prototype.decode,pT=function(){let v=!1;try{let i=Object.defineProperty({},"passive",{get:function(){v=!0}});window.addEventListener("_",null,i),window.removeEventListener("_",null,i)}catch{}return v}();var xw={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:'`renderMode` must be `"hybrid"` or `"vector"`',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"},Ly=class extends Error{constructor(i){let u=xw[i];super(u),this.code=i,this.name="AssertionError",this.message=u}},Km=Ly;function zr(v,i){if(!v)throw new Km(i)}var vT=new Array(6);function Da(){return[1,0,0,1,0,0]}function bw(v,i,u,m,a,l,M){return v[0]=i,v[1]=u,v[2]=m,v[3]=a,v[4]=l,v[5]=M,v}function Ux(v,i){return v[0]=i[0],v[1]=i[1],v[2]=i[2],v[3]=i[3],v[4]=i[4],v[5]=i[5],v}function qo(v,i){let u=i[0],m=i[1];return i[0]=v[0]*u+v[2]*m+v[4],i[1]=v[1]*u+v[3]*m+v[5],i}function Vx(v,i,u){return bw(v,i,0,0,u,0,0)}function Ys(v,i,u,m,a,l,M,z){let D=Math.sin(l),q=Math.cos(l);return v[0]=m*q,v[1]=a*D,v[2]=-m*D,v[3]=a*q,v[4]=M*m*q-z*m*D+i,v[5]=M*a*D+z*a*q+u,v}function Nx(v,i,u,m,a,l,M){return zy(Ys(Da(),v,i,u,m,a,l,M))}function jx(v,i){let u=ww(i);zr(u!==0,32);let m=i[0],a=i[1],l=i[2],M=i[3],z=i[4],D=i[5];return v[0]=M/u,v[1]=-a/u,v[2]=-l/u,v[3]=m/u,v[4]=(l*D-M*z)/u,v[5]=-(m*D-a*z)/u,v}function ww(v){return v[0]*v[3]-v[1]*v[2]}var Bx;function zy(v){let i="matrix("+v.join(", ")+")";if(Zp)return i;let u=Bx||(Bx=document.createElement("div"));return u.style.transform=i,u.style.transform}var ko={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function bu(v){let i=Qa();for(let u=0,m=v.length;u<m;++u)Dy(i,v[u]);return i}function Sw(v,i,u){let m=Math.min.apply(null,v),a=Math.min.apply(null,i),l=Math.max.apply(null,v),M=Math.max.apply(null,i);return uc(m,a,l,M,u)}function _l(v,i,u){return u?(u[0]=v[0]-i,u[1]=v[1]-i,u[2]=v[2]+i,u[3]=v[3]+i,u):[v[0]-i,v[1]-i,v[2]+i,v[3]+i]}function Gx(v,i){return i?(i[0]=v[0],i[1]=v[1],i[2]=v[2],i[3]=v[3],i):v.slice()}function bs(v,i,u){let m,a;return i<v[0]?m=v[0]-i:v[2]<i?m=i-v[2]:m=0,u<v[1]?a=v[1]-u:v[3]<u?a=u-v[3]:a=0,m*m+a*a}function Ym(v,i){return Jd(v,i[0],i[1])}function lc(v,i){return v[0]<=i[0]&&i[2]<=v[2]&&v[1]<=i[1]&&i[3]<=v[3]}function Jd(v,i,u){return v[0]<=i&&i<=v[2]&&v[1]<=u&&u<=v[3]}function Hm(v,i){let u=v[0],m=v[1],a=v[2],l=v[3],M=i[0],z=i[1],D=ko.UNKNOWN;return M<u?D=D|ko.LEFT:M>a&&(D=D|ko.RIGHT),z<m?D=D|ko.BELOW:z>l&&(D=D|ko.ABOVE),D===ko.UNKNOWN&&(D=ko.INTERSECTING),D}function Qa(){return[1/0,1/0,-1/0,-1/0]}function uc(v,i,u,m,a){return a?(a[0]=v,a[1]=i,a[2]=u,a[3]=m,a):[v,i,u,m]}function Wp(v){return uc(1/0,1/0,-1/0,-1/0,v)}function Xp(v,i){let u=v[0],m=v[1];return uc(u,m,u,m,i)}function Jm(v,i,u,m,a){let l=Wp(a);return Fy(l,v,i,u,m)}function Qm(v,i){return v[0]==i[0]&&v[2]==i[2]&&v[1]==i[1]&&v[3]==i[3]}function qx(v,i){return i[0]<v[0]&&(v[0]=i[0]),i[2]>v[2]&&(v[2]=i[2]),i[1]<v[1]&&(v[1]=i[1]),i[3]>v[3]&&(v[3]=i[3]),v}function Dy(v,i){i[0]<v[0]&&(v[0]=i[0]),i[0]>v[2]&&(v[2]=i[0]),i[1]<v[1]&&(v[1]=i[1]),i[1]>v[3]&&(v[3]=i[1])}function Fy(v,i,u,m,a){for(;u<m;u+=a)Ew(v,i[u],i[u+1]);return v}function Ew(v,i,u){v[0]=Math.min(v[0],i),v[1]=Math.min(v[1],u),v[2]=Math.max(v[2],i),v[3]=Math.max(v[3],u)}function Zx(v,i){let u;return u=i(Oy(v)),u||(u=i(By(v)),u)||(u=i(Vy(v)),u)||(u=i(Uy(v)),u)?u:!1}function Oy(v){return[v[0],v[1]]}function By(v){return[v[2],v[1]]}function wu(v){return[(v[0]+v[2])/2,(v[1]+v[3])/2]}function Wx(v,i,u,m,a){let[l,M,z,D,q,V,de,pe]=Tw(v,i,u,m);return uc(Math.min(l,z,q,de),Math.min(M,D,V,pe),Math.max(l,z,q,de),Math.max(M,D,V,pe),a)}function Tw(v,i,u,m){let a=i*m[0]/2,l=i*m[1]/2,M=Math.cos(u),z=Math.sin(u),D=a*M,q=a*z,V=l*M,de=l*z,pe=v[0],Ie=v[1];return[pe-D+de,Ie-q-V,pe-D-de,Ie-q+V,pe+D-de,Ie+q+V,pe+D+de,Ie+q-V,pe-D+de,Ie-q-V]}function vl(v){return v[3]-v[1]}function Xx(v,i,u){let m=u||Qa();return uo(v,i)?(v[0]>i[0]?m[0]=v[0]:m[0]=i[0],v[1]>i[1]?m[1]=v[1]:m[1]=i[1],v[2]<i[2]?m[2]=v[2]:m[2]=i[2],v[3]<i[3]?m[3]=v[3]:m[3]=i[3]):Wp(m),m}function Uy(v){return[v[0],v[3]]}function Vy(v){return[v[2],v[3]]}function bo(v){return v[2]-v[0]}function uo(v,i){return v[0]<=i[2]&&v[2]>=i[0]&&v[1]<=i[3]&&v[3]>=i[1]}function $x(v){return v[2]<v[0]||v[3]<v[1]}function Kx(v,i){return i?(i[0]=v[0],i[1]=v[1],i[2]=v[2],i[3]=v[3],i):v}function Hx(v,i,u){let m=!1,a=Hm(v,i),l=Hm(v,u);if(a===ko.INTERSECTING||l===ko.INTERSECTING)m=!0;else{let M=v[0],z=v[1],D=v[2],q=v[3],V=i[0],de=i[1],pe=u[0],Ie=u[1],Ne=(Ie-de)/(pe-V),nt,we;l&ko.ABOVE&&!(a&ko.ABOVE)&&(nt=pe-(Ie-q)/Ne,m=nt>=M&&nt<=D),!m&&l&ko.RIGHT&&!(a&ko.RIGHT)&&(we=Ie-(pe-D)*Ne,m=we>=z&&we<=q),!m&&l&ko.BELOW&&!(a&ko.BELOW)&&(nt=pe-(Ie-z)/Ne,m=nt>=M&&nt<=D),!m&&l&ko.LEFT&&!(a&ko.LEFT)&&(we=Ie-(pe-M)*Ne,m=we>=z&&we<=q)}return m}function Yx(v,i,u,m){let a=[];if(m>1){let z=v[2]-v[0],D=v[3]-v[1];for(let q=0;q<m;++q)a.push(v[0]+z*q/m,v[1],v[2],v[1]+D*q/m,v[2]-z*q/m,v[3],v[0],v[3]-D*q/m)}else a=[v[0],v[1],v[2],v[1],v[2],v[3],v[0],v[3]];i(a,a,2);let l=[],M=[];for(let z=0,D=a.length;z<D;z+=2)l.push(a[z]),M.push(a[z+1]);return Sw(l,M,u)}function Ny(v,i){let u=i.getExtent(),m=wu(v);if(i.canWrapX()&&(m[0]<u[0]||m[0]>=u[2])){let a=bo(u),M=Math.floor((m[0]-u[0])/a)*a;v[0]-=M,v[2]-=M}return v}function Jx(v,i){if(i.canWrapX()){let u=i.getExtent();if(!isFinite(v[0])||!isFinite(v[2]))return[[u[0],v[1],u[2],v[3]]];Ny(v,i);let m=bo(u);if(bo(v)>m)return[[u[0],v[1],u[2],v[3]]];if(v[0]<u[0])return[[v[0]+m,v[1],u[2],v[3]],[u[0],v[1],v[2],v[3]]];if(v[2]>u[2])return[[v[0],v[1],u[2],v[3]],[u[0],v[1],v[2]-m,v[3]]]}return[v]}var Zh={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var jy=class{constructor(i){this.code_=i.code,this.units_=i.units,this.extent_=i.extent!==void 0?i.extent:null,this.worldExtent_=i.worldExtent!==void 0?i.worldExtent:null,this.axisOrientation_=i.axisOrientation!==void 0?i.axisOrientation:"enu",this.global_=i.global!==void 0?i.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=i.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=i.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Zh[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(i){this.global_=i,this.canWrapX_=!!(i&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(i){this.defaultTileGrid_=i}setExtent(i){this.extent_=i,this.canWrapX_=!!(this.global_&&i)}setWorldExtent(i){this.worldExtent_=i}setGetPointResolution(i){this.getPointResolutionFunc_=i}getPointResolutionFunc(){return this.getPointResolutionFunc_}},eg=jy;var Qd=6378137,$p=Math.PI*Qd,Iw=[-$p,-$p,$p,$p],Cw=[-180,-85,180,85],tg=Qd*Math.log(Math.tan(Math.PI/2)),ah=class extends eg{constructor(i){super({code:i,units:"m",extent:Iw,global:!0,worldExtent:Cw,getPointResolution:function(u,m){return u/Math.cosh(m[1]/Qd)}})}},Gy=[new ah("EPSG:3857"),new ah("EPSG:102100"),new ah("EPSG:102113"),new ah("EPSG:900913"),new ah("http://www.opengis.net/def/crs/EPSG/0/3857"),new ah("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Qx(v,i,u){let m=v.length;u=u>1?u:2,i===void 0&&(u>2?i=v.slice():i=new Array(m));for(let a=0;a<m;a+=u){i[a]=$p*v[a]/180;let l=Qd*Math.log(Math.tan(Math.PI*(+v[a+1]+90)/360));l>tg?l=tg:l<-tg&&(l=-tg),i[a+1]=l}return i}function e0(v,i,u){let m=v.length;u=u>1?u:2,i===void 0&&(u>2?i=v.slice():i=new Array(m));for(let a=0;a<m;a+=u)i[a]=180*v[a]/$p,i[a+1]=360*Math.atan(Math.exp(v[a+1]/Qd))/Math.PI-90;return i}var Aw=6378137,t0=[-180,-90,180,90],Mw=Math.PI*Aw/180,cc=class extends eg{constructor(i,u){super({code:i,units:"degrees",extent:t0,axisOrientation:u,global:!0,metersPerUnit:Mw,worldExtent:t0})}},qy=[new cc("CRS:84"),new cc("EPSG:4326","neu"),new cc("urn:ogc:def:crs:OGC:1.3:CRS84"),new cc("urn:ogc:def:crs:OGC:2:84"),new cc("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new cc("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new cc("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var Zy={};function i0(v){return Zy[v]||Zy[v.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function r0(v,i){Zy[v]=i}var Kp={};function ef(v,i,u){let m=v.getCode(),a=i.getCode();m in Kp||(Kp[m]={}),Kp[m][a]=u}function n0(v,i){let u;return v in Kp&&i in Kp[v]&&(u=Kp[v][i]),u}function Jn(v,i,u){return Math.min(Math.max(v,i),u)}function o0(v,i,u,m,a,l){let M=a-u,z=l-m;if(M!==0||z!==0){let D=((v-u)*M+(i-m)*z)/(M*M+z*z);D>1?(u=a,m=l):D>0&&(u+=M*D,m+=z*D)}return ql(v,i,u,m)}function ql(v,i,u,m){let a=u-v,l=m-i;return a*a+l*l}function a0(v){return v*180/Math.PI}function s0(v){return v*Math.PI/180}function Wh(v,i){let u=v%i;return u*i<0?u+i:u}function va(v,i,u){return v+u*(i-v)}function l0(v,i){let u=Math.pow(10,i);return Math.round(v*u)/u}function u0(v,i){return v[0]+=+i[0],v[1]+=+i[1],v}function Wy(v,i){let u=v[0],m=v[1],a=i[0],l=i[1],M=a[0],z=a[1],D=l[0],q=l[1],V=D-M,de=q-z,pe=V===0&&de===0?0:(V*(u-M)+de*(m-z))/(V*V+de*de||0),Ie,Ne;return pe<=0?(Ie=M,Ne=z):pe>=1?(Ie=D,Ne=q):(Ie=M+pe*V,Ne=z+pe*de),[Ie,Ne]}function es(v,i){let u=!0;for(let m=v.length-1;m>=0;--m)if(v[m]!=i[m]){u=!1;break}return u}function c0(v,i){let u=Math.cos(i),m=Math.sin(i),a=v[0]*u-v[1]*m,l=v[1]*u+v[0]*m;return v[0]=a,v[1]=l,v}function Hp(v,i){let u=v[0]-i[0],m=v[1]-i[1];return u*u+m*m}function Xy(v,i){return Math.sqrt(Hp(v,i))}function h0(v,i){return Hp(v,Wy(v,i))}function p0(v,i){if(i.canWrapX()){let u=bo(i.getExtent()),m=d0(v,i,u);m&&(v[0]-=m*u)}return v}function d0(v,i,u){let m=i.getExtent(),a=0;return i.canWrapX()&&(v[0]<m[0]||v[0]>m[2])&&(u=u||bo(m),a=Math.floor((v[0]-m[0])/u)),a}var f0={info:1,warn:2,error:3,none:4},Pw=f0.info;function m0(...v){Pw>f0.warn||console.warn(...v)}var $y=!0;function Ky(v){$y=!(v===void 0?!0:v)}function Hy(v,i){if(i!==void 0){for(let u=0,m=v.length;u<m;++u)i[u]=v[u];i=i}else i=v.slice();return i}function kw(v,i){if(i!==void 0&&v!==i){for(let u=0,m=v.length;u<m;++u)i[u]=v[u];v=i}return v}function Rw(v){r0(v.getCode(),v),ef(v,v,Hy)}function Lw(v){v.forEach(Rw)}function Zo(v){return typeof v=="string"?i0(v):v||null}function g0(v){Lw(v),v.forEach(function(i){v.forEach(function(u){i!==u&&ef(i,u,Hy)})})}function zw(v,i,u,m){v.forEach(function(a){i.forEach(function(l){ef(a,l,u),ef(l,a,m)})})}function ig(v,i){if(v){if(typeof v=="string")return Zo(v)}else return Zo(i);return v}function co(v,i){return Ky(),ng(v,"EPSG:4326",i!==void 0?i:"EPSG:3857")}function sh(v,i){let u=ng(v,i!==void 0?i:"EPSG:3857","EPSG:4326"),m=u[0];return(m<-180||m>180)&&(u[0]=Wh(m+180,360)-180),u}function y0(v,i){if(v===i)return!0;let u=v.getUnits()===i.getUnits();return(v.getCode()===i.getCode()||rg(v,i)===Hy)&&u}function rg(v,i){let u=v.getCode(),m=i.getCode(),a=n0(u,m);return a||(a=kw),a}function tf(v,i){let u=Zo(v),m=Zo(i);return rg(u,m)}function ng(v,i,u){return tf(i,u)(v,void 0,v.length)}function rf(v,i,u,m){let a=tf(i,u);return Yx(v,a,void 0,m)}var Zl=null;function Su(){return Zl}function Yp(v,i){return Zl?ng(v,i,Zl):v}function Ro(v,i){return Zl?ng(v,Zl,i):($y&&!es(v,[0,0])&&v[0]>=-180&&v[0]<=180&&v[1]>=-90&&v[1]<=90&&($y=!1,m0("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),v)}function lh(v,i){return Zl?rf(v,i,Zl):v}function Eu(v,i){return Zl?rf(v,Zl,i):v}function _0(v,i){if(!Zl)return v;let u=Zo(i).getUnits(),m=Zl.getUnits();return u&&m?v*Zh[u]/Zh[m]:v}function Dw(){g0(Gy),g0(qy),zw(qy,Gy,Qx,e0)}Dw();function xl(v,i,u,m,a,l){l=l||[];let M=0;for(let z=i;z<u;z+=m){let D=v[z],q=v[z+1];l[M++]=a[0]*D+a[2]*q+a[4],l[M++]=a[1]*D+a[3]*q+a[5]}return l&&l.length!=M&&(l.length=M),l}function og(v,i,u,m,a,l,M){M=M||[];let z=Math.cos(a),D=Math.sin(a),q=l[0],V=l[1],de=0;for(let pe=i;pe<u;pe+=m){let Ie=v[pe]-q,Ne=v[pe+1]-V;M[de++]=q+Ie*z-Ne*D,M[de++]=V+Ie*D+Ne*z;for(let nt=pe+2;nt<pe+m;++nt)M[de++]=v[nt]}return M&&M.length!=de&&(M.length=de),M}function v0(v,i,u,m,a,l,M,z){z=z||[];let D=M[0],q=M[1],V=0;for(let de=i;de<u;de+=m){let pe=v[de]-D,Ie=v[de+1]-q;z[V++]=D+a*pe,z[V++]=q+l*Ie;for(let Ne=de+2;Ne<de+m;++Ne)z[V++]=v[Ne]}return z&&z.length!=V&&(z.length=V),z}function x0(v,i,u,m,a,l,M){M=M||[];let z=0;for(let D=i;D<u;D+=m){M[z++]=v[D]+a,M[z++]=v[D+1]+l;for(let q=D+2;q<D+m;++q)M[z++]=v[q]}return M&&M.length!=z&&(M.length=z),M}var b0=Da(),Yy=class extends lo{constructor(){super(),this.extent_=Qa(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=kx(function(i,u,m){if(!m)return this.getSimplifiedGeometry(u);let a=this.clone();return a.applyTransform(m),a.getSimplifiedGeometry(u)})}simplifyTransformed(i,u){return this.simplifyTransformedInternal(this.getRevision(),i,u)}clone(){return Xi()}closestPointXY(i,u,m,a){return Xi()}containsXY(i,u){let m=this.getClosestPoint([i,u]);return m[0]===i&&m[1]===u}getClosestPoint(i,u){return u=u||[NaN,NaN],this.closestPointXY(i[0],i[1],u,1/0),u}intersectsCoordinate(i){return this.containsXY(i[0],i[1])}computeExtent(i){return Xi()}getExtent(i){if(this.extentRevision_!=this.getRevision()){let u=this.computeExtent(this.extent_);(isNaN(u[0])||isNaN(u[1]))&&Wp(u),this.extentRevision_=this.getRevision()}return Kx(this.extent_,i)}rotate(i,u){Xi()}scale(i,u,m){Xi()}simplify(i){return this.getSimplifiedGeometry(i*i)}getSimplifiedGeometry(i){return Xi()}getType(){return Xi()}applyTransform(i){Xi()}intersectsExtent(i){return Xi()}translate(i,u){Xi()}transform(i,u){let m=Zo(i),a=m.getUnits()=="tile-pixels"?function(l,M,z){let D=m.getExtent(),q=m.getWorldExtent(),V=vl(q)/vl(D);return Ys(b0,q[0],q[3],V,-V,0,0,0),xl(l,0,l.length,z,b0,M),tf(m,u)(l,M,z)}:tf(m,u);return this.applyTransform(a),this}},ag=Yy;var Jy=class extends ag{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(i){return Jm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i)}getCoordinates(){return Xi()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(i){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),i<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&i<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let u=this.getSimplifiedGeometryInternal(i);return u.getFlatCoordinates().length<this.flatCoordinates.length?u:(this.simplifiedGeometryMaxMinSquaredTolerance=i,this)}getSimplifiedGeometryInternal(i){return this}getStride(){return this.stride}setFlatCoordinates(i,u){this.stride=w0(i),this.layout=i,this.flatCoordinates=u}setCoordinates(i,u){Xi()}setLayout(i,u,m){let a;if(i)a=w0(i);else{for(let l=0;l<m;++l){if(u.length===0){this.layout="XY",this.stride=2;return}u=u[0]}a=u.length,i=Fw(a)}this.layout=i,this.stride=a}applyTransform(i){this.flatCoordinates&&(i(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(i,u){let m=this.getFlatCoordinates();if(m){let a=this.getStride();og(m,0,m.length,a,i,u,m),this.changed()}}scale(i,u,m){u===void 0&&(u=i),m||(m=wu(this.getExtent()));let a=this.getFlatCoordinates();if(a){let l=this.getStride();v0(a,0,a.length,l,i,u,m,a),this.changed()}}translate(i,u){let m=this.getFlatCoordinates();if(m){let a=this.getStride();x0(m,0,m.length,a,i,u,m),this.changed()}}};function Fw(v){let i;return v==2?i="XY":v==3?i="XYZ":v==4&&(i="XYZM"),i}function w0(v){let i;return v=="XY"?i=2:v=="XYZ"||v=="XYM"?i=3:v=="XYZM"&&(i=4),i}function S0(v,i,u){let m=v.getFlatCoordinates();if(!m)return null;let a=v.getStride();return xl(m,0,m.length,a,i,u)}var ws=Jy;function E0(v,i,u,m){for(let a=0,l=u.length;a<l;++a)v[i++]=u[a];return i}function Xh(v,i,u,m){for(let a=0,l=u.length;a<l;++a){let M=u[a];for(let z=0;z<m;++z)v[i++]=M[z]}return i}function nf(v,i,u,m,a){a=a||[];let l=0;for(let M=0,z=u.length;M<z;++M){let D=Xh(v,i,u[M],m);a[l++]=D,i=D}return a.length=l,a}function T0(v,i,u,m,a){a=a||[];let l=0;for(let M=0,z=u.length;M<z;++M){let D=nf(v,i,u[M],m,a[l]);D.length===0&&(D[0]=i),a[l++]=D,i=D[D.length-1]}return a.length=l,a}var Jp=class extends ag{constructor(i){super(),this.geometries_=i||null,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Po),this.changeEventsKeys_.length=0}listenGeometriesChange_(){if(this.geometries_)for(let i=0,u=this.geometries_.length;i<u;++i)this.changeEventsKeys_.push(so(this.geometries_[i],cn.CHANGE,this.changed,this))}clone(){let i=new Jp(null);return i.setGeometries(this.geometries_),i.applyProperties(this),i}closestPointXY(i,u,m,a){if(a<bs(this.getExtent(),i,u))return a;let l=this.geometries_;for(let M=0,z=l.length;M<z;++M)a=l[M].closestPointXY(i,u,m,a);return a}containsXY(i,u){let m=this.geometries_;for(let a=0,l=m.length;a<l;++a)if(m[a].containsXY(i,u))return!0;return!1}computeExtent(i){Wp(i);let u=this.geometries_;for(let m=0,a=u.length;m<a;++m)qx(i,u[m].getExtent());return i}getGeometries(){return I0(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let i=[],u=this.geometries_;for(let m=0,a=u.length;m<a;++m)u[m].getType()===this.getType()?i=i.concat(u[m].getGeometriesArrayRecursive()):i.push(u[m]);return i}getSimplifiedGeometry(i){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),i<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&i<this.simplifiedGeometryMaxMinSquaredTolerance)return this;let u=[],m=this.geometries_,a=!1;for(let l=0,M=m.length;l<M;++l){let z=m[l],D=z.getSimplifiedGeometry(i);u.push(D),D!==z&&(a=!0)}if(a){let l=new Jp(null);return l.setGeometriesArray(u),l}return this.simplifiedGeometryMaxMinSquaredTolerance=i,this}getType(){return"GeometryCollection"}intersectsExtent(i){let u=this.geometries_;for(let m=0,a=u.length;m<a;++m)if(u[m].intersectsExtent(i))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(i,u){let m=this.geometries_;for(let a=0,l=m.length;a<l;++a)m[a].rotate(i,u);this.changed()}scale(i,u,m){m||(m=wu(this.getExtent()));let a=this.geometries_;for(let l=0,M=a.length;l<M;++l)a[l].scale(i,u,m);this.changed()}setGeometries(i){this.setGeometriesArray(I0(i))}setGeometriesArray(i){this.unlistenGeometriesChange_(),this.geometries_=i,this.listenGeometriesChange_(),this.changed()}applyTransform(i){let u=this.geometries_;for(let m=0,a=u.length;m<a;++m)u[m].applyTransform(i);this.changed()}translate(i,u){let m=this.geometries_;for(let a=0,l=m.length;a<l;++a)m[a].translate(i,u);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function I0(v){let i=[];for(let u=0,m=v.length;u<m;++u)i.push(v[u].clone());return i}var C0=Jp;function A0(v,i,u,m,a,l,M){let z=v[i],D=v[i+1],q=v[u]-z,V=v[u+1]-D,de;if(q===0&&V===0)de=i;else{let pe=((a-z)*q+(l-D)*V)/(q*q+V*V);if(pe>1)de=u;else if(pe>0){for(let Ie=0;Ie<m;++Ie)M[Ie]=va(v[i+Ie],v[u+Ie],pe);M.length=m;return}else de=i}for(let pe=0;pe<m;++pe)M[pe]=v[de+pe];M.length=m}function of(v,i,u,m,a){let l=v[i],M=v[i+1];for(i+=m;i<u;i+=m){let z=v[i],D=v[i+1],q=ql(l,M,z,D);q>a&&(a=q),l=z,M=D}return a}function af(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){let z=u[l];a=of(v,i,z,m,a),i=z}return a}function M0(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){let z=u[l];a=af(v,i,z,m,a),i=z[z.length-1]}return a}function sf(v,i,u,m,a,l,M,z,D,q,V){if(i==u)return q;let de,pe;if(a===0){if(pe=ql(M,z,v[i],v[i+1]),pe<q){for(de=0;de<m;++de)D[de]=v[i+de];return D.length=m,pe}return q}V=V||[NaN,NaN];let Ie=i+m;for(;Ie<u;)if(A0(v,Ie-m,Ie,m,M,z,V),pe=ql(M,z,V[0],V[1]),pe<q){for(q=pe,de=0;de<m;++de)D[de]=V[de];D.length=m,Ie+=m}else Ie+=m*Math.max((Math.sqrt(pe)-Math.sqrt(q))/a|0,1);if(l&&(A0(v,u-m,i,m,M,z,V),pe=ql(M,z,V[0],V[1]),pe<q)){for(q=pe,de=0;de<m;++de)D[de]=V[de];D.length=m}return q}function lf(v,i,u,m,a,l,M,z,D,q,V){V=V||[NaN,NaN];for(let de=0,pe=u.length;de<pe;++de){let Ie=u[de];q=sf(v,i,Ie,m,a,l,M,z,D,q,V),i=Ie}return q}function P0(v,i,u,m,a,l,M,z,D,q,V){V=V||[NaN,NaN];for(let de=0,pe=u.length;de<pe;++de){let Ie=u[de];q=lf(v,i,Ie,m,a,l,M,z,D,q,V),i=Ie[Ie.length-1]}return q}function uf(v,i,u,m,a,l,M){let z=(u-i)/m;if(z<3){for(;i<u;i+=m)l[M++]=v[i],l[M++]=v[i+1];return M}let D=new Array(z);D[0]=1,D[z-1]=1;let q=[i,u-m],V=0;for(;q.length>0;){let de=q.pop(),pe=q.pop(),Ie=0,Ne=v[pe],nt=v[pe+1],we=v[de],Pe=v[de+1];for(let et=pe+m;et<de;et+=m){let ut=v[et],mt=v[et+1],ct=o0(ut,mt,Ne,nt,we,Pe);ct>Ie&&(V=et,Ie=ct)}Ie>a&&(D[(V-i)/m]=1,pe+m<V&&q.push(pe,V),V+m<de&&q.push(V,de))}for(let de=0;de<z;++de)D[de]&&(l[M++]=v[i+de*m],l[M++]=v[i+de*m+1]);return M}function k0(v,i,u,m,a,l,M,z){for(let D=0,q=u.length;D<q;++D){let V=u[D];M=uf(v,i,V,m,a,l,M),z.push(M),i=V}return M}function uh(v,i){return i*Math.round(v/i)}function Ow(v,i,u,m,a,l,M){if(i==u)return M;let z=uh(v[i],a),D=uh(v[i+1],a);i+=m,l[M++]=z,l[M++]=D;let q,V;do if(q=uh(v[i],a),V=uh(v[i+1],a),i+=m,i==u)return l[M++]=q,l[M++]=V,M;while(q==z&&V==D);for(;i<u;){let de=uh(v[i],a),pe=uh(v[i+1],a);if(i+=m,de==q&&pe==V)continue;let Ie=q-z,Ne=V-D,nt=de-z,we=pe-D;if(Ie*we==Ne*nt&&(Ie<0&&nt<Ie||Ie==nt||Ie>0&&nt>Ie)&&(Ne<0&&we<Ne||Ne==we||Ne>0&&we>Ne)){q=de,V=pe;continue}l[M++]=q,l[M++]=V,z=q,D=V,q=de,V=pe}return l[M++]=q,l[M++]=V,M}function Qy(v,i,u,m,a,l,M,z){for(let D=0,q=u.length;D<q;++D){let V=u[D];M=Ow(v,i,V,m,a,l,M),z.push(M),i=V}return M}function R0(v,i,u,m,a,l,M,z){for(let D=0,q=u.length;D<q;++D){let V=u[D],de=[];M=Qy(v,i,V,m,a,l,M,de),z.push(de),i=V[V.length-1]}return M}function bl(v,i,u,m,a){a=a!==void 0?a:[];let l=0;for(let M=i;M<u;M+=m)a[l++]=v.slice(M,M+m);return a.length=l,a}function ch(v,i,u,m,a){a=a!==void 0?a:[];let l=0;for(let M=0,z=u.length;M<z;++M){let D=u[M];a[l++]=bl(v,i,D,m,a[l]),i=D}return a.length=l,a}function cf(v,i,u,m,a){a=a!==void 0?a:[];let l=0;for(let M=0,z=u.length;M<z;++M){let D=u[M];a[l++]=D.length===1&&D[0]===i?[]:ch(v,i,D,m,a[l]),i=D[D.length-1]}return a.length=l,a}function e_(v,i,u,m){let a=0,l=v[u-m],M=v[u-m+1];for(;i<u;i+=m){let z=v[i],D=v[i+1];a+=M*z-l*D,l=z,M=D}return a/2}function t_(v,i,u,m){let a=0;for(let l=0,M=u.length;l<M;++l){let z=u[l];a+=e_(v,i,z,m),i=z}return a}function L0(v,i,u,m){let a=0;for(let l=0,M=u.length;l<M;++l){let z=u[l];a+=t_(v,i,z,m),i=z[z.length-1]}return a}var Qp=class extends ws{constructor(i,u){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(i[0])?this.setFlatCoordinates(u,i):this.setCoordinates(i,u)}clone(){return new Qp(this.flatCoordinates.slice(),this.layout)}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(of(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),sf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,i,u,m,a))}getArea(){return e_(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(i){let u=[];return u.length=uf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i,u,0),new Qp(u,"XY")}getType(){return"LinearRing"}intersectsExtent(i){return!1}setCoordinates(i,u){this.setLayout(u,i,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Xh(this.flatCoordinates,0,i,this.stride),this.changed()}},i_=Qp;function sg(v,i,u,m,a){let l;for(i+=m;i<u;i+=m)if(l=a(v.slice(i-m,i),v.slice(i,i+m)),l)return l;return!1}function ug(v,i,u,m,a,l,M){let z,D,q=(u-i)/m;if(q===1)z=i;else if(q===2)z=i,D=a;else if(q!==0){let V=v[i],de=v[i+1],pe=0,Ie=[0];for(let we=i+m;we<u;we+=m){let Pe=v[we],et=v[we+1];pe+=Math.sqrt((Pe-V)*(Pe-V)+(et-de)*(et-de)),Ie.push(pe),V=Pe,de=et}let Ne=a*pe,nt=Mx(Ie,Ne);nt<0?(D=(Ne-Ie[-nt-2])/(Ie[-nt-1]-Ie[-nt-2]),z=i+(-nt-2)*m):z=i+nt*m}M=M>1?M:2,l=l||new Array(M);for(let V=0;V<M;++V)l[V]=z===void 0?NaN:D===void 0?v[z+V]:va(v[z+V],v[z+m+V],D);return l}function lg(v,i,u,m,a,l){if(u==i)return null;let M;if(a<v[i+m-1])return l?(M=v.slice(i,i+m),M[m-1]=a,M):null;if(v[u-1]<a)return l?(M=v.slice(u-m,u),M[m-1]=a,M):null;if(a==v[i+m-1])return v.slice(i,i+m);let z=i/m,D=u/m;for(;z<D;){let pe=z+D>>1;a<v[(pe+1)*m-1]?D=pe:z=pe+1}let q=v[z*m-1];if(a==q)return v.slice((z-1)*m,(z-1)*m+m);let V=v[(z+1)*m-1],de=(a-q)/(V-q);M=[];for(let pe=0;pe<m-1;++pe)M.push(va(v[(z-1)*m+pe],v[z*m+pe],de));return M.push(a),M}function z0(v,i,u,m,a,l,M){if(M)return lg(v,i,u[u.length-1],m,a,l);let z;if(a<v[m-1])return l?(z=v.slice(0,m),z[m-1]=a,z):null;if(v[v.length-1]<a)return l?(z=v.slice(v.length-m),z[m-1]=a,z):null;for(let D=0,q=u.length;D<q;++D){let V=u[D];if(i!=V){if(a<v[i+m-1])return null;if(a<=v[V-1])return lg(v,i,V,m,a,!1);i=V}}return null}function D0(v,i,u,m,a){return!Zx(a,function(M){return!hh(v,i,u,m,M[0],M[1])})}function hh(v,i,u,m,a,l){let M=0,z=v[u-m],D=v[u-m+1];for(;i<u;i+=m){let q=v[i],V=v[i+1];D<=l?V>l&&(q-z)*(l-D)-(a-z)*(V-D)>0&&M++:V<=l&&(q-z)*(l-D)-(a-z)*(V-D)<0&&M--,z=q,D=V}return M!==0}function hf(v,i,u,m,a,l){if(u.length===0||!hh(v,i,u[0],m,a,l))return!1;for(let M=1,z=u.length;M<z;++M)if(hh(v,u[M-1],u[M],m,a,l))return!1;return!0}function F0(v,i,u,m,a,l){if(u.length===0)return!1;for(let M=0,z=u.length;M<z;++M){let D=u[M];if(hf(v,i,D,m,a,l))return!0;i=D[D.length-1]}return!1}function pf(v,i,u,m,a){let l=Fy(Qa(),v,i,u,m);return uo(a,l)?lc(a,l)||l[0]>=a[0]&&l[2]<=a[2]||l[1]>=a[1]&&l[3]<=a[3]?!0:sg(v,i,u,m,function(M,z){return Hx(a,M,z)}):!1}function O0(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){if(pf(v,i,u[l],m,a))return!0;i=u[l]}return!1}function Bw(v,i,u,m,a){return!!(pf(v,i,u,m,a)||hh(v,i,u,m,a[0],a[1])||hh(v,i,u,m,a[0],a[3])||hh(v,i,u,m,a[2],a[1])||hh(v,i,u,m,a[2],a[3]))}function r_(v,i,u,m,a){if(!Bw(v,i,u[0],m,a))return!1;if(u.length===1)return!0;for(let l=1,M=u.length;l<M;++l)if(D0(v,u[l-1],u[l],m,a)&&!pf(v,u[l-1],u[l],m,a))return!1;return!0}function B0(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){let z=u[l];if(r_(v,i,z,m,a))return!0;i=z[z.length-1]}return!1}function cg(v,i,u,m){let a=v[i],l=v[i+1],M=0;for(let z=i+m;z<u;z+=m){let D=v[z],q=v[z+1];M+=Math.sqrt((D-a)*(D-a)+(q-l)*(q-l)),a=D,l=q}return M}var ed=class extends ws{constructor(i,u){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(i[0])?this.setFlatCoordinates(u,i):this.setCoordinates(i,u)}appendCoordinate(i){this.flatCoordinates?Ya(this.flatCoordinates,i):this.flatCoordinates=i.slice(),this.changed()}clone(){let i=new ed(this.flatCoordinates.slice(),this.layout);return i.applyProperties(this),i}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(of(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),sf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,i,u,m,a))}forEachSegment(i){return sg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i)}getCoordinateAtM(i,u){return this.layout!="XYM"&&this.layout!="XYZM"?null:(u=u!==void 0?u:!1,lg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i,u))}getCoordinates(){return bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(i,u){return ug(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i,u,this.stride)}getLength(){return cg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(i){let u=[];return u.length=uf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i,u,0),new ed(u,"XY")}getType(){return"LineString"}intersectsExtent(i){return pf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,i)}setCoordinates(i,u){this.setLayout(u,i,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Xh(this.flatCoordinates,0,i,this.stride),this.changed()}},Wl=ed;var td=class extends ws{constructor(i,u,m){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(i[0]))this.setCoordinates(i,u);else if(u!==void 0&&m)this.setFlatCoordinates(u,i),this.ends_=m;else{let a=this.getLayout(),l=i,M=[],z=[];for(let D=0,q=l.length;D<q;++D){let V=l[D];D===0&&(a=V.getLayout()),Ya(M,V.getFlatCoordinates()),z.push(M.length)}this.setFlatCoordinates(a,M),this.ends_=z}}appendLineString(i){this.flatCoordinates?Ya(this.flatCoordinates,i.getFlatCoordinates().slice()):this.flatCoordinates=i.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let i=new td(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return i.applyProperties(this),i}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(af(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),lf(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,i,u,m,a))}getCoordinateAtM(i,u,m){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(u=u!==void 0?u:!1,m=m!==void 0?m:!1,z0(this.flatCoordinates,0,this.ends_,this.stride,i,u,m))}getCoordinates(){return ch(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(i){return i<0||this.ends_.length<=i?null:new Wl(this.flatCoordinates.slice(i===0?0:this.ends_[i-1],this.ends_[i]),this.layout)}getLineStrings(){let i=this.flatCoordinates,u=this.ends_,m=this.layout,a=[],l=0;for(let M=0,z=u.length;M<z;++M){let D=u[M],q=new Wl(i.slice(l,D),m);a.push(q),l=D}return a}getFlatMidpoints(){let i=[],u=this.flatCoordinates,m=0,a=this.ends_,l=this.stride;for(let M=0,z=a.length;M<z;++M){let D=a[M],q=ug(u,m,D,l,.5);Ya(i,q),m=D}return i}getSimplifiedGeometryInternal(i){let u=[],m=[];return u.length=k0(this.flatCoordinates,0,this.ends_,this.stride,i,u,0,m),new td(u,"XY",m)}getType(){return"MultiLineString"}intersectsExtent(i){return O0(this.flatCoordinates,0,this.ends_,this.stride,i)}setCoordinates(i,u){this.setLayout(u,i,2),this.flatCoordinates||(this.flatCoordinates=[]);let m=nf(this.flatCoordinates,0,i,this.stride,this.ends_);this.flatCoordinates.length=m.length===0?0:m[m.length-1],this.changed()}},U0=td;var df=class extends ws{constructor(i,u){super(),this.setCoordinates(i,u)}clone(){let i=new df(this.flatCoordinates.slice(),this.layout);return i.applyProperties(this),i}closestPointXY(i,u,m,a){let l=this.flatCoordinates,M=ql(i,u,l[0],l[1]);if(M<a){let z=this.stride;for(let D=0;D<z;++D)m[D]=l[D];return m.length=z,M}return a}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(i){return Xp(this.flatCoordinates,i)}getType(){return"Point"}intersectsExtent(i){return Jd(i,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(i,u){this.setLayout(u,i,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=E0(this.flatCoordinates,0,i,this.stride),this.changed()}},xa=df;var ff=class extends ws{constructor(i,u){super(),u&&!Array.isArray(i[0])?this.setFlatCoordinates(u,i):this.setCoordinates(i,u)}appendPoint(i){this.flatCoordinates?Ya(this.flatCoordinates,i.getFlatCoordinates()):this.flatCoordinates=i.getFlatCoordinates().slice(),this.changed()}clone(){let i=new ff(this.flatCoordinates.slice(),this.layout);return i.applyProperties(this),i}closestPointXY(i,u,m,a){if(a<bs(this.getExtent(),i,u))return a;let l=this.flatCoordinates,M=this.stride;for(let z=0,D=l.length;z<D;z+=M){let q=ql(i,u,l[z],l[z+1]);if(q<a){a=q;for(let V=0;V<M;++V)m[V]=l[z+V];m.length=M}}return a}getCoordinates(){return bl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(i){let u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return i<0||u<=i?null:new xa(this.flatCoordinates.slice(i*this.stride,(i+1)*this.stride),this.layout)}getPoints(){let i=this.flatCoordinates,u=this.layout,m=this.stride,a=[];for(let l=0,M=i.length;l<M;l+=m){let z=new xa(i.slice(l,l+m),u);a.push(z)}return a}getType(){return"MultiPoint"}intersectsExtent(i){let u=this.flatCoordinates,m=this.stride;for(let a=0,l=u.length;a<l;a+=m){let M=u[a],z=u[a+1];if(Jd(i,M,z))return!0}return!1}setCoordinates(i,u){this.setLayout(u,i,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Xh(this.flatCoordinates,0,i,this.stride),this.changed()}},hg=ff;function n_(v,i,u,m,a,l,M){let z,D,q,V,de,pe,Ie,Ne=a[l+1],nt=[];for(let et=0,ut=u.length;et<ut;++et){let mt=u[et];for(V=v[mt-m],pe=v[mt-m+1],z=i;z<mt;z+=m)de=v[z],Ie=v[z+1],(Ne<=pe&&Ie<=Ne||pe<=Ne&&Ne<=Ie)&&(q=(Ne-pe)/(Ie-pe)*(de-V)+V,nt.push(q)),V=de,pe=Ie}let we=NaN,Pe=-1/0;for(nt.sort(rh),V=nt[0],z=1,D=nt.length;z<D;++z){de=nt[z];let et=Math.abs(de-V);et>Pe&&(q=(V+de)/2,hf(v,i,u,m,q,Ne)&&(we=q,Pe=et)),V=de}return isNaN(we)&&(we=a[l]),M?(M.push(we,Ne,Pe),M):[we,Ne,Pe]}function V0(v,i,u,m,a){let l=[];for(let M=0,z=u.length;M<z;++M){let D=u[M];l=n_(v,i,D,m,a,2*M,l),i=D[D.length-1]}return l}function N0(v,i,u,m){for(;i<u-m;){for(let a=0;a<m;++a){let l=v[i+a];v[i+a]=v[u-m+a],v[u-m+a]=l}i+=m,u-=m}}function j0(v,i,u,m){let a=0,l=v[u-m],M=v[u-m+1];for(;i<u;i+=m){let z=v[i],D=v[i+1];a+=(z-l)*(D+M),l=z,M=D}return a===0?void 0:a>0}function o_(v,i,u,m,a){a=a!==void 0?a:!1;for(let l=0,M=u.length;l<M;++l){let z=u[l],D=j0(v,i,z,m);if(l===0){if(a&&D||!a&&!D)return!1}else if(a&&!D||!a&&D)return!1;i=z}return!0}function G0(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l){let z=u[l];if(!o_(v,i,z,m,a))return!1;z.length&&(i=z[z.length-1])}return!0}function pg(v,i,u,m,a){a=a!==void 0?a:!1;for(let l=0,M=u.length;l<M;++l){let z=u[l],D=j0(v,i,z,m);(l===0?a&&D||!a&&!D:a&&!D||!a&&D)&&N0(v,i,z,m),i=z}return i}function a_(v,i,u,m,a){for(let l=0,M=u.length;l<M;++l)i=pg(v,i,u[l],m,a);return i}var ph=class extends ws{constructor(i,u,m){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,u!==void 0&&m?(this.setFlatCoordinates(u,i),this.ends_=m):this.setCoordinates(i,u)}appendLinearRing(i){this.flatCoordinates?Ya(this.flatCoordinates,i.getFlatCoordinates()):this.flatCoordinates=i.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let i=new ph(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return i.applyProperties(this),i}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(af(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),lf(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,i,u,m,a))}containsXY(i,u){return hf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,i,u)}getArea(){return t_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(i){let u;return i!==void 0?(u=this.getOrientedFlatCoordinates().slice(),pg(u,0,this.ends_,this.stride,i)):u=this.flatCoordinates,ch(u,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let i=wu(this.getExtent());this.flatInteriorPoint_=n_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,i,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new xa(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(i){return i<0||this.ends_.length<=i?null:new i_(this.flatCoordinates.slice(i===0?0:this.ends_[i-1],this.ends_[i]),this.layout)}getLinearRings(){let i=this.layout,u=this.flatCoordinates,m=this.ends_,a=[],l=0;for(let M=0,z=m.length;M<z;++M){let D=m[M],q=new i_(u.slice(l,D),i);a.push(q),l=D}return a}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let i=this.flatCoordinates;o_(i,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=i:(this.orientedFlatCoordinates_=i.slice(),this.orientedFlatCoordinates_.length=pg(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(i){let u=[],m=[];return u.length=Qy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(i),u,0,m),new ph(u,"XY",m)}getType(){return"Polygon"}intersectsExtent(i){return r_(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,i)}setCoordinates(i,u){this.setLayout(u,i,2),this.flatCoordinates||(this.flatCoordinates=[]);let m=nf(this.flatCoordinates,0,i,this.stride,this.ends_);this.flatCoordinates.length=m.length===0?0:m[m.length-1],this.changed()}},mf=ph;function s_(v){let i=v[0],u=v[1],m=v[2],a=v[3],l=[i,u,i,a,m,a,m,u,i,u];return new ph(l,"XY",[l.length])}function l_(v,i,u){i=i||32;let m=v.getStride(),a=v.getLayout(),l=v.getCenter(),M=m*(i+1),z=new Array(M);for(let V=0;V<M;V+=m){z[V]=0,z[V+1]=0;for(let de=2;de<m;de++)z[V+de]=l[de]}let D=[z.length],q=new ph(z,a,D);return Uw(q,l,v.getRadius(),u),q}function Uw(v,i,u,m){let a=v.getFlatCoordinates(),l=v.getStride(),M=a.length/l-1,z=m||0;for(let D=0;D<=M;++D){let q=D*l,V=z+Wh(D,M)*2*Math.PI/M;a[q]=i[0]+u*Math.cos(V),a[q+1]=i[1]+u*Math.sin(V)}v.changed()}function q0(v,i,u,m){let a=[],l=Qa();for(let M=0,z=u.length;M<z;++M){let D=u[M];l=Jm(v,i,D[0],m),a.push((l[0]+l[2])/2,(l[1]+l[3])/2),i=D[D.length-1]}return a}var id=class extends ws{constructor(i,u,m){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!m&&!Array.isArray(i[0])){let a=this.getLayout(),l=i,M=[],z=[];for(let D=0,q=l.length;D<q;++D){let V=l[D];D===0&&(a=V.getLayout());let de=M.length,pe=V.getEnds();for(let Ie=0,Ne=pe.length;Ie<Ne;++Ie)pe[Ie]+=de;Ya(M,V.getFlatCoordinates()),z.push(pe)}u=a,i=M,m=z}u!==void 0&&m?(this.setFlatCoordinates(u,i),this.endss_=m):this.setCoordinates(i,u)}appendPolygon(i){let u;if(!this.flatCoordinates)this.flatCoordinates=i.getFlatCoordinates().slice(),u=i.getEnds().slice(),this.endss_.push();else{let m=this.flatCoordinates.length;Ya(this.flatCoordinates,i.getFlatCoordinates()),u=i.getEnds().slice();for(let a=0,l=u.length;a<l;++a)u[a]+=m}this.endss_.push(u),this.changed()}clone(){let i=this.endss_.length,u=new Array(i);for(let a=0;a<i;++a)u[a]=this.endss_[a].slice();let m=new id(this.flatCoordinates.slice(),this.layout,u);return m.applyProperties(this),m}closestPointXY(i,u,m,a){return a<bs(this.getExtent(),i,u)?a:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(M0(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),P0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,i,u,m,a))}containsXY(i,u){return F0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,i,u)}getArea(){return L0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(i){let u;return i!==void 0?(u=this.getOrientedFlatCoordinates().slice(),a_(u,0,this.endss_,this.stride,i)):u=this.flatCoordinates,cf(u,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let i=q0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=V0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,i),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new hg(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let i=this.flatCoordinates;G0(i,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=i:(this.orientedFlatCoordinates_=i.slice(),this.orientedFlatCoordinates_.length=a_(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(i){let u=[],m=[];return u.length=R0(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(i),u,0,m),new id(u,"XY",m)}getPolygon(i){if(i<0||this.endss_.length<=i)return null;let u;if(i===0)u=0;else{let l=this.endss_[i-1];u=l[l.length-1]}let m=this.endss_[i].slice(),a=m[m.length-1];if(u!==0)for(let l=0,M=m.length;l<M;++l)m[l]-=u;return new mf(this.flatCoordinates.slice(u,a),this.layout,m)}getPolygons(){let i=this.layout,u=this.flatCoordinates,m=this.endss_,a=[],l=0;for(let M=0,z=m.length;M<z;++M){let D=m[M].slice(),q=D[D.length-1];if(l!==0)for(let de=0,pe=D.length;de<pe;++de)D[de]-=l;let V=new mf(u.slice(l,q),i,D);a.push(V),l=q}return a}getType(){return"MultiPolygon"}intersectsExtent(i){return B0(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,i)}setCoordinates(i,u){this.setLayout(u,i,3),this.flatCoordinates||(this.flatCoordinates=[]);let m=T0(this.flatCoordinates,0,i,this.stride,this.endss_);if(m.length===0)this.flatCoordinates.length=0;else{let a=m[m.length-1];this.flatCoordinates.length=a.length===0?0:a[a.length-1]}this.changed()}},Z0=id;var Vw=(v,i,u)=>{let{time_intervals:m,olGeometry:a,coordinate:l}=i.properties,{coordinates:M}=i.geometry,{type:z}=i.geometry,D=a,q,V;if(a&&(z=D.getType()),u&&l)q=l;else if(z==="Point")q=M;else if(z==="LineString"){D||(D=new Wl(M));let de=m||[[]],pe=de[0],Ie=de[de.length-1];if(v<pe[0])[,,V]=pe,q=D.getFirstCoordinate();else if(v>Ie[0])[,,V]=Ie,q=D.getLastCoordinate();else for(let Ne=0;Ne<de.length-1;Ne+=1){let[nt,we]=de[Ne],[Pe,et]=de[Ne+1];if(nt<=v&&v<=Pe){let mt=Math.min((v-nt)/(Pe-nt),1)*(et-we)+we;q=D.getCoordinateAt(mt),[,,V]=de[Ne];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",D);return{coord:q,rotation:V}},W0=Vw;var Nw=(v,i,u,m,a)=>{if(!v)return{renderedTrajectories:[]};let{time:l=Date.now(),size:M=[],center:z,resolution:D,rotation:q=0,pixelRatio:V=1}=m;if(!D||!z)return{renderedTrajectories:[]};let{noInterpolate:de=!1,hoverVehicleId:pe,selectedVehicleId:Ie,filter:Ne,getScreenPixel:nt=(zt,Qt)=>(Qt.zoom||0)<12?zt.map(Vt=>Math.floor(Vt)):zt}=a,we=v.getContext("2d");we?.clearRect(0,0,v.width,v.height);let[Pe,et]=M;Pe&&et&&(v.width!==Pe||v.height!==et)&&([v.width,v.height]=[Pe*V,et*V]);let ut=Ys(Da(),M[0]/2,M[1]/2,1/D,-1/D,-q,-z[0],-z[1]);v.style&&(v.style.width=`${v.width/V}px`,v.style.height=`${v.height/V}px`);let mt,ct,ft,It,Mt=[];for(let zt=i.length-1;zt>=0;zt-=1){let Qt=i[zt];if(Ne&&!Ne(Qt))continue;let{train_id:Vt,timeOffset:mi}=Qt.properties,{coord:Ii,rotation:$t}=W0(l-(mi||0),Qt,de);if(i[zt].properties.coordinate=Ii,i[zt].properties.rotation=$t,!Ii)continue;let ci=qo(ut,[...Ii]);if(!ci||(ci=ci.map(Ei=>Ei*V),ci[0]<0||ci[0]>v.width||ci[1]<0||ci[1]>v.height))continue;let Jt=u(Qt,m,a);if(Jt){if(pe!==Vt&&Ie!==Vt){let[Ei,ni]=nt([ci[0]-Jt.width/2,ci[1]-Jt.height/2],m);we?.drawImage(Jt,Ei,ni)}pe&&pe===Vt&&(mt=Jt,ct=ci),Ie&&Ie===Vt&&(ft=Jt,It=ci),Mt.push(Qt)}}return ft&&It&&we?.drawImage(ft,Math.floor(It[0]-ft.width/2),Math.floor(It[1]-ft.height/2)),mt&&ct&&we?.drawImage(mt,Math.floor(ct[0]-mt.width/2),Math.floor(ct[1]-mt.height/2)),{renderedTrajectories:Mt}},gf=Nw;function rd(v){let i;return u=>{let{map:m,mbMap:a,olLayer:l}=v;if(!m||!a)return i||(i=document.createElement("div")),i;let M=a.getCanvas(),{viewState:z}=u,D=l?.getOpacity()||1;return M.style.opacity=`${D}`,a.jumpTo({center:sh(z.center),zoom:z.zoom-1,bearing:a0(-z.rotation)}),M.isConnected?(M.width!==u.size[0]||M.height!==u.size[1])&&a.resize():m.render(),a.redraw(),a.getContainer()}}function nd(v){let i;return u=>{let{map:m,mbMap:a,renderState:l,olLayer:M}=v;if(!m||!a)return i||(i=document.createElement("div")),i;let z=!1,D=a.getCanvas(),{viewState:q}=u,V=M?.getVisible();l&&l?.visible!==V&&(D.style.display=V?"block":"none",l.visible=V,D.style.position="absolute");let de=M?.getOpacity();D&&l&&l.opacity!==de&&(D.style.opacity=de,l.opacity=de);let{rotation:pe}=q;l&&l.rotation!==pe&&(a.rotateTo(-(pe||0)*180/Math.PI,{animate:!1}),z=!0,l.rotation=pe),l&&l.center&&(l.zoom!==q.zoom||l.center[0]!==q.center[0]||l.center[1]!==q.center[1])&&(a.jumpTo({center:sh(q.center),zoom:q.zoom-1}),z=!0,l.zoom=q.zoom,l.center=q.center);let Ie=m.getSize()||[0,0];if(l&&l.size&&(l.size[0]!==Ie[0]||l.size[1]!==Ie[1])&&(z=!0,l.size=Ie),a&&a.style&&a.isStyleLoaded()&&z)try{a._frame&&(a._frame.cancel(),a._frame=null),a._render()}catch(Ne){console.warn(Ne)}return a.getContainer()}}var jw=(v,i,u=!1)=>{let m=["HIDDEN","LEAVING","BOARDING"],a=v.has_fzo&&m.indexOf(v.state)>-1,l=i.has_fzo&&m.indexOf(i.state)>-1;if(a||l){if(a!==l)return a?-1:1;if(v.state!==i.state)return m.indexOf(v.state)-m.indexOf(i.state)}let M=null,z=null,D=Date.now();return u?(M=new Date(v.min_arrival_time||v.time).getTime()-D,z=new Date(i.min_arrival_time||i.time).getTime()-D):(M=new Date(v.time).getTime()-D,z=new Date(i.time).getTime()-D),M-z},yf=jw;var Gw=(v,i=!1,u=30)=>{let m=Object.keys(v).map(de=>v[de]);m.sort((de,pe)=>yf(de,pe,i));let a=new Date;a.setMinutes(a.getMinutes()+u);let l=a.getTime(),M=new Date;M.setMinutes(M.getMinutes()-u);let z=M.getTime(),D=[],q=[],V=null;for(let de=m.length-1;de>=0;de-=1){let pe={...m[de]},Ie=new Date(pe.time).getTime();Ie>z&&Ie<l&&(pe.state==="BOARDING"&&(q.includes(pe.platform)?pe.state="HIDDEN":q.push(pe.platform)),V&&pe.to[0]===V.to[0]&&Math.abs(Ie-V.time)<1e3&&pe.line.name===V.line.name&&(pe.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(pe.state)&&(pe.cancelled=!0),V=pe,V.time=Ie,D.unshift(pe))}return D},_f=Gw;var qw=(v,i=!1,u=30,m=100)=>{let a={},l={};return M=>{let{source:z,content:D}=M;a[z]&&window.clearTimeout(a[z]),l[D.call_id]=D,a[z]=window.setTimeout(()=>{let q=_f(l,i||!1,u);v(q)},m)}},u_=qw;var Zw=(v,i)=>{let u=null;return typeof window>"u"?null:(typeof document<"u"&&document?.createElement?(u=document.createElement("canvas"),u.width=v,u.height=i):OffscreenCanvas?u=new OffscreenCanvas(v,i):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),u)},Xl=Zw;var od={};wy(od,{bgColors:()=>$0,getBgColor:()=>$w,getDelayColor:()=>Yw,getDelayText:()=>Jw,getRadius:()=>Xw,getTextColor:()=>Kw,getTextSize:()=>Hw,getTypeIndex:()=>dg,textColors:()=>K0,types:()=>X0});var Ww=[[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]],X0=[/^Tram/i,/^Subway( \/ Metro \/ S-Bahn)?/i,/^Train/i,/^Bus/i,/^Ferry/i,/^Cable ?Car/i,/^Gondola/i,/^Funicular/i,/^(Long distance bus|coach)/i,/^Rail/i],$0=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],K0=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],dg=v=>typeof v=="string"?X0.findIndex(i=>i.test(v)):v,Xw=(v,i)=>{try{let u=dg(v||0);return Ww[u][i]}catch{return 1}},$w=v=>{try{let i=dg(v);return $0[i]}catch{return"#ffffff"}},Kw=v=>{try{let i=dg(v);return K0[i]}catch{return"#ffffff"}},Hw=(v,i,u,m)=>{if(!v)return 0;v.font=`bold ${m}px Arial`;let a=v.measureText(u),l=25,M=0;for(;a.width>i-6&&M<l;)m-=.5,v.font=`bold ${m}px arial, sans-serif`,a=v.measureText(u),M+=1;return m},Yw=(v,i,u)=>i?u?"#ff0000":"#a0a0a0":v===null?"#a0a0a0":v>=36e5?"#ed004c":v>=5e5?"#e80000":v>=3e5?"#ff4a00":v>=18e4?"#f7bf00":"#00a00c",Jw=(v,i)=>i?String.fromCodePoint(215):v>36e5?`+${Math.round(v/36e5)}h`:v>59e3?`+${Math.round(v/6e4)}m`:v>0?`+${v}s`:"";var c_={},m_=(v,i,u)=>{let m=`${v}, ${i}, ${u}`;if(!c_[m]){let a=Xl(v*2,v*2);if(a){let l=a.getContext("2d");if(!l)return null;l.beginPath(),l.arc(v,v,i,0,2*Math.PI,!1),l.fillStyle=u,l.filter="blur(1px)",l.fill(),c_[m]=a}}return c_[m]},h_={},g_=(v,i,u,m,a="#000",l=1)=>{let M=`${v}, ${u}, ${m}, ${a}, ${l}`;if(!h_[M]){let z=Xl(Math.ceil(v.length*i),Math.ceil(i+8*l));if(z){let D=z.getContext("2d");if(!D)return null;D.font=u,D.textAlign="left",D.textBaseline="middle",D.font=u,D.fillStyle=m,D.strokeStyle=a,D.lineWidth=1.5*l,D.strokeText(v,0,i),D.fillText(v,0,i),h_[M]=z}}return h_[M]},p_={},y_=(v,i,u,m,a,l)=>{let M=`${v}, ${i}, ${u}, ${m}, ${a}, ${l}`;if(!p_[M]){let z=Xl(v*2,v*2);if(z){let D=z.getContext("2d");if(!D)return null;D.fillStyle=u,m&&(D.lineWidth=1*l,D.strokeStyle="#000000"),D.beginPath(),D.arc(v,v,i,0,2*Math.PI,!1),D.fill(),a&&D.setLineDash([5,3]),m&&D.stroke(),p_[M]=z}}return p_[M]},d_={},__=(v,i,u,m,a,l,M)=>{let z=`${v}, ${i}, ${u}, ${m},${a}, ${l}, ${M}`;if(!d_[z]){let D=Xl(i*2,i*2);if(D){let q=D.getContext("2d");if(!q)return null;l&&(q.save(),q.textBaseline="middle",q.textAlign="center",q.font=`bold ${u+2}px Arial`,q.strokeStyle=a,q.strokeText(v,i,i),q.restore()),q.textBaseline="middle",q.textAlign="center",q.fillStyle=m,q.font=`bold ${u}px Arial`,q.strokeStyle=a,q.strokeText(v,i,i),q.fillText(v,i,i),d_[z]=D}}return d_[z]},f_={},Qw=(v,i,u)=>{let{hoverVehicleId:m,selectedVehicleId:a,useDelayStyle:l,delayOutlineColor:M="#000",delayDisplay:z=3e5,getRadius:D=()=>0,getBgColor:q=()=>"#000",getDelayColor:V=()=>"#000",getDelayText:de=()=>null,getTextColor:pe=()=>"#000",getTextSize:Ie=()=>0,getMaxRadiusForText:Ne=()=>10,getMaxRadiusForStrokeAndDelay:nt=()=>7}=u,{zoom:we,pixelRatio:Pe=1}=i,{type:et}=v.properties,{train_id:ut,line:mt,delay:ct,state:ft,operator_provides_realtime_journey:It}=v.properties,{name:Mt,text_color:zt,color:Qt}=mt||{},Vt=ft==="JOURNEY_CANCELLED";et||(et="Rail"),Mt||(Mt="I"),zt||(zt="#000000"),Qt&&Qt[0]!=="#"&&(Qt=`#${Qt}`),zt[0]!=="#"&&(zt=`#${zt}`);let mi=Math.min(Math.floor(we||1),16),Ii=!!(m&&m===ut),$t=!!(a&&a===ut),ci=D(et,mi)*Pe,Jt=ci>=nt()*Pe;(Ii||$t)&&(ci=Jt?ci+5*Pe:14*Pe);let Ei=ci>Ne()*Pe,ni=`${ci}${Ii||$t}`;if(l?(ni+=`${It}${ct}`,Jt&&(ni+=`${Vt}`)):(ni+=`${Qt||et}`,Jt&&(ni+=`${Vt}${ct}`)),Ei&&(ni+=`${Mt}${zt}`),!f_[ni]){if(ci===0)return null;let Ui=1*Pe,Bi=ci+2*Pe,jr=ci*2,Ht=Bi*2+Ui*2,Br=Ht/2,Gr=null;Jt&&ct!==null&&(Gr=m_(Br,Bi,V(ct,Vt)));let or=null,on=0;if(Jt&&(Ii||(ct||0)>=z||Vt)){on=Math.max(Vt?19:14,Math.min(Vt?19:17,ci*1.2))*Pe;let pr=de(ct,Vt);pr&&(or=g_(pr,on,`bold ${on}px arial, sans-serif`,V(ct,Vt,!0),M,Pe))}let Fi;l?Fi=V(ct,Vt):Fi=Qt||q(et);let qr=y_(Br,ci,Fi,Jt||Ii||$t,!!Jt&&!!l&&ct===null&&It==="yes",Pe),Ai=Ht+(or?.width||0)*2,Ir=Xl(Ai,Ht);if(Ir){let pr=Ir.getContext("2d");if(!pr)return null;let Wn=or?.width||0;Gr&&pr.drawImage(Gr,Wn,0),qr&&pr.drawImage(qr,Wn,0);let dn=null;if(Ei){let qi=Math.max(ci,10),Zr=Ie(pr,jr,Mt,qi),An=l?"#000000":zt||pe(et);dn=__(Mt,Br,Zr,An,Fi,!!l&&ct===null&&It==="yes",Pe)}dn&&pr.drawImage(dn,Wn,0),or&&pr.drawImage(or,Wn+Math.ceil(Br+Bi)+Ui,Math.ceil(Br-on)),f_[ni]=Ir}}return f_[ni]},$h=Qw;var e2=(v,i,u)=>$h(v,i,{...u,useDelayStyle:!0}),v_=e2;var fg,t2=()=>{if(!fg){fg=Xl(15,15);let v=fg?.getContext("2d");v&&(v.arc(8,8,5,0,2*Math.PI,!1),v.fillStyle="#8ED6FF",v.fill(),v.lineWidth=3,v.strokeStyle="black",v.stroke(),v.lineWidth=3)}return fg},x_=t2;var Yr={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var b_=class extends lo{constructor(i){super(),this.on,this.once,this.un,this.background_=i.background;let u=Object.assign({},i);typeof i.properties=="object"&&(delete u.properties,Object.assign(u,i.properties)),u[Yr.OPACITY]=i.opacity!==void 0?i.opacity:1,zr(typeof u[Yr.OPACITY]=="number",64),u[Yr.VISIBLE]=i.visible!==void 0?i.visible:!0,u[Yr.Z_INDEX]=i.zIndex,u[Yr.MAX_RESOLUTION]=i.maxResolution!==void 0?i.maxResolution:1/0,u[Yr.MIN_RESOLUTION]=i.minResolution!==void 0?i.minResolution:0,u[Yr.MIN_ZOOM]=i.minZoom!==void 0?i.minZoom:-1/0,u[Yr.MAX_ZOOM]=i.maxZoom!==void 0?i.maxZoom:1/0,this.className_=u.className!==void 0?u.className:"ol-layer",delete u.className,this.setProperties(u),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(i){let u=this.state_||{layer:this,managed:i===void 0?!0:i},m=this.getZIndex();return u.opacity=Jn(Math.round(this.getOpacity()*100)/100,0,1),u.visible=this.getVisible(),u.extent=this.getExtent(),u.zIndex=m===void 0&&!u.managed?1/0:m,u.maxResolution=this.getMaxResolution(),u.minResolution=Math.max(this.getMinResolution(),0),u.minZoom=this.getMinZoom(),u.maxZoom=this.getMaxZoom(),this.state_=u,u}getLayersArray(i){return Xi()}getLayerStatesArray(i){return Xi()}getExtent(){return this.get(Yr.EXTENT)}getMaxResolution(){return this.get(Yr.MAX_RESOLUTION)}getMinResolution(){return this.get(Yr.MIN_RESOLUTION)}getMinZoom(){return this.get(Yr.MIN_ZOOM)}getMaxZoom(){return this.get(Yr.MAX_ZOOM)}getOpacity(){return this.get(Yr.OPACITY)}getSourceState(){return Xi()}getVisible(){return this.get(Yr.VISIBLE)}getZIndex(){return this.get(Yr.Z_INDEX)}setBackground(i){this.background_=i,this.changed()}setExtent(i){this.set(Yr.EXTENT,i)}setMaxResolution(i){this.set(Yr.MAX_RESOLUTION,i)}setMinResolution(i){this.set(Yr.MIN_RESOLUTION,i)}setMaxZoom(i){this.set(Yr.MAX_ZOOM,i)}setMinZoom(i){this.set(Yr.MIN_ZOOM,i)}setOpacity(i){zr(typeof i=="number",64),this.set(Yr.OPACITY,i)}setVisible(i){this.set(Yr.VISIBLE,i)}setZIndex(i){this.set(Yr.Z_INDEX,i)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},mg=b_;var vf={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Ss={ANIMATING:0,INTERACTING:1};var wl={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function w_(v,i,u){return function(m,a,l,M,z){if(!m)return;if(!a&&!i)return m;let D=i?0:l[0]*a,q=i?0:l[1]*a,V=z?z[0]:0,de=z?z[1]:0,pe=v[0]+D/2+V,Ie=v[2]-D/2+V,Ne=v[1]+q/2+de,nt=v[3]-q/2+de;pe>Ie&&(pe=(Ie+pe)/2,Ie=pe),Ne>nt&&(Ne=(nt+Ne)/2,nt=Ne);let we=Jn(m[0],pe,Ie),Pe=Jn(m[1],Ne,nt);if(M&&u&&a){let et=30*a;we+=-et*Math.log(1+Math.max(0,pe-m[0])/et)+et*Math.log(1+Math.max(0,m[0]-Ie)/et),Pe+=-et*Math.log(1+Math.max(0,Ne-m[1])/et)+et*Math.log(1+Math.max(0,m[1]-nt)/et)}return[we,Pe]}}function H0(v){return v}function S_(v,i,u,m){let a=bo(i)/u[0],l=vl(i)/u[1];return m?Math.min(v,Math.max(a,l)):Math.min(v,Math.min(a,l))}function E_(v,i,u){let m=Math.min(v,i),a=50;return m*=Math.log(1+a*Math.max(0,v/i-1))/a+1,u&&(m=Math.max(m,u),m/=Math.log(1+a*Math.max(0,u/v-1))/a+1),Jn(m,u/2,i*2)}function Y0(v,i,u,m){return i=i!==void 0?i:!0,function(a,l,M,z){if(a!==void 0){let D=v[0],q=v[v.length-1],V=u?S_(D,u,M,m):D;if(z)return i?E_(a,V,q):Jn(a,q,V);let de=Math.min(V,a),pe=Math.floor(jm(v,de,l));return v[pe]>V&&pe<v.length-1?v[pe+1]:v[pe]}}}function J0(v,i,u,m,a,l){return m=m!==void 0?m:!0,u=u!==void 0?u:0,function(M,z,D,q){if(M!==void 0){let V=a?S_(i,a,D,l):i;if(q)return m?E_(M,V,u):Jn(M,u,V);let de=1e-9,pe=Math.ceil(Math.log(i/V)/Math.log(v)-de),Ie=-z*(.5-de)+.5,Ne=Math.min(V,M),nt=Math.floor(Math.log(i/Ne)/Math.log(v)+Ie),we=Math.max(pe,nt),Pe=i/Math.pow(v,we);return Jn(Pe,u,V)}}}function T_(v,i,u,m,a){return u=u!==void 0?u:!0,function(l,M,z,D){if(l!==void 0){let q=m?S_(v,m,z,a):v;return!u||!D?Jn(l,i,q):E_(l,q,i)}}}function Q0(v){if(v!==void 0)return 0}function I_(v){if(v!==void 0)return v}function e1(v){let i=2*Math.PI/v;return function(u,m){if(m)return u;if(u!==void 0)return u=Math.floor(u/i+.5)*i,u}}function t1(v){return v=v||s0(5),function(i,u){if(u)return i;if(i!==void 0)return Math.abs(i)<=v?0:i}}function i2(v){return Math.pow(v,3)}function i1(v){return 1-i2(1-v)}function r1(v){return 3*v*v-2*v*v*v}var C_=0,M_=class extends lo{constructor(i){super(),this.on,this.once,this.un,i=Object.assign({},i),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ig(i.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,i.projection&&Ky(),i.center&&(i.center=Ro(i.center,this.projection_)),i.extent&&(i.extent=Eu(i.extent,this.projection_)),this.applyOptions_(i)}applyOptions_(i){let u=Object.assign({},i);for(let z in wl)delete u[z];this.setProperties(u,!0);let m=n2(i);this.maxResolution_=m.maxResolution,this.minResolution_=m.minResolution,this.zoomFactor_=m.zoomFactor,this.resolutions_=i.resolutions,this.padding_=i.padding,this.minZoom_=m.minZoom;let a=r2(i),l=m.constraint,M=o2(i);this.constraints_={center:a,resolution:l,rotation:M},this.setRotation(i.rotation!==void 0?i.rotation:0),this.setCenterInternal(i.center!==void 0?i.center:null),i.resolution!==void 0?this.setResolution(i.resolution):i.zoom!==void 0&&this.setZoom(i.zoom)}get padding(){return this.padding_}set padding(i){let u=this.padding_;this.padding_=i;let m=this.getCenterInternal();if(m){let a=i||[0,0,0,0];u=u||[0,0,0,0];let l=this.getResolution(),M=l/2*(a[3]-u[3]+u[1]-a[1]),z=l/2*(a[0]-u[0]+u[2]-a[2]);this.setCenterInternal([m[0]+M,m[1]-z])}}getUpdatedOptions_(i){let u=this.getProperties();return u.resolution!==void 0?u.resolution=this.getResolution():u.zoom=this.getZoom(),u.center=this.getCenterInternal(),u.rotation=this.getRotation(),Object.assign({},u,i)}animate(i){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let u=new Array(arguments.length);for(let m=0;m<u.length;++m){let a=arguments[m];a.center&&(a=Object.assign({},a),a.center=Ro(a.center,this.getProjection())),a.anchor&&(a=Object.assign({},a),a.anchor=Ro(a.anchor,this.getProjection())),u[m]=a}this.animateInternal.apply(this,u)}animateInternal(i){let u=arguments.length,m;u>1&&typeof arguments[u-1]=="function"&&(m=arguments[u-1],--u);let a=0;for(;a<u&&!this.isDef();++a){let V=arguments[a];V.center&&this.setCenterInternal(V.center),V.zoom!==void 0?this.setZoom(V.zoom):V.resolution&&this.setResolution(V.resolution),V.rotation!==void 0&&this.setRotation(V.rotation)}if(a===u){m&&gg(m,!0);return}let l=Date.now(),M=this.targetCenter_.slice(),z=this.targetResolution_,D=this.targetRotation_,q=[];for(;a<u;++a){let V=arguments[a],de={start:l,complete:!1,anchor:V.anchor,duration:V.duration!==void 0?V.duration:1e3,easing:V.easing||r1,callback:m};if(V.center&&(de.sourceCenter=M,de.targetCenter=V.center.slice(),M=de.targetCenter),V.zoom!==void 0?(de.sourceResolution=z,de.targetResolution=this.getResolutionForZoom(V.zoom),z=de.targetResolution):V.resolution&&(de.sourceResolution=z,de.targetResolution=V.resolution,z=de.targetResolution),V.rotation!==void 0){de.sourceRotation=D;let pe=Wh(V.rotation-D+Math.PI,2*Math.PI)-Math.PI;de.targetRotation=D+pe,D=de.targetRotation}a2(de)?de.complete=!0:l+=de.duration,q.push(de)}this.animations_.push(q),this.setHint(Ss.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Ss.ANIMATING]>0}getInteracting(){return this.hints_[Ss.INTERACTING]>0}cancelAnimations(){this.setHint(Ss.ANIMATING,-this.hints_[Ss.ANIMATING]);let i;for(let u=0,m=this.animations_.length;u<m;++u){let a=this.animations_[u];if(a[0].callback&&gg(a[0].callback,!1),!i)for(let l=0,M=a.length;l<M;++l){let z=a[l];if(!z.complete){i=z.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=i,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let i=Date.now(),u=!1;for(let m=this.animations_.length-1;m>=0;--m){let a=this.animations_[m],l=!0;for(let M=0,z=a.length;M<z;++M){let D=a[M];if(D.complete)continue;let q=i-D.start,V=D.duration>0?q/D.duration:1;V>=1?(D.complete=!0,V=1):l=!1;let de=D.easing(V);if(D.sourceCenter){let pe=D.sourceCenter[0],Ie=D.sourceCenter[1],Ne=D.targetCenter[0],nt=D.targetCenter[1];this.nextCenter_=D.targetCenter;let we=pe+de*(Ne-pe),Pe=Ie+de*(nt-Ie);this.targetCenter_=[we,Pe]}if(D.sourceResolution&&D.targetResolution){let pe=de===1?D.targetResolution:D.sourceResolution+de*(D.targetResolution-D.sourceResolution);if(D.anchor){let Ie=this.getViewportSize_(this.getRotation()),Ne=this.constraints_.resolution(pe,0,Ie,!0);this.targetCenter_=this.calculateCenterZoom(Ne,D.anchor)}this.nextResolution_=D.targetResolution,this.targetResolution_=pe,this.applyTargetState_(!0)}if(D.sourceRotation!==void 0&&D.targetRotation!==void 0){let pe=de===1?Wh(D.targetRotation+Math.PI,2*Math.PI)-Math.PI:D.sourceRotation+de*(D.targetRotation-D.sourceRotation);if(D.anchor){let Ie=this.constraints_.rotation(pe,!0);this.targetCenter_=this.calculateCenterRotate(Ie,D.anchor)}this.nextRotation_=D.targetRotation,this.targetRotation_=pe}if(this.applyTargetState_(!0),u=!0,!D.complete)break}if(l){this.animations_[m]=null,this.setHint(Ss.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let M=a[0].callback;M&&gg(M,!0)}}this.animations_=this.animations_.filter(Boolean),u&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(i,u){let m,a=this.getCenterInternal();return a!==void 0&&(m=[a[0]-u[0],a[1]-u[1]],c0(m,i-this.getRotation()),u0(m,u)),m}calculateCenterZoom(i,u){let m,a=this.getCenterInternal(),l=this.getResolution();if(a!==void 0&&l!==void 0){let M=u[0]-i*(u[0]-a[0])/l,z=u[1]-i*(u[1]-a[1])/l;m=[M,z]}return m}getViewportSize_(i){let u=this.viewportSize_;if(i){let m=u[0],a=u[1];return[Math.abs(m*Math.cos(i))+Math.abs(a*Math.sin(i)),Math.abs(m*Math.sin(i))+Math.abs(a*Math.cos(i))]}return u}setViewportSize(i){this.viewportSize_=Array.isArray(i)?i.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let i=this.getCenterInternal();return i&&Yp(i,this.getProjection())}getCenterInternal(){return this.get(wl.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(i){return i!==void 0?(i[0]=this.hints_[0],i[1]=this.hints_[1],i):this.hints_.slice()}calculateExtent(i){let u=this.calculateExtentInternal(i);return lh(u,this.getProjection())}calculateExtentInternal(i){i=i||this.getViewportSizeMinusPadding_();let u=this.getCenterInternal();zr(u,1);let m=this.getResolution();zr(m!==void 0,2);let a=this.getRotation();return zr(a!==void 0,3),Wx(u,m,a,i)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(i){this.applyOptions_(this.getUpdatedOptions_({maxZoom:i}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(i){this.applyOptions_(this.getUpdatedOptions_({minZoom:i}))}setConstrainResolution(i){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:i}))}getProjection(){return this.projection_}getResolution(){return this.get(wl.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(i,u){return this.getResolutionForExtentInternal(Eu(i,this.getProjection()),u)}getResolutionForExtentInternal(i,u){u=u||this.getViewportSizeMinusPadding_();let m=bo(i)/u[0],a=vl(i)/u[1];return Math.max(m,a)}getResolutionForValueFunction(i){i=i||2;let u=this.getConstrainedResolution(this.maxResolution_),m=this.minResolution_,a=Math.log(u/m)/Math.log(i);return function(l){return u/Math.pow(i,l*a)}}getRotation(){return this.get(wl.ROTATION)}getValueForResolutionFunction(i){let u=Math.log(i||2),m=this.getConstrainedResolution(this.maxResolution_),a=this.minResolution_,l=Math.log(m/a)/u;return function(M){return Math.log(m/M)/u/l}}getViewportSizeMinusPadding_(i){let u=this.getViewportSize_(i),m=this.padding_;return m&&(u=[u[0]-m[1]-m[3],u[1]-m[0]-m[2]]),u}getState(){let i=this.getProjection(),u=this.getResolution(),m=this.getRotation(),a=this.getCenterInternal(),l=this.padding_;if(l){let M=this.getViewportSizeMinusPadding_();a=A_(a,this.getViewportSize_(),[M[0]/2+l[3],M[1]/2+l[0]],u,m)}return{center:a.slice(0),projection:i!==void 0?i:null,resolution:u,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:m,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let i,u=this.getResolution();return u!==void 0&&(i=this.getZoomForResolution(u)),i}getZoomForResolution(i){let u=this.minZoom_||0,m,a;if(this.resolutions_){let l=jm(this.resolutions_,i,1);u=l,m=this.resolutions_[l],l==this.resolutions_.length-1?a=2:a=m/this.resolutions_[l+1]}else m=this.maxResolution_,a=this.zoomFactor_;return u+Math.log(m/i)/Math.log(a)}getResolutionForZoom(i){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;let u=Jn(Math.floor(i),0,this.resolutions_.length-2),m=this.resolutions_[u]/this.resolutions_[u+1];return this.resolutions_[u]/Math.pow(m,Jn(i-u,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,i-this.minZoom_)}fit(i,u){let m;if(zr(Array.isArray(i)||typeof i.getSimplifiedGeometry=="function",24),Array.isArray(i)){zr(!$x(i),25);let a=Eu(i,this.getProjection());m=s_(a)}else if(i.getType()==="Circle"){let a=Eu(i.getExtent(),this.getProjection());m=s_(a),m.rotate(this.getRotation(),wu(a))}else{let a=Su();a?m=i.clone().transform(a,this.getProjection()):m=i}this.fitInternal(m,u)}rotatedExtentForGeometry(i){let u=this.getRotation(),m=Math.cos(u),a=Math.sin(-u),l=i.getFlatCoordinates(),M=i.getStride(),z=1/0,D=1/0,q=-1/0,V=-1/0;for(let de=0,pe=l.length;de<pe;de+=M){let Ie=l[de]*m-l[de+1]*a,Ne=l[de]*a+l[de+1]*m;z=Math.min(z,Ie),D=Math.min(D,Ne),q=Math.max(q,Ie),V=Math.max(V,Ne)}return[z,D,q,V]}fitInternal(i,u){u=u||{};let m=u.size;m||(m=this.getViewportSizeMinusPadding_());let a=u.padding!==void 0?u.padding:[0,0,0,0],l=u.nearest!==void 0?u.nearest:!1,M;u.minResolution!==void 0?M=u.minResolution:u.maxZoom!==void 0?M=this.getResolutionForZoom(u.maxZoom):M=0;let z=this.rotatedExtentForGeometry(i),D=this.getResolutionForExtentInternal(z,[m[0]-a[1]-a[3],m[1]-a[0]-a[2]]);D=isNaN(D)?M:Math.max(D,M),D=this.getConstrainedResolution(D,l?0:1);let q=this.getRotation(),V=Math.sin(q),de=Math.cos(q),pe=wu(z);pe[0]+=(a[1]-a[3])/2*D,pe[1]+=(a[0]-a[2])/2*D;let Ie=pe[0]*de-pe[1]*V,Ne=pe[1]*de+pe[0]*V,nt=this.getConstrainedCenter([Ie,Ne],D),we=u.callback?u.callback:ac;u.duration!==void 0?this.animateInternal({resolution:D,center:nt,duration:u.duration,easing:u.easing},we):(this.targetResolution_=D,this.targetCenter_=nt,this.applyTargetState_(!1,!0),gg(we,!0))}centerOn(i,u,m){this.centerOnInternal(Ro(i,this.getProjection()),u,m)}centerOnInternal(i,u,m){this.setCenterInternal(A_(i,u,m,this.getResolution(),this.getRotation()))}calculateCenterShift(i,u,m,a){let l,M=this.padding_;if(M&&i){let z=this.getViewportSizeMinusPadding_(-m),D=A_(i,a,[z[0]/2+M[3],z[1]/2+M[0]],u,m);l=[i[0]-D[0],i[1]-D[1]]}return l}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(i){let u=Yp(this.targetCenter_,this.getProjection());this.setCenter([u[0]+i[0],u[1]+i[1]])}adjustCenterInternal(i){let u=this.targetCenter_;this.setCenterInternal([u[0]+i[0],u[1]+i[1]])}adjustResolution(i,u){u=u&&Ro(u,this.getProjection()),this.adjustResolutionInternal(i,u)}adjustResolutionInternal(i,u){let m=this.getAnimating()||this.getInteracting(),a=this.getViewportSize_(this.getRotation()),l=this.constraints_.resolution(this.targetResolution_*i,0,a,m);u&&(this.targetCenter_=this.calculateCenterZoom(l,u)),this.targetResolution_*=i,this.applyTargetState_()}adjustZoom(i,u){this.adjustResolution(Math.pow(this.zoomFactor_,-i),u)}adjustRotation(i,u){u&&(u=Ro(u,this.getProjection())),this.adjustRotationInternal(i,u)}adjustRotationInternal(i,u){let m=this.getAnimating()||this.getInteracting(),a=this.constraints_.rotation(this.targetRotation_+i,m);u&&(this.targetCenter_=this.calculateCenterRotate(a,u)),this.targetRotation_+=i,this.applyTargetState_()}setCenter(i){this.setCenterInternal(i&&Ro(i,this.getProjection()))}setCenterInternal(i){this.targetCenter_=i,this.applyTargetState_()}setHint(i,u){return this.hints_[i]+=u,this.changed(),this.hints_[i]}setResolution(i){this.targetResolution_=i,this.applyTargetState_()}setRotation(i){this.targetRotation_=i,this.applyTargetState_()}setZoom(i){this.setResolution(this.getResolutionForZoom(i))}applyTargetState_(i,u){let m=this.getAnimating()||this.getInteracting()||u,a=this.constraints_.rotation(this.targetRotation_,m),l=this.getViewportSize_(a),M=this.constraints_.resolution(this.targetResolution_,0,l,m),z=this.constraints_.center(this.targetCenter_,M,l,m,this.calculateCenterShift(this.targetCenter_,M,a,l));this.get(wl.ROTATION)!==a&&this.set(wl.ROTATION,a),this.get(wl.RESOLUTION)!==M&&(this.set(wl.RESOLUTION,M),this.set("zoom",this.getZoom(),!0)),(!z||!this.get(wl.CENTER)||!es(this.get(wl.CENTER),z))&&this.set(wl.CENTER,z),this.getAnimating()&&!i&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(i,u,m){i=i!==void 0?i:200;let a=u||0,l=this.constraints_.rotation(this.targetRotation_),M=this.getViewportSize_(l),z=this.constraints_.resolution(this.targetResolution_,a,M),D=this.constraints_.center(this.targetCenter_,z,M,!1,this.calculateCenterShift(this.targetCenter_,z,l,M));if(i===0&&!this.cancelAnchor_){this.targetResolution_=z,this.targetRotation_=l,this.targetCenter_=D,this.applyTargetState_();return}m=m||(i===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==z||this.getRotation()!==l||!this.getCenterInternal()||!es(this.getCenterInternal(),D))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:l,center:D,resolution:z,duration:i,easing:i1,anchor:m}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Ss.INTERACTING,1)}endInteraction(i,u,m){m=m&&Ro(m,this.getProjection()),this.endInteractionInternal(i,u,m)}endInteractionInternal(i,u,m){this.getInteracting()&&(this.setHint(Ss.INTERACTING,-1),this.resolveConstraints(i,u,m))}getConstrainedCenter(i,u){let m=this.getViewportSize_(this.getRotation());return this.constraints_.center(i,u||this.getResolution(),m)}getConstrainedZoom(i,u){let m=this.getResolutionForZoom(i);return this.getZoomForResolution(this.getConstrainedResolution(m,u))}getConstrainedResolution(i,u){u=u||0;let m=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(i,u,m)}};function gg(v,i){setTimeout(function(){v(i)},0)}function r2(v){if(v.extent!==void 0){let u=v.smoothExtentConstraint!==void 0?v.smoothExtentConstraint:!0;return w_(v.extent,v.constrainOnlyCenter,u)}let i=ig(v.projection,"EPSG:3857");if(v.multiWorld!==!0&&i.isGlobal()){let u=i.getExtent().slice();return u[0]=-1/0,u[2]=1/0,w_(u,!1,!1)}return H0}function n2(v){let i,u,m,M=v.minZoom!==void 0?v.minZoom:C_,z=v.maxZoom!==void 0?v.maxZoom:28,D=v.zoomFactor!==void 0?v.zoomFactor:2,q=v.multiWorld!==void 0?v.multiWorld:!1,V=v.smoothResolutionConstraint!==void 0?v.smoothResolutionConstraint:!0,de=v.showFullExtent!==void 0?v.showFullExtent:!1,pe=ig(v.projection,"EPSG:3857"),Ie=pe.getExtent(),Ne=v.constrainOnlyCenter,nt=v.extent;if(!q&&!nt&&pe.isGlobal()&&(Ne=!1,nt=Ie),v.resolutions!==void 0){let we=v.resolutions;u=we[M],m=we[z]!==void 0?we[z]:we[we.length-1],v.constrainResolution?i=Y0(we,V,!Ne&&nt,de):i=T_(u,m,V,!Ne&&nt,de)}else{let Pe=(Ie?Math.max(bo(Ie),vl(Ie)):360*Zh.degrees/pe.getMetersPerUnit())/256/Math.pow(2,C_),et=Pe/Math.pow(2,28-C_);u=v.maxResolution,u!==void 0?M=0:u=Pe/Math.pow(D,M),m=v.minResolution,m===void 0&&(v.maxZoom!==void 0?v.maxResolution!==void 0?m=u/Math.pow(D,z):m=Pe/Math.pow(D,z):m=et),z=M+Math.floor(Math.log(u/m)/Math.log(D)),m=u/Math.pow(D,z-M),v.constrainResolution?i=J0(D,u,m,V,!Ne&&nt,de):i=T_(u,m,V,!Ne&&nt,de)}return{constraint:i,maxResolution:u,minResolution:m,minZoom:M,zoomFactor:D}}function o2(v){if(v.enableRotation!==void 0?v.enableRotation:!0){let u=v.constrainRotation;return u===void 0||u===!0?t1():u===!1?I_:typeof u=="number"?e1(u):I_}return Q0}function a2(v){return!(v.sourceCenter&&v.targetCenter&&!es(v.sourceCenter,v.targetCenter)||v.sourceResolution!==v.targetResolution||v.sourceRotation!==v.targetRotation)}function A_(v,i,u,m,a){let l=Math.cos(-a),M=Math.sin(-a),z=v[0]*l-v[1]*M,D=v[1]*l+v[0]*M;z+=(i[0]/2-u[0])*m,D+=(u[1]-i[1]/2)*m,M=-M;let q=z*l-D*M,V=D*l+z*M;return[q,V]}var P_=M_;var k_=class extends mg{constructor(i){let u=Object.assign({},i);delete u.source,super(u),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,i.render&&(this.render=i.render),i.map&&this.setMap(i.map),this.addChangeListener(Yr.SOURCE,this.handleSourcePropertyChange_);let m=i.source?i.source:null;this.setSource(m)}getLayersArray(i){return i=i||[],i.push(this),i}getLayerStatesArray(i){return i=i||[],i.push(this.getLayerState()),i}getSource(){return this.get(Yr.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let i=this.getSource();return i?i.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Po(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let i=this.getSource();i&&(this.sourceChangeKey_=so(i,cn.CHANGE,this.handleSourceChange_,this),i.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(i){return this.renderer_?this.renderer_.getFeatures(i):Promise.resolve([])}getData(i){return!this.renderer_||!this.rendered?null:this.renderer_.getData(i)}isVisible(i){let u;i instanceof P_?u={viewState:i.getState(),extent:i.calculateExtent()}:u=i;let m=this.getExtent();return this.getVisible()&&R_(this.getLayerState(),u.viewState)&&(!m||uo(m,u.extent))}getAttributions(i){if(!this.isVisible(i))return[];let u,m=this.getSource();if(m&&(u=m.getAttributions()),!u)return[];let a=i instanceof P_?i.getViewStateAndExtent():i,l=u(a);return Array.isArray(l)||(l=[l]),l}render(i,u){let m=this.getRenderer();if(m.prepareFrame(i))return this.rendered=!0,m.renderFrame(i,u)}unrender(){this.rendered=!1}setMapInternal(i){i||this.unrender(),this.set(Yr.MAP,i)}getMapInternal(){return this.get(Yr.MAP)}setMap(i){this.mapPrecomposeKey_&&(Po(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),i||this.changed(),this.mapRenderKey_&&(Po(this.mapRenderKey_),this.mapRenderKey_=null),i&&(this.mapPrecomposeKey_=so(i,vf.PRECOMPOSE,function(u){let a=u.frameState.layerStatesArray,l=this.getLayerState(!1);zr(!a.some(function(M){return M.layer===l.layer}),67),a.push(l)},this),this.mapRenderKey_=so(this,cn.CHANGE,i.render,i),this.changed())}setSource(i){this.set(Yr.SOURCE,i)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}};function R_(v,i){if(!v.visible)return!1;let u=i.resolution;if(u<v.minResolution||u>=v.maxResolution)return!1;let m=i.zoom;return m>v.minZoom&&m<=v.maxZoom}var Kh=k_;var L_=class extends lo{constructor(u={}){super(u);this.defineProperties(u);let{active:m}={active:u.active!==!1,...u};this.active=m}defineProperties(u){let{target:m,element:a,render:l}={...u};Object.defineProperties(this,{active:{get:()=>this.get("active"),set:M=>{this.set("active",M),M?this.activate():this.deactivate(),this.render()}},map:{get:()=>this.get("map"),set:M=>{if(this.map&&this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.deactivate(),this.set("map",M),this.map){let z=this.target||this.map.getTargetElement&&this.map.getTargetElement()||this.map.getContainer&&this.map.getContainer();this.element||this.createDefaultElement(),this.element&&z.appendChild(this.element),this.active&&this.activate()}this.render()}},target:{value:m},element:{value:a,writable:!0},render:{value:l||this.render,writable:!0}})}attachToMap(u){this.map=u}detachFromMap(){this.map=void 0}activate(){this.deactivate()}deactivate(){console.error("The function deactivate() must be implemented in subclasses")}render(u){console.error("The function render() must be implemented in subclasses")}createDefaultElement(){console.error("The function createDefaultElement() must be implemented in subclasses")}},ad=L_;var z_=class extends ad{render(){this.element&&(this.element.innerHTML=this.active?this.getCopyrights().join(" | "):"")}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-copyright",Object.assign(this.element.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"})}getCopyrights(){return console.error("The getCopyrights() function must be implemented in subclasses.",this),[]}},yg=z_;var D_=class extends yg{constructor(u){super(u);this.onPostRender=this.onPostRender.bind(this)}getCopyrights(){if(!this.frameState)return[];let u=[];return this.frameState?.layerStatesArray.forEach(m=>{let{layer:a}=m;this.frameState&&R_(m,this.frameState.viewState)&&a&&a.getSource&&a.getSource()&&a.getSource().getAttributions()&&(u=u.concat(a.getSource().getAttributions()(this.frameState)))}),qh(u)}activate(){super.activate(),this.map&&this.map.on("postrender",this.onPostRender)}deactivate(){this.map&&this.map.un("postrender",this.onPostRender)}onPostRender(u){this.map&&this.element&&(this.frameState=u.frameState||void 0,this.render())}},n1=D_;var Es={ADD:"add",REMOVE:"remove"};var o1={LENGTH:"length"},sd=class extends nn{constructor(i,u,m){super(i),this.element=u,this.index=m}},F_=class extends lo{constructor(i,u){if(super(),this.on,this.once,this.un,u=u||{},this.unique_=!!u.unique,this.array_=i||[],this.unique_)for(let m=0,a=this.array_.length;m<a;++m)this.assertUnique_(this.array_[m],m);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(i){for(let u=0,m=i.length;u<m;++u)this.push(i[u]);return this}forEach(i){let u=this.array_;for(let m=0,a=u.length;m<a;++m)i(u[m],m,u)}getArray(){return this.array_}item(i){return this.array_[i]}getLength(){return this.get(o1.LENGTH)}insertAt(i,u){if(i<0||i>this.getLength())throw new Error("Index out of bounds: "+i);this.unique_&&this.assertUnique_(u),this.array_.splice(i,0,u),this.updateLength_(),this.dispatchEvent(new sd(Es.ADD,u,i))}pop(){return this.removeAt(this.getLength()-1)}push(i){this.unique_&&this.assertUnique_(i);let u=this.getLength();return this.insertAt(u,i),this.getLength()}remove(i){let u=this.array_;for(let m=0,a=u.length;m<a;++m)if(u[m]===i)return this.removeAt(m)}removeAt(i){if(i<0||i>=this.getLength())return;let u=this.array_[i];return this.array_.splice(i,1),this.updateLength_(),this.dispatchEvent(new sd(Es.REMOVE,u,i)),u}setAt(i,u){let m=this.getLength();if(i>=m){this.insertAt(i,u);return}if(i<0)throw new Error("Index out of bounds: "+i);this.unique_&&this.assertUnique_(u,i);let a=this.array_[i];this.array_[i]=u,this.dispatchEvent(new sd(Es.REMOVE,a,i)),this.dispatchEvent(new sd(Es.ADD,u,i))}updateLength_(){this.set(o1.LENGTH,this.array_.length)}assertUnique_(i,u){for(let m=0,a=this.array_.length;m<a;++m)if(this.array_[m]===i&&m!==u)throw new Km(58)}},dh=F_;var xf=class extends lo{constructor(i){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),i)if(typeof i.getSimplifiedGeometry=="function"){let u=i;this.setGeometry(u)}else{let u=i;this.setProperties(u)}}clone(){let i=new xf(this.hasProperties()?this.getProperties():null);i.setGeometryName(this.getGeometryName());let u=this.getGeometry();u&&i.setGeometry(u.clone());let m=this.getStyle();return m&&i.setStyle(m),i}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Po(this.geometryChangeKey_),this.geometryChangeKey_=null);let i=this.getGeometry();i&&(this.geometryChangeKey_=so(i,cn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(i){this.set(this.geometryName_,i)}setStyle(i){this.style_=i,this.styleFunction_=i?s2(i):void 0,this.changed()}setId(i){this.id_=i,this.changed()}setGeometryName(i){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=i,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}};function s2(v){if(typeof v=="function")return v;let i;return Array.isArray(v)?i=v:(zr(typeof v.getZIndex=="function",41),i=[v]),function(){return i}}var Tu=xf;var bf=class{constructor(i){i=i||{},this.color_=i.color!==void 0?i.color:null}clone(){let i=this.getColor();return new bf({color:Array.isArray(i)?i.slice():i||void 0})}getColor(){return this.color_}setColor(i){this.color_=i}},ba=bf;var wf=class{constructor(i){i=i||{},this.color_=i.color!==void 0?i.color:null,this.lineCap_=i.lineCap,this.lineDash_=i.lineDash!==void 0?i.lineDash:null,this.lineDashOffset_=i.lineDashOffset,this.lineJoin_=i.lineJoin,this.miterLimit_=i.miterLimit,this.width_=i.width}clone(){let i=this.getColor();return new wf({color:Array.isArray(i)?i.slice():i||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(i){this.color_=i}setLineCap(i){this.lineCap_=i}setLineDash(i){this.lineDash_=i}setLineDashOffset(i){this.lineDashOffset_=i}setLineJoin(i){this.lineJoin_=i}setMiterLimit(i){this.miterLimit_=i}setWidth(i){this.width_=i}},Wo=wf;var Zn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function ld(v,i){return Array.isArray(v)?v:(i===void 0?i=[v,v]:(i[0]=v,i[1]=v),i)}var Sf=class{constructor(i){this.opacity_=i.opacity,this.rotateWithView_=i.rotateWithView,this.rotation_=i.rotation,this.scale_=i.scale,this.scaleArray_=ld(i.scale),this.displacement_=i.displacement,this.declutterMode_=i.declutterMode}clone(){let i=this.getScale();return new Sf({opacity:this.getOpacity(),scale:Array.isArray(i)?i.slice():i,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return Xi()}getImage(i){return Xi()}getHitDetectionImage(){return Xi()}getPixelRatio(i){return 1}getImageState(){return Xi()}getImageSize(){return Xi()}getOrigin(){return Xi()}getSize(){return Xi()}setDisplacement(i){this.displacement_=i}setOpacity(i){this.opacity_=i}setRotateWithView(i){this.rotateWithView_=i}setRotation(i){this.rotation_=i}setScale(i){this.scale_=i,this.scaleArray_=ld(i)}listenImageChange(i){Xi()}load(){Xi()}unlistenImageChange(i){Xi()}},_g=Sf;var l2=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,u2=/^([a-z]*)$|^hsla?\(.*\)$/i;function vg(v){return typeof v=="string"?v:O_(v)}function c2(v){let i=document.createElement("div");if(i.style.color=v,i.style.color!==""){document.body.appendChild(i);let u=getComputedStyle(i).color;return document.body.removeChild(i),u}return""}var h2=function(){let i={},u=0;return function(m){let a;if(i.hasOwnProperty(m))a=i[m];else{if(u>=1024){let l=0;for(let M in i)l++&3||(delete i[M],--u)}a=p2(m),i[m]=a,++u}return a}}();function Hh(v){return Array.isArray(v)?v:h2(v)}function p2(v){let i,u,m,a,l;if(u2.exec(v)&&(v=c2(v)),l2.exec(v)){let M=v.length-1,z;M<=4?z=1:z=2;let D=M===4||M===8;i=parseInt(v.substr(1+0*z,z),16),u=parseInt(v.substr(1+1*z,z),16),m=parseInt(v.substr(1+2*z,z),16),D?a=parseInt(v.substr(1+3*z,z),16):a=255,z==1&&(i=(i<<4)+i,u=(u<<4)+u,m=(m<<4)+m,D&&(a=(a<<4)+a)),l=[i,u,m,a/255]}else v.startsWith("rgba(")?(l=v.slice(5,-1).split(",").map(Number),a1(l)):v.startsWith("rgb(")?(l=v.slice(4,-1).split(",").map(Number),l.push(1),a1(l)):zr(!1,14);return l}function a1(v){return v[0]=Jn(v[0]+.5|0,0,255),v[1]=Jn(v[1]+.5|0,0,255),v[2]=Jn(v[2]+.5|0,0,255),v[3]=Jn(v[3],0,1),v}function O_(v){let i=v[0];i!=(i|0)&&(i=i+.5|0);let u=v[1];u!=(u|0)&&(u=u+.5|0);let m=v[2];m!=(m|0)&&(m=m+.5|0);let a=v[3]===void 0?1:Math.round(v[3]*100)/100;return"rgba("+i+","+u+","+m+","+a+")"}function Ts(v){return Array.isArray(v)?O_(v):v}function aa(v,i,u,m){let a;return u&&u.length?a=u.shift():Zp?a=new OffscreenCanvas(v||300,i||300):a=document.createElement("canvas"),v&&(a.width=v),i&&(a.height=i),a.getContext("2d",m)}function s1(v){let i=v.canvas;i.width=1,i.height=1,v.clearRect(0,0,1,1)}var d2=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),l1=["style","variant","weight","size","lineHeight","family"],B_=function(v){let i=v.match(d2);if(!i)return null;let u={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let m=0,a=l1.length;m<a;++m){let l=i[m+1];l!==void 0&&(u[l1[m]]=l)}return u.families=u.family.split(/,\s?/),u};var bg="10px sans-serif",Is="#000",Yh="round",hc=[],pc=0,Iu="round",dc=10,fc="#000",mh="center",Jh="middle",mc=[0,0,0,0],gc=1,fh=new lo,ud=null,U_,V_={},u1=function(){let i="32px ",u=["monospace","serif"],m=u.length,a="wmytzilWMYTZIL@#/&?$%10\uF013",l,M;function z(q,V,de){let pe=!0;for(let Ie=0;Ie<m;++Ie){let Ne=u[Ie];if(M=xg(q+" "+V+" "+i+Ne,a),de!=Ne){let nt=xg(q+" "+V+" "+i+de+","+Ne,a);pe=pe&&nt!=M}}return!!pe}function D(){let q=!0,V=fh.getKeys();for(let de=0,pe=V.length;de<pe;++de){let Ie=V[de];fh.get(Ie)<100&&(z.apply(this,Ie.split(`
1076
1076
  `))?(nh(V_),ud=null,U_=void 0,fh.set(Ie,100)):(fh.set(Ie,fh.get(Ie)+1,!0),q=!1))}q&&(clearInterval(l),l=void 0)}return function(q){let V=B_(q);if(!V)return;let de=V.families;for(let pe=0,Ie=de.length;pe<Ie;++pe){let Ne=de[pe],nt=V.style+`
1077
1077
  `+V.weight+`
1078
1078
  `+Ne;fh.get(nt)===void 0&&(fh.set(nt,100,!0),z(V.style,V.weight,Ne)||(fh.set(nt,0,!0),l===void 0&&(l=setInterval(D,32))))}}}(),f2=function(){let v;return function(i){let u=V_[i];if(u==null){if(Zp){let m=B_(i),a=c1(i,"\u017Dg");u=(isNaN(Number(m.lineHeight))?1.2:Number(m.lineHeight))*(a.actualBoundingBoxAscent+a.actualBoundingBoxDescent)}else v||(v=document.createElement("div"),v.innerHTML="M",v.style.minHeight="0",v.style.maxHeight="none",v.style.height="auto",v.style.padding="0",v.style.border="none",v.style.position="absolute",v.style.display="block",v.style.left="-99999px"),v.style.font=i,document.body.appendChild(v),u=v.offsetHeight,document.body.removeChild(v);V_[i]=u}return u}}();function c1(v,i){return ud||(ud=aa(1,1)),v!=U_&&(ud.font=v,U_=ud.font),ud.measureText(i)}function xg(v,i){return c1(v,i).width}function N_(v,i,u){if(i in u)return u[i];let m=i.split(`
@@ -1080,5 +1080,5 @@ uniform ${se} ${fe} u_${xe};
1080
1080
  `||q===V){l=Math.max(l,M),a.push(M),M=0,z+=D;continue}let pe=i[q+1]||v.font,Ie=xg(pe,de);u.push(Ie),M+=Ie;let Ne=f2(pe);m.push(Ne),D=Math.max(D,Ne)}return{width:l,height:z,widths:u,heights:m,lineWidths:a}}function p1(v,i,u,m,a,l,M,z,D,q,V){v.save(),u!==1&&(v.globalAlpha*=u),i&&v.setTransform.apply(v,i),m.contextInstructions?(v.translate(D,q),v.scale(V[0],V[1]),m2(m,v)):V[0]<0||V[1]<0?(v.translate(D,q),v.scale(V[0],V[1]),v.drawImage(m,a,l,M,z,0,0,M,z)):v.drawImage(m,a,l,M,z,D,q,M*V[0],z*V[1]),v.restore()}function m2(v,i){let u=v.contextInstructions;for(let m=0,a=u.length;m<a;m+=2)Array.isArray(u[m+1])?i[u[m]].apply(i,u[m+1]):i[u[m]]=u[m+1]}var Ef=class extends _g{constructor(i){let u=i.rotateWithView!==void 0?i.rotateWithView:!1;super({opacity:1,rotateWithView:u,rotation:i.rotation!==void 0?i.rotation:0,scale:i.scale!==void 0?i.scale:1,displacement:i.displacement!==void 0?i.displacement:[0,0],declutterMode:i.declutterMode}),this.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=i.fill!==void 0?i.fill:null,this.origin_=[0,0],this.points_=i.points,this.radius_=i.radius!==void 0?i.radius:i.radius1,this.radius2_=i.radius2,this.angle_=i.angle!==void 0?i.angle:0,this.stroke_=i.stroke!==void 0?i.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){let i=this.getScale(),u=new Ef({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(i)?i.slice():i,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return u.setOpacity(this.getOpacity()),u}getAnchor(){let i=this.size_;if(!i)return null;let u=this.getDisplacement(),m=this.getScaleArray();return[i[0]/2-u[0]/m[0],i[1]/2+u[1]/m[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(i){this.fill_=i,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(i){let u=this.canvas_[i];if(!u){let m=this.renderOptions_,a=aa(m.size*i,m.size*i);this.draw_(m,a,i),u=a.canvas,this.canvas_[i]=u}return u}getPixelRatio(i){return i}getImageSize(){return this.size_}getImageState(){return Zn.LOADED}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(i){this.stroke_=i,this.render()}listenImageChange(i){}load(){}unlistenImageChange(i){}calculateLineJoinSize_(i,u,m){if(u===0||this.points_===1/0||i!=="bevel"&&i!=="miter")return u;let a=this.radius_,l=this.radius2_===void 0?a:this.radius2_;if(a<l){let ft=a;a=l,l=ft}let M=this.radius2_===void 0?this.points_:this.points_*2,z=2*Math.PI/M,D=l*Math.sin(z),q=Math.sqrt(l*l-D*D),V=a-q,de=Math.sqrt(D*D+V*V),pe=de/D;if(i==="miter"&&pe<=m)return pe*u;let Ie=u/2/pe,Ne=u/2*(V/de),we=Math.sqrt((a+Ie)*(a+Ie)+Ne*Ne)-a;if(this.radius2_===void 0||i==="bevel")return we*2;let Pe=a*Math.sin(z),et=Math.sqrt(a*a-Pe*Pe),ut=l-et,ct=Math.sqrt(Pe*Pe+ut*ut)/Pe;if(ct<=m){let ft=ct*u/2-l-a;return 2*Math.max(we,ft)}return we*2}createRenderOptions(){let i=Iu,u=0,m=null,a=0,l,M=0;this.stroke_&&(l=this.stroke_.getColor(),l===null&&(l=fc),l=Ts(l),M=this.stroke_.getWidth(),M===void 0&&(M=gc),m=this.stroke_.getLineDash(),a=this.stroke_.getLineDashOffset(),i=this.stroke_.getLineJoin(),i===void 0&&(i=Iu),u=this.stroke_.getMiterLimit(),u===void 0&&(u=dc));let z=this.calculateLineJoinSize_(i,M,u),D=Math.max(this.radius_,this.radius2_||0),q=Math.ceil(2*D+z);return{strokeStyle:l,strokeWidth:M,size:q,lineDash:m,lineDashOffset:a,lineJoin:i,miterLimit:u}}render(){this.renderOptions_=this.createRenderOptions();let i=this.renderOptions_.size;this.canvas_={},this.size_=[i,i]}draw_(i,u,m){if(u.scale(m,m),u.translate(i.size/2,i.size/2),this.createPath_(u),this.fill_){let a=this.fill_.getColor();a===null&&(a=Is),u.fillStyle=Ts(a),u.fill()}this.stroke_&&(u.strokeStyle=i.strokeStyle,u.lineWidth=i.strokeWidth,i.lineDash&&(u.setLineDash(i.lineDash),u.lineDashOffset=i.lineDashOffset),u.lineJoin=i.lineJoin,u.miterLimit=i.miterLimit,u.stroke())}createHitDetectionCanvas_(i){if(this.fill_){let u=this.fill_.getColor(),m=0;if(typeof u=="string"&&(u=Hh(u)),u===null?m=1:Array.isArray(u)&&(m=u.length===4?u[3]:1),m===0){let a=aa(i.size,i.size);this.hitDetectionCanvas_=a.canvas,this.drawHitDetectionCanvas_(i,a)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))}createPath_(i){let u=this.points_,m=this.radius_;if(u===1/0)i.arc(0,0,m,0,2*Math.PI);else{let a=this.radius2_===void 0?m:this.radius2_;this.radius2_!==void 0&&(u*=2);let l=this.angle_-Math.PI/2,M=2*Math.PI/u;for(let z=0;z<u;z++){let D=l+z*M,q=z%2===0?m:a;i.lineTo(q*Math.cos(D),q*Math.sin(D))}i.closePath()}}drawHitDetectionCanvas_(i,u){u.translate(i.size/2,i.size/2),this.createPath_(u),u.fillStyle=Is,u.fill(),this.stroke_&&(u.strokeStyle=i.strokeStyle,u.lineWidth=i.strokeWidth,i.lineDash&&(u.setLineDash(i.lineDash),u.lineDashOffset=i.lineDashOffset),u.lineJoin=i.lineJoin,u.miterLimit=i.miterLimit,u.stroke())}},wg=Ef;var Tf=class extends wg{constructor(i){i=i||{radius:5},super({points:1/0,fill:i.fill,radius:i.radius,stroke:i.stroke,scale:i.scale!==void 0?i.scale:1,rotation:i.rotation!==void 0?i.rotation:0,rotateWithView:i.rotateWithView!==void 0?i.rotateWithView:!1,displacement:i.displacement!==void 0?i.displacement:[0,0],declutterMode:i.declutterMode})}clone(){let i=this.getScale(),u=new Tf({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(i)?i.slice():i,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return u.setOpacity(this.getOpacity()),u}setRadius(i){this.radius_=i,this.render()}},Cs=Tf;var Cu=class{constructor(i){i=i||{},this.geometry_=null,this.geometryFunction_=d1,i.geometry!==void 0&&this.setGeometry(i.geometry),this.fill_=i.fill!==void 0?i.fill:null,this.image_=i.image!==void 0?i.image:null,this.renderer_=i.renderer!==void 0?i.renderer:null,this.hitDetectionRenderer_=i.hitDetectionRenderer!==void 0?i.hitDetectionRenderer:null,this.stroke_=i.stroke!==void 0?i.stroke:null,this.text_=i.text!==void 0?i.text:null,this.zIndex_=i.zIndex}clone(){let i=this.getGeometry();return i&&typeof i=="object"&&(i=i.clone()),new Cu({geometry:i,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(i){this.renderer_=i}setHitDetectionRenderer(i){this.hitDetectionRenderer_=i}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(i){this.fill_=i}getImage(){return this.image_}setImage(i){this.image_=i}getStroke(){return this.stroke_}setStroke(i){this.stroke_=i}getText(){return this.text_}setText(i){this.text_=i}getZIndex(){return this.zIndex_}setGeometry(i){typeof i=="function"?this.geometryFunction_=i:typeof i=="string"?this.geometryFunction_=function(u){return u.get(i)}:i?i!==void 0&&(this.geometryFunction_=function(){return i}):this.geometryFunction_=d1,this.geometry_=i}setZIndex(i){this.zIndex_=i}};function f1(v){let i;if(typeof v=="function")i=v;else{let u;Array.isArray(v)?u=v:(zr(typeof v.getZIndex=="function",41),u=[v]),i=function(){return u}}return i}var j_=null;function m1(v,i){if(!j_){let u=new ba({color:"rgba(255,255,255,0.4)"}),m=new Wo({color:"#3399CC",width:1.25});j_=[new Cu({image:new Cs({fill:u,stroke:m,radius:5}),fill:u,stroke:m})]}return j_}function g1(){let v={},i=[255,255,255,1],u=[0,153,255,1],m=3;return v.Polygon=[new Cu({fill:new ba({color:[255,255,255,.5]})})],v.MultiPolygon=v.Polygon,v.LineString=[new Cu({stroke:new Wo({color:i,width:m+2})}),new Cu({stroke:new Wo({color:u,width:m})})],v.MultiLineString=v.LineString,v.Circle=v.Polygon.concat(v.LineString),v.Point=[new Cu({image:new Cs({radius:m*2,fill:new ba({color:u}),stroke:new Wo({color:i,width:m/2})}),zIndex:1/0})],v.MultiPoint=v.Point,v.GeometryCollection=v.Polygon.concat(v.LineString,v.Point),v}function d1(v){return v.getGeometry()}var Fa=Cu;var g2="#333",If=class{constructor(i){i=i||{},this.font_=i.font,this.rotation_=i.rotation,this.rotateWithView_=i.rotateWithView,this.scale_=i.scale,this.scaleArray_=ld(i.scale!==void 0?i.scale:1),this.text_=i.text,this.textAlign_=i.textAlign,this.justify_=i.justify,this.repeat_=i.repeat,this.textBaseline_=i.textBaseline,this.fill_=i.fill!==void 0?i.fill:new ba({color:g2}),this.maxAngle_=i.maxAngle!==void 0?i.maxAngle:Math.PI/4,this.placement_=i.placement!==void 0?i.placement:"point",this.overflow_=!!i.overflow,this.stroke_=i.stroke!==void 0?i.stroke:null,this.offsetX_=i.offsetX!==void 0?i.offsetX:0,this.offsetY_=i.offsetY!==void 0?i.offsetY:0,this.backgroundFill_=i.backgroundFill?i.backgroundFill:null,this.backgroundStroke_=i.backgroundStroke?i.backgroundStroke:null,this.padding_=i.padding===void 0?null:i.padding}clone(){let i=this.getScale();return new If({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(i)?i.slice():i,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(i){this.overflow_=i}setFont(i){this.font_=i}setMaxAngle(i){this.maxAngle_=i}setOffsetX(i){this.offsetX_=i}setOffsetY(i){this.offsetY_=i}setPlacement(i){this.placement_=i}setRepeat(i){this.repeat_=i}setRotateWithView(i){this.rotateWithView_=i}setFill(i){this.fill_=i}setRotation(i){this.rotation_=i}setScale(i){this.scale_=i,this.scaleArray_=ld(i!==void 0?i:1)}setStroke(i){this.stroke_=i}setText(i){this.text_=i}setTextAlign(i){this.textAlign_=i}setJustify(i){this.justify_=i}setTextBaseline(i){this.textBaseline_=i}setBackgroundFill(i){this.backgroundFill_=i}setBackgroundStroke(i){this.backgroundStroke_=i}setPadding(i){this.padding_=i}},y1=If;var w1=Vp(Z_(),1);var W_=class{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let i=0;for(let u in this.cache_){let m=this.cache_[u];!(i++&3)&&!m.hasListener()&&(delete this.cache_[u],--this.cacheSize_)}}}get(i,u,m){let a=_1(i,u,m);return a in this.cache_?this.cache_[a]:null}set(i,u,m,a){let l=_1(i,u,m);this.cache_[l]=a,++this.cacheSize_}setSize(i){this.maxCacheSize_=i,this.expire()}};function _1(v,i,u){let m=u?vg(u):"null";return i+":"+v+":"+m}var X_=new W_;function v1(v,i,u){let m=v,a=!0,l=!1,M=!1,z=[jp(m,cn.LOAD,function(){M=!0,l||i()})];return m.src&&Ox?(l=!0,m.decode().then(function(){a&&i()}).catch(function(D){a&&(M?i():u())})):z.push(jp(m,cn.ERROR,u)),function(){a=!1,z.forEach(Po)}}var Cf=null,$_=class extends qm{constructor(i,u,m,a,l,M){super(),this.hitDetectionImage_=null,this.image_=i,this.crossOrigin_=a,this.canvas_={},this.color_=M,this.unlisten_=null,this.imageState_=l,this.size_=m,this.src_=u,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Zn.LOADED){Cf||(Cf=aa(1,1,void 0,{willReadFrequently:!0})),Cf.drawImage(this.image_,0,0);try{Cf.getImageData(0,0,1,1),this.tainted_=!1}catch{Cf=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(cn.CHANGE)}handleImageError_(){this.imageState_=Zn.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Zn.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(i){return this.image_||this.initializeImage_(),this.replaceColor_(i),this.canvas_[i]?this.canvas_[i]:this.image_}getPixelRatio(i){return this.replaceColor_(i),this.canvas_[i]?i:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let i=this.size_[0],u=this.size_[1],m=aa(i,u);m.fillRect(0,0,i,u),this.hitDetectionImage_=m.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Zn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Zn.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=v1(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(i){if(!this.color_||this.canvas_[i]||this.imageState_!==Zn.LOADED)return;let u=this.image_,m=document.createElement("canvas");m.width=Math.ceil(u.width*i),m.height=Math.ceil(u.height*i);let a=m.getContext("2d");a.scale(i,i),a.drawImage(u,0,0),a.globalCompositeOperation="multiply",a.fillStyle=vg(this.color_),a.fillRect(0,0,m.width/i,m.height/i),a.globalCompositeOperation="destination-in",a.drawImage(u,0,0),this.canvas_[i]=m}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}};function x1(v,i,u,m,a,l){let M=X_.get(i,m,l);return M||(M=new $_(v,i,u,m,a,l),X_.set(i,m,l,M)),M}var Af=class extends _g{constructor(i){i=i||{};let u=i.opacity!==void 0?i.opacity:1,m=i.rotation!==void 0?i.rotation:0,a=i.scale!==void 0?i.scale:1,l=i.rotateWithView!==void 0?i.rotateWithView:!1;super({opacity:u,rotation:m,scale:a,displacement:i.displacement!==void 0?i.displacement:[0,0],rotateWithView:l,declutterMode:i.declutterMode}),this.anchor_=i.anchor!==void 0?i.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=i.anchorOrigin!==void 0?i.anchorOrigin:"top-left",this.anchorXUnits_=i.anchorXUnits!==void 0?i.anchorXUnits:"fraction",this.anchorYUnits_=i.anchorYUnits!==void 0?i.anchorYUnits:"fraction",this.crossOrigin_=i.crossOrigin!==void 0?i.crossOrigin:null;let M=i.img!==void 0?i.img:null;this.imgSize_=i.imgSize;let z=i.src;zr(!(z!==void 0&&M),4),zr(!M||M&&this.imgSize_,5),(z===void 0||z.length===0)&&M&&(z=M.src||Tr(M)),zr(z!==void 0&&z.length>0,6),zr(!((i.width!==void 0||i.height!==void 0)&&i.scale!==void 0),69);let D=i.src!==void 0?Zn.IDLE:Zn.LOADED;if(this.color_=i.color!==void 0?Hh(i.color):null,this.iconImage_=x1(M,z,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,D,this.color_),this.offset_=i.offset!==void 0?i.offset:[0,0],this.offsetOrigin_=i.offsetOrigin!==void 0?i.offsetOrigin:"top-left",this.origin_=null,this.size_=i.size!==void 0?i.size:null,this.width_=i.width,this.height_=i.height,this.width_!==void 0||this.height_!==void 0){let q=this.getImage(1),V=()=>{this.updateScaleFromWidthAndHeight(this.width_,this.height_)};q.width>0?this.updateScaleFromWidthAndHeight(this.width_,this.height_):q.addEventListener("load",V)}}clone(){let i=this.getScale();return i=Array.isArray(i)?i.slice():i,(this.width_!==void 0||this.height_!==void 0)&&(i=void 0),new Af({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode(),width:this.width_,height:this.height_})}updateScaleFromWidthAndHeight(i,u){let m=this.getImage(1);i!==void 0&&u!==void 0?super.setScale([i/m.width,u/m.height]):i!==void 0?super.setScale([i/m.width,i/m.width]):u!==void 0?super.setScale([u/m.height,u/m.height]):super.setScale([1,1])}getAnchor(){let i=this.normalizedAnchor_;if(!i){i=this.anchor_;let a=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!a)return null;i=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(i[0]*=a[0]),this.anchorYUnits_=="fraction"&&(i[1]*=a[1])}if(this.anchorOrigin_!="top-left"){if(!a)return null;i===this.anchor_&&(i=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(i[0]=-i[0]+a[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(i[1]=-i[1]+a[1])}this.normalizedAnchor_=i}let u=this.getDisplacement(),m=this.getScaleArray();return[i[0]-u[0]/m[0],i[1]+u[1]/m[1]]}setAnchor(i){this.anchor_=i,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(i){return this.iconImage_.getImage(i)}getPixelRatio(i){return this.iconImage_.getPixelRatio(i)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let i=this.offset_;if(this.offsetOrigin_!="top-left"){let u=this.getSize(),m=this.iconImage_.getSize();if(!u||!m)return null;i=i.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(i[0]=m[0]-u[0]-i[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(i[1]=m[1]-u[1]-i[1])}return this.origin_=i,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){return this.width_}getHeight(){return this.height_}setWidth(i){this.width_=i,this.updateScaleFromWidthAndHeight(i,this.height_)}setHeight(i){this.height_=i,this.updateScaleFromWidthAndHeight(this.width_,i)}setScale(i){super.setScale(i);let u=this.getImage(1);if(u){let m=Array.isArray(i)?i[0]:i;m!==void 0&&(this.width_=m*u.width);let a=Array.isArray(i)?i[1]:i;a!==void 0&&(this.height_=a*u.height)}}listenImageChange(i){this.iconImage_.addEventListener(cn.CHANGE,i)}load(){this.iconImage_.load()}unlistenImageChange(i){this.iconImage_.removeEventListener(cn.CHANGE,i)}},Mf=Af;function K_(v){return new Fa({fill:Pf(v,""),stroke:kf(v,""),text:y2(v),image:_2(v)})}function Pf(v,i){let u=v[i+"fill-color"];if(u)return new ba({color:u})}function kf(v,i){let u=v[i+"stroke-width"],m=v[i+"stroke-color"];if(!(!u&&!m))return new Wo({width:u,color:m,lineCap:v[i+"stroke-line-cap"],lineJoin:v[i+"stroke-line-join"],lineDash:v[i+"stroke-line-dash"],lineDashOffset:v[i+"stroke-line-dash-offset"],miterLimit:v[i+"stroke-miter-limit"]})}function y2(v){let i=v["text-value"];return i?new y1({text:i,font:v["text-font"],maxAngle:v["text-max-angle"],offsetX:v["text-offset-x"],offsetY:v["text-offset-y"],overflow:v["text-overflow"],placement:v["text-placement"],repeat:v["text-repeat"],scale:v["text-scale"],rotateWithView:v["text-rotate-with-view"],rotation:v["text-rotation"],textAlign:v["text-align"],justify:v["text-justify"],textBaseline:v["text-baseline"],padding:v["text-padding"],fill:Pf(v,"text-"),backgroundFill:Pf(v,"text-background-"),stroke:kf(v,"text-"),backgroundStroke:kf(v,"text-background-")}):void 0}function _2(v){let i=v["icon-src"],u=v["icon-img"];if(i||u)return new Mf({src:i,img:u,imgSize:v["icon-img-size"],anchor:v["icon-anchor"],anchorOrigin:v["icon-anchor-origin"],anchorXUnits:v["icon-anchor-x-units"],anchorYUnits:v["icon-anchor-y-units"],color:v["icon-color"],crossOrigin:v["icon-cross-origin"],offset:v["icon-offset"],displacement:v["icon-displacement"],opacity:v["icon-opacity"],scale:v["icon-scale"],rotation:v["icon-rotation"],rotateWithView:v["icon-rotate-with-view"],size:v["icon-size"],declutterMode:v["icon-declutter-mode"]});let m=v["shape-points"];if(m){let l="shape-";return new wg({points:m,fill:Pf(v,l),stroke:kf(v,l),radius:v["shape-radius"],radius1:v["shape-radius1"],radius2:v["shape-radius2"],angle:v["shape-angle"],displacement:v["shape-displacement"],rotation:v["shape-rotation"],rotateWithView:v["shape-rotate-with-view"],scale:v["shape-scale"],declutterMode:v["shape-declutter-mode"]})}let a=v["circle-radius"];if(a){let l="circle-";return new Cs({radius:a,fill:Pf(v,l),stroke:kf(v,l),displacement:v["circle-displacement"],scale:v["circle-scale"],rotation:v["circle-rotation"],rotateWithView:v["circle-rotate-with-view"],declutterMode:v["circle-declutter-mode"]})}}var b1={RENDER_ORDER:"renderOrder"},H_=class extends Kh{constructor(i){i=i||{};let u=Object.assign({},i);delete u.style,delete u.renderBuffer,delete u.updateWhileAnimating,delete u.updateWhileInteracting,super(u),this.declutter_=i.declutter!==void 0?i.declutter:!1,this.renderBuffer_=i.renderBuffer!==void 0?i.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(i.style),this.updateWhileAnimating_=i.updateWhileAnimating!==void 0?i.updateWhileAnimating:!1,this.updateWhileInteracting_=i.updateWhileInteracting!==void 0?i.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(i){return super.getFeatures(i)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(b1.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(i){i.declutterTree||(i.declutterTree=new w1.default(9)),this.getRenderer().renderDeclutter(i)}setRenderOrder(i){this.set(b1.RENDER_ORDER,i)}setStyle(i){let u;if(i===void 0)u=m1;else if(i===null)u=null;else if(typeof i=="function")u=i;else if(i instanceof Fa)u=i;else if(Array.isArray(i)){let m=i.length,a=new Array(m);for(let l=0;l<m;++l){let M=i[l];M instanceof Fa?a[l]=M:a[l]=K_(M)}u=a}else u=K_(i);this.style_=u,this.styleFunction_=i===null?void 0:f1(this.style_),this.changed()}},S1=H_;var Rf={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Lf=[Rf.FILL],Au=[Rf.STROKE],yc=[Rf.BEGIN_PATH],Y_=[Rf.CLOSE_PATH],ji=Rf;var J_=class{drawCustom(i,u,m,a){}drawGeometry(i){}setStyle(i){}drawCircle(i,u){}drawFeature(i,u){}drawGeometryCollection(i,u){}drawLineString(i,u){}drawMultiLineString(i,u){}drawMultiPoint(i,u){}drawMultiPolygon(i,u){}drawPoint(i,u){}drawPolygon(i,u){}drawText(i,u){}setFillStrokeStyle(i,u){}setImageStyle(i,u){}setTextStyle(i,u){}},Sg=J_;var Q_=class extends Sg{constructor(i,u,m,a){super(),this.tolerance=i,this.maxExtent=u,this.pixelRatio=a,this.maxLineWidth=0,this.resolution=m,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(i){let u=this.pixelRatio;return u==1?i:i.map(function(m){return m*u})}appendFlatPointCoordinates(i,u){let m=this.getBufferedMaxExtent(),a=this.tmpCoordinate_,l=this.coordinates,M=l.length;for(let z=0,D=i.length;z<D;z+=u)a[0]=i[z],a[1]=i[z+1],Ym(m,a)&&(l[M++]=a[0],l[M++]=a[1]);return M}appendFlatLineCoordinates(i,u,m,a,l,M){let z=this.coordinates,D=z.length,q=this.getBufferedMaxExtent();M&&(u+=a);let V=i[u],de=i[u+1],pe=this.tmpCoordinate_,Ie=!0,Ne,nt,we;for(Ne=u+a;Ne<m;Ne+=a)pe[0]=i[Ne],pe[1]=i[Ne+1],we=Hm(q,pe),we!==nt?(Ie&&(z[D++]=V,z[D++]=de,Ie=!1),z[D++]=pe[0],z[D++]=pe[1]):we===ko.INTERSECTING?(z[D++]=pe[0],z[D++]=pe[1],Ie=!1):Ie=!0,V=pe[0],de=pe[1],nt=we;return(l&&Ie||Ne===u+a)&&(z[D++]=V,z[D++]=de),D}drawCustomCoordinates_(i,u,m,a,l){for(let M=0,z=m.length;M<z;++M){let D=m[M],q=this.appendFlatLineCoordinates(i,u,D,a,!1,!1);l.push(q),u=D}return u}drawCustom(i,u,m,a){this.beginGeometry(i,u);let l=i.getType(),M=i.getStride(),z=this.coordinates.length,D,q,V,de,pe;switch(l){case"MultiPolygon":D=i.getOrientedFlatCoordinates(),de=[];let Ie=i.getEndss();pe=0;for(let Ne=0,nt=Ie.length;Ne<nt;++Ne){let we=[];pe=this.drawCustomCoordinates_(D,pe,Ie[Ne],M,we),de.push(we)}this.instructions.push([ji.CUSTOM,z,de,i,m,cf]),this.hitDetectionInstructions.push([ji.CUSTOM,z,de,i,a||m,cf]);break;case"Polygon":case"MultiLineString":V=[],D=l=="Polygon"?i.getOrientedFlatCoordinates():i.getFlatCoordinates(),pe=this.drawCustomCoordinates_(D,0,i.getEnds(),M,V),this.instructions.push([ji.CUSTOM,z,V,i,m,ch]),this.hitDetectionInstructions.push([ji.CUSTOM,z,V,i,a||m,ch]);break;case"LineString":case"Circle":D=i.getFlatCoordinates(),q=this.appendFlatLineCoordinates(D,0,D.length,M,!1,!1),this.instructions.push([ji.CUSTOM,z,q,i,m,bl]),this.hitDetectionInstructions.push([ji.CUSTOM,z,q,i,a||m,bl]);break;case"MultiPoint":D=i.getFlatCoordinates(),q=this.appendFlatPointCoordinates(D,M),q>z&&(this.instructions.push([ji.CUSTOM,z,q,i,m,bl]),this.hitDetectionInstructions.push([ji.CUSTOM,z,q,i,a||m,bl]));break;case"Point":D=i.getFlatCoordinates(),this.coordinates.push(D[0],D[1]),q=this.coordinates.length,this.instructions.push([ji.CUSTOM,z,q,i,m]),this.hitDetectionInstructions.push([ji.CUSTOM,z,q,i,a||m]);break;default:}this.endGeometry(u)}beginGeometry(i,u){this.beginGeometryInstruction1_=[ji.BEGIN_GEOMETRY,u,0,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[ji.BEGIN_GEOMETRY,u,0,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let i=this.hitDetectionInstructions;i.reverse();let u,m=i.length,a,l,M=-1;for(u=0;u<m;++u)a=i[u],l=a[0],l==ji.END_GEOMETRY?M=u:l==ji.BEGIN_GEOMETRY&&(a[2]=u,Px(this.hitDetectionInstructions,M,u),M=-1)}setFillStrokeStyle(i,u){let m=this.state;if(i){let a=i.getColor();m.fillStyle=Ts(a||Is)}else m.fillStyle=void 0;if(u){let a=u.getColor();m.strokeStyle=Ts(a||fc);let l=u.getLineCap();m.lineCap=l!==void 0?l:Yh;let M=u.getLineDash();m.lineDash=M?M.slice():hc;let z=u.getLineDashOffset();m.lineDashOffset=z||pc;let D=u.getLineJoin();m.lineJoin=D!==void 0?D:Iu;let q=u.getWidth();m.lineWidth=q!==void 0?q:gc;let V=u.getMiterLimit();m.miterLimit=V!==void 0?V:dc,m.lineWidth>this.maxLineWidth&&(this.maxLineWidth=m.lineWidth,this.bufferedMaxExtent_=null)}else m.strokeStyle=void 0,m.lineCap=void 0,m.lineDash=null,m.lineDashOffset=void 0,m.lineJoin=void 0,m.lineWidth=void 0,m.miterLimit=void 0}createFill(i){let u=i.fillStyle,m=[ji.SET_FILL_STYLE,u];return typeof u!="string"&&m.push(!0),m}applyStroke(i){this.instructions.push(this.createStroke(i))}createStroke(i){return[ji.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth*this.pixelRatio,i.lineCap,i.lineJoin,i.miterLimit,this.applyPixelRatio(i.lineDash),i.lineDashOffset*this.pixelRatio]}updateFillStyle(i,u){let m=i.fillStyle;(typeof m!="string"||i.currentFillStyle!=m)&&(m!==void 0&&this.instructions.push(u.call(this,i)),i.currentFillStyle=m)}updateStrokeStyle(i,u){let m=i.strokeStyle,a=i.lineCap,l=i.lineDash,M=i.lineDashOffset,z=i.lineJoin,D=i.lineWidth,q=i.miterLimit;(i.currentStrokeStyle!=m||i.currentLineCap!=a||l!=i.currentLineDash&&!xs(i.currentLineDash,l)||i.currentLineDashOffset!=M||i.currentLineJoin!=z||i.currentLineWidth!=D||i.currentMiterLimit!=q)&&(m!==void 0&&u.call(this,i),i.currentStrokeStyle=m,i.currentLineCap=a,i.currentLineDash=l,i.currentLineDashOffset=M,i.currentLineJoin=z,i.currentLineWidth=D,i.currentMiterLimit=q)}endGeometry(i){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let u=[ji.END_GEOMETRY,i];this.instructions.push(u),this.hitDetectionInstructions.push(u)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Gx(this.maxExtent),this.maxLineWidth>0)){let i=this.resolution*(this.maxLineWidth+1)/2;_l(this.bufferedMaxExtent_,i,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Mu=Q_;var ev=class extends Mu{constructor(i,u,m,a){super(i,u,m,a),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(i,u){if(!this.image_)return;this.beginGeometry(i,u);let m=i.getFlatCoordinates(),a=i.getStride(),l=this.coordinates.length,M=this.appendFlatPointCoordinates(m,a);this.instructions.push([ji.DRAW_IMAGE,l,M,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([ji.DRAW_IMAGE,l,M,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(u)}drawMultiPoint(i,u){if(!this.image_)return;this.beginGeometry(i,u);let m=i.getFlatCoordinates(),a=i.getStride(),l=this.coordinates.length,M=this.appendFlatPointCoordinates(m,a);this.instructions.push([ji.DRAW_IMAGE,l,M,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([ji.DRAW_IMAGE,l,M,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(u)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(i,u){let m=i.getAnchor(),a=i.getSize(),l=i.getOrigin();this.imagePixelRatio_=i.getPixelRatio(this.pixelRatio),this.anchorX_=m[0],this.anchorY_=m[1],this.hitDetectionImage_=i.getHitDetectionImage(),this.image_=i.getImage(this.pixelRatio),this.height_=a[1],this.opacity_=i.getOpacity(),this.originX_=l[0],this.originY_=l[1],this.rotateWithView_=i.getRotateWithView(),this.rotation_=i.getRotation(),this.scale_=i.getScaleArray(),this.width_=a[0],this.declutterMode_=i.getDeclutterMode(),this.declutterImageWithText_=u}},E1=ev;var tv=class extends Mu{constructor(i,u,m,a){super(i,u,m,a)}drawFlatCoordinates_(i,u,m,a){let l=this.coordinates.length,M=this.appendFlatLineCoordinates(i,u,m,a,!1,!1),z=[ji.MOVE_TO_LINE_TO,l,M];return this.instructions.push(z),this.hitDetectionInstructions.push(z),m}drawLineString(i,u){let m=this.state,a=m.strokeStyle,l=m.lineWidth;if(a===void 0||l===void 0)return;this.updateStrokeStyle(m,this.applyStroke),this.beginGeometry(i,u),this.hitDetectionInstructions.push([ji.SET_STROKE_STYLE,m.strokeStyle,m.lineWidth,m.lineCap,m.lineJoin,m.miterLimit,hc,pc],yc);let M=i.getFlatCoordinates(),z=i.getStride();this.drawFlatCoordinates_(M,0,M.length,z),this.hitDetectionInstructions.push(Au),this.endGeometry(u)}drawMultiLineString(i,u){let m=this.state,a=m.strokeStyle,l=m.lineWidth;if(a===void 0||l===void 0)return;this.updateStrokeStyle(m,this.applyStroke),this.beginGeometry(i,u),this.hitDetectionInstructions.push([ji.SET_STROKE_STYLE,m.strokeStyle,m.lineWidth,m.lineCap,m.lineJoin,m.miterLimit,m.lineDash,m.lineDashOffset],yc);let M=i.getEnds(),z=i.getFlatCoordinates(),D=i.getStride(),q=0;for(let V=0,de=M.length;V<de;++V)q=this.drawFlatCoordinates_(z,q,M[V],D);this.hitDetectionInstructions.push(Au),this.endGeometry(u)}finish(){let i=this.state;return i.lastStroke!=null&&i.lastStroke!=this.coordinates.length&&this.instructions.push(Au),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(i){i.lastStroke!=null&&i.lastStroke!=this.coordinates.length&&(this.instructions.push(Au),i.lastStroke=this.coordinates.length),i.lastStroke=0,super.applyStroke(i),this.instructions.push(yc)}},T1=tv;var iv=class extends Mu{constructor(i,u,m,a){super(i,u,m,a)}drawFlatCoordinatess_(i,u,m,a){let l=this.state,M=l.fillStyle!==void 0,z=l.strokeStyle!==void 0,D=m.length;this.instructions.push(yc),this.hitDetectionInstructions.push(yc);for(let q=0;q<D;++q){let V=m[q],de=this.coordinates.length,pe=this.appendFlatLineCoordinates(i,u,V,a,!0,!z),Ie=[ji.MOVE_TO_LINE_TO,de,pe];this.instructions.push(Ie),this.hitDetectionInstructions.push(Ie),z&&(this.instructions.push(Y_),this.hitDetectionInstructions.push(Y_)),u=V}return M&&(this.instructions.push(Lf),this.hitDetectionInstructions.push(Lf)),z&&(this.instructions.push(Au),this.hitDetectionInstructions.push(Au)),u}drawCircle(i,u){let m=this.state,a=m.fillStyle,l=m.strokeStyle;if(a===void 0&&l===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(i,u),m.fillStyle!==void 0&&this.hitDetectionInstructions.push([ji.SET_FILL_STYLE,Is]),m.strokeStyle!==void 0&&this.hitDetectionInstructions.push([ji.SET_STROKE_STYLE,m.strokeStyle,m.lineWidth,m.lineCap,m.lineJoin,m.miterLimit,m.lineDash,m.lineDashOffset]);let M=i.getFlatCoordinates(),z=i.getStride(),D=this.coordinates.length;this.appendFlatLineCoordinates(M,0,M.length,z,!1,!1);let q=[ji.CIRCLE,D];this.instructions.push(yc,q),this.hitDetectionInstructions.push(yc,q),m.fillStyle!==void 0&&(this.instructions.push(Lf),this.hitDetectionInstructions.push(Lf)),m.strokeStyle!==void 0&&(this.instructions.push(Au),this.hitDetectionInstructions.push(Au)),this.endGeometry(u)}drawPolygon(i,u){let m=this.state,a=m.fillStyle,l=m.strokeStyle;if(a===void 0&&l===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(i,u),m.fillStyle!==void 0&&this.hitDetectionInstructions.push([ji.SET_FILL_STYLE,Is]),m.strokeStyle!==void 0&&this.hitDetectionInstructions.push([ji.SET_STROKE_STYLE,m.strokeStyle,m.lineWidth,m.lineCap,m.lineJoin,m.miterLimit,m.lineDash,m.lineDashOffset]);let M=i.getEnds(),z=i.getOrientedFlatCoordinates(),D=i.getStride();this.drawFlatCoordinatess_(z,0,M,D),this.endGeometry(u)}drawMultiPolygon(i,u){let m=this.state,a=m.fillStyle,l=m.strokeStyle;if(a===void 0&&l===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(i,u),m.fillStyle!==void 0&&this.hitDetectionInstructions.push([ji.SET_FILL_STYLE,Is]),m.strokeStyle!==void 0&&this.hitDetectionInstructions.push([ji.SET_STROKE_STYLE,m.strokeStyle,m.lineWidth,m.lineCap,m.lineJoin,m.miterLimit,m.lineDash,m.lineDashOffset]);let M=i.getEndss(),z=i.getOrientedFlatCoordinates(),D=i.getStride(),q=0;for(let V=0,de=M.length;V<de;++V)q=this.drawFlatCoordinatess_(z,q,M[V],D);this.endGeometry(u)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let i=this.tolerance;if(i!==0){let u=this.coordinates;for(let m=0,a=u.length;m<a;++m)u[m]=uh(u[m],i)}return super.finish()}setFillStrokeStyles_(){let i=this.state;i.fillStyle!==void 0&&this.updateFillStyle(i,this.createFill),i.strokeStyle!==void 0&&this.updateStrokeStyle(i,this.applyStroke)}},rv=iv;function I1(v,i,u,m,a){let l=[],M=u,z=0,D=i.slice(u,2);for(;z<v&&M+a<m;){let[q,V]=D.slice(-2),de=i[M+a],pe=i[M+a+1],Ie=Math.sqrt((de-q)*(de-q)+(pe-V)*(pe-V));if(z+=Ie,z>=v){let Ne=(v-z+Ie)/Ie,nt=va(q,de,Ne),we=va(V,pe,Ne);D.push(nt,we),l.push(D),D=[nt,we],z==v&&(M+=a),z=0}else if(z<v)D.push(i[M+a],i[M+a+1]),M+=a;else{let Ne=Ie-z,nt=va(q,de,Ne/Ie),we=va(V,pe,Ne/Ie);D.push(nt,we),l.push(D),D=[nt,we],z=0,M+=a}}return z>0&&l.push(D),l}function C1(v,i,u,m,a){let l=u,M=u,z=0,D=0,q=u,V,de,pe,Ie,Ne,nt,we,Pe,et,ut;for(de=u;de<m;de+=a){let mt=i[de],ct=i[de+1];Ne!==void 0&&(et=mt-Ne,ut=ct-nt,Ie=Math.sqrt(et*et+ut*ut),we!==void 0&&(D+=pe,V=Math.acos((we*et+Pe*ut)/(pe*Ie)),V>v&&(D>z&&(z=D,l=q,M=de),D=0,q=de-a)),pe=Ie,we=et,Pe=ut),Ne=mt,nt=ct}return D+=Ie,D>z?[q,de]:[l,M]}var cd={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},nv=class extends Mu{constructor(i,u,m,a){super(i,u,m,a),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){let i=super.finish();return i.textStates=this.textStates,i.fillStates=this.fillStates,i.strokeStates=this.strokeStates,i}drawText(i,u){let m=this.textFillState_,a=this.textStrokeState_,l=this.textState_;if(this.text_===""||!l||!m&&!a)return;let M=this.coordinates,z=M.length,D=i.getType(),q=null,V=i.getStride();if(l.placement==="line"&&(D=="LineString"||D=="MultiLineString"||D=="Polygon"||D=="MultiPolygon")){if(!uo(this.getBufferedMaxExtent(),i.getExtent()))return;let de;if(q=i.getFlatCoordinates(),D=="LineString")de=[q.length];else if(D=="MultiLineString")de=i.getEnds();else if(D=="Polygon")de=i.getEnds().slice(0,1);else if(D=="MultiPolygon"){let nt=i.getEndss();de=[];for(let we=0,Pe=nt.length;we<Pe;++we)de.push(nt[we][0])}this.beginGeometry(i,u);let pe=l.repeat,Ie=pe?void 0:l.textAlign,Ne=0;for(let nt=0,we=de.length;nt<we;++nt){let Pe;pe?Pe=I1(pe*this.resolution,q,Ne,de[nt],V):Pe=[q.slice(Ne,de[nt])];for(let et=0,ut=Pe.length;et<ut;++et){let mt=Pe[et],ct=0,ft=mt.length;if(Ie==null){let Mt=C1(l.maxAngle,mt,0,mt.length,2);ct=Mt[0],ft=Mt[1]}for(let Mt=ct;Mt<ft;Mt+=V)M.push(mt[Mt],mt[Mt+1]);let It=M.length;Ne=de[nt],this.drawChars_(z,It),z=It}}this.endGeometry(u)}else{let de=l.overflow?null:[];switch(D){case"Point":case"MultiPoint":q=i.getFlatCoordinates();break;case"LineString":q=i.getFlatMidpoint();break;case"Circle":q=i.getCenter();break;case"MultiLineString":q=i.getFlatMidpoints(),V=2;break;case"Polygon":q=i.getFlatInteriorPoint(),l.overflow||de.push(q[2]/this.resolution),V=3;break;case"MultiPolygon":let we=i.getFlatInteriorPoints();q=[];for(let Pe=0,et=we.length;Pe<et;Pe+=3)l.overflow||de.push(we[Pe+2]/this.resolution),q.push(we[Pe],we[Pe+1]);if(q.length===0)return;V=2;break;default:}let pe=this.appendFlatPointCoordinates(q,V);if(pe===z)return;if(de&&(pe-z)/2!==q.length/V){let we=z/2;de=de.filter((Pe,et)=>{let ut=M[(we+et)*2]===q[et*V]&&M[(we+et)*2+1]===q[et*V+1];return ut||--we,ut})}this.saveTextStates_(),(l.backgroundFill||l.backgroundStroke)&&(this.setFillStrokeStyle(l.backgroundFill,l.backgroundStroke),l.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),l.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(i,u);let Ie=l.padding;if(Ie!=mc&&(l.scale[0]<0||l.scale[1]<0)){let we=l.padding[0],Pe=l.padding[1],et=l.padding[2],ut=l.padding[3];l.scale[0]<0&&(Pe=-Pe,ut=-ut),l.scale[1]<0&&(we=-we,et=-et),Ie=[we,Pe,et,ut]}let Ne=this.pixelRatio;this.instructions.push([ji.DRAW_IMAGE,z,pe,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,Ie==mc?mc:Ie.map(function(we){return we*Ne}),!!l.backgroundFill,!!l.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,de]);let nt=1/Ne;this.hitDetectionInstructions.push([ji.DRAW_IMAGE,z,pe,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[nt,nt],NaN,void 0,this.declutterImageWithText_,Ie,!!l.backgroundFill,!!l.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,de]),this.endGeometry(u)}}saveTextStates_(){let i=this.textStrokeState_,u=this.textState_,m=this.textFillState_,a=this.strokeKey_;i&&(a in this.strokeStates||(this.strokeStates[a]={strokeStyle:i.strokeStyle,lineCap:i.lineCap,lineDashOffset:i.lineDashOffset,lineWidth:i.lineWidth,lineJoin:i.lineJoin,miterLimit:i.miterLimit,lineDash:i.lineDash}));let l=this.textKey_;l in this.textStates||(this.textStates[l]={font:u.font,textAlign:u.textAlign||mh,justify:u.justify,textBaseline:u.textBaseline||Jh,scale:u.scale});let M=this.fillKey_;m&&(M in this.fillStates||(this.fillStates[M]={fillStyle:m.fillStyle}))}drawChars_(i,u){let m=this.textStrokeState_,a=this.textState_,l=this.strokeKey_,M=this.textKey_,z=this.fillKey_;this.saveTextStates_();let D=this.pixelRatio,q=cd[a.textBaseline],V=this.textOffsetY_*D,de=this.text_,pe=m?m.lineWidth*Math.abs(a.scale[0])/2:0;this.instructions.push([ji.DRAW_CHARS,i,u,q,a.overflow,z,a.maxAngle,D,V,l,pe*D,de,M,1]),this.hitDetectionInstructions.push([ji.DRAW_CHARS,i,u,q,a.overflow,z,a.maxAngle,1,V,l,pe,de,M,1/D])}setTextStyle(i,u){let m,a,l;if(!i)this.text_="";else{let M=i.getFill();M?(a=this.textFillState_,a||(a={},this.textFillState_=a),a.fillStyle=Ts(M.getColor()||Is)):(a=null,this.textFillState_=a);let z=i.getStroke();if(!z)l=null,this.textStrokeState_=l;else{l=this.textStrokeState_,l||(l={},this.textStrokeState_=l);let Ne=z.getLineDash(),nt=z.getLineDashOffset(),we=z.getWidth(),Pe=z.getMiterLimit();l.lineCap=z.getLineCap()||Yh,l.lineDash=Ne?Ne.slice():hc,l.lineDashOffset=nt===void 0?pc:nt,l.lineJoin=z.getLineJoin()||Iu,l.lineWidth=we===void 0?gc:we,l.miterLimit=Pe===void 0?dc:Pe,l.strokeStyle=Ts(z.getColor()||fc)}m=this.textState_;let D=i.getFont()||bg;u1(D);let q=i.getScaleArray();m.overflow=i.getOverflow(),m.font=D,m.maxAngle=i.getMaxAngle(),m.placement=i.getPlacement(),m.textAlign=i.getTextAlign(),m.repeat=i.getRepeat(),m.justify=i.getJustify(),m.textBaseline=i.getTextBaseline()||Jh,m.backgroundFill=i.getBackgroundFill(),m.backgroundStroke=i.getBackgroundStroke(),m.padding=i.getPadding()||mc,m.scale=q===void 0?[1,1]:q;let V=i.getOffsetX(),de=i.getOffsetY(),pe=i.getRotateWithView(),Ie=i.getRotation();this.text_=i.getText()||"",this.textOffsetX_=V===void 0?0:V,this.textOffsetY_=de===void 0?0:de,this.textRotateWithView_=pe===void 0?!1:pe,this.textRotation_=Ie===void 0?0:Ie,this.strokeKey_=l?(typeof l.strokeStyle=="string"?l.strokeStyle:Tr(l.strokeStyle))+l.lineCap+l.lineDashOffset+"|"+l.lineWidth+l.lineJoin+l.miterLimit+"["+l.lineDash.join()+"]":"",this.textKey_=m.font+m.scale+(m.textAlign||"?")+(m.repeat||"?")+(m.justify||"?")+(m.textBaseline||"?"),this.fillKey_=a?typeof a.fillStyle=="string"?a.fillStyle:"|"+Tr(a.fillStyle):""}this.declutterImageWithText_=u}},A1=nv;var v2={Circle:rv,Default:Mu,Image:E1,LineString:T1,Polygon:rv,Text:A1},ov=class{constructor(i,u,m,a){this.tolerance_=i,this.maxExtent_=u,this.pixelRatio_=a,this.resolution_=m,this.buildersByZIndex_={}}finish(){let i={};for(let u in this.buildersByZIndex_){i[u]=i[u]||{};let m=this.buildersByZIndex_[u];for(let a in m){let l=m[a].finish();i[u][a]=l}}return i}getBuilder(i,u){let m=i!==void 0?i.toString():"0",a=this.buildersByZIndex_[m];a===void 0&&(a={},this.buildersByZIndex_[m]=a);let l=a[u];if(l===void 0){let M=v2[u];l=new M(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),a[u]=l}return l}},av=ov;var sv=class extends Zm{constructor(i){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=i,this.declutterExecutorGroup=null}getFeatures(i){return Xi()}getData(i){return null}prepareFrame(i){return Xi()}renderFrame(i,u){return Xi()}loadedTileCallback(i,u,m){i[u]||(i[u]={}),i[u][m.tileCoord.toString()]=m}createLoadedTileFinder(i,u,m){return(a,l)=>{let M=this.loadedTileCallback.bind(this,m,a);return i.forEachLoadedTile(u,a,l,M)}}forEachFeatureAtCoordinate(i,u,m,a,l){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(i){i.target.getState()===Zn.LOADED&&this.renderIfReadyAndVisible()}loadImage(i){let u=i.getState();return u!=Zn.LOADED&&u!=Zn.ERROR&&i.addEventListener(cn.CHANGE,this.boundHandleImageChange_),u==Zn.IDLE&&(i.load(),u=i.getState()),u==Zn.LOADED}renderIfReadyAndVisible(){let i=this.getLayer();i&&i.getVisible()&&i.getSourceState()==="ready"&&i.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}},M1=sv;var lv=class extends nn{constructor(i,u,m,a){super(i),this.inversePixelTransform=u,this.frameState=m,this.context=a}},P1=lv;var cv=[],hd=null;function x2(){hd=aa(1,1,void 0,{willReadFrequently:!0})}var uv=class extends M1{constructor(i){super(i),this.container=null,this.renderedResolution,this.tempTransform=Da(),this.pixelTransform=Da(),this.inversePixelTransform=Da(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(i,u,m){hd||x2(),hd.clearRect(0,0,1,1);let a;try{hd.drawImage(i,u,m,1,1,0,0,1,1),a=hd.getImageData(0,0,1,1).data}catch{return hd=null,null}return a}getBackground(i){let m=this.getLayer().getBackground();return typeof m=="function"&&(m=m(i.viewState.resolution)),m||void 0}useContainer(i,u,m){let a=this.getLayer().getClassName(),l,M;if(i&&i.className===a&&(!m||i&&i.style.backgroundColor&&xs(Hh(i.style.backgroundColor),Hh(m)))){let z=i.firstElementChild;z instanceof HTMLCanvasElement&&(M=z.getContext("2d"))}if(M&&M.canvas.style.transform===u?(this.container=i,this.context=M,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){l=document.createElement("div"),l.className=a;let z=l.style;z.position="absolute",z.width="100%",z.height="100%",M=aa();let D=M.canvas;l.appendChild(D),z=D.style,z.position="absolute",z.left="0",z.transformOrigin="top left",this.container=l,this.context=M}!this.containerReused&&m&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=m)}clipUnrotated(i,u,m){let a=Uy(m),l=Vy(m),M=By(m),z=Oy(m);qo(u.coordinateToPixelTransform,a),qo(u.coordinateToPixelTransform,l),qo(u.coordinateToPixelTransform,M),qo(u.coordinateToPixelTransform,z);let D=this.inversePixelTransform;qo(D,a),qo(D,l),qo(D,M),qo(D,z),i.save(),i.beginPath(),i.moveTo(Math.round(a[0]),Math.round(a[1])),i.lineTo(Math.round(l[0]),Math.round(l[1])),i.lineTo(Math.round(M[0]),Math.round(M[1])),i.lineTo(Math.round(z[0]),Math.round(z[1])),i.clip()}dispatchRenderEvent_(i,u,m){let a=this.getLayer();if(a.hasListener(i)){let l=new P1(i,this.inversePixelTransform,m,u);a.dispatchEvent(l)}}preRender(i,u){this.frameState=u,this.dispatchRenderEvent_(vf.PRERENDER,i,u)}postRender(i,u){this.dispatchRenderEvent_(vf.POSTRENDER,i,u)}getRenderTransform(i,u,m,a,l,M,z){let D=l/2,q=M/2,V=a/u,de=-V,pe=-i[0]+z,Ie=-i[1];return Ys(this.tempTransform,D,q,V,de,-m,pe,Ie)}disposeInternal(){delete this.frameState,super.disposeInternal()}},k1=uv;function R1(v,i,u,m,a,l,M,z,D,q,V,de){let pe=v[i],Ie=v[i+1],Ne=0,nt=0,we=0,Pe=0;function et(){Ne=pe,nt=Ie,i+=m,pe=v[i],Ie=v[i+1],Pe+=we,we=Math.sqrt((pe-Ne)*(pe-Ne)+(Ie-nt)*(Ie-nt))}do et();while(i<u-m&&Pe+we<l);let ut=we===0?0:(l-Pe)/we,mt=va(Ne,pe,ut),ct=va(nt,Ie,ut),ft=i-m,It=Pe,Mt=l+z*D(q,a,V);for(;i<u-m&&Pe+we<Mt;)et();ut=we===0?0:(Mt-Pe)/we;let zt=va(Ne,pe,ut),Qt=va(nt,Ie,ut),Vt;if(de){let Jt=[mt,ct,zt,Qt];og(Jt,0,4,2,de,Jt,Jt),Vt=Jt[0]>Jt[2]}else Vt=mt>zt;let mi=Math.PI,Ii=[],$t=ft+m===i;i=ft,we=0,Pe=It,pe=v[i],Ie=v[i+1];let ci;if($t){et(),ci=Math.atan2(Ie-nt,pe-Ne),Vt&&(ci+=ci>0?-mi:mi);let Jt=(zt+mt)/2,Ei=(Qt+ct)/2;return Ii[0]=[Jt,Ei,(Mt-l)/2,ci,a],Ii}a=a.replace(/\n/g," ");for(let Jt=0,Ei=a.length;Jt<Ei;){et();let ni=Math.atan2(Ie-nt,pe-Ne);if(Vt&&(ni+=ni>0?-mi:mi),ci!==void 0){let Gr=ni-ci;if(Gr+=Gr>mi?-2*mi:Gr<-mi?2*mi:0,Math.abs(Gr)>M)return null}ci=ni;let Ui=Jt,Bi=0;for(;Jt<Ei;++Jt){let Gr=Vt?Ei-Jt-1:Jt,or=z*D(q,a[Gr],V);if(i+m<u&&Pe+we<l+Bi+or/2)break;Bi+=or}if(Jt===Ui)continue;let jr=Vt?a.substring(Ei-Ui,Ei-Jt):a.substring(Ui,Jt);ut=we===0?0:(l+Bi/2-Pe)/we;let Ht=va(Ne,pe,ut),Br=va(nt,Ie,ut);Ii.push([Ht,Br,Bi/2,ni,jr]),l+=Bi}return Ii}var pd=Qa(),gh=[],_c=[],vc=[],yh=[];function L1(v){return v[3].declutterBox}var b2=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function z1(v,i){return(i==="start"||i==="end")&&!b2.test(v)&&(i=i==="start"?"left":"right"),cd[i]}function w2(v,i,u){return u>0&&v.push(`
1081
1081
  `,""),v.push(i,""),v}var hv=class{constructor(i,u,m,a){this.overlaps=m,this.pixelRatio=u,this.resolution=i,this.alignFill_,this.instructions=a.instructions,this.coordinates=a.coordinates,this.coordinateCache_={},this.renderedTransform_=Da(),this.hitDetectionInstructions=a.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=a.fillStates||{},this.strokeStates=a.strokeStates||{},this.textStates=a.textStates||{},this.widths_={},this.labels_={}}createLabel(i,u,m,a){let l=i+u+m+a;if(this.labels_[l])return this.labels_[l];let M=a?this.strokeStates[a]:null,z=m?this.fillStates[m]:null,D=this.textStates[u],q=this.pixelRatio,V=[D.scale[0]*q,D.scale[1]*q],de=Array.isArray(i),pe=D.justify?cd[D.justify]:z1(Array.isArray(i)?i[0]:i,D.textAlign||mh),Ie=a&&M.lineWidth?M.lineWidth:0,Ne=de?i:i.split(`
1082
1082
  `).reduce(w2,[]),{width:nt,height:we,widths:Pe,heights:et,lineWidths:ut}=h1(D,Ne),mt=nt+Ie,ct=[],ft=(mt+2)*V[0],It=(we+Ie)*V[1],Mt={width:ft<0?Math.floor(ft):Math.ceil(ft),height:It<0?Math.floor(It):Math.ceil(It),contextInstructions:ct};(V[0]!=1||V[1]!=1)&&ct.push("scale",V),a&&(ct.push("strokeStyle",M.strokeStyle),ct.push("lineWidth",Ie),ct.push("lineCap",M.lineCap),ct.push("lineJoin",M.lineJoin),ct.push("miterLimit",M.miterLimit),ct.push("setLineDash",[M.lineDash]),ct.push("lineDashOffset",M.lineDashOffset)),m&&ct.push("fillStyle",z.fillStyle),ct.push("textBaseline","middle"),ct.push("textAlign","center");let zt=.5-pe,Qt=pe*mt+zt*Ie,Vt=[],mi=[],Ii=0,$t=0,ci=0,Jt=0,Ei;for(let ni=0,Ui=Ne.length;ni<Ui;ni+=2){let Bi=Ne[ni];if(Bi===`
1083
- `){$t+=Ii,Ii=0,Qt=pe*mt+zt*Ie,++Jt;continue}let jr=Ne[ni+1]||D.font;jr!==Ei&&(a&&Vt.push("font",jr),m&&mi.push("font",jr),Ei=jr),Ii=Math.max(Ii,et[ci]);let Ht=[Bi,Qt+zt*Pe[ci]+pe*(Pe[ci]-ut[Jt]),.5*(Ie+Ii)+$t];Qt+=Pe[ci],a&&Vt.push("strokeText",Ht),m&&mi.push("fillText",Ht),++ci}return Array.prototype.push.apply(ct,Vt),Array.prototype.push.apply(ct,mi),this.labels_[l]=Mt,Mt}replayTextBackground_(i,u,m,a,l,M,z){i.beginPath(),i.moveTo.apply(i,u),i.lineTo.apply(i,m),i.lineTo.apply(i,a),i.lineTo.apply(i,l),i.lineTo.apply(i,u),M&&(this.alignFill_=M[2],this.fill_(i)),z&&(this.setStrokeStyle_(i,z),i.stroke())}calculateImageOrLabelDimensions_(i,u,m,a,l,M,z,D,q,V,de,pe,Ie,Ne,nt,we){z*=pe[0],D*=pe[1];let Pe=m-z,et=a-D,ut=l+q>i?i-q:l,mt=M+V>u?u-V:M,ct=Ne[3]+ut*pe[0]+Ne[1],ft=Ne[0]+mt*pe[1]+Ne[2],It=Pe-Ne[3],Mt=et-Ne[0];(nt||de!==0)&&(gh[0]=It,yh[0]=It,gh[1]=Mt,_c[1]=Mt,_c[0]=It+ct,vc[0]=_c[0],vc[1]=Mt+ft,yh[1]=vc[1]);let zt;return de!==0?(zt=Ys(Da(),m,a,1,1,de,-m,-a),qo(zt,gh),qo(zt,_c),qo(zt,vc),qo(zt,yh),uc(Math.min(gh[0],_c[0],vc[0],yh[0]),Math.min(gh[1],_c[1],vc[1],yh[1]),Math.max(gh[0],_c[0],vc[0],yh[0]),Math.max(gh[1],_c[1],vc[1],yh[1]),pd)):uc(Math.min(It,It+ct),Math.min(Mt,Mt+ft),Math.max(It,It+ct),Math.max(Mt,Mt+ft),pd),Ie&&(Pe=Math.round(Pe),et=Math.round(et)),{drawImageX:Pe,drawImageY:et,drawImageW:ut,drawImageH:mt,originX:q,originY:V,declutterBox:{minX:pd[0],minY:pd[1],maxX:pd[2],maxY:pd[3],value:we},canvasTransform:zt,scale:pe}}replayImageOrLabel_(i,u,m,a,l,M,z){let D=!!(M||z),q=a.declutterBox,V=i.canvas,de=z?z[2]*a.scale[0]/2:0;return q.minX-de<=V.width/u&&q.maxX+de>=0&&q.minY-de<=V.height/u&&q.maxY+de>=0&&(D&&this.replayTextBackground_(i,gh,_c,vc,yh,M,z),p1(i,a.canvasTransform,l,m,a.originX,a.originY,a.drawImageW,a.drawImageH,a.drawImageX,a.drawImageY,a.scale)),!0}fill_(i){if(this.alignFill_){let u=qo(this.renderedTransform_,[0,0]),m=512*this.pixelRatio;i.save(),i.translate(u[0]%m,u[1]%m),i.rotate(this.viewRotation_)}i.fill(),this.alignFill_&&i.restore()}setStrokeStyle_(i,u){i.strokeStyle=u[1],i.lineWidth=u[2],i.lineCap=u[3],i.lineJoin=u[4],i.miterLimit=u[5],i.lineDashOffset=u[7],i.setLineDash(u[6])}drawLabelWithPointPlacement_(i,u,m,a){let l=this.textStates[u],M=this.createLabel(i,u,a,m),z=this.strokeStates[m],D=this.pixelRatio,q=z1(Array.isArray(i)?i[0]:i,l.textAlign||mh),V=cd[l.textBaseline||Jh],de=z&&z.lineWidth?z.lineWidth:0,pe=M.width/D-2*l.scale[0],Ie=q*pe+2*(.5-q)*de,Ne=V*M.height/D+2*(.5-V)*de;return{label:M,anchorX:Ie,anchorY:Ne}}execute_(i,u,m,a,l,M,z,D){let q;this.pixelCoordinates_&&xs(m,this.renderedTransform_)?q=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),q=xl(this.coordinates,0,this.coordinates.length,2,m,this.pixelCoordinates_),Ux(this.renderedTransform_,m));let V=0,de=a.length,pe=0,Ie,Ne,nt,we,Pe,et,ut,mt,ct,ft,It,Mt,zt=0,Qt=0,Vt=null,mi=null,Ii=this.coordinateCache_,$t=this.viewRotation_,ci=Math.round(Math.atan2(-m[1],m[0])*1e12)/1e12,Jt={context:i,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$t},Ei=this.instructions!=a||this.overlaps?0:200,ni,Ui,Bi,jr;for(;V<de;){let Ht=a[V];switch(Ht[0]){case ji.BEGIN_GEOMETRY:ni=Ht[1],jr=Ht[3],ni.getGeometry()?z!==void 0&&!uo(z,jr.getExtent())?V=Ht[2]+1:++V:V=Ht[2];break;case ji.BEGIN_PATH:zt>Ei&&(this.fill_(i),zt=0),Qt>Ei&&(i.stroke(),Qt=0),!zt&&!Qt&&(i.beginPath(),we=NaN,Pe=NaN),++V;break;case ji.CIRCLE:pe=Ht[1];let Gr=q[pe],or=q[pe+1],on=q[pe+2],Fi=q[pe+3],Cn=on-Gr,wo=Fi-or,qr=Math.sqrt(Cn*Cn+wo*wo);i.moveTo(Gr+qr,or),i.arc(Gr,or,qr,0,2*Math.PI,!0),++V;break;case ji.CLOSE_PATH:i.closePath(),++V;break;case ji.CUSTOM:pe=Ht[1],Ie=Ht[2];let Ai=Ht[3],ho=Ht[4],Ir=Ht.length==6?Ht[5]:void 0;Jt.geometry=Ai,Jt.feature=ni,V in Ii||(Ii[V]=[]);let pr=Ii[V];Ir?Ir(q,pe,Ie,2,pr):(pr[0]=q[pe],pr[1]=q[pe+1],pr.length=2),ho(pr,Jt),++V;break;case ji.DRAW_IMAGE:pe=Ht[1],Ie=Ht[2],mt=Ht[3],Ne=Ht[4],nt=Ht[5];let Wn=Ht[6],dn=Ht[7],qi=Ht[8],Zr=Ht[9],An=Ht[10],Ln=Ht[11],zn=Ht[12],Wr=Ht[13],Dn=Ht[14],hn=Ht[15];if(!mt&&Ht.length>=20){ct=Ht[19],ft=Ht[20],It=Ht[21],Mt=Ht[22];let ue=this.drawLabelWithPointPlacement_(ct,ft,It,Mt);mt=ue.label,Ht[3]=mt;let ge=Ht[23];Ne=(ue.anchorX-ge)*this.pixelRatio,Ht[4]=Ne;let Te=Ht[24];nt=(ue.anchorY-Te)*this.pixelRatio,Ht[5]=nt,Wn=mt.height,Ht[6]=Wn,Wr=mt.width,Ht[13]=Wr}let Qn;Ht.length>25&&(Qn=Ht[25]);let bt,jt,eo;Ht.length>17?(bt=Ht[16],jt=Ht[17],eo=Ht[18]):(bt=mc,jt=!1,eo=!1),An&&ci?Ln+=$t:!An&&!ci&&(Ln-=$t);let Fn=0;for(;pe<Ie;pe+=2){if(Qn&&Qn[Fn++]<Wr/this.pixelRatio)continue;let ue=this.calculateImageOrLabelDimensions_(mt.width,mt.height,q[pe],q[pe+1],Wr,Wn,Ne,nt,qi,Zr,Ln,zn,l,bt,jt||eo,ni),ge=[i,u,mt,ue,dn,jt?Vt:null,eo?mi:null];if(D){if(Dn==="none")continue;if(Dn==="obstacle"){D.insert(ue.declutterBox);continue}else{let Te,Re;if(hn){let Xe=Ie-pe;if(!hn[Xe]){hn[Xe]=ge;continue}if(Te=hn[Xe],delete hn[Xe],Re=L1(Te),D.collides(Re))continue}if(D.collides(ue.declutterBox))continue;Te&&(D.insert(Re),this.replayImageOrLabel_.apply(this,Te)),D.insert(ue.declutterBox)}}this.replayImageOrLabel_.apply(this,ge)}++V;break;case ji.DRAW_CHARS:let Hi=Ht[1],bn=Ht[2],fn=Ht[3],mn=Ht[4];Mt=Ht[5];let So=Ht[6],Gt=Ht[7],Vi=Ht[8];It=Ht[9];let Ri=Ht[10];ct=Ht[11],ft=Ht[12];let Ur=[Ht[13],Ht[13]],wn=this.textStates[ft],bi=wn.font,Sn=[wn.scale[0]*Gt,wn.scale[1]*Gt],Pr;bi in this.widths_?Pr=this.widths_[bi]:(Pr={},this.widths_[bi]=Pr);let _r=cg(q,Hi,bn,2),ie=Math.abs(Sn[0])*N_(bi,ct,Pr);if(mn||ie<=_r){let ue=this.textStates[ft].textAlign,ge=(_r-ie)*cd[ue],Te=R1(q,Hi,bn,2,ct,ge,So,Math.abs(Sn[0]),N_,bi,Pr,ci?0:this.viewRotation_);e:if(Te){let Re=[],Xe,Ye,Se,Oe,te;if(It)for(Xe=0,Ye=Te.length;Xe<Ye;++Xe){te=Te[Xe],Se=te[4],Oe=this.createLabel(Se,ft,"",It),Ne=te[2]+(Sn[0]<0?-Ri:Ri),nt=fn*Oe.height+(.5-fn)*2*Ri*Sn[1]/Sn[0]-Vi;let W=this.calculateImageOrLabelDimensions_(Oe.width,Oe.height,te[0],te[1],Oe.width,Oe.height,Ne,nt,0,0,te[3],Ur,!1,mc,!1,ni);if(D&&D.collides(W.declutterBox))break e;Re.push([i,u,Oe,W,1,null,null])}if(Mt)for(Xe=0,Ye=Te.length;Xe<Ye;++Xe){te=Te[Xe],Se=te[4],Oe=this.createLabel(Se,ft,Mt,""),Ne=te[2],nt=fn*Oe.height-Vi;let W=this.calculateImageOrLabelDimensions_(Oe.width,Oe.height,te[0],te[1],Oe.width,Oe.height,Ne,nt,0,0,te[3],Ur,!1,mc,!1,ni);if(D&&D.collides(W.declutterBox))break e;Re.push([i,u,Oe,W,1,null,null])}D&&D.load(Re.map(L1));for(let W=0,J=Re.length;W<J;++W)this.replayImageOrLabel_.apply(this,Re[W])}}++V;break;case ji.END_GEOMETRY:if(M!==void 0){ni=Ht[1];let ue=M(ni,jr);if(ue)return ue}++V;break;case ji.FILL:Ei?zt++:this.fill_(i),++V;break;case ji.MOVE_TO_LINE_TO:for(pe=Ht[1],Ie=Ht[2],Ui=q[pe],Bi=q[pe+1],et=Ui+.5|0,ut=Bi+.5|0,(et!==we||ut!==Pe)&&(i.moveTo(Ui,Bi),we=et,Pe=ut),pe+=2;pe<Ie;pe+=2)Ui=q[pe],Bi=q[pe+1],et=Ui+.5|0,ut=Bi+.5|0,(pe==Ie-2||et!==we||ut!==Pe)&&(i.lineTo(Ui,Bi),we=et,Pe=ut);++V;break;case ji.SET_FILL_STYLE:Vt=Ht,this.alignFill_=Ht[2],zt&&(this.fill_(i),zt=0,Qt&&(i.stroke(),Qt=0)),i.fillStyle=Ht[1],++V;break;case ji.SET_STROKE_STYLE:mi=Ht,Qt&&(i.stroke(),Qt=0),this.setStrokeStyle_(i,Ht),++V;break;case ji.STROKE:Ei?Qt++:i.stroke(),++V;break;default:++V;break}}zt&&this.fill_(i),Qt&&i.stroke()}execute(i,u,m,a,l,M){this.viewRotation_=a,this.execute_(i,u,m,this.instructions,l,void 0,void 0,M)}executeHitDetection(i,u,m,a,l){return this.viewRotation_=m,this.execute_(i,1,u,this.hitDetectionInstructions,!0,a,l)}},D1=hv;var pv=["Polygon","Circle","LineString","Image","Text","Default"],fv=class{constructor(i,u,m,a,l,M){this.maxExtent_=i,this.overlaps_=a,this.pixelRatio_=m,this.resolution_=u,this.renderBuffer_=M,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Da(),this.createExecutors_(l)}clip(i,u){let m=this.getClipCoords(u);i.beginPath(),i.moveTo(m[0],m[1]),i.lineTo(m[2],m[3]),i.lineTo(m[4],m[5]),i.lineTo(m[6],m[7]),i.clip()}createExecutors_(i){for(let u in i){let m=this.executorsByZIndex_[u];m===void 0&&(m={},this.executorsByZIndex_[u]=m);let a=i[u];for(let l in a){let M=a[l];m[l]=new D1(this.resolution_,this.pixelRatio_,this.overlaps_,M)}}}hasExecutors(i){for(let u in this.executorsByZIndex_){let m=this.executorsByZIndex_[u];for(let a=0,l=i.length;a<l;++a)if(i[a]in m)return!0}return!1}forEachFeatureAtCoordinate(i,u,m,a,l,M){a=Math.round(a);let z=a*2+1,D=Ys(this.hitDetectionTransform_,a+.5,a+.5,1/u,-1/u,-m,-i[0],-i[1]),q=!this.hitDetectionContext_;q&&(this.hitDetectionContext_=aa(z,z,void 0,{willReadFrequently:!0}));let V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):q||V.clearRect(0,0,z,z);let de;this.renderBuffer_!==void 0&&(de=Qa(),Dy(de,i),_l(de,u*(this.renderBuffer_+a),de));let pe=S2(a),Ie;function Ne(ct,ft){let It=V.getImageData(0,0,z,z).data;for(let Mt=0,zt=pe.length;Mt<zt;Mt++)if(It[pe[Mt]]>0){if(!M||Ie!=="Image"&&Ie!=="Text"||M.includes(ct)){let Qt=(pe[Mt]-3)/4,Vt=a-Qt%z,mi=a-(Qt/z|0),Ii=l(ct,ft,Vt*Vt+mi*mi);if(Ii)return Ii}V.clearRect(0,0,z,z);break}}let nt=Object.keys(this.executorsByZIndex_).map(Number);nt.sort(rh);let we,Pe,et,ut,mt;for(we=nt.length-1;we>=0;--we){let ct=nt[we].toString();for(et=this.executorsByZIndex_[ct],Pe=pv.length-1;Pe>=0;--Pe)if(Ie=pv[Pe],ut=et[Ie],ut!==void 0&&(mt=ut.executeHitDetection(V,D,m,Ne,de),mt))return mt}}getClipCoords(i){let u=this.maxExtent_;if(!u)return null;let m=u[0],a=u[1],l=u[2],M=u[3],z=[m,a,m,M,l,M,l,a];return xl(z,0,8,2,i,z),z}isEmpty(){return Gl(this.executorsByZIndex_)}execute(i,u,m,a,l,M,z){let D=Object.keys(this.executorsByZIndex_).map(Number);D.sort(rh),this.maxExtent_&&(i.save(),this.clip(i,m)),M=M||pv;let q,V,de,pe,Ie,Ne;for(z&&D.reverse(),q=0,V=D.length;q<V;++q){let nt=D[q].toString();for(Ie=this.executorsByZIndex_[nt],de=0,pe=M.length;de<pe;++de){let we=M[de];Ne=Ie[we],Ne!==void 0&&Ne.execute(i,u,m,a,l,z)}}this.maxExtent_&&i.restore()}},dv={};function S2(v){if(dv[v]!==void 0)return dv[v];let i=v*2+1,u=v*v,m=new Array(u+1);for(let l=0;l<=v;++l)for(let M=0;M<=v;++M){let z=l*l+M*M;if(z>u)break;let D=m[z];D||(D=[],m[z]=D),D.push(((v+l)*i+(v+M))*4+3),l>0&&D.push(((v-l)*i+(v+M))*4+3),M>0&&(D.push(((v+l)*i+(v-M))*4+3),l>0&&D.push(((v-l)*i+(v-M))*4+3))}let a=[];for(let l=0,M=m.length;l<M;++l)m[l]&&a.push(...m[l]);return dv[v]=a,a}var mv=fv;var gv=class extends Sg{constructor(i,u,m,a,l,M,z){super(),this.context_=i,this.pixelRatio_=u,this.extent_=m,this.transform_=a,this.transformRotation_=a?l0(Math.atan2(a[1],a[0]),10):0,this.viewRotation_=l,this.squaredTolerance_=M,this.userTransform_=z,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Da()}drawImages_(i,u,m,a){if(!this.image_)return;let l=xl(i,u,m,a,this.transform_,this.pixelCoordinates_),M=this.context_,z=this.tmpLocalTransform_,D=M.globalAlpha;this.imageOpacity_!=1&&(M.globalAlpha=D*this.imageOpacity_);let q=this.imageRotation_;this.transformRotation_===0&&(q-=this.viewRotation_),this.imageRotateWithView_&&(q+=this.viewRotation_);for(let V=0,de=l.length;V<de;V+=2){let pe=l[V]-this.imageAnchorX_,Ie=l[V+1]-this.imageAnchorY_;if(q!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let Ne=pe+this.imageAnchorX_,nt=Ie+this.imageAnchorY_;Ys(z,Ne,nt,1,1,q,-Ne,-nt),M.setTransform.apply(M,z),M.translate(Ne,nt),M.scale(this.imageScale_[0],this.imageScale_[1]),M.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),M.setTransform(1,0,0,1,0,0)}else M.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,pe,Ie,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(M.globalAlpha=D)}drawText_(i,u,m,a){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let l=xl(i,u,m,a,this.transform_,this.pixelCoordinates_),M=this.context_,z=this.textRotation_;for(this.transformRotation_===0&&(z-=this.viewRotation_),this.textRotateWithView_&&(z+=this.viewRotation_);u<m;u+=a){let D=l[u]+this.textOffsetX_,q=l[u+1]+this.textOffsetY_;z!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(M.translate(D-this.textOffsetX_,q-this.textOffsetY_),M.rotate(z),M.translate(this.textOffsetX_,this.textOffsetY_),M.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&M.strokeText(this.text_,0,0),this.textFillState_&&M.fillText(this.text_,0,0),M.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&M.strokeText(this.text_,D,q),this.textFillState_&&M.fillText(this.text_,D,q))}}moveToLineTo_(i,u,m,a,l){let M=this.context_,z=xl(i,u,m,a,this.transform_,this.pixelCoordinates_);M.moveTo(z[0],z[1]);let D=z.length;l&&(D-=2);for(let q=2;q<D;q+=2)M.lineTo(z[q],z[q+1]);return l&&M.closePath(),m}drawRings_(i,u,m,a){for(let l=0,M=m.length;l<M;++l)u=this.moveToLineTo_(i,u,m[l],a,!0);return u}drawCircle(i){if(uo(this.extent_,i.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let u=S0(i,this.transform_,this.pixelCoordinates_),m=u[2]-u[0],a=u[3]-u[1],l=Math.sqrt(m*m+a*a),M=this.context_;M.beginPath(),M.arc(u[0],u[1],l,0,2*Math.PI),this.fillState_&&M.fill(),this.strokeState_&&M.stroke()}this.text_!==""&&this.drawText_(i.getCenter(),0,2,2)}}setStyle(i){this.setFillStrokeStyle(i.getFill(),i.getStroke()),this.setImageStyle(i.getImage()),this.setTextStyle(i.getText())}setTransform(i){this.transform_=i}drawGeometry(i){switch(i.getType()){case"Point":this.drawPoint(i);break;case"LineString":this.drawLineString(i);break;case"Polygon":this.drawPolygon(i);break;case"MultiPoint":this.drawMultiPoint(i);break;case"MultiLineString":this.drawMultiLineString(i);break;case"MultiPolygon":this.drawMultiPolygon(i);break;case"GeometryCollection":this.drawGeometryCollection(i);break;case"Circle":this.drawCircle(i);break;default:}}drawFeature(i,u){let m=u.getGeometryFunction()(i);!m||!uo(this.extent_,m.getExtent())||(this.setStyle(u),this.drawGeometry(m))}drawGeometryCollection(i){let u=i.getGeometriesArray();for(let m=0,a=u.length;m<a;++m)this.drawGeometry(u[m])}drawPoint(i){this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let u=i.getFlatCoordinates(),m=i.getStride();this.image_&&this.drawImages_(u,0,u.length,m),this.text_!==""&&this.drawText_(u,0,u.length,m)}drawMultiPoint(i){this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let u=i.getFlatCoordinates(),m=i.getStride();this.image_&&this.drawImages_(u,0,u.length,m),this.text_!==""&&this.drawText_(u,0,u.length,m)}drawLineString(i){if(this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!uo(this.extent_,i.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let u=this.context_,m=i.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(m,0,m.length,i.getStride(),!1),u.stroke()}if(this.text_!==""){let u=i.getFlatMidpoint();this.drawText_(u,0,2,2)}}}drawMultiLineString(i){this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let u=i.getExtent();if(uo(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let m=this.context_,a=i.getFlatCoordinates(),l=0,M=i.getEnds(),z=i.getStride();m.beginPath();for(let D=0,q=M.length;D<q;++D)l=this.moveToLineTo_(a,l,M[D],z,!1);m.stroke()}if(this.text_!==""){let m=i.getFlatMidpoints();this.drawText_(m,0,m.length,2)}}}drawPolygon(i){if(this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!uo(this.extent_,i.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let u=this.context_;u.beginPath(),this.drawRings_(i.getOrientedFlatCoordinates(),0,i.getEnds(),i.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){let u=i.getFlatInteriorPoint();this.drawText_(u,0,2,2)}}}drawMultiPolygon(i){if(this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!uo(this.extent_,i.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let u=this.context_,m=i.getOrientedFlatCoordinates(),a=0,l=i.getEndss(),M=i.getStride();u.beginPath();for(let z=0,D=l.length;z<D;++z){let q=l[z];a=this.drawRings_(m,a,q,M)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){let u=i.getFlatInteriorPoints();this.drawText_(u,0,u.length,2)}}}setContextFillState_(i){let u=this.context_,m=this.contextFillState_;m?m.fillStyle!=i.fillStyle&&(m.fillStyle=i.fillStyle,u.fillStyle=i.fillStyle):(u.fillStyle=i.fillStyle,this.contextFillState_={fillStyle:i.fillStyle})}setContextStrokeState_(i){let u=this.context_,m=this.contextStrokeState_;m?(m.lineCap!=i.lineCap&&(m.lineCap=i.lineCap,u.lineCap=i.lineCap),xs(m.lineDash,i.lineDash)||u.setLineDash(m.lineDash=i.lineDash),m.lineDashOffset!=i.lineDashOffset&&(m.lineDashOffset=i.lineDashOffset,u.lineDashOffset=i.lineDashOffset),m.lineJoin!=i.lineJoin&&(m.lineJoin=i.lineJoin,u.lineJoin=i.lineJoin),m.lineWidth!=i.lineWidth&&(m.lineWidth=i.lineWidth,u.lineWidth=i.lineWidth),m.miterLimit!=i.miterLimit&&(m.miterLimit=i.miterLimit,u.miterLimit=i.miterLimit),m.strokeStyle!=i.strokeStyle&&(m.strokeStyle=i.strokeStyle,u.strokeStyle=i.strokeStyle)):(u.lineCap=i.lineCap,u.setLineDash(i.lineDash),u.lineDashOffset=i.lineDashOffset,u.lineJoin=i.lineJoin,u.lineWidth=i.lineWidth,u.miterLimit=i.miterLimit,u.strokeStyle=i.strokeStyle,this.contextStrokeState_={lineCap:i.lineCap,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,lineJoin:i.lineJoin,lineWidth:i.lineWidth,miterLimit:i.miterLimit,strokeStyle:i.strokeStyle})}setContextTextState_(i){let u=this.context_,m=this.contextTextState_,a=i.textAlign?i.textAlign:mh;m?(m.font!=i.font&&(m.font=i.font,u.font=i.font),m.textAlign!=a&&(m.textAlign=a,u.textAlign=a),m.textBaseline!=i.textBaseline&&(m.textBaseline=i.textBaseline,u.textBaseline=i.textBaseline)):(u.font=i.font,u.textAlign=a,u.textBaseline=i.textBaseline,this.contextTextState_={font:i.font,textAlign:a,textBaseline:i.textBaseline})}setFillStrokeStyle(i,u){if(!i)this.fillState_=null;else{let m=i.getColor();this.fillState_={fillStyle:Ts(m||Is)}}if(!u)this.strokeState_=null;else{let m=u.getColor(),a=u.getLineCap(),l=u.getLineDash(),M=u.getLineDashOffset(),z=u.getLineJoin(),D=u.getWidth(),q=u.getMiterLimit(),V=l||hc;this.strokeState_={lineCap:a!==void 0?a:Yh,lineDash:this.pixelRatio_===1?V:V.map(de=>de*this.pixelRatio_),lineDashOffset:(M||pc)*this.pixelRatio_,lineJoin:z!==void 0?z:Iu,lineWidth:(D!==void 0?D:gc)*this.pixelRatio_,miterLimit:q!==void 0?q:dc,strokeStyle:Ts(m||fc)}}}setImageStyle(i){let u;if(!i||!(u=i.getSize())){this.image_=null;return}let m=i.getPixelRatio(this.pixelRatio_),a=i.getAnchor(),l=i.getOrigin();this.image_=i.getImage(this.pixelRatio_),this.imageAnchorX_=a[0]*m,this.imageAnchorY_=a[1]*m,this.imageHeight_=u[1]*m,this.imageOpacity_=i.getOpacity(),this.imageOriginX_=l[0],this.imageOriginY_=l[1],this.imageRotateWithView_=i.getRotateWithView(),this.imageRotation_=i.getRotation();let M=i.getScaleArray();this.imageScale_=[M[0]*this.pixelRatio_/m,M[1]*this.pixelRatio_/m],this.imageWidth_=u[0]*m}setTextStyle(i){if(!i)this.text_="";else{let u=i.getFill();if(!u)this.textFillState_=null;else{let Ie=u.getColor();this.textFillState_={fillStyle:Ts(Ie||Is)}}let m=i.getStroke();if(!m)this.textStrokeState_=null;else{let Ie=m.getColor(),Ne=m.getLineCap(),nt=m.getLineDash(),we=m.getLineDashOffset(),Pe=m.getLineJoin(),et=m.getWidth(),ut=m.getMiterLimit();this.textStrokeState_={lineCap:Ne!==void 0?Ne:Yh,lineDash:nt||hc,lineDashOffset:we||pc,lineJoin:Pe!==void 0?Pe:Iu,lineWidth:et!==void 0?et:gc,miterLimit:ut!==void 0?ut:dc,strokeStyle:Ts(Ie||fc)}}let a=i.getFont(),l=i.getOffsetX(),M=i.getOffsetY(),z=i.getRotateWithView(),D=i.getRotation(),q=i.getScaleArray(),V=i.getText(),de=i.getTextAlign(),pe=i.getTextBaseline();this.textState_={font:a!==void 0?a:bg,textAlign:de!==void 0?de:mh,textBaseline:pe!==void 0?pe:Jh},this.text_=V!==void 0?Array.isArray(V)?V.reduce((Ie,Ne,nt)=>Ie+=nt%2?" ":Ne,""):V:"",this.textOffsetX_=l!==void 0?this.pixelRatio_*l:0,this.textOffsetY_=M!==void 0?this.pixelRatio_*M:0,this.textRotateWithView_=z!==void 0?z:!1,this.textRotation_=D!==void 0?D:0,this.textScale_=[this.pixelRatio_*q[0],this.pixelRatio_*q[1]]}}},F1=gv;var $l=.5;function O1(v,i,u,m,a,l,M){let z=v[0]*$l,D=v[1]*$l,q=aa(z,D);q.imageSmoothingEnabled=!1;let V=q.canvas,de=new F1(q,$l,a,null,M),pe=u.length,Ie=Math.floor((256*256*256-1)/pe),Ne={};for(let we=1;we<=pe;++we){let Pe=u[we-1],et=Pe.getStyleFunction()||m;if(!m)continue;let ut=et(Pe,l);if(!ut)continue;Array.isArray(ut)||(ut=[ut]);let ct=(we*Ie).toString(16).padStart(7,"#00000");for(let ft=0,It=ut.length;ft<It;++ft){let Mt=ut[ft],zt=Mt.getGeometryFunction()(Pe);if(!zt||!uo(a,zt.getExtent()))continue;let Qt=Mt.clone(),Vt=Qt.getFill();Vt&&Vt.setColor(ct);let mi=Qt.getStroke();mi&&(mi.setColor(ct),mi.setLineDash(null)),Qt.setText(void 0);let Ii=Mt.getImage();if(Ii&&Ii.getOpacity()!==0){let Ei=Ii.getImageSize();if(!Ei)continue;let ni=aa(Ei[0],Ei[1],void 0,{alpha:!1}),Ui=ni.canvas;ni.fillStyle=ct,ni.fillRect(0,0,Ui.width,Ui.height),Qt.setImage(new Mf({img:Ui,imgSize:Ei,anchor:Ii.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:Ii.getOrigin(),opacity:1,size:Ii.getSize(),scale:Ii.getScale(),rotation:Ii.getRotation(),rotateWithView:Ii.getRotateWithView()}))}let $t=Qt.getZIndex()||0,ci=Ne[$t];ci||(ci={},Ne[$t]=ci,ci.Polygon=[],ci.Circle=[],ci.LineString=[],ci.Point=[]);let Jt=zt.getType();if(Jt==="GeometryCollection"){let Ei=zt.getGeometriesArrayRecursive();for(let ni=0,Ui=Ei.length;ni<Ui;++ni){let Bi=Ei[ni];ci[Bi.getType().replace("Multi","")].push(Bi,Qt)}}else ci[Jt.replace("Multi","")].push(zt,Qt)}}let nt=Object.keys(Ne).map(Number).sort(rh);for(let we=0,Pe=nt.length;we<Pe;++we){let et=Ne[nt[we]];for(let ut in et){let mt=et[ut];for(let ct=0,ft=mt.length;ct<ft;ct+=2){de.setStyle(mt[ct+1]);for(let It=0,Mt=i.length;It<Mt;++It)de.setTransform(i[It]),de.drawGeometry(mt[ct])}}}return q.getImageData(0,0,V.width,V.height)}function B1(v,i,u){let m=[];if(u){let a=Math.floor(Math.round(v[0])*$l),l=Math.floor(Math.round(v[1])*$l),M=(Jn(a,0,u.width-1)+Jn(l,0,u.height-1)*u.width)*4,z=u.data[M],D=u.data[M+1],V=u.data[M+2]+256*(D+256*z),de=Math.floor((256*256*256-1)/i.length);V&&V%de===0&&m.push(i[V/de-1])}return m}var E2=.5,U1={Point:k2,LineString:A2,Polygon:L2,MultiPoint:R2,MultiLineString:M2,MultiPolygon:P2,GeometryCollection:C2,Circle:T2};function V1(v,i){return parseInt(Tr(v),10)-parseInt(Tr(i),10)}function N1(v,i){let u=Eg(v,i);return u*u}function Eg(v,i){return E2*v/i}function T2(v,i,u,m,a){let l=u.getFill(),M=u.getStroke();if(l||M){let D=v.getBuilder(u.getZIndex(),"Circle");D.setFillStrokeStyle(l,M),D.drawCircle(i,m)}let z=u.getText();if(z&&z.getText()){let D=(a||v).getBuilder(u.getZIndex(),"Text");D.setTextStyle(z),D.drawText(i,m)}}function yv(v,i,u,m,a,l,M){let z=!1,D=u.getImage();if(D){let q=D.getImageState();q==Zn.LOADED||q==Zn.ERROR?D.unlistenImageChange(a):(q==Zn.IDLE&&D.load(),D.listenImageChange(a),z=!0)}return I2(v,i,u,m,l,M),z}function I2(v,i,u,m,a,l){let M=u.getGeometryFunction()(i);if(!M)return;let z=M.simplifyTransformed(m,a);if(u.getRenderer())j1(v,z,u,i);else{let q=U1[z.getType()];q(v,z,u,i,l)}}function j1(v,i,u,m){if(i.getType()=="GeometryCollection"){let l=i.getGeometries();for(let M=0,z=l.length;M<z;++M)j1(v,l[M],u,m);return}v.getBuilder(u.getZIndex(),"Default").drawCustom(i,m,u.getRenderer(),u.getHitDetectionRenderer())}function C2(v,i,u,m,a){let l=i.getGeometriesArray(),M,z;for(M=0,z=l.length;M<z;++M){let D=U1[l[M].getType()];D(v,l[M],u,m,a)}}function A2(v,i,u,m,a){let l=u.getStroke();if(l){let z=v.getBuilder(u.getZIndex(),"LineString");z.setFillStrokeStyle(null,l),z.drawLineString(i,m)}let M=u.getText();if(M&&M.getText()){let z=(a||v).getBuilder(u.getZIndex(),"Text");z.setTextStyle(M),z.drawText(i,m)}}function M2(v,i,u,m,a){let l=u.getStroke();if(l){let z=v.getBuilder(u.getZIndex(),"LineString");z.setFillStrokeStyle(null,l),z.drawMultiLineString(i,m)}let M=u.getText();if(M&&M.getText()){let z=(a||v).getBuilder(u.getZIndex(),"Text");z.setTextStyle(M),z.drawText(i,m)}}function P2(v,i,u,m,a){let l=u.getFill(),M=u.getStroke();if(M||l){let D=v.getBuilder(u.getZIndex(),"Polygon");D.setFillStrokeStyle(l,M),D.drawMultiPolygon(i,m)}let z=u.getText();if(z&&z.getText()){let D=(a||v).getBuilder(u.getZIndex(),"Text");D.setTextStyle(z),D.drawText(i,m)}}function k2(v,i,u,m,a){let l=u.getImage(),M=u.getText(),z;if(l){if(l.getImageState()!=Zn.LOADED)return;let D=v;if(a){let V=l.getDeclutterMode();if(V!=="none")if(D=a,V==="obstacle"){let de=v.getBuilder(u.getZIndex(),"Image");de.setImageStyle(l,z),de.drawPoint(i,m)}else M&&M.getText()&&(z={})}let q=D.getBuilder(u.getZIndex(),"Image");q.setImageStyle(l,z),q.drawPoint(i,m)}if(M&&M.getText()){let D=v;a&&(D=a);let q=D.getBuilder(u.getZIndex(),"Text");q.setTextStyle(M,z),q.drawText(i,m)}}function R2(v,i,u,m,a){let l=u.getImage(),M=u.getText(),z;if(l){if(l.getImageState()!=Zn.LOADED)return;let D=v;if(a){let V=l.getDeclutterMode();if(V!=="none")if(D=a,V==="obstacle"){let de=v.getBuilder(u.getZIndex(),"Image");de.setImageStyle(l,z),de.drawMultiPoint(i,m)}else M&&M.getText()&&(z={})}let q=D.getBuilder(u.getZIndex(),"Image");q.setImageStyle(l,z),q.drawMultiPoint(i,m)}if(M&&M.getText()){let D=v;a&&(D=a);let q=D.getBuilder(u.getZIndex(),"Text");q.setTextStyle(M,z),q.drawText(i,m)}}function L2(v,i,u,m,a){let l=u.getFill(),M=u.getStroke();if(l||M){let D=v.getBuilder(u.getZIndex(),"Polygon");D.setFillStrokeStyle(l,M),D.drawPolygon(i,m)}let z=u.getText();if(z&&z.getText()){let D=(a||v).getBuilder(u.getZIndex(),"Text");D.setTextStyle(z),D.drawText(i,m)}}var _v=class extends k1{constructor(i){super(i),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Qa(),this.wrappedRenderedExtent_=Qa(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(i,u,m){let a=u.extent,l=u.viewState,M=l.center,z=l.resolution,D=l.projection,q=l.rotation,V=D.getExtent(),de=this.getLayer().getSource(),pe=u.pixelRatio,Ie=u.viewHints,Ne=!(Ie[Ss.ANIMATING]||Ie[Ss.INTERACTING]),nt=this.compositionContext_,we=Math.round(u.size[0]*pe),Pe=Math.round(u.size[1]*pe),et=de.getWrapX()&&D.canWrapX(),ut=et?bo(V):null,mt=et?Math.ceil((a[2]-V[2])/ut)+1:1,ct=et?Math.floor((a[0]-V[0])/ut):0;do{let ft=this.getRenderTransform(M,z,q,pe,we,Pe,ct*ut);i.execute(nt,1,ft,q,Ne,void 0,m)}while(++ct<mt)}setupCompositionContext_(){if(this.opacity_!==1){let i=aa(this.context.canvas.width,this.context.canvas.height,cv);this.compositionContext_=i}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){let i=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=i,s1(this.compositionContext_),cv.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(i){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,i,i.declutterTree),this.releaseCompositionContext_())}renderFrame(i,u){let m=i.pixelRatio,a=i.layerStatesArray[i.layerIndex];Vx(this.pixelTransform,1/m,1/m),jx(this.inversePixelTransform,this.pixelTransform);let l=zy(this.pixelTransform);this.useContainer(u,l,this.getBackground(i));let M=this.context,z=M.canvas,D=this.replayGroup_,q=this.declutterExecutorGroup;if((!D||D.isEmpty())&&(!q||q.isEmpty()))return null;let V=Math.round(i.size[0]*m),de=Math.round(i.size[1]*m);z.width!=V||z.height!=de?(z.width=V,z.height=de,z.style.transform!==l&&(z.style.transform=l)):this.containerReused||M.clearRect(0,0,V,de),this.preRender(M,i);let pe=i.viewState,Ie=pe.projection;this.opacity_=a.opacity,this.setupCompositionContext_();let Ne=!1,nt=!0;if(a.extent&&this.clipping){let we=Eu(a.extent,Ie);nt=uo(we,i.extent),Ne=nt&&!lc(we,i.extent),Ne&&this.clipUnrotated(this.compositionContext_,i,we)}return nt&&this.renderWorlds(D,i),Ne&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(M,i),this.renderedRotation_!==pe.rotation&&(this.renderedRotation_=pe.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(i){return new Promise(u=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let m=[this.context.canvas.width,this.context.canvas.height];qo(this.pixelTransform,m);let a=this.renderedCenter_,l=this.renderedResolution_,M=this.renderedRotation_,z=this.renderedProjection_,D=this.wrappedRenderedExtent_,q=this.getLayer(),V=[],de=m[0]*$l,pe=m[1]*$l;V.push(this.getRenderTransform(a,l,M,$l,de,pe,0).slice());let Ie=q.getSource(),Ne=z.getExtent();if(Ie.getWrapX()&&z.canWrapX()&&!lc(Ne,D)){let nt=D[0],we=bo(Ne),Pe=0,et;for(;nt<Ne[0];)--Pe,et=we*Pe,V.push(this.getRenderTransform(a,l,M,$l,de,pe,et).slice()),nt+=we;for(Pe=0,nt=D[2];nt>Ne[2];)++Pe,et=we*Pe,V.push(this.getRenderTransform(a,l,M,$l,de,pe,et).slice()),nt-=we}this.hitDetectionImageData_=O1(m,V,this.renderedFeatures_,q.getStyleFunction(),D,l,M)}u(B1(i,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(i,u,m,a,l){if(!this.replayGroup_)return;let M=u.viewState.resolution,z=u.viewState.rotation,D=this.getLayer(),q={},V=function(Ie,Ne,nt){let we=Tr(Ie),Pe=q[we];if(Pe){if(Pe!==!0&&nt<Pe.distanceSq){if(nt===0)return q[we]=!0,l.splice(l.lastIndexOf(Pe),1),a(Ie,D,Ne);Pe.geometry=Ne,Pe.distanceSq=nt}}else{if(nt===0)return q[we]=!0,a(Ie,D,Ne);l.push(q[we]={feature:Ie,layer:D,geometry:Ne,distanceSq:nt,callback:a})}},de,pe=[this.replayGroup_];return this.declutterExecutorGroup&&pe.push(this.declutterExecutorGroup),pe.some(Ie=>de=Ie.forEachFeatureAtCoordinate(i,M,z,m,V,Ie===this.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(Ne=>Ne.value):null)),de}handleFontsChanged(){let i=this.getLayer();i.getVisible()&&this.replayGroup_&&i.changed()}handleStyleImageChange_(i){this.renderIfReadyAndVisible()}prepareFrame(i){let u=this.getLayer(),m=u.getSource();if(!m)return!1;let a=i.viewHints[Ss.ANIMATING],l=i.viewHints[Ss.INTERACTING],M=u.getUpdateWhileAnimating(),z=u.getUpdateWhileInteracting();if(this.ready&&!M&&a||!z&&l)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let D=i.extent,q=i.viewState,V=q.projection,de=q.resolution,pe=i.pixelRatio,Ie=u.getRevision(),Ne=u.getRenderBuffer(),nt=u.getRenderOrder();nt===void 0&&(nt=V1);let we=q.center.slice(),Pe=_l(D,Ne*de),et=Pe.slice(),ut=[Pe.slice()],mt=V.getExtent();if(m.getWrapX()&&V.canWrapX()&&!lc(mt,i.extent)){let Jt=bo(mt),Ei=Math.max(bo(Pe)/2,Jt);Pe[0]=mt[0]-Ei,Pe[2]=mt[2]+Ei,p0(we,V);let ni=Ny(ut[0],V);ni[0]<mt[0]&&ni[2]<mt[2]?ut.push([ni[0]+Jt,ni[1],ni[2]+Jt,ni[3]]):ni[0]>mt[0]&&ni[2]>mt[2]&&ut.push([ni[0]-Jt,ni[1],ni[2]-Jt,ni[3]])}if(this.ready&&this.renderedResolution_==de&&this.renderedRevision_==Ie&&this.renderedRenderOrder_==nt&&lc(this.wrappedRenderedExtent_,Pe))return xs(this.renderedExtent_,et)||(this.hitDetectionImageData_=null,this.renderedExtent_=et),this.renderedCenter_=we,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let ct=new av(Eg(de,pe),Pe,de,pe),ft;this.getLayer().getDeclutter()&&(ft=new av(Eg(de,pe),Pe,de,pe));let It=Su(),Mt;if(It){for(let Jt=0,Ei=ut.length;Jt<Ei;++Jt){let ni=ut[Jt],Ui=lh(ni,V);m.loadFeatures(Ui,_0(de,V),It)}Mt=rg(It,V)}else for(let Jt=0,Ei=ut.length;Jt<Ei;++Jt)m.loadFeatures(ut[Jt],de,V);let zt=N1(de,pe),Qt=!0,Vt=Jt=>{let Ei,ni=Jt.getStyleFunction()||u.getStyleFunction();if(ni&&(Ei=ni(Jt,de)),Ei){let Ui=this.renderFeature(Jt,zt,Ei,ct,Mt,ft);Qt=Qt&&!Ui}},mi=lh(Pe,V),Ii=m.getFeaturesInExtent(mi);nt&&Ii.sort(nt);for(let Jt=0,Ei=Ii.length;Jt<Ei;++Jt)Vt(Ii[Jt]);this.renderedFeatures_=Ii,this.ready=Qt;let $t=ct.finish(),ci=new mv(Pe,de,pe,m.getOverlaps(),$t,u.getRenderBuffer());return ft&&(this.declutterExecutorGroup=new mv(Pe,de,pe,m.getOverlaps(),ft.finish(),u.getRenderBuffer())),this.renderedResolution_=de,this.renderedRevision_=Ie,this.renderedRenderOrder_=nt,this.renderedExtent_=et,this.wrappedRenderedExtent_=Pe,this.renderedCenter_=we,this.renderedProjection_=V,this.replayGroup_=ci,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(i,u,m,a,l,M){if(!m)return!1;let z=!1;if(Array.isArray(m))for(let D=0,q=m.length;D<q;++D)z=yv(a,i,m[D],u,this.boundHandleStyleImageChange_,l,M)||z;else z=yv(a,i,m,u,this.boundHandleStyleImageChange_,l,M);return z}},G1=_v;var vv=class extends S1{constructor(i){super(i)}createRenderer(){return new G1(this)}},Qh=vv;var q1=Vp(Z_(),1);var xv=class{constructor(i){this.rbush_=new q1.default(i),this.items_={}}insert(i,u){let m={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3],value:u};this.rbush_.insert(m),this.items_[Tr(u)]=m}load(i,u){let m=new Array(u.length);for(let a=0,l=u.length;a<l;a++){let M=i[a],z=u[a],D={minX:M[0],minY:M[1],maxX:M[2],maxY:M[3],value:z};m[a]=D,this.items_[Tr(z)]=D}this.rbush_.load(m)}remove(i){let u=Tr(i),m=this.items_[u];return delete this.items_[u],this.rbush_.remove(m)!==null}update(i,u){let m=this.items_[Tr(u)],a=[m.minX,m.minY,m.maxX,m.maxY];Qm(a,i)||(this.remove(u),this.insert(i,u))}getAll(){return this.rbush_.all().map(function(u){return u.value})}getInExtent(i){let u={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]};return this.rbush_.search(u).map(function(a){return a.value})}forEach(i){return this.forEach_(this.getAll(),i)}forEachInExtent(i,u){return this.forEach_(this.getInExtent(i),u)}forEach_(i,u){let m;for(let a=0,l=i.length;a<l;a++)if(m=u(i[a]),m)return m;return m}isEmpty(){return Gl(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(i){let u=this.rbush_.toJSON();return uc(u.minX,u.minY,u.maxX,u.maxY,i)}concat(i){this.rbush_.load(i.rbush_.all());for(let u in i.items_)this.items_[u]=i.items_[u]}},zf=xv;var bv=class extends lo{constructor(i){super(),this.projection=Zo(i.projection),this.attributions_=Z1(i.attributions),this.attributionsCollapsible_=i.attributionsCollapsible!==void 0?i.attributionsCollapsible:!0,this.loading=!1,this.state_=i.state!==void 0?i.state:"ready",this.wrapX_=i.wrapX!==void 0?i.wrapX:!1,this.interpolate_=!!i.interpolate,this.viewResolver=null,this.viewRejector=null;let u=this;this.viewPromise_=new Promise(function(m,a){u.viewResolver=m,u.viewRejector=a})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(i){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(i){this.attributions_=Z1(i),this.changed()}setState(i){this.state_=i,this.changed()}};function Z1(v){return v?Array.isArray(v)?function(i){return v}:typeof v=="function"?v:function(i){return[v]}:null}var dd=bv;var ts={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function W1(v,i){return[[-1/0,-1/0,1/0,1/0]]}var z2=!1;function D2(v,i,u,m,a,l,M){let z=new XMLHttpRequest;z.open("GET",typeof v=="function"?v(u,m,a):v,!0),i.getType()=="arraybuffer"&&(z.responseType="arraybuffer"),z.withCredentials=z2,z.onload=function(D){if(!z.status||z.status>=200&&z.status<300){let q=i.getType(),V;q=="json"||q=="text"?V=z.responseText:q=="xml"?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):q=="arraybuffer"&&(V=z.response),V?l(i.readFeatures(V,{extent:u,featureProjection:a}),i.readProjection(V)):M()}else M()},z.onerror=M,z.send()}function wv(v,i){return function(u,m,a,l,M){let z=this;D2(v,i,u,m,a,function(D,q){z.addFeatures(D),l!==void 0&&l(D)},M||ac)}}var Pu=class extends nn{constructor(i,u,m){super(i),this.feature=u,this.features=m}},Sv=class extends dd{constructor(i){i=i||{},super({attributions:i.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:i.wrapX!==void 0?i.wrapX:!0}),this.on,this.once,this.un,this.loader_=ac,this.format_=i.format,this.overlaps_=i.overlaps===void 0?!0:i.overlaps,this.url_=i.url,i.loader!==void 0?this.loader_=i.loader:this.url_!==void 0&&(zr(this.format_,7),this.loader_=wv(this.url_,this.format_)),this.strategy_=i.strategy!==void 0?i.strategy:W1;let u=i.useSpatialIndex!==void 0?i.useSpatialIndex:!0;this.featuresRtree_=u?new zf:null,this.loadedExtentsRtree_=new zf,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let m,a;Array.isArray(i.features)?a=i.features:i.features&&(m=i.features,a=m.getArray()),!u&&m===void 0&&(m=new dh(a)),a!==void 0&&this.addFeaturesInternal(a),m!==void 0&&this.bindFeaturesCollection_(m)}addFeature(i){this.addFeatureInternal(i),this.changed()}addFeatureInternal(i){let u=Tr(i);if(!this.addToIndex_(u,i)){this.featuresCollection_&&this.featuresCollection_.remove(i);return}this.setupChangeEvents_(u,i);let m=i.getGeometry();if(m){let a=m.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(a,i)}else this.nullGeometryFeatures_[u]=i;this.dispatchEvent(new Pu(ts.ADDFEATURE,i))}setupChangeEvents_(i,u){this.featureChangeKeys_[i]=[so(u,cn.CHANGE,this.handleFeatureChange_,this),so(u,Np.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(i,u){let m=!0,a=u.getId();return a!==void 0&&(a.toString()in this.idIndex_?m=!1:this.idIndex_[a.toString()]=u),m&&(zr(!(i in this.uidIndex_),30),this.uidIndex_[i]=u),m}addFeatures(i){this.addFeaturesInternal(i),this.changed()}addFeaturesInternal(i){let u=[],m=[],a=[];for(let l=0,M=i.length;l<M;l++){let z=i[l],D=Tr(z);this.addToIndex_(D,z)&&m.push(z)}for(let l=0,M=m.length;l<M;l++){let z=m[l],D=Tr(z);this.setupChangeEvents_(D,z);let q=z.getGeometry();if(q){let V=q.getExtent();u.push(V),a.push(z)}else this.nullGeometryFeatures_[D]=z}if(this.featuresRtree_&&this.featuresRtree_.load(u,a),this.hasListener(ts.ADDFEATURE))for(let l=0,M=m.length;l<M;l++)this.dispatchEvent(new Pu(ts.ADDFEATURE,m[l]))}bindFeaturesCollection_(i){let u=!1;this.addEventListener(ts.ADDFEATURE,function(m){u||(u=!0,i.push(m.feature),u=!1)}),this.addEventListener(ts.REMOVEFEATURE,function(m){u||(u=!0,i.remove(m.feature),u=!1)}),i.addEventListener(Es.ADD,m=>{u||(u=!0,this.addFeature(m.element),u=!1)}),i.addEventListener(Es.REMOVE,m=>{u||(u=!0,this.removeFeature(m.element),u=!1)}),this.featuresCollection_=i}clear(i){if(i){for(let m in this.featureChangeKeys_)this.featureChangeKeys_[m].forEach(Po);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){let m=a=>{this.removeFeatureInternal(a)};this.featuresRtree_.forEach(m);for(let a in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[a])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let u=new Pu(ts.CLEAR);this.dispatchEvent(u),this.changed()}forEachFeature(i){if(this.featuresRtree_)return this.featuresRtree_.forEach(i);this.featuresCollection_&&this.featuresCollection_.forEach(i)}forEachFeatureAtCoordinateDirect(i,u){let m=[i[0],i[1],i[0],i[1]];return this.forEachFeatureInExtent(m,function(a){if(a.getGeometry().intersectsCoordinate(i))return u(a)})}forEachFeatureInExtent(i,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(i,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)}forEachFeatureIntersectingExtent(i,u){return this.forEachFeatureInExtent(i,function(m){if(m.getGeometry().intersectsExtent(i)){let l=u(m);if(l)return l}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let i;return this.featuresCollection_?i=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(i=this.featuresRtree_.getAll(),Gl(this.nullGeometryFeatures_)||Ya(i,Object.values(this.nullGeometryFeatures_))),i}getFeaturesAtCoordinate(i){let u=[];return this.forEachFeatureAtCoordinateDirect(i,function(m){u.push(m)}),u}getFeaturesInExtent(i,u){if(this.featuresRtree_){if(!(u&&u.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(i);let a=Jx(i,u);return[].concat(...a.map(l=>this.featuresRtree_.getInExtent(l)))}else if(this.featuresCollection_)return this.featuresCollection_.getArray().slice(0);return[]}getClosestFeatureToCoordinate(i,u){let m=i[0],a=i[1],l=null,M=[NaN,NaN],z=1/0,D=[-1/0,-1/0,1/0,1/0];return u=u||Gm,this.featuresRtree_.forEachInExtent(D,function(q){if(u(q)){let V=q.getGeometry(),de=z;if(z=V.closestPointXY(m,a,M,z),z<de){l=q;let pe=Math.sqrt(z);D[0]=m-pe,D[1]=a-pe,D[2]=m+pe,D[3]=a+pe}}}),l}getExtent(i){return this.featuresRtree_.getExtent(i)}getFeatureById(i){let u=this.idIndex_[i.toString()];return u!==void 0?u:null}getFeatureByUid(i){let u=this.uidIndex_[i];return u!==void 0?u:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(i){let u=i.target,m=Tr(u),a=u.getGeometry();if(!a)m in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[m]=u);else{let M=a.getExtent();m in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[m],this.featuresRtree_&&this.featuresRtree_.insert(M,u)):this.featuresRtree_&&this.featuresRtree_.update(M,u)}let l=u.getId();if(l!==void 0){let M=l.toString();this.idIndex_[M]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[M]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[m]=u;this.changed(),this.dispatchEvent(new Pu(ts.CHANGEFEATURE,u))}hasFeature(i){let u=i.getId();return u!==void 0?u in this.idIndex_:Tr(i)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Gl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(i,u,m){let a=this.loadedExtentsRtree_,l=this.strategy_(i,u,m);for(let M=0,z=l.length;M<z;++M){let D=l[M];a.forEachInExtent(D,function(V){return lc(V.extent,D)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Pu(ts.FEATURESLOADSTART)),this.loader_.call(this,D,u,m,V=>{--this.loadingExtentsCount_,this.dispatchEvent(new Pu(ts.FEATURESLOADEND,void 0,V))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Pu(ts.FEATURESLOADERROR))}),a.insert(D,{extent:D.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(i){let u=this.loadedExtentsRtree_,m;u.forEachInExtent(i,function(a){if(Qm(a.extent,i))return m=a,!0}),m&&u.remove(m)}removeFeature(i){if(!i)return;let u=Tr(i);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(i),this.removeFeatureInternal(i)&&this.changed()}removeFeatureInternal(i){let u=Tr(i),m=this.featureChangeKeys_[u];if(!m)return;m.forEach(Po),delete this.featureChangeKeys_[u];let a=i.getId();return a!==void 0&&delete this.idIndex_[a.toString()],delete this.uidIndex_[u],this.dispatchEvent(new Pu(ts.REMOVEFEATURE,i)),i}removeFromIdIndex_(i){let u=!1;for(let m in this.idIndex_)if(this.idIndex_[m]===i){delete this.idIndex_[m],u=!0;break}return u}setLoader(i){this.loader_=i}setUrl(i){zr(this.format_,7),this.url_=i,this.setLoader(wv(i,this.format_))}},ep=Sv;var _h=class extends nn{constructor(i,u){super(i),this.layer=u}},Ev={LAYERS:"layers"},Df=class extends mg{constructor(i){i=i||{};let u=Object.assign({},i);delete u.layers;let m=i.layers;super(u),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Ev.LAYERS,this.handleLayersChanged_),m?Array.isArray(m)?m=new dh(m.slice(),{unique:!0}):zr(typeof m.getArray=="function",43):m=new dh(void 0,{unique:!0}),this.setLayers(m)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Po),this.layersListenerKeys_.length=0;let i=this.getLayers();this.layersListenerKeys_.push(so(i,Es.ADD,this.handleLayersAdd_,this),so(i,Es.REMOVE,this.handleLayersRemove_,this));for(let m in this.listenerKeys_)this.listenerKeys_[m].forEach(Po);nh(this.listenerKeys_);let u=i.getArray();for(let m=0,a=u.length;m<a;m++){let l=u[m];this.registerLayerListeners_(l),this.dispatchEvent(new _h("addlayer",l))}this.changed()}registerLayerListeners_(i){let u=[so(i,Np.PROPERTYCHANGE,this.handleLayerChange_,this),so(i,cn.CHANGE,this.handleLayerChange_,this)];i instanceof Df&&u.push(so(i,"addlayer",this.handleLayerGroupAdd_,this),so(i,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Tr(i)]=u}handleLayerGroupAdd_(i){this.dispatchEvent(new _h("addlayer",i.layer))}handleLayerGroupRemove_(i){this.dispatchEvent(new _h("removelayer",i.layer))}handleLayersAdd_(i){let u=i.element;this.registerLayerListeners_(u),this.dispatchEvent(new _h("addlayer",u)),this.changed()}handleLayersRemove_(i){let u=i.element,m=Tr(u);this.listenerKeys_[m].forEach(Po),delete this.listenerKeys_[m],this.dispatchEvent(new _h("removelayer",u)),this.changed()}getLayers(){return this.get(Ev.LAYERS)}setLayers(i){let u=this.getLayers();if(u){let m=u.getArray();for(let a=0,l=m.length;a<l;++a)this.dispatchEvent(new _h("removelayer",m[a]))}this.set(Ev.LAYERS,i)}getLayersArray(i){return i=i!==void 0?i:[],this.getLayers().forEach(function(u){u.getLayersArray(i)}),i}getLayerStatesArray(i){let u=i!==void 0?i:[],m=u.length;this.getLayers().forEach(function(M){M.getLayerStatesArray(u)});let a=this.getLayerState(),l=a.zIndex;!i&&a.zIndex===void 0&&(l=0);for(let M=m,z=u.length;M<z;M++){let D=u[M];D.opacity*=a.opacity,D.visible=D.visible&&a.visible,D.maxResolution=Math.min(D.maxResolution,a.maxResolution),D.minResolution=Math.max(D.minResolution,a.minResolution),D.minZoom=Math.max(D.minZoom,a.minZoom),D.maxZoom=Math.min(D.maxZoom,a.maxZoom),a.extent!==void 0&&(D.extent!==void 0?D.extent=Xx(D.extent,a.extent):D.extent=a.extent),D.zIndex===void 0&&(D.zIndex=l)}return u}getSourceState(){return"ready"}},Tv=Df;var Js={SINGLECLICK:"singleclick",CLICK:cn.CLICK,DBLCLICK:cn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Iv={ACTIVE:"active"};var Cv=class extends lo{constructor(i){super(),this.on,this.once,this.un,i&&i.handleEvent&&(this.handleEvent=i.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Iv.ACTIVE)}getMap(){return this.map_}handleEvent(i){return!0}setActive(i){this.set(Iv.ACTIVE,i)}setMap(i){this.map_=i}};var X1=Cv;var Av=class extends X1{constructor(i){i=i||{},super(i),i.handleDownEvent&&(this.handleDownEvent=i.handleDownEvent),i.handleDragEvent&&(this.handleDragEvent=i.handleDragEvent),i.handleMoveEvent&&(this.handleMoveEvent=i.handleMoveEvent),i.handleUpEvent&&(this.handleUpEvent=i.handleUpEvent),i.stopDown&&(this.stopDown=i.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(i){return!1}handleDragEvent(i){}handleEvent(i){if(!i.originalEvent)return!0;let u=!1;if(this.updateTrackedPointers_(i),this.handlingDownUpSequence){if(i.type==Js.POINTERDRAG)this.handleDragEvent(i),i.originalEvent.preventDefault();else if(i.type==Js.POINTERUP){let m=this.handleUpEvent(i);this.handlingDownUpSequence=m&&this.targetPointers.length>0}}else if(i.type==Js.POINTERDOWN){let m=this.handleDownEvent(i);this.handlingDownUpSequence=m,u=this.stopDown(m)}else i.type==Js.POINTERMOVE&&this.handleMoveEvent(i);return!u}handleMoveEvent(i){}handleUpEvent(i){return!1}stopDown(i){return i}updateTrackedPointers_(i){i.activePointers&&(this.targetPointers=i.activePointers)}};var $1=Av;var K1=function(v){let i=v.originalEvent;return i.altKey&&!(i.metaKey||i.ctrlKey)&&!i.shiftKey};var H1=Gm,Y1=function(v){return v.type==Js.CLICK};var J1=function(v){return v.type==Js.SINGLECLICK};var Q1=function(v){let i=v.originalEvent;return zr(i!==void 0,56),i.isPrimary&&i.button===0};var eb=0,Ff=1,tb=[0,0,0,0],fd=[],Mv={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},Of=class extends nn{constructor(i,u,m){super(i),this.features=u,this.mapBrowserEvent=m}},Pv=class extends $1{constructor(i){super(i),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=i.condition?i.condition:Q1,this.defaultDeleteCondition_=function(m){return K1(m)&&J1(m)},this.deleteCondition_=i.deleteCondition?i.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=i.insertVertexCondition?i.insertVertexCondition:H1,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new zf,this.pixelTolerance_=i.pixelTolerance!==void 0?i.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Qh({source:new ep({useSpatialIndex:!1,wrapX:!!i.wrapX}),style:i.style?i.style:O2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let u;if(i.features?u=i.features:i.source&&(this.source_=i.source,u=new dh(this.source_.getFeatures()),this.source_.addEventListener(ts.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(ts.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!u)throw new Error("The modify interaction requires features, a source or a layer");i.hitDetection&&(this.hitDetection_=i.hitDetection),this.features_=u,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(Es.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(Es.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=i.snapToPointer===void 0?!this.hitDetection_:i.snapToPointer}addFeature_(i){let u=i.getGeometry();if(u){let a=this.SEGMENT_WRITERS_[u.getType()];a&&a(i,u)}let m=this.getMap();m&&m.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,m),i.addEventListener(cn.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(i,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new dh;let m=this.featuresBeingModified_.getArray();for(let a=0,l=u.length;a<l;++a){let M=u[a];for(let z=0,D=M.length;z<D;++z){let q=M[z].feature;q&&!m.includes(q)&&this.featuresBeingModified_.push(q)}}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new Of(Mv.MODIFYSTART,this.featuresBeingModified_,i))}}removeFeature_(i){this.removeFeatureSegmentData_(i),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),i.removeEventListener(cn.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(i){let u=this.rBush_,m=[];u.forEach(function(a){i===a.feature&&m.push(a)});for(let a=m.length-1;a>=0;--a){let l=m[a];for(let M=this.dragSegments_.length-1;M>=0;--M)this.dragSegments_[M][0]===l&&this.dragSegments_.splice(M,1);u.remove(l)}}setActive(i){this.vertexFeature_&&!i&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(i)}setMap(i){this.overlay_.setMap(i),super.setMap(i)}getOverlay(){return this.overlay_}handleSourceAdd_(i){i.feature&&this.features_.push(i.feature)}handleSourceRemove_(i){i.feature&&this.features_.remove(i.feature)}handleFeatureAdd_(i){this.addFeature_(i.element)}handleFeatureChange_(i){if(!this.changingFeature_){let u=i.target;this.removeFeature_(u),this.addFeature_(u)}}handleFeatureRemove_(i){this.removeFeature_(i.element)}writePointGeometry_(i,u){let m=u.getCoordinates(),a={feature:i,geometry:u,segment:[m,m]};this.rBush_.insert(u.getExtent(),a)}writeMultiPointGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length;a<l;++a){let M=m[a],z={feature:i,geometry:u,depth:[a],index:a,segment:[M,M]};this.rBush_.insert(u.getExtent(),z)}}writeLineStringGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length-1;a<l;++a){let M=m.slice(a,a+2),z={feature:i,geometry:u,index:a,segment:M};this.rBush_.insert(bu(M),z)}}writeMultiLineStringGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length;a<l;++a){let M=m[a];for(let z=0,D=M.length-1;z<D;++z){let q=M.slice(z,z+2),V={feature:i,geometry:u,depth:[a],index:z,segment:q};this.rBush_.insert(bu(q),V)}}}writePolygonGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length;a<l;++a){let M=m[a];for(let z=0,D=M.length-1;z<D;++z){let q=M.slice(z,z+2),V={feature:i,geometry:u,depth:[a],index:z,segment:q};this.rBush_.insert(bu(q),V)}}}writeMultiPolygonGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length;a<l;++a){let M=m[a];for(let z=0,D=M.length;z<D;++z){let q=M[z];for(let V=0,de=q.length-1;V<de;++V){let pe=q.slice(V,V+2),Ie={feature:i,geometry:u,depth:[z,a],index:V,segment:pe};this.rBush_.insert(bu(pe),Ie)}}}}writeCircleGeometry_(i,u){let m=u.getCenter(),a={feature:i,geometry:u,index:eb,segment:[m,m]},l={feature:i,geometry:u,index:Ff,segment:[m,m]},M=[a,l];a.featureSegments=M,l.featureSegments=M,this.rBush_.insert(Xp(m),a);let z=u,D=Su();if(D&&this.getMap()){let q=this.getMap().getView().getProjection();z=z.clone().transform(D,q),z=l_(z).transform(q,D)}this.rBush_.insert(z.getExtent(),l)}writeGeometryCollectionGeometry_(i,u){let m=u.getGeometriesArray();for(let a=0;a<m.length;++a){let l=m[a],M=this.SEGMENT_WRITERS_[l.getType()];M(i,l)}}createOrUpdateVertexFeature_(i,u,m){let a=this.vertexFeature_;return a?a.getGeometry().setCoordinates(i):(a=new Tu(new xa(i)),this.vertexFeature_=a,this.overlay_.getSource().addFeature(a)),a.set("features",u),a.set("geometries",m),a}handleEvent(i){if(!i.originalEvent)return!0;this.lastPointerEvent_=i;let u;return!i.map.getView().getInteracting()&&i.type==Js.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(i),this.vertexFeature_&&this.deleteCondition_(i)&&(i.type!=Js.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),i.type==Js.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(i)&&!u}handleDragEvent(i){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(i,this.dragSegments_);let u=[i.coordinate[0]+this.delta_[0],i.coordinate[1]+this.delta_[1]],m=[],a=[];for(let l=0,M=this.dragSegments_.length;l<M;++l){let z=this.dragSegments_[l],D=z[0],q=D.feature;m.includes(q)||m.push(q);let V=D.geometry;a.includes(V)||a.push(V);let de=D.depth,pe,Ie=D.segment,Ne=z[1];for(;u.length<V.getStride();)u.push(Ie[Ne][u.length]);switch(V.getType()){case"Point":pe=u,Ie[0]=u,Ie[1]=u;break;case"MultiPoint":pe=V.getCoordinates(),pe[D.index]=u,Ie[0]=u,Ie[1]=u;break;case"LineString":pe=V.getCoordinates(),pe[D.index+Ne]=u,Ie[Ne]=u;break;case"MultiLineString":pe=V.getCoordinates(),pe[de[0]][D.index+Ne]=u,Ie[Ne]=u;break;case"Polygon":pe=V.getCoordinates(),pe[de[0]][D.index+Ne]=u,Ie[Ne]=u;break;case"MultiPolygon":pe=V.getCoordinates(),pe[de[1]][de[0]][D.index+Ne]=u,Ie[Ne]=u;break;case"Circle":if(Ie[0]=u,Ie[1]=u,D.index===eb)this.changingFeature_=!0,V.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;let nt=i.map.getView().getProjection(),we=Xy(Ro(V.getCenter(),nt),Ro(u,nt)),Pe=Su();if(Pe){let et=V.clone().transform(Pe,nt);et.setRadius(we),we=et.transform(nt,Pe).getRadius()}V.setRadius(we),this.changingFeature_=!1}break;default:}pe&&this.setGeometryCoordinates_(V,pe)}this.createOrUpdateVertexFeature_(u,m,a)}handleDownEvent(i){if(!this.condition_(i))return!1;let u=i.coordinate;this.handlePointerAtPixel_(i.pixel,i.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;let m=this.vertexFeature_;if(m){let a=i.map.getView().getProjection(),l=[],M=m.getGeometry().getCoordinates(),z=bu([M]),D=this.rBush_.getInExtent(z),q={};D.sort(F2);for(let V=0,de=D.length;V<de;++V){let pe=D[V],Ie=pe.segment,Ne=Tr(pe.geometry),nt=pe.depth;if(nt&&(Ne+="-"+nt.join("-")),q[Ne]||(q[Ne]=new Array(2)),pe.geometry.getType()==="Circle"&&pe.index===Ff){let we=rb(u,pe,a);es(we,M)&&!q[Ne][0]&&(this.dragSegments_.push([pe,0]),q[Ne][0]=pe);continue}if(es(Ie[0],M)&&!q[Ne][0]){this.dragSegments_.push([pe,0]),q[Ne][0]=pe;continue}if(es(Ie[1],M)&&!q[Ne][1]){if(q[Ne][0]&&q[Ne][0].index===0){let we=pe.geometry.getCoordinates();switch(pe.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":we=we[nt[1]];case"Polygon":if(pe.index!==we[nt[0]].length-2)continue;break;default:}}this.dragSegments_.push([pe,1]),q[Ne][1]=pe;continue}Tr(Ie)in this.vertexSegments_&&!q[Ne][0]&&!q[Ne][1]&&this.insertVertexCondition_(i)&&l.push(pe)}l.length&&this.willModifyFeatures_(i,[l]);for(let V=l.length-1;V>=0;--V)this.insertVertex_(l[V],M)}return!!this.vertexFeature_}handleUpEvent(i){for(let u=this.dragSegments_.length-1;u>=0;--u){let m=this.dragSegments_[u][0],a=m.geometry;if(a.getType()==="Circle"){let l=a.getCenter(),M=m.featureSegments[0],z=m.featureSegments[1];M.segment[0]=l,M.segment[1]=l,z.segment[0]=l,z.segment[1]=l,this.rBush_.update(Xp(l),M);let D=a,q=Su();if(q){let V=i.map.getView().getProjection();D=D.clone().transform(q,V),D=l_(D).transform(V,q)}this.rBush_.update(D.getExtent(),z)}else this.rBush_.update(bu(m.segment),m)}return this.featuresBeingModified_&&(this.dispatchEvent(new Of(Mv.MODIFYEND,this.featuresBeingModified_,i)),this.featuresBeingModified_=null),!1}handlePointerMove_(i){this.lastPixel_=i.pixel,this.handlePointerAtPixel_(i.pixel,i.map,i.coordinate)}handlePointerAtPixel_(i,u,m){let a=m||u.getCoordinateFromPixel(i),l=u.getView().getProjection(),M=function(q,V){return ib(a,q,l)-ib(a,V,l)},z,D;if(this.hitDetection_){let q=typeof this.hitDetection_=="object"?V=>V===this.hitDetection_:void 0;u.forEachFeatureAtPixel(i,(V,de,pe)=>{let Ie=pe||V.getGeometry();if(Ie.getType()==="Point"&&V instanceof Tu&&this.features_.getArray().includes(V)){D=Ie;let Ne=D.getFlatCoordinates().slice(0,2);z=[{feature:V,geometry:D,segment:[Ne,Ne]}]}return!0},{layerFilter:q})}if(!z){let q=Eu(Xp(a,tb),l),V=u.getView().getResolution()*this.pixelTolerance_,de=lh(_l(q,V,tb),l);z=this.rBush_.getInExtent(de)}if(z&&z.length>0){let q=z.sort(M)[0],V=q.segment,de=rb(a,q,l),pe=u.getPixelFromCoordinate(de),Ie=Xy(i,pe);if(D||Ie<=this.pixelTolerance_){let Ne={};if(Ne[Tr(V)]=!0,this.snapToPointer_||(this.delta_[0]=de[0]-a[0],this.delta_[1]=de[1]-a[1]),q.geometry.getType()==="Circle"&&q.index===Ff)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(de,[q.feature],[q.geometry]);else{let nt=u.getPixelFromCoordinate(V[0]),we=u.getPixelFromCoordinate(V[1]),Pe=Hp(pe,nt),et=Hp(pe,we);Ie=Math.sqrt(Math.min(Pe,et)),this.snappedToVertex_=Ie<=this.pixelTolerance_,this.snappedToVertex_&&(de=Pe>et?V[1]:V[0]),this.createOrUpdateVertexFeature_(de,[q.feature],[q.geometry]);let ut={};ut[Tr(q.geometry)]=!0;for(let mt=1,ct=z.length;mt<ct;++mt){let ft=z[mt].segment;if(es(V[0],ft[0])&&es(V[1],ft[1])||es(V[0],ft[1])&&es(V[1],ft[0])){let It=Tr(z[mt].geometry);It in ut||(ut[It]=!0,Ne[Tr(ft)]=!0)}else break}}this.vertexSegments_=Ne;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(i,u){let m=i.segment,a=i.feature,l=i.geometry,M=i.depth,z=i.index,D;for(;u.length<l.getStride();)u.push(0);switch(l.getType()){case"MultiLineString":D=l.getCoordinates(),D[M[0]].splice(z+1,0,u);break;case"Polygon":D=l.getCoordinates(),D[M[0]].splice(z+1,0,u);break;case"MultiPolygon":D=l.getCoordinates(),D[M[1]][M[0]].splice(z+1,0,u);break;case"LineString":D=l.getCoordinates(),D.splice(z+1,0,u);break;default:return}this.setGeometryCoordinates_(l,D);let q=this.rBush_;q.remove(i),this.updateSegmentIndices_(l,z,M,1);let V={segment:[m[0],u],feature:a,geometry:l,depth:M,index:z};q.insert(bu(V.segment),V),this.dragSegments_.push([V,1]);let de={segment:[u,m[1]],feature:a,geometry:l,depth:M,index:z+1};q.insert(bu(de.segment),de),this.dragSegments_.push([de,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=Js.POINTERDRAG){let i=this.lastPointerEvent_;this.willModifyFeatures_(i,this.dragSegments_);let u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Of(Mv.MODIFYEND,this.featuresBeingModified_,i)),this.featuresBeingModified_=null,u}return!1}removeVertex_(){let i=this.dragSegments_,u={},m=!1,a,l,M,z,D,q,V,de,pe,Ie,Ne;for(D=i.length-1;D>=0;--D)M=i[D],Ie=M[0],Ne=Tr(Ie.feature),Ie.depth&&(Ne+="-"+Ie.depth.join("-")),Ne in u||(u[Ne]={}),M[1]===0?(u[Ne].right=Ie,u[Ne].index=Ie.index):M[1]==1&&(u[Ne].left=Ie,u[Ne].index=Ie.index+1);for(Ne in u){switch(pe=u[Ne].right,V=u[Ne].left,q=u[Ne].index,de=q-1,V!==void 0?Ie=V:Ie=pe,de<0&&(de=0),z=Ie.geometry,l=z.getCoordinates(),a=l,m=!1,z.getType()){case"MultiLineString":l[Ie.depth[0]].length>2&&(l[Ie.depth[0]].splice(q,1),m=!0);break;case"LineString":l.length>2&&(l.splice(q,1),m=!0);break;case"MultiPolygon":a=a[Ie.depth[1]];case"Polygon":a=a[Ie.depth[0]],a.length>4&&(q==a.length-1&&(q=0),a.splice(q,1),m=!0,q===0&&(a.pop(),a.push(a[0]),de=a.length-1));break;default:}if(m){this.setGeometryCoordinates_(z,l);let nt=[];if(V!==void 0&&(this.rBush_.remove(V),nt.push(V.segment[0])),pe!==void 0&&(this.rBush_.remove(pe),nt.push(pe.segment[1])),V!==void 0&&pe!==void 0){let we={depth:Ie.depth,feature:Ie.feature,geometry:Ie.geometry,index:de,segment:nt};this.rBush_.insert(bu(we.segment),we)}this.updateSegmentIndices_(z,q,Ie.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),i.length=0}}return m}setGeometryCoordinates_(i,u){this.changingFeature_=!0,i.setCoordinates(u),this.changingFeature_=!1}updateSegmentIndices_(i,u,m,a){this.rBush_.forEachInExtent(i.getExtent(),function(l){l.geometry===i&&(m===void 0||l.depth===void 0||xs(l.depth,m))&&l.index>u&&(l.index+=a)})}};function F2(v,i){return v.index-i.index}function ib(v,i,u){let m=i.geometry;if(m.getType()==="Circle"){let l=m;if(i.index===Ff){let M=Su();M&&(l=l.clone().transform(M,u));let z=Hp(l.getCenter(),Ro(v,u)),D=Math.sqrt(z)-l.getRadius();return D*D}}let a=Ro(v,u);return fd[0]=Ro(i.segment[0],u),fd[1]=Ro(i.segment[1],u),h0(a,fd)}function rb(v,i,u){let m=i.geometry;if(m.getType()==="Circle"&&i.index===Ff){let l=m,M=Su();return M&&(l=l.clone().transform(M,u)),Yp(l.getClosestPoint(Ro(v,u)),u)}let a=Ro(v,u);return fd[0]=Ro(i.segment[0],u),fd[1]=Ro(i.segment[1],u),Yp(Wy(a,fd),u)}function O2(){let v=g1();return function(i,u){return v.Point}}var kv=Pv;var Rv=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}getReadOptions(i,u){if(u){let m=u.dataProjection?Zo(u.dataProjection):this.readProjection(i);u.extent&&m&&m.getUnits()==="tile-pixels"&&(m=Zo(m),m.setWorldExtent(u.extent)),u={dataProjection:m,featureProjection:u.featureProjection}}return this.adaptOptions(u)}adaptOptions(i){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},i)}getType(){return Xi()}readFeature(i,u){return Xi()}readFeatures(i,u){return Xi()}readGeometry(i,u){return Xi()}readProjection(i){return Xi()}writeFeature(i,u){return Xi()}writeFeatures(i,u){return Xi()}writeGeometry(i,u){return Xi()}},nb=Rv;function Lv(v,i,u){let m=u?Zo(u.featureProjection):null,a=u?Zo(u.dataProjection):null,l;if(m&&a&&!y0(m,a)?l=(i?v.clone():v).transform(i?m:a,i?a:m):l=v,i&&u&&u.decimals!==void 0){let M=Math.pow(10,u.decimals),z=function(D){for(let q=0,V=D.length;q<V;++q)D[q]=Math.round(D[q]*M)/M;return D};l===v&&(l=v.clone()),l.applyTransform(z)}return l}var zv=class extends nb{constructor(){super()}getType(){return"json"}readFeature(i,u){return this.readFeatureFromObject(Tg(i),this.getReadOptions(i,u))}readFeatures(i,u){return this.readFeaturesFromObject(Tg(i),this.getReadOptions(i,u))}readFeatureFromObject(i,u){return Xi()}readFeaturesFromObject(i,u){return Xi()}readGeometry(i,u){return this.readGeometryFromObject(Tg(i),this.getReadOptions(i,u))}readGeometryFromObject(i,u){return Xi()}readProjection(i){return this.readProjectionFromObject(Tg(i))}readProjectionFromObject(i){return Xi()}writeFeature(i,u){return JSON.stringify(this.writeFeatureObject(i,u))}writeFeatureObject(i,u){return Xi()}writeFeatures(i,u){return JSON.stringify(this.writeFeaturesObject(i,u))}writeFeaturesObject(i,u){return Xi()}writeGeometry(i,u){return JSON.stringify(this.writeGeometryObject(i,u))}writeGeometryObject(i,u){return Xi()}};function Tg(v){if(typeof v=="string"){let i=JSON.parse(v);return i||null}else if(v!==null)return v;return null}var ob=zv;var Dv=class extends ob{constructor(i){i=i||{},super(),this.dataProjection=Zo(i.dataProjection?i.dataProjection:"EPSG:4326"),i.featureProjection&&(this.defaultFeatureProjection=Zo(i.featureProjection)),this.geometryName_=i.geometryName,this.extractGeometryName_=i.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(i,u){let m=null;i.type==="Feature"?m=i:m={type:"Feature",geometry:i,properties:null};let a=Fv(m.geometry,u),l=new Tu;return this.geometryName_?l.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in m!==void 0&&l.setGeometryName(m.geometry_name),l.setGeometry(a),"id"in m&&l.setId(m.id),m.properties&&l.setProperties(m.properties,!0),l}readFeaturesFromObject(i,u){let m=i,a=null;if(m.type==="FeatureCollection"){let l=i;a=[];let M=l.features;for(let z=0,D=M.length;z<D;++z)a.push(this.readFeatureFromObject(M[z],u))}else a=[this.readFeatureFromObject(i,u)];return a}readGeometryFromObject(i,u){return Fv(i,u)}readProjectionFromObject(i){let u=i.crs,m;return u?u.type=="name"?m=Zo(u.properties.name):u.type==="EPSG"?m=Zo("EPSG:"+u.properties.code):zr(!1,36):m=this.dataProjection,m}writeFeatureObject(i,u){u=this.adaptOptions(u);let m={type:"Feature",geometry:null,properties:null},a=i.getId();if(a!==void 0&&(m.id=a),!i.hasProperties())return m;let l=i.getProperties(),M=i.getGeometry();return M&&(m.geometry=Ov(M,u),delete l[i.getGeometryName()]),Gl(l)||(m.properties=l),m}writeFeaturesObject(i,u){u=this.adaptOptions(u);let m=[];for(let a=0,l=i.length;a<l;++a)m.push(this.writeFeatureObject(i[a],u));return{type:"FeatureCollection",features:m}}writeGeometryObject(i,u){return Ov(i,this.adaptOptions(u))}};function Fv(v,i){if(!v)return null;let u;switch(v.type){case"Point":{u=U2(v);break}case"LineString":{u=V2(v);break}case"Polygon":{u=q2(v);break}case"MultiPoint":{u=j2(v);break}case"MultiLineString":{u=N2(v);break}case"MultiPolygon":{u=G2(v);break}case"GeometryCollection":{u=B2(v);break}default:throw new Error("Unsupported GeoJSON type: "+v.type)}return Lv(u,!1,i)}function B2(v,i){let u=v.geometries.map(function(m){return Fv(m,i)});return new C0(u)}function U2(v){return new xa(v.coordinates)}function V2(v){return new Wl(v.coordinates)}function N2(v){return new U0(v.coordinates)}function j2(v){return new hg(v.coordinates)}function G2(v){return new Z0(v.coordinates)}function q2(v){return new mf(v.coordinates)}function Ov(v,i){v=Lv(v,!0,i);let u=v.getType(),m;switch(u){case"Point":{m=H2(v,i);break}case"LineString":{m=W2(v,i);break}case"Polygon":{m=Y2(v,i);break}case"MultiPoint":{m=$2(v,i);break}case"MultiLineString":{m=X2(v,i);break}case"MultiPolygon":{m=K2(v,i);break}case"GeometryCollection":{m=Z2(v,i);break}case"Circle":{m={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+u)}return m}function Z2(v,i){return i=Object.assign({},i),delete i.featureProjection,{type:"GeometryCollection",geometries:v.getGeometriesArray().map(function(m){return Ov(m,i)})}}function W2(v,i){return{type:"LineString",coordinates:v.getCoordinates()}}function X2(v,i){return{type:"MultiLineString",coordinates:v.getCoordinates()}}function $2(v,i){return{type:"MultiPoint",coordinates:v.getCoordinates()}}function K2(v,i){let u;return i&&(u=i.rightHanded),{type:"MultiPolygon",coordinates:v.getCoordinates(u)}}function H2(v,i){return{type:"Point",coordinates:v.getCoordinates()}}function Y2(v,i){let u;return i&&(u=i.rightHanded),{type:"Polygon",coordinates:v.getCoordinates(u)}}var Sl=Dv;var Ig,J2=new Uint8Array(16);function Bv(){if(!Ig&&(Ig=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ig))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ig(J2)}var wa=[];for(let v=0;v<256;++v)wa.push((v+256).toString(16).slice(1));function ab(v,i=0){return(wa[v[i+0]]+wa[v[i+1]]+wa[v[i+2]]+wa[v[i+3]]+"-"+wa[v[i+4]]+wa[v[i+5]]+"-"+wa[v[i+6]]+wa[v[i+7]]+"-"+wa[v[i+8]]+wa[v[i+9]]+"-"+wa[v[i+10]]+wa[v[i+11]]+wa[v[i+12]]+wa[v[i+13]]+wa[v[i+14]]+wa[v[i+15]]).toLowerCase()}var Q2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Uv={randomUUID:Q2};function eS(v,i,u){if(Uv.randomUUID&&!i&&!v)return Uv.randomUUID();v=v||{};let m=v.random||(v.rng||Bv)();if(m[6]=m[6]&15|64,m[8]=m[8]&63|128,i){u=u||0;for(let a=0;a<16;++a)i[u+a]=m[a];return i}return ab(m)}var Vv=eS;var tp=class extends lo{constructor(u={}){super();this.properties={};this.options={};this.defineProperties(u),u.properties&&this.setProperties(u.properties),this.options=u,this.visible=u.visible===void 0?!0:!!u.visible,this.group=u.group,this.copyrights=u.copyrights,this.children=u.children,this.on("change:visible:group",m=>{this.group===m.target.group&&this!==m.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(a=>a.dispatchEvent(m))})}defineProperties(u={}){let{name:m,key:a,properties:l,hitTolerance:M}={...u},z=Vv();Object.defineProperties(this,{name:{value:m},key:{value:a||m||z},group:{get:()=>this.get("group"),set:D=>{this.set("group",D)}},copyrights:{get:()=>this.get("copyrights"),set:D=>{let q=D&&!Array.isArray(D)?[D]:D;this.set("copyrights",q||[])}},options:{value:u},map:{writable:!0},visible:{get:()=>this.get("visible"),set:D=>{if(D!==this.visible)if(this.set("visible",D),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(q=>q.visible)&&this.children.forEach(q=>{q.visible=!0}),this.parent&&this.group){let q=this.parent;for(;q.parent;)q=q.parent;let V=new nn("change:visible:group");V.target=this,q.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(q=>{q.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(q=>q.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:D=>{this.set("disabled",D)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:D=>{(this.children||[]).forEach(q=>{q.parent=void 0}),Array.isArray(D)&&D.forEach(q=>{q.parent=this}),this.set("children",D||[])}},hitTolerance:{value:M||5,writable:!0},properties:{value:{...l||{}}}})}attachToMap(u){this.detachFromMap(),this.map=u,this.children&&this.children.forEach(m=>{m.attachToMap(u)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(u,m){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:u})}flat(){return Yd(this)}};function tS(v){return class extends v{constructor(u={}){super(u);let{userInteractions:m=!0,userClickInteractions:a=!0,userHoverInteractions:l=!0,defaultUserInteractions:M=!0}=u;this.userInteractions=m,this.userClickInteractions=a,this.userHoverInteractions=l,this.defaultUserInteractions=M,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:D}=u;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&D&&this.onHover(D)}attachToMap(u){super.attachToMap(u),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(u=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:m,layer:a,coordinate:l,event:M}})=>{u(m,a,l,M)}))}),this.userHoverCallbacks.forEach(u=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:m,layer:a,coordinate:l,event:M}})=>{u(m,a,l,M)}))})}unlistenEvents(){Ja(this.userClickEventsKeys),Ja(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(u){this.userClickCallbacks.push(u),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(u){this.userHoverCallbacks.push(u),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(u){let m=this.userClickCallbacks.indexOf(u);m===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(m,1),this.map&&this.listenEvents())}unHover(u){let m=this.userHoverCallbacks.indexOf(u);m===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(m,1),this.map&&this.listenEvents())}onUserClickCallback(u){let m=u.coordinate||co(u.lngLat.toArray()),a={features:[],layer:this,coordinate:m,event:u};return this.getFeatureInfoAtCoordinate(m).then(l=>{let M=new nn("user:click");return M.target=l,this.dispatchEvent(M),l}).catch(()=>a)}onUserMoveCallback(u){let m=u.coordinate||co(u.lngLat.toArray()),a={features:[],layer:this,coordinate:m,event:u};return this.getFeatureInfoAtCoordinate(m).then(l=>{let M=new nn("user:hover");return M.target=l,this.dispatchEvent(M),l}).catch(()=>a)}activateUserInteractions(){}deactivateUserInteractions(){}}}var Cg=tS;var Bf=class extends Cg(tp){constructor(u){super(u);this.olLayer?.setVisible(this.visible)}defineProperties(u){super.defineProperties(u),Object.defineProperties(this,{olLayer:{value:u.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(u){if(super.attachToMap(u),!!this.map&&(this.olLayer?.setVisible(this.visible),this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.on("change:minZoom",()=>{this.olLayer&&this.get("minZoom")&&this.olLayer.setMinZoom(this.get("minZoom"))})),this.olListenersKeys.push(this.on("change:maxZoom",()=>{this.olLayer&&this.get("maxZoom")&&this.olLayer.setMaxZoom(this.get("maxZoom"))})),this.olListenersKeys.push(this.map.getLayers().on("remove",m=>{m.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let m=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(a=>{a.getSource&&a.getSource()?.setAttributions(m)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(m)}}detachFromMap(){this.deactivateUserInteractions(),Ja(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ja([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(u){return new Bf({...this.options,...u})}},As=Bf;var sb=new Cs({radius:6,fill:new ba({color:[255,0,0,1]}),stroke:new Wo({color:[0,0,0,1],width:1})}),iS=new Fa({stroke:new Wo({color:[0,0,0,1],width:5})}),rS=new Fa({image:sb,stroke:new Wo({color:[255,0,0,1],width:3})}),nS=new Fa({image:sb,stroke:new Wo({color:[255,0,0,1],width:3,lineDash:[1,10]})}),oS=(v,i)=>{let u=v.get("minResolution"),m=v.get("maxResolution"),a=i<=u&&i>m;return u&&m&&!a?[]:v.get("mot")!=="foot"?[iS,rS]:[nS]},Uf=class extends As{constructor(u){super(u);this.options={};this.olLayer=u.olLayer||new Qh({source:new ep,style:u.style||oS})}clone(u){return new Uf({...this.options,...u})}},Ag=Uf;var aS=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,lb=/^([\d.]+),([\d.]+)$/,ub=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,Mg="stop-fetch",cb=v=>{let i=[];return v.forEach(u=>{let m=u.getGeometry()?.getCoordinates();m?.length&&i.push(...m)}),i},Vf=class extends ad{constructor(u={}){super(u);this.viaPoints=[];this.loading=!1;this.graphs=[];this.modify=!0;this.useRawViaPoints=!1;this.snapToClosestStation=!1;this.cacheStationData={};this.abortControllers={};this.segments=[];this.format=new Sl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:m=>{m&&(this.set("mot",m),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:m=>{this.set("loading",m)}},modify:{get:()=>this.get("modify"),set:m=>{this.set("modify",m)}}}),this.loading=!1,this.graphs=u.graphs||[["osm",0,99]],this.mot=u.mot||"bus",this.modify=u.modify!==!1,this.routingApiParams=u.routingApiParams,this.useRawViaPoints=u.useRawViaPoints||!1,this.snapToClosestStation=u.snapToClosestStation||!1,this.apiKey=u.apiKey,this.stopsApiKey=u.stopsApiKey||this.apiKey,this.stopsApiUrl=u.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Xd({...u}),this.routingLayer=u.routingLayer||new Ag({name:"routing-layer",style:u.style}),this.onRouteError=u.onRouteError||(m=>{this.dispatchEvent(new nn("change:route")),this.reset(),console.error(m)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(u,m){let a=m.getView();return u.map(([,l,M])=>[a.getResolutionForZoom(l),a.getResolutionForZoom(M||l+1)])}addViaPoint(u,m=-1,a=0){this.viaPoints.splice(m===-1?this.viaPoints.length:m,a,u),this.drawRoute(),this.dispatchEvent(new nn("change:route"))}removeViaPoint(u=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[u]&&this.viaPoints.splice(u,1),this.drawRoute(),this.dispatchEvent(new nn("change:route"))}setViaPoints(u){this.viaPoints=[...u],this.drawRoute(),this.dispatchEvent(new nn("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new nn("change:route"))}abortRequests(){this.graphs.forEach(u=>{let m=u[0];this.abortControllers[m]&&this.abortControllers[m].abort(),this.abortControllers[m]=new AbortController}),this.abortControllers[Mg]?.abort(),this.abortControllers[Mg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer?.olLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[Mg]);let u=this.viaPoints.map(m=>{if(Array.isArray(m)){let a=this.map?.getView().getProjection(),[l,M]=sh(m,a);return this.snapToClosestStation?[`@${M}`,l]:[M,l]}return this.useRawViaPoints?m:`!${m}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((m,a)=>this.drawViaPoint(m,a,this.abortControllers[Mg])),Promise.all(this.graphs.map(([m],a)=>{let{signal:l}=this.abortControllers[m];return this.api?this.api.route({graph:m,via:`${u.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:l}).then(M=>{if(this.segments=this.format.readFeatures(M),this.mot==="foot"){let q=this.segments.reduce((V,de)=>{let pe=de.get("trg");return V.find(Ie=>Ie[0]===pe[0]&&Ie[1]===pe[1])?V:[...V,pe]},[]);this.segments=q.map(V=>{let de=this.segments.filter(Ie=>{let Ne=Ie.get("trg");return Ne[0]===V[0]&&Ne[1]===V[1]}),pe=cb(de);return new Tu({geometry:new Wl(pe)})})}let z=cb(this.segments),D=new Tu({geometry:new Wl(z)});D.set("graph",m),D.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[a]?.length>=2&&(D.set("minResolution",this.graphsResolutions[a][0]),D.set("maxResolution",this.graphsResolutions[a][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(D),this.loading=!1}).catch(M=>{M.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new nn("error")),this.onRouteError(M,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(u,m,a){let l=new Tu;if(l.set("viaPointIdx",m),Array.isArray(u))return l.setGeometry(new xa(u)),this.routingLayer?.olLayer?.getSource()?.addFeature(l),Promise.resolve(l);if(!this.useRawViaPoints||ub.test(u)){let V,de;return this.useRawViaPoints?[,V,,de]=ub.exec(u)||[]:[V,de]=u.split("$"),fetch(`${this.stopsApiUrl}lookup/${V}?key=${this.stopsApiKey}`,{signal:a.signal}).then(pe=>pe.json()).then(pe=>{let{coordinates:Ie}=pe.features[0].geometry;return this.cacheStationData[u]=co(Ie),l.set("viaPointTrack",de),l.setGeometry(new xa(co(Ie))),this.routingLayer?.olLayer?.getSource()?.addFeature(l),l}).catch(pe=>{pe.name!=="AbortError"&&(this.dispatchEvent(new nn("error")),this.onRouteError(pe,this),this.loading=!1)})}if(this.useRawViaPoints&&lb.test(u)){let[V,de]=lb.exec(u)||[];if(de&&V){let pe=parseFloat(de),Ie=parseFloat(V),Ne=co([pe,Ie],this.map?.getView().getProjection());return l.setGeometry(new xa(Ne)),this.routingLayer?.olLayer?.getSource()?.addFeature(l),Promise.resolve(l)}}let[,M,,z,D,,q]=aS.exec(u)||[];if(D&&z){let V=co([parseFloat(D),parseFloat(z)],this.map?.getView().getProjection());return l.set("viaPointTrack",q),l.setGeometry(new xa(V)),this.routingLayer?.olLayer?.getSource()?.addFeature(l),Promise.resolve(l)}return M?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${M}&limit=1`,{signal:a.signal}).then(V=>V.json()).then(V=>{let{coordinates:de}=V.features[0].geometry;return this.cacheStationData[u]=co(de),l.set("viaPointTrack",q),l.setGeometry(new xa(co(de))),this.routingLayer?.olLayer?.getSource()?.addFeature(l),l}).catch(V=>(this.dispatchEvent(new nn("error")),this.onRouteError(V,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(u){let a=u.target.getFeaturesAtPixel(u.pixel).find(l=>l.getGeometry()?.getType()==="Point"&&l.get("viaPointIdx")!==void 0);if(a){this.removeViaPoint(a.get("viaPointIdx"));return}this.addViaPoint(u.coordinate)}onModifyStart(u){let m=-1,a=u.features.getArray().find(M=>M.getGeometry()?.getType()==="LineString");if(a&&a.getGeometry()&&u.mapBrowserEvent.coordinate){let M=_l(new xa(a.getGeometry()?.getClosestPoint(u.mapBrowserEvent.coordinate)).getExtent(),.001);m=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(M))}let l=(u.features.getArray().filter(M=>M.getGeometry()?.getType()==="Point")||[])[0];this.initialRouteDrag={viaPoint:l,oldRoute:a&&a.clone(),segmentIndex:m}}onModifyEnd(u){let m=u.mapBrowserEvent.coordinate,{oldRoute:a,viaPoint:l,segmentIndex:M}=this.initialRouteDrag||{};return l?this.addViaPoint(m,l.get("viaPointIdx"),1):a?M===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(m,(M||0)+1):this.addViaPoint(m,0,1)}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new kv({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:u=>{let a=u.target.getFeaturesAtPixel(u.pixel,{hitTolerance:5}).find(l=>l.getGeometry()?.getType()==="Point"&&l.get("index"));return Y1(u)&&a?(this.removeViaPoint(a.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){this.modify&&(this.removeListeners(),this.onMapClickKey=this.map?.on("singleclick",this.onMapClick))}removeListeners(){this.onMapClickKey&&Ja(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new Sl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Vf.getGraphsResolutions(this.graphs,this.map),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.routingLayer?.attachToMap(this.map),this.modifyInteraction&&this.map.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}deactivate(){this.map&&(this.routingLayer?.detachFromMap(),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}render(){}},hb=Vf;var Nv=class extends ad{constructor(u){super(u);let{apiParams:m,apiKey:a,url:l,placeholder:M}=u||{};this.apiParams={limit:20,...m||{}},this.placeholder=M||"Search for a stop...";let z={apiKey:a};l&&(z.url=l),this.api=new $d(z),this.abortController=new AbortController}deactivate(){}render(u){let m=u?.features||[];this.suggestionsElt&&(this.suggestionsElt.style.display=m.length?"block":"none",this.suggestionsElt.innerHTML="",m.forEach(a=>{let l=document.createElement("div");l.innerHTML=a?.properties?.name,l.onclick=()=>{this.onSuggestionClick(a)},Object.assign(l.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(l)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=u=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(u.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(u,m){return(u!==void 0||u!==null)&&(this.apiParams.q=u),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,m&&{signal:m.signal}).then(a=>{this.render(a)}).catch(()=>{this.render()})}onSuggestionClick(u){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},pb=Nv;var jv=class extends pb{onSuggestionClick(i){let u=co(i.geometry.coordinates);this.map.getView().setCenter(u)}},db=jv;var mb=Vp(fb());var Zv=class extends As{constructor(u){super(u);this.olLayer=new Kh({source:new dd({}),render:this.getOlLayerRender()}),this.styleUrl=u.url,this.apiKey=u.apiKey,this.apiKeyName=u.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(u){super.attachToMap(u),this.map&&(this.format=new Sl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let u=document.createElement("div");if(u.style.position="absolute",u.style.width="100%",u.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let m=this.getMapboxMapClass();this.mbMap=new m({style:Gh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:u,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new nn("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(u){let m=sc(u.target)||[];this.copyrights?.toString()!==m.toString()&&(this.copyrights=m,this.olLayer?.getSource()?.setAttributions(m))}getFeatureInfoAtCoordinate(u,m){if(!m||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:u,features:[],layer:this});let a=u&&this.mbMap.project(sh(u)),l;if(this.hitTolerance){let{x:z,y:D}=a;l=[{x:z-this.hitTolerance,y:D-this.hitTolerance},{x:z+this.hitTolerance,y:D+this.hitTolerance}]}let M=this.mbMap.queryRenderedFeatures(l||a,m).map(z=>{let D=this.format.readFeature(z);return D&&D.set("mapboxFeature",z),D});return Promise.resolve({layer:this,features:M,coordinate:u})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let u=document.createElement("div");return()=>u}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},Pg=Zv;var ip=class extends Pg{attachToMap(u){super.attachToMap(u),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(m){console.warn(m)}}))}loadMbMap(){let[u,m]=this.map?.getView().getCenter()||[];if((!u||!m)&&(u=0,m=0),this.renderState={center:[u,m],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{this.mbMap&&(this.mbMap.resize(),this.copyrights=sc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let a=this.mbMap.getCanvas();a&&(this.options.tabIndex?a.setAttribute("tabindex",`${this.options.tabIndex}`):a.removeAttribute("tabindex"))}getOlLayerRender(){return nd(this)}getMapboxMapClass(){return mb.Map}clone(u){return new ip({...this.options,...u})}};var _b=Vp(yb());var rp=class extends Pg{getOlLayerRender(){return rd(this)}getMapboxMapClass(){return _b.Map}clone(u){return new rp({...this.options,...u})}};var Nf=class extends As{constructor(u){super(u);this.mapboxLayer=u.mapboxLayer,this.disabled=!1,this.styleLayersFilter=u.styleLayersFilter,this.beforeId=u.beforeId,this.featureInfoFilter=u.featureInfoFilter||(m=>m),this.queryRenderedLayersFilter=u.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(u.styleLayer?[u.styleLayer]:u.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),u.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof u.filters=="function"?u.filters(this):u.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=m=>!!this.styleLayers?.find(a=>m.id===a.id))}attachToMap(u){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(u),super.attachToMap(u),!this.map||!this.mapboxLayer)return;let{mbMap:m}=this.mapboxLayer;if(!m){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(u)}));return}this.mapboxLayer.loaded||m.isStyleLoaded()||m.loaded()?this.onLoad():m.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",a=>{this.applyLayoutVisibility(a)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:u}=this.mapboxLayer;u.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(m=>{let{id:a,source:l}=m;u.getSource(l)&&a&&!u.getLayer(a)&&u.addLayer(m,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(m=>{let{id:a}=m;a&&u.getLayer(a)&&u.removeLayer(a)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer,m=u.getStyle();if(m&&this.styleLayersFilter){let a=m.layers.filter(this.styleLayersFilter);this.disabled=!a.length}}getFeatureInfoAtCoordinate(u){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:u,features:[],layer:this});let{mbMap:m}=this.mapboxLayer;if(!m.isStyleLoaded())return Promise.resolve({coordinate:u,features:[],layer:this});let a=this.styleLayers||[];return this.styleLayersFilter&&(a=m.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(a=m.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(u,{layers:a.map(l=>l&&l.id),validate:!1}).then(l=>{let M=l.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(M),{...l,features:M,layer:this}})}setFilter(u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:m}=this.mapboxLayer;this.styleLayers.forEach(({id:a})=>{a&&u&&m.getLayer(a)&&m.setFilter(a,u)})}setHoverState(u,m){if(!this.mapboxLayer?.mbMap)return;let{mbMap:a}=this.mapboxLayer;!u||!a||u.forEach(l=>{let{source:M,sourceLayer:z}=l.get("mapboxFeature")||{};if(!M&&!z||!l.getId()){l.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",l.getId(),l.getProperties());return}a.setFeatureState({id:l.getId(),source:M,sourceLayer:z},{hover:m})})}select(u=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=u,this.setHoverState(this.selectedFeatures||[],!0)}highlight(u=[]){let m=this.highlightedFeatures?.filter(a=>!(this.selectedFeatures||[]).map(l=>l.getId()).includes(a.getId()))||[];this.setHoverState(m,!1),this.highlightedFeatures=u,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(u){let{visible:m}=this,a=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:l}=this.mapboxLayer,M=l.getStyle();if(M&&a){let z=m?"visible":"none",D=M.layers||[];for(let q=0;q<D.length;q+=1){let V=D[q];a(V)&&l.getLayer(V.id)&&(l.setLayoutProperty(V.id,"visibility",z),(this.get("minZoom")||this.get("maxZoom"))&&l.setLayerZoomRange(V.id,this.get("minZoom")?this.get("minZoom")-1:0,this.get("maxZoom")?this.get("maxZoom")-1:24))}}}clone(u){return new Nf({...this.options,...u})}},vb=Nf;var Yv=Vp(Sb()),Jv=Vp(Ab());function NS(v){return class extends v{constructor(m){super({hitTolerance:10,...m});this.debug=m.debug||!1,this.mode=m.mode||Go.TOPOGRAPHIC,this.api=m.api||new Hd(m),this.tenant=m.tenant||"",this.minZoomInterpolation=m.minZoomInterpolation||8,this.format=new Sl,this.onStart=m.onStart,this.onStop=m.onStop;let a=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"],l=["rail"],M=["tram","subway","rail","bus"];this.motsByZoom=m.motsByZoom||[l,l,l,l,l,l,l,l,l,M,M,a,a,a,a],this.getMotsByZoom=z=>m.getMotsByZoom&&m.getMotsByZoom(z,this.motsByZoom)||this.motsByZoom[z]||this.motsByZoom[this.motsByZoom.length-1],this.generalizationLevelByZoom=m.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=z=>m.getGeneralizationLevelByZoom&&m.getGeneralizationLevelByZoom(z,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[z],this.renderTimeIntervalByZoom=m.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=z=>m.getRenderTimeIntervalByZoom&&m.getRenderTimeIntervalByZoom(z,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[z],this.isUpdateBboxOnMoveEnd=m.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,Jv.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,Yv.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(m){let{style:a,speed:l,pixelRatio:M,hoverVehicleId:z,selectedVehicleId:D,filter:q,sort:V,time:de,live:pe,canvas:Ie,styleOptions:Ne,mode:nt}=m,we=Ie,Pe=l||1,et=de||new Date,ut=nt||Go.TOPOGRAPHIC,mt=a||$h;super.defineProperties(m),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{get:()=>(we||(we=document.createElement("canvas")),we),set:ct=>{we=ct}},mode:{get:()=>ut,set:ct=>{ct!==ut&&(ut=ct,this.api?.wsApi?.open&&(this.stop(),this.start()))}},style:{get:()=>mt,set:ct=>{mt=ct,this.renderTrajectories()}},styleOptions:{value:{...od,...Ne||{}}},speed:{get:()=>Pe,set:ct=>{Pe=ct,this.start()}},filter:{value:q,writable:!0},sort:{value:V,writable:!0},live:{value:pe===!1?pe:!0,writable:!0},time:{get:()=>et,set:ct=>{et=ct&&ct.getTime?ct:new Date(ct),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:D,writable:!0},pixelRatio:{value:M||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:m.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:m.useThrottle!==!1,writable:!0},useDebounce:{value:m.useDebounce||!1,writable:!0}})}attachToMap(m){super.attachToMap(m),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",a=>{a.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ja(this.visibilityRef),this.canvas){let m=this.canvas.getContext("2d");m&&m.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap()}}start(){this.stop(),this.purgeOutOfDateTrajectories(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.onStart&&this.onStart(this)}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close(),this.onStop&&this.onStop(this)}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(m,a=!1){if(!this.map||!this.trajectories)return!1;let l=this.live?Date.now():this.time?.getTime(),M=Object.values(this.trajectories);return this.sort&&M.sort(this.sort),!this.canvas||!this.style||(this.renderState=gf(this.canvas,M,this.style,{...m,pixelRatio:this.pixelRatio||1,time:l},{filter:this.filter,noInterpolate:(m.zoom||0)<this.minZoomInterpolation?!0:a,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(m,a){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),m&&(!a&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(m,a)}):!a&&this.useDebounce?this.debounceRenderTrajectories(m,a):!a&&this.useThrottle?this.throttleRenderTrajectories(m,a):this.renderTrajectoriesInternal(m,a))}setBbox(m,a){if(this.trajectories&&m&&a){let M=Object.keys(this.trajectories);for(let z=M.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[M[z]],m,a)}if(!m)return;let l=[...m];this.isUpdateBboxOnMoveEnd&&a&&(l.push(a),this.generalizationLevel=this.getGeneralizationLevelByZoom(a),this.generalizationLevel&&l.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(a),this.mots&&l.push(`mots=${this.mots}`)),this.tenant&&l.push(`tenant=${this.tenant}`),this.api.bbox=l}getRefreshTimeInMs(m=0){let a=m!==void 0?Math.round(m):-1,l=this.getRenderTimeIntervalByZoom(a)||25,M=Math.max(25,l/(this.speed||1)),z=Math.min(M,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,Jv.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,Yv.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,D]=this.api.buffer;this.api.buffer=[z,D]}return M}getVehicle(m){return this.trajectories&&Object.values(this.trajectories).filter(m)||[]}getFeatureInfoAtCoordinate(m,a){let{resolution:l,nb:M}=a,z=_l([...m,...m],this.hitTolerance*l),D=Object.values(this.trajectories||{});this.sort&&(D=D.sort(this.sort));let q=[];for(let V=0;V<D.length&&(D[V].properties.coordinate&&Ym(z,D[V].properties.coordinate)&&q.push(D[V]),q.length!==M);V+=1);return Promise.resolve({layer:this,features:q.map(V=>this.format.readFeature(V)),coordinate:m})}getTrajectoryInfos(m){let a=[this.api.getStopSequence(m),this.api.getFullTrajectory(m,this.mode,this.generalizationLevel)];return Promise.all(a).then(([l,M])=>({stopSequence:l,fullTrajectory:M}))}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([m,a])=>{let l=a?.properties?.time_intervals;this.time&&l.length&&l[l.length-1][0]<this.time&&this.removeTrajectory(m)})}purgeTrajectory(m,a,l){let{type:M,bounds:z}=m.properties;return this.isUpdateBboxOnMoveEnd&&!uo(a,z)||this.mots&&!this.mots.includes(M)?(this.removeTrajectory(m),!0):!1}addTrajectory(m){this.filter&&!this.filter(m)||(this.trajectories||(this.trajectories={}),this.trajectories[m.properties.train_id]=m,this.renderTrajectories())}removeTrajectory(m){let a;typeof m!="string"?a=m?.properties?.train_id:a=m,this.trajectories&&delete this.trajectories[a]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){this.visible&&(document.hidden?(this.stop(),this.trajectories={}):this.start())}onTrajectoryMessage(m){if(!m.content)return;let a=m.content,{geometry:l,properties:{train_id:M,time_since_update:z,raw_coordinates:D}}=a;z<0||this.purgeTrajectory(a)||(this.debug&&this.mode===Go.TOPOGRAPHIC&&D?a.properties.olGeometry=this.format.readGeometry({type:"Point",coordinates:co(D,this.map.getView().getProjection())}):a.properties.olGeometry=this.format.readGeometry(l),a.properties.timeOffset=Date.now()-m.timestamp,this.addTrajectory(a))}onDeleteTrajectoryMessage(m){m.content&&this.removeTrajectory(m.content)}onFeatureHover(m,a,l){let[M]=m,z=null;M&&(z=M.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(m,a,l){let[M]=m,z=null;M&&(z=M.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=M,this.renderTrajectories(!0))}}}var Rg=NS;var jS=new Fa({zIndex:2,image:new Cs({radius:5,fill:new ba({color:"#000000"})}),stroke:new Wo({color:"#000000",width:6})}),GS=(v,i,u)=>{let m="#ffffff",a=v.get("type"),l=v.get("stroke");return l&&l[0]!=="#"&&(l=`#${l}`),m=l||u?.getBgColor(a),m=/#ffffff/i.test(m)?"#ff0000":m,[jS,new Fa({zIndex:3,image:new Cs({radius:4,fill:new ba({color:m})}),stroke:new Wo({color:m,width:4})})]},Lg=GS;var qS=new Fa({zIndex:2,image:new Cs({radius:5,fill:new ba({color:"#000000"})}),stroke:new Wo({color:"#000000",width:6})}),ZS=new Fa({zIndex:3,image:new Cs({radius:4,fill:new ba({color:"#a0a0a0"})}),stroke:new Wo({color:"#a0a0a0",width:4})}),WS=()=>[qS,ZS],Mb=WS;var XS=new Sl,jf=class extends Rg(As){constructor(u){super({...u});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!u.allowRenderWhenAnimating,this.olLayer=u.olLayer||new Tv({layers:[new Qh({source:new ep({features:[]}),style:(m,a)=>(u.fullTrajectoryStyle||Lg)(m,a,this.styleOptions)}),new Kh({source:new dd({}),render:m=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:a,resolution:l,rotation:M}=m.viewState,{center:z,resolution:D,rotation:q}=this.renderedViewState;if(D/l>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let V=this.map.getPixelFromCoordinate(z),de=this.map.getPixelFromCoordinate(a);this.transformContainer.style.transform=Nx(V[0]-de[0],V[1]-de[1],D/l,D/l,M-q,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(u){super.attachToMap(u),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],m=>{let a=(m.map||m.target).getView();if(a.getAnimating()||a.getInteracting())return;let l=a.getZoom();this.currentZoom!==l&&this.onZoomEnd(),this.currentZoom=l,this.onMoveEnd(m)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(u){if(this.map&&this.canvas){let m=this.canvas.getContext("2d",{willReadFrequently:!0}),a=this.map.getPixelFromCoordinate(u);return!!m?.getImageData(a[0]*(this.pixelRatio||1),a[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(u){if(!this.map)return;let m=this.map.getView();m.getCenter()&&super.renderTrajectories({size:this.map.getSize(),center:m.getCenter(),extent:m.calculateExtent(),resolution:m.getResolution(),rotation:m.getRotation(),zoom:m.getZoom(),pixelRatio:this.pixelRatio},u)}renderTrajectoriesInternal(u,m){if(!this.map)return!1;let a=!1;return a=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(u,m),a&&(this.renderedViewState={...u},this.transformContainer&&(this.transformContainer.style.transform="")),a}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(u,m={}){if(!this.map||!this.map.getView())return Promise.resolve({layer:this,features:[],coordinate:u});let a=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(u,{resolution:a,...m})}onMoveEnd(u){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onFeatureHover(u,m,a){super.onFeatureHover(u,m,a),this.map.getTargetElement().style.cursor=u.length?"pointer":"auto"}onFeatureClick(u,m,a){super.onFeatureClick(u,m,a),!u.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(u,m,a){let l=this.map.getView().getCenter();return!m&&!l?!1:super.purgeTrajectory(u,m||this.map.getView().calculateExtent(),a||this.map.getView().getZoom())}setBbox(u,m){let a=u,l=m;!a&&this.isUpdateBboxOnMoveEnd&&(a=u||this.map.getView().calculateExtent(),l=Math.floor(this.map.getView().getZoom())),super.setBbox(a,l)}highlightTrajectory(u){return this.api.getFullTrajectory(u,this.mode,this.generalizationLevel).then(m=>{let a=m.content;if(this.vectorLayer.getSource().clear(),!a||!a.features||!a.features.length)return;let l=XS.readFeatures(a);return this.vectorLayer.getSource().addFeatures(l),l})}clone(u){return new jf({...this.options,...u})}},Pb=jf;var Gf=class extends As{getFeatureInfoAtCoordinate(i){let u=[];if(this.map){let m=this.map.getPixelFromCoordinate(i);u=this.map.getFeaturesAtPixel(m,{layerFilter:a=>a===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:u,layer:this,coordinate:i})}clone(i){return new Gf({...this.options,...i})}},kb=Gf;var qf=class extends As{constructor(u){super(u);this.abortController=new AbortController,this.format=new Sl}getFeatureInfoUrl(u){if(!this.map)return;let m=this.map.getView().getProjection(),a=this.map.getView().getResolution();if(a&&m&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(u,a,m,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(u){this.abortController?.abort(),this.abortController=new AbortController;let{signal:m}=this.abortController,a=this.getFeatureInfoUrl(u);return a?fetch(a,{signal:m}).then(l=>l.json()).then(l=>l.features).then(l=>({layer:this,coordinate:u,features:l.map(M=>this.format.readFeature(M))})).catch(()=>Promise.resolve({features:[],coordinate:u,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:u,layer:this}))}clone(u){return new qf({...this.options,...u})}},Rb=qf;var Bg={};wy(Bg,{CopyrightControl:()=>Lb,Layer:()=>Dg,RealtimeAPI:()=>Hd,RealtimeLayer:()=>Xb,RealtimeModes:()=>Go,RoutingAPI:()=>Xd,StopsAPI:()=>$d,compareDepartures:()=>yf,createCanvas:()=>Xl,createRealtimeFilters:()=>ky,debounceDeparturesMessages:()=>u_,debounceWebsocketMessages:()=>Kd,getCircleCanvas:()=>y_,getDelayBgCanvas:()=>m_,getDelayTextCanvas:()=>g_,getHoursAndMinutes:()=>Fx,getLayersAsFlatArray:()=>Yd,getMapboxMapCopyrights:()=>sc,getMapboxRender:()=>nd,getMaplibreRender:()=>rd,getMercatorResolution:()=>Og,getSourceCoordinates:()=>Xf,getTextCanvas:()=>__,getUTCDateString:()=>zx,getUTCTimeString:()=>Dx,getUrlWithParams:()=>Gh,pad:()=>$m,realtimeConfig:()=>od,realtimeDefaultStyle:()=>$h,realtimeDelayStyle:()=>v_,realtimeSimpleStyle:()=>x_,removeDuplicate:()=>qh,renderTrajectories:()=>gf,sortAndFilterDepartures:()=>_f,sortByDelay:()=>Ry});var Qv=class extends yg{constructor(i){super(i),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return sc(this.map)}},Lb=Qv;var Zf=class extends Cg(tp){attachToMap(u){super.attachToMap(u),this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ja(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let u=this.map.getBounds().toArray();return rf([...u[0],...u[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(u){return new Zf({...this.options,...u})}},Dg=Zf;var Xo=63710088e-1,zb={centimeters:Xo*100,centimetres:Xo*100,degrees:Xo/111325,feet:Xo*3.28084,inches:Xo*39.37,kilometers:Xo/1e3,kilometres:Xo/1e3,meters:Xo,metres:Xo,miles:Xo/1609.344,millimeters:Xo*1e3,millimetres:Xo*1e3,nauticalmiles:Xo/1852,radians:1,yards:Xo*1.0936},GB={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/Xo,yards:1.0936133};function Db(v,i,u){u===void 0&&(u={});var m={type:"Feature"};return(u.id===0||u.id)&&(m.id=u.id),u.bbox&&(m.bbox=u.bbox),m.properties=i||{},m.geometry=v,m}function vh(v,i,u){if(u===void 0&&(u={}),!v)throw new Error("coordinates is required");if(!Array.isArray(v))throw new Error("coordinates must be an Array");if(v.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ex(v[0])||!ex(v[1]))throw new Error("coordinates must contain numbers");var m={type:"Point",coordinates:v};return Db(m,i,u)}function $S(v,i){i===void 0&&(i="kilometers");var u=zb[i];if(!u)throw new Error(i+" units is invalid");return v*u}function KS(v,i){i===void 0&&(i="kilometers");var u=zb[i];if(!u)throw new Error(i+" units is invalid");return v/u}function Fb(v){var i=v%(2*Math.PI);return i*180/Math.PI}function np(v){var i=v%360;return i*Math.PI/180}function Fg(v,i,u){if(i===void 0&&(i="kilometers"),u===void 0&&(u="kilometers"),!(v>=0))throw new Error("length must be a positive number");return $S(KS(v,i),u)}function ex(v){return!isNaN(v)&&v!==null&&!Array.isArray(v)}function tx(v){return!!v&&v.constructor===Object}function Wf(v,i,u){if(v!==null)for(var m,a,l,M,z,D,q,V=0,de=0,pe,Ie=v.type,Ne=Ie==="FeatureCollection",nt=Ie==="Feature",we=Ne?v.features.length:1,Pe=0;Pe<we;Pe++){q=Ne?v.features[Pe].geometry:nt?v.geometry:v,pe=q?q.type==="GeometryCollection":!1,z=pe?q.geometries.length:1;for(var et=0;et<z;et++){var ut=0,mt=0;if(M=pe?q.geometries[et]:q,M!==null){D=M.coordinates;var ct=M.type;switch(V=u&&(ct==="Polygon"||ct==="MultiPolygon")?1:0,ct){case null:break;case"Point":if(i(D,de,Pe,ut,mt)===!1)return!1;de++,ut++;break;case"LineString":case"MultiPoint":for(m=0;m<D.length;m++){if(i(D[m],de,Pe,ut,mt)===!1)return!1;de++,ct==="MultiPoint"&&ut++}ct==="LineString"&&ut++;break;case"Polygon":case"MultiLineString":for(m=0;m<D.length;m++){for(a=0;a<D[m].length-V;a++){if(i(D[m][a],de,Pe,ut,mt)===!1)return!1;de++}ct==="MultiLineString"&&ut++,ct==="Polygon"&&mt++}ct==="Polygon"&&ut++;break;case"MultiPolygon":for(m=0;m<D.length;m++){for(mt=0,a=0;a<D[m].length;a++){for(l=0;l<D[m][a].length-V;l++){if(i(D[m][a][l],de,Pe,ut,mt)===!1)return!1;de++}mt++}ut++}break;case"GeometryCollection":for(m=0;m<M.geometries.length;m++)if(Wf(M.geometries[m],i,u)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function HS(v,i){i===void 0&&(i={});var u=0,m=0,a=0;return Wf(v,function(l){u+=l[0],m+=l[1],a++},!0),vh([u/a,m/a],i.properties)}var Ob=HS;function ku(v){if(!v)throw new Error("coord is required");if(!Array.isArray(v)){if(v.type==="Feature"&&v.geometry!==null&&v.geometry.type==="Point")return v.geometry.coordinates;if(v.type==="Point")return v.coordinates}if(Array.isArray(v)&&v.length>=2&&!Array.isArray(v[0])&&!Array.isArray(v[1]))return v;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Bb(v){if(Array.isArray(v))return v;if(v.type==="Feature"){if(v.geometry!==null)return v.geometry.coordinates}else if(v.coordinates)return v.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function YS(v,i,u){u===void 0&&(u={});var m;u.final?m=Ub(ku(i),ku(v)):m=Ub(ku(v),ku(i));var a=m>180?-(360-m):m;return a}function Ub(v,i){var u=np(v[1]),m=np(i[1]),a=np(i[0]-v[0]);a>Math.PI&&(a-=2*Math.PI),a<-Math.PI&&(a+=2*Math.PI);var l=Math.log(Math.tan(m/2+Math.PI/4)/Math.tan(u/2+Math.PI/4)),M=Math.atan2(a,l);return(Fb(M)+360)%360}var Vb=YS;function JS(v,i,u){u===void 0&&(u={});var m=ku(v),a=ku(i);a[0]+=a[0]-m[0]>180?-360:m[0]-a[0]>180?360:0;var l=QS(m,a),M=Fg(l,"meters",u.units);return M}function QS(v,i,u){u=u===void 0?Xo:Number(u);var m=u,a=v[1]*Math.PI/180,l=i[1]*Math.PI/180,M=l-a,z=Math.abs(i[0]-v[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var D=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(a/2+Math.PI/4)),q=Math.abs(D)>1e-11?M/D:Math.cos(a),V=Math.sqrt(M*M+q*q*z*z),de=V*m;return de}var Nb=JS;function eE(v,i,u,m){m===void 0&&(m={});var a=i<0,l=Fg(Math.abs(i),m.units,"meters");a&&(l=-Math.abs(l));var M=ku(v),z=tE(M,l,u);return z[0]+=z[0]-M[0]>180?-360:M[0]-z[0]>180?360:0,vh(z,m.properties)}function tE(v,i,u,m){m=m===void 0?Xo:Number(m);var a=i/m,l=v[0]*Math.PI/180,M=np(v[1]),z=np(u),D=a*Math.cos(z),q=M+D;Math.abs(q)>Math.PI/2&&(q=q>0?Math.PI-q:-Math.PI-q);var V=Math.log(Math.tan(q/2+Math.PI/4)/Math.tan(M/2+Math.PI/4)),de=Math.abs(V)>1e-11?D/V:Math.cos(M),pe=a*Math.sin(z)/de,Ie=l+pe;return[(Ie*180/Math.PI+540)%360-180,q*180/Math.PI]}var jb=eE;function iE(v){if(!v)throw new Error("geojson is required");switch(v.type){case"Feature":return Gb(v);case"FeatureCollection":return rE(v);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ix(v);default:throw new Error("unknown GeoJSON type")}}function Gb(v){var i={type:"Feature"};return Object.keys(v).forEach(function(u){switch(u){case"type":case"properties":case"geometry":return;default:i[u]=v[u]}}),i.properties=qb(v.properties),i.geometry=ix(v.geometry),i}function qb(v){var i={};return v&&Object.keys(v).forEach(function(u){var m=v[u];typeof m=="object"?m===null?i[u]=null:Array.isArray(m)?i[u]=m.map(function(a){return a}):i[u]=qb(m):i[u]=m}),i}function rE(v){var i={type:"FeatureCollection"};return Object.keys(v).forEach(function(u){switch(u){case"type":case"features":return;default:i[u]=v[u]}}),i.features=v.features.map(function(u){return Gb(u)}),i}function ix(v){var i={type:v.type};return v.bbox&&(i.bbox=v.bbox),v.type==="GeometryCollection"?(i.geometries=v.geometries.map(function(u){return ix(u)}),i):(i.coordinates=Zb(v.coordinates),i)}function Zb(v){var i=v;return typeof i[0]!="object"?i.slice():i.map(function(u){return Zb(u)})}var Wb=iE;function nE(v,i,u){if(u=u||{},!tx(u))throw new Error("options is invalid");var m=u.pivot,a=u.mutate;if(!v)throw new Error("geojson is required");if(i==null||isNaN(i))throw new Error("angle is required");return i===0||(m||(m=Ob(v)),(a===!1||a===void 0)&&(v=Wb(v)),Wf(v,function(l){var M=Vb(m,l),z=M+i,D=Nb(m,l),q=Bb(jb(m,D,z));l[0]=q[0],l[1]=q[1]})),v}var rx=nE;var oE=(v,i=1)=>{let{width:u,height:m}=v.getCanvas(),a=v.unproject({x:0,y:0}),l=v.unproject({x:0,y:m/i}),M=v.unproject({x:u/i,y:m/i}),z=v.unproject({x:u/i,y:0});return[[a.lng,a.lat],[z.lng,z.lat],[M.lng,M.lat],[l.lng,l.lat]]},Xf=oE;var aE=v=>{let i=v.getBounds().toArray(),u=co(i[0]),m=co(i[1]),a=[...u,...m],{width:l,height:M}=v.getCanvas(),z=bo(a)/l,D=vl(a)/M;return Math.max(z,D)},Og=aE;var nx=class extends Rg(Dg){constructor(i={}){super({...i}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(i,u){i&&(super.attachToMap(i),this.source={type:"canvas",canvas:this.canvas,coordinates:Xf(i,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=u,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},i.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(i=>{Ja(i)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(i){super.onUserMoveCallback({coordinate:co(i.lngLat.toArray()),...i})}renderTrajectories(i=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:u,height:m}=this.map.getCanvas(),a=this.map.getCenter(),l=this.map.unproject({x:0,y:m/this.pixelRatio}),M=this.map.unproject({x:u/this.pixelRatio,y:0}),z=rx(vh([l.lng,l.lat]),-this.map.getBearing(),{pivot:[a.lng,a.lat]}).geometry.coordinates,D=rx(vh([M.lng,M.lat]),-this.map.getBearing(),{pivot:[a.lng,a.lat]}).geometry.coordinates,q=[...co(z),...co(D)],V=bo(q)/(u/this.pixelRatio),de=vl(q)/(m/this.pixelRatio),pe=Math.max(V,de),Ie={size:[u/this.pixelRatio,m/this.pixelRatio],center:co([a.lng,a.lat]),extent:q,resolution:pe,zoom:this.getOlZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Ie,i)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(i,u={}){let m=Og(this.map);return super.getFeatureInfoAtCoordinate(i,{resolution:m,...u})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(i,u,m){return super.purgeTrajectory(i,u||this.getMercatorExtent(),m||Math.floor(this.getOlZoom()))}setBbox(i,u){let m=i,a=u;!m&&this.isUpdateBboxOnMoveEnd&&(m=i||this.getMercatorExtent(),a=Math.floor(this.getOlZoom())),super.setBbox(m,a)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(i,u=!1){let m=super.renderTrajectoriesInternal(i,u);if(m&&this.map.style){let a=Xf(this.map,this.pixelRatio),l=this.map.getSource(this.key);l&&l.setCoordinates(a)}return m}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(i,u,m){super.onFeatureHover(i,u,m),this.map.getCanvasContainer().style.cursor=i.length?"pointer":"auto"}},Xb=nx;var ox={ol:zg,mapbox:Bg};typeof window<"u"&&(window.mbt=ox);var q5=ox;})();
1083
+ `){$t+=Ii,Ii=0,Qt=pe*mt+zt*Ie,++Jt;continue}let jr=Ne[ni+1]||D.font;jr!==Ei&&(a&&Vt.push("font",jr),m&&mi.push("font",jr),Ei=jr),Ii=Math.max(Ii,et[ci]);let Ht=[Bi,Qt+zt*Pe[ci]+pe*(Pe[ci]-ut[Jt]),.5*(Ie+Ii)+$t];Qt+=Pe[ci],a&&Vt.push("strokeText",Ht),m&&mi.push("fillText",Ht),++ci}return Array.prototype.push.apply(ct,Vt),Array.prototype.push.apply(ct,mi),this.labels_[l]=Mt,Mt}replayTextBackground_(i,u,m,a,l,M,z){i.beginPath(),i.moveTo.apply(i,u),i.lineTo.apply(i,m),i.lineTo.apply(i,a),i.lineTo.apply(i,l),i.lineTo.apply(i,u),M&&(this.alignFill_=M[2],this.fill_(i)),z&&(this.setStrokeStyle_(i,z),i.stroke())}calculateImageOrLabelDimensions_(i,u,m,a,l,M,z,D,q,V,de,pe,Ie,Ne,nt,we){z*=pe[0],D*=pe[1];let Pe=m-z,et=a-D,ut=l+q>i?i-q:l,mt=M+V>u?u-V:M,ct=Ne[3]+ut*pe[0]+Ne[1],ft=Ne[0]+mt*pe[1]+Ne[2],It=Pe-Ne[3],Mt=et-Ne[0];(nt||de!==0)&&(gh[0]=It,yh[0]=It,gh[1]=Mt,_c[1]=Mt,_c[0]=It+ct,vc[0]=_c[0],vc[1]=Mt+ft,yh[1]=vc[1]);let zt;return de!==0?(zt=Ys(Da(),m,a,1,1,de,-m,-a),qo(zt,gh),qo(zt,_c),qo(zt,vc),qo(zt,yh),uc(Math.min(gh[0],_c[0],vc[0],yh[0]),Math.min(gh[1],_c[1],vc[1],yh[1]),Math.max(gh[0],_c[0],vc[0],yh[0]),Math.max(gh[1],_c[1],vc[1],yh[1]),pd)):uc(Math.min(It,It+ct),Math.min(Mt,Mt+ft),Math.max(It,It+ct),Math.max(Mt,Mt+ft),pd),Ie&&(Pe=Math.round(Pe),et=Math.round(et)),{drawImageX:Pe,drawImageY:et,drawImageW:ut,drawImageH:mt,originX:q,originY:V,declutterBox:{minX:pd[0],minY:pd[1],maxX:pd[2],maxY:pd[3],value:we},canvasTransform:zt,scale:pe}}replayImageOrLabel_(i,u,m,a,l,M,z){let D=!!(M||z),q=a.declutterBox,V=i.canvas,de=z?z[2]*a.scale[0]/2:0;return q.minX-de<=V.width/u&&q.maxX+de>=0&&q.minY-de<=V.height/u&&q.maxY+de>=0&&(D&&this.replayTextBackground_(i,gh,_c,vc,yh,M,z),p1(i,a.canvasTransform,l,m,a.originX,a.originY,a.drawImageW,a.drawImageH,a.drawImageX,a.drawImageY,a.scale)),!0}fill_(i){if(this.alignFill_){let u=qo(this.renderedTransform_,[0,0]),m=512*this.pixelRatio;i.save(),i.translate(u[0]%m,u[1]%m),i.rotate(this.viewRotation_)}i.fill(),this.alignFill_&&i.restore()}setStrokeStyle_(i,u){i.strokeStyle=u[1],i.lineWidth=u[2],i.lineCap=u[3],i.lineJoin=u[4],i.miterLimit=u[5],i.lineDashOffset=u[7],i.setLineDash(u[6])}drawLabelWithPointPlacement_(i,u,m,a){let l=this.textStates[u],M=this.createLabel(i,u,a,m),z=this.strokeStates[m],D=this.pixelRatio,q=z1(Array.isArray(i)?i[0]:i,l.textAlign||mh),V=cd[l.textBaseline||Jh],de=z&&z.lineWidth?z.lineWidth:0,pe=M.width/D-2*l.scale[0],Ie=q*pe+2*(.5-q)*de,Ne=V*M.height/D+2*(.5-V)*de;return{label:M,anchorX:Ie,anchorY:Ne}}execute_(i,u,m,a,l,M,z,D){let q;this.pixelCoordinates_&&xs(m,this.renderedTransform_)?q=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),q=xl(this.coordinates,0,this.coordinates.length,2,m,this.pixelCoordinates_),Ux(this.renderedTransform_,m));let V=0,de=a.length,pe=0,Ie,Ne,nt,we,Pe,et,ut,mt,ct,ft,It,Mt,zt=0,Qt=0,Vt=null,mi=null,Ii=this.coordinateCache_,$t=this.viewRotation_,ci=Math.round(Math.atan2(-m[1],m[0])*1e12)/1e12,Jt={context:i,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$t},Ei=this.instructions!=a||this.overlaps?0:200,ni,Ui,Bi,jr;for(;V<de;){let Ht=a[V];switch(Ht[0]){case ji.BEGIN_GEOMETRY:ni=Ht[1],jr=Ht[3],ni.getGeometry()?z!==void 0&&!uo(z,jr.getExtent())?V=Ht[2]+1:++V:V=Ht[2];break;case ji.BEGIN_PATH:zt>Ei&&(this.fill_(i),zt=0),Qt>Ei&&(i.stroke(),Qt=0),!zt&&!Qt&&(i.beginPath(),we=NaN,Pe=NaN),++V;break;case ji.CIRCLE:pe=Ht[1];let Gr=q[pe],or=q[pe+1],on=q[pe+2],Fi=q[pe+3],Cn=on-Gr,wo=Fi-or,qr=Math.sqrt(Cn*Cn+wo*wo);i.moveTo(Gr+qr,or),i.arc(Gr,or,qr,0,2*Math.PI,!0),++V;break;case ji.CLOSE_PATH:i.closePath(),++V;break;case ji.CUSTOM:pe=Ht[1],Ie=Ht[2];let Ai=Ht[3],ho=Ht[4],Ir=Ht.length==6?Ht[5]:void 0;Jt.geometry=Ai,Jt.feature=ni,V in Ii||(Ii[V]=[]);let pr=Ii[V];Ir?Ir(q,pe,Ie,2,pr):(pr[0]=q[pe],pr[1]=q[pe+1],pr.length=2),ho(pr,Jt),++V;break;case ji.DRAW_IMAGE:pe=Ht[1],Ie=Ht[2],mt=Ht[3],Ne=Ht[4],nt=Ht[5];let Wn=Ht[6],dn=Ht[7],qi=Ht[8],Zr=Ht[9],An=Ht[10],Ln=Ht[11],zn=Ht[12],Wr=Ht[13],Dn=Ht[14],hn=Ht[15];if(!mt&&Ht.length>=20){ct=Ht[19],ft=Ht[20],It=Ht[21],Mt=Ht[22];let ue=this.drawLabelWithPointPlacement_(ct,ft,It,Mt);mt=ue.label,Ht[3]=mt;let ge=Ht[23];Ne=(ue.anchorX-ge)*this.pixelRatio,Ht[4]=Ne;let Te=Ht[24];nt=(ue.anchorY-Te)*this.pixelRatio,Ht[5]=nt,Wn=mt.height,Ht[6]=Wn,Wr=mt.width,Ht[13]=Wr}let Qn;Ht.length>25&&(Qn=Ht[25]);let bt,jt,eo;Ht.length>17?(bt=Ht[16],jt=Ht[17],eo=Ht[18]):(bt=mc,jt=!1,eo=!1),An&&ci?Ln+=$t:!An&&!ci&&(Ln-=$t);let Fn=0;for(;pe<Ie;pe+=2){if(Qn&&Qn[Fn++]<Wr/this.pixelRatio)continue;let ue=this.calculateImageOrLabelDimensions_(mt.width,mt.height,q[pe],q[pe+1],Wr,Wn,Ne,nt,qi,Zr,Ln,zn,l,bt,jt||eo,ni),ge=[i,u,mt,ue,dn,jt?Vt:null,eo?mi:null];if(D){if(Dn==="none")continue;if(Dn==="obstacle"){D.insert(ue.declutterBox);continue}else{let Te,Re;if(hn){let Xe=Ie-pe;if(!hn[Xe]){hn[Xe]=ge;continue}if(Te=hn[Xe],delete hn[Xe],Re=L1(Te),D.collides(Re))continue}if(D.collides(ue.declutterBox))continue;Te&&(D.insert(Re),this.replayImageOrLabel_.apply(this,Te)),D.insert(ue.declutterBox)}}this.replayImageOrLabel_.apply(this,ge)}++V;break;case ji.DRAW_CHARS:let Hi=Ht[1],bn=Ht[2],fn=Ht[3],mn=Ht[4];Mt=Ht[5];let So=Ht[6],Gt=Ht[7],Vi=Ht[8];It=Ht[9];let Ri=Ht[10];ct=Ht[11],ft=Ht[12];let Ur=[Ht[13],Ht[13]],wn=this.textStates[ft],bi=wn.font,Sn=[wn.scale[0]*Gt,wn.scale[1]*Gt],Pr;bi in this.widths_?Pr=this.widths_[bi]:(Pr={},this.widths_[bi]=Pr);let _r=cg(q,Hi,bn,2),ie=Math.abs(Sn[0])*N_(bi,ct,Pr);if(mn||ie<=_r){let ue=this.textStates[ft].textAlign,ge=(_r-ie)*cd[ue],Te=R1(q,Hi,bn,2,ct,ge,So,Math.abs(Sn[0]),N_,bi,Pr,ci?0:this.viewRotation_);e:if(Te){let Re=[],Xe,Ye,Se,Oe,te;if(It)for(Xe=0,Ye=Te.length;Xe<Ye;++Xe){te=Te[Xe],Se=te[4],Oe=this.createLabel(Se,ft,"",It),Ne=te[2]+(Sn[0]<0?-Ri:Ri),nt=fn*Oe.height+(.5-fn)*2*Ri*Sn[1]/Sn[0]-Vi;let W=this.calculateImageOrLabelDimensions_(Oe.width,Oe.height,te[0],te[1],Oe.width,Oe.height,Ne,nt,0,0,te[3],Ur,!1,mc,!1,ni);if(D&&D.collides(W.declutterBox))break e;Re.push([i,u,Oe,W,1,null,null])}if(Mt)for(Xe=0,Ye=Te.length;Xe<Ye;++Xe){te=Te[Xe],Se=te[4],Oe=this.createLabel(Se,ft,Mt,""),Ne=te[2],nt=fn*Oe.height-Vi;let W=this.calculateImageOrLabelDimensions_(Oe.width,Oe.height,te[0],te[1],Oe.width,Oe.height,Ne,nt,0,0,te[3],Ur,!1,mc,!1,ni);if(D&&D.collides(W.declutterBox))break e;Re.push([i,u,Oe,W,1,null,null])}D&&D.load(Re.map(L1));for(let W=0,J=Re.length;W<J;++W)this.replayImageOrLabel_.apply(this,Re[W])}}++V;break;case ji.END_GEOMETRY:if(M!==void 0){ni=Ht[1];let ue=M(ni,jr);if(ue)return ue}++V;break;case ji.FILL:Ei?zt++:this.fill_(i),++V;break;case ji.MOVE_TO_LINE_TO:for(pe=Ht[1],Ie=Ht[2],Ui=q[pe],Bi=q[pe+1],et=Ui+.5|0,ut=Bi+.5|0,(et!==we||ut!==Pe)&&(i.moveTo(Ui,Bi),we=et,Pe=ut),pe+=2;pe<Ie;pe+=2)Ui=q[pe],Bi=q[pe+1],et=Ui+.5|0,ut=Bi+.5|0,(pe==Ie-2||et!==we||ut!==Pe)&&(i.lineTo(Ui,Bi),we=et,Pe=ut);++V;break;case ji.SET_FILL_STYLE:Vt=Ht,this.alignFill_=Ht[2],zt&&(this.fill_(i),zt=0,Qt&&(i.stroke(),Qt=0)),i.fillStyle=Ht[1],++V;break;case ji.SET_STROKE_STYLE:mi=Ht,Qt&&(i.stroke(),Qt=0),this.setStrokeStyle_(i,Ht),++V;break;case ji.STROKE:Ei?Qt++:i.stroke(),++V;break;default:++V;break}}zt&&this.fill_(i),Qt&&i.stroke()}execute(i,u,m,a,l,M){this.viewRotation_=a,this.execute_(i,u,m,this.instructions,l,void 0,void 0,M)}executeHitDetection(i,u,m,a,l){return this.viewRotation_=m,this.execute_(i,1,u,this.hitDetectionInstructions,!0,a,l)}},D1=hv;var pv=["Polygon","Circle","LineString","Image","Text","Default"],fv=class{constructor(i,u,m,a,l,M){this.maxExtent_=i,this.overlaps_=a,this.pixelRatio_=m,this.resolution_=u,this.renderBuffer_=M,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Da(),this.createExecutors_(l)}clip(i,u){let m=this.getClipCoords(u);i.beginPath(),i.moveTo(m[0],m[1]),i.lineTo(m[2],m[3]),i.lineTo(m[4],m[5]),i.lineTo(m[6],m[7]),i.clip()}createExecutors_(i){for(let u in i){let m=this.executorsByZIndex_[u];m===void 0&&(m={},this.executorsByZIndex_[u]=m);let a=i[u];for(let l in a){let M=a[l];m[l]=new D1(this.resolution_,this.pixelRatio_,this.overlaps_,M)}}}hasExecutors(i){for(let u in this.executorsByZIndex_){let m=this.executorsByZIndex_[u];for(let a=0,l=i.length;a<l;++a)if(i[a]in m)return!0}return!1}forEachFeatureAtCoordinate(i,u,m,a,l,M){a=Math.round(a);let z=a*2+1,D=Ys(this.hitDetectionTransform_,a+.5,a+.5,1/u,-1/u,-m,-i[0],-i[1]),q=!this.hitDetectionContext_;q&&(this.hitDetectionContext_=aa(z,z,void 0,{willReadFrequently:!0}));let V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):q||V.clearRect(0,0,z,z);let de;this.renderBuffer_!==void 0&&(de=Qa(),Dy(de,i),_l(de,u*(this.renderBuffer_+a),de));let pe=S2(a),Ie;function Ne(ct,ft){let It=V.getImageData(0,0,z,z).data;for(let Mt=0,zt=pe.length;Mt<zt;Mt++)if(It[pe[Mt]]>0){if(!M||Ie!=="Image"&&Ie!=="Text"||M.includes(ct)){let Qt=(pe[Mt]-3)/4,Vt=a-Qt%z,mi=a-(Qt/z|0),Ii=l(ct,ft,Vt*Vt+mi*mi);if(Ii)return Ii}V.clearRect(0,0,z,z);break}}let nt=Object.keys(this.executorsByZIndex_).map(Number);nt.sort(rh);let we,Pe,et,ut,mt;for(we=nt.length-1;we>=0;--we){let ct=nt[we].toString();for(et=this.executorsByZIndex_[ct],Pe=pv.length-1;Pe>=0;--Pe)if(Ie=pv[Pe],ut=et[Ie],ut!==void 0&&(mt=ut.executeHitDetection(V,D,m,Ne,de),mt))return mt}}getClipCoords(i){let u=this.maxExtent_;if(!u)return null;let m=u[0],a=u[1],l=u[2],M=u[3],z=[m,a,m,M,l,M,l,a];return xl(z,0,8,2,i,z),z}isEmpty(){return Gl(this.executorsByZIndex_)}execute(i,u,m,a,l,M,z){let D=Object.keys(this.executorsByZIndex_).map(Number);D.sort(rh),this.maxExtent_&&(i.save(),this.clip(i,m)),M=M||pv;let q,V,de,pe,Ie,Ne;for(z&&D.reverse(),q=0,V=D.length;q<V;++q){let nt=D[q].toString();for(Ie=this.executorsByZIndex_[nt],de=0,pe=M.length;de<pe;++de){let we=M[de];Ne=Ie[we],Ne!==void 0&&Ne.execute(i,u,m,a,l,z)}}this.maxExtent_&&i.restore()}},dv={};function S2(v){if(dv[v]!==void 0)return dv[v];let i=v*2+1,u=v*v,m=new Array(u+1);for(let l=0;l<=v;++l)for(let M=0;M<=v;++M){let z=l*l+M*M;if(z>u)break;let D=m[z];D||(D=[],m[z]=D),D.push(((v+l)*i+(v+M))*4+3),l>0&&D.push(((v-l)*i+(v+M))*4+3),M>0&&(D.push(((v+l)*i+(v-M))*4+3),l>0&&D.push(((v-l)*i+(v-M))*4+3))}let a=[];for(let l=0,M=m.length;l<M;++l)m[l]&&a.push(...m[l]);return dv[v]=a,a}var mv=fv;var gv=class extends Sg{constructor(i,u,m,a,l,M,z){super(),this.context_=i,this.pixelRatio_=u,this.extent_=m,this.transform_=a,this.transformRotation_=a?l0(Math.atan2(a[1],a[0]),10):0,this.viewRotation_=l,this.squaredTolerance_=M,this.userTransform_=z,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Da()}drawImages_(i,u,m,a){if(!this.image_)return;let l=xl(i,u,m,a,this.transform_,this.pixelCoordinates_),M=this.context_,z=this.tmpLocalTransform_,D=M.globalAlpha;this.imageOpacity_!=1&&(M.globalAlpha=D*this.imageOpacity_);let q=this.imageRotation_;this.transformRotation_===0&&(q-=this.viewRotation_),this.imageRotateWithView_&&(q+=this.viewRotation_);for(let V=0,de=l.length;V<de;V+=2){let pe=l[V]-this.imageAnchorX_,Ie=l[V+1]-this.imageAnchorY_;if(q!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let Ne=pe+this.imageAnchorX_,nt=Ie+this.imageAnchorY_;Ys(z,Ne,nt,1,1,q,-Ne,-nt),M.setTransform.apply(M,z),M.translate(Ne,nt),M.scale(this.imageScale_[0],this.imageScale_[1]),M.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),M.setTransform(1,0,0,1,0,0)}else M.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,pe,Ie,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(M.globalAlpha=D)}drawText_(i,u,m,a){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let l=xl(i,u,m,a,this.transform_,this.pixelCoordinates_),M=this.context_,z=this.textRotation_;for(this.transformRotation_===0&&(z-=this.viewRotation_),this.textRotateWithView_&&(z+=this.viewRotation_);u<m;u+=a){let D=l[u]+this.textOffsetX_,q=l[u+1]+this.textOffsetY_;z!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(M.translate(D-this.textOffsetX_,q-this.textOffsetY_),M.rotate(z),M.translate(this.textOffsetX_,this.textOffsetY_),M.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&M.strokeText(this.text_,0,0),this.textFillState_&&M.fillText(this.text_,0,0),M.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&M.strokeText(this.text_,D,q),this.textFillState_&&M.fillText(this.text_,D,q))}}moveToLineTo_(i,u,m,a,l){let M=this.context_,z=xl(i,u,m,a,this.transform_,this.pixelCoordinates_);M.moveTo(z[0],z[1]);let D=z.length;l&&(D-=2);for(let q=2;q<D;q+=2)M.lineTo(z[q],z[q+1]);return l&&M.closePath(),m}drawRings_(i,u,m,a){for(let l=0,M=m.length;l<M;++l)u=this.moveToLineTo_(i,u,m[l],a,!0);return u}drawCircle(i){if(uo(this.extent_,i.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let u=S0(i,this.transform_,this.pixelCoordinates_),m=u[2]-u[0],a=u[3]-u[1],l=Math.sqrt(m*m+a*a),M=this.context_;M.beginPath(),M.arc(u[0],u[1],l,0,2*Math.PI),this.fillState_&&M.fill(),this.strokeState_&&M.stroke()}this.text_!==""&&this.drawText_(i.getCenter(),0,2,2)}}setStyle(i){this.setFillStrokeStyle(i.getFill(),i.getStroke()),this.setImageStyle(i.getImage()),this.setTextStyle(i.getText())}setTransform(i){this.transform_=i}drawGeometry(i){switch(i.getType()){case"Point":this.drawPoint(i);break;case"LineString":this.drawLineString(i);break;case"Polygon":this.drawPolygon(i);break;case"MultiPoint":this.drawMultiPoint(i);break;case"MultiLineString":this.drawMultiLineString(i);break;case"MultiPolygon":this.drawMultiPolygon(i);break;case"GeometryCollection":this.drawGeometryCollection(i);break;case"Circle":this.drawCircle(i);break;default:}}drawFeature(i,u){let m=u.getGeometryFunction()(i);!m||!uo(this.extent_,m.getExtent())||(this.setStyle(u),this.drawGeometry(m))}drawGeometryCollection(i){let u=i.getGeometriesArray();for(let m=0,a=u.length;m<a;++m)this.drawGeometry(u[m])}drawPoint(i){this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let u=i.getFlatCoordinates(),m=i.getStride();this.image_&&this.drawImages_(u,0,u.length,m),this.text_!==""&&this.drawText_(u,0,u.length,m)}drawMultiPoint(i){this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let u=i.getFlatCoordinates(),m=i.getStride();this.image_&&this.drawImages_(u,0,u.length,m),this.text_!==""&&this.drawText_(u,0,u.length,m)}drawLineString(i){if(this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!uo(this.extent_,i.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let u=this.context_,m=i.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(m,0,m.length,i.getStride(),!1),u.stroke()}if(this.text_!==""){let u=i.getFlatMidpoint();this.drawText_(u,0,2,2)}}}drawMultiLineString(i){this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let u=i.getExtent();if(uo(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let m=this.context_,a=i.getFlatCoordinates(),l=0,M=i.getEnds(),z=i.getStride();m.beginPath();for(let D=0,q=M.length;D<q;++D)l=this.moveToLineTo_(a,l,M[D],z,!1);m.stroke()}if(this.text_!==""){let m=i.getFlatMidpoints();this.drawText_(m,0,m.length,2)}}}drawPolygon(i){if(this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!uo(this.extent_,i.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let u=this.context_;u.beginPath(),this.drawRings_(i.getOrientedFlatCoordinates(),0,i.getEnds(),i.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){let u=i.getFlatInteriorPoint();this.drawText_(u,0,2,2)}}}drawMultiPolygon(i){if(this.squaredTolerance_&&(i=i.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!uo(this.extent_,i.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let u=this.context_,m=i.getOrientedFlatCoordinates(),a=0,l=i.getEndss(),M=i.getStride();u.beginPath();for(let z=0,D=l.length;z<D;++z){let q=l[z];a=this.drawRings_(m,a,q,M)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){let u=i.getFlatInteriorPoints();this.drawText_(u,0,u.length,2)}}}setContextFillState_(i){let u=this.context_,m=this.contextFillState_;m?m.fillStyle!=i.fillStyle&&(m.fillStyle=i.fillStyle,u.fillStyle=i.fillStyle):(u.fillStyle=i.fillStyle,this.contextFillState_={fillStyle:i.fillStyle})}setContextStrokeState_(i){let u=this.context_,m=this.contextStrokeState_;m?(m.lineCap!=i.lineCap&&(m.lineCap=i.lineCap,u.lineCap=i.lineCap),xs(m.lineDash,i.lineDash)||u.setLineDash(m.lineDash=i.lineDash),m.lineDashOffset!=i.lineDashOffset&&(m.lineDashOffset=i.lineDashOffset,u.lineDashOffset=i.lineDashOffset),m.lineJoin!=i.lineJoin&&(m.lineJoin=i.lineJoin,u.lineJoin=i.lineJoin),m.lineWidth!=i.lineWidth&&(m.lineWidth=i.lineWidth,u.lineWidth=i.lineWidth),m.miterLimit!=i.miterLimit&&(m.miterLimit=i.miterLimit,u.miterLimit=i.miterLimit),m.strokeStyle!=i.strokeStyle&&(m.strokeStyle=i.strokeStyle,u.strokeStyle=i.strokeStyle)):(u.lineCap=i.lineCap,u.setLineDash(i.lineDash),u.lineDashOffset=i.lineDashOffset,u.lineJoin=i.lineJoin,u.lineWidth=i.lineWidth,u.miterLimit=i.miterLimit,u.strokeStyle=i.strokeStyle,this.contextStrokeState_={lineCap:i.lineCap,lineDash:i.lineDash,lineDashOffset:i.lineDashOffset,lineJoin:i.lineJoin,lineWidth:i.lineWidth,miterLimit:i.miterLimit,strokeStyle:i.strokeStyle})}setContextTextState_(i){let u=this.context_,m=this.contextTextState_,a=i.textAlign?i.textAlign:mh;m?(m.font!=i.font&&(m.font=i.font,u.font=i.font),m.textAlign!=a&&(m.textAlign=a,u.textAlign=a),m.textBaseline!=i.textBaseline&&(m.textBaseline=i.textBaseline,u.textBaseline=i.textBaseline)):(u.font=i.font,u.textAlign=a,u.textBaseline=i.textBaseline,this.contextTextState_={font:i.font,textAlign:a,textBaseline:i.textBaseline})}setFillStrokeStyle(i,u){if(!i)this.fillState_=null;else{let m=i.getColor();this.fillState_={fillStyle:Ts(m||Is)}}if(!u)this.strokeState_=null;else{let m=u.getColor(),a=u.getLineCap(),l=u.getLineDash(),M=u.getLineDashOffset(),z=u.getLineJoin(),D=u.getWidth(),q=u.getMiterLimit(),V=l||hc;this.strokeState_={lineCap:a!==void 0?a:Yh,lineDash:this.pixelRatio_===1?V:V.map(de=>de*this.pixelRatio_),lineDashOffset:(M||pc)*this.pixelRatio_,lineJoin:z!==void 0?z:Iu,lineWidth:(D!==void 0?D:gc)*this.pixelRatio_,miterLimit:q!==void 0?q:dc,strokeStyle:Ts(m||fc)}}}setImageStyle(i){let u;if(!i||!(u=i.getSize())){this.image_=null;return}let m=i.getPixelRatio(this.pixelRatio_),a=i.getAnchor(),l=i.getOrigin();this.image_=i.getImage(this.pixelRatio_),this.imageAnchorX_=a[0]*m,this.imageAnchorY_=a[1]*m,this.imageHeight_=u[1]*m,this.imageOpacity_=i.getOpacity(),this.imageOriginX_=l[0],this.imageOriginY_=l[1],this.imageRotateWithView_=i.getRotateWithView(),this.imageRotation_=i.getRotation();let M=i.getScaleArray();this.imageScale_=[M[0]*this.pixelRatio_/m,M[1]*this.pixelRatio_/m],this.imageWidth_=u[0]*m}setTextStyle(i){if(!i)this.text_="";else{let u=i.getFill();if(!u)this.textFillState_=null;else{let Ie=u.getColor();this.textFillState_={fillStyle:Ts(Ie||Is)}}let m=i.getStroke();if(!m)this.textStrokeState_=null;else{let Ie=m.getColor(),Ne=m.getLineCap(),nt=m.getLineDash(),we=m.getLineDashOffset(),Pe=m.getLineJoin(),et=m.getWidth(),ut=m.getMiterLimit();this.textStrokeState_={lineCap:Ne!==void 0?Ne:Yh,lineDash:nt||hc,lineDashOffset:we||pc,lineJoin:Pe!==void 0?Pe:Iu,lineWidth:et!==void 0?et:gc,miterLimit:ut!==void 0?ut:dc,strokeStyle:Ts(Ie||fc)}}let a=i.getFont(),l=i.getOffsetX(),M=i.getOffsetY(),z=i.getRotateWithView(),D=i.getRotation(),q=i.getScaleArray(),V=i.getText(),de=i.getTextAlign(),pe=i.getTextBaseline();this.textState_={font:a!==void 0?a:bg,textAlign:de!==void 0?de:mh,textBaseline:pe!==void 0?pe:Jh},this.text_=V!==void 0?Array.isArray(V)?V.reduce((Ie,Ne,nt)=>Ie+=nt%2?" ":Ne,""):V:"",this.textOffsetX_=l!==void 0?this.pixelRatio_*l:0,this.textOffsetY_=M!==void 0?this.pixelRatio_*M:0,this.textRotateWithView_=z!==void 0?z:!1,this.textRotation_=D!==void 0?D:0,this.textScale_=[this.pixelRatio_*q[0],this.pixelRatio_*q[1]]}}},F1=gv;var $l=.5;function O1(v,i,u,m,a,l,M){let z=v[0]*$l,D=v[1]*$l,q=aa(z,D);q.imageSmoothingEnabled=!1;let V=q.canvas,de=new F1(q,$l,a,null,M),pe=u.length,Ie=Math.floor((256*256*256-1)/pe),Ne={};for(let we=1;we<=pe;++we){let Pe=u[we-1],et=Pe.getStyleFunction()||m;if(!m)continue;let ut=et(Pe,l);if(!ut)continue;Array.isArray(ut)||(ut=[ut]);let ct=(we*Ie).toString(16).padStart(7,"#00000");for(let ft=0,It=ut.length;ft<It;++ft){let Mt=ut[ft],zt=Mt.getGeometryFunction()(Pe);if(!zt||!uo(a,zt.getExtent()))continue;let Qt=Mt.clone(),Vt=Qt.getFill();Vt&&Vt.setColor(ct);let mi=Qt.getStroke();mi&&(mi.setColor(ct),mi.setLineDash(null)),Qt.setText(void 0);let Ii=Mt.getImage();if(Ii&&Ii.getOpacity()!==0){let Ei=Ii.getImageSize();if(!Ei)continue;let ni=aa(Ei[0],Ei[1],void 0,{alpha:!1}),Ui=ni.canvas;ni.fillStyle=ct,ni.fillRect(0,0,Ui.width,Ui.height),Qt.setImage(new Mf({img:Ui,imgSize:Ei,anchor:Ii.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:Ii.getOrigin(),opacity:1,size:Ii.getSize(),scale:Ii.getScale(),rotation:Ii.getRotation(),rotateWithView:Ii.getRotateWithView()}))}let $t=Qt.getZIndex()||0,ci=Ne[$t];ci||(ci={},Ne[$t]=ci,ci.Polygon=[],ci.Circle=[],ci.LineString=[],ci.Point=[]);let Jt=zt.getType();if(Jt==="GeometryCollection"){let Ei=zt.getGeometriesArrayRecursive();for(let ni=0,Ui=Ei.length;ni<Ui;++ni){let Bi=Ei[ni];ci[Bi.getType().replace("Multi","")].push(Bi,Qt)}}else ci[Jt.replace("Multi","")].push(zt,Qt)}}let nt=Object.keys(Ne).map(Number).sort(rh);for(let we=0,Pe=nt.length;we<Pe;++we){let et=Ne[nt[we]];for(let ut in et){let mt=et[ut];for(let ct=0,ft=mt.length;ct<ft;ct+=2){de.setStyle(mt[ct+1]);for(let It=0,Mt=i.length;It<Mt;++It)de.setTransform(i[It]),de.drawGeometry(mt[ct])}}}return q.getImageData(0,0,V.width,V.height)}function B1(v,i,u){let m=[];if(u){let a=Math.floor(Math.round(v[0])*$l),l=Math.floor(Math.round(v[1])*$l),M=(Jn(a,0,u.width-1)+Jn(l,0,u.height-1)*u.width)*4,z=u.data[M],D=u.data[M+1],V=u.data[M+2]+256*(D+256*z),de=Math.floor((256*256*256-1)/i.length);V&&V%de===0&&m.push(i[V/de-1])}return m}var E2=.5,U1={Point:k2,LineString:A2,Polygon:L2,MultiPoint:R2,MultiLineString:M2,MultiPolygon:P2,GeometryCollection:C2,Circle:T2};function V1(v,i){return parseInt(Tr(v),10)-parseInt(Tr(i),10)}function N1(v,i){let u=Eg(v,i);return u*u}function Eg(v,i){return E2*v/i}function T2(v,i,u,m,a){let l=u.getFill(),M=u.getStroke();if(l||M){let D=v.getBuilder(u.getZIndex(),"Circle");D.setFillStrokeStyle(l,M),D.drawCircle(i,m)}let z=u.getText();if(z&&z.getText()){let D=(a||v).getBuilder(u.getZIndex(),"Text");D.setTextStyle(z),D.drawText(i,m)}}function yv(v,i,u,m,a,l,M){let z=!1,D=u.getImage();if(D){let q=D.getImageState();q==Zn.LOADED||q==Zn.ERROR?D.unlistenImageChange(a):(q==Zn.IDLE&&D.load(),D.listenImageChange(a),z=!0)}return I2(v,i,u,m,l,M),z}function I2(v,i,u,m,a,l){let M=u.getGeometryFunction()(i);if(!M)return;let z=M.simplifyTransformed(m,a);if(u.getRenderer())j1(v,z,u,i);else{let q=U1[z.getType()];q(v,z,u,i,l)}}function j1(v,i,u,m){if(i.getType()=="GeometryCollection"){let l=i.getGeometries();for(let M=0,z=l.length;M<z;++M)j1(v,l[M],u,m);return}v.getBuilder(u.getZIndex(),"Default").drawCustom(i,m,u.getRenderer(),u.getHitDetectionRenderer())}function C2(v,i,u,m,a){let l=i.getGeometriesArray(),M,z;for(M=0,z=l.length;M<z;++M){let D=U1[l[M].getType()];D(v,l[M],u,m,a)}}function A2(v,i,u,m,a){let l=u.getStroke();if(l){let z=v.getBuilder(u.getZIndex(),"LineString");z.setFillStrokeStyle(null,l),z.drawLineString(i,m)}let M=u.getText();if(M&&M.getText()){let z=(a||v).getBuilder(u.getZIndex(),"Text");z.setTextStyle(M),z.drawText(i,m)}}function M2(v,i,u,m,a){let l=u.getStroke();if(l){let z=v.getBuilder(u.getZIndex(),"LineString");z.setFillStrokeStyle(null,l),z.drawMultiLineString(i,m)}let M=u.getText();if(M&&M.getText()){let z=(a||v).getBuilder(u.getZIndex(),"Text");z.setTextStyle(M),z.drawText(i,m)}}function P2(v,i,u,m,a){let l=u.getFill(),M=u.getStroke();if(M||l){let D=v.getBuilder(u.getZIndex(),"Polygon");D.setFillStrokeStyle(l,M),D.drawMultiPolygon(i,m)}let z=u.getText();if(z&&z.getText()){let D=(a||v).getBuilder(u.getZIndex(),"Text");D.setTextStyle(z),D.drawText(i,m)}}function k2(v,i,u,m,a){let l=u.getImage(),M=u.getText(),z;if(l){if(l.getImageState()!=Zn.LOADED)return;let D=v;if(a){let V=l.getDeclutterMode();if(V!=="none")if(D=a,V==="obstacle"){let de=v.getBuilder(u.getZIndex(),"Image");de.setImageStyle(l,z),de.drawPoint(i,m)}else M&&M.getText()&&(z={})}let q=D.getBuilder(u.getZIndex(),"Image");q.setImageStyle(l,z),q.drawPoint(i,m)}if(M&&M.getText()){let D=v;a&&(D=a);let q=D.getBuilder(u.getZIndex(),"Text");q.setTextStyle(M,z),q.drawText(i,m)}}function R2(v,i,u,m,a){let l=u.getImage(),M=u.getText(),z;if(l){if(l.getImageState()!=Zn.LOADED)return;let D=v;if(a){let V=l.getDeclutterMode();if(V!=="none")if(D=a,V==="obstacle"){let de=v.getBuilder(u.getZIndex(),"Image");de.setImageStyle(l,z),de.drawMultiPoint(i,m)}else M&&M.getText()&&(z={})}let q=D.getBuilder(u.getZIndex(),"Image");q.setImageStyle(l,z),q.drawMultiPoint(i,m)}if(M&&M.getText()){let D=v;a&&(D=a);let q=D.getBuilder(u.getZIndex(),"Text");q.setTextStyle(M,z),q.drawText(i,m)}}function L2(v,i,u,m,a){let l=u.getFill(),M=u.getStroke();if(l||M){let D=v.getBuilder(u.getZIndex(),"Polygon");D.setFillStrokeStyle(l,M),D.drawPolygon(i,m)}let z=u.getText();if(z&&z.getText()){let D=(a||v).getBuilder(u.getZIndex(),"Text");D.setTextStyle(z),D.drawText(i,m)}}var _v=class extends k1{constructor(i){super(i),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Qa(),this.wrappedRenderedExtent_=Qa(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(i,u,m){let a=u.extent,l=u.viewState,M=l.center,z=l.resolution,D=l.projection,q=l.rotation,V=D.getExtent(),de=this.getLayer().getSource(),pe=u.pixelRatio,Ie=u.viewHints,Ne=!(Ie[Ss.ANIMATING]||Ie[Ss.INTERACTING]),nt=this.compositionContext_,we=Math.round(u.size[0]*pe),Pe=Math.round(u.size[1]*pe),et=de.getWrapX()&&D.canWrapX(),ut=et?bo(V):null,mt=et?Math.ceil((a[2]-V[2])/ut)+1:1,ct=et?Math.floor((a[0]-V[0])/ut):0;do{let ft=this.getRenderTransform(M,z,q,pe,we,Pe,ct*ut);i.execute(nt,1,ft,q,Ne,void 0,m)}while(++ct<mt)}setupCompositionContext_(){if(this.opacity_!==1){let i=aa(this.context.canvas.width,this.context.canvas.height,cv);this.compositionContext_=i}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){let i=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=i,s1(this.compositionContext_),cv.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(i){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,i,i.declutterTree),this.releaseCompositionContext_())}renderFrame(i,u){let m=i.pixelRatio,a=i.layerStatesArray[i.layerIndex];Vx(this.pixelTransform,1/m,1/m),jx(this.inversePixelTransform,this.pixelTransform);let l=zy(this.pixelTransform);this.useContainer(u,l,this.getBackground(i));let M=this.context,z=M.canvas,D=this.replayGroup_,q=this.declutterExecutorGroup;if((!D||D.isEmpty())&&(!q||q.isEmpty()))return null;let V=Math.round(i.size[0]*m),de=Math.round(i.size[1]*m);z.width!=V||z.height!=de?(z.width=V,z.height=de,z.style.transform!==l&&(z.style.transform=l)):this.containerReused||M.clearRect(0,0,V,de),this.preRender(M,i);let pe=i.viewState,Ie=pe.projection;this.opacity_=a.opacity,this.setupCompositionContext_();let Ne=!1,nt=!0;if(a.extent&&this.clipping){let we=Eu(a.extent,Ie);nt=uo(we,i.extent),Ne=nt&&!lc(we,i.extent),Ne&&this.clipUnrotated(this.compositionContext_,i,we)}return nt&&this.renderWorlds(D,i),Ne&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(M,i),this.renderedRotation_!==pe.rotation&&(this.renderedRotation_=pe.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(i){return new Promise(u=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let m=[this.context.canvas.width,this.context.canvas.height];qo(this.pixelTransform,m);let a=this.renderedCenter_,l=this.renderedResolution_,M=this.renderedRotation_,z=this.renderedProjection_,D=this.wrappedRenderedExtent_,q=this.getLayer(),V=[],de=m[0]*$l,pe=m[1]*$l;V.push(this.getRenderTransform(a,l,M,$l,de,pe,0).slice());let Ie=q.getSource(),Ne=z.getExtent();if(Ie.getWrapX()&&z.canWrapX()&&!lc(Ne,D)){let nt=D[0],we=bo(Ne),Pe=0,et;for(;nt<Ne[0];)--Pe,et=we*Pe,V.push(this.getRenderTransform(a,l,M,$l,de,pe,et).slice()),nt+=we;for(Pe=0,nt=D[2];nt>Ne[2];)++Pe,et=we*Pe,V.push(this.getRenderTransform(a,l,M,$l,de,pe,et).slice()),nt-=we}this.hitDetectionImageData_=O1(m,V,this.renderedFeatures_,q.getStyleFunction(),D,l,M)}u(B1(i,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(i,u,m,a,l){if(!this.replayGroup_)return;let M=u.viewState.resolution,z=u.viewState.rotation,D=this.getLayer(),q={},V=function(Ie,Ne,nt){let we=Tr(Ie),Pe=q[we];if(Pe){if(Pe!==!0&&nt<Pe.distanceSq){if(nt===0)return q[we]=!0,l.splice(l.lastIndexOf(Pe),1),a(Ie,D,Ne);Pe.geometry=Ne,Pe.distanceSq=nt}}else{if(nt===0)return q[we]=!0,a(Ie,D,Ne);l.push(q[we]={feature:Ie,layer:D,geometry:Ne,distanceSq:nt,callback:a})}},de,pe=[this.replayGroup_];return this.declutterExecutorGroup&&pe.push(this.declutterExecutorGroup),pe.some(Ie=>de=Ie.forEachFeatureAtCoordinate(i,M,z,m,V,Ie===this.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(Ne=>Ne.value):null)),de}handleFontsChanged(){let i=this.getLayer();i.getVisible()&&this.replayGroup_&&i.changed()}handleStyleImageChange_(i){this.renderIfReadyAndVisible()}prepareFrame(i){let u=this.getLayer(),m=u.getSource();if(!m)return!1;let a=i.viewHints[Ss.ANIMATING],l=i.viewHints[Ss.INTERACTING],M=u.getUpdateWhileAnimating(),z=u.getUpdateWhileInteracting();if(this.ready&&!M&&a||!z&&l)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let D=i.extent,q=i.viewState,V=q.projection,de=q.resolution,pe=i.pixelRatio,Ie=u.getRevision(),Ne=u.getRenderBuffer(),nt=u.getRenderOrder();nt===void 0&&(nt=V1);let we=q.center.slice(),Pe=_l(D,Ne*de),et=Pe.slice(),ut=[Pe.slice()],mt=V.getExtent();if(m.getWrapX()&&V.canWrapX()&&!lc(mt,i.extent)){let Jt=bo(mt),Ei=Math.max(bo(Pe)/2,Jt);Pe[0]=mt[0]-Ei,Pe[2]=mt[2]+Ei,p0(we,V);let ni=Ny(ut[0],V);ni[0]<mt[0]&&ni[2]<mt[2]?ut.push([ni[0]+Jt,ni[1],ni[2]+Jt,ni[3]]):ni[0]>mt[0]&&ni[2]>mt[2]&&ut.push([ni[0]-Jt,ni[1],ni[2]-Jt,ni[3]])}if(this.ready&&this.renderedResolution_==de&&this.renderedRevision_==Ie&&this.renderedRenderOrder_==nt&&lc(this.wrappedRenderedExtent_,Pe))return xs(this.renderedExtent_,et)||(this.hitDetectionImageData_=null,this.renderedExtent_=et),this.renderedCenter_=we,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let ct=new av(Eg(de,pe),Pe,de,pe),ft;this.getLayer().getDeclutter()&&(ft=new av(Eg(de,pe),Pe,de,pe));let It=Su(),Mt;if(It){for(let Jt=0,Ei=ut.length;Jt<Ei;++Jt){let ni=ut[Jt],Ui=lh(ni,V);m.loadFeatures(Ui,_0(de,V),It)}Mt=rg(It,V)}else for(let Jt=0,Ei=ut.length;Jt<Ei;++Jt)m.loadFeatures(ut[Jt],de,V);let zt=N1(de,pe),Qt=!0,Vt=Jt=>{let Ei,ni=Jt.getStyleFunction()||u.getStyleFunction();if(ni&&(Ei=ni(Jt,de)),Ei){let Ui=this.renderFeature(Jt,zt,Ei,ct,Mt,ft);Qt=Qt&&!Ui}},mi=lh(Pe,V),Ii=m.getFeaturesInExtent(mi);nt&&Ii.sort(nt);for(let Jt=0,Ei=Ii.length;Jt<Ei;++Jt)Vt(Ii[Jt]);this.renderedFeatures_=Ii,this.ready=Qt;let $t=ct.finish(),ci=new mv(Pe,de,pe,m.getOverlaps(),$t,u.getRenderBuffer());return ft&&(this.declutterExecutorGroup=new mv(Pe,de,pe,m.getOverlaps(),ft.finish(),u.getRenderBuffer())),this.renderedResolution_=de,this.renderedRevision_=Ie,this.renderedRenderOrder_=nt,this.renderedExtent_=et,this.wrappedRenderedExtent_=Pe,this.renderedCenter_=we,this.renderedProjection_=V,this.replayGroup_=ci,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(i,u,m,a,l,M){if(!m)return!1;let z=!1;if(Array.isArray(m))for(let D=0,q=m.length;D<q;++D)z=yv(a,i,m[D],u,this.boundHandleStyleImageChange_,l,M)||z;else z=yv(a,i,m,u,this.boundHandleStyleImageChange_,l,M);return z}},G1=_v;var vv=class extends S1{constructor(i){super(i)}createRenderer(){return new G1(this)}},Qh=vv;var q1=Vp(Z_(),1);var xv=class{constructor(i){this.rbush_=new q1.default(i),this.items_={}}insert(i,u){let m={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3],value:u};this.rbush_.insert(m),this.items_[Tr(u)]=m}load(i,u){let m=new Array(u.length);for(let a=0,l=u.length;a<l;a++){let M=i[a],z=u[a],D={minX:M[0],minY:M[1],maxX:M[2],maxY:M[3],value:z};m[a]=D,this.items_[Tr(z)]=D}this.rbush_.load(m)}remove(i){let u=Tr(i),m=this.items_[u];return delete this.items_[u],this.rbush_.remove(m)!==null}update(i,u){let m=this.items_[Tr(u)],a=[m.minX,m.minY,m.maxX,m.maxY];Qm(a,i)||(this.remove(u),this.insert(i,u))}getAll(){return this.rbush_.all().map(function(u){return u.value})}getInExtent(i){let u={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]};return this.rbush_.search(u).map(function(a){return a.value})}forEach(i){return this.forEach_(this.getAll(),i)}forEachInExtent(i,u){return this.forEach_(this.getInExtent(i),u)}forEach_(i,u){let m;for(let a=0,l=i.length;a<l;a++)if(m=u(i[a]),m)return m;return m}isEmpty(){return Gl(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(i){let u=this.rbush_.toJSON();return uc(u.minX,u.minY,u.maxX,u.maxY,i)}concat(i){this.rbush_.load(i.rbush_.all());for(let u in i.items_)this.items_[u]=i.items_[u]}},zf=xv;var bv=class extends lo{constructor(i){super(),this.projection=Zo(i.projection),this.attributions_=Z1(i.attributions),this.attributionsCollapsible_=i.attributionsCollapsible!==void 0?i.attributionsCollapsible:!0,this.loading=!1,this.state_=i.state!==void 0?i.state:"ready",this.wrapX_=i.wrapX!==void 0?i.wrapX:!1,this.interpolate_=!!i.interpolate,this.viewResolver=null,this.viewRejector=null;let u=this;this.viewPromise_=new Promise(function(m,a){u.viewResolver=m,u.viewRejector=a})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(i){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(i){this.attributions_=Z1(i),this.changed()}setState(i){this.state_=i,this.changed()}};function Z1(v){return v?Array.isArray(v)?function(i){return v}:typeof v=="function"?v:function(i){return[v]}:null}var dd=bv;var ts={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function W1(v,i){return[[-1/0,-1/0,1/0,1/0]]}var z2=!1;function D2(v,i,u,m,a,l,M){let z=new XMLHttpRequest;z.open("GET",typeof v=="function"?v(u,m,a):v,!0),i.getType()=="arraybuffer"&&(z.responseType="arraybuffer"),z.withCredentials=z2,z.onload=function(D){if(!z.status||z.status>=200&&z.status<300){let q=i.getType(),V;q=="json"||q=="text"?V=z.responseText:q=="xml"?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):q=="arraybuffer"&&(V=z.response),V?l(i.readFeatures(V,{extent:u,featureProjection:a}),i.readProjection(V)):M()}else M()},z.onerror=M,z.send()}function wv(v,i){return function(u,m,a,l,M){let z=this;D2(v,i,u,m,a,function(D,q){z.addFeatures(D),l!==void 0&&l(D)},M||ac)}}var Pu=class extends nn{constructor(i,u,m){super(i),this.feature=u,this.features=m}},Sv=class extends dd{constructor(i){i=i||{},super({attributions:i.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:i.wrapX!==void 0?i.wrapX:!0}),this.on,this.once,this.un,this.loader_=ac,this.format_=i.format,this.overlaps_=i.overlaps===void 0?!0:i.overlaps,this.url_=i.url,i.loader!==void 0?this.loader_=i.loader:this.url_!==void 0&&(zr(this.format_,7),this.loader_=wv(this.url_,this.format_)),this.strategy_=i.strategy!==void 0?i.strategy:W1;let u=i.useSpatialIndex!==void 0?i.useSpatialIndex:!0;this.featuresRtree_=u?new zf:null,this.loadedExtentsRtree_=new zf,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let m,a;Array.isArray(i.features)?a=i.features:i.features&&(m=i.features,a=m.getArray()),!u&&m===void 0&&(m=new dh(a)),a!==void 0&&this.addFeaturesInternal(a),m!==void 0&&this.bindFeaturesCollection_(m)}addFeature(i){this.addFeatureInternal(i),this.changed()}addFeatureInternal(i){let u=Tr(i);if(!this.addToIndex_(u,i)){this.featuresCollection_&&this.featuresCollection_.remove(i);return}this.setupChangeEvents_(u,i);let m=i.getGeometry();if(m){let a=m.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(a,i)}else this.nullGeometryFeatures_[u]=i;this.dispatchEvent(new Pu(ts.ADDFEATURE,i))}setupChangeEvents_(i,u){this.featureChangeKeys_[i]=[so(u,cn.CHANGE,this.handleFeatureChange_,this),so(u,Np.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(i,u){let m=!0,a=u.getId();return a!==void 0&&(a.toString()in this.idIndex_?m=!1:this.idIndex_[a.toString()]=u),m&&(zr(!(i in this.uidIndex_),30),this.uidIndex_[i]=u),m}addFeatures(i){this.addFeaturesInternal(i),this.changed()}addFeaturesInternal(i){let u=[],m=[],a=[];for(let l=0,M=i.length;l<M;l++){let z=i[l],D=Tr(z);this.addToIndex_(D,z)&&m.push(z)}for(let l=0,M=m.length;l<M;l++){let z=m[l],D=Tr(z);this.setupChangeEvents_(D,z);let q=z.getGeometry();if(q){let V=q.getExtent();u.push(V),a.push(z)}else this.nullGeometryFeatures_[D]=z}if(this.featuresRtree_&&this.featuresRtree_.load(u,a),this.hasListener(ts.ADDFEATURE))for(let l=0,M=m.length;l<M;l++)this.dispatchEvent(new Pu(ts.ADDFEATURE,m[l]))}bindFeaturesCollection_(i){let u=!1;this.addEventListener(ts.ADDFEATURE,function(m){u||(u=!0,i.push(m.feature),u=!1)}),this.addEventListener(ts.REMOVEFEATURE,function(m){u||(u=!0,i.remove(m.feature),u=!1)}),i.addEventListener(Es.ADD,m=>{u||(u=!0,this.addFeature(m.element),u=!1)}),i.addEventListener(Es.REMOVE,m=>{u||(u=!0,this.removeFeature(m.element),u=!1)}),this.featuresCollection_=i}clear(i){if(i){for(let m in this.featureChangeKeys_)this.featureChangeKeys_[m].forEach(Po);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){let m=a=>{this.removeFeatureInternal(a)};this.featuresRtree_.forEach(m);for(let a in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[a])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let u=new Pu(ts.CLEAR);this.dispatchEvent(u),this.changed()}forEachFeature(i){if(this.featuresRtree_)return this.featuresRtree_.forEach(i);this.featuresCollection_&&this.featuresCollection_.forEach(i)}forEachFeatureAtCoordinateDirect(i,u){let m=[i[0],i[1],i[0],i[1]];return this.forEachFeatureInExtent(m,function(a){if(a.getGeometry().intersectsCoordinate(i))return u(a)})}forEachFeatureInExtent(i,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(i,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)}forEachFeatureIntersectingExtent(i,u){return this.forEachFeatureInExtent(i,function(m){if(m.getGeometry().intersectsExtent(i)){let l=u(m);if(l)return l}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let i;return this.featuresCollection_?i=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(i=this.featuresRtree_.getAll(),Gl(this.nullGeometryFeatures_)||Ya(i,Object.values(this.nullGeometryFeatures_))),i}getFeaturesAtCoordinate(i){let u=[];return this.forEachFeatureAtCoordinateDirect(i,function(m){u.push(m)}),u}getFeaturesInExtent(i,u){if(this.featuresRtree_){if(!(u&&u.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(i);let a=Jx(i,u);return[].concat(...a.map(l=>this.featuresRtree_.getInExtent(l)))}else if(this.featuresCollection_)return this.featuresCollection_.getArray().slice(0);return[]}getClosestFeatureToCoordinate(i,u){let m=i[0],a=i[1],l=null,M=[NaN,NaN],z=1/0,D=[-1/0,-1/0,1/0,1/0];return u=u||Gm,this.featuresRtree_.forEachInExtent(D,function(q){if(u(q)){let V=q.getGeometry(),de=z;if(z=V.closestPointXY(m,a,M,z),z<de){l=q;let pe=Math.sqrt(z);D[0]=m-pe,D[1]=a-pe,D[2]=m+pe,D[3]=a+pe}}}),l}getExtent(i){return this.featuresRtree_.getExtent(i)}getFeatureById(i){let u=this.idIndex_[i.toString()];return u!==void 0?u:null}getFeatureByUid(i){let u=this.uidIndex_[i];return u!==void 0?u:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(i){let u=i.target,m=Tr(u),a=u.getGeometry();if(!a)m in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[m]=u);else{let M=a.getExtent();m in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[m],this.featuresRtree_&&this.featuresRtree_.insert(M,u)):this.featuresRtree_&&this.featuresRtree_.update(M,u)}let l=u.getId();if(l!==void 0){let M=l.toString();this.idIndex_[M]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[M]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[m]=u;this.changed(),this.dispatchEvent(new Pu(ts.CHANGEFEATURE,u))}hasFeature(i){let u=i.getId();return u!==void 0?u in this.idIndex_:Tr(i)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Gl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(i,u,m){let a=this.loadedExtentsRtree_,l=this.strategy_(i,u,m);for(let M=0,z=l.length;M<z;++M){let D=l[M];a.forEachInExtent(D,function(V){return lc(V.extent,D)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Pu(ts.FEATURESLOADSTART)),this.loader_.call(this,D,u,m,V=>{--this.loadingExtentsCount_,this.dispatchEvent(new Pu(ts.FEATURESLOADEND,void 0,V))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Pu(ts.FEATURESLOADERROR))}),a.insert(D,{extent:D.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(i){let u=this.loadedExtentsRtree_,m;u.forEachInExtent(i,function(a){if(Qm(a.extent,i))return m=a,!0}),m&&u.remove(m)}removeFeature(i){if(!i)return;let u=Tr(i);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(i),this.removeFeatureInternal(i)&&this.changed()}removeFeatureInternal(i){let u=Tr(i),m=this.featureChangeKeys_[u];if(!m)return;m.forEach(Po),delete this.featureChangeKeys_[u];let a=i.getId();return a!==void 0&&delete this.idIndex_[a.toString()],delete this.uidIndex_[u],this.dispatchEvent(new Pu(ts.REMOVEFEATURE,i)),i}removeFromIdIndex_(i){let u=!1;for(let m in this.idIndex_)if(this.idIndex_[m]===i){delete this.idIndex_[m],u=!0;break}return u}setLoader(i){this.loader_=i}setUrl(i){zr(this.format_,7),this.url_=i,this.setLoader(wv(i,this.format_))}},ep=Sv;var _h=class extends nn{constructor(i,u){super(i),this.layer=u}},Ev={LAYERS:"layers"},Df=class extends mg{constructor(i){i=i||{};let u=Object.assign({},i);delete u.layers;let m=i.layers;super(u),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Ev.LAYERS,this.handleLayersChanged_),m?Array.isArray(m)?m=new dh(m.slice(),{unique:!0}):zr(typeof m.getArray=="function",43):m=new dh(void 0,{unique:!0}),this.setLayers(m)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Po),this.layersListenerKeys_.length=0;let i=this.getLayers();this.layersListenerKeys_.push(so(i,Es.ADD,this.handleLayersAdd_,this),so(i,Es.REMOVE,this.handleLayersRemove_,this));for(let m in this.listenerKeys_)this.listenerKeys_[m].forEach(Po);nh(this.listenerKeys_);let u=i.getArray();for(let m=0,a=u.length;m<a;m++){let l=u[m];this.registerLayerListeners_(l),this.dispatchEvent(new _h("addlayer",l))}this.changed()}registerLayerListeners_(i){let u=[so(i,Np.PROPERTYCHANGE,this.handleLayerChange_,this),so(i,cn.CHANGE,this.handleLayerChange_,this)];i instanceof Df&&u.push(so(i,"addlayer",this.handleLayerGroupAdd_,this),so(i,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Tr(i)]=u}handleLayerGroupAdd_(i){this.dispatchEvent(new _h("addlayer",i.layer))}handleLayerGroupRemove_(i){this.dispatchEvent(new _h("removelayer",i.layer))}handleLayersAdd_(i){let u=i.element;this.registerLayerListeners_(u),this.dispatchEvent(new _h("addlayer",u)),this.changed()}handleLayersRemove_(i){let u=i.element,m=Tr(u);this.listenerKeys_[m].forEach(Po),delete this.listenerKeys_[m],this.dispatchEvent(new _h("removelayer",u)),this.changed()}getLayers(){return this.get(Ev.LAYERS)}setLayers(i){let u=this.getLayers();if(u){let m=u.getArray();for(let a=0,l=m.length;a<l;++a)this.dispatchEvent(new _h("removelayer",m[a]))}this.set(Ev.LAYERS,i)}getLayersArray(i){return i=i!==void 0?i:[],this.getLayers().forEach(function(u){u.getLayersArray(i)}),i}getLayerStatesArray(i){let u=i!==void 0?i:[],m=u.length;this.getLayers().forEach(function(M){M.getLayerStatesArray(u)});let a=this.getLayerState(),l=a.zIndex;!i&&a.zIndex===void 0&&(l=0);for(let M=m,z=u.length;M<z;M++){let D=u[M];D.opacity*=a.opacity,D.visible=D.visible&&a.visible,D.maxResolution=Math.min(D.maxResolution,a.maxResolution),D.minResolution=Math.max(D.minResolution,a.minResolution),D.minZoom=Math.max(D.minZoom,a.minZoom),D.maxZoom=Math.min(D.maxZoom,a.maxZoom),a.extent!==void 0&&(D.extent!==void 0?D.extent=Xx(D.extent,a.extent):D.extent=a.extent),D.zIndex===void 0&&(D.zIndex=l)}return u}getSourceState(){return"ready"}},Tv=Df;var Js={SINGLECLICK:"singleclick",CLICK:cn.CLICK,DBLCLICK:cn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Iv={ACTIVE:"active"};var Cv=class extends lo{constructor(i){super(),this.on,this.once,this.un,i&&i.handleEvent&&(this.handleEvent=i.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Iv.ACTIVE)}getMap(){return this.map_}handleEvent(i){return!0}setActive(i){this.set(Iv.ACTIVE,i)}setMap(i){this.map_=i}};var X1=Cv;var Av=class extends X1{constructor(i){i=i||{},super(i),i.handleDownEvent&&(this.handleDownEvent=i.handleDownEvent),i.handleDragEvent&&(this.handleDragEvent=i.handleDragEvent),i.handleMoveEvent&&(this.handleMoveEvent=i.handleMoveEvent),i.handleUpEvent&&(this.handleUpEvent=i.handleUpEvent),i.stopDown&&(this.stopDown=i.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(i){return!1}handleDragEvent(i){}handleEvent(i){if(!i.originalEvent)return!0;let u=!1;if(this.updateTrackedPointers_(i),this.handlingDownUpSequence){if(i.type==Js.POINTERDRAG)this.handleDragEvent(i),i.originalEvent.preventDefault();else if(i.type==Js.POINTERUP){let m=this.handleUpEvent(i);this.handlingDownUpSequence=m&&this.targetPointers.length>0}}else if(i.type==Js.POINTERDOWN){let m=this.handleDownEvent(i);this.handlingDownUpSequence=m,u=this.stopDown(m)}else i.type==Js.POINTERMOVE&&this.handleMoveEvent(i);return!u}handleMoveEvent(i){}handleUpEvent(i){return!1}stopDown(i){return i}updateTrackedPointers_(i){i.activePointers&&(this.targetPointers=i.activePointers)}};var $1=Av;var K1=function(v){let i=v.originalEvent;return i.altKey&&!(i.metaKey||i.ctrlKey)&&!i.shiftKey};var H1=Gm,Y1=function(v){return v.type==Js.CLICK};var J1=function(v){return v.type==Js.SINGLECLICK};var Q1=function(v){let i=v.originalEvent;return zr(i!==void 0,56),i.isPrimary&&i.button===0};var eb=0,Ff=1,tb=[0,0,0,0],fd=[],Mv={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},Of=class extends nn{constructor(i,u,m){super(i),this.features=u,this.mapBrowserEvent=m}},Pv=class extends $1{constructor(i){super(i),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=i.condition?i.condition:Q1,this.defaultDeleteCondition_=function(m){return K1(m)&&J1(m)},this.deleteCondition_=i.deleteCondition?i.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=i.insertVertexCondition?i.insertVertexCondition:H1,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new zf,this.pixelTolerance_=i.pixelTolerance!==void 0?i.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Qh({source:new ep({useSpatialIndex:!1,wrapX:!!i.wrapX}),style:i.style?i.style:O2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let u;if(i.features?u=i.features:i.source&&(this.source_=i.source,u=new dh(this.source_.getFeatures()),this.source_.addEventListener(ts.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(ts.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!u)throw new Error("The modify interaction requires features, a source or a layer");i.hitDetection&&(this.hitDetection_=i.hitDetection),this.features_=u,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(Es.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(Es.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=i.snapToPointer===void 0?!this.hitDetection_:i.snapToPointer}addFeature_(i){let u=i.getGeometry();if(u){let a=this.SEGMENT_WRITERS_[u.getType()];a&&a(i,u)}let m=this.getMap();m&&m.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,m),i.addEventListener(cn.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(i,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new dh;let m=this.featuresBeingModified_.getArray();for(let a=0,l=u.length;a<l;++a){let M=u[a];for(let z=0,D=M.length;z<D;++z){let q=M[z].feature;q&&!m.includes(q)&&this.featuresBeingModified_.push(q)}}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new Of(Mv.MODIFYSTART,this.featuresBeingModified_,i))}}removeFeature_(i){this.removeFeatureSegmentData_(i),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),i.removeEventListener(cn.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(i){let u=this.rBush_,m=[];u.forEach(function(a){i===a.feature&&m.push(a)});for(let a=m.length-1;a>=0;--a){let l=m[a];for(let M=this.dragSegments_.length-1;M>=0;--M)this.dragSegments_[M][0]===l&&this.dragSegments_.splice(M,1);u.remove(l)}}setActive(i){this.vertexFeature_&&!i&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(i)}setMap(i){this.overlay_.setMap(i),super.setMap(i)}getOverlay(){return this.overlay_}handleSourceAdd_(i){i.feature&&this.features_.push(i.feature)}handleSourceRemove_(i){i.feature&&this.features_.remove(i.feature)}handleFeatureAdd_(i){this.addFeature_(i.element)}handleFeatureChange_(i){if(!this.changingFeature_){let u=i.target;this.removeFeature_(u),this.addFeature_(u)}}handleFeatureRemove_(i){this.removeFeature_(i.element)}writePointGeometry_(i,u){let m=u.getCoordinates(),a={feature:i,geometry:u,segment:[m,m]};this.rBush_.insert(u.getExtent(),a)}writeMultiPointGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length;a<l;++a){let M=m[a],z={feature:i,geometry:u,depth:[a],index:a,segment:[M,M]};this.rBush_.insert(u.getExtent(),z)}}writeLineStringGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length-1;a<l;++a){let M=m.slice(a,a+2),z={feature:i,geometry:u,index:a,segment:M};this.rBush_.insert(bu(M),z)}}writeMultiLineStringGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length;a<l;++a){let M=m[a];for(let z=0,D=M.length-1;z<D;++z){let q=M.slice(z,z+2),V={feature:i,geometry:u,depth:[a],index:z,segment:q};this.rBush_.insert(bu(q),V)}}}writePolygonGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length;a<l;++a){let M=m[a];for(let z=0,D=M.length-1;z<D;++z){let q=M.slice(z,z+2),V={feature:i,geometry:u,depth:[a],index:z,segment:q};this.rBush_.insert(bu(q),V)}}}writeMultiPolygonGeometry_(i,u){let m=u.getCoordinates();for(let a=0,l=m.length;a<l;++a){let M=m[a];for(let z=0,D=M.length;z<D;++z){let q=M[z];for(let V=0,de=q.length-1;V<de;++V){let pe=q.slice(V,V+2),Ie={feature:i,geometry:u,depth:[z,a],index:V,segment:pe};this.rBush_.insert(bu(pe),Ie)}}}}writeCircleGeometry_(i,u){let m=u.getCenter(),a={feature:i,geometry:u,index:eb,segment:[m,m]},l={feature:i,geometry:u,index:Ff,segment:[m,m]},M=[a,l];a.featureSegments=M,l.featureSegments=M,this.rBush_.insert(Xp(m),a);let z=u,D=Su();if(D&&this.getMap()){let q=this.getMap().getView().getProjection();z=z.clone().transform(D,q),z=l_(z).transform(q,D)}this.rBush_.insert(z.getExtent(),l)}writeGeometryCollectionGeometry_(i,u){let m=u.getGeometriesArray();for(let a=0;a<m.length;++a){let l=m[a],M=this.SEGMENT_WRITERS_[l.getType()];M(i,l)}}createOrUpdateVertexFeature_(i,u,m){let a=this.vertexFeature_;return a?a.getGeometry().setCoordinates(i):(a=new Tu(new xa(i)),this.vertexFeature_=a,this.overlay_.getSource().addFeature(a)),a.set("features",u),a.set("geometries",m),a}handleEvent(i){if(!i.originalEvent)return!0;this.lastPointerEvent_=i;let u;return!i.map.getView().getInteracting()&&i.type==Js.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(i),this.vertexFeature_&&this.deleteCondition_(i)&&(i.type!=Js.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),i.type==Js.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(i)&&!u}handleDragEvent(i){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(i,this.dragSegments_);let u=[i.coordinate[0]+this.delta_[0],i.coordinate[1]+this.delta_[1]],m=[],a=[];for(let l=0,M=this.dragSegments_.length;l<M;++l){let z=this.dragSegments_[l],D=z[0],q=D.feature;m.includes(q)||m.push(q);let V=D.geometry;a.includes(V)||a.push(V);let de=D.depth,pe,Ie=D.segment,Ne=z[1];for(;u.length<V.getStride();)u.push(Ie[Ne][u.length]);switch(V.getType()){case"Point":pe=u,Ie[0]=u,Ie[1]=u;break;case"MultiPoint":pe=V.getCoordinates(),pe[D.index]=u,Ie[0]=u,Ie[1]=u;break;case"LineString":pe=V.getCoordinates(),pe[D.index+Ne]=u,Ie[Ne]=u;break;case"MultiLineString":pe=V.getCoordinates(),pe[de[0]][D.index+Ne]=u,Ie[Ne]=u;break;case"Polygon":pe=V.getCoordinates(),pe[de[0]][D.index+Ne]=u,Ie[Ne]=u;break;case"MultiPolygon":pe=V.getCoordinates(),pe[de[1]][de[0]][D.index+Ne]=u,Ie[Ne]=u;break;case"Circle":if(Ie[0]=u,Ie[1]=u,D.index===eb)this.changingFeature_=!0,V.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;let nt=i.map.getView().getProjection(),we=Xy(Ro(V.getCenter(),nt),Ro(u,nt)),Pe=Su();if(Pe){let et=V.clone().transform(Pe,nt);et.setRadius(we),we=et.transform(nt,Pe).getRadius()}V.setRadius(we),this.changingFeature_=!1}break;default:}pe&&this.setGeometryCoordinates_(V,pe)}this.createOrUpdateVertexFeature_(u,m,a)}handleDownEvent(i){if(!this.condition_(i))return!1;let u=i.coordinate;this.handlePointerAtPixel_(i.pixel,i.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;let m=this.vertexFeature_;if(m){let a=i.map.getView().getProjection(),l=[],M=m.getGeometry().getCoordinates(),z=bu([M]),D=this.rBush_.getInExtent(z),q={};D.sort(F2);for(let V=0,de=D.length;V<de;++V){let pe=D[V],Ie=pe.segment,Ne=Tr(pe.geometry),nt=pe.depth;if(nt&&(Ne+="-"+nt.join("-")),q[Ne]||(q[Ne]=new Array(2)),pe.geometry.getType()==="Circle"&&pe.index===Ff){let we=rb(u,pe,a);es(we,M)&&!q[Ne][0]&&(this.dragSegments_.push([pe,0]),q[Ne][0]=pe);continue}if(es(Ie[0],M)&&!q[Ne][0]){this.dragSegments_.push([pe,0]),q[Ne][0]=pe;continue}if(es(Ie[1],M)&&!q[Ne][1]){if(q[Ne][0]&&q[Ne][0].index===0){let we=pe.geometry.getCoordinates();switch(pe.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":we=we[nt[1]];case"Polygon":if(pe.index!==we[nt[0]].length-2)continue;break;default:}}this.dragSegments_.push([pe,1]),q[Ne][1]=pe;continue}Tr(Ie)in this.vertexSegments_&&!q[Ne][0]&&!q[Ne][1]&&this.insertVertexCondition_(i)&&l.push(pe)}l.length&&this.willModifyFeatures_(i,[l]);for(let V=l.length-1;V>=0;--V)this.insertVertex_(l[V],M)}return!!this.vertexFeature_}handleUpEvent(i){for(let u=this.dragSegments_.length-1;u>=0;--u){let m=this.dragSegments_[u][0],a=m.geometry;if(a.getType()==="Circle"){let l=a.getCenter(),M=m.featureSegments[0],z=m.featureSegments[1];M.segment[0]=l,M.segment[1]=l,z.segment[0]=l,z.segment[1]=l,this.rBush_.update(Xp(l),M);let D=a,q=Su();if(q){let V=i.map.getView().getProjection();D=D.clone().transform(q,V),D=l_(D).transform(V,q)}this.rBush_.update(D.getExtent(),z)}else this.rBush_.update(bu(m.segment),m)}return this.featuresBeingModified_&&(this.dispatchEvent(new Of(Mv.MODIFYEND,this.featuresBeingModified_,i)),this.featuresBeingModified_=null),!1}handlePointerMove_(i){this.lastPixel_=i.pixel,this.handlePointerAtPixel_(i.pixel,i.map,i.coordinate)}handlePointerAtPixel_(i,u,m){let a=m||u.getCoordinateFromPixel(i),l=u.getView().getProjection(),M=function(q,V){return ib(a,q,l)-ib(a,V,l)},z,D;if(this.hitDetection_){let q=typeof this.hitDetection_=="object"?V=>V===this.hitDetection_:void 0;u.forEachFeatureAtPixel(i,(V,de,pe)=>{let Ie=pe||V.getGeometry();if(Ie.getType()==="Point"&&V instanceof Tu&&this.features_.getArray().includes(V)){D=Ie;let Ne=D.getFlatCoordinates().slice(0,2);z=[{feature:V,geometry:D,segment:[Ne,Ne]}]}return!0},{layerFilter:q})}if(!z){let q=Eu(Xp(a,tb),l),V=u.getView().getResolution()*this.pixelTolerance_,de=lh(_l(q,V,tb),l);z=this.rBush_.getInExtent(de)}if(z&&z.length>0){let q=z.sort(M)[0],V=q.segment,de=rb(a,q,l),pe=u.getPixelFromCoordinate(de),Ie=Xy(i,pe);if(D||Ie<=this.pixelTolerance_){let Ne={};if(Ne[Tr(V)]=!0,this.snapToPointer_||(this.delta_[0]=de[0]-a[0],this.delta_[1]=de[1]-a[1]),q.geometry.getType()==="Circle"&&q.index===Ff)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(de,[q.feature],[q.geometry]);else{let nt=u.getPixelFromCoordinate(V[0]),we=u.getPixelFromCoordinate(V[1]),Pe=Hp(pe,nt),et=Hp(pe,we);Ie=Math.sqrt(Math.min(Pe,et)),this.snappedToVertex_=Ie<=this.pixelTolerance_,this.snappedToVertex_&&(de=Pe>et?V[1]:V[0]),this.createOrUpdateVertexFeature_(de,[q.feature],[q.geometry]);let ut={};ut[Tr(q.geometry)]=!0;for(let mt=1,ct=z.length;mt<ct;++mt){let ft=z[mt].segment;if(es(V[0],ft[0])&&es(V[1],ft[1])||es(V[0],ft[1])&&es(V[1],ft[0])){let It=Tr(z[mt].geometry);It in ut||(ut[It]=!0,Ne[Tr(ft)]=!0)}else break}}this.vertexSegments_=Ne;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(i,u){let m=i.segment,a=i.feature,l=i.geometry,M=i.depth,z=i.index,D;for(;u.length<l.getStride();)u.push(0);switch(l.getType()){case"MultiLineString":D=l.getCoordinates(),D[M[0]].splice(z+1,0,u);break;case"Polygon":D=l.getCoordinates(),D[M[0]].splice(z+1,0,u);break;case"MultiPolygon":D=l.getCoordinates(),D[M[1]][M[0]].splice(z+1,0,u);break;case"LineString":D=l.getCoordinates(),D.splice(z+1,0,u);break;default:return}this.setGeometryCoordinates_(l,D);let q=this.rBush_;q.remove(i),this.updateSegmentIndices_(l,z,M,1);let V={segment:[m[0],u],feature:a,geometry:l,depth:M,index:z};q.insert(bu(V.segment),V),this.dragSegments_.push([V,1]);let de={segment:[u,m[1]],feature:a,geometry:l,depth:M,index:z+1};q.insert(bu(de.segment),de),this.dragSegments_.push([de,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=Js.POINTERDRAG){let i=this.lastPointerEvent_;this.willModifyFeatures_(i,this.dragSegments_);let u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Of(Mv.MODIFYEND,this.featuresBeingModified_,i)),this.featuresBeingModified_=null,u}return!1}removeVertex_(){let i=this.dragSegments_,u={},m=!1,a,l,M,z,D,q,V,de,pe,Ie,Ne;for(D=i.length-1;D>=0;--D)M=i[D],Ie=M[0],Ne=Tr(Ie.feature),Ie.depth&&(Ne+="-"+Ie.depth.join("-")),Ne in u||(u[Ne]={}),M[1]===0?(u[Ne].right=Ie,u[Ne].index=Ie.index):M[1]==1&&(u[Ne].left=Ie,u[Ne].index=Ie.index+1);for(Ne in u){switch(pe=u[Ne].right,V=u[Ne].left,q=u[Ne].index,de=q-1,V!==void 0?Ie=V:Ie=pe,de<0&&(de=0),z=Ie.geometry,l=z.getCoordinates(),a=l,m=!1,z.getType()){case"MultiLineString":l[Ie.depth[0]].length>2&&(l[Ie.depth[0]].splice(q,1),m=!0);break;case"LineString":l.length>2&&(l.splice(q,1),m=!0);break;case"MultiPolygon":a=a[Ie.depth[1]];case"Polygon":a=a[Ie.depth[0]],a.length>4&&(q==a.length-1&&(q=0),a.splice(q,1),m=!0,q===0&&(a.pop(),a.push(a[0]),de=a.length-1));break;default:}if(m){this.setGeometryCoordinates_(z,l);let nt=[];if(V!==void 0&&(this.rBush_.remove(V),nt.push(V.segment[0])),pe!==void 0&&(this.rBush_.remove(pe),nt.push(pe.segment[1])),V!==void 0&&pe!==void 0){let we={depth:Ie.depth,feature:Ie.feature,geometry:Ie.geometry,index:de,segment:nt};this.rBush_.insert(bu(we.segment),we)}this.updateSegmentIndices_(z,q,Ie.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),i.length=0}}return m}setGeometryCoordinates_(i,u){this.changingFeature_=!0,i.setCoordinates(u),this.changingFeature_=!1}updateSegmentIndices_(i,u,m,a){this.rBush_.forEachInExtent(i.getExtent(),function(l){l.geometry===i&&(m===void 0||l.depth===void 0||xs(l.depth,m))&&l.index>u&&(l.index+=a)})}};function F2(v,i){return v.index-i.index}function ib(v,i,u){let m=i.geometry;if(m.getType()==="Circle"){let l=m;if(i.index===Ff){let M=Su();M&&(l=l.clone().transform(M,u));let z=Hp(l.getCenter(),Ro(v,u)),D=Math.sqrt(z)-l.getRadius();return D*D}}let a=Ro(v,u);return fd[0]=Ro(i.segment[0],u),fd[1]=Ro(i.segment[1],u),h0(a,fd)}function rb(v,i,u){let m=i.geometry;if(m.getType()==="Circle"&&i.index===Ff){let l=m,M=Su();return M&&(l=l.clone().transform(M,u)),Yp(l.getClosestPoint(Ro(v,u)),u)}let a=Ro(v,u);return fd[0]=Ro(i.segment[0],u),fd[1]=Ro(i.segment[1],u),Yp(Wy(a,fd),u)}function O2(){let v=g1();return function(i,u){return v.Point}}var kv=Pv;var Rv=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}getReadOptions(i,u){if(u){let m=u.dataProjection?Zo(u.dataProjection):this.readProjection(i);u.extent&&m&&m.getUnits()==="tile-pixels"&&(m=Zo(m),m.setWorldExtent(u.extent)),u={dataProjection:m,featureProjection:u.featureProjection}}return this.adaptOptions(u)}adaptOptions(i){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},i)}getType(){return Xi()}readFeature(i,u){return Xi()}readFeatures(i,u){return Xi()}readGeometry(i,u){return Xi()}readProjection(i){return Xi()}writeFeature(i,u){return Xi()}writeFeatures(i,u){return Xi()}writeGeometry(i,u){return Xi()}},nb=Rv;function Lv(v,i,u){let m=u?Zo(u.featureProjection):null,a=u?Zo(u.dataProjection):null,l;if(m&&a&&!y0(m,a)?l=(i?v.clone():v).transform(i?m:a,i?a:m):l=v,i&&u&&u.decimals!==void 0){let M=Math.pow(10,u.decimals),z=function(D){for(let q=0,V=D.length;q<V;++q)D[q]=Math.round(D[q]*M)/M;return D};l===v&&(l=v.clone()),l.applyTransform(z)}return l}var zv=class extends nb{constructor(){super()}getType(){return"json"}readFeature(i,u){return this.readFeatureFromObject(Tg(i),this.getReadOptions(i,u))}readFeatures(i,u){return this.readFeaturesFromObject(Tg(i),this.getReadOptions(i,u))}readFeatureFromObject(i,u){return Xi()}readFeaturesFromObject(i,u){return Xi()}readGeometry(i,u){return this.readGeometryFromObject(Tg(i),this.getReadOptions(i,u))}readGeometryFromObject(i,u){return Xi()}readProjection(i){return this.readProjectionFromObject(Tg(i))}readProjectionFromObject(i){return Xi()}writeFeature(i,u){return JSON.stringify(this.writeFeatureObject(i,u))}writeFeatureObject(i,u){return Xi()}writeFeatures(i,u){return JSON.stringify(this.writeFeaturesObject(i,u))}writeFeaturesObject(i,u){return Xi()}writeGeometry(i,u){return JSON.stringify(this.writeGeometryObject(i,u))}writeGeometryObject(i,u){return Xi()}};function Tg(v){if(typeof v=="string"){let i=JSON.parse(v);return i||null}else if(v!==null)return v;return null}var ob=zv;var Dv=class extends ob{constructor(i){i=i||{},super(),this.dataProjection=Zo(i.dataProjection?i.dataProjection:"EPSG:4326"),i.featureProjection&&(this.defaultFeatureProjection=Zo(i.featureProjection)),this.geometryName_=i.geometryName,this.extractGeometryName_=i.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(i,u){let m=null;i.type==="Feature"?m=i:m={type:"Feature",geometry:i,properties:null};let a=Fv(m.geometry,u),l=new Tu;return this.geometryName_?l.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in m!==void 0&&l.setGeometryName(m.geometry_name),l.setGeometry(a),"id"in m&&l.setId(m.id),m.properties&&l.setProperties(m.properties,!0),l}readFeaturesFromObject(i,u){let m=i,a=null;if(m.type==="FeatureCollection"){let l=i;a=[];let M=l.features;for(let z=0,D=M.length;z<D;++z)a.push(this.readFeatureFromObject(M[z],u))}else a=[this.readFeatureFromObject(i,u)];return a}readGeometryFromObject(i,u){return Fv(i,u)}readProjectionFromObject(i){let u=i.crs,m;return u?u.type=="name"?m=Zo(u.properties.name):u.type==="EPSG"?m=Zo("EPSG:"+u.properties.code):zr(!1,36):m=this.dataProjection,m}writeFeatureObject(i,u){u=this.adaptOptions(u);let m={type:"Feature",geometry:null,properties:null},a=i.getId();if(a!==void 0&&(m.id=a),!i.hasProperties())return m;let l=i.getProperties(),M=i.getGeometry();return M&&(m.geometry=Ov(M,u),delete l[i.getGeometryName()]),Gl(l)||(m.properties=l),m}writeFeaturesObject(i,u){u=this.adaptOptions(u);let m=[];for(let a=0,l=i.length;a<l;++a)m.push(this.writeFeatureObject(i[a],u));return{type:"FeatureCollection",features:m}}writeGeometryObject(i,u){return Ov(i,this.adaptOptions(u))}};function Fv(v,i){if(!v)return null;let u;switch(v.type){case"Point":{u=U2(v);break}case"LineString":{u=V2(v);break}case"Polygon":{u=q2(v);break}case"MultiPoint":{u=j2(v);break}case"MultiLineString":{u=N2(v);break}case"MultiPolygon":{u=G2(v);break}case"GeometryCollection":{u=B2(v);break}default:throw new Error("Unsupported GeoJSON type: "+v.type)}return Lv(u,!1,i)}function B2(v,i){let u=v.geometries.map(function(m){return Fv(m,i)});return new C0(u)}function U2(v){return new xa(v.coordinates)}function V2(v){return new Wl(v.coordinates)}function N2(v){return new U0(v.coordinates)}function j2(v){return new hg(v.coordinates)}function G2(v){return new Z0(v.coordinates)}function q2(v){return new mf(v.coordinates)}function Ov(v,i){v=Lv(v,!0,i);let u=v.getType(),m;switch(u){case"Point":{m=H2(v,i);break}case"LineString":{m=W2(v,i);break}case"Polygon":{m=Y2(v,i);break}case"MultiPoint":{m=$2(v,i);break}case"MultiLineString":{m=X2(v,i);break}case"MultiPolygon":{m=K2(v,i);break}case"GeometryCollection":{m=Z2(v,i);break}case"Circle":{m={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+u)}return m}function Z2(v,i){return i=Object.assign({},i),delete i.featureProjection,{type:"GeometryCollection",geometries:v.getGeometriesArray().map(function(m){return Ov(m,i)})}}function W2(v,i){return{type:"LineString",coordinates:v.getCoordinates()}}function X2(v,i){return{type:"MultiLineString",coordinates:v.getCoordinates()}}function $2(v,i){return{type:"MultiPoint",coordinates:v.getCoordinates()}}function K2(v,i){let u;return i&&(u=i.rightHanded),{type:"MultiPolygon",coordinates:v.getCoordinates(u)}}function H2(v,i){return{type:"Point",coordinates:v.getCoordinates()}}function Y2(v,i){let u;return i&&(u=i.rightHanded),{type:"Polygon",coordinates:v.getCoordinates(u)}}var Sl=Dv;var Ig,J2=new Uint8Array(16);function Bv(){if(!Ig&&(Ig=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ig))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ig(J2)}var wa=[];for(let v=0;v<256;++v)wa.push((v+256).toString(16).slice(1));function ab(v,i=0){return(wa[v[i+0]]+wa[v[i+1]]+wa[v[i+2]]+wa[v[i+3]]+"-"+wa[v[i+4]]+wa[v[i+5]]+"-"+wa[v[i+6]]+wa[v[i+7]]+"-"+wa[v[i+8]]+wa[v[i+9]]+"-"+wa[v[i+10]]+wa[v[i+11]]+wa[v[i+12]]+wa[v[i+13]]+wa[v[i+14]]+wa[v[i+15]]).toLowerCase()}var Q2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Uv={randomUUID:Q2};function eS(v,i,u){if(Uv.randomUUID&&!i&&!v)return Uv.randomUUID();v=v||{};let m=v.random||(v.rng||Bv)();if(m[6]=m[6]&15|64,m[8]=m[8]&63|128,i){u=u||0;for(let a=0;a<16;++a)i[u+a]=m[a];return i}return ab(m)}var Vv=eS;var tp=class extends lo{constructor(u={}){super();this.properties={};this.options={};this.defineProperties(u),u.properties&&this.setProperties(u.properties),this.options=u,this.visible=u.visible===void 0?!0:!!u.visible,this.group=u.group,this.copyrights=u.copyrights,this.children=u.children,this.on("change:visible:group",m=>{this.group===m.target.group&&this!==m.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(a=>a.dispatchEvent(m))})}defineProperties(u={}){let{name:m,key:a,properties:l,hitTolerance:M}={...u},z=Vv();Object.defineProperties(this,{name:{value:m},key:{value:a||m||z},group:{get:()=>this.get("group"),set:D=>{this.set("group",D)}},copyrights:{get:()=>this.get("copyrights"),set:D=>{let q=D&&!Array.isArray(D)?[D]:D;this.set("copyrights",q||[])}},options:{value:u},map:{writable:!0},visible:{get:()=>this.get("visible"),set:D=>{if(D!==this.visible)if(this.set("visible",D),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(q=>q.visible)&&this.children.forEach(q=>{q.visible=!0}),this.parent&&this.group){let q=this.parent;for(;q.parent;)q=q.parent;let V=new nn("change:visible:group");V.target=this,q.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(q=>{q.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(q=>q.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:D=>{this.set("disabled",D)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:D=>{(this.children||[]).forEach(q=>{q.parent=void 0}),Array.isArray(D)&&D.forEach(q=>{q.parent=this}),this.set("children",D||[])}},hitTolerance:{value:M||5,writable:!0},properties:{value:{...l||{}}}})}attachToMap(u){this.detachFromMap(),this.map=u,this.children&&this.children.forEach(m=>{m.attachToMap(u)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(u,m){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:u})}flat(){return Yd(this)}};function tS(v){return class extends v{constructor(u={}){super(u);let{userInteractions:m=!0,userClickInteractions:a=!0,userHoverInteractions:l=!0,defaultUserInteractions:M=!0}=u;this.userInteractions=m,this.userClickInteractions=a,this.userHoverInteractions=l,this.defaultUserInteractions=M,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:D}=u;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&D&&this.onHover(D)}attachToMap(u){super.attachToMap(u),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(u=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:m,layer:a,coordinate:l,event:M}})=>{u(m,a,l,M)}))}),this.userHoverCallbacks.forEach(u=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:m,layer:a,coordinate:l,event:M}})=>{u(m,a,l,M)}))})}unlistenEvents(){Ja(this.userClickEventsKeys),Ja(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(u){this.userClickCallbacks.push(u),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(u){this.userHoverCallbacks.push(u),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(u){let m=this.userClickCallbacks.indexOf(u);m===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(m,1),this.map&&this.listenEvents())}unHover(u){let m=this.userHoverCallbacks.indexOf(u);m===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(m,1),this.map&&this.listenEvents())}onUserClickCallback(u){let m=u.coordinate||co(u.lngLat.toArray()),a={features:[],layer:this,coordinate:m,event:u};return this.getFeatureInfoAtCoordinate(m).then(l=>{let M=new nn("user:click");return M.target=l,this.dispatchEvent(M),l}).catch(()=>a)}onUserMoveCallback(u){let m=u.coordinate||co(u.lngLat.toArray()),a={features:[],layer:this,coordinate:m,event:u};return this.getFeatureInfoAtCoordinate(m).then(l=>{let M=new nn("user:hover");return M.target=l,this.dispatchEvent(M),l}).catch(()=>a)}activateUserInteractions(){}deactivateUserInteractions(){}}}var Cg=tS;var Bf=class extends Cg(tp){constructor(u){super(u);this.olLayer?.setVisible(this.visible)}defineProperties(u){super.defineProperties(u),Object.defineProperties(this,{olLayer:{value:u.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(u){if(super.attachToMap(u),!!this.map&&(this.olLayer?.setVisible(this.visible),this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.on("change:minZoom",()=>{this.olLayer&&this.get("minZoom")&&this.olLayer.setMinZoom(this.get("minZoom"))})),this.olListenersKeys.push(this.on("change:maxZoom",()=>{this.olLayer&&this.get("maxZoom")&&this.olLayer.setMaxZoom(this.get("maxZoom"))})),this.olListenersKeys.push(this.map.getLayers().on("remove",m=>{m.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let m=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(a=>{a.getSource&&a.getSource()?.setAttributions(m)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(m)}}detachFromMap(){this.deactivateUserInteractions(),Ja(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ja([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(u){return new Bf({...this.options,...u})}},As=Bf;var sb=new Cs({radius:6,fill:new ba({color:[255,0,0,1]}),stroke:new Wo({color:[0,0,0,1],width:1})}),iS=new Fa({stroke:new Wo({color:[0,0,0,1],width:5})}),rS=new Fa({image:sb,stroke:new Wo({color:[255,0,0,1],width:3})}),nS=new Fa({image:sb,stroke:new Wo({color:[255,0,0,1],width:3,lineDash:[1,10]})}),oS=(v,i)=>{let u=v.get("minResolution"),m=v.get("maxResolution"),a=i<=u&&i>m;return u&&m&&!a?[]:v.get("mot")!=="foot"?[iS,rS]:[nS]},Uf=class extends As{constructor(u){super(u);this.options={};this.olLayer=u.olLayer||new Qh({source:new ep,style:u.style||oS})}clone(u){return new Uf({...this.options,...u})}},Ag=Uf;var aS=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,lb=/^([\d.]+),([\d.]+)$/,ub=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,Mg="stop-fetch",cb=v=>{let i=[];return v.forEach(u=>{let m=u.getGeometry()?.getCoordinates();m?.length&&i.push(...m)}),i},Vf=class extends ad{constructor(u={}){super(u);this.viaPoints=[];this.loading=!1;this.graphs=[];this.modify=!0;this.useRawViaPoints=!1;this.snapToClosestStation=!1;this.cacheStationData={};this.abortControllers={};this.segments=[];this.format=new Sl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:m=>{m&&(this.set("mot",m),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:m=>{this.set("loading",m)}},modify:{get:()=>this.get("modify"),set:m=>{this.set("modify",m)}}}),this.loading=!1,this.graphs=u.graphs||[["osm",0,99]],this.mot=u.mot||"bus",this.modify=u.modify!==!1,this.routingApiParams=u.routingApiParams,this.useRawViaPoints=u.useRawViaPoints||!1,this.snapToClosestStation=u.snapToClosestStation||!1,this.apiKey=u.apiKey,this.stopsApiKey=u.stopsApiKey||this.apiKey,this.stopsApiUrl=u.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Xd({...u}),this.routingLayer=u.routingLayer||new Ag({name:"routing-layer",style:u.style}),this.onRouteError=u.onRouteError||(m=>{this.dispatchEvent(new nn("change:route")),this.reset(),console.error(m)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(u,m){let a=m.getView();return u.map(([,l,M])=>[a.getResolutionForZoom(l),a.getResolutionForZoom(M||l+1)])}addViaPoint(u,m=-1,a=0){this.viaPoints.splice(m===-1?this.viaPoints.length:m,a,u),this.drawRoute(),this.dispatchEvent(new nn("change:route"))}removeViaPoint(u=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[u]&&this.viaPoints.splice(u,1),this.drawRoute(),this.dispatchEvent(new nn("change:route"))}setViaPoints(u){this.viaPoints=[...u],this.drawRoute(),this.dispatchEvent(new nn("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new nn("change:route"))}abortRequests(){this.graphs.forEach(u=>{let m=u[0];this.abortControllers[m]&&this.abortControllers[m].abort(),this.abortControllers[m]=new AbortController}),this.abortControllers[Mg]?.abort(),this.abortControllers[Mg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer?.olLayer?.getSource()?.clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[Mg]);let u=this.viaPoints.map(m=>{if(Array.isArray(m)){let a=this.map?.getView().getProjection(),[l,M]=sh(m,a);return this.snapToClosestStation?[`@${M}`,l]:[M,l]}return this.useRawViaPoints?m:`!${m}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((m,a)=>this.drawViaPoint(m,a,this.abortControllers[Mg])),Promise.all(this.graphs.map(([m],a)=>{let{signal:l}=this.abortControllers[m];return this.api?this.api.route({graph:m,via:`${u.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:l}).then(M=>{if(this.segments=this.format.readFeatures(M),this.mot==="foot"){let q=this.segments.reduce((V,de)=>{let pe=de.get("trg");return V.find(Ie=>Ie[0]===pe[0]&&Ie[1]===pe[1])?V:[...V,pe]},[]);this.segments=q.map(V=>{let de=this.segments.filter(Ie=>{let Ne=Ie.get("trg");return Ne[0]===V[0]&&Ne[1]===V[1]}),pe=cb(de);return new Tu({geometry:new Wl(pe)})})}let z=cb(this.segments),D=new Tu({geometry:new Wl(z)});D.set("graph",m),D.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[a]?.length>=2&&(D.set("minResolution",this.graphsResolutions[a][0]),D.set("maxResolution",this.graphsResolutions[a][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(D),this.loading=!1}).catch(M=>{M.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new nn("error")),this.onRouteError(M,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(u,m,a){let l=new Tu;if(l.set("viaPointIdx",m),Array.isArray(u))return l.setGeometry(new xa(u)),this.routingLayer?.olLayer?.getSource()?.addFeature(l),Promise.resolve(l);if(!this.useRawViaPoints||ub.test(u)){let V,de;return this.useRawViaPoints?[,V,,de]=ub.exec(u)||[]:[V,de]=u.split("$"),fetch(`${this.stopsApiUrl}lookup/${V}?key=${this.stopsApiKey}`,{signal:a.signal}).then(pe=>pe.json()).then(pe=>{let{coordinates:Ie}=pe.features[0].geometry;return this.cacheStationData[u]=co(Ie),l.set("viaPointTrack",de),l.setGeometry(new xa(co(Ie))),this.routingLayer?.olLayer?.getSource()?.addFeature(l),l}).catch(pe=>{pe.name!=="AbortError"&&(this.dispatchEvent(new nn("error")),this.onRouteError(pe,this),this.loading=!1)})}if(this.useRawViaPoints&&lb.test(u)){let[V,de]=lb.exec(u)||[];if(de&&V){let pe=parseFloat(de),Ie=parseFloat(V),Ne=co([pe,Ie],this.map?.getView().getProjection());return l.setGeometry(new xa(Ne)),this.routingLayer?.olLayer?.getSource()?.addFeature(l),Promise.resolve(l)}}let[,M,,z,D,,q]=aS.exec(u)||[];if(D&&z){let V=co([parseFloat(D),parseFloat(z)],this.map?.getView().getProjection());return l.set("viaPointTrack",q),l.setGeometry(new xa(V)),this.routingLayer?.olLayer?.getSource()?.addFeature(l),Promise.resolve(l)}return M?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${M}&limit=1`,{signal:a.signal}).then(V=>V.json()).then(V=>{let{coordinates:de}=V.features[0].geometry;return this.cacheStationData[u]=co(de),l.set("viaPointTrack",q),l.setGeometry(new xa(co(de))),this.routingLayer?.olLayer?.getSource()?.addFeature(l),l}).catch(V=>(this.dispatchEvent(new nn("error")),this.onRouteError(V,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(u){let a=u.target.getFeaturesAtPixel(u.pixel).find(l=>l.getGeometry()?.getType()==="Point"&&l.get("viaPointIdx")!==void 0);if(a){this.removeViaPoint(a.get("viaPointIdx"));return}this.addViaPoint(u.coordinate)}onModifyStart(u){let m=-1,a=u.features.getArray().find(M=>M.getGeometry()?.getType()==="LineString");if(a&&a.getGeometry()&&u.mapBrowserEvent.coordinate){let M=_l(new xa(a.getGeometry()?.getClosestPoint(u.mapBrowserEvent.coordinate)).getExtent(),.001);m=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(M))}let l=(u.features.getArray().filter(M=>M.getGeometry()?.getType()==="Point")||[])[0];this.initialRouteDrag={viaPoint:l,oldRoute:a&&a.clone(),segmentIndex:m}}onModifyEnd(u){let m=u.mapBrowserEvent.coordinate,{oldRoute:a,viaPoint:l,segmentIndex:M}=this.initialRouteDrag||{};return l?this.addViaPoint(m,l.get("viaPointIdx"),1):a?M===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(m,(M||0)+1):this.addViaPoint(m,0,1)}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new kv({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:u=>{let a=u.target.getFeaturesAtPixel(u.pixel,{hitTolerance:5}).find(l=>l.getGeometry()?.getType()==="Point"&&l.get("index"));return Y1(u)&&a?(this.removeViaPoint(a.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){this.modify&&(this.removeListeners(),this.onMapClickKey=this.map?.on("singleclick",this.onMapClick))}removeListeners(){this.onMapClickKey&&Ja(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new Sl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Vf.getGraphsResolutions(this.graphs,this.map),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.routingLayer?.attachToMap(this.map),this.modifyInteraction&&this.map.addInteraction(this.modifyInteraction),this.modifyInteraction?.setActive(this.modify),this.addListeners())}deactivate(){this.map&&(this.routingLayer?.detachFromMap(),this.modifyInteraction&&this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}render(){}},hb=Vf;var Nv=class extends ad{constructor(u){super(u);let{apiParams:m,apiKey:a,url:l,placeholder:M}=u||{};this.apiParams={limit:20,...m||{}},this.placeholder=M||"Search for a stop...";let z={apiKey:a};l&&(z.url=l),this.api=new $d(z),this.abortController=new AbortController}deactivate(){}render(u){let m=u?.features||[];this.suggestionsElt&&(this.suggestionsElt.style.display=m.length?"block":"none",this.suggestionsElt.innerHTML="",m.forEach(a=>{let l=document.createElement("div");l.innerHTML=a?.properties?.name,l.onclick=()=>{this.onSuggestionClick(a)},Object.assign(l.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(l)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=u=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(u.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(u,m){return(u!==void 0||u!==null)&&(this.apiParams.q=u),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,m&&{signal:m.signal}).then(a=>{this.render(a)}).catch(()=>{this.render()})}onSuggestionClick(u){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},pb=Nv;var jv=class extends pb{onSuggestionClick(i){let u=co(i.geometry.coordinates);this.map.getView().setCenter(u)}},db=jv;var mb=Vp(fb());var Zv=class extends As{constructor(u){super(u);this.olLayer=new Kh({source:new dd({}),render:this.getOlLayerRender()}),this.styleUrl=u.url,this.apiKey=u.apiKey,this.apiKeyName=u.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(u){super.attachToMap(u),this.map&&(this.format=new Sl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let u=document.createElement("div");if(u.style.position="absolute",u.style.width="100%",u.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let m=this.getMapboxMapClass();this.mbMap=new m({style:Gh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:u,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new nn("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(u){let m=sc(u.target)||[];this.copyrights?.toString()!==m.toString()&&(this.copyrights=m,this.olLayer?.getSource()?.setAttributions(m))}getFeatureInfoAtCoordinate(u,m){if(!m||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:u,features:[],layer:this});let a=u&&this.mbMap.project(sh(u)),l;if(this.hitTolerance){let{x:z,y:D}=a;l=[{x:z-this.hitTolerance,y:D-this.hitTolerance},{x:z+this.hitTolerance,y:D+this.hitTolerance}]}let M=this.mbMap.queryRenderedFeatures(l||a,m).map(z=>{let D=this.format.readFeature(z);return D&&D.set("mapboxFeature",z),D});return Promise.resolve({layer:this,features:M,coordinate:u})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let u=document.createElement("div");return()=>u}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},Pg=Zv;var ip=class extends Pg{attachToMap(u){super.attachToMap(u),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(m){console.warn(m)}}))}loadMbMap(){let[u,m]=this.map?.getView().getCenter()||[];if((!u||!m)&&(u=0,m=0),this.renderState={center:[u,m],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{this.mbMap&&(this.mbMap.resize(),this.copyrights=sc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let a=this.mbMap.getCanvas();a&&(this.options.tabIndex?a.setAttribute("tabindex",`${this.options.tabIndex}`):a.removeAttribute("tabindex"))}getOlLayerRender(){return nd(this)}getMapboxMapClass(){return mb.Map}clone(u){return new ip({...this.options,...u})}};var _b=Vp(yb());var rp=class extends Pg{getOlLayerRender(){return rd(this)}getMapboxMapClass(){return _b.Map}clone(u){return new rp({...this.options,...u})}};var Nf=class extends As{constructor(u){super(u);this.mapboxLayer=u.mapboxLayer,this.disabled=!1,this.styleLayersFilter=u.styleLayersFilter,this.beforeId=u.beforeId,this.featureInfoFilter=u.featureInfoFilter||(m=>m),this.queryRenderedLayersFilter=u.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(u.styleLayer?[u.styleLayer]:u.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),u.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof u.filters=="function"?u.filters(this):u.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=m=>!!this.styleLayers?.find(a=>m.id===a.id))}attachToMap(u){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(u),super.attachToMap(u),!this.map||!this.mapboxLayer)return;let{mbMap:m}=this.mapboxLayer;if(!m){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(u)}));return}this.mapboxLayer.loaded||m.isStyleLoaded()||m.loaded()?this.onLoad():m.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",a=>{this.applyLayoutVisibility(a)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:u}=this.mapboxLayer;u.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(m=>{let{id:a,source:l}=m;u.getSource(l)&&a&&!u.getLayer(a)&&u.addLayer(m,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(m=>{let{id:a}=m;a&&u.getLayer(a)&&u.removeLayer(a)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer,m=u.getStyle();if(m&&this.styleLayersFilter){let a=m.layers.filter(this.styleLayersFilter);this.disabled=!a.length}}getFeatureInfoAtCoordinate(u){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:u,features:[],layer:this});let{mbMap:m}=this.mapboxLayer;if(!m.isStyleLoaded())return Promise.resolve({coordinate:u,features:[],layer:this});let a=this.styleLayers||[];return this.styleLayersFilter&&(a=m.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(a=m.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(u,{layers:a.map(l=>l&&l.id),validate:!1}).then(l=>{let M=l.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(M),{...l,features:M,layer:this}})}setFilter(u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:m}=this.mapboxLayer;this.styleLayers.forEach(({id:a})=>{a&&u&&m.getLayer(a)&&m.setFilter(a,u)})}setHoverState(u,m){if(!this.mapboxLayer?.mbMap)return;let{mbMap:a}=this.mapboxLayer;!u||!a||u.forEach(l=>{let{source:M,sourceLayer:z}=l.get("mapboxFeature")||{};if(!M&&!z||!l.getId()){l.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",l.getId(),l.getProperties());return}a.setFeatureState({id:l.getId(),source:M,sourceLayer:z},{hover:m})})}select(u=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=u,this.setHoverState(this.selectedFeatures||[],!0)}highlight(u=[]){let m=this.highlightedFeatures?.filter(a=>!(this.selectedFeatures||[]).map(l=>l.getId()).includes(a.getId()))||[];this.setHoverState(m,!1),this.highlightedFeatures=u,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(u){let{visible:m}=this,a=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:l}=this.mapboxLayer,M=l.getStyle();if(M&&a){let z=m?"visible":"none",D=M.layers||[];for(let q=0;q<D.length;q+=1){let V=D[q];a(V)&&l.getLayer(V.id)&&(l.setLayoutProperty(V.id,"visibility",z),(this.get("minZoom")||this.get("maxZoom"))&&l.setLayerZoomRange(V.id,this.get("minZoom")?this.get("minZoom")-1:0,this.get("maxZoom")?this.get("maxZoom")-1:24))}}}clone(u){return new Nf({...this.options,...u})}},vb=Nf;var Yv=Vp(Sb()),Jv=Vp(Ab());function NS(v){return class extends v{constructor(m){super({hitTolerance:10,...m});this.debug=m.debug||!1,this.mode=m.mode||Go.TOPOGRAPHIC,this.api=m.api||new Hd(m),this.tenant=m.tenant||"",this.minZoomInterpolation=m.minZoomInterpolation||8,this.format=new Sl,this.onStart=m.onStart,this.onStop=m.onStop;let a=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"],l=["rail"],M=["tram","subway","rail","bus"];this.motsByZoom=m.motsByZoom||[l,l,l,l,l,l,l,l,l,M,M,a,a,a,a],this.getMotsByZoom=z=>m.getMotsByZoom&&m.getMotsByZoom(z,this.motsByZoom)||this.motsByZoom[z]||this.motsByZoom[this.motsByZoom.length-1],this.generalizationLevelByZoom=m.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=z=>m.getGeneralizationLevelByZoom&&m.getGeneralizationLevelByZoom(z,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[z],this.renderTimeIntervalByZoom=m.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=z=>m.getRenderTimeIntervalByZoom&&m.getRenderTimeIntervalByZoom(z,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[z],this.isUpdateBboxOnMoveEnd=m.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,Jv.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,Yv.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(m){let{style:a,speed:l,pixelRatio:M,hoverVehicleId:z,selectedVehicleId:D,filter:q,sort:V,time:de,live:pe,canvas:Ie,styleOptions:Ne,mode:nt}=m,we=Ie,Pe=l||1,et=de||new Date,ut=nt||Go.TOPOGRAPHIC,mt=a||$h;super.defineProperties(m),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{get:()=>(we||(we=document.createElement("canvas")),we),set:ct=>{we=ct}},mode:{get:()=>ut,set:ct=>{ct!==ut&&(ut=ct,this.api?.wsApi?.open&&(this.stop(),this.start()))}},style:{get:()=>mt,set:ct=>{mt=ct,this.renderTrajectories()}},styleOptions:{value:{...od,...Ne||{}}},speed:{get:()=>Pe,set:ct=>{Pe=ct,this.start()}},filter:{value:q,writable:!0},sort:{value:V,writable:!0},live:{value:pe===!1?pe:!0,writable:!0},time:{get:()=>et,set:ct=>{et=ct&&ct.getTime?ct:new Date(ct),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:D,writable:!0},pixelRatio:{value:M||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:m.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:m.useThrottle!==!1,writable:!0},useDebounce:{value:m.useDebounce||!1,writable:!0}})}attachToMap(m){super.attachToMap(m),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",a=>{a.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ja(this.visibilityRef),this.canvas){let m=this.canvas.getContext("2d");m&&m.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap()}}start(){this.stop(),this.purgeOutOfDateTrajectories(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.onStart&&this.onStart(this)}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close(),this.onStop&&this.onStop(this)}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(m,a=!1){if(!this.map||!this.trajectories)return!1;let l=this.live?Date.now():this.time?.getTime(),M=Object.values(this.trajectories);return this.sort&&M.sort(this.sort),!this.canvas||!this.style||(this.renderState=gf(this.canvas,M,this.style,{...m,pixelRatio:this.pixelRatio||1,time:l},{filter:this.filter,noInterpolate:(m.zoom||0)<this.minZoomInterpolation?!0:a,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(m,a){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),m&&(!a&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(m,a)}):!a&&this.useDebounce?this.debounceRenderTrajectories(m,a):!a&&this.useThrottle?this.throttleRenderTrajectories(m,a):this.renderTrajectoriesInternal(m,a))}setBbox(m,a){if(this.trajectories&&m&&a){let M=Object.keys(this.trajectories);for(let z=M.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[M[z]],m,a)}if(!m)return;let l=[...m];this.isUpdateBboxOnMoveEnd&&a&&(l.push(a),this.generalizationLevel=this.getGeneralizationLevelByZoom(a),this.generalizationLevel&&l.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(a),this.mots&&l.push(`mots=${this.mots}`)),this.tenant&&l.push(`tenant=${this.tenant}`),this.mode!=="topographic"&&l.push(`channel_prefix=${this.mode}`),this.api.bbox=l}getRefreshTimeInMs(m=0){let a=m!==void 0?Math.round(m):-1,l=this.getRenderTimeIntervalByZoom(a)||25,M=Math.max(25,l/(this.speed||1)),z=Math.min(M,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,Jv.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,Yv.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,D]=this.api.buffer;this.api.buffer=[z,D]}return M}getVehicle(m){return this.trajectories&&Object.values(this.trajectories).filter(m)||[]}getFeatureInfoAtCoordinate(m,a){let{resolution:l,nb:M}=a,z=_l([...m,...m],this.hitTolerance*l),D=Object.values(this.trajectories||{});this.sort&&(D=D.sort(this.sort));let q=[];for(let V=0;V<D.length&&(D[V].properties.coordinate&&Ym(z,D[V].properties.coordinate)&&q.push(D[V]),q.length!==M);V+=1);return Promise.resolve({layer:this,features:q.map(V=>this.format.readFeature(V)),coordinate:m})}getTrajectoryInfos(m){let a=[this.api.getStopSequence(m),this.api.getFullTrajectory(m,this.mode,this.generalizationLevel)];return Promise.all(a).then(([l,M])=>({stopSequence:l,fullTrajectory:M}))}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([m,a])=>{let l=a?.properties?.time_intervals;this.time&&l.length&&l[l.length-1][0]<this.time&&this.removeTrajectory(m)})}purgeTrajectory(m,a,l){let{type:M,bounds:z}=m.properties;return this.isUpdateBboxOnMoveEnd&&!uo(a,z)||this.mots&&!this.mots.includes(M)?(this.removeTrajectory(m),!0):!1}addTrajectory(m){this.filter&&!this.filter(m)||(this.trajectories||(this.trajectories={}),this.trajectories[m.properties.train_id]=m,this.renderTrajectories())}removeTrajectory(m){let a;typeof m!="string"?a=m?.properties?.train_id:a=m,this.trajectories&&delete this.trajectories[a]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){this.visible&&(document.hidden?(this.stop(),this.trajectories={}):this.start())}onTrajectoryMessage(m){if(!m.content)return;let a=m.content,{geometry:l,properties:{train_id:M,time_since_update:z,raw_coordinates:D}}=a;z<0||this.purgeTrajectory(a)||(this.debug&&this.mode===Go.TOPOGRAPHIC&&D?a.properties.olGeometry=this.format.readGeometry({type:"Point",coordinates:co(D,this.map.getView().getProjection())}):a.properties.olGeometry=this.format.readGeometry(l),a.properties.timeOffset=Date.now()-m.timestamp,this.addTrajectory(a))}onDeleteTrajectoryMessage(m){m.content&&this.removeTrajectory(m.content)}onFeatureHover(m,a,l){let[M]=m,z=null;M&&(z=M.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(m,a,l){let[M]=m,z=null;M&&(z=M.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=M,this.renderTrajectories(!0))}}}var Rg=NS;var jS=new Fa({zIndex:2,image:new Cs({radius:5,fill:new ba({color:"#000000"})}),stroke:new Wo({color:"#000000",width:6})}),GS=(v,i,u)=>{let m="#ffffff",a=v.get("type"),l=v.get("stroke");return l&&l[0]!=="#"&&(l=`#${l}`),m=l||u?.getBgColor(a),m=/#ffffff/i.test(m)?"#ff0000":m,[jS,new Fa({zIndex:3,image:new Cs({radius:4,fill:new ba({color:m})}),stroke:new Wo({color:m,width:4})})]},Lg=GS;var qS=new Fa({zIndex:2,image:new Cs({radius:5,fill:new ba({color:"#000000"})}),stroke:new Wo({color:"#000000",width:6})}),ZS=new Fa({zIndex:3,image:new Cs({radius:4,fill:new ba({color:"#a0a0a0"})}),stroke:new Wo({color:"#a0a0a0",width:4})}),WS=()=>[qS,ZS],Mb=WS;var XS=new Sl,jf=class extends Rg(As){constructor(u){super({...u});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!u.allowRenderWhenAnimating,this.olLayer=u.olLayer||new Tv({layers:[new Qh({source:new ep({features:[]}),style:(m,a)=>(u.fullTrajectoryStyle||Lg)(m,a,this.styleOptions)}),new Kh({source:new dd({}),render:m=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:a,resolution:l,rotation:M}=m.viewState,{center:z,resolution:D,rotation:q}=this.renderedViewState;if(D/l>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let V=this.map.getPixelFromCoordinate(z),de=this.map.getPixelFromCoordinate(a);this.transformContainer.style.transform=Nx(V[0]-de[0],V[1]-de[1],D/l,D/l,M-q,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(u){super.attachToMap(u),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],m=>{let a=(m.map||m.target).getView();if(a.getAnimating()||a.getInteracting())return;let l=a.getZoom();this.currentZoom!==l&&this.onZoomEnd(),this.currentZoom=l,this.onMoveEnd(m)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(u){if(this.map&&this.canvas){let m=this.canvas.getContext("2d",{willReadFrequently:!0}),a=this.map.getPixelFromCoordinate(u);return!!m?.getImageData(a[0]*(this.pixelRatio||1),a[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(u){if(!this.map)return;let m=this.map.getView();m.getCenter()&&super.renderTrajectories({size:this.map.getSize(),center:m.getCenter(),extent:m.calculateExtent(),resolution:m.getResolution(),rotation:m.getRotation(),zoom:m.getZoom(),pixelRatio:this.pixelRatio},u)}renderTrajectoriesInternal(u,m){if(!this.map)return!1;let a=!1;return a=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(u,m),a&&(this.renderedViewState={...u},this.transformContainer&&(this.transformContainer.style.transform="")),a}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(u,m={}){if(!this.map||!this.map.getView())return Promise.resolve({layer:this,features:[],coordinate:u});let a=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(u,{resolution:a,...m})}onMoveEnd(u){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onFeatureHover(u,m,a){super.onFeatureHover(u,m,a),this.map.getTargetElement().style.cursor=u.length?"pointer":"auto"}onFeatureClick(u,m,a){super.onFeatureClick(u,m,a),!u.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(u,m,a){let l=this.map.getView().getCenter();return!m&&!l?!1:super.purgeTrajectory(u,m||this.map.getView().calculateExtent(),a||this.map.getView().getZoom())}setBbox(u,m){let a=u,l=m;!a&&this.isUpdateBboxOnMoveEnd&&(a=u||this.map.getView().calculateExtent(),l=Math.floor(this.map.getView().getZoom())),super.setBbox(a,l)}highlightTrajectory(u){return this.api.getFullTrajectory(u,this.mode,this.generalizationLevel).then(m=>{let a=m.content;if(this.vectorLayer.getSource().clear(),!a||!a.features||!a.features.length)return;let l=XS.readFeatures(a);return this.vectorLayer.getSource().addFeatures(l),l})}clone(u){return new jf({...this.options,...u})}},Pb=jf;var Gf=class extends As{getFeatureInfoAtCoordinate(i){let u=[];if(this.map){let m=this.map.getPixelFromCoordinate(i);u=this.map.getFeaturesAtPixel(m,{layerFilter:a=>a===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:u,layer:this,coordinate:i})}clone(i){return new Gf({...this.options,...i})}},kb=Gf;var qf=class extends As{constructor(u){super(u);this.abortController=new AbortController,this.format=new Sl}getFeatureInfoUrl(u){if(!this.map)return;let m=this.map.getView().getProjection(),a=this.map.getView().getResolution();if(a&&m&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(u,a,m,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(u){this.abortController?.abort(),this.abortController=new AbortController;let{signal:m}=this.abortController,a=this.getFeatureInfoUrl(u);return a?fetch(a,{signal:m}).then(l=>l.json()).then(l=>l.features).then(l=>({layer:this,coordinate:u,features:l.map(M=>this.format.readFeature(M))})).catch(()=>Promise.resolve({features:[],coordinate:u,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:u,layer:this}))}clone(u){return new qf({...this.options,...u})}},Rb=qf;var Bg={};wy(Bg,{CopyrightControl:()=>Lb,Layer:()=>Dg,RealtimeAPI:()=>Hd,RealtimeLayer:()=>Xb,RealtimeModes:()=>Go,RoutingAPI:()=>Xd,StopsAPI:()=>$d,compareDepartures:()=>yf,createCanvas:()=>Xl,createRealtimeFilters:()=>ky,debounceDeparturesMessages:()=>u_,debounceWebsocketMessages:()=>Kd,getCircleCanvas:()=>y_,getDelayBgCanvas:()=>m_,getDelayTextCanvas:()=>g_,getHoursAndMinutes:()=>Fx,getLayersAsFlatArray:()=>Yd,getMapboxMapCopyrights:()=>sc,getMapboxRender:()=>nd,getMaplibreRender:()=>rd,getMercatorResolution:()=>Og,getSourceCoordinates:()=>Xf,getTextCanvas:()=>__,getUTCDateString:()=>zx,getUTCTimeString:()=>Dx,getUrlWithParams:()=>Gh,pad:()=>$m,realtimeConfig:()=>od,realtimeDefaultStyle:()=>$h,realtimeDelayStyle:()=>v_,realtimeSimpleStyle:()=>x_,removeDuplicate:()=>qh,renderTrajectories:()=>gf,sortAndFilterDepartures:()=>_f,sortByDelay:()=>Ry});var Qv=class extends yg{constructor(i){super(i),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return sc(this.map)}},Lb=Qv;var Zf=class extends Cg(tp){attachToMap(u){super.attachToMap(u),this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ja(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let u=this.map.getBounds().toArray();return rf([...u[0],...u[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(u){return new Zf({...this.options,...u})}},Dg=Zf;var Xo=63710088e-1,zb={centimeters:Xo*100,centimetres:Xo*100,degrees:Xo/111325,feet:Xo*3.28084,inches:Xo*39.37,kilometers:Xo/1e3,kilometres:Xo/1e3,meters:Xo,metres:Xo,miles:Xo/1609.344,millimeters:Xo*1e3,millimetres:Xo*1e3,nauticalmiles:Xo/1852,radians:1,yards:Xo*1.0936},GB={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/Xo,yards:1.0936133};function Db(v,i,u){u===void 0&&(u={});var m={type:"Feature"};return(u.id===0||u.id)&&(m.id=u.id),u.bbox&&(m.bbox=u.bbox),m.properties=i||{},m.geometry=v,m}function vh(v,i,u){if(u===void 0&&(u={}),!v)throw new Error("coordinates is required");if(!Array.isArray(v))throw new Error("coordinates must be an Array");if(v.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ex(v[0])||!ex(v[1]))throw new Error("coordinates must contain numbers");var m={type:"Point",coordinates:v};return Db(m,i,u)}function $S(v,i){i===void 0&&(i="kilometers");var u=zb[i];if(!u)throw new Error(i+" units is invalid");return v*u}function KS(v,i){i===void 0&&(i="kilometers");var u=zb[i];if(!u)throw new Error(i+" units is invalid");return v/u}function Fb(v){var i=v%(2*Math.PI);return i*180/Math.PI}function np(v){var i=v%360;return i*Math.PI/180}function Fg(v,i,u){if(i===void 0&&(i="kilometers"),u===void 0&&(u="kilometers"),!(v>=0))throw new Error("length must be a positive number");return $S(KS(v,i),u)}function ex(v){return!isNaN(v)&&v!==null&&!Array.isArray(v)}function tx(v){return!!v&&v.constructor===Object}function Wf(v,i,u){if(v!==null)for(var m,a,l,M,z,D,q,V=0,de=0,pe,Ie=v.type,Ne=Ie==="FeatureCollection",nt=Ie==="Feature",we=Ne?v.features.length:1,Pe=0;Pe<we;Pe++){q=Ne?v.features[Pe].geometry:nt?v.geometry:v,pe=q?q.type==="GeometryCollection":!1,z=pe?q.geometries.length:1;for(var et=0;et<z;et++){var ut=0,mt=0;if(M=pe?q.geometries[et]:q,M!==null){D=M.coordinates;var ct=M.type;switch(V=u&&(ct==="Polygon"||ct==="MultiPolygon")?1:0,ct){case null:break;case"Point":if(i(D,de,Pe,ut,mt)===!1)return!1;de++,ut++;break;case"LineString":case"MultiPoint":for(m=0;m<D.length;m++){if(i(D[m],de,Pe,ut,mt)===!1)return!1;de++,ct==="MultiPoint"&&ut++}ct==="LineString"&&ut++;break;case"Polygon":case"MultiLineString":for(m=0;m<D.length;m++){for(a=0;a<D[m].length-V;a++){if(i(D[m][a],de,Pe,ut,mt)===!1)return!1;de++}ct==="MultiLineString"&&ut++,ct==="Polygon"&&mt++}ct==="Polygon"&&ut++;break;case"MultiPolygon":for(m=0;m<D.length;m++){for(mt=0,a=0;a<D[m].length;a++){for(l=0;l<D[m][a].length-V;l++){if(i(D[m][a][l],de,Pe,ut,mt)===!1)return!1;de++}mt++}ut++}break;case"GeometryCollection":for(m=0;m<M.geometries.length;m++)if(Wf(M.geometries[m],i,u)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function HS(v,i){i===void 0&&(i={});var u=0,m=0,a=0;return Wf(v,function(l){u+=l[0],m+=l[1],a++},!0),vh([u/a,m/a],i.properties)}var Ob=HS;function ku(v){if(!v)throw new Error("coord is required");if(!Array.isArray(v)){if(v.type==="Feature"&&v.geometry!==null&&v.geometry.type==="Point")return v.geometry.coordinates;if(v.type==="Point")return v.coordinates}if(Array.isArray(v)&&v.length>=2&&!Array.isArray(v[0])&&!Array.isArray(v[1]))return v;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Bb(v){if(Array.isArray(v))return v;if(v.type==="Feature"){if(v.geometry!==null)return v.geometry.coordinates}else if(v.coordinates)return v.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function YS(v,i,u){u===void 0&&(u={});var m;u.final?m=Ub(ku(i),ku(v)):m=Ub(ku(v),ku(i));var a=m>180?-(360-m):m;return a}function Ub(v,i){var u=np(v[1]),m=np(i[1]),a=np(i[0]-v[0]);a>Math.PI&&(a-=2*Math.PI),a<-Math.PI&&(a+=2*Math.PI);var l=Math.log(Math.tan(m/2+Math.PI/4)/Math.tan(u/2+Math.PI/4)),M=Math.atan2(a,l);return(Fb(M)+360)%360}var Vb=YS;function JS(v,i,u){u===void 0&&(u={});var m=ku(v),a=ku(i);a[0]+=a[0]-m[0]>180?-360:m[0]-a[0]>180?360:0;var l=QS(m,a),M=Fg(l,"meters",u.units);return M}function QS(v,i,u){u=u===void 0?Xo:Number(u);var m=u,a=v[1]*Math.PI/180,l=i[1]*Math.PI/180,M=l-a,z=Math.abs(i[0]-v[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var D=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(a/2+Math.PI/4)),q=Math.abs(D)>1e-11?M/D:Math.cos(a),V=Math.sqrt(M*M+q*q*z*z),de=V*m;return de}var Nb=JS;function eE(v,i,u,m){m===void 0&&(m={});var a=i<0,l=Fg(Math.abs(i),m.units,"meters");a&&(l=-Math.abs(l));var M=ku(v),z=tE(M,l,u);return z[0]+=z[0]-M[0]>180?-360:M[0]-z[0]>180?360:0,vh(z,m.properties)}function tE(v,i,u,m){m=m===void 0?Xo:Number(m);var a=i/m,l=v[0]*Math.PI/180,M=np(v[1]),z=np(u),D=a*Math.cos(z),q=M+D;Math.abs(q)>Math.PI/2&&(q=q>0?Math.PI-q:-Math.PI-q);var V=Math.log(Math.tan(q/2+Math.PI/4)/Math.tan(M/2+Math.PI/4)),de=Math.abs(V)>1e-11?D/V:Math.cos(M),pe=a*Math.sin(z)/de,Ie=l+pe;return[(Ie*180/Math.PI+540)%360-180,q*180/Math.PI]}var jb=eE;function iE(v){if(!v)throw new Error("geojson is required");switch(v.type){case"Feature":return Gb(v);case"FeatureCollection":return rE(v);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ix(v);default:throw new Error("unknown GeoJSON type")}}function Gb(v){var i={type:"Feature"};return Object.keys(v).forEach(function(u){switch(u){case"type":case"properties":case"geometry":return;default:i[u]=v[u]}}),i.properties=qb(v.properties),i.geometry=ix(v.geometry),i}function qb(v){var i={};return v&&Object.keys(v).forEach(function(u){var m=v[u];typeof m=="object"?m===null?i[u]=null:Array.isArray(m)?i[u]=m.map(function(a){return a}):i[u]=qb(m):i[u]=m}),i}function rE(v){var i={type:"FeatureCollection"};return Object.keys(v).forEach(function(u){switch(u){case"type":case"features":return;default:i[u]=v[u]}}),i.features=v.features.map(function(u){return Gb(u)}),i}function ix(v){var i={type:v.type};return v.bbox&&(i.bbox=v.bbox),v.type==="GeometryCollection"?(i.geometries=v.geometries.map(function(u){return ix(u)}),i):(i.coordinates=Zb(v.coordinates),i)}function Zb(v){var i=v;return typeof i[0]!="object"?i.slice():i.map(function(u){return Zb(u)})}var Wb=iE;function nE(v,i,u){if(u=u||{},!tx(u))throw new Error("options is invalid");var m=u.pivot,a=u.mutate;if(!v)throw new Error("geojson is required");if(i==null||isNaN(i))throw new Error("angle is required");return i===0||(m||(m=Ob(v)),(a===!1||a===void 0)&&(v=Wb(v)),Wf(v,function(l){var M=Vb(m,l),z=M+i,D=Nb(m,l),q=Bb(jb(m,D,z));l[0]=q[0],l[1]=q[1]})),v}var rx=nE;var oE=(v,i=1)=>{let{width:u,height:m}=v.getCanvas(),a=v.unproject({x:0,y:0}),l=v.unproject({x:0,y:m/i}),M=v.unproject({x:u/i,y:m/i}),z=v.unproject({x:u/i,y:0});return[[a.lng,a.lat],[z.lng,z.lat],[M.lng,M.lat],[l.lng,l.lat]]},Xf=oE;var aE=v=>{let i=v.getBounds().toArray(),u=co(i[0]),m=co(i[1]),a=[...u,...m],{width:l,height:M}=v.getCanvas(),z=bo(a)/l,D=vl(a)/M;return Math.max(z,D)},Og=aE;var nx=class extends Rg(Dg){constructor(i={}){super({...i}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(i,u){i&&(super.attachToMap(i),this.source={type:"canvas",canvas:this.canvas,coordinates:Xf(i,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=u,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},i.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(i=>{Ja(i)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(i){super.onUserMoveCallback({coordinate:co(i.lngLat.toArray()),...i})}renderTrajectories(i=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:u,height:m}=this.map.getCanvas(),a=this.map.getCenter(),l=this.map.unproject({x:0,y:m/this.pixelRatio}),M=this.map.unproject({x:u/this.pixelRatio,y:0}),z=rx(vh([l.lng,l.lat]),-this.map.getBearing(),{pivot:[a.lng,a.lat]}).geometry.coordinates,D=rx(vh([M.lng,M.lat]),-this.map.getBearing(),{pivot:[a.lng,a.lat]}).geometry.coordinates,q=[...co(z),...co(D)],V=bo(q)/(u/this.pixelRatio),de=vl(q)/(m/this.pixelRatio),pe=Math.max(V,de),Ie={size:[u/this.pixelRatio,m/this.pixelRatio],center:co([a.lng,a.lat]),extent:q,resolution:pe,zoom:this.getOlZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Ie,i)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(i,u={}){let m=Og(this.map);return super.getFeatureInfoAtCoordinate(i,{resolution:m,...u})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(i,u,m){return super.purgeTrajectory(i,u||this.getMercatorExtent(),m||Math.floor(this.getOlZoom()))}setBbox(i,u){let m=i,a=u;!m&&this.isUpdateBboxOnMoveEnd&&(m=i||this.getMercatorExtent(),a=Math.floor(this.getOlZoom())),super.setBbox(m,a)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(i,u=!1){let m=super.renderTrajectoriesInternal(i,u);if(m&&this.map.style){let a=Xf(this.map,this.pixelRatio),l=this.map.getSource(this.key);l&&l.setCoordinates(a)}return m}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(i,u,m){super.onFeatureHover(i,u,m),this.map.getCanvasContainer().style.cursor=i.length?"pointer":"auto"}},Xb=nx;var ox={ol:zg,mapbox:Bg};typeof window<"u"&&(window.mbt=ox);var q5=ox;})();
1084
1084
  //# sourceMappingURL=mbt.min.js.map