mobility-toolbox-js 2.0.0-beta.71 → 2.0.0-beta.74

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,12 +1072,12 @@ uniform ${se} ${pe} u_${xe};
1072
1072
  `),yt=W.createShader(W.FRAGMENT_SHADER);if(W.isContextLost())return void(this.failedToCreate=!0);W.shaderSource(yt,ct),W.compileShader(yt),W.attachShader(this.program,yt);let ft=W.createShader(W.VERTEX_SHADER);if(W.isContextLost())return void(this.failedToCreate=!0);W.shaderSource(ft,je),W.compileShader(ft),W.attachShader(this.program,ft),this.attributes={};let vt={};this.numAttributes=pe.length;for(let Et=0;Et<this.numAttributes;Et++)pe[Et]&&(W.bindAttribLocation(this.program,Et,pe[Et]),this.attributes[pe[Et]]=Et);W.linkProgram(this.program),W.deleteShader(ft),W.deleteShader(yt);for(let Et=0;Et<tt.length;Et++){let Rt=tt[Et];if(Rt&&!vt[Rt]){let xt=W.getUniformLocation(this.program,Rt);xt&&(vt[Rt]=xt)}}this.fixedUniforms=M(i,vt),this.terrainUniforms=((Et,Rt)=>({u_depth:new s.Uniform1i(Et,Rt.u_depth),u_terrain:new s.Uniform1i(Et,Rt.u_terrain),u_terrain_dim:new s.Uniform1f(Et,Rt.u_terrain_dim),u_terrain_matrix:new s.UniformMatrix4f(Et,Rt.u_terrain_matrix),u_terrain_unpack:new s.Uniform4f(Et,Rt.u_terrain_unpack),u_terrain_offset:new s.Uniform1f(Et,Rt.u_terrain_offset),u_terrain_exaggeration:new s.Uniform1f(Et,Rt.u_terrain_exaggeration)}))(i,vt),this.binderUniforms=T?T.getUniforms(i,vt):[]}draw(i,d,x,T,M,U,q,W,Y,se,pe,xe,Ge,ze,Be,tt,st,ct){let je=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(x),i.setStencilMode(T),i.setColorMode(M),i.setCullFace(U),W){i.activeTexture.set(je.TEXTURE2),je.bindTexture(je.TEXTURE_2D,W.depthTexture),i.activeTexture.set(je.TEXTURE3),je.bindTexture(je.TEXTURE_2D,W.texture);for(let ft in this.terrainUniforms)this.terrainUniforms[ft].set(W[ft])}for(let ft in this.fixedUniforms)this.fixedUniforms[ft].set(q[ft]);Be&&Be.setUniforms(i,this.binderUniforms,Ge,{zoom:ze});let yt=0;switch(d){case je.LINES:yt=2;break;case je.TRIANGLES:yt=3;break;case je.LINE_STRIP:yt=1}for(let ft of xe.get()){let vt=ft.vaos||(ft.vaos={});(vt[Y]||(vt[Y]=new Cs)).bind(i,this,se,Be?Be.getPaintVertexBuffers():[],pe,ft.vertexOffset,tt,st,ct),je.drawElements(d,ft.primitiveLength*yt,je.UNSIGNED_SHORT,ft.primitiveOffset*yt*2)}}}function Hn(E,i,d){let x=1/te(d,1,i.transform.tileZoom),T=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,i.transform.tileZoom)/T,U=M*(d.tileID.canonical.x+d.tileID.wrap*T),q=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[x,E.fromScale,E.toScale],u_fade:E.t,u_pixel_coord_upper:[U>>16,q>>16],u_pixel_coord_lower:[65535&U,65535&q]}}let _n=(E,i,d,x)=>{let T=i.style.light,M=T.properties.get("position"),U=[M.x,M.y,M.z],q=s.create$1();T.properties.get("anchor")==="viewport"&&s.fromRotation(q,-i.transform.angle),s.transformMat3(U,U,q);let W=T.properties.get("color");return{u_matrix:E,u_lightpos:U,u_lightintensity:T.properties.get("intensity"),u_lightcolor:[W.r,W.g,W.b],u_vertical_gradient:+d,u_opacity:x}},Xo=(E,i,d,x,T,M,U)=>s.extend(_n(E,i,d,x),Hn(M,i,U),{u_height_factor:-Math.pow(2,T.overscaledZ)/U.tileSize/8}),Si=E=>({u_matrix:E}),zo=(E,i,d,x)=>s.extend(Si(E),Hn(d,i,x)),To=(E,i)=>({u_matrix:E,u_world:i}),Lu=(E,i,d,x,T)=>s.extend(zo(E,i,d,x),{u_world:T}),Do=(E,i,d,x)=>{let T=E.transform,M,U;if(x.paint.get("circle-pitch-alignment")==="map"){let q=te(d,1,T.zoom);M=!0,U=[q,q]}else M=!1,U=T.pixelsToGLUnits;return{u_camera_to_center_distance:T.cameraToCenterDistance,u_scale_with_map:+(x.paint.get("circle-pitch-scale")==="map"),u_matrix:E.translatePosMatrix(i.posMatrix,d,x.paint.get("circle-translate"),x.paint.get("circle-translate-anchor")),u_pitch_with_map:+M,u_device_pixel_ratio:E.pixelRatio,u_extrude_scale:U}},As=(E,i,d)=>{let x=te(d,1,i.zoom),T=Math.pow(2,i.zoom-d.tileID.overscaledZ),M=d.tileID.overscaleFactor();return{u_matrix:E,u_camera_to_center_distance:i.cameraToCenterDistance,u_pixels_to_tile_units:x,u_extrude_scale:[i.pixelsToGLUnits[0]/(x*T),i.pixelsToGLUnits[1]/(x*T)],u_overscale_factor:M}},Oo=(E,i,d=1)=>({u_matrix:E,u_color:i,u_overlay:0,u_overlay_scale:d}),un=E=>({u_matrix:E}),Fo=(E,i,d,x)=>({u_matrix:E,u_extrude_scale:te(i,1,d),u_intensity:x});function zn(E,i){let d=Math.pow(2,i.canonical.z),x=i.canonical.y;return[new s.MercatorCoordinate(0,x/d).toLngLat().lat,new s.MercatorCoordinate(0,(x+1)/d).toLngLat().lat]}let Wo=(E,i,d,x)=>{let T=E.transform;return{u_matrix:Js(E,i,d,x),u_ratio:1/te(i,1,T.zoom),u_device_pixel_ratio:E.pixelRatio,u_units_to_pixels:[1/T.pixelsToGLUnits[0],1/T.pixelsToGLUnits[1]]}},Ru=(E,i,d,x,T)=>s.extend(Wo(E,i,d,T),{u_image:0,u_image_height:x}),Hl=(E,i,d,x,T)=>{let M=E.transform,U=Yi(i,M);return{u_matrix:Js(E,i,d,T),u_texsize:i.imageAtlasTexture.size,u_ratio:1/te(i,1,M.zoom),u_device_pixel_ratio:E.pixelRatio,u_image:0,u_scale:[U,x.fromScale,x.toScale],u_fade:x.t,u_units_to_pixels:[1/M.pixelsToGLUnits[0],1/M.pixelsToGLUnits[1]]}},Ps=(E,i,d,x,T,M)=>{let U=E.lineAtlas,q=Yi(i,E.transform),W=d.layout.get("line-cap")==="round",Y=U.getDash(x.from,W),se=U.getDash(x.to,W),pe=Y.width*T.fromScale,xe=se.width*T.toScale;return s.extend(Wo(E,i,d,M),{u_patternscale_a:[q/pe,-Y.height/2],u_patternscale_b:[q/xe,-se.height/2],u_sdfgamma:U.width/(256*Math.min(pe,xe)*E.pixelRatio)/2,u_image:0,u_tex_y_a:Y.y,u_tex_y_b:se.y,u_mix:T.t})};function Yi(E,i){return 1/te(E,1,i.tileZoom)}function Js(E,i,d,x){return E.translatePosMatrix(x?x.posMatrix:i.tileID.posMatrix,i,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}let vc=(E,i,d,x,T)=>{return{u_matrix:E,u_tl_parent:i,u_scale_parent:d,u_buffer_scale:1,u_fade_t:x.mix,u_opacity:x.opacity*T.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:T.paint.get("raster-brightness-min"),u_brightness_high:T.paint.get("raster-brightness-max"),u_saturation_factor:(U=T.paint.get("raster-saturation"),U>0?1-1/(1.001-U):-U),u_contrast_factor:(M=T.paint.get("raster-contrast"),M>0?1/(1-M):1+M),u_spin_weights:zu(T.paint.get("raster-hue-rotate"))};var M,U};function zu(E){E*=Math.PI/180;let i=Math.sin(E),d=Math.cos(E);return[(2*d+1)/3,(-Math.sqrt(3)*i-d+1)/3,(Math.sqrt(3)*i-d+1)/3]}let Yl=(E,i,d,x,T,M,U,q,W,Y)=>{let se=T.transform;return{u_is_size_zoom_constant:+(E==="constant"||E==="source"),u_is_size_feature_constant:+(E==="constant"||E==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.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:T.options.fadeDuration?T.symbolFadeChange:1,u_matrix:M,u_label_plane_matrix:U,u_coord_matrix:q,u_is_text:+W,u_pitch_with_map:+x,u_texsize:Y,u_texture:0}},Da=(E,i,d,x,T,M,U,q,W,Y,se)=>{let pe=T.transform;return s.extend(Yl(E,i,d,x,T,M,U,q,W,Y),{u_gamma_scale:x?Math.cos(pe._pitch)*pe.cameraToCenterDistance:1,u_device_pixel_ratio:T.pixelRatio,u_is_halo:+se})},Jl=(E,i,d,x,T,M,U,q,W,Y)=>s.extend(Da(E,i,d,x,T,M,U,q,!0,W,!0),{u_texsize_icon:Y,u_texture_icon:1}),wl=(E,i,d)=>({u_matrix:E,u_opacity:i,u_color:d}),xc=(E,i,d,x,T,M)=>s.extend(function(U,q,W,Y){let se=W.imageManager.getPattern(U.from.toString()),pe=W.imageManager.getPattern(U.to.toString()),{width:xe,height:Ge}=W.imageManager.getPixelSize(),ze=Math.pow(2,Y.tileID.overscaledZ),Be=Y.tileSize*Math.pow(2,W.transform.tileZoom)/ze,tt=Be*(Y.tileID.canonical.x+Y.tileID.wrap*ze),st=Be*Y.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:se.tl,u_pattern_br_a:se.br,u_pattern_tl_b:pe.tl,u_pattern_br_b:pe.br,u_texsize:[xe,Ge],u_mix:q.t,u_pattern_size_a:se.displaySize,u_pattern_size_b:pe.displaySize,u_scale_a:q.fromScale,u_scale_b:q.toScale,u_tile_units_to_pixels:1/te(Y,1,W.transform.tileZoom),u_pixel_coord_upper:[tt>>16,st>>16],u_pixel_coord_lower:[65535&tt,65535&st]}}(x,M,d,T),{u_matrix:E,u_opacity:i}),Qs={fillExtrusion:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_lightpos:new s.Uniform3f(E,i.u_lightpos),u_lightintensity:new s.Uniform1f(E,i.u_lightintensity),u_lightcolor:new s.Uniform3f(E,i.u_lightcolor),u_vertical_gradient:new s.Uniform1f(E,i.u_vertical_gradient),u_opacity:new s.Uniform1f(E,i.u_opacity)}),fillExtrusionPattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_lightpos:new s.Uniform3f(E,i.u_lightpos),u_lightintensity:new s.Uniform1f(E,i.u_lightintensity),u_lightcolor:new s.Uniform3f(E,i.u_lightcolor),u_vertical_gradient:new s.Uniform1f(E,i.u_vertical_gradient),u_height_factor:new s.Uniform1f(E,i.u_height_factor),u_image:new s.Uniform1i(E,i.u_image),u_texsize:new s.Uniform2f(E,i.u_texsize),u_pixel_coord_upper:new s.Uniform2f(E,i.u_pixel_coord_upper),u_pixel_coord_lower:new s.Uniform2f(E,i.u_pixel_coord_lower),u_scale:new s.Uniform3f(E,i.u_scale),u_fade:new s.Uniform1f(E,i.u_fade),u_opacity:new s.Uniform1f(E,i.u_opacity)}),fill:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),fillPattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_image:new s.Uniform1i(E,i.u_image),u_texsize:new s.Uniform2f(E,i.u_texsize),u_pixel_coord_upper:new s.Uniform2f(E,i.u_pixel_coord_upper),u_pixel_coord_lower:new s.Uniform2f(E,i.u_pixel_coord_lower),u_scale:new s.Uniform3f(E,i.u_scale),u_fade:new s.Uniform1f(E,i.u_fade)}),fillOutline:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_world:new s.Uniform2f(E,i.u_world)}),fillOutlinePattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_world:new s.Uniform2f(E,i.u_world),u_image:new s.Uniform1i(E,i.u_image),u_texsize:new s.Uniform2f(E,i.u_texsize),u_pixel_coord_upper:new s.Uniform2f(E,i.u_pixel_coord_upper),u_pixel_coord_lower:new s.Uniform2f(E,i.u_pixel_coord_lower),u_scale:new s.Uniform3f(E,i.u_scale),u_fade:new s.Uniform1f(E,i.u_fade)}),circle:(E,i)=>({u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_scale_with_map:new s.Uniform1i(E,i.u_scale_with_map),u_pitch_with_map:new s.Uniform1i(E,i.u_pitch_with_map),u_extrude_scale:new s.Uniform2f(E,i.u_extrude_scale),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),collisionBox:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_pixels_to_tile_units:new s.Uniform1f(E,i.u_pixels_to_tile_units),u_extrude_scale:new s.Uniform2f(E,i.u_extrude_scale),u_overscale_factor:new s.Uniform1f(E,i.u_overscale_factor)}),collisionCircle:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_inv_matrix:new s.UniformMatrix4f(E,i.u_inv_matrix),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_viewport_size:new s.Uniform2f(E,i.u_viewport_size)}),debug:(E,i)=>({u_color:new s.UniformColor(E,i.u_color),u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_overlay:new s.Uniform1i(E,i.u_overlay),u_overlay_scale:new s.Uniform1f(E,i.u_overlay_scale)}),clippingMask:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),heatmap:(E,i)=>({u_extrude_scale:new s.Uniform1f(E,i.u_extrude_scale),u_intensity:new s.Uniform1f(E,i.u_intensity),u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),heatmapTexture:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_world:new s.Uniform2f(E,i.u_world),u_image:new s.Uniform1i(E,i.u_image),u_color_ramp:new s.Uniform1i(E,i.u_color_ramp),u_opacity:new s.Uniform1f(E,i.u_opacity)}),hillshade:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_image:new s.Uniform1i(E,i.u_image),u_latrange:new s.Uniform2f(E,i.u_latrange),u_light:new s.Uniform2f(E,i.u_light),u_shadow:new s.UniformColor(E,i.u_shadow),u_highlight:new s.UniformColor(E,i.u_highlight),u_accent:new s.UniformColor(E,i.u_accent)}),hillshadePrepare:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_image:new s.Uniform1i(E,i.u_image),u_dimension:new s.Uniform2f(E,i.u_dimension),u_zoom:new s.Uniform1f(E,i.u_zoom),u_unpack:new s.Uniform4f(E,i.u_unpack)}),line:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_ratio:new s.Uniform1f(E,i.u_ratio),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_units_to_pixels:new s.Uniform2f(E,i.u_units_to_pixels)}),lineGradient:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_ratio:new s.Uniform1f(E,i.u_ratio),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_units_to_pixels:new s.Uniform2f(E,i.u_units_to_pixels),u_image:new s.Uniform1i(E,i.u_image),u_image_height:new s.Uniform1f(E,i.u_image_height)}),linePattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_texsize:new s.Uniform2f(E,i.u_texsize),u_ratio:new s.Uniform1f(E,i.u_ratio),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_image:new s.Uniform1i(E,i.u_image),u_units_to_pixels:new s.Uniform2f(E,i.u_units_to_pixels),u_scale:new s.Uniform3f(E,i.u_scale),u_fade:new s.Uniform1f(E,i.u_fade)}),lineSDF:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_ratio:new s.Uniform1f(E,i.u_ratio),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_units_to_pixels:new s.Uniform2f(E,i.u_units_to_pixels),u_patternscale_a:new s.Uniform2f(E,i.u_patternscale_a),u_patternscale_b:new s.Uniform2f(E,i.u_patternscale_b),u_sdfgamma:new s.Uniform1f(E,i.u_sdfgamma),u_image:new s.Uniform1i(E,i.u_image),u_tex_y_a:new s.Uniform1f(E,i.u_tex_y_a),u_tex_y_b:new s.Uniform1f(E,i.u_tex_y_b),u_mix:new s.Uniform1f(E,i.u_mix)}),raster:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_tl_parent:new s.Uniform2f(E,i.u_tl_parent),u_scale_parent:new s.Uniform1f(E,i.u_scale_parent),u_buffer_scale:new s.Uniform1f(E,i.u_buffer_scale),u_fade_t:new s.Uniform1f(E,i.u_fade_t),u_opacity:new s.Uniform1f(E,i.u_opacity),u_image0:new s.Uniform1i(E,i.u_image0),u_image1:new s.Uniform1i(E,i.u_image1),u_brightness_low:new s.Uniform1f(E,i.u_brightness_low),u_brightness_high:new s.Uniform1f(E,i.u_brightness_high),u_saturation_factor:new s.Uniform1f(E,i.u_saturation_factor),u_contrast_factor:new s.Uniform1f(E,i.u_contrast_factor),u_spin_weights:new s.Uniform3f(E,i.u_spin_weights)}),symbolIcon:(E,i)=>({u_is_size_zoom_constant:new s.Uniform1i(E,i.u_is_size_zoom_constant),u_is_size_feature_constant:new s.Uniform1i(E,i.u_is_size_feature_constant),u_size_t:new s.Uniform1f(E,i.u_size_t),u_size:new s.Uniform1f(E,i.u_size),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_pitch:new s.Uniform1f(E,i.u_pitch),u_rotate_symbol:new s.Uniform1i(E,i.u_rotate_symbol),u_aspect_ratio:new s.Uniform1f(E,i.u_aspect_ratio),u_fade_change:new s.Uniform1f(E,i.u_fade_change),u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_label_plane_matrix:new s.UniformMatrix4f(E,i.u_label_plane_matrix),u_coord_matrix:new s.UniformMatrix4f(E,i.u_coord_matrix),u_is_text:new s.Uniform1i(E,i.u_is_text),u_pitch_with_map:new s.Uniform1i(E,i.u_pitch_with_map),u_texsize:new s.Uniform2f(E,i.u_texsize),u_texture:new s.Uniform1i(E,i.u_texture)}),symbolSDF:(E,i)=>({u_is_size_zoom_constant:new s.Uniform1i(E,i.u_is_size_zoom_constant),u_is_size_feature_constant:new s.Uniform1i(E,i.u_is_size_feature_constant),u_size_t:new s.Uniform1f(E,i.u_size_t),u_size:new s.Uniform1f(E,i.u_size),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_pitch:new s.Uniform1f(E,i.u_pitch),u_rotate_symbol:new s.Uniform1i(E,i.u_rotate_symbol),u_aspect_ratio:new s.Uniform1f(E,i.u_aspect_ratio),u_fade_change:new s.Uniform1f(E,i.u_fade_change),u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_label_plane_matrix:new s.UniformMatrix4f(E,i.u_label_plane_matrix),u_coord_matrix:new s.UniformMatrix4f(E,i.u_coord_matrix),u_is_text:new s.Uniform1i(E,i.u_is_text),u_pitch_with_map:new s.Uniform1i(E,i.u_pitch_with_map),u_texsize:new s.Uniform2f(E,i.u_texsize),u_texture:new s.Uniform1i(E,i.u_texture),u_gamma_scale:new s.Uniform1f(E,i.u_gamma_scale),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_is_halo:new s.Uniform1i(E,i.u_is_halo)}),symbolTextAndIcon:(E,i)=>({u_is_size_zoom_constant:new s.Uniform1i(E,i.u_is_size_zoom_constant),u_is_size_feature_constant:new s.Uniform1i(E,i.u_is_size_feature_constant),u_size_t:new s.Uniform1f(E,i.u_size_t),u_size:new s.Uniform1f(E,i.u_size),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_pitch:new s.Uniform1f(E,i.u_pitch),u_rotate_symbol:new s.Uniform1i(E,i.u_rotate_symbol),u_aspect_ratio:new s.Uniform1f(E,i.u_aspect_ratio),u_fade_change:new s.Uniform1f(E,i.u_fade_change),u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_label_plane_matrix:new s.UniformMatrix4f(E,i.u_label_plane_matrix),u_coord_matrix:new s.UniformMatrix4f(E,i.u_coord_matrix),u_is_text:new s.Uniform1i(E,i.u_is_text),u_pitch_with_map:new s.Uniform1i(E,i.u_pitch_with_map),u_texsize:new s.Uniform2f(E,i.u_texsize),u_texsize_icon:new s.Uniform2f(E,i.u_texsize_icon),u_texture:new s.Uniform1i(E,i.u_texture),u_texture_icon:new s.Uniform1i(E,i.u_texture_icon),u_gamma_scale:new s.Uniform1f(E,i.u_gamma_scale),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_is_halo:new s.Uniform1i(E,i.u_is_halo)}),background:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_opacity:new s.Uniform1f(E,i.u_opacity),u_color:new s.UniformColor(E,i.u_color)}),backgroundPattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_opacity:new s.Uniform1f(E,i.u_opacity),u_image:new s.Uniform1i(E,i.u_image),u_pattern_tl_a:new s.Uniform2f(E,i.u_pattern_tl_a),u_pattern_br_a:new s.Uniform2f(E,i.u_pattern_br_a),u_pattern_tl_b:new s.Uniform2f(E,i.u_pattern_tl_b),u_pattern_br_b:new s.Uniform2f(E,i.u_pattern_br_b),u_texsize:new s.Uniform2f(E,i.u_texsize),u_mix:new s.Uniform1f(E,i.u_mix),u_pattern_size_a:new s.Uniform2f(E,i.u_pattern_size_a),u_pattern_size_b:new s.Uniform2f(E,i.u_pattern_size_b),u_scale_a:new s.Uniform1f(E,i.u_scale_a),u_scale_b:new s.Uniform1f(E,i.u_scale_b),u_pixel_coord_upper:new s.Uniform2f(E,i.u_pixel_coord_upper),u_pixel_coord_lower:new s.Uniform2f(E,i.u_pixel_coord_lower),u_tile_units_to_pixels:new s.Uniform1f(E,i.u_tile_units_to_pixels)}),terrain:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_texture:new s.Uniform1i(E,i.u_texture)}),terrainDepth:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),terrainCoords:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_texture:new s.Uniform1i(E,i.u_texture),u_terrain_coords_id:new s.Uniform1f(E,i.u_terrain_coords_id)})};class So{constructor(i,d,x){this.context=i;let T=i.gl;this.buffer=T.createBuffer(),this.dynamicDraw=Boolean(x),this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),T.bufferData(T.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?T.DYNAMIC_DRAW:T.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){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,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let ba={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class wa{constructor(i,d,x,T){this.length=d.length,this.attributes=x,this.itemSize=d.bytesPerElement,this.dynamicDraw=T,this.context=i;let M=i.gl;this.buffer=M.createBuffer(),i.bindVertexBuffer.set(this.buffer),M.bufferData(M.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?M.DYNAMIC_DRAW:M.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);let d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,d){for(let x=0;x<this.attributes.length;x++){let T=d.attributes[this.attributes[x].name];T!==void 0&&i.enableVertexAttribArray(T)}}setVertexAttribPointers(i,d,x){for(let T=0;T<this.attributes.length;T++){let M=this.attributes[T],U=d.attributes[M.name];U!==void 0&&i.vertexAttribPointer(U,M.components,i[ba[M.type]],!1,this.itemSize,M.offset+this.itemSize*(x||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ii{constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Oa extends ii{getDefault(){return s.Color.transparent}set(i){let d=this.current;(i.r!==d.r||i.g!==d.g||i.b!==d.b||i.a!==d.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class es extends ii{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class ts extends ii{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class Nn extends ii{getDefault(){return[!0,!0,!0,!0]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||i[2]!==d[2]||i[3]!==d[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class cn extends ii{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class Vn extends ii{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class Ql extends ii{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){let d=this.current;(i.func!==d.func||i.ref!==d.ref||i.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class eu extends ii{getDefault(){let i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||i[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class tu extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;i?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=i,this.dirty=!1}}class El extends ii{getDefault(){return[0,1]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class Tl extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;i?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=i,this.dirty=!1}}class el extends ii{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class Sl extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;i?d.enable(d.BLEND):d.disable(d.BLEND),this.current=i,this.dirty=!1}}class ru extends ii{getDefault(){let i=this.gl;return[i.ONE,i.ZERO]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(i[0],i[1]),this.current=i,this.dirty=!1)}}class Il extends ii{getDefault(){return s.Color.transparent}set(i){let d=this.current;(i.r!==d.r||i.g!==d.g||i.b!==d.b||i.a!==d.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class bc extends ii{getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquation(i),this.current=i,this.dirty=!1)}}class tl extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;i?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=i,this.dirty=!1}}class Ea extends ii{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class wc extends ii{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}class Gn extends ii{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}}class Du extends ii{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class rs extends ii{getDefault(){let i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||i[2]!==d[2]||i[3]!==d[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class is extends ii{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class Ms extends ii{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Fa extends ii{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.bindTexture(d.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class oa extends ii{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Ba extends ii{getDefault(){return null}set(i){let d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Ua extends ii{constructor(i){super(i),this.vao=i.extVertexArrayObject}getDefault(){return null}set(i){this.vao&&(i!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(i),this.current=i,this.dirty=!1)}}class Bo extends ii{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class Ou extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class Fu extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class ci extends ii{constructor(i,d){super(i),this.context=i,this.parent=d}getDefault(){return null}}class ks extends ci{setDirty(){this.dirty=!0}set(i){if(i===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,i,0),this.current=i,this.dirty=!1}}class Cl extends ci{set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Ls{constructor(i,d,x,T){this.context=i,this.width=d,this.height=x;let M=i.gl,U=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new ks(i,U),T&&(this.depthAttachment=new Cl(i,U)),M.checkFramebufferStatus(M.FRAMEBUFFER)!==M.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let i=this.context.gl,d=this.colorAttachment.get();if(d&&i.deleteTexture(d),this.depthAttachment){let x=this.depthAttachment.get();x&&i.deleteRenderbuffer(x)}i.deleteFramebuffer(this.framebuffer)}}class Ui{constructor(i,d,x){this.blendFunction=i,this.blendColor=d,this.mask=x}}Ui.Replace=[1,0],Ui.disabled=new Ui(Ui.Replace,s.Color.transparent,[!1,!1,!1,!1]),Ui.unblended=new Ui(Ui.Replace,s.Color.transparent,[!0,!0,!0,!0]),Ui.alphaBlended=new Ui([1,771],s.Color.transparent,[!0,!0,!0,!0]);class Bu{constructor(i){this.gl=i,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Oa(this),this.clearDepth=new es(this),this.clearStencil=new ts(this),this.colorMask=new Nn(this),this.depthMask=new cn(this),this.stencilMask=new Vn(this),this.stencilFunc=new Ql(this),this.stencilOp=new eu(this),this.stencilTest=new tu(this),this.depthRange=new El(this),this.depthTest=new Tl(this),this.depthFunc=new el(this),this.blend=new Sl(this),this.blendFunc=new ru(this),this.blendColor=new Il(this),this.blendEquation=new bc(this),this.cullFace=new tl(this),this.cullFaceSide=new Ea(this),this.frontFace=new wc(this),this.program=new Gn(this),this.activeTexture=new Du(this),this.viewport=new rs(this),this.bindFramebuffer=new is(this),this.bindRenderbuffer=new Ms(this),this.bindTexture=new Fa(this),this.bindVertexBuffer=new oa(this),this.bindElementBuffer=new Ba(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ua(this),this.pixelStoreUnpack=new Bo(this),this.pixelStoreUnpackPremultiplyAlpha=new Ou(this),this.pixelStoreUnpackFlipY=new Fu(this),this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=i.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(i.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=i.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=i.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=i.getParameter(i.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(i,d){return new So(this,i,d)}createVertexBuffer(i,d,x){return new wa(this,i,d,x)}createRenderbuffer(i,d,x){let T=this.gl,M=T.createRenderbuffer();return this.bindRenderbuffer.set(M),T.renderbufferStorage(T.RENDERBUFFER,i,d,x),this.bindRenderbuffer.set(null),M}createFramebuffer(i,d,x){return new Ls(this,i,d,x)}clear({color:i,depth:d}){let x=this.gl,T=0;i&&(T|=x.COLOR_BUFFER_BIT,this.clearColor.set(i),this.colorMask.set([!0,!0,!0,!0])),d!==void 0&&(T|=x.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(d),this.depthMask.set(!0)),x.clear(T)}setCullFace(i){i.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(i){V(i.blendFunction,Ui.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor)),this.colorMask.set(i.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class ti{constructor(i,d,x){this.func=i,this.mask=d,this.range=x}}ti.ReadOnly=!1,ti.ReadWrite=!0,ti.disabled=new ti(519,ti.ReadOnly,[0,1]);let ni=7680;class hi{constructor(i,d,x,T,M,U){this.test=i,this.ref=d,this.mask=x,this.fail=T,this.depthFail=M,this.pass=U}}hi.disabled=new hi({func:519,mask:0},0,0,ni,ni,ni);class Ti{constructor(i,d,x){this.enable=i,this.mode=d,this.frontFace=x}}let rl;function Rs(E,i,d,x,T,M,U){let q=E.context,W=q.gl,Y=E.useProgram("collisionBox"),se=[],pe=0,xe=0;for(let je=0;je<x.length;je++){let yt=x[je],ft=i.getTile(yt),vt=ft.getBucket(d);if(!vt)continue;let Et=yt.posMatrix;T[0]===0&&T[1]===0||(Et=E.translatePosMatrix(yt.posMatrix,ft,T,M));let Rt=U?vt.textCollisionBox:vt.iconCollisionBox,xt=vt.collisionCircleArray;if(xt.length>0){let ir=s.create(),p=Et;s.mul(ir,vt.placementInvProjMatrix,E.transform.glCoordMatrix),s.mul(ir,ir,vt.placementViewportMatrix),se.push({circleArray:xt,circleOffset:xe,transform:p,invTransform:ir,coord:yt}),pe+=xt.length/4,xe=pe}Rt&&Y.draw(q,W.LINES,ti.disabled,hi.disabled,E.colorModeForRenderPass(),Ti.disabled,As(Et,E.transform,ft),E.style.terrain&&E.style.terrain.getTerrainData(yt),d.id,Rt.layoutVertexBuffer,Rt.indexBuffer,Rt.segments,null,E.transform.zoom,null,null,Rt.collisionVertexBuffer)}if(!U||!se.length)return;let Ge=E.useProgram("collisionCircle"),ze=new s.CollisionCircleLayoutArray;ze.resize(4*pe),ze._trim();let Be=0;for(let je of se)for(let yt=0;yt<je.circleArray.length/4;yt++){let ft=4*yt,vt=je.circleArray[ft+0],Et=je.circleArray[ft+1],Rt=je.circleArray[ft+2],xt=je.circleArray[ft+3];ze.emplace(Be++,vt,Et,Rt,xt,0),ze.emplace(Be++,vt,Et,Rt,xt,1),ze.emplace(Be++,vt,Et,Rt,xt,2),ze.emplace(Be++,vt,Et,Rt,xt,3)}(!rl||rl.length<2*pe)&&(rl=function(je){let yt=2*je,ft=new s.QuadTriangleArray;ft.resize(yt),ft._trim();for(let vt=0;vt<yt;vt++){let Et=6*vt;ft.uint16[Et+0]=4*vt+0,ft.uint16[Et+1]=4*vt+1,ft.uint16[Et+2]=4*vt+2,ft.uint16[Et+3]=4*vt+2,ft.uint16[Et+4]=4*vt+3,ft.uint16[Et+5]=4*vt+0}return ft}(pe));let tt=q.createIndexBuffer(rl,!0),st=q.createVertexBuffer(ze,s.collisionCircleLayout.members,!0);for(let je of se){let yt={u_matrix:je.transform,u_inv_matrix:je.invTransform,u_camera_to_center_distance:(ct=E.transform).cameraToCenterDistance,u_viewport_size:[ct.width,ct.height]};Ge.draw(q,W.TRIANGLES,ti.disabled,hi.disabled,E.colorModeForRenderPass(),Ti.disabled,yt,E.style.terrain&&E.style.terrain.getTerrainData(je.coord),d.id,st,tt,s.SegmentVector.simpleSegment(0,2*je.circleOffset,je.circleArray.length,je.circleArray.length/2),null,E.transform.zoom,null,null,null)}var ct;st.destroy(),tt.destroy()}Ti.disabled=new Ti(!1,1029,2305),Ti.backCCW=new Ti(!0,1029,2305);let Uu=s.identity(new Float32Array(16));function zs(E,i,d,x,T,M){let{horizontalAlign:U,verticalAlign:q}=s.getAnchorAlignment(E),W=-(U-.5)*i,Y=-(q-.5)*d,se=s.evaluateVariableOffset(E,x);return new s.pointGeometry((W/T+se[0])*M,(Y/T+se[1])*M)}function Nu(E,i,d,x,T,M,U,q,W,Y,se){let pe=E.text.placedSymbolArray,xe=E.text.dynamicLayoutVertexArray,Ge=E.icon.dynamicLayoutVertexArray,ze={};xe.clear();for(let Be=0;Be<pe.length;Be++){let tt=pe.get(Be),st=E.allowVerticalPlacement&&!tt.placedOrientation,ct=tt.hidden||!tt.crossTileID||st?null:x[tt.crossTileID];if(ct){let je=new s.pointGeometry(tt.anchorX,tt.anchorY),yt=Wr(je,d?U:M,se),ft=Ln(T.cameraToCenterDistance,yt.signedDistanceFromCamera),vt=s.evaluateSizeForFeature(E.textSizeData,W,tt)*ft/s.ONE_EM;d&&(vt*=E.tilePixelRatio/q);let{width:Et,height:Rt,anchor:xt,textOffset:ir,textBoxScale:p}=ct,m=zs(xt,Et,Rt,ir,p,vt),f=d?Wr(je.add(m),M,se).point:yt.point.add(i?m.rotate(-T.angle):m),v=E.allowVerticalPlacement&&tt.placedOrientation===s.WritingMode.vertical?Math.PI/2:0;for(let I=0;I<tt.numGlyphs;I++)s.addDynamicAttributes(xe,f,v);Y&&tt.associatedIconIndex>=0&&(ze[tt.associatedIconIndex]={shiftedAnchor:f,angle:v})}else Ir(tt.numGlyphs,xe)}if(Y){Ge.clear();let Be=E.icon.placedSymbolArray;for(let tt=0;tt<Be.length;tt++){let st=Be.get(tt);if(st.hidden)Ir(st.numGlyphs,Ge);else{let ct=ze[tt];if(ct)for(let je=0;je<st.numGlyphs;je++)s.addDynamicAttributes(Ge,ct.shiftedAnchor,ct.angle);else Ir(st.numGlyphs,Ge)}}E.icon.dynamicLayoutVertexBuffer.updateData(Ge)}E.text.dynamicLayoutVertexBuffer.updateData(xe)}function Ds(E,i,d){return d.iconsInText&&i?"symbolTextAndIcon":E?"symbolSDF":"symbolIcon"}function Ta(E,i,d,x,T,M,U,q,W,Y,se,pe){let xe=E.context,Ge=xe.gl,ze=E.transform,Be=q==="map",tt=W==="map",st=q!=="viewport"&&d.layout.get("symbol-placement")!=="point",ct=Be&&!tt&&!st,je=!d.layout.get("symbol-sort-key").isConstant(),yt=!1,ft=E.depthModeForSublayer(0,ti.ReadOnly),vt=d.layout.get("text-variable-anchor"),Et=[];for(let Rt of x){let xt=i.getTile(Rt),ir=xt.getBucket(d);if(!ir)continue;let p=T?ir.text:ir.icon;if(!p||!p.segments.get().length)continue;let m=p.programConfigurations.get(d.id),f=T||ir.sdfIcons,v=T?ir.textSizeData:ir.iconSizeData,I=tt||ze.pitch!==0,L=E.useProgram(Ds(f,T,ir),m),D=s.evaluateSizeForZoom(v,ze.zoom),G=E.style.terrain&&E.style.terrain.getTerrainData(Rt),K,ne,ye,be,Ee=[0,0],Fe=null;if(T){if(ne=xt.glyphAtlasTexture,ye=Ge.LINEAR,K=xt.glyphAtlasTexture.size,ir.iconsInText){Ee=xt.imageAtlasTexture.size,Fe=xt.imageAtlasTexture;let Mt=v.kind==="composite"||v.kind==="camera";be=I||E.options.rotating||E.options.zooming||Mt?Ge.LINEAR:Ge.NEAREST}}else{let Mt=d.layout.get("icon-size").constantOr(0)!==1||ir.iconsNeedLinear;ne=xt.imageAtlasTexture,ye=f||E.options.rotating||E.options.zooming||Mt||I?Ge.LINEAR:Ge.NEAREST,K=xt.imageAtlasTexture.size}let De=te(xt,1,E.transform.zoom),Ze=ho(Rt.posMatrix,tt,Be,E.transform,De),Me=yn(Rt.posMatrix,tt,Be,E.transform,De),Xe=vt&&ir.hasTextData(),Qe=d.layout.get("icon-text-fit")!=="none"&&Xe&&ir.hasIconData();if(st){let Mt=E.style.terrain?(fr,dr)=>E.style.terrain.getElevation(Rt,fr,dr):null,Ht=d.layout.get("text-rotation-alignment")==="map";fn(ir,Rt.posMatrix,E,T,Ze,Me,tt,Y,Ht,Mt)}let rt=E.translatePosMatrix(Rt.posMatrix,xt,M,U),at=st||T&&vt||Qe?Uu:Ze,lt=E.translatePosMatrix(Me,xt,M,U,!0),dt=f&&d.paint.get(T?"text-halo-width":"icon-halo-width").constantOr(1)!==0,bt;bt=f?ir.iconsInText?Jl(v.kind,D,ct,tt,E,rt,at,lt,K,Ee):Da(v.kind,D,ct,tt,E,rt,at,lt,T,K,!0):Yl(v.kind,D,ct,tt,E,rt,at,lt,T,K);let St={program:L,buffers:p,uniformValues:bt,atlasTexture:ne,atlasTextureIcon:Fe,atlasInterpolation:ye,atlasInterpolationIcon:be,isSDF:f,hasHalo:dt};if(je&&ir.canOverlap){yt=!0;let Mt=p.segments.get();for(let Ht of Mt)Et.push({segments:new s.SegmentVector([Ht]),sortKey:Ht.sortKey,state:St,terrainData:G})}else Et.push({segments:p.segments,sortKey:0,state:St,terrainData:G})}yt&&Et.sort((Rt,xt)=>Rt.sortKey-xt.sortKey);for(let Rt of Et){let xt=Rt.state;if(xe.activeTexture.set(Ge.TEXTURE0),xt.atlasTexture.bind(xt.atlasInterpolation,Ge.CLAMP_TO_EDGE),xt.atlasTextureIcon&&(xe.activeTexture.set(Ge.TEXTURE1),xt.atlasTextureIcon&&xt.atlasTextureIcon.bind(xt.atlasInterpolationIcon,Ge.CLAMP_TO_EDGE)),xt.isSDF){let ir=xt.uniformValues;xt.hasHalo&&(ir.u_is_halo=1,il(xt.buffers,Rt.segments,d,E,xt.program,ft,se,pe,ir,Rt.terrainData)),ir.u_is_halo=0}il(xt.buffers,Rt.segments,d,E,xt.program,ft,se,pe,xt.uniformValues,Rt.terrainData)}}function il(E,i,d,x,T,M,U,q,W,Y){let se=x.context;T.draw(se,se.gl.TRIANGLES,M,U,q,Ti.disabled,W,Y,d.id,E.layoutVertexBuffer,E.indexBuffer,i,d.paint,x.transform.zoom,E.programConfigurations.get(d.id),E.dynamicLayoutVertexBuffer,E.opacityVertexBuffer)}function Na(E,i,d,x,T,M,U){let q=E.context.gl,W=d.paint.get("fill-pattern"),Y=W&&W.constantOr(1),se=d.getCrossfadeParameters(),pe,xe,Ge,ze,Be;U?(xe=Y&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",pe=q.LINES):(xe=Y?"fillPattern":"fill",pe=q.TRIANGLES);for(let tt of x){let st=i.getTile(tt);if(Y&&!st.patternsLoaded())continue;let ct=st.getBucket(d);if(!ct)continue;let je=ct.programConfigurations.get(d.id),yt=E.useProgram(xe,je),ft=E.style.terrain&&E.style.terrain.getTerrainData(tt);Y&&(E.context.activeTexture.set(q.TEXTURE0),st.imageAtlasTexture.bind(q.LINEAR,q.CLAMP_TO_EDGE),je.updatePaintBuffers(se));let vt=W.constantOr(null);if(vt&&st.imageAtlas){let xt=st.imageAtlas,ir=xt.patternPositions[vt.to.toString()],p=xt.patternPositions[vt.from.toString()];ir&&p&&je.setConstantPatternPositions(ir,p)}let Et=ft?tt:null,Rt=E.translatePosMatrix(Et?Et.posMatrix:tt.posMatrix,st,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(U){ze=ct.indexBuffer2,Be=ct.segments2;let xt=[q.drawingBufferWidth,q.drawingBufferHeight];Ge=xe==="fillOutlinePattern"&&Y?Lu(Rt,E,se,st,xt):To(Rt,xt)}else ze=ct.indexBuffer,Be=ct.segments,Ge=Y?zo(Rt,E,se,st):Si(Rt);yt.draw(E.context,pe,T,E.stencilModeForClipping(tt),M,Ti.disabled,Ge,ft,d.id,ct.layoutVertexBuffer,ze,Be,d.paint,E.transform.zoom,je)}}function mi(E,i,d,x,T,M,U){let q=E.context,W=q.gl,Y=d.paint.get("fill-extrusion-pattern"),se=Y.constantOr(1),pe=d.getCrossfadeParameters(),xe=d.paint.get("fill-extrusion-opacity");for(let Ge of x){let ze=i.getTile(Ge),Be=ze.getBucket(d);if(!Be)continue;let tt=E.style.terrain&&E.style.terrain.getTerrainData(Ge),st=Be.programConfigurations.get(d.id),ct=E.useProgram(se?"fillExtrusionPattern":"fillExtrusion",st);se&&(E.context.activeTexture.set(W.TEXTURE0),ze.imageAtlasTexture.bind(W.LINEAR,W.CLAMP_TO_EDGE),st.updatePaintBuffers(pe));let je=Y.constantOr(null);if(je&&ze.imageAtlas){let Et=ze.imageAtlas,Rt=Et.patternPositions[je.to.toString()],xt=Et.patternPositions[je.from.toString()];Rt&&xt&&st.setConstantPatternPositions(Rt,xt)}let yt=E.translatePosMatrix(Ge.posMatrix,ze,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),ft=d.paint.get("fill-extrusion-vertical-gradient"),vt=se?Xo(yt,E,ft,xe,Ge,pe,ze):_n(yt,E,ft,xe);ct.draw(q,q.gl.TRIANGLES,T,M,U,Ti.backCCW,vt,tt,d.id,Be.layoutVertexBuffer,Be.indexBuffer,Be.segments,d.paint,E.transform.zoom,st,E.style.terrain&&Be.centroidVertexBuffer)}}function nl(E,i,d,x,T,M,U){let q=E.context,W=q.gl,Y=d.fbo;if(!Y)return;let se=E.useProgram("hillshade"),pe=E.style.terrain&&E.style.terrain.getTerrainData(i);q.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,Y.colorAttachment.get()),se.draw(q,W.TRIANGLES,T,M,U,Ti.disabled,((xe,Ge,ze,Be)=>{let tt=ze.paint.get("hillshade-shadow-color"),st=ze.paint.get("hillshade-highlight-color"),ct=ze.paint.get("hillshade-accent-color"),je=ze.paint.get("hillshade-illumination-direction")*(Math.PI/180);ze.paint.get("hillshade-illumination-anchor")==="viewport"&&(je-=xe.transform.angle);let yt=!xe.options.moving;return{u_matrix:Be?Be.posMatrix:xe.transform.calculatePosMatrix(Ge.tileID.toUnwrapped(),yt),u_image:0,u_latrange:zn(0,Ge.tileID),u_light:[ze.paint.get("hillshade-exaggeration"),je],u_shadow:tt,u_highlight:st,u_accent:ct}})(E,d,x,pe?i:null),pe,x.id,E.rasterBoundsBuffer,E.quadTriangleIndexBuffer,E.rasterBoundsSegments)}function Ec(E,i,d,x,T,M){let U=E.context,q=U.gl,W=i.dem;if(W&&W.data){let Y=W.dim,se=W.stride,pe=W.getPixels();if(U.activeTexture.set(q.TEXTURE1),U.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||E.getTileTexture(se),i.demTexture){let Ge=i.demTexture;Ge.update(pe,{premultiply:!1}),Ge.bind(q.NEAREST,q.CLAMP_TO_EDGE)}else i.demTexture=new Se(U,pe,q.RGBA,{premultiply:!1}),i.demTexture.bind(q.NEAREST,q.CLAMP_TO_EDGE);U.activeTexture.set(q.TEXTURE0);let xe=i.fbo;if(!xe){let Ge=new Se(U,{width:Y,height:Y,data:null},q.RGBA);Ge.bind(q.LINEAR,q.CLAMP_TO_EDGE),xe=i.fbo=U.createFramebuffer(Y,Y,!0),xe.colorAttachment.set(Ge.texture)}U.bindFramebuffer.set(xe.framebuffer),U.viewport.set([0,0,Y,Y]),E.useProgram("hillshadePrepare").draw(U,q.TRIANGLES,x,T,M,Ti.disabled,((Ge,ze)=>{let Be=ze.stride,tt=s.create();return s.ortho(tt,0,s.EXTENT,-s.EXTENT,0,0,1),s.translate(tt,tt,[0,-s.EXTENT,0]),{u_matrix:tt,u_image:1,u_dimension:[Be,Be],u_zoom:Ge.overscaledZ,u_unpack:ze.getUnpackVector()}})(i.tileID,W),null,d.id,E.rasterBoundsBuffer,E.quadTriangleIndexBuffer,E.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Va(E,i,d,x,T,M){let U=x.paint.get("raster-fade-duration");if(!M&&U>0){let q=s.exported.now(),W=(q-E.timeAdded)/U,Y=i?(q-i.timeAdded)/U:-1,se=d.getSource(),pe=T.coveringZoomLevel({tileSize:se.tileSize,roundZoom:se.roundZoom}),xe=!i||Math.abs(i.tileID.overscaledZ-pe)>Math.abs(E.tileID.overscaledZ-pe),Ge=xe&&E.refreshedUponExpiration?1:s.clamp(xe?W:1-Y,0,1);return E.refreshedUponExpiration&&W>=1&&(E.refreshedUponExpiration=!1),i?{opacity:1,mix:1-Ge}:{opacity:Ge,mix:0}}return{opacity:1,mix:0}}let Al=new s.Color(1,0,0,1),aa=new s.Color(0,1,0,1),Vu=new s.Color(0,0,1,1),ol=new s.Color(1,0,1,1),Os=new s.Color(0,1,1,1);function sa(E,i,d,x){Sa(E,0,i+d/2,E.transform.width,d,x)}function ns(E,i,d,x){Sa(E,i-d/2,0,d,E.transform.height,x)}function Sa(E,i,d,x,T,M){let U=E.context,q=U.gl;q.enable(q.SCISSOR_TEST),q.scissor(i*E.pixelRatio,d*E.pixelRatio,x*E.pixelRatio,T*E.pixelRatio),U.clear({color:M}),q.disable(q.SCISSOR_TEST)}function al(E,i,d){let x=E.context,T=x.gl,M=d.posMatrix,U=E.useProgram("debug"),q=ti.disabled,W=hi.disabled,Y=E.colorModeForRenderPass(),se="$debug",pe=E.style.terrain&&E.style.terrain.getTerrainData(d);x.activeTexture.set(T.TEXTURE0),E.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE);let xe=i.getTileByID(d.key).latestRawTileData,Ge=Math.floor((xe&&xe.byteLength||0)/1024),ze=i.getTile(d).tileSize,Be=512/Math.min(ze,512)*(d.overscaledZ/E.transform.zoom)*.5,tt=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(tt+=` => ${d.overscaledZ}`),function(st,ct){st.initDebugOverlayCanvas();let je=st.debugOverlayCanvas,yt=st.context.gl,ft=st.debugOverlayCanvas.getContext("2d");ft.clearRect(0,0,je.width,je.height),ft.shadowColor="white",ft.shadowBlur=2,ft.lineWidth=1.5,ft.strokeStyle="white",ft.textBaseline="top",ft.font="bold 36px Open Sans, sans-serif",ft.fillText(ct,5,5),ft.strokeText(ct,5,5),st.debugOverlayTexture.update(je),st.debugOverlayTexture.bind(yt.LINEAR,yt.CLAMP_TO_EDGE)}(E,`${tt} ${Ge}kB`),U.draw(x,T.TRIANGLES,q,W,Ui.alphaBlended,Ti.disabled,Oo(M,s.Color.transparent,Be),null,se,E.debugBuffer,E.quadTriangleIndexBuffer,E.debugSegments),U.draw(x,T.LINE_STRIP,q,W,Y,Ti.disabled,Oo(M,s.Color.red),pe,se,E.debugBuffer,E.tileBorderIndexBuffer,E.debugSegments)}function Pl(E,i,d){let x=E.context,T=x.gl,M=E.colorModeForRenderPass(),U=new ti(T.LEQUAL,ti.ReadWrite,E.depthRangeFor3D),q=E.useProgram("terrain"),W=i.getTerrainMesh(),Y=i.getTerrainData(d.tileID);x.bindFramebuffer.set(null),x.viewport.set([0,0,E.width,E.height]),x.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,i.getRTTFramebuffer().colorAttachment.get());let se=E.transform.calculatePosMatrix(d.tileID.toUnwrapped());q.draw(x,T.TRIANGLES,U,hi.disabled,M,Ti.backCCW,{u_matrix:se,u_texture:0},Y,"terrain",W.vertexBuffer,W.indexBuffer,W.segments)}function Fs(E,i,d,x){let T=E.context,M=d.tileSize*i.qualityFactor;d.textures[x]||(d.textures[x]=E.getTileTexture(M)||new Se(T,{width:M,height:M,data:null},T.gl.RGBA),d.textures[x].bind(T.gl.LINEAR,T.gl.CLAMP_TO_EDGE),x===0&&i.sourceCache.renderHistory.unshift(d.tileID.key));let U=i.getRTTFramebuffer();U.colorAttachment.set(d.textures[x].texture),T.bindFramebuffer.set(U.framebuffer),T.viewport.set([0,0,M,M])}class $o{constructor(i){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=i,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=i.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){let i=this.painter.style,d=i.terrain;for(let x in i.sourceCaches){this._coordsDescendingInv[x]={};let T=i.sourceCaches[x].getVisibleCoordinates();for(let M of T){let U=d.sourceCache.getTerrainCoords(M);for(let q in U)this._coordsDescendingInv[x][q]||(this._coordsDescendingInv[x][q]=[]),this._coordsDescendingInv[x][q].push(U[q])}}for(let x of i._order){let T=i._layers[x],M=T.source;if(this._renderToTexture[T.type]&&!this._coordsDescendingInvStr[M]){this._coordsDescendingInvStr[M]={};for(let U in this._coordsDescendingInv[M])this._coordsDescendingInvStr[M][U]=this._coordsDescendingInv[M][U].map(q=>q.key).sort().join()}}return this._renderableTiles.forEach(x=>{for(let T in this._coordsDescendingInvStr){let M=this._coordsDescendingInvStr[T][x.tileID.key];M&&M!==x.textureCoords[T]&&x.clearTextures(this.painter),d.needsRerender(T,x.tileID)&&x.clearTextures(this.painter)}this._rerender[x.tileID.key]=!x.textures.length}),d.clearRerenderCache(),d.sourceCache.removeOutdated(this.painter),this}renderLayer(i){let d=i.type,x=this.painter,T=x.style._order,M=x.currentLayer,U=M+1===T.length;if(this._renderToTexture[d]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(T[M]),!U))return!0;if(this._renderToTexture[this._prevType]||d==="hillshade"||this._renderToTexture[d]&&U){this._prevType=d;let q=this._stacks.length-1,W=this._stacks[q]||[];for(let Y of this._renderableTiles){if(Fs(x,x.style.terrain,Y,q),this._rerender[Y.tileID.key]){x.context.clear({color:s.Color.transparent});for(let se=0;se<W.length;se++){let pe=x.style._layers[W[se]],xe=pe.source?this._coordsDescendingInv[pe.source][Y.tileID.key]:[Y.tileID];x._renderTileClippingMasks(pe,xe),x.renderLayer(x,x.style.sourceCaches[pe.source],pe,xe),pe.source&&(Y.textureCoords[pe.source]=this._coordsDescendingInvStr[pe.source][Y.tileID.key])}}Pl(x,x.style.terrain,Y)}if(d==="hillshade"){this._stacks.push([T[M]]);for(let Y of this._renderableTiles){let se=this._coordsDescendingInv[i.source][Y.tileID.key];Fs(x,x.style.terrain,Y,this._stacks.length-1),x.context.clear({color:s.Color.transparent}),x._renderTileClippingMasks(i,se),x.renderLayer(x,x.style.sourceCaches[i.source],i,se),Pl(x,x.style.terrain,Y)}return!0}return this._renderToTexture[d]}return!1}}let sl={symbol:function(E,i,d,x,T){if(E.renderPass!=="translucent")return;let M=hi.disabled,U=E.colorModeForRenderPass();d.layout.get("text-variable-anchor")&&function(q,W,Y,se,pe,xe,Ge){let ze=W.transform,Be=pe==="map",tt=xe==="map";for(let st of q){let ct=se.getTile(st),je=ct.getBucket(Y);if(!je||!je.text||!je.text.segments.get().length)continue;let yt=s.evaluateSizeForZoom(je.textSizeData,ze.zoom),ft=te(ct,1,W.transform.zoom),vt=ho(st.posMatrix,tt,Be,W.transform,ft),Et=Y.layout.get("icon-text-fit")!=="none"&&je.hasIconData();if(yt){let Rt=Math.pow(2,ze.zoom-ct.tileID.overscaledZ);Nu(je,Be,tt,Ge,ze,vt,st.posMatrix,Rt,yt,Et,W.style.terrain?(xt,ir)=>W.style.terrain.getElevation(st,xt,ir):null)}}}(x,E,d,i,d.layout.get("text-rotation-alignment"),d.layout.get("text-pitch-alignment"),T),d.paint.get("icon-opacity").constantOr(1)!==0&&Ta(E,i,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"),M,U),d.paint.get("text-opacity").constantOr(1)!==0&&Ta(E,i,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"),M,U),i.map.showCollisionBoxes&&(Rs(E,i,d,x,d.paint.get("text-translate"),d.paint.get("text-translate-anchor"),!0),Rs(E,i,d,x,d.paint.get("icon-translate"),d.paint.get("icon-translate-anchor"),!1))},circle:function(E,i,d,x){if(E.renderPass!=="translucent")return;let T=d.paint.get("circle-opacity"),M=d.paint.get("circle-stroke-width"),U=d.paint.get("circle-stroke-opacity"),q=!d.layout.get("circle-sort-key").isConstant();if(T.constantOr(1)===0&&(M.constantOr(1)===0||U.constantOr(1)===0))return;let W=E.context,Y=W.gl,se=E.depthModeForSublayer(0,ti.ReadOnly),pe=hi.disabled,xe=E.colorModeForRenderPass(),Ge=[];for(let ze=0;ze<x.length;ze++){let Be=x[ze],tt=i.getTile(Be),st=tt.getBucket(d);if(!st)continue;let ct=st.programConfigurations.get(d.id),je=E.useProgram("circle",ct),yt=st.layoutVertexBuffer,ft=st.indexBuffer,vt=E.style.terrain&&E.style.terrain.getTerrainData(Be),Et={programConfiguration:ct,program:je,layoutVertexBuffer:yt,indexBuffer:ft,uniformValues:Do(E,Be,tt,d),terrainData:vt};if(q){let Rt=st.segments.get();for(let xt of Rt)Ge.push({segments:new s.SegmentVector([xt]),sortKey:xt.sortKey,state:Et})}else Ge.push({segments:st.segments,sortKey:0,state:Et})}q&&Ge.sort((ze,Be)=>ze.sortKey-Be.sortKey);for(let ze of Ge){let{programConfiguration:Be,program:tt,layoutVertexBuffer:st,indexBuffer:ct,uniformValues:je,terrainData:yt}=ze.state;tt.draw(W,Y.TRIANGLES,se,pe,xe,Ti.disabled,je,yt,d.id,st,ct,ze.segments,d.paint,E.transform.zoom,Be)}},heatmap:function(E,i,d,x){if(d.paint.get("heatmap-opacity")!==0)if(E.renderPass==="offscreen"){let T=E.context,M=T.gl,U=hi.disabled,q=new Ui([M.ONE,M.ONE],s.Color.transparent,[!0,!0,!0,!0]);(function(W,Y,se){let pe=W.gl;W.activeTexture.set(pe.TEXTURE1),W.viewport.set([0,0,Y.width/4,Y.height/4]);let xe=se.heatmapFbo;if(xe)pe.bindTexture(pe.TEXTURE_2D,xe.colorAttachment.get()),W.bindFramebuffer.set(xe.framebuffer);else{let Ge=pe.createTexture();pe.bindTexture(pe.TEXTURE_2D,Ge),pe.texParameteri(pe.TEXTURE_2D,pe.TEXTURE_WRAP_S,pe.CLAMP_TO_EDGE),pe.texParameteri(pe.TEXTURE_2D,pe.TEXTURE_WRAP_T,pe.CLAMP_TO_EDGE),pe.texParameteri(pe.TEXTURE_2D,pe.TEXTURE_MIN_FILTER,pe.LINEAR),pe.texParameteri(pe.TEXTURE_2D,pe.TEXTURE_MAG_FILTER,pe.LINEAR),xe=se.heatmapFbo=W.createFramebuffer(Y.width/4,Y.height/4,!1),function(ze,Be,tt,st){let ct=ze.gl;ct.texImage2D(ct.TEXTURE_2D,0,ct.RGBA,Be.width/4,Be.height/4,0,ct.RGBA,ze.extRenderToTextureHalfFloat?ze.extTextureHalfFloat.HALF_FLOAT_OES:ct.UNSIGNED_BYTE,null),st.colorAttachment.set(tt)}(W,Y,Ge,xe)}})(T,E,d),T.clear({color:s.Color.transparent});for(let W=0;W<x.length;W++){let Y=x[W];if(i.hasRenderableParent(Y))continue;let se=i.getTile(Y),pe=se.getBucket(d);if(!pe)continue;let xe=pe.programConfigurations.get(d.id),Ge=E.useProgram("heatmap",xe),{zoom:ze}=E.transform;Ge.draw(T,M.TRIANGLES,ti.disabled,U,q,Ti.disabled,Fo(Y.posMatrix,se,ze,d.paint.get("heatmap-intensity")),null,d.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,d.paint,E.transform.zoom,xe)}T.viewport.set([0,0,E.width,E.height])}else E.renderPass==="translucent"&&(E.context.setColorMode(E.colorModeForRenderPass()),function(T,M){let U=T.context,q=U.gl,W=M.heatmapFbo;if(!W)return;U.activeTexture.set(q.TEXTURE0),q.bindTexture(q.TEXTURE_2D,W.colorAttachment.get()),U.activeTexture.set(q.TEXTURE1);let Y=M.colorRampTexture;Y||(Y=M.colorRampTexture=new Se(U,M.colorRamp,q.RGBA)),Y.bind(q.LINEAR,q.CLAMP_TO_EDGE),T.useProgram("heatmapTexture").draw(U,q.TRIANGLES,ti.disabled,hi.disabled,T.colorModeForRenderPass(),Ti.disabled,((se,pe,xe,Ge)=>{let ze=s.create();s.ortho(ze,0,se.width,se.height,0,0,1);let Be=se.context.gl;return{u_matrix:ze,u_world:[Be.drawingBufferWidth,Be.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:pe.paint.get("heatmap-opacity")}})(T,M),null,M.id,T.viewportBuffer,T.quadTriangleIndexBuffer,T.viewportSegments,M.paint,T.transform.zoom)}(E,d))},line:function(E,i,d,x){if(E.renderPass!=="translucent")return;let T=d.paint.get("line-opacity"),M=d.paint.get("line-width");if(T.constantOr(1)===0||M.constantOr(1)===0)return;let U=E.depthModeForSublayer(0,ti.ReadOnly),q=E.colorModeForRenderPass(),W=d.paint.get("line-dasharray"),Y=d.paint.get("line-pattern"),se=Y.constantOr(1),pe=d.paint.get("line-gradient"),xe=d.getCrossfadeParameters(),Ge=se?"linePattern":W?"lineSDF":pe?"lineGradient":"line",ze=E.context,Be=ze.gl,tt=!0;for(let st of x){let ct=i.getTile(st);if(se&&!ct.patternsLoaded())continue;let je=ct.getBucket(d);if(!je)continue;let yt=je.programConfigurations.get(d.id),ft=E.context.program.get(),vt=E.useProgram(Ge,yt),Et=tt||vt.program!==ft,Rt=E.style.terrain&&E.style.terrain.getTerrainData(st),xt=Y.constantOr(null);if(xt&&ct.imageAtlas){let m=ct.imageAtlas,f=m.patternPositions[xt.to.toString()],v=m.patternPositions[xt.from.toString()];f&&v&&yt.setConstantPatternPositions(f,v)}let ir=Rt?st:null,p=se?Hl(E,ct,d,xe,ir):W?Ps(E,ct,d,W,xe,ir):pe?Ru(E,ct,d,je.lineClipsArray.length,ir):Wo(E,ct,d,ir);if(se)ze.activeTexture.set(Be.TEXTURE0),ct.imageAtlasTexture.bind(Be.LINEAR,Be.CLAMP_TO_EDGE),yt.updatePaintBuffers(xe);else if(W&&(Et||E.lineAtlas.dirty))ze.activeTexture.set(Be.TEXTURE0),E.lineAtlas.bind(ze);else if(pe){let m=je.gradients[d.id],f=m.texture;if(d.gradientVersion!==m.version){let v=256;if(d.stepInterpolant){let I=i.getSource().maxzoom,L=st.canonical.z===I?Math.ceil(1<<E.transform.maxZoom-st.canonical.z):1;v=s.clamp(s.nextPowerOfTwo(je.maxLineLength/s.EXTENT*1024*L),256,ze.maxTextureSize)}m.gradient=s.renderColorRamp({expression:d.gradientExpression(),evaluationKey:"lineProgress",resolution:v,image:m.gradient||void 0,clips:je.lineClipsArray}),m.texture?m.texture.update(m.gradient):m.texture=new Se(ze,m.gradient,Be.RGBA),m.version=d.gradientVersion,f=m.texture}ze.activeTexture.set(Be.TEXTURE0),f.bind(d.stepInterpolant?Be.NEAREST:Be.LINEAR,Be.CLAMP_TO_EDGE)}vt.draw(ze,Be.TRIANGLES,U,E.stencilModeForClipping(st),q,Ti.disabled,p,Rt,d.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,d.paint,E.transform.zoom,yt,je.layoutVertexBuffer2),tt=!1}},fill:function(E,i,d,x){let T=d.paint.get("fill-color"),M=d.paint.get("fill-opacity");if(M.constantOr(1)===0)return;let U=E.colorModeForRenderPass(),q=d.paint.get("fill-pattern"),W=E.opaquePassEnabledForLayer()&&!q.constantOr(1)&&T.constantOr(s.Color.transparent).a===1&&M.constantOr(0)===1?"opaque":"translucent";if(E.renderPass===W){let Y=E.depthModeForSublayer(1,E.renderPass==="opaque"?ti.ReadWrite:ti.ReadOnly);Na(E,i,d,x,Y,U,!1)}if(E.renderPass==="translucent"&&d.paint.get("fill-antialias")){let Y=E.depthModeForSublayer(d.getPaintProperty("fill-outline-color")?2:0,ti.ReadOnly);Na(E,i,d,x,Y,U,!0)}},"fill-extrusion":function(E,i,d,x){let T=d.paint.get("fill-extrusion-opacity");if(T!==0&&E.renderPass==="translucent"){let M=new ti(E.context.gl.LEQUAL,ti.ReadWrite,E.depthRangeFor3D);if(T!==1||d.paint.get("fill-extrusion-pattern").constantOr(1))mi(E,i,d,x,M,hi.disabled,Ui.disabled),mi(E,i,d,x,M,E.stencilModeFor3D(),E.colorModeForRenderPass());else{let U=E.colorModeForRenderPass();mi(E,i,d,x,M,hi.disabled,U)}}},hillshade:function(E,i,d,x){if(E.renderPass!=="offscreen"&&E.renderPass!=="translucent")return;let T=E.context,M=E.depthModeForSublayer(0,ti.ReadOnly),U=E.colorModeForRenderPass(),[q,W]=E.renderPass==="translucent"?E.stencilConfigForOverlap(x):[{},x];for(let Y of W){let se=i.getTile(Y);se.needsHillshadePrepare!==void 0&&se.needsHillshadePrepare&&E.renderPass==="offscreen"?Ec(E,se,d,M,hi.disabled,U):E.renderPass==="translucent"&&nl(E,Y,se,d,M,q[Y.overscaledZ],U)}T.viewport.set([0,0,E.width,E.height])},raster:function(E,i,d,x){if(E.renderPass!=="translucent"||d.paint.get("raster-opacity")===0||!x.length)return;let T=E.context,M=T.gl,U=i.getSource(),q=E.useProgram("raster"),W=E.colorModeForRenderPass(),[Y,se]=U instanceof Lr?[{},x]:E.stencilConfigForOverlap(x),pe=se[se.length-1].overscaledZ,xe=!E.options.moving;for(let Ge of se){let ze=E.depthModeForSublayer(Ge.overscaledZ-pe,d.paint.get("raster-opacity")===1?ti.ReadWrite:ti.ReadOnly,M.LESS),Be=i.getTile(Ge);Be.registerFadeDuration(d.paint.get("raster-fade-duration"));let tt=i.findLoadedParent(Ge,0),st=Va(Be,tt,i,d,E.transform,E.style.terrain),ct,je,yt=d.paint.get("raster-resampling")==="nearest"?M.NEAREST:M.LINEAR;T.activeTexture.set(M.TEXTURE0),Be.texture.bind(yt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),T.activeTexture.set(M.TEXTURE1),tt?(tt.texture.bind(yt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),ct=Math.pow(2,tt.tileID.overscaledZ-Be.tileID.overscaledZ),je=[Be.tileID.canonical.x*ct%1,Be.tileID.canonical.y*ct%1]):Be.texture.bind(yt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST);let ft=E.style.terrain&&E.style.terrain.getTerrainData(Ge),vt=ft?Ge:null,Et=vt?vt.posMatrix:E.transform.calculatePosMatrix(Ge.toUnwrapped(),xe),Rt=vc(Et,je||[0,0],ct||1,st,d);U instanceof Lr?q.draw(T,M.TRIANGLES,ze,hi.disabled,W,Ti.disabled,Rt,ft,d.id,U.boundsBuffer,E.quadTriangleIndexBuffer,U.boundsSegments):q.draw(T,M.TRIANGLES,ze,Y[Ge.overscaledZ],W,Ti.disabled,Rt,ft,d.id,E.rasterBoundsBuffer,E.quadTriangleIndexBuffer,E.rasterBoundsSegments)}},background:function(E,i,d,x){let T=d.paint.get("background-color"),M=d.paint.get("background-opacity");if(M===0)return;let U=E.context,q=U.gl,W=E.transform,Y=W.tileSize,se=d.paint.get("background-pattern");if(E.isPatternMissing(se))return;let pe=!se&&T.a===1&&M===1&&E.opaquePassEnabledForLayer()?"opaque":"translucent";if(E.renderPass!==pe)return;let xe=hi.disabled,Ge=E.depthModeForSublayer(0,pe==="opaque"?ti.ReadWrite:ti.ReadOnly),ze=E.colorModeForRenderPass(),Be=E.useProgram(se?"backgroundPattern":"background"),tt=x||W.coveringTiles({tileSize:Y,terrain:E.style.terrain});se&&(U.activeTexture.set(q.TEXTURE0),E.imageManager.bind(E.context));let st=d.getCrossfadeParameters();for(let ct of tt){let je=x?ct.posMatrix:E.transform.calculatePosMatrix(ct.toUnwrapped()),yt=se?xc(je,M,E,se,{tileID:ct,tileSize:Y},st):wl(je,M,T),ft=E.style.terrain&&E.style.terrain.getTerrainData(ct);Be.draw(U,q.TRIANGLES,Ge,xe,ze,Ti.disabled,yt,ft,d.id,E.tileExtentBuffer,E.quadTriangleIndexBuffer,E.tileExtentSegments)}},debug:function(E,i,d){for(let x=0;x<d.length;x++)al(E,i,d[x])},custom:function(E,i,d){let x=E.context,T=d.implementation;if(E.renderPass==="offscreen"){let M=T.prerender;M&&(E.setCustomLayerDefaults(),x.setColorMode(E.colorModeForRenderPass()),M.call(T,x.gl,E.transform.customLayerMatrix()),x.setDirty(),E.setBaseState())}else if(E.renderPass==="translucent"){E.setCustomLayerDefaults(),x.setColorMode(E.colorModeForRenderPass()),x.setStencilMode(hi.disabled);let M=T.renderingMode==="3d"?new ti(E.context.gl.LEQUAL,ti.ReadWrite,E.depthRangeFor3D):E.depthModeForSublayer(0,ti.ReadOnly);x.setDepthMode(M),T.render(x.gl,E.transform.customLayerMatrix()),x.setDirty(),E.setBaseState(),x.bindFramebuffer.set(null)}}};class iu{constructor(i,d){this.context=new Bu(i),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:s.create(),renderTime:0},this.setup(),this.numSublayers=Or.maxUnderzooming+Or.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Kt,this.gpuTimers={}}resize(i,d,x){if(this.width=i*x,this.height=d*x,this.pixelRatio=x,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let T of this.style._order)this.style._layers[T].resize()}setup(){let i=this.context,d=new s.PosArray;d.emplaceBack(0,0),d.emplaceBack(s.EXTENT,0),d.emplaceBack(0,s.EXTENT),d.emplaceBack(s.EXTENT,s.EXTENT),this.tileExtentBuffer=i.createVertexBuffer(d,Vr.members),this.tileExtentSegments=s.SegmentVector.simpleSegment(0,0,4,2);let x=new s.PosArray;x.emplaceBack(0,0),x.emplaceBack(s.EXTENT,0),x.emplaceBack(0,s.EXTENT),x.emplaceBack(s.EXTENT,s.EXTENT),this.debugBuffer=i.createVertexBuffer(x,Vr.members),this.debugSegments=s.SegmentVector.simpleSegment(0,0,4,5);let T=new s.RasterBoundsArray;T.emplaceBack(0,0,0,0),T.emplaceBack(s.EXTENT,0,s.EXTENT,0),T.emplaceBack(0,s.EXTENT,0,s.EXTENT),T.emplaceBack(s.EXTENT,s.EXTENT,s.EXTENT,s.EXTENT),this.rasterBoundsBuffer=i.createVertexBuffer(T,vr.members),this.rasterBoundsSegments=s.SegmentVector.simpleSegment(0,0,4,2);let M=new s.PosArray;M.emplaceBack(0,0),M.emplaceBack(1,0),M.emplaceBack(0,1),M.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(M,Vr.members),this.viewportSegments=s.SegmentVector.simpleSegment(0,0,4,2);let U=new s.LineStripIndexArray;U.emplaceBack(0),U.emplaceBack(1),U.emplaceBack(3),U.emplaceBack(2),U.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(U);let q=new s.TriangleIndexArray;q.emplaceBack(0,1,2),q.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(q),this.emptyTexture=new Se(i,{width:1,height:1,data:new Uint8Array([0,0,0,0])},i.gl.RGBA);let W=this.context.gl;this.stencilClearMode=new hi({func:W.ALWAYS,mask:0},0,255,W.ZERO,W.ZERO,W.ZERO)}clearStencil(){let i=this.context,d=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let x=s.create();s.ortho(x,0,this.width,this.height,0,0,1),s.scale(x,x,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,d.TRIANGLES,ti.disabled,this.stencilClearMode,Ui.disabled,Ti.disabled,un(x),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,d){if(this.currentStencilSource===i.source||!i.isTileClipped()||!d||!d.length)return;this.currentStencilSource=i.source;let x=this.context,T=x.gl;this.nextStencilID+d.length>256&&this.clearStencil(),x.setColorMode(Ui.disabled),x.setDepthMode(ti.disabled);let M=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let U of d){let q=this._tileClippingMaskIDs[U.key]=this.nextStencilID++,W=this.style.terrain&&this.style.terrain.getTerrainData(U);M.draw(x,T.TRIANGLES,ti.disabled,new hi({func:T.ALWAYS,mask:0},q,255,T.KEEP,T.KEEP,T.REPLACE),Ui.disabled,Ti.disabled,un(U.posMatrix),W,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let i=this.nextStencilID++,d=this.context.gl;return new hi({func:d.NOTEQUAL,mask:255},i,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(i){let d=this.context.gl;return new hi({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(i){let d=this.context.gl,x=i.sort((U,q)=>q.overscaledZ-U.overscaledZ),T=x[x.length-1].overscaledZ,M=x[0].overscaledZ-T+1;if(M>1){this.currentStencilSource=void 0,this.nextStencilID+M>256&&this.clearStencil();let U={};for(let q=0;q<M;q++)U[q+T]=new hi({func:d.GEQUAL,mask:255},q+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=M,[U,x]}return[{[T]:hi.disabled},x]}colorModeForRenderPass(){let i=this.context.gl;return this._showOverdrawInspector?new Ui([i.CONSTANT_COLOR,i.ONE],new s.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ui.unblended:Ui.alphaBlended}depthModeForSublayer(i,d,x){if(!this.opaquePassEnabledForLayer())return ti.disabled;let T=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new ti(x||this.context.gl.LEQUAL,d,[T,T])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(i,d){this.style=i,this.options=d,this.lineAtlas=i.lineAtlas,this.imageManager=i.imageManager,this.glyphManager=i.glyphManager,this.symbolFadeChange=i.placement.symbolFadeChange(s.exported.now()),this.imageManager.beginFrame();let x=this.style._order,T=this.style.sourceCaches,M=this.style.terrain&&new $o(this);for(let Y in T){let se=T[Y];se.used&&se.prepare(this.context)}let U={},q={},W={};for(let Y in T){let se=T[Y];U[Y]=se.getVisibleCoordinates(),q[Y]=U[Y].slice().reverse(),W[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(M){this.opaquePassCutoff=0;let Y=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!s.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||Y.length)&&(s.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(se,pe){let xe=se.context,Ge=xe.gl,ze=Ui.unblended,Be=new ti(Ge.LEQUAL,ti.ReadWrite,[0,1]),tt=pe.getTerrainMesh(),st=pe.sourceCache.getRenderableTiles(),ct=se.useProgram("terrainDepth");xe.bindFramebuffer.set(pe.getFramebuffer("depth").framebuffer),xe.viewport.set([0,0,se.width/devicePixelRatio,se.height/devicePixelRatio]),xe.clear({color:s.Color.transparent,depth:1});for(let je of st){let yt=pe.getTerrainData(je.tileID),ft=se.transform.calculatePosMatrix(je.tileID.toUnwrapped());ct.draw(xe,Ge.TRIANGLES,Be,hi.disabled,ze,Ti.backCCW,{u_matrix:ft},yt,"terrain",tt.vertexBuffer,tt.indexBuffer,tt.segments)}xe.bindFramebuffer.set(null),xe.viewport.set([0,0,se.width,se.height])}(this,this.style.terrain),function(se,pe){let xe=se.context,Ge=xe.gl,ze=Ui.unblended,Be=new ti(Ge.LEQUAL,ti.ReadWrite,[0,1]),tt=pe.getTerrainMesh(),st=pe.getCoordsTexture(),ct=pe.sourceCache.getRenderableTiles(),je=se.useProgram("terrainCoords");xe.bindFramebuffer.set(pe.getFramebuffer("coords").framebuffer),xe.viewport.set([0,0,se.width/devicePixelRatio,se.height/devicePixelRatio]),xe.clear({color:s.Color.transparent,depth:1}),pe.coordsIndex=[];for(let yt of ct){let ft=pe.getTerrainData(yt.tileID);xe.activeTexture.set(Ge.TEXTURE0),Ge.bindTexture(Ge.TEXTURE_2D,st.texture);let vt=se.transform.calculatePosMatrix(yt.tileID.toUnwrapped());je.draw(xe,Ge.TRIANGLES,Be,hi.disabled,ze,Ti.backCCW,{u_matrix:vt,u_terrain_coords_id:(255-pe.coordsIndex.length)/255,u_texture:0},ft,"terrain",tt.vertexBuffer,tt.indexBuffer,tt.segments),pe.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 pe=q[se.source];(se.type==="custom"||pe.length)&&this.renderLayer(this,T[se.source],se,pe)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:d.showOverdrawInspector?s.Color.black:s.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(i._order.length+2)*this.numSublayers*this.depthEpsilon],!M)for(this.renderPass="opaque",this.currentLayer=x.length-1;this.currentLayer>=0;this.currentLayer--){let Y=this.style._layers[x[this.currentLayer]],se=T[Y.source],pe=U[Y.source];this._renderTileClippingMasks(Y,pe),this.renderLayer(this,se,Y,pe)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<x.length;this.currentLayer++){let Y=this.style._layers[x[this.currentLayer]],se=T[Y.source];if(M&&M.renderLayer(Y))continue;let pe=(Y.type==="symbol"?W:q)[Y.source];this._renderTileClippingMasks(Y,U[Y.source]),this.renderLayer(this,se,Y,pe)}if(this.options.showTileBoundaries){let Y,se;Object.values(this.style._layers).forEach(pe=>{pe.source&&!pe.isHidden(this.transform.zoom)&&(pe.source!==(se&&se.id)&&(se=this.style.sourceCaches[pe.source]),(!Y||Y.getSource().maxzoom<se.getSource().maxzoom)&&(Y=se))}),Y&&sl.debug(this,Y,Y.getVisibleCoordinates())}this.options.showPadding&&function(Y){let se=Y.transform.padding;sa(Y,Y.transform.height-(se.top||0),3,Al),sa(Y,se.bottom||0,3,aa),ns(Y,se.left||0,3,Vu),ns(Y,Y.transform.width-(se.right||0),3,ol);let pe=Y.transform.centerPoint;(function(xe,Ge,ze,Be){Sa(xe,Ge-1,ze-10,2,20,Be),Sa(xe,Ge-10,ze-1,20,2,Be)})(Y,pe.x,Y.transform.height-pe.y,Os)}(this),this.context.setDefault()}renderLayer(i,d,x,T){x.isHidden(this.transform.zoom)||(x.type==="background"||x.type==="custom"||(T||[]).length)&&(this.id=x.id,this.gpuTimingStart(x),sl[x.type](i,d,x,T,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(i){if(!this.options.gpuTiming)return;let d=this.context.extTimerQuery,x=this.gpuTimers[i.id];x||(x=this.gpuTimers[i.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 i=this.context.extTimerQuery;i.endQueryEXT(i.TIME_ELAPSED_EXT)}collectGpuTimers(){let i=this.gpuTimers;return this.gpuTimers={},i}queryGpuTimers(i){let d={};for(let x in i){let T=i[x],M=this.context.extTimerQuery,U=M.getQueryObjectEXT(T.query,M.QUERY_RESULT_EXT)/1e6;M.deleteQueryEXT(T.query),d[x]=U}return d}translatePosMatrix(i,d,x,T,M){if(!x[0]&&!x[1])return i;let U=M?T==="map"?this.transform.angle:0:T==="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 q=[M?x[0]:te(d,x[0],this.transform.zoom),M?x[1]:te(d,x[1],this.transform.zoom),0],W=new Float32Array(16);return s.translate(W,i,q),W}saveTileTexture(i){let d=this._tileTextures[i.size[0]];d?d.push(i):this._tileTextures[i.size[0]]=[i]}getTileTexture(i){let d=this._tileTextures[i];return d&&d.length>0?d.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;let d=this.imageManager.getPattern(i.from.toString()),x=this.imageManager.getPattern(i.to.toString());return!d||!x}useProgram(i,d){this.cache=this.cache||{};let x=i+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[x]||(this.cache[x]=new Ys(this.context,i,Rn[i],d,Qs[i],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 i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Se(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Ml{constructor(i,d){this.points=i,this.planes=d}static fromInvProjectionMatrix(i,d,x){let T=Math.pow(2,x),M=[[-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(q=>{let W=1/(q=s.transformMat4([],q,i))[3]/d*T;return s.mul$1(q,q,[W,W,1/q[3],W])}),U=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(q=>{let W=s.sub([],M[q[0]],M[q[1]]),Y=s.sub([],M[q[2]],M[q[1]]),se=s.normalize([],s.cross([],W,Y)),pe=-s.dot(se,M[q[1]]);return se.concat(pe)});return new Ml(M,U)}}class la{constructor(i,d){this.min=i,this.max=d,this.center=s.scale$1([],s.add([],this.min,this.max),.5)}quadrant(i){let d=[i%2==0,i<2],x=s.clone$2(this.min),T=s.clone$2(this.max);for(let M=0;M<d.length;M++)x[M]=d[M]?this.min[M]:this.center[M],T[M]=d[M]?this.center[M]:this.max[M];return T[2]=this.max[2],new la(x,T)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}intersects(i){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 T=0;T<i.planes.length;T++){let M=i.planes[T],U=0;for(let q=0;q<d.length;q++)s.dot$1(M,d[q])>=0&&U++;if(U===0)return 0;U!==d.length&&(x=!1)}if(x)return 2;for(let T=0;T<3;T++){let M=Number.MAX_VALUE,U=-Number.MAX_VALUE;for(let q=0;q<i.points.length;q++){let W=i.points[q][T]-this.min[T];M=Math.min(M,W),U=Math.max(U,W)}if(U<0||M>this.max[T]-this.min[T])return 0}return 1}}class Ia{constructor(i=0,d=0,x=0,T=0){if(isNaN(i)||i<0||isNaN(d)||d<0||isNaN(x)||x<0||isNaN(T)||T<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=d,this.left=x,this.right=T}interpolate(i,d,x){return d.top!=null&&i.top!=null&&(this.top=s.number(i.top,d.top,x)),d.bottom!=null&&i.bottom!=null&&(this.bottom=s.number(i.bottom,d.bottom,x)),d.left!=null&&i.left!=null&&(this.left=s.number(i.left,d.left,x)),d.right!=null&&i.right!=null&&(this.right=s.number(i.right,d.right,x)),this}getCenter(i,d){let x=s.clamp((this.left+i-this.right)/2,0,i),T=s.clamp((this.top+d-this.bottom)/2,0,d);return new s.pointGeometry(x,T)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new Ia(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class os{constructor(i,d,x,T,M){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=M===void 0||!!M,this._minZoom=i||0,this._maxZoom=d||22,this._minPitch=x??0,this._maxPitch=T??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new s.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ia,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let i=new os(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.tileSize=this.tileSize,i.latRange=this.latRange,i.width=this.width,i.height=this.height,i._center=this._center,i._elevation=this._elevation,i.zoom=this.zoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._calcMatrices(),i}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){let d=-s.wrap(i,-180,180)*Math.PI/180;var x;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=(x=new s.ARRAY_TYPE(4),s.ARRAY_TYPE!=Float32Array&&(x[1]=0,x[2]=0),x[0]=1,x[3]=1,x),function(T,M,U){var q=M[0],W=M[1],Y=M[2],se=M[3],pe=Math.sin(U),xe=Math.cos(U);T[0]=q*xe+Y*pe,T[1]=W*xe+se*pe,T[2]=q*-pe+Y*xe,T[3]=W*-pe+se*xe}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){let d=s.clamp(i,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(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){let d=Math.min(Math.max(i,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(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,d,x){this._unmodified=!1,this._edgeInsets.interpolate(i,d,x),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){let d=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(i){let d=[new s.UnwrappedTileID(0,i)];if(this._renderWorldCopies){let x=this.pointCoordinate(new s.pointGeometry(0,0)),T=this.pointCoordinate(new s.pointGeometry(this.width,0)),M=this.pointCoordinate(new s.pointGeometry(this.width,this.height)),U=this.pointCoordinate(new s.pointGeometry(0,this.height)),q=Math.floor(Math.min(x.x,T.x,M.x,U.x)),W=Math.floor(Math.max(x.x,T.x,M.x,U.x)),Y=1;for(let se=q-Y;se<=W+Y;se++)se!==0&&d.push(new s.UnwrappedTileID(se,i))}return d}coveringTiles(i){var d,x;let T=this.coveringZoomLevel(i),M=T;if(i.minzoom!==void 0&&T<i.minzoom)return[];i.maxzoom!==void 0&&T>i.maxzoom&&(T=i.maxzoom);let U=this.pointCoordinate(this.getCameraPoint()),q=s.MercatorCoordinate.fromLngLat(this.center),W=Math.pow(2,T),Y=[W*U.x,W*U.y,0],se=[W*q.x,W*q.y,0],pe=Ml.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,T),xe=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(xe=T);let Ge=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,ze=je=>({aabb:new la([je*W,0,0],[(je+1)*W,W,0]),zoom:0,x:0,y:0,wrap:je,fullyVisible:!1}),Be=[],tt=[],st=T,ct=i.reparseOverscaled?M:T;if(this._renderWorldCopies)for(let je=1;je<=3;je++)Be.push(ze(-je)),Be.push(ze(je));for(Be.push(ze(0));Be.length>0;){let je=Be.pop(),yt=je.x,ft=je.y,vt=je.fullyVisible;if(!vt){let m=je.aabb.intersects(pe);if(m===0)continue;vt=m===2}let Et=i.terrain?Y:se,Rt=je.aabb.distanceX(Et),xt=je.aabb.distanceY(Et),ir=Math.max(Math.abs(Rt),Math.abs(xt)),p=Ge+(1<<st-je.zoom)-2;if(je.zoom===st||ir>p&&je.zoom>=xe){let m=st-je.zoom,f=Y[0]-.5-(yt<<m),v=Y[1]-.5-(ft<<m);tt.push({tileID:new s.OverscaledTileID(je.zoom===st?ct:je.zoom,je.wrap,je.zoom,yt,ft),distanceSq:s.sqrLen([se[0]-.5-yt,se[1]-.5-ft]),tileDistanceToCamera:Math.sqrt(f*f+v*v)})}else for(let m=0;m<4;m++){let f=(yt<<1)+m%2,v=(ft<<1)+(m>>1),I=je.zoom+1,L=je.aabb.quadrant(m);if(i.terrain){let D=new s.OverscaledTileID(I,je.wrap,I,f,v),G=i.terrain.getMinMaxElevation(D),K=(d=G.minElevation)!==null&&d!==void 0?d:this.elevation,ne=(x=G.maxElevation)!==null&&x!==void 0?x:this.elevation;L=new la([L.min[0],L.min[1],K],[L.max[0],L.max[1],ne])}Be.push({aabb:L,zoom:I,x:f,y:v,wrap:je.wrap,fullyVisible:vt})}}return tt.sort((je,yt)=>je.distanceSq-yt.distanceSq).map(je=>je.tileID)}resize(i,d){this.width=i,this.height=d,this.pixelsToGLUnits=[2/i,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){let d=s.clamp(i.lat,-this.maxValidLatitude,this.maxValidLatitude);return new s.pointGeometry(s.mercatorXfromLng(i.lng)*this.worldSize,s.mercatorYfromLat(d)*this.worldSize)}unproject(i){return new s.MercatorCoordinate(i.x/this.worldSize,i.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(i){this.freezeElevation||(this.elevation=i?this.getElevation(this._center,i):0)}getElevation(i,d){let x=s.MercatorCoordinate.fromLngLat(i),T=(1<<this.tileZoom)*s.EXTENT,M=x.x*T,U=x.y*T,q=Math.floor(M/s.EXTENT),W=Math.floor(U/s.EXTENT),Y=new s.OverscaledTileID(this.tileZoom,0,this.tileZoom,q,W);return d.getElevation(Y,M%s.EXTENT,U%s.EXTENT,s.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(i){let d=this.pointLocation(this.centerPoint,i),x=this.getElevation(d,i);if(!(this.elevation-x))return;let T=this.getCameraPosition(),M=s.MercatorCoordinate.fromLngLat(T.lngLat,T.altitude),U=s.MercatorCoordinate.fromLngLat(d,x),q=M.x-U.x,W=M.y-U.y,Y=M.z-U.z,se=Math.sqrt(q*q+W*W+Y*Y),pe=this.scaleZoom(this.cameraToCenterDistance/se/this.tileSize);this._elevation=x,this._center=d,this.zoom=pe}setLocationAtPoint(i,d){let x=this.pointCoordinate(d),T=this.pointCoordinate(this.centerPoint),M=this.locationCoordinate(i),U=new s.MercatorCoordinate(M.x-(x.x-T.x),M.y-(x.y-T.y));this.center=this.coordinateLocation(U),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,d){return d?this.coordinatePoint(this.locationCoordinate(i),this.getElevation(i,d),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,d){return this.coordinateLocation(this.pointCoordinate(i,d))}locationCoordinate(i){return s.MercatorCoordinate.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,d){if(d){let xe=d.pointCoordinate(i);if(xe!=null)return xe}let x=[i.x,i.y,0,1],T=[i.x,i.y,1,1];s.transformMat4(x,x,this.pixelMatrixInverse),s.transformMat4(T,T,this.pixelMatrixInverse);let M=x[3],U=T[3],q=x[1]/M,W=T[1]/U,Y=x[2]/M,se=T[2]/U,pe=Y===se?0:(0-Y)/(se-Y);return new s.MercatorCoordinate(s.number(x[0]/M,T[0]/U,pe)/this.worldSize,s.number(q,W,pe)/this.worldSize)}coordinatePoint(i,d=0,x=this.pixelMatrix){let T=[i.x*this.worldSize,i.y*this.worldSize,d,1];return s.transformMat4(T,T,x),new s.pointGeometry(T[0]/T[3],T[1]/T[3])}getBounds(){let i=Math.max(0,this.height/2-this.getHorizon());return new s.LngLatBounds().extend(this.pointLocation(new s.pointGeometry(0,i))).extend(this.pointLocation(new s.pointGeometry(this.width,i))).extend(this.pointLocation(new s.pointGeometry(this.width,this.height))).extend(this.pointLocation(new s.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new s.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(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(i,d=!1){let x=i.key,T=d?this._alignedPosMatrixCache:this._posMatrixCache;if(T[x])return T[x];let M=i.canonical,U=this.worldSize/this.zoomScale(M.z),q=M.x+Math.pow(2,M.z)*i.wrap,W=s.identity(new Float64Array(16));return s.translate(W,W,[q*U,M.y*U,0]),s.scale(W,W,[U/s.EXTENT,U/s.EXTENT,1]),s.multiply(W,d?this.alignedProjMatrix:this.projMatrix,W),T[x]=new Float32Array(W),T[x]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let i,d,x,T,M=-90,U=90,q=-180,W=180,Y=this.size,se=this._unmodified;if(this.latRange){let Ge=this.latRange;M=s.mercatorYfromLat(Ge[1])*this.worldSize,U=s.mercatorYfromLat(Ge[0])*this.worldSize,i=U-M<Y.y?Y.y/(U-M):0}if(this.lngRange){let Ge=this.lngRange;q=s.wrap(s.mercatorXfromLng(Ge[0])*this.worldSize,0,this.worldSize),W=s.wrap(s.mercatorXfromLng(Ge[1])*this.worldSize,0,this.worldSize),W<q&&(W+=this.worldSize),d=W-q<Y.x?Y.x/(W-q):0}let pe=this.point,xe=Math.max(d||0,i||0);if(xe)return this.center=this.unproject(new s.pointGeometry(d?(W+q)/2:pe.x,i?(U+M)/2:pe.y)),this.zoom+=this.scaleZoom(xe),this._unmodified=se,void(this._constraining=!1);if(this.latRange){let Ge=pe.y,ze=Y.y/2;Ge-ze<M&&(T=M+ze),Ge+ze>U&&(T=U-ze)}if(this.lngRange){let Ge=(q+W)/2,ze=s.wrap(pe.x,Ge-this.worldSize/2,Ge+this.worldSize/2),Be=Y.x/2;ze-Be<q&&(x=q+Be),ze+Be>W&&(x=W-Be)}x===void 0&&T===void 0||(this.center=this.unproject(new s.pointGeometry(x!==void 0?x:pe.x,T!==void 0?T:pe.y)).wrap()),this._unmodified=se,this._constraining=!1}_calcMatrices(){if(!this.height)return;let i=this.centerOffset,d=this.point.x,x=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=s.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let T=s.identity(new Float64Array(16));s.scale(T,T,[this.width/2,-this.height/2,1]),s.translate(T,T,[1,-1,0]),this.labelPlaneMatrix=T,T=s.identity(new Float64Array(16)),s.scale(T,T,[1,-1,1]),s.translate(T,T,[-1,-1,0]),s.scale(T,T,[2/this.width,2/this.height,1]),this.glCoordMatrix=T,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);let M=Math.PI/2+this._pitch,U=this._fov*(.5+i.y/this.height),q=Math.sin(U)*this.cameraToSeaLevelDistance/Math.sin(s.clamp(Math.PI-M-U,.01,Math.PI-.01)),W=this.getHorizon(),Y=2*Math.atan(W/this.cameraToCenterDistance)*(.5+i.y/(2*W)),se=Math.sin(Y)*this.cameraToSeaLevelDistance/Math.sin(s.clamp(Math.PI-M-Y,.01,Math.PI-.01)),pe=Math.cos(Math.PI/2-this._pitch)*q+this.cameraToSeaLevelDistance,xe=Math.cos(Math.PI/2-this._pitch)*se+this.cameraToSeaLevelDistance,Ge=1.01*Math.min(pe,xe),ze=this.height/50;T=new Float64Array(16),s.perspective(T,this._fov,this.width/this.height,ze,Ge),T[8]=2*-i.x/this.width,T[9]=2*i.y/this.height,s.scale(T,T,[1,-1,1]),s.translate(T,T,[0,0,-this.cameraToCenterDistance]),s.rotateX(T,T,this._pitch),s.rotateZ(T,T,this.angle),s.translate(T,T,[-d,-x,0]),this.mercatorMatrix=s.scale([],T,[this.worldSize,this.worldSize,this.worldSize]),s.scale(T,T,[1,1,this._pixelPerMeter]),this.pixelMatrix=s.multiply(new Float64Array(16),this.labelPlaneMatrix,T),s.translate(T,T,[0,0,-this.elevation]),this.projMatrix=T,this.invProjMatrix=s.invert([],T),this.pixelMatrix3D=s.multiply(new Float64Array(16),this.labelPlaneMatrix,T);let Be=this.width%2/2,tt=this.height%2/2,st=Math.cos(this.angle),ct=Math.sin(this.angle),je=d-Math.round(d)+st*Be+ct*tt,yt=x-Math.round(x)+st*tt+ct*Be,ft=new Float64Array(T);if(s.translate(ft,ft,[je>.5?je-1:je,yt>.5?yt-1:yt,0]),this.alignedProjMatrix=ft,T=s.invert(new Float64Array(16),this.pixelMatrix),!T)throw new Error("failed to invert matrix");this.pixelMatrixInverse=T,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let i=this.pointCoordinate(new s.pointGeometry(0,0)),d=[i.x*this.worldSize,i.y*this.worldSize,0,1];return s.transformMat4(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.pointGeometry(0,i))}getCameraQueryGeometry(i){let d=this.getCameraPoint();if(i.length===1)return[i[0],d];{let x=d.x,T=d.y,M=d.x,U=d.y;for(let q of i)x=Math.min(x,q.x),T=Math.min(T,q.y),M=Math.max(M,q.x),U=Math.max(U,q.y);return[new s.pointGeometry(x,T),new s.pointGeometry(M,T),new s.pointGeometry(M,U),new s.pointGeometry(x,U),new s.pointGeometry(x,T)]}}}class nu{constructor(i){this._hashName=i&&encodeURIComponent(i),s.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(d,x){let T=!1,M=null,U=()=>{M=null,T&&(d(),M=setTimeout(U,300),T=!1)};return()=>(T=!0,M||U(),M)}(this._updateHashUnthrottled.bind(this))}addTo(i){return this._map=i,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(i){let d=this._map.getCenter(),x=Math.round(100*this._map.getZoom())/100,T=Math.ceil((x*Math.LN2+Math.log(512/360/.5))/Math.LN10),M=Math.pow(10,T),U=Math.round(d.lng*M)/M,q=Math.round(d.lat*M)/M,W=this._map.getBearing(),Y=this._map.getPitch(),se="";if(se+=i?`/${U}/${q}/${x}`:`${x}/${q}/${U}`,(W||Y)&&(se+="/"+Math.round(10*W)/10),Y&&(se+=`/${Math.round(Y)}`),this._hashName){let pe=this._hashName,xe=!1,Ge=window.location.hash.slice(1).split("&").map(ze=>{let Be=ze.split("=")[0];return Be===pe?(xe=!0,`${Be}=${se}`):ze}).filter(ze=>ze);return xe||Ge.push(`${pe}=${se}`),`#${Ge.join("&")}`}return`#${se}`}_getCurrentHash(){let i=window.location.hash.replace("#","");if(this._hashName){let d;return i.split("&").map(x=>x.split("=")).forEach(x=>{x[0]===this._hashName&&(d=x)}),(d&&d[1]||"").split("/")}return i.split("/")}_onHashChange(){let i=this._getCurrentHash();if(i.length>=3&&!i.some(d=>isNaN(d))){let d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:d,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){let i=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,i)}catch{}}}let as={linearity:.3,easing:s.bezier(0,0,.3,1)},Tc=s.extend({deceleration:2500,maxSpeed:1400},as),kl=s.extend({deceleration:20,maxSpeed:1400},as),ou=s.extend({deceleration:1e3,maxSpeed:360},as),Bs=s.extend({deceleration:1e3,maxSpeed:90},as);class Gu{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.exported.now(),settings:i})}_drainInertiaBuffer(){let i=this._inertiaBuffer,d=s.exported.now();for(;i.length>0&&d-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let d={zoom:0,bearing:0,pitch:0,pan:new s.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(let{settings:M}of this._inertiaBuffer)d.zoom+=M.zoomDelta||0,d.bearing+=M.bearingDelta||0,d.pitch+=M.pitchDelta||0,M.panDelta&&d.pan._add(M.panDelta),M.around&&(d.around=M.around),M.pinchAround&&(d.pinchAround=M.pinchAround);let x=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,T={};if(d.pan.mag()){let M=Us(d.pan.mag(),x,s.extend({},Tc,i||{}));T.offset=d.pan.mult(M.amount/d.pan.mag()),T.center=this._map.transform.center,ss(T,M)}if(d.zoom){let M=Us(d.zoom,x,kl);T.zoom=this._map.transform.zoom+M.amount,ss(T,M)}if(d.bearing){let M=Us(d.bearing,x,ou);T.bearing=this._map.transform.bearing+s.clamp(M.amount,-179,179),ss(T,M)}if(d.pitch){let M=Us(d.pitch,x,Bs);T.pitch=this._map.transform.pitch+M.amount,ss(T,M)}if(T.zoom||T.bearing){let M=d.pinchAround===void 0?d.around:d.pinchAround;T.around=M?this._map.unproject(M):this._map.getCenter()}return this.clear(),s.extend(T,{noMoveStart:!0})}}function ss(E,i){(!E.duration||E.duration<i.duration)&&(E.duration=i.duration,E.easing=i.easing)}function Us(E,i,d){let{maxSpeed:x,linearity:T,deceleration:M}=d,U=s.clamp(E*T/(i/1e3),-x,x),q=Math.abs(U)/(M*T);return{easing:d.easing,duration:1e3*q,amount:U*(q/2)}}class po extends s.Event{constructor(i,d,x,T={}){let M=N.mousePos(d.getCanvasContainer(),x),U=d.unproject(M);super(i,s.extend({point:M,lngLat:U,originalEvent:x},T)),this._defaultPrevented=!1,this.target=d}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Ns extends s.Event{constructor(i,d,x){let T=i==="touchend"?x.changedTouches:x.touches,M=N.touchPos(d.getCanvasContainer(),T),U=M.map(W=>d.unproject(W)),q=M.reduce((W,Y,se,pe)=>W.add(Y.div(pe.length)),new s.pointGeometry(0,0));super(i,{points:M,point:q,lngLats:U,lngLat:d.unproject(q),originalEvent:x}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Yn extends s.Event{constructor(i,d,x){super(i,{originalEvent:x}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Sc{constructor(i,d){this._map=i,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new Yn(i.type,this._map,i))}mousedown(i,d){return this._mousedownPos=d,this._firePreventable(new po(i.type,this._map,i))}mouseup(i){this._map.fire(new po(i.type,this._map,i))}click(i,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new po(i.type,this._map,i))}dblclick(i){return this._firePreventable(new po(i.type,this._map,i))}mouseover(i){this._map.fire(new po(i.type,this._map,i))}mouseout(i){this._map.fire(new po(i.type,this._map,i))}touchstart(i){return this._firePreventable(new Ns(i.type,this._map,i))}touchmove(i){this._map.fire(new Ns(i.type,this._map,i))}touchend(i){this._map.fire(new Ns(i.type,this._map,i))}touchcancel(i){this._map.fire(new Ns(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Io{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new po(i.type,this._map,i))}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(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new po(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Di{constructor(i,d){this._map=i,this._el=i.getCanvasContainer(),this._container=i.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(i,d){this.isEnabled()&&i.shiftKey&&i.button===0&&(N.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(i,d){if(!this._active)return;let x=d;if(this._lastPos.equals(x)||!this._box&&x.dist(this._startPos)<this._clickTolerance)return;let T=this._startPos;this._lastPos=x,this._box||(this._box=N.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",i));let M=Math.min(T.x,x.x),U=Math.max(T.x,x.x),q=Math.min(T.y,x.y),W=Math.max(T.y,x.y);N.setTransform(this._box,`translate(${M}px,${q}px)`),this._box.style.width=U-M+"px",this._box.style.height=W-q+"px"}mouseupWindow(i,d){if(!this._active||i.button!==0)return;let x=this._startPos,T=d;if(this.reset(),N.suppressClick(),x.x!==T.x||x.y!==T.y)return this._map.fire(new s.Event("boxzoomend",{originalEvent:i})),{cameraAnimation:M=>M.fitScreenCoordinates(x,T,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(N.remove(this._box),this._box=null),N.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,d){return this._map.fire(new s.Event(i,{originalEvent:d}))}}function Ko(E,i){if(E.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${E.length}, points ${i.length}`);let d={};for(let x=0;x<E.length;x++)d[E[x].identifier]=i[x];return d}class ua{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(i,d,x){(this.centroid||x.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),x.length===this.numTouches&&(this.centroid=function(T){let M=new s.pointGeometry(0,0);for(let U of T)M._add(U);return M.div(T.length)}(d),this.touches=Ko(x,d)))}touchmove(i,d,x){if(this.aborted||!this.centroid)return;let T=Ko(x,d);for(let M in this.touches){let U=this.touches[M],q=T[M];(!q||q.dist(U)>30)&&(this.aborted=!0)}}touchend(i,d,x){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),x.length===0){let T=!this.aborted&&this.centroid;if(this.reset(),T)return T}}}class Ca{constructor(i){this.singleTap=new ua(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,d,x){this.singleTap.touchstart(i,d,x)}touchmove(i,d,x){this.singleTap.touchmove(i,d,x)}touchend(i,d,x){let T=this.singleTap.touchend(i,d,x);if(T){let M=i.timeStamp-this.lastTime<500,U=!this.lastTap||this.lastTap.dist(T)<30;if(M&&U||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=T,this.count===this.numTaps)return this.reset(),T}}}class Jr{constructor(){this._zoomIn=new Ca({numTouches:1,numTaps:2}),this._zoomOut=new Ca({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,d,x){this._zoomIn.touchstart(i,d,x),this._zoomOut.touchstart(i,d,x)}touchmove(i,d,x){this._zoomIn.touchmove(i,d,x),this._zoomOut.touchmove(i,d,x)}touchend(i,d,x){let T=this._zoomIn.touchend(i,d,x),M=this._zoomOut.touchend(i,d,x);return T?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:U=>U.easeTo({duration:300,zoom:U.getZoom()+1,around:U.unproject(T)},{originalEvent:i})}):M?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:U=>U.easeTo({duration:300,zoom:U.getZoom()-1,around:U.unproject(M)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let ki={0:1,2:2};class ro{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(i,d){return!1}_move(i,d){return{}}mousedown(i,d){if(this._lastPoint)return;let x=N.mouseButton(i);this._correctButton(i,x)&&(this._lastPoint=d,this._eventButton=x)}mousemoveWindow(i,d){let x=this._lastPoint;if(x){if(i.preventDefault(),function(T,M){let U=ki[M];return T.buttons===void 0||(T.buttons&U)!==U}(i,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(i){this._lastPoint&&N.mouseButton(i)===this._eventButton&&(this._moved&&N.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ga extends ro{mousedown(i,d){super.mousedown(i,d),this._lastPoint&&(this._active=!0)}_correctButton(i,d){return d===0&&!i.ctrlKey}_move(i,d){return{around:d,panDelta:d.sub(i)}}}class Co extends ro{_correctButton(i,d){return d===0&&i.ctrlKey||d===2}_move(i,d){let x=.8*(d.x-i.x);if(x)return this._active=!0,{bearingDelta:x}}contextmenu(i){i.preventDefault()}}class ar extends ro{_correctButton(i,d){return d===0&&i.ctrlKey||d===2}_move(i,d){let x=-.5*(d.y-i.y);if(x)return this._active=!0,{pitchDelta:x}}contextmenu(i){i.preventDefault()}}class Ic{constructor(i,d){this._minTouches=i.cooperativeGestures?2:1,this._clickTolerance=i.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new s.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(i,d,x){return this._calculateTransform(i,d,x)}touchmove(i,d,x){if(this._map._cooperativeGestures&&(this._minTouches===2&&x.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(i,!1,x.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(x.length<this._minTouches))return i.preventDefault(),this._calculateTransform(i,d,x)}touchend(i,d,x){this._calculateTransform(i,d,x),this._active&&x.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,d,x){x.length>0&&(this._active=!0);let T=Ko(x,d),M=new s.pointGeometry(0,0),U=new s.pointGeometry(0,0),q=0;for(let Y in T){let se=T[Y],pe=this._touches[Y];pe&&(M._add(se),U._add(se.sub(pe)),q++,T[Y]=se)}if(this._touches=T,q<this._minTouches||!U.mag())return;let W=U.div(q);return this._sum._add(W),this._sum.mag()<this._clickTolerance?void 0:{around:M.div(q),panDelta:W}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vs{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(i){}_move(i,d,x){return{}}touchstart(i,d,x){this._firstTwoTouches||x.length<2||(this._firstTwoTouches=[x[0].identifier,x[1].identifier],this._start([d[0],d[1]]))}touchmove(i,d,x){if(!this._firstTwoTouches)return;i.preventDefault();let[T,M]=this._firstTwoTouches,U=Ho(x,d,T),q=Ho(x,d,M);if(!U||!q)return;let W=this._aroundCenter?null:U.add(q).div(2);return this._move([U,q],W,i)}touchend(i,d,x){if(!this._firstTwoTouches)return;let[T,M]=this._firstTwoTouches,U=Ho(x,d,T),q=Ho(x,d,M);U&&q||(this._active&&N.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&i.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ho(E,i,d){for(let x=0;x<E.length;x++)if(E[x].identifier===d)return i[x]}function Gs(E,i){return Math.log(E/i)/Math.LN2}class Jt extends Vs{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,d){let x=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(Math.abs(Gs(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Gs(this._distance,x),pinchAround:d}}}function nn(E,i){return 180*E.angleWith(i)/Math.PI}class Ll extends Vs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,d){let x=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:nn(this._vector,x),pinchAround:d}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());let d=25/(Math.PI*this._minDiameter)*360,x=nn(i,this._startVector);return Math.abs(x)<d}}function au(E){return Math.abs(E.y)>Math.abs(E.x)}class on extends Vs{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,d,x){super.touchstart(i,d,x),this._currentTouchCount=x.length}_start(i){this._lastPoints=i,au(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,d,x){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;let T=i[0].sub(this._lastPoints[0]),M=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(T,M,x.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(T.y+M.y)/2*-.5}):void 0}gestureBeginsVertically(i,d,x){if(this._valid!==void 0)return this._valid;let T=i.mag()>=2,M=d.mag()>=2;if(!T&&!M)return;if(!T||!M)return this._firstMove===void 0&&(this._firstMove=x),x-this._firstMove<100&&void 0;let U=i.y>0==d.y>0;return au(i)&&au(d)&&U}}let rr={panStep:100,bearingStep:15,pitchStep:10};class fo{constructor(){let i=rr;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let d=0,x=0,T=0,M=0,U=0;switch(i.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:i.shiftKey?x=-1:(i.preventDefault(),M=-1);break;case 39:i.shiftKey?x=1:(i.preventDefault(),M=1);break;case 38:i.shiftKey?T=1:(i.preventDefault(),U=-1);break;case 40:i.shiftKey?T=-1:(i.preventDefault(),U=1);break;default:return}return this._rotationDisabled&&(x=0,T=0),{cameraAnimation:q=>{let W=q.getZoom();q.easeTo({duration:300,easeId:"keyboardHandler",easing:su,zoom:d?Math.round(W)+d*(i.shiftKey?2:1):W,bearing:q.getBearing()+x*this._bearingStep,pitch:q.getPitch()+T*this._pitchStep,offset:[-M*this._panStep,-U*this._panStep],center:q.getCenter()},{originalEvent:i})}}}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 su(E){return E*(2-E)}let js=4.000244140625;class Uo{constructor(i,d){this._map=i,this._el=i.getCanvasContainer(),this._handler=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,s.bindAll(["_onTimeout"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(i){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;i.preventDefault()}let d=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY,x=s.exported.now(),T=x-(this._lastWheelEventTime||0);this._lastWheelEventTime=x,d!==0&&d%js==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":T>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(T*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),i.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=i,this._delta-=d,this._active||this._start(i)),i.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){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=N.mousePos(this._el,i);this._around=s.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 i=this._map.transform;if(this._delta!==0){let q=this._type==="wheel"&&Math.abs(this._delta)>js?this._wheelZoomRate:this._defaultZoomRate,W=2/(1+Math.exp(-Math.abs(this._delta*q)));this._delta<0&&W!==0&&(W=1/W);let Y=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(Y*W))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let d=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,x=this._startZoom,T=this._easing,M,U=!1;if(this._type==="wheel"&&x&&T){let q=Math.min((s.exported.now()-this._lastWheelEventTime)/200,1),W=T(q);M=s.number(x,d,W),q<1?this._frameId||(this._frameId=!0):U=!0}else M=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:M-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let d=s.ease;if(this._prevEase){let x=this._prevEase,T=(s.exported.now()-x.start)/x.duration,M=x.easing(T+.01)-x.easing(T),U=.27/Math.sqrt(M*M+1e-4)*.01,q=Math.sqrt(.0729-U*U);d=s.bezier(U,q,.25,1)}return this._prevEase={start:s.exported.now(),duration:i,easing:d},d}reset(){this._active=!1}}class io{constructor(i,d){this._clickZoom=i,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 Rl{constructor(){this.reset()}reset(){this._active=!1}dblclick(i,d){return i.preventDefault(),{cameraAnimation:x=>{x.easeTo({duration:300,zoom:x.getZoom()+(i.shiftKey?-1:1),around:x.unproject(d)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qt{constructor(){this._tap=new Ca({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(i,d,x){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?x.length>0&&(this._swipePoint=d[0],this._swipeTouch=x[0].identifier):this._tap.touchstart(i,d,x))}touchmove(i,d,x){if(this._tapTime){if(this._swipePoint){if(x[0].identifier!==this._swipeTouch)return;let T=d[0],M=T.y-this._swipePoint.y;return this._swipePoint=T,i.preventDefault(),this._active=!0,{zoomDelta:M/128}}}else this._tap.touchmove(i,d,x)}touchend(i,d,x){this._tapTime?this._swipePoint&&x.length===0&&this.reset():this._tap.touchend(i,d,x)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class no{constructor(i,d,x){this._el=i,this._mousePan=d,this._touchPan=x}enable(i){this._inertiaOptions=i||{},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 ca{constructor(i,d,x){this._pitchWithRotate=i.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 lu{constructor(i,d,x,T){this._el=i,this._touchZoom=d,this._touchRotate=x,this._tapDragZoom=T,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),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 Jn=E=>E.zoom||E.drag||E.pitch||E.rotate;class oo extends s.Event{}function ls(E){return E.panDelta&&E.panDelta.mag()||E.zoomDelta||E.bearingDelta||E.pitchDelta}class zl{constructor(i,d){this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Gu(i),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d),s.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[T,M,U]of this._listeners)N.addEventListener(T,M,T===document?this.handleWindowEvent:this.handleEvent,U)}destroy(){for(let[i,d,x]of this._listeners)N.removeEventListener(i,d,i===document?this.handleWindowEvent:this.handleEvent,x)}_addDefaultHandlers(i){let d=this._map,x=d.getCanvasContainer();this._add("mapEvent",new Sc(d,i));let T=d.boxZoom=new Di(d,i);this._add("boxZoom",T);let M=new Jr,U=new Rl;d.doubleClickZoom=new io(U,M),this._add("tapZoom",M),this._add("clickZoom",U);let q=new qt;this._add("tapDragZoom",q);let W=d.touchPitch=new on(d);this._add("touchPitch",W);let Y=new Co(i),se=new ar(i);d.dragRotate=new ca(i,Y,se),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",se,["mouseRotate"]);let pe=new Ga(i),xe=new Ic(i,d);d.dragPan=new no(x,pe,xe),this._add("mousePan",pe),this._add("touchPan",xe,["touchZoom","touchRotate"]);let Ge=new Ll,ze=new Jt;d.touchZoomRotate=new lu(x,ze,Ge,q),this._add("touchRotate",Ge,["touchPan","touchZoom"]),this._add("touchZoom",ze,["touchPan","touchRotate"]);let Be=d.scrollZoom=new Uo(d,this);this._add("scrollZoom",Be,["mousePan"]);let tt=d.keyboard=new fo;this._add("keyboard",tt),this._add("blockableMapEvent",new Io(d));for(let st of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])i.interactive&&i[st]&&d[st].enable(i[st])}_add(i,d,x){this._handlers.push({handlerName:i,handler:d,allowed:x}),this._handlersById[i]=d}stop(i){if(!this._updatingCamera){for(let{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(let{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Jn(this._eventsInProgress))||this.isZooming()}_blockedByActive(i,d,x){for(let T in i)if(T!==x&&(!d||d.indexOf(T)<0))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){let d=[];for(let x of i)this._el.contains(x.target)&&d.push(x);return d}handleEvent(i,d){if(i.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let x=i.type==="renderFrame"?void 0:i,T={needsRenderFrame:!1},M={},U={},q=i.touches,W=q?this._getMapTouches(q):void 0,Y=W?N.touchPos(this._el,W):N.mousePos(this._el,i);for(let{handlerName:xe,handler:Ge,allowed:ze}of this._handlers){if(!Ge.isEnabled())continue;let Be;this._blockedByActive(U,ze,xe)?Ge.reset():Ge[d||i.type]&&(Be=Ge[d||i.type](i,Y,W),this.mergeHandlerResult(T,M,Be,xe,x),Be&&Be.needsRenderFrame&&this._triggerRenderFrame()),(Be||Ge.isActive())&&(U[xe]=Ge)}let se={};for(let xe in this._previousActiveHandlers)U[xe]||(se[xe]=x);this._previousActiveHandlers=U,(Object.keys(se).length||ls(T))&&(this._changes.push([T,M,se]),this._triggerRenderFrame()),(Object.keys(U).length||ls(T))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:pe}=T;pe&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],pe(this._map))}mergeHandlerResult(i,d,x,T,M){if(!x)return;s.extend(i,x);let U={handlerName:T,originalEvent:x.originalEvent||M};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 i={},d={},x={};for(let[T,M,U]of this._changes)T.panDelta&&(i.panDelta=(i.panDelta||new s.pointGeometry(0,0))._add(T.panDelta)),T.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+T.zoomDelta),T.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+T.bearingDelta),T.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+T.pitchDelta),T.around!==void 0&&(i.around=T.around),T.pinchAround!==void 0&&(i.pinchAround=T.pinchAround),T.noInertia&&(i.noInertia=T.noInertia),s.extend(d,M),s.extend(x,U);this._updateMapTransform(i,d,x),this._changes=[]}_updateMapTransform(i,d,x){let T=this._map,M=T.transform,U=T.style&&T.style.terrain;if(!(ls(i)||U&&this._drag))return this._fireEvents(d,x,!0);let{panDelta:q,zoomDelta:W,bearingDelta:Y,pitchDelta:se,around:pe,pinchAround:xe}=i;xe!==void 0&&(pe=xe),T._stop(!0),pe=pe||T.transform.centerPoint;let Ge=M.pointLocation(q?pe.sub(q):pe);Y&&(M.bearing+=Y),se&&(M.pitch+=se),W&&(M.zoom+=W),U?d.drag&&!this._drag?(this._drag={center:M.centerPoint,lngLat:M.pointLocation(pe),point:pe,handlerName:d.drag.handlerName},T.fire(new s.Event("freezeElevation",{freeze:!0}))):this._drag&&x[this._drag.handlerName]?(T.fire(new s.Event("freezeElevation",{freeze:!1})),this._drag=null):d.drag&&this._drag&&(M.center=M.pointLocation(M.centerPoint.sub(q))):M.setLocationAtPoint(Ge,pe),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(d,x,!0)}_fireEvents(i,d,x){let T=Jn(this._eventsInProgress),M=Jn(i),U={};for(let se in i){let{originalEvent:pe}=i[se];this._eventsInProgress[se]||(U[`${se}start`]=pe),this._eventsInProgress[se]=i[se]}!T&&M&&this._fireEvent("movestart",M.originalEvent);for(let se in U)this._fireEvent(se,U[se]);M&&this._fireEvent("move",M.originalEvent);for(let se in i){let{originalEvent:pe}=i[se];this._fireEvent(se,pe)}let q={},W;for(let se in this._eventsInProgress){let{handlerName:pe,originalEvent:xe}=this._eventsInProgress[se];this._handlersById[pe].isActive()||(delete this._eventsInProgress[se],W=d[pe]||xe,q[`${se}end`]=W)}for(let se in q)this._fireEvent(se,q[se]);let Y=Jn(this._eventsInProgress);if(x&&(T||M)&&!Y){this._updatingCamera=!0;let se=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),pe=xe=>xe!==0&&-this._bearingSnap<xe&&xe<this._bearingSnap;se?(pe(se.bearing||this._map.getBearing())&&(se.bearing=0),this._map.easeTo(se,{originalEvent:W})):(this._map.fire(new s.Event("moveend",{originalEvent:W})),pe(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(i,d){this._map.fire(new s.Event(i,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{delete this._frameId,this.handleEvent(new oo("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}let Ji={extend:(E,...i)=>s.extend(E,...i),run(E){E()},logToElement(E,i=!1,d="log"){let x=window.document.getElementById(d);x&&(i&&(x.innerHTML=""),x.innerHTML+=`<br>${E}`)}};class gi extends s.Evented{constructor(i,d){super(),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=d.bearingSnap,s.bindAll(["_renderFrameCallback"],this)}getCenter(){return new s.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(i,d){return this.jumpTo({center:i},d)}panBy(i,d,x){return i=s.pointGeometry.convert(i).mult(-1),this.panTo(this.transform.center,s.extend({offset:i},d),x)}panTo(i,d,x){return this.easeTo(s.extend({center:i},d),x)}getZoom(){return this.transform.zoom}setZoom(i,d){return this.jumpTo({zoom:i},d),this}zoomTo(i,d,x){return this.easeTo(s.extend({zoom:i},d),x)}zoomIn(i,d){return this.zoomTo(this.getZoom()+1,i,d),this}zoomOut(i,d){return this.zoomTo(this.getZoom()-1,i,d),this}getBearing(){return this.transform.bearing}setBearing(i,d){return this.jumpTo({bearing:i},d),this}getPadding(){return this.transform.padding}setPadding(i,d){return this.jumpTo({padding:i},d),this}rotateTo(i,d,x){return this.easeTo(s.extend({bearing:i},d),x)}resetNorth(i,d){return this.rotateTo(0,s.extend({duration:1e3},i),d),this}resetNorthPitch(i,d){return this.easeTo(s.extend({bearing:0,pitch:0,duration:1e3},i),d),this}snapToNorth(i,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,d):this}getPitch(){return this.transform.pitch}setPitch(i,d){return this.jumpTo({pitch:i},d),this}cameraForBounds(i,d){i=s.LngLatBounds.convert(i);let x=d&&d.bearing||0;return this._cameraForBoxAndBearing(i.getNorthWest(),i.getSouthEast(),x,d)}_cameraForBoxAndBearing(i,d,x,T){let M={top:0,bottom:0,right:0,left:0};if(typeof(T=s.extend({padding:M,offset:[0,0],maxZoom:this.transform.maxZoom},T)).padding=="number"){let ft=T.padding;T.padding={top:ft,bottom:ft,right:ft,left:ft}}T.padding=s.extend(M,T.padding);let U=this.transform,q=U.padding,W=U.project(s.LngLat.convert(i)),Y=U.project(s.LngLat.convert(d)),se=W.rotate(-x*Math.PI/180),pe=Y.rotate(-x*Math.PI/180),xe=new s.pointGeometry(Math.max(se.x,pe.x),Math.max(se.y,pe.y)),Ge=new s.pointGeometry(Math.min(se.x,pe.x),Math.min(se.y,pe.y)),ze=xe.sub(Ge),Be=(U.width-(q.left+q.right+T.padding.left+T.padding.right))/ze.x,tt=(U.height-(q.top+q.bottom+T.padding.top+T.padding.bottom))/ze.y;if(tt<0||Be<0)return void s.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let st=Math.min(U.scaleZoom(U.scale*Math.min(Be,tt)),T.maxZoom),ct=s.pointGeometry.convert(T.offset),je=new s.pointGeometry((T.padding.left-T.padding.right)/2,(T.padding.top-T.padding.bottom)/2).rotate(x*Math.PI/180),yt=ct.add(je).mult(U.scale/U.zoomScale(st));return{center:U.unproject(W.add(Y).div(2).sub(yt)),zoom:st,bearing:x}}fitBounds(i,d,x){return this._fitInternal(this.cameraForBounds(i,d),d,x)}fitScreenCoordinates(i,d,x,T,M){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(s.pointGeometry.convert(i)),this.transform.pointLocation(s.pointGeometry.convert(d)),x,T),T,M)}_fitInternal(i,d,x){return i?(delete(d=s.extend(i,d)).padding,d.linear?this.easeTo(d,x):this.flyTo(d,x)):this}jumpTo(i,d){this.stop();let x=this.transform,T=!1,M=!1,U=!1;return"zoom"in i&&x.zoom!==+i.zoom&&(T=!0,x.zoom=+i.zoom),i.center!==void 0&&(x.center=s.LngLat.convert(i.center)),"bearing"in i&&x.bearing!==+i.bearing&&(M=!0,x.bearing=+i.bearing),"pitch"in i&&x.pitch!==+i.pitch&&(U=!0,x.pitch=+i.pitch),i.padding==null||x.isPaddingEqual(i.padding)||(x.padding=i.padding),this.fire(new s.Event("movestart",d)).fire(new s.Event("move",d)),T&&this.fire(new s.Event("zoomstart",d)).fire(new s.Event("zoom",d)).fire(new s.Event("zoomend",d)),M&&this.fire(new s.Event("rotatestart",d)).fire(new s.Event("rotate",d)).fire(new s.Event("rotateend",d)),U&&this.fire(new s.Event("pitchstart",d)).fire(new s.Event("pitch",d)).fire(new s.Event("pitchend",d)),this.fire(new s.Event("moveend",d))}calculateCameraOptionsFromTo(i,d,x,T=0){let M=s.MercatorCoordinate.fromLngLat(i,d),U=s.MercatorCoordinate.fromLngLat(x,T),q=U.x-M.x,W=U.y-M.y,Y=U.z-M.z,se=Math.hypot(q,W,Y);if(se===0)throw new Error("Can't calculate camera options with same From and To");let pe=Math.hypot(q,W),xe=this.transform.scaleZoom(this.transform.cameraToCenterDistance/se/this.transform.tileSize),Ge=180*Math.atan2(q,-W)/Math.PI,ze=180*Math.acos(pe/se)/Math.PI;return ze=Y<0?90-ze:90+ze,{center:U.toLngLat(),zoom:xe,pitch:ze,bearing:Ge}}easeTo(i,d){this._stop(!1,i.easeId),((i=s.extend({offset:[0,0],duration:500,easing:s.ease},i)).animate===!1||!i.essential&&s.exported.prefersReducedMotion)&&(i.duration=0);let x=this.transform,T=this.getZoom(),M=this.getBearing(),U=this.getPitch(),q=this.getPadding(),W="zoom"in i?+i.zoom:T,Y="bearing"in i?this._normalizeBearing(i.bearing,M):M,se="pitch"in i?+i.pitch:U,pe="padding"in i?i.padding:x.padding,xe=s.pointGeometry.convert(i.offset),Ge=x.centerPoint.add(xe),ze=x.pointLocation(Ge),Be=s.LngLat.convert(i.center||ze);this._normalizeCenter(Be);let tt=x.project(ze),st=x.project(Be).sub(tt),ct=x.zoomScale(W-T),je,yt;i.around&&(je=s.LngLat.convert(i.around),yt=x.locationPoint(je));let ft={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||W!==T,this._rotating=this._rotating||M!==Y,this._pitching=this._pitching||se!==U,this._padding=!x.isPaddingEqual(pe),this._easeId=i.easeId,this._prepareEase(d,i.noMoveStart,ft),this._ease(vt=>{if(this._zooming&&(x.zoom=s.number(T,W,vt)),this._rotating&&(x.bearing=s.number(M,Y,vt)),this._pitching&&(x.pitch=s.number(U,se,vt)),this._padding&&(x.interpolatePadding(q,pe,vt),Ge=x.centerPoint.add(xe)),je)x.setLocationAtPoint(je,yt);else{let Et=x.zoomScale(x.zoom-T),Rt=W>T?Math.min(2,ct):Math.max(.5,ct),xt=Math.pow(Rt,1-vt),ir=x.unproject(tt.add(st.mult(vt*xt)).mult(Et));x.setLocationAtPoint(x.renderWorldCopies?ir.wrap():ir,Ge)}this._fireMoveEvents(d)},vt=>{this._afterEase(d,vt)},i),this}_prepareEase(i,d,x={}){this._moving=!0,this.fire(new s.Event("freezeElevation",{freeze:!0})),d||x.moving||this.fire(new s.Event("movestart",i)),this._zooming&&!x.zooming&&this.fire(new s.Event("zoomstart",i)),this._rotating&&!x.rotating&&this.fire(new s.Event("rotatestart",i)),this._pitching&&!x.pitching&&this.fire(new s.Event("pitchstart",i))}_fireMoveEvents(i){this.fire(new s.Event("move",i)),this._zooming&&this.fire(new s.Event("zoom",i)),this._rotating&&this.fire(new s.Event("rotate",i)),this._pitching&&this.fire(new s.Event("pitch",i))}_afterEase(i,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId,this.fire(new s.Event("freezeElevation",{freeze:!1}));let x=this._zooming,T=this._rotating,M=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,x&&this.fire(new s.Event("zoomend",i)),T&&this.fire(new s.Event("rotateend",i)),M&&this.fire(new s.Event("pitchend",i)),this.fire(new s.Event("moveend",i))}flyTo(i,d){if(!i.essential&&s.exported.prefersReducedMotion){let I=s.pick(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(I,d)}this.stop(),i=s.extend({offset:[0,0],speed:1.2,curve:1.42,easing:s.ease},i);let x=this.transform,T=this.getZoom(),M=this.getBearing(),U=this.getPitch(),q=this.getPadding(),W="zoom"in i?s.clamp(+i.zoom,x.minZoom,x.maxZoom):T,Y="bearing"in i?this._normalizeBearing(i.bearing,M):M,se="pitch"in i?+i.pitch:U,pe="padding"in i?i.padding:x.padding,xe=x.zoomScale(W-T),Ge=s.pointGeometry.convert(i.offset),ze=x.centerPoint.add(Ge),Be=x.pointLocation(ze),tt=s.LngLat.convert(i.center||Be);this._normalizeCenter(tt);let st=x.project(Be),ct=x.project(tt).sub(st),je=i.curve,yt=Math.max(x.width,x.height),ft=yt/xe,vt=ct.mag();if("minZoom"in i){let I=s.clamp(Math.min(i.minZoom,T,W),x.minZoom,x.maxZoom),L=yt/x.zoomScale(I-T);je=Math.sqrt(L/vt*2)}let Et=je*je;function Rt(I){let L=(ft*ft-yt*yt+(I?-1:1)*Et*Et*vt*vt)/(2*(I?ft:yt)*Et*vt);return Math.log(Math.sqrt(L*L+1)-L)}function xt(I){return(Math.exp(I)-Math.exp(-I))/2}function ir(I){return(Math.exp(I)+Math.exp(-I))/2}let p=Rt(0),m=function(I){return ir(p)/ir(p+je*I)},f=function(I){return yt*((ir(p)*(xt(L=p+je*I)/ir(L))-xt(p))/Et)/vt;var L},v=(Rt(1)-p)/je;if(Math.abs(vt)<1e-6||!isFinite(v)){if(Math.abs(yt-ft)<1e-6)return this.easeTo(i,d);let I=ft<yt?-1:1;v=Math.abs(Math.log(ft/yt))/je,f=function(){return 0},m=function(L){return Math.exp(I*je*L)}}return i.duration="duration"in i?+i.duration:1e3*v/("screenSpeed"in i?+i.screenSpeed/je:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=M!==Y,this._pitching=se!==U,this._padding=!x.isPaddingEqual(pe),this._prepareEase(d,!1),this._ease(I=>{let L=I*v,D=1/m(L);x.zoom=I===1?W:T+x.scaleZoom(D),this._rotating&&(x.bearing=s.number(M,Y,I)),this._pitching&&(x.pitch=s.number(U,se,I)),this._padding&&(x.interpolatePadding(q,pe,I),ze=x.centerPoint.add(Ge));let G=I===1?tt:x.unproject(st.add(ct.mult(f(L))).mult(D));x.setLocationAtPoint(x.renderWorldCopies?G.wrap():G,ze),this._fireMoveEvents(d)},()=>this._afterEase(d),i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,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(!i){let x=this.handlers;x&&x.stop(!1)}return this}_ease(i,d,x){x.animate===!1||x.duration===0?(i(1),d()):(this._easeStart=s.exported.now(),this._easeOptions=x,this._onEaseFrame=i,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let i=Math.min((s.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(i)),i<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(i,d){i=s.wrap(i,-180,180);let x=Math.abs(i-d);return Math.abs(i-360-d)<x&&(i-=360),Math.abs(i+360-d)<x&&(i+=360),i}_normalizeCenter(i){let d=this.transform;if(!d.renderWorldCopies||d.lngRange)return;let x=i.lng-d.center.lng;i.lng+=x>180?-360:x<-180?360:0}}class ll{constructor(i={}){this.options=i,s.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options&&this.options.compact,this._container=N.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=N.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=N.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(){N.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(i,d){let x=this._map._getUIString(`AttributionControl.${d}`);i.title=x,i.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(i){!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(T=>typeof T!="string"?"":T)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){let T=this._map.style.stylesheet;this.styleOwner=T.owner,this.styleId=T.id}let d=this._map.style.sourceCaches;for(let T in d){let M=d[T];if(M.used||M.usedForTerrain){let U=M.getSource();U.attribution&&i.indexOf(U.attribution)<0&&i.push(U.attribution)}}i=i.filter(T=>String(T).trim()),i.sort((T,M)=>T.length-M.length),i=i.filter((T,M)=>{for(let U=M+1;U<i.length;U++)if(i[U].indexOf(T)>=0)return!1;return!0});let x=i.join(" | ");x!==this._attribHTML&&(this._attribHTML=x,i.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 us{constructor(i={}){this.options=i,s.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=N.create("div","maplibregl-ctrl mapboxgl-ctrl");let d=N.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(){N.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){let i=this._container.children;if(i.length){let d=i[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 uu{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){let d=++this._id;return this._queue.push({callback:i,id:d,cancelled:!1}),d}remove(i){let d=this._currentlyRunning,x=d?this._queue.concat(d):this._queue;for(let T of x)if(T.id===i)return void(T.cancelled=!0)}run(i=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(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let cu={"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"},Yo={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},No={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ur{constructor(i,d,x=!1){this._clickTolerance=10,this.element=d,this.mouseRotate=new Co({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,x&&(this.mousePitch=new ar({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),s.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),N.addEventListener(d,"mousedown",this.mousedown),N.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),N.addEventListener(d,"touchmove",this.touchmove),N.addEventListener(d,"touchend",this.touchend),N.addEventListener(d,"touchcancel",this.reset)}down(i,d){this.mouseRotate.mousedown(i,d),this.mousePitch&&this.mousePitch.mousedown(i,d),N.disableDrag()}move(i,d){let x=this.map,T=this.mouseRotate.mousemoveWindow(i,d);if(T&&T.bearingDelta&&x.setBearing(x.getBearing()+T.bearingDelta),this.mousePitch){let M=this.mousePitch.mousemoveWindow(i,d);M&&M.pitchDelta&&x.setPitch(x.getPitch()+M.pitchDelta)}}off(){let i=this.element;N.removeEventListener(i,"mousedown",this.mousedown),N.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),N.removeEventListener(i,"touchmove",this.touchmove),N.removeEventListener(i,"touchend",this.touchend),N.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){N.enableDrag(),N.removeEventListener(window,"mousemove",this.mousemove),N.removeEventListener(window,"mouseup",this.mouseup)}mousedown(i){this.down(s.extend({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),N.mousePos(this.element,i)),N.addEventListener(window,"mousemove",this.mousemove),N.addEventListener(window,"mouseup",this.mouseup)}mousemove(i){this.move(i,N.mousePos(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){i.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=N.touchPos(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){i.targetTouches.length!==1?this.reset():(this._lastPos=N.touchPos(this.element,i.targetTouches)[0],this.move({preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){i.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(E,i,d){if(E=new s.LngLat(E.lng,E.lat),i){let x=new s.LngLat(E.lng-360,E.lat),T=new s.LngLat(E.lng+360,E.lat),M=d.locationPoint(E).distSqr(i);d.locationPoint(x).distSqr(i)<M?E=x:d.locationPoint(T).distSqr(i)<M&&(E=T)}for(;Math.abs(E.lng-d.center.lng)>180;){let x=d.locationPoint(E);if(x.x>=0&&x.y>=0&&x.x<=d.width&&x.y<=d.height)break;E.lng>d.center.lng?E.lng-=360:E.lng+=360}return E}let sr={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 cr(E,i,d){let x=E.classList;for(let T in sr)x.remove(`maplibregl-${d}-anchor-${T}`,`mapboxgl-${d}-anchor-${T}`);x.add(`maplibregl-${d}-anchor-${i}`,`mapboxgl-${d}-anchor-${i}`)}class Jo extends s.Evented{constructor(i,d){if(super(),(i instanceof HTMLElement||d)&&(i=s.extend({element:i},d)),s.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,i&&i.element)this._element=i.element,this._offset=s.pointGeometry.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=N.create("div"),this._element.setAttribute("aria-label","Map marker");let x=N.createNS("http://www.w3.org/2000/svg","svg"),T=41,M=27;x.setAttributeNS(null,"display","block"),x.setAttributeNS(null,"height",`${T}px`),x.setAttributeNS(null,"width",`${M}px`),x.setAttributeNS(null,"viewBox",`0 0 ${M} ${T}`);let U=N.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 q=N.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"fill-rule","nonzero");let W=N.createNS("http://www.w3.org/2000/svg","g");W.setAttributeNS(null,"transform","translate(3.0, 29.0)"),W.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 ct of Y){let je=N.createNS("http://www.w3.org/2000/svg","ellipse");je.setAttributeNS(null,"opacity","0.04"),je.setAttributeNS(null,"cx","10.5"),je.setAttributeNS(null,"cy","5.80029008"),je.setAttributeNS(null,"rx",ct.rx),je.setAttributeNS(null,"ry",ct.ry),W.appendChild(je)}let se=N.createNS("http://www.w3.org/2000/svg","g");se.setAttributeNS(null,"fill",this._color);let pe=N.createNS("http://www.w3.org/2000/svg","path");pe.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(pe);let xe=N.createNS("http://www.w3.org/2000/svg","g");xe.setAttributeNS(null,"opacity","0.25"),xe.setAttributeNS(null,"fill","#000000");let Ge=N.createNS("http://www.w3.org/2000/svg","path");Ge.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(Ge);let ze=N.createNS("http://www.w3.org/2000/svg","g");ze.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ze.setAttributeNS(null,"fill","#FFFFFF");let Be=N.createNS("http://www.w3.org/2000/svg","g");Be.setAttributeNS(null,"transform","translate(8.0, 8.0)");let tt=N.createNS("http://www.w3.org/2000/svg","circle");tt.setAttributeNS(null,"fill","#000000"),tt.setAttributeNS(null,"opacity","0.25"),tt.setAttributeNS(null,"cx","5.5"),tt.setAttributeNS(null,"cy","5.5"),tt.setAttributeNS(null,"r","5.4999962");let st=N.createNS("http://www.w3.org/2000/svg","circle");st.setAttributeNS(null,"fill","#FFFFFF"),st.setAttributeNS(null,"cx","5.5"),st.setAttributeNS(null,"cy","5.5"),st.setAttributeNS(null,"r","5.4999962"),Be.appendChild(tt),Be.appendChild(st),q.appendChild(W),q.appendChild(se),q.appendChild(xe),q.appendChild(ze),q.appendChild(Be),x.appendChild(q),x.setAttributeNS(null,"height",T*this._scale+"px"),x.setAttributeNS(null,"width",M*this._scale+"px"),this._element.appendChild(x),this._offset=s.pointGeometry.convert(i&&i.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()}),cr(this._element,this._anchor,"marker"),this._popup=null}addTo(i){return this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.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),N.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=s.LngLat.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){let T=Math.sqrt(Math.pow(13.5,2)/2);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[T,-1*(38.1-13.5+T)],"bottom-right":[-T,-1*(38.1-13.5+T)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,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(i){let d=i.code,x=i.charCode||i.keyCode;d!=="Space"&&d!=="Enter"&&x!==32&&x!==13||this.togglePopup()}_onMapClick(i){let d=i.originalEvent.target,x=this._element;this._popup&&(d===x||x.contains(d))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let i=this._popup;return i?(i.isOpen()?i.remove():i.addTo(this._map),this):this}_update(i){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)`),i&&i.type!=="moveend"||(this._pos=this._pos.round()),N.setTransform(this._element,`${sr[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 T=this._map.unproject(this._pos),M=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=T.distanceTo(this._lngLat)>20*M?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(i){return this._offset=s.pointGeometry.convert(i),this._update(),this}_onMove(i){if(!this._isDragging){let d=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=i.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 s.Event("dragstart"))),this.fire(new s.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 s.Event("dragend")),this._state="inactive"}_addDragHandler(i){this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.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(i){return this._draggable=!!i,this._map&&(i?(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(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}let Aa={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},jn,xi=0,Qo=!1,ur={maxWidth:100,unit:"metric"};function lr(E,i,d){let x=d&&d.maxWidth||100,T=E._container.clientHeight/2,M=E.unproject([0,T]),U=E.unproject([x,T]),q=M.distanceTo(U);if(d&&d.unit==="imperial"){let W=3.2808*q;W>5280?ha(i,x,W/5280,E._getUIString("ScaleControl.Miles")):ha(i,x,W,E._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?ha(i,x,q/1852,E._getUIString("ScaleControl.NauticalMiles")):q>=1e3?ha(i,x,q/1e3,E._getUIString("ScaleControl.Kilometers")):ha(i,x,q,E._getUIString("ScaleControl.Meters"))}function ha(E,i,d,x){let T=function(M){let U=Math.pow(10,`${Math.floor(M)}`.length-1),q=M/U;return q=q>=10?10:q>=5?5:q>=3?3:q>=2?2:q>=1?1:function(W){let Y=Math.pow(10,Math.ceil(-Math.log(W)/Math.LN10));return Math.round(W*Y)/Y}(q),U*q}(d);E.style.width=i*(T/d)+"px",E.innerHTML=`${T}&nbsp;${x}`}let si={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ii=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Cn(E){if(E){if(typeof E=="number"){let i=Math.round(Math.sqrt(.5*Math.pow(E,2)));return{center:new s.pointGeometry(0,0),top:new s.pointGeometry(0,E),"top-left":new s.pointGeometry(i,i),"top-right":new s.pointGeometry(-i,i),bottom:new s.pointGeometry(0,-E),"bottom-left":new s.pointGeometry(i,-i),"bottom-right":new s.pointGeometry(-i,-i),left:new s.pointGeometry(E,0),right:new s.pointGeometry(-E,0)}}if(E instanceof s.pointGeometry||Array.isArray(E)){let i=s.pointGeometry.convert(E);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:s.pointGeometry.convert(E.center||[0,0]),top:s.pointGeometry.convert(E.top||[0,0]),"top-left":s.pointGeometry.convert(E["top-left"]||[0,0]),"top-right":s.pointGeometry.convert(E["top-right"]||[0,0]),bottom:s.pointGeometry.convert(E.bottom||[0,0]),"bottom-left":s.pointGeometry.convert(E["bottom-left"]||[0,0]),"bottom-right":s.pointGeometry.convert(E["bottom-right"]||[0,0]),left:s.pointGeometry.convert(E.left||[0,0]),right:s.pointGeometry.convert(E.right||[0,0])}}return Cn(new s.pointGeometry(0,0))}let ao={supported:P,setRTLTextPlugin:s.setRTLTextPlugin,getRTLTextPluginStatus:s.getRTLTextPluginStatus,Map:class extends gi{constructor(E){var i;if(s.PerformanceUtils.mark(s.PerformanceMarkers.create),(E=s.extend({},Yo,E)).minZoom!=null&&E.maxZoom!=null&&E.minZoom>E.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(E.minPitch!=null&&E.maxPitch!=null&&E.minPitch>E.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(E.minPitch!=null&&E.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(E.maxPitch!=null&&E.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new os(E.minZoom,E.maxZoom,E.minPitch,E.maxPitch,E.renderWorldCopies),{bearingSnap:E.bearingSnap}),this._interactive=E.interactive,this._cooperativeGestures=E.cooperativeGestures,this._maxTileCacheSize=E.maxTileCacheSize,this._failIfMajorPerformanceCaveat=E.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=E.preserveDrawingBuffer,this._antialias=E.antialias,this._trackResize=E.trackResize,this._bearingSnap=E.bearingSnap,this._refreshExpiredTiles=E.refreshExpiredTiles,this._fadeDuration=E.fadeDuration,this._crossSourceCollisions=E.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=E.collectResourceTiming,this._renderTaskQueue=new uu,this._controls=[],this._mapId=s.uniqueId(),this._locale=s.extend({},cu,E.locale),this._clickTolerance=E.clickTolerance,this._pixelRatio=(i=E.pixelRatio)!==null&&i!==void 0?i:devicePixelRatio,this._requestManager=new me(E.transformRequest),typeof E.container=="string"){if(this._container=document.getElementById(E.container),!this._container)throw new Error(`Container '${E.container}' not found.`)}else{if(!(E.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=E.container}if(E.maxBounds&&this.setMaxBounds(E.maxBounds),s.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 zl(this,E),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=E.hash&&new nu(typeof E.hash=="string"&&E.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:E.center,zoom:E.zoom,bearing:E.bearing,pitch:E.pitch}),E.bounds&&(this.resize(),this.fitBounds(E.bounds,s.extend({},E.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=E.localIdeographFontFamily,E.style&&this.setStyle(E.style,{localIdeographFontFamily:E.localIdeographFontFamily}),E.attributionControl&&this.addControl(new ll({customAttribution:E.customAttribution})),E.maplibreLogo&&this.addControl(new us,E.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 s.Event(`${d.dataType}data`,d))}),this.on("dataloading",d=>{this.fire(new s.Event(`${d.dataType}dataloading`,d))}),this.on("dataabort",d=>{this.fire(new s.Event("sourcedataabort",d))})}_getMapId(){return this._mapId}addControl(E,i){if(i===void 0&&(i=E.getDefaultPosition?E.getDefaultPosition():"top-right"),!E||!E.onAdd)return this.fire(new s.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let d=E.onAdd(this);this._controls.push(E);let x=this._controlPositions[i];return i.indexOf("bottom")!==-1?x.insertBefore(d,x.firstChild):x.appendChild(d),this}removeControl(E){if(!E||!E.onRemove)return this.fire(new s.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(E);return i>-1&&this._controls.splice(i,1),E.onRemove(this),this}hasControl(E){return this._controls.indexOf(E)>-1}calculateCameraOptionsFromTo(E,i,d,x){return x==null&&this.style.terrain&&(x=this.transform.getElevation(d,this.style.terrain)),super.calculateCameraOptionsFromTo(E,i,d,x)}resize(E){let i=this._containerDimensions(),d=i[0],x=i[1];this._resizeCanvas(d,x,this.getPixelRatio()),this.transform.resize(d,x),this.painter.resize(d,x,this.getPixelRatio());let T=!this._moving;return T&&(this.stop(),this.fire(new s.Event("movestart",E)).fire(new s.Event("move",E))),this.fire(new s.Event("resize",E)),T&&this.fire(new s.Event("moveend",E)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(E){let[i,d]=this._containerDimensions();this._pixelRatio=E,this._resizeCanvas(i,d,E),this.painter.resize(i,d,E)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(E){return this.transform.setMaxBounds(s.LngLatBounds.convert(E)),this._update()}setMinZoom(E){if((E=E??-2)>=-2&&E<=this.transform.maxZoom)return this.transform.minZoom=E,this._update(),this.getZoom()<E&&this.setZoom(E),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(E){if((E=E??22)>=this.transform.minZoom)return this.transform.maxZoom=E,this._update(),this.getZoom()>E&&this.setZoom(E),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(E){if((E=E??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(E>=0&&E<=this.transform.maxPitch)return this.transform.minPitch=E,this._update(),this.getPitch()<E&&this.setPitch(E),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(E){if((E=E??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(E>=this.transform.minPitch)return this.transform.maxPitch=E,this._update(),this.getPitch()>E&&this.setPitch(E),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(E){return this.transform.renderWorldCopies=E,this._update()}project(E){return this.transform.locationPoint(s.LngLat.convert(E),this.style&&this.style.terrain)}unproject(E){return this.transform.pointLocation(s.pointGeometry.convert(E),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(E,i,d){if(E==="mouseenter"||E==="mouseover"){let x=!1;return{layer:i,listener:d,delegates:{mousemove:M=>{let U=this.getLayer(i)?this.queryRenderedFeatures(M.point,{layers:[i]}):[];U.length?x||(x=!0,d.call(this,new po(E,this,M.originalEvent,{features:U}))):x=!1},mouseout:()=>{x=!1}}}}if(E==="mouseleave"||E==="mouseout"){let x=!1;return{layer:i,listener:d,delegates:{mousemove:U=>{(this.getLayer(i)?this.queryRenderedFeatures(U.point,{layers:[i]}):[]).length?x=!0:x&&(x=!1,d.call(this,new po(E,this,U.originalEvent)))},mouseout:U=>{x&&(x=!1,d.call(this,new po(E,this,U.originalEvent)))}}}}{let x=T=>{let M=this.getLayer(i)?this.queryRenderedFeatures(T.point,{layers:[i]}):[];M.length&&(T.features=M,d.call(this,T),delete T.features)};return{layer:i,listener:d,delegates:{[E]:x}}}}on(E,i,d){if(d===void 0)return super.on(E,i);let x=this._createDelegatedListener(E,i,d);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[E]=this._delegatedListeners[E]||[],this._delegatedListeners[E].push(x);for(let T in x.delegates)this.on(T,x.delegates[T]);return this}once(E,i,d){if(d===void 0)return super.once(E,i);let x=this._createDelegatedListener(E,i,d);for(let T in x.delegates)this.once(T,x.delegates[T]);return this}off(E,i,d){return d===void 0?super.off(E,i):(this._delegatedListeners&&this._delegatedListeners[E]&&(x=>{let T=this._delegatedListeners[E];for(let M=0;M<T.length;M++){let U=T[M];if(U.layer===i&&U.listener===d){for(let q in U.delegates)this.off(q,U.delegates[q]);return T.splice(M,1),this}}})(),this)}queryRenderedFeatures(E,i){if(!this.style)return[];let d;if(i!==void 0||E===void 0||E instanceof s.pointGeometry||Array.isArray(E)||(i=E,E=void 0),i=i||{},(E=E||[[0,0],[this.transform.width,this.transform.height]])instanceof s.pointGeometry||typeof E[0]=="number")d=[s.pointGeometry.convert(E)];else{let x=s.pointGeometry.convert(E[0]),T=s.pointGeometry.convert(E[1]);d=[x,new s.pointGeometry(T.x,x.y),T,new s.pointGeometry(x.x,T.y),x]}return this.style.queryRenderedFeatures(d,i,this.transform)}querySourceFeatures(E,i){return this.style.querySourceFeatures(E,i)}setStyle(E,i){return(i=s.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},i)).diff!==!1&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&E?(this._diffStyle(E,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(E,i))}setTransformRequest(E){return this._requestManager.setTransformRequest(E),this}_getUIString(E){let i=this._locale[E];if(i==null)throw new Error(`Missing UI string '${E}'`);return i}_updateStyle(E,i){return this.style&&(this.style.setEventedParent(null),this.style._remove()),E?(this.style=new In(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof E=="string"?this.style.loadURL(E):this.style.loadJSON(E),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new In(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(E,i){if(typeof E=="string"){let d=this._requestManager.transformRequest(E,s.ResourceType.Style);s.getJSON(d,(x,T)=>{x?this.fire(new s.ErrorEvent(x)):T&&this._updateDiff(T,i)})}else typeof E=="object"&&this._updateDiff(E,i)}_updateDiff(E,i){try{this.style.setState(E)&&this._update(!0)}catch(d){s.warnOnce(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(E,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():s.warnOnce("There is no style added to the map.")}addSource(E,i){return this._lazyInitEmptyStyle(),this.style.addSource(E,i),this._update(!0)}isSourceLoaded(E){let i=this.style&&this.style.sourceCaches[E];if(i!==void 0)return i.loaded();this.fire(new s.ErrorEvent(new Error(`There is no source with ID '${E}'`)))}setTerrain(E){return this.style.setTerrain(E),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){let E=this.style&&this.style.sourceCaches;for(let i in E){let d=E[i]._tiles;for(let x in d){let T=d[x];if(T.state!=="loaded"&&T.state!=="errored")return!1}}return!0}addSourceType(E,i,d){return this._lazyInitEmptyStyle(),this.style.addSourceType(E,i,d)}removeSource(E){return this.style.removeSource(E),this._update(!0)}getSource(E){return this.style.getSource(E)}addImage(E,i,{pixelRatio:d=1,sdf:x=!1,stretchX:T,stretchY:M,content:U}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||s.isImageBitmap(i)){let{width:q,height:W,data:Y}=s.exported.getImageData(i);this.style.addImage(E,{data:new s.RGBAImage({width:q,height:W},Y),pixelRatio:d,stretchX:T,stretchY:M,content:U,sdf:x,version:0})}else{if(i.width===void 0||i.height===void 0)return this.fire(new s.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:q,height:W,data:Y}=i,se=i;this.style.addImage(E,{data:new s.RGBAImage({width:q,height:W},new Uint8Array(Y)),pixelRatio:d,stretchX:T,stretchY:M,content:U,sdf:x,version:0,userImage:se}),se.onAdd&&se.onAdd(this,E)}}}updateImage(E,i){let d=this.style.getImage(E);if(!d)return this.fire(new s.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let x=i instanceof HTMLImageElement||s.isImageBitmap(i)?s.exported.getImageData(i):i,{width:T,height:M,data:U}=x;if(T===void 0||M===void 0)return this.fire(new s.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(T!==d.data.width||M!==d.data.height)return this.fire(new s.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));let q=!(i instanceof HTMLImageElement||s.isImageBitmap(i));d.data.replace(U,q),this.style.updateImage(E,d)}hasImage(E){return E?!!this.style.getImage(E):(this.fire(new s.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(E){this.style.removeImage(E)}loadImage(E,i){s.getImage(this._requestManager.transformRequest(E,s.ResourceType.Image),i)}listImages(){return this.style.listImages()}addLayer(E,i){return this._lazyInitEmptyStyle(),this.style.addLayer(E,i),this._update(!0)}moveLayer(E,i){return this.style.moveLayer(E,i),this._update(!0)}removeLayer(E){return this.style.removeLayer(E),this._update(!0)}getLayer(E){return this.style.getLayer(E)}setLayerZoomRange(E,i,d){return this.style.setLayerZoomRange(E,i,d),this._update(!0)}setFilter(E,i,d={}){return this.style.setFilter(E,i,d),this._update(!0)}getFilter(E){return this.style.getFilter(E)}setPaintProperty(E,i,d,x={}){return this.style.setPaintProperty(E,i,d,x),this._update(!0)}getPaintProperty(E,i){return this.style.getPaintProperty(E,i)}setLayoutProperty(E,i,d,x={}){return this.style.setLayoutProperty(E,i,d,x),this._update(!0)}getLayoutProperty(E,i){return this.style.getLayoutProperty(E,i)}setLight(E,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(E,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(E,i){return this.style.setFeatureState(E,i),this._update()}removeFeatureState(E,i){return this.style.removeFeatureState(E,i),this._update()}getFeatureState(E){return this.style.getFeatureState(E)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let E=0,i=0;return this._container&&(E=this._container.clientWidth||400,i=this._container.clientHeight||300),[E,i]}_setupContainer(){let E=this._container;E.classList.add("maplibregl-map","mapboxgl-map");let i=this._canvasContainer=N.create("div","maplibregl-canvas-container mapboxgl-canvas-container",E);this._interactive&&i.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=N.create("canvas","maplibregl-canvas mapboxgl-canvas",i),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=N.create("div","maplibregl-control-container mapboxgl-control-container",E),T=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(M=>{T[M]=N.create("div",`maplibregl-ctrl-${M} mapboxgl-ctrl-${M}`,x)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){let E=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=N.create("div","maplibregl-cooperative-gesture-screen",E);let i="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",i="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===i&&(this._metaPress=!0)}),document.addEventListener("keyup",x=>{x.key===i&&(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(E,i,d){this._canvas.width=d*E,this._canvas.height=d*i,this._canvas.style.width=`${E}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let E=s.extend({},P.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl",E)||this._canvas.getContext("experimental-webgl",E);i?(this.painter=new iu(i,this.transform),s.exported$1.testSupport(i)):this.fire(new s.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(E){E.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.Event("webglcontextlost",{originalEvent:E}))}_contextRestored(E){this._setupPainter(),this.resize(),this._update(),this.fire(new s.Event("webglcontextrestored",{originalEvent:E}))}_onMapScroll(E){if(E.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(E,i,d){return!i&&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(E){return this.style?(this._styleDirty=this._styleDirty||E,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(E){return this._update(),this._renderTaskQueue.add(E)}_cancelRenderFrame(E){this._renderTaskQueue.remove(E)}_render(E){let i,d=0,x=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=x.createQueryEXT(),x.beginQueryEXT(x.TIME_ELAPSED_EXT,i),d=s.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(E),this._removed)return;let T=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let U=this.transform.zoom,q=s.exported.now();this.style.zoomHistory.update(U,q);let W=new s.EvaluationParameters(U,{now:q,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Y=W.crossFadingFactor();Y===1&&Y===this._crossFadingFactor||(T=!0,this._crossFadingFactor=Y),this.style.update(W)}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 s.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.PerformanceUtils.mark(s.PerformanceMarkers.load),this.fire(new s.Event("load"))),this.style&&(this.style.hasTransitions()||T)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){let U=s.exported.now()-d;x.endQueryEXT(x.TIME_ELAPSED_EXT,i),setTimeout(()=>{let q=x.getQueryObjectEXT(i,x.QUERY_RESULT_EXT)/1e6;x.deleteQueryEXT(i),this.fire(new s.Event("gpu-timing-frame",{cpuTime:U,gpuTime:q}))},50)}if(this.listens("gpu-timing-layer")){let U=this.painter.collectGpuTimers();setTimeout(()=>{let q=this.painter.queryGpuTimers(U);this.fire(new s.Event("gpu-timing-layer",{layerTimes:q}))},50)}let M=this._sourcesDirty||this._styleDirty||this._placementDirty;return M||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new s.Event("idle")),!this._loaded||this._fullyLoaded||M||(this._fullyLoaded=!0,s.PerformanceUtils.mark(s.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 i of this._controls)i.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 E=this.painter.context.gl.getExtension("WEBGL_lose_context");E&&E.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),N.remove(this._canvasContainer),N.remove(this._controlContainer),this._cooperativeGestures&&N.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),s.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new s.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=s.exported.frame(E=>{s.PerformanceUtils.frame(E),this._frame=null,this._render(E)}))}_onWindowOnline(){this._update()}_onWindowResize(E){this._trackResize&&this.resize({originalEvent:E})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(E){this._showTileBoundaries!==E&&(this._showTileBoundaries=E,this._update())}get showPadding(){return!!this._showPadding}set showPadding(E){this._showPadding!==E&&(this._showPadding=E,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(E){this._showCollisionBoxes!==E&&(this._showCollisionBoxes=E,E?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(E){this._showOverdrawInspector!==E&&(this._showOverdrawInspector=E,this._update())}get repaint(){return!!this._repaint}set repaint(E){this._repaint!==E&&(this._repaint=E,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(E){this._vertices=E,this._update()}_setCacheLimits(E,i){s.setCacheLimits(E,i)}get version(){return"2.4.0"}},NavigationControl:class{constructor(E){this.options=s.extend({},No,E),this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(s.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),N.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",i=>this._map.zoomOut({},{originalEvent:i})),N.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=N.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let E=this._map.getZoom(),i=E===this._map.getMaxZoom(),d=E===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())}_rotateCompassArrow(){let E=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=E}onAdd(E){return this._map=E,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 Ur(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){N.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(E,i){let d=N.create("button",E,this._container);return d.type="button",d.addEventListener("click",i),d}_setButtonTitle(E,i){let d=this._map._getUIString(`NavigationControl.${i}`);E.title=d,E.setAttribute("aria-label",d)}},GeolocateControl:class extends s.Evented{constructor(E){super(),this.options=s.extend({},Aa,E),s.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(E){var i;return this._map=E,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),i=this._setupUI,jn!==void 0?i(jn):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{jn=d.state!=="denied",i(jn)}):(jn=!!window.navigator.geolocation,i(jn)),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(),N.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xi=0,Qo=!1}_isOutOfMapMaxBounds(E){let i=this._map.getMaxBounds(),d=E.coords;return i&&(d.longitude<i.getWest()||d.longitude>i.getEast()||d.latitude<i.getSouth()||d.latitude>i.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(E){if(this._map){if(this._isOutOfMapMaxBounds(E))return this._setErrorState(),this.fire(new s.Event("outofmaxbounds",E)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=E,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(E),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(E),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new s.Event("geolocate",E)),this._finish()}}_updateCamera(E){let i=new s.LngLat(E.coords.longitude,E.coords.latitude),d=E.coords.accuracy,x=this._map.getBearing(),T=s.extend({bearing:x},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(d),T,{geolocateSource:!0})}_updateMarker(E){if(E){let i=new s.LngLat(E.coords.longitude,E.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=E.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let E=this._map._container.clientHeight/2,i=this._map.unproject([0,E]),d=this._map.unproject([1,E]),x=i.distanceTo(d),T=Math.ceil(2*this._accuracy/x);this._circleElement.style.width=`${T}px`,this._circleElement.style.height=`${T}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(E){if(this._map){if(this.options.trackUserLocation)if(E.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 i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(E.code===3&&Qo)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 s.Event("error",E)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(E){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=N.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),N.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",E===!1){s.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=N.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Jo(this._dotElement),this._circleElement=N.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Jo({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",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.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 s.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return s.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 s.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xi--,Qo=!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 s.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 s.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 E;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),xi++,xi>1?(E={maximumAge:6e5,timeout:0},Qo=!0):(E=this.options.positionOptions,Qo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,E)}}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:ll,LogoControl:us,ScaleControl:class{constructor(E){this.options=s.extend({},ur,E),s.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){lr(this._map,this._container,this.options)}onAdd(E){return this._map=E,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",E.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){N.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(E){this.options.unit=E,lr(this._map,this._container,this.options)}},FullscreenControl:class{constructor(E){this._fullscreen=!1,E&&E.container&&(E.container instanceof HTMLElement?this._container=E.container:s.warnOnce("Full screen control 'container' must be a DOM element.")),s.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(E){return this._map=E,this._container||(this._container=this._map.getContainer()),this._controlContainer=N.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){N.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 E=this._fullscreenButton=N.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);N.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",E).setAttribute("aria-hidden","true"),E.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let E=this._getTitle();this._fullscreenButton.setAttribute("aria-label",E),this._fullscreenButton.title=E}_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(E){this.options=E,s.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(E){return this._map=E,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=N.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),N.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(){N.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 s.Evented{constructor(E){super(),this.options=s.extend(Object.create(si),E),s.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(E){return this._map&&this.remove(),this._map=E,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 s.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&N.remove(this._content),this._container&&(N.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 s.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(E){return this._lngLat=s.LngLat.convert(E),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(E){return this.setDOMContent(document.createTextNode(E))}setHTML(E){let i=document.createDocumentFragment(),d=document.createElement("body"),x;for(d.innerHTML=E;x=d.firstChild,x;)i.appendChild(x);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(E){return this.options.maxWidth=E,this._update(),this}setDOMContent(E){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=N.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(E),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(E){this._container&&this._container.classList.add(E)}removeClassName(E){this._container&&this._container.classList.remove(E)}setOffset(E){return this.options.offset=E,this._update(),this}toggleClassName(E){if(this._container)return this._container.classList.toggle(E)}_createCloseButton(){this.options.closeButton&&(this._closeButton=N.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(E){this._update(E.point)}_onMouseMove(E){this._update(E.point)}_onDrag(E){this._update(E.point)}_update(E){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=N.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=N.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(M=>this._container.classList.add(M)),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&&!E))return;let i=this._pos=this._trackPointer&&E?E:this._map.project(this._lngLat),d=this.options.anchor,x=Cn(this.options.offset);if(!d){let M=this._container.offsetWidth,U=this._container.offsetHeight,q;q=i.y+x.bottom.y<U?["top"]:i.y>this._map.transform.height-U?["bottom"]:[],i.x<M/2?q.push("left"):i.x>this._map.transform.width-M/2&&q.push("right"),d=q.length===0?"bottom":q.join("-")}let T=i.add(x[d]).round();N.setTransform(this._container,`${sr[d]} translate(${T.x}px,${T.y}px)`),cr(this._container,d,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let E=this._container.querySelector(Ii);E&&E.focus()}_onClose(){this.remove()}},Marker:Jo,Style:In,LngLat:s.LngLat,LngLatBounds:s.LngLatBounds,Point:s.pointGeometry,MercatorCoordinate:s.MercatorCoordinate,Evented:s.Evented,AJAXError:s.AJAXError,config:s.config,CanvasSource:Rr,GeoJSONSource:mr,ImageSource:Lr,RasterDEMTileSource:kt,RasterTileSource:er,VectorTileSource:Ft,VideoSource:Ar,prewarm:function(){di().acquire(Xi)},clearPrewarmedResources:function(){let E=Mi;E&&(E.isPreloaded()&&E.numActive()===1?(E.release(Xi),Mi=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 Pr.workerCount},set workerCount(E){Pr.workerCount=E},get maxParallelImageRequests(){return s.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(E){s.config.MAX_PARALLEL_IMAGE_REQUESTS=E},clearStorage(E){s.clearTileCache(E)},workerUrl:"",addProtocol(E,i){s.config.REGISTERED_PROTOCOLS[E]=i},removeProtocol(E){delete s.config.REGISTERED_PROTOCOLS[E]}};return Ji.extend(ao,{isSafari:s.isSafari,getPerformanceMetrics:s.PerformanceUtils.getPerformanceMetrics}),ao});var r=n;return r})});var a1=jf((_B,o1)=>{var EE="Expected a function",i1=NaN,TE="[object Symbol]",SE=/^\s+|\s+$/g,IE=/^[-+]0x[0-9a-f]+$/i,CE=/^0b[01]+$/i,AE=/^0o[0-7]+$/i,PE=parseInt,ME=typeof global=="object"&&global&&global.Object===Object&&global,kE=typeof self=="object"&&self&&self.Object===Object&&self,LE=ME||kE||Function("return this")(),RE=Object.prototype,zE=RE.toString,DE=Math.max,OE=Math.min,F_=function(){return LE.Date.now()};function FE(y,h,n){var u,r,s,P,z,F,V=0,N=!1,me=!1,ve=!0;if(typeof y!="function")throw new TypeError(EE);h=n1(h)||0,B_(n)&&(N=!!n.leading,me="maxWait"in n,s=me?DE(n1(n.maxWait)||0,h):s,ve="trailing"in n?!!n.trailing:ve);function Se(pt){var Tt=u,It=r;return u=r=void 0,V=pt,P=y.apply(It,Tt),P}function Ue(pt){return V=pt,z=setTimeout(Ne,h),N?Se(pt):P}function et(pt){var Tt=pt-F,It=pt-V,Pt=h-Tt;return me?OE(Pt,s-It):Pt}function Ie(pt){var Tt=pt-F,It=pt-V;return F===void 0||Tt>=h||Tt<0||me&&It>=s}function Ne(){var pt=F_();if(Ie(pt))return He(pt);z=setTimeout(Ne,et(pt))}function He(pt){return z=void 0,ve&&u?Se(pt):(u=r=void 0,P)}function nt(){z!==void 0&&clearTimeout(z),V=0,u=F=r=z=void 0}function mt(){return z===void 0?P:He(F_())}function ht(){var pt=F_(),Tt=Ie(pt);if(u=arguments,r=this,F=pt,Tt){if(z===void 0)return Ue(F);if(me)return z=setTimeout(Ne,h),Se(F)}return z===void 0&&(z=setTimeout(Ne,h)),P}return ht.cancel=nt,ht.flush=mt,ht}function B_(y){var h=typeof y;return!!y&&(h=="object"||h=="function")}function BE(y){return!!y&&typeof y=="object"}function UE(y){return typeof y=="symbol"||BE(y)&&zE.call(y)==TE}function n1(y){if(typeof y=="number")return y;if(UE(y))return i1;if(B_(y)){var h=typeof y.valueOf=="function"?y.valueOf():y;y=B_(h)?h+"":h}if(typeof y!="string")return y===0?y:+y;y=y.replace(SE,"");var n=CE.test(y);return n||AE.test(y)?PE(y.slice(2),n?2:8):IE.test(y)?i1:+y}o1.exports=FE});var h1=jf((vB,c1)=>{var u1="Expected a function",s1=NaN,NE="[object Symbol]",VE=/^\s+|\s+$/g,GE=/^[-+]0x[0-9a-f]+$/i,jE=/^0b[01]+$/i,qE=/^0o[0-7]+$/i,ZE=parseInt,XE=typeof global=="object"&&global&&global.Object===Object&&global,WE=typeof self=="object"&&self&&self.Object===Object&&self,$E=XE||WE||Function("return this")(),KE=Object.prototype,HE=KE.toString,YE=Math.max,JE=Math.min,U_=function(){return $E.Date.now()};function QE(y,h,n){var u,r,s,P,z,F,V=0,N=!1,me=!1,ve=!0;if(typeof y!="function")throw new TypeError(u1);h=l1(h)||0,dg(n)&&(N=!!n.leading,me="maxWait"in n,s=me?YE(l1(n.maxWait)||0,h):s,ve="trailing"in n?!!n.trailing:ve);function Se(pt){var Tt=u,It=r;return u=r=void 0,V=pt,P=y.apply(It,Tt),P}function Ue(pt){return V=pt,z=setTimeout(Ne,h),N?Se(pt):P}function et(pt){var Tt=pt-F,It=pt-V,Pt=h-Tt;return me?JE(Pt,s-It):Pt}function Ie(pt){var Tt=pt-F,It=pt-V;return F===void 0||Tt>=h||Tt<0||me&&It>=s}function Ne(){var pt=U_();if(Ie(pt))return He(pt);z=setTimeout(Ne,et(pt))}function He(pt){return z=void 0,ve&&u?Se(pt):(u=r=void 0,P)}function nt(){z!==void 0&&clearTimeout(z),V=0,u=F=r=z=void 0}function mt(){return z===void 0?P:He(U_())}function ht(){var pt=U_(),Tt=Ie(pt);if(u=arguments,r=this,F=pt,Tt){if(z===void 0)return Ue(F);if(me)return z=setTimeout(Ne,h),Se(F)}return z===void 0&&(z=setTimeout(Ne,h)),P}return ht.cancel=nt,ht.flush=mt,ht}function eT(y,h,n){var u=!0,r=!0;if(typeof y!="function")throw new TypeError(u1);return dg(n)&&(u="leading"in n?!!n.leading:u,r="trailing"in n?!!n.trailing:r),QE(y,h,{leading:u,maxWait:h,trailing:r})}function dg(y){var h=typeof y;return!!y&&(h=="object"||h=="function")}function tT(y){return!!y&&typeof y=="object"}function rT(y){return typeof y=="symbol"||tT(y)&&HE.call(y)==NE}function l1(y){if(typeof y=="number")return y;if(rT(y))return s1;if(dg(y)){var h=typeof y.valueOf=="function"?y.valueOf():y;y=dg(h)?h+"":h}if(typeof y!="string")return y===0?y:+y;y=y.replace(VE,"");var n=jE.test(y);return n||qE.test(y)?ZE(y.slice(2),n?2:8):GE.test(y)?s1:+y}c1.exports=eT});var yg={};oy(yg,{CopyrightControl:()=>Fx,Layer:()=>Is,MapboxLayer:()=>op,MapboxStyleLayer:()=>r1,MaplibreLayer:()=>ap,RealtimeAPI:()=>Wf,RealtimeLayer:()=>f1,RealtimeModes:()=>qo,RoutingAPI:()=>qf,RoutingControl:()=>$0,RoutingLayer:()=>hg,StopFinderControl:()=>H0,StopsAPI:()=>Zf,VectorLayer:()=>d1,WMSLayer:()=>m1,compareDepartures:()=>pd,createRealtimeFilters:()=>cy,debounceDeparturesMessages:()=>Oy,debounceWebsocketMessages:()=>Xf,fullTrajectoryDelayStyle:()=>p1,fullTrajectoryStyle:()=>gg,getCircleCanvas:()=>qy,getDelayBgCanvas:()=>Gy,getDelayTextCanvas:()=>jy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>ac,getMapboxRender:()=>rf,getMaplibreRender:()=>tf,getTextCanvas:()=>Zy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Xh,pad:()=>Rm,realtimeConfig:()=>nf,realtimeDefaultStyle:()=>Yh,realtimeDelayStyle:()=>Xy,realtimeSimpleStyle:()=>Wy,removeDuplicate:()=>Wh,renderTrajectories:()=>hd,sortAndFilterDepartures:()=>fd,sortByDelay:()=>hy});var $1=function(){function y(h){this.propagationStopped,this.defaultPrevented,this.type=h,this.target=null}return y.prototype.preventDefault=function(){this.defaultPrevented=!0},y.prototype.stopPropagation=function(){this.propagationStopped=!0},y}();var ln=$1;var qp={PROPERTYCHANGE:"propertychange"};var K1=function(){function y(){this.disposed=!1}return y.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},y.prototype.disposeInternal=function(){},y}(),yv=K1;function _v(y,h,n){for(var u,r,s=n||rh,P=0,z=y.length,F=!1;P<z;)u=P+(z-P>>1),r=+s(y[u],h),r<0?P=u+1:(z=u,F=!r);return F?P:~P}function rh(y,h){return y>h?1:y<h?-1:0}function vv(y,h){return y.indexOf(h)>=0}function xv(y,h,n){for(;h<n;){var u=y[h];y[h]=y[n],y[n]=u,++h,--n}}function Ka(y,h){for(var n=Array.isArray(h)?h:[h],u=n.length,r=0;r<u;r++)y[y.length]=n[r]}function _s(y,h){var n=y.length;if(n!==h.length)return!1;for(var u=0;u<n;u++)if(y[u]!==h[u])return!1;return!0}function Cm(){return!0}function Zh(){}function bv(y){var h=!1,n,u,r;return function(){var s=Array.prototype.slice.call(arguments);return(!h||this!==r||!_s(s,u))&&(h=!0,r=this,u=s,n=y.apply(this,arguments)),n}}var Ra=typeof Object.assign=="function"?Object.assign:function(y,h){if(y==null)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(y),u=1,r=arguments.length;u<r;++u){var s=arguments[u];if(s!=null)for(var P in s)s.hasOwnProperty(P)&&(n[P]=s[P])}return n};function ih(y){for(var h in y)delete y[h]}var Am=typeof Object.values=="function"?Object.values:function(y){var h=[];for(var n in y)h.push(y[n]);return h};function Vl(y){var h;for(h in y)return!1;return!h}var H1=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y1=function(y){H1(h,y);function h(n){var u=y.call(this)||this;return u.eventTarget_=n,u.pendingRemovals_=null,u.dispatching_=null,u.listeners_=null,u}return h.prototype.addEventListener=function(n,u){if(!(!n||!u)){var r=this.listeners_||(this.listeners_={}),s=r[n]||(r[n]=[]);s.indexOf(u)===-1&&s.push(u)}},h.prototype.dispatchEvent=function(n){var u=typeof n=="string",r=u?n:n.type,s=this.listeners_&&this.listeners_[r];if(!!s){var P=u?new ln(n):n;P.target||(P.target=this.eventTarget_||this);var z=this.dispatching_||(this.dispatching_={}),F=this.pendingRemovals_||(this.pendingRemovals_={});r in z||(z[r]=0,F[r]=0),++z[r];for(var V,N=0,me=s.length;N<me;++N)if("handleEvent"in s[N]?V=s[N].handleEvent(P):V=s[N].call(this,P),V===!1||P.propagationStopped){V=!1;break}if(--z[r]===0){var ve=F[r];for(delete F[r];ve--;)this.removeEventListener(r,Zh);delete z[r]}return V}},h.prototype.disposeInternal=function(){this.listeners_&&ih(this.listeners_)},h.prototype.getListeners=function(n){return this.listeners_&&this.listeners_[n]||void 0},h.prototype.hasListener=function(n){return this.listeners_?n?n in this.listeners_:Object.keys(this.listeners_).length>0:!1},h.prototype.removeEventListener=function(n,u){var r=this.listeners_&&this.listeners_[n];if(r){var s=r.indexOf(u);s!==-1&&(this.pendingRemovals_&&n in this.pendingRemovals_?(r[s]=Zh,++this.pendingRemovals_[n]):(r.splice(s,1),r.length===0&&delete this.listeners_[n]))}},h}(yv),nh=Y1;var en={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 lo(y,h,n,u,r){if(u&&u!==y&&(n=n.bind(u)),r){var s=n;n=function(){y.removeEventListener(h,n),s.apply(this,arguments)}}var P={target:y,type:h,listener:n};return y.addEventListener(h,n),P}function Zp(y,h,n,u){return lo(y,h,n,u,!0)}function Mo(y){y&&y.target&&(y.target.removeEventListener(y.type,y.listener),ih(y))}var J1=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Pm=function(y){J1(h,y);function h(){var n=y.call(this)||this;return n.on=n.onInternal,n.once=n.onceInternal,n.un=n.unInternal,n.revision_=0,n}return h.prototype.changed=function(){++this.revision_,this.dispatchEvent(en.CHANGE)},h.prototype.getRevision=function(){return this.revision_},h.prototype.onInternal=function(n,u){if(Array.isArray(n)){for(var r=n.length,s=new Array(r),P=0;P<r;++P)s[P]=lo(this,n[P],u);return s}else return lo(this,n,u)},h.prototype.onceInternal=function(n,u){var r;if(Array.isArray(n)){var s=n.length;r=new Array(s);for(var P=0;P<s;++P)r[P]=Zp(this,n[P],u)}else r=Zp(this,n,u);return u.ol_key=r,r},h.prototype.unInternal=function(n,u){var r=u.ol_key;if(r)Ha(r);else if(Array.isArray(n))for(var s=0,P=n.length;s<P;++s)this.removeEventListener(n[s],u);else this.removeEventListener(n,u)},h}(nh);Pm.prototype.on;Pm.prototype.once;Pm.prototype.un;function Ha(y){if(Array.isArray(y))for(var h=0,n=y.length;h<n;++h)Mo(y[h]);else Mo(y)}var Mm=Pm;function jr(){return function(){throw new Error("Unimplemented abstract method.")}()}var Q1=0;function Pi(y){return y.ol_uid||(y.ol_uid=String(++Q1))}var km="6.14.1";var Ev=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),wv=function(y){Ev(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.key=u,s.oldValue=r,s}return h}(ln);var eb=function(y){Ev(h,y);function h(n){var u=y.call(this)||this;return u.on,u.once,u.un,Pi(u),u.values_=null,n!==void 0&&u.setProperties(n),u}return h.prototype.get=function(n){var u;return this.values_&&this.values_.hasOwnProperty(n)&&(u=this.values_[n]),u},h.prototype.getKeys=function(){return this.values_&&Object.keys(this.values_)||[]},h.prototype.getProperties=function(){return this.values_&&Ra({},this.values_)||{}},h.prototype.hasProperties=function(){return!!this.values_},h.prototype.notify=function(n,u){var r;r="change:".concat(n),this.hasListener(r)&&this.dispatchEvent(new wv(r,n,u)),r=qp.PROPERTYCHANGE,this.hasListener(r)&&this.dispatchEvent(new wv(r,n,u))},h.prototype.addChangeListener=function(n,u){this.addEventListener("change:".concat(n),u)},h.prototype.removeChangeListener=function(n,u){this.removeEventListener("change:".concat(n),u)},h.prototype.set=function(n,u,r){var s=this.values_||(this.values_={});if(r)s[n]=u;else{var P=s[n];s[n]=u,P!==u&&this.notify(n,P)}},h.prototype.setProperties=function(n,u){for(var r in n)this.set(r,n[r],u)},h.prototype.applyProperties=function(n){!n.values_||Ra(this.values_||(this.values_={}),n.values_)},h.prototype.unset=function(n,u){if(this.values_&&n in this.values_){var r=this.values_[n];delete this.values_[n],Vl(this.values_)&&(this.values_=null),u||this.notify(n,r)}},h}(Mm),ko=eb;var tb=(y,h)=>{let n=new URL(y);return Object.entries(h||{}).forEach(([r,s])=>{s!=null&&n.searchParams.set(r,s)}),n},Xh=tb;var ay=class extends ko{constructor(n){super();this.url=n.url,this.apiKey=n.apiKey}fetch(n,u,r){if(!this.url)return Promise.reject(new Error(`No url defined for request to ${this.url}/${n}`));if(!this.url&&!this.apiKey&&!/key=/.test(this.url))return Promise.reject(new Error(`No apiKey defined for request to ${this.url}`));let s=u||{},P=Xh(`${this.url}${n||""}`,{key:this.apiKey,...s});return fetch(P.toString(),r).then(z=>{try{return z.json().then(F=>{if(F.error)throw new Error(F.error);return F})}catch(F){return Promise.reject(new Error(F))}})}},Lm=ay;var sy=class extends Lm{constructor(h={}){super({url:"https://api.geops.io/routing/v1/",...h})}route(h,n){return this.fetch("",h,n)}},qf=sy;var ly=class extends Lm{constructor(h={}){super({url:"https://api.geops.io/stops/v1/",...h})}search(h,n){return this.fetch("",h,n)}},Zf=ly;var Xp=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(h,n={}){let u=`${h} ${n.channel}`;return u+=n.args?` ${n.args}`:"",u+=n.id?` ${n.id}`:"",u.trim()}connect(h,n=()=>{}){if(this.websocket&&!this.closed){if(!this.closing&&this.websocket.url!==h)this.websocket.close();else if(this.connecting)return}this.websocket=new WebSocket(h),this.open?(n(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{n(),this.subscribePreviousSubscriptions()})}close(){this.websocket&&(this.open||this.connecting)&&(this.websocket.onclose=()=>{},this.websocket.close(),this.messagesOnOpen=[])}send(h){if(!this.websocket)return;let n=()=>{this.websocket?.send(h)};this.open?this.messagesOnOpen.includes(h)||n():this.messagesOnOpen.includes(h)||(this.messagesOnOpen.push(h),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],n()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}addEvents(h,n){this.websocket&&(this.websocket.addEventListener("message",h),n&&(this.websocket.addEventListener("error",n),this.websocket.addEventListener("close",n)))}removeEvents(h,n){this.websocket&&(this.websocket.removeEventListener("message",h),n&&(this.websocket.removeEventListener("error",n),this.websocket.removeEventListener("close",n)))}listen(h,n,u){this.unlisten(h,n);let r=s=>{let P;try{P=JSON.parse(s.data)}catch(V){console.error("WebSocket: unable to parse JSON data",V,s.data);return}let z=h.channel;z+=h.args?` ${h.args}`:"";let F;P.source==="buffer"?F=P.content:F=[P],F.forEach(V=>{V?.source===z&&(!h.id||h.id===P.client_reference)&&n(V)})};return this.addEvents(r,u),{onMessageCb:r,onErrorCb:u}}unlisten(h,n){[...this.subscriptions||[],...this.requests||[]].filter(u=>u.params.channel===h.channel&&(!n||u.cb===n)).forEach(({onMessageCb:u,onErrorCb:r})=>{this.removeEvents(u,r)})}get(h,n,u){let r=Xp.getRequestString("GET",h);this.send(r);let s=N=>(...me)=>{N(...me);let ve=this.requests.findIndex(et=>r===et.requestString&&n===et.cb),{onMessageCb:Se,onErrorCb:Ue}=this.requests[ve];this.removeEvents(Se,Ue),this.requests.splice(ve,1)},{onMessageCb:P,onErrorCb:z}=this.listen(h,s(n),u&&s(u));this.requests||(this.requests=[]);let F=this.requests.findIndex(N=>r===N.requestString&&n===N.cb),V={params:h,requestString:r,cb:n,errorCb:u,onMessageCb:P,onErrorCb:z};F>-1?this.requests[F]=V:this.requests.push(V)}subscribe(h,n,u,r=!1){let{onMessageCb:s,onErrorCb:P}=this.listen(h,n,u),z=Xp.getRequestString("",h),F=this.subscriptions.findIndex(N=>h.channel===N.params.channel&&n===N.cb),V={params:h,cb:n,errorCb:u,onMessageCb:s,onErrorCb:P,quiet:r};F>-1?this.subscriptions[F]=V:this.subscriptions.push(V),this.subscribed[z]||(V.quiet||(this.send(`GET ${z}`),this.send(`SUB ${z}`)),this.subscribed[z]=!0)}unsubscribe(h,n){let u=this.subscriptions.filter(r=>r.params.channel===h&&(!n||r.cb===n));u.forEach(({onMessageCb:r,onErrorCb:s})=>{this.removeEvents(r,s)}),this.subscriptions=this.subscriptions.filter(r=>r.params.channel!==h||n&&r.cb!==n),h&&this.subscribed[h]&&!this.subscriptions.find(r=>r.params.channel===h)&&u.find(r=>!r.quiet)&&(this.send(`DEL ${h}`),this.subscribed[h]=!1)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(h=>{this.subscribed[h]=!1}),[...this.subscriptions].forEach(h=>{this.subscribe(h.params,h.cb,h.errorCb,h.quiet)})}},Tv=Xp;var rb=(y,h,n=100)=>{let u={},r={},s=[];return P=>{let{source:z,content:F}=P;u[z]&&window.clearTimeout(u[z]),h?r[h(F)]=F:s.push(F),u[z]=window.setTimeout(()=>{let V=h?Object.values(r):s;y(V)},n)}},Xf=rb;var ib=(y,h)=>y===h.SCHEMATIC?"_schematic":"",bu=ib;var qo={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},uy=class{constructor(h={}){this.defineProperties(h),this.prefix=h.prefix||"",this.onOpen=this.onOpen.bind(this)}defineProperties(h){let n=h;typeof h=="string"&&(n={url:h});let{apiKey:u}=n,{url:r,projection:s,bbox:P,buffer:z=[100,100]}=n,F=new Tv;r||(r="wss://api.geops.io/tracker-ws/v1/"),u&&(r=`${r}?key=${u}`),Object.defineProperties(this,{url:{get:()=>r,set:V=>{r=V,this.open()}},projection:{get:()=>s,set:V=>{V!==s&&(s=V,this.wsApi&&this.wsApi.send(`PROJECTION ${s}`))}},bbox:{get:()=>P,set:V=>{JSON.stringify(V)!==JSON.stringify(P)&&(P=V,this.wsApi&&P&&this.wsApi.send(`BBOX ${P.join(" ")}`))}},buffer:{get:()=>z,set:V=>{JSON.stringify(V)!==JSON.stringify(z)&&(z=V,this.wsApi&&this.wsApi.send(`BUFFER ${z.join(" ")}`))}},wsApi:{value:F,writable:!0},pingIntervalMs:{value:h.pingIntervalMs||1e4,writable:!0},reconnectTimeoutMs:{value:h.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(h,n,u=()=>{},r=!1){!h||!n||this.wsApi.subscribe({channel:h},n,u,r)}unsubscribe(h,n="",u){let r=bu(qo.SCHEMATIC,qo),s=bu(qo.TOPOGRAPHIC,qo);this.wsApi.unsubscribe(`${h}${r}${n||""}`,u),this.wsApi.unsubscribe(`${h}${s}${n||""}`,u)}subscribeDepartures(h,n,u=()=>{},r=!1){this.subscribe(`timetable_${h}`,n,u,r)}unsubscribeDepartures(h,n){this.unsubscribe(`timetable_${h}`,"",n)}subscribeDisruptions(h,n=()=>{},u=!1){this.subscribe(`${this.prefix}newsticker`,h,n,u)}unsubscribeDisruptions(h){this.unsubscribe(`${this.prefix}newsticker`,"",h)}getStation(h,n){let u={channel:`station${bu(n,qo)}`,args:h};return new Promise((r,s)=>{this.wsApi.get(u,r,s)})}getStations(h,n=100){return new Promise(u=>{this.wsApi.get({channel:`station${bu(h,qo)}`},Xf(u,void 0,n))})}subscribeStations(h,n,u=()=>{},r=!1){this.subscribe(`station${bu(h,qo)}`,n,u,r)}unsubscribeStations(h){this.unsubscribe("station","",h)}subscribeExtraGeoms(h,n=()=>{},u=!1){this.subscribe("extra_geoms",h,n,u)}unsubscribeExtraGeoms(h){this.unsubscribe("extra_geoms","",h)}subscribeTrajectory(h,n,u=()=>{},r=!1){this.unsubscribeTrajectory(n),this.subscribe(`trajectory${bu(h,qo)}`,n,u,r)}unsubscribeTrajectory(h){this.unsubscribe("trajectory","",h)}subscribeDeletedVehicles(h,n,u=()=>{},r=!1){this.unsubscribeDeletedVehicles(n),this.subscribe(`deleted_vehicles${bu(h,qo)}`,n,u,r)}unsubscribeDeletedVehicles(h){this.unsubscribe("deleted_vehicles","",h)}getFullTrajectory(h,n,u){let r=[`full_trajectory${bu(n,qo)}`];h&&r.push(h),(!n||n===qo.TOPOGRAPHIC)&&u&&r.push(`gen${u}`);let s={channel:r.join("_")};return new Promise((P,z)=>{this.wsApi.get(s,P,z)})}subscribeFullTrajectory(h,n,u,r=()=>{},s=!1){this.subscribe(`full_trajectory${bu(n,qo)}_${h}`,u,r,s)}unsubscribeFullTrajectory(h,n){this.unsubscribe("full_trajectory",`_${h}`,n)}getStopSequence(h){return new Promise((n,u)=>{this.wsApi.get({channel:`stopsequence_${h}`},n,u)})}subscribeStopSequence(h,n,u=()=>{},r=!1){this.subscribe(`stopsequence_${h}`,n,u,r)}unsubscribeStopSequence(h,n){this.unsubscribe("stopsequence",`_${h}`,n)}subscribeHealthCheck(h,n=()=>{},u=!1){this.subscribe("healthcheck",h,n,u)}unsubscribeHealthCheck(h){this.unsubscribe("healthcheck","",h)}},Wf=uy;var nb=y=>{let h=y.filter(s=>s!=null&&s.trim&&s.trim()),n=h.map(s=>s.toLowerCase());return[...new Set(n)].map(s=>h.find(P=>P.toLowerCase()===s))},Wh=nb;var ob=y=>{if(!y)return[];let{style:h}=y;if(!h)return[];let{sourceCaches:n}=h,u=[];return Object.values(n).forEach(r=>{if(r.used){let s=r.getSource(),P=s.attribution||s.options&&s.options.attribution;P&&(u=u.concat(P.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),Wh(u)},ac=ob;var ab=(y,h,n,u)=>{let r=[];if(!y&&!h&&!n&&!u)return null;if(u){let s=typeof u=="string"?[u]:u,P=z=>{let F=z.properties.name||z.properties.line&&z.properties.line.name||"";return F?s.some(V=>new RegExp(V,"i").test(F)):!1};r.push(P)}if(y){let P=(typeof y=="string"?y.split(","):y).map(F=>F.replace(/\s+/g,"").toUpperCase()),z=F=>{let{line:V,name:N}=F.properties,me=(N||V&&V.name||"").toUpperCase();return me?P.includes(me):!1};r.push(z)}if(h){let P=(typeof h=="string"?h.split(","):h).map(F=>parseInt(F,10)),z=F=>{let V=F.properties.route_identifier||F.properties.routeIdentifier||"",N=parseInt(V.split(".")[0],10);return P.includes(N)};r.push(z)}if(n){let s=typeof n=="string"?[n]:n,P=z=>s.some(F=>{let V=z.properties.operator||z.properties.tenant||"";return new RegExp(F,"i").test(V)});r.push(P)}return r.length?s=>{for(let P=0;P<r.length;P+=1)if(!r[P](s))return!1;return!0}:null},cy=ab;var Sv=y=>{let h=y;Array.isArray(h)||(h=[y]);let n=[];return h.forEach(u=>{n.push(u);let{children:r}=u;n=n.concat(Sv(r||[]))}),n},$f=Sv;var Iv=(y=new Date)=>{let h=(y.getUTCMonth()+1).toString();h=h.length===1?`0${h}`:h;let n=y.getUTCDate().toString();return n=n.length===1?`0${n}`:n,[y.getUTCFullYear(),h,n].join("")},Cv=y=>[y.getUTCHours(),y.getUTCMinutes(),`${y.getUTCSeconds()}.${y.getUTCMilliseconds()}`].join(":"),Rm=y=>y<10?`0${y}`:`${y}`,Av=y=>{if(!y||y<=0)return"";let h=new Date(y);return`${Rm(h.getHours())}:${Rm(h.getMinutes())}`};var sb=(y,h)=>{let n=y.properties,u=h.properties;return n.delay===null&&u.delay!==null?1:u.delay===null&&n.delay!==null?-1:n.cancelled&&!u.cancelled?u.delay<18e4?-1:1:u.cancelled&&!n.cancelled?n.delay<18e4?1:-1:u.delay-n.delay},hy=sb;var oh=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",TS=oh.indexOf("firefox")!==-1,lb=oh.indexOf("safari")!==-1&&oh.indexOf("chrom")==-1,SS=lb&&!!(oh.indexOf("version/15.4")>=0||oh.match(/cpu (os|iphone os) 15_4 like mac os x/)),IS=oh.indexOf("webkit")!==-1&&oh.indexOf("edge")==-1,CS=oh.indexOf("macintosh")!==-1;var ah=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Pv=typeof Image<"u"&&Image.prototype.decode,AS=function(){var y=!1;try{var h=Object.defineProperty({},"passive",{get:function(){y=!0}});window.addEventListener("_",null,h),window.removeEventListener("_",null,h)}catch{}return y}();var ub=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),cb=function(y){ub(h,y);function h(n){var u=this,r=km==="latest"?km:"v"+km.split("-")[0],s="Assertion failed. See https://openlayers.org/en/"+r+"/doc/errors/#"+n+" for details.";return u=y.call(this,s)||this,u.code=n,u.name="AssertionError",u.message=s,u}return h}(Error),zm=cb;function En(y,h){if(!y)throw new zm(h)}var OS=new Array(6);function za(){return[1,0,0,1,0,0]}function hb(y,h,n,u,r,s,P){return y[0]=h,y[1]=n,y[2]=u,y[3]=r,y[4]=s,y[5]=P,y}function kv(y,h){return y[0]=h[0],y[1]=h[1],y[2]=h[2],y[3]=h[3],y[4]=h[4],y[5]=h[5],y}function bo(y,h){var n=h[0],u=h[1];return h[0]=y[0]*n+y[2]*u+y[4],h[1]=y[1]*n+y[3]*u+y[5],h}function Lv(y,h,n){return hb(y,h,0,0,n,0,0)}function vs(y,h,n,u,r,s,P,z){var F=Math.sin(s),V=Math.cos(s);return y[0]=u*V,y[1]=r*F,y[2]=-u*F,y[3]=r*V,y[4]=P*u*V-z*u*F+h,y[5]=P*r*F+z*r*V+n,y}function Rv(y,h,n,u,r,s,P){return py(vs(za(),y,h,n,u,r,s,P))}function zv(y,h){var n=pb(h);En(n!==0,32);var u=h[0],r=h[1],s=h[2],P=h[3],z=h[4],F=h[5];return y[0]=P/n,y[1]=-r/n,y[2]=-s/n,y[3]=u/n,y[4]=(s*F-P*z)/n,y[5]=-(u*F-r*z)/n,y}function pb(y){return y[0]*y[3]-y[1]*y[2]}var Mv;function py(y){var h="matrix("+y.join(", ")+")";if(ah)return h;var n=Mv||(Mv=document.createElement("div"));return n.style.transform=h,n.style.transform}var Ot={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"};var Gl={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},US={9001:Gl.METERS,9002:Gl.FEET,9003:Gl.USFEET,9101:Gl.RADIANS,9102:Gl.DEGREES};var wu={};wu[Gl.RADIANS]=6370997/(2*Math.PI);wu[Gl.DEGREES]=2*Math.PI*6370997/360;wu[Gl.FEET]=.3048;wu[Gl.METERS]=1;wu[Gl.USFEET]=1200/3937;var sc=Gl;var Lo={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Eu(y){for(var h=Ya(),n=0,u=y.length;n<u;++n)fy(h,y[n]);return h}function fb(y,h,n){var u=Math.min.apply(null,y),r=Math.min.apply(null,h),s=Math.max.apply(null,y),P=Math.max.apply(null,h);return sh(u,r,s,P,n)}function gl(y,h,n){return n?(n[0]=y[0]-h,n[1]=y[1]-h,n[2]=y[2]+h,n[3]=y[3]+h,n):[y[0]-h,y[1]-h,y[2]+h,y[3]+h]}function Dv(y,h){return h?(h[0]=y[0],h[1]=y[1],h[2]=y[2],h[3]=y[3],h):y.slice()}function xs(y,h,n){var u,r;return h<y[0]?u=y[0]-h:y[2]<h?u=h-y[2]:u=0,n<y[1]?r=y[1]-n:y[3]<n?r=n-y[3]:r=0,u*u+r*r}function Wp(y,h){return Kf(y,h[0],h[1])}function lc(y,h){return y[0]<=h[0]&&h[2]<=y[2]&&y[1]<=h[1]&&h[3]<=y[3]}function Kf(y,h,n){return y[0]<=h&&h<=y[2]&&y[1]<=n&&n<=y[3]}function Dm(y,h){var n=y[0],u=y[1],r=y[2],s=y[3],P=h[0],z=h[1],F=Lo.UNKNOWN;return P<n?F=F|Lo.LEFT:P>r&&(F=F|Lo.RIGHT),z<u?F=F|Lo.BELOW:z>s&&(F=F|Lo.ABOVE),F===Lo.UNKNOWN&&(F=Lo.INTERSECTING),F}function Ya(){return[1/0,1/0,-1/0,-1/0]}function sh(y,h,n,u,r){return r?(r[0]=y,r[1]=h,r[2]=n,r[3]=u,r):[y,h,n,u]}function $p(y){return sh(1/0,1/0,-1/0,-1/0,y)}function Kp(y,h){var n=y[0],u=y[1];return sh(n,u,n,u,h)}function Om(y,h,n,u,r){var s=$p(r);return dy(s,y,h,n,u)}function Fm(y,h){return y[0]==h[0]&&y[2]==h[2]&&y[1]==h[1]&&y[3]==h[3]}function Ov(y,h){return h[0]<y[0]&&(y[0]=h[0]),h[2]>y[2]&&(y[2]=h[2]),h[1]<y[1]&&(y[1]=h[1]),h[3]>y[3]&&(y[3]=h[3]),y}function fy(y,h){h[0]<y[0]&&(y[0]=h[0]),h[0]>y[2]&&(y[2]=h[0]),h[1]<y[1]&&(y[1]=h[1]),h[1]>y[3]&&(y[3]=h[1])}function dy(y,h,n,u,r){for(;n<u;n+=r)db(y,h[n],h[n+1]);return y}function db(y,h,n){y[0]=Math.min(y[0],h),y[1]=Math.min(y[1],n),y[2]=Math.max(y[2],h),y[3]=Math.max(y[3],n)}function Fv(y,h){var n;return n=h(my(y)),n||(n=h(gy(y)),n)||(n=h(_y(y)),n)||(n=h(yy(y)),n)?n:!1}function my(y){return[y[0],y[1]]}function gy(y){return[y[2],y[1]]}function $h(y){return[(y[0]+y[2])/2,(y[1]+y[3])/2]}function Tu(y){return y[3]-y[1]}function Bv(y,h,n){var u=n||Ya();return Ro(y,h)?(y[0]>h[0]?u[0]=y[0]:u[0]=h[0],y[1]>h[1]?u[1]=y[1]:u[1]=h[1],y[2]<h[2]?u[2]=y[2]:u[2]=h[2],y[3]<h[3]?u[3]=y[3]:u[3]=h[3]):$p(u),u}function yy(y){return[y[0],y[3]]}function _y(y){return[y[2],y[3]]}function bs(y){return y[2]-y[0]}function Ro(y,h){return y[0]<=h[2]&&y[2]>=h[0]&&y[1]<=h[3]&&y[3]>=h[1]}function Uv(y,h){return h?(h[0]=y[0],h[1]=y[1],h[2]=y[2],h[3]=y[3],h):y}function Nv(y,h,n){var u=!1,r=Dm(y,h),s=Dm(y,n);if(r===Lo.INTERSECTING||s===Lo.INTERSECTING)u=!0;else{var P=y[0],z=y[1],F=y[2],V=y[3],N=h[0],me=h[1],ve=n[0],Se=n[1],Ue=(Se-me)/(ve-N),et=void 0,Ie=void 0;!!(s&Lo.ABOVE)&&!(r&Lo.ABOVE)&&(et=ve-(Se-V)/Ue,u=et>=P&&et<=F),!u&&!!(s&Lo.RIGHT)&&!(r&Lo.RIGHT)&&(Ie=Se-(ve-F)*Ue,u=Ie>=z&&Ie<=V),!u&&!!(s&Lo.BELOW)&&!(r&Lo.BELOW)&&(et=ve-(Se-z)/Ue,u=et>=P&&et<=F),!u&&!!(s&Lo.LEFT)&&!(r&Lo.LEFT)&&(Ie=Se-(ve-P)*Ue,u=Ie>=z&&Ie<=V)}return u}function Vv(y,h,n,u){var r=[];if(u>1)for(var s=y[2]-y[0],P=y[3]-y[1],z=0;z<u;++z)r.push(y[0]+s*z/u,y[1],y[2],y[1]+P*z/u,y[2]-s*z/u,y[3],y[0],y[3]-P*z/u);else r=[y[0],y[1],y[2],y[1],y[2],y[3],y[0],y[3]];h(r,r,2);for(var F=[],V=[],z=0,N=r.length;z<N;z+=2)F.push(r[z]),V.push(r[z+1]);return fb(F,V,n)}function Gv(y,h){var n=h.getExtent(),u=$h(y);if(h.canWrapX()&&(u[0]<n[0]||u[0]>=n[2])){var r=bs(n),s=Math.floor((u[0]-n[0])/r),P=s*r;y[0]-=P,y[2]-=P}return y}var mb=function(){function y(h){this.code_=h.code,this.units_=h.units,this.extent_=h.extent!==void 0?h.extent:null,this.worldExtent_=h.worldExtent!==void 0?h.worldExtent:null,this.axisOrientation_=h.axisOrientation!==void 0?h.axisOrientation:"enu",this.global_=h.global!==void 0?h.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=h.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=h.metersPerUnit}return y.prototype.canWrapX=function(){return this.canWrapX_},y.prototype.getCode=function(){return this.code_},y.prototype.getExtent=function(){return this.extent_},y.prototype.getUnits=function(){return this.units_},y.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||wu[this.units_]},y.prototype.getWorldExtent=function(){return this.worldExtent_},y.prototype.getAxisOrientation=function(){return this.axisOrientation_},y.prototype.isGlobal=function(){return this.global_},y.prototype.setGlobal=function(h){this.global_=h,this.canWrapX_=!!(h&&this.extent_)},y.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},y.prototype.setDefaultTileGrid=function(h){this.defaultTileGrid_=h},y.prototype.setExtent=function(h){this.extent_=h,this.canWrapX_=!!(this.global_&&h)},y.prototype.setWorldExtent=function(h){this.worldExtent_=h},y.prototype.setGetPointResolution=function(h){this.getPointResolutionFunc_=h},y.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},y}(),Bm=mb;function jl(y,h,n){return Math.min(Math.max(y,h),n)}var jv=function(){var y;return"cosh"in Math?y=Math.cosh:y=function(h){var n=Math.exp(h);return(n+1/n)/2},y}(),XS=function(){var y;return"log2"in Math?y=Math.log2:y=function(h){return Math.log(h)*Math.LOG2E},y}();function qv(y,h,n,u,r,s){var P=r-n,z=s-u;if(P!==0||z!==0){var F=((y-n)*P+(h-u)*z)/(P*P+z*z);F>1?(n=r,u=s):F>0&&(n+=P*F,u+=z*F)}return ql(y,h,n,u)}function ql(y,h,n,u){var r=n-y,s=u-h;return r*r+s*s}function Zv(y){return y*180/Math.PI}function Um(y,h){var n=y%h;return n*h<0?n+h:n}function yl(y,h,n){return y+n*(h-y)}var gb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Hf=6378137,Yp=Math.PI*Hf,yb=[-Yp,-Yp,Yp,Yp],_b=[-180,-85,180,85],Nm=Hf*Math.log(Math.tan(Math.PI/2)),Hp=function(y){gb(h,y);function h(n){return y.call(this,{code:n,units:sc.METERS,extent:yb,global:!0,worldExtent:_b,getPointResolution:function(u,r){return u/jv(r[1]/Hf)}})||this}return h}(Bm),vy=[new Hp("EPSG:3857"),new Hp("EPSG:102100"),new Hp("EPSG:102113"),new Hp("EPSG:900913"),new Hp("http://www.opengis.net/def/crs/EPSG/0/3857"),new Hp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Xv(y,h,n){var u=y.length,r=n>1?n:2,s=h;s===void 0&&(r>2?s=y.slice():s=new Array(u));for(var P=0;P<u;P+=r){s[P]=Yp*y[P]/180;var z=Hf*Math.log(Math.tan(Math.PI*(+y[P+1]+90)/360));z>Nm?z=Nm:z<-Nm&&(z=-Nm),s[P+1]=z}return s}function Wv(y,h,n){var u=y.length,r=n>1?n:2,s=h;s===void 0&&(r>2?s=y.slice():s=new Array(u));for(var P=0;P<u;P+=r)s[P]=180*y[P]/Yp,s[P+1]=360*Math.atan(Math.exp(y[P+1]/Hf))/Math.PI-90;return s}var vb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xb=6378137,$v=[-180,-90,180,90],bb=Math.PI*xb/180,Kh=function(y){vb(h,y);function h(n,u){return y.call(this,{code:n,units:sc.DEGREES,extent:$v,axisOrientation:u,global:!0,metersPerUnit:bb,worldExtent:$v})||this}return h}(Bm),xy=[new Kh("CRS:84"),new Kh("EPSG:4326","neu"),new Kh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Kh("urn:ogc:def:crs:OGC:2:84"),new Kh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Kh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Kh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var by={};function Kv(y){return by[y]||by[y.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Hv(y,h){by[y]=h}var Jp={};function Yf(y,h,n){var u=y.getCode(),r=h.getCode();u in Jp||(Jp[u]={}),Jp[u][r]=n}function Yv(y,h){var n;return y in Jp&&h in Jp[y]&&(n=Jp[y][h]),n}function wy(y,h){var n=y[0],u=y[1],r=h[0],s=h[1],P=r[0],z=r[1],F=s[0],V=s[1],N=F-P,me=V-z,ve=N===0&&me===0?0:(N*(n-P)+me*(u-z))/(N*N+me*me||0),Se,Ue;return ve<=0?(Se=P,Ue=z):ve>=1?(Se=F,Ue=V):(Se=P+ve*N,Ue=z+ve*me),[Se,Ue]}function Su(y,h){for(var n=!0,u=y.length-1;u>=0;--u)if(y[u]!=h[u]){n=!1;break}return n}function Qp(y,h){var n=y[0]-h[0],u=y[1]-h[1];return n*n+u*u}function Ey(y,h){return Math.sqrt(Qp(y,h))}function Jv(y,h){return Qp(y,wy(y,h))}function Qv(y,h){if(h.canWrapX()){var n=bs(h.getExtent()),u=ex(y,h,n);u&&(y[0]-=u*n)}return y}function ex(y,h,n){var u=h.getExtent(),r=0;if(h.canWrapX()&&(y[0]<u[0]||y[0]>u[2])){var s=n||bs(u);r=Math.floor((y[0]-u[0])/s)}return r}var Ty=!0;function wb(y){var h=y===void 0?!0:y;Ty=!h}function Sy(y,h,n){var u;if(h!==void 0){for(var r=0,s=y.length;r<s;++r)h[r]=y[r];u=h}else u=y.slice();return u}function Eb(y,h,n){if(h!==void 0&&y!==h){for(var u=0,r=y.length;u<r;++u)h[u]=y[u];y=h}return y}function Tb(y){Hv(y.getCode(),y),Yf(y,y,Sy)}function Sb(y){y.forEach(Tb)}function ya(y){return typeof y=="string"?Kv(y):y||null}function tx(y){Sb(y),y.forEach(function(h){y.forEach(function(n){h!==n&&Yf(h,n,Sy)})})}function Ib(y,h,n,u){y.forEach(function(r){h.forEach(function(s){Yf(r,s,n),Yf(s,r,u)})})}function uo(y,h){return wb(),Gm(y,"EPSG:4326",h!==void 0?h:"EPSG:3857")}function lh(y,h){var n=Gm(y,h!==void 0?h:"EPSG:3857","EPSG:4326"),u=n[0];return(u<-180||u>180)&&(n[0]=Um(u+180,360)-180),n}function rx(y,h){if(y===h)return!0;var n=y.getUnits()===h.getUnits();if(y.getCode()===h.getCode())return n;var u=Vm(y,h);return u===Sy&&n}function Vm(y,h){var n=y.getCode(),u=h.getCode(),r=Yv(n,u);return r||(r=Eb),r}function Jf(y,h){var n=ya(y),u=ya(h);return Vm(n,u)}function Gm(y,h,n){var u=Jf(h,n);return u(y,void 0,y.length)}function Qf(y,h,n,u){var r=Jf(h,n);return Vv(y,r,void 0,u)}var Zl=null;function uh(){return Zl}function Iy(y,h){return Zl?Gm(y,h,Zl):y}function Xl(y,h){return Zl?Gm(y,Zl,h):(Ty&&!Su(y,[0,0])&&y[0]>=-180&&y[0]<=180&&y[1]>=-90&&y[1]<=90&&(Ty=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),y)}function ef(y,h){return Zl?Qf(y,h,Zl):y}function ed(y,h){return Zl?Qf(y,Zl,h):y}function ix(y,h){if(!Zl)return y;var n=ya(h).getUnits(),u=Zl.getUnits();return n&&u?y*wu[n]/wu[u]:y}function Cb(){tx(vy),tx(xy),Ib(xy,vy,Xv,Wv)}Cb();function _l(y,h,n,u,r,s){for(var P=s||[],z=0,F=h;F<n;F+=u){var V=y[F],N=y[F+1];P[z++]=r[0]*V+r[2]*N+r[4],P[z++]=r[1]*V+r[3]*N+r[5]}return s&&P.length!=z&&(P.length=z),P}function jm(y,h,n,u,r,s,P){for(var z=P||[],F=Math.cos(r),V=Math.sin(r),N=s[0],me=s[1],ve=0,Se=h;Se<n;Se+=u){var Ue=y[Se]-N,et=y[Se+1]-me;z[ve++]=N+Ue*F-et*V,z[ve++]=me+Ue*V+et*F;for(var Ie=Se+2;Ie<Se+u;++Ie)z[ve++]=y[Ie]}return P&&z.length!=ve&&(z.length=ve),z}function nx(y,h,n,u,r,s,P,z){for(var F=z||[],V=P[0],N=P[1],me=0,ve=h;ve<n;ve+=u){var Se=y[ve]-V,Ue=y[ve+1]-N;F[me++]=V+r*Se,F[me++]=N+s*Ue;for(var et=ve+2;et<ve+u;++et)F[me++]=y[et]}return z&&F.length!=me&&(F.length=me),F}function ox(y,h,n,u,r,s,P){for(var z=P||[],F=0,V=h;V<n;V+=u){z[F++]=y[V]+r,z[F++]=y[V+1]+s;for(var N=V+2;N<V+u;++N)z[F++]=y[N]}return P&&z.length!=F&&(z.length=F),z}var Ab=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),ax=za(),Pb=function(y){Ab(h,y);function h(){var n=y.call(this)||this;return n.extent_=Ya(),n.extentRevision_=-1,n.simplifiedGeometryMaxMinSquaredTolerance=0,n.simplifiedGeometryRevision=0,n.simplifyTransformedInternal=bv(function(u,r,s){if(!s)return this.getSimplifiedGeometry(r);var P=this.clone();return P.applyTransform(s),P.getSimplifiedGeometry(r)}),n}return h.prototype.simplifyTransformed=function(n,u){return this.simplifyTransformedInternal(this.getRevision(),n,u)},h.prototype.clone=function(){return jr()},h.prototype.closestPointXY=function(n,u,r,s){return jr()},h.prototype.containsXY=function(n,u){var r=this.getClosestPoint([n,u]);return r[0]===n&&r[1]===u},h.prototype.getClosestPoint=function(n,u){var r=u||[NaN,NaN];return this.closestPointXY(n[0],n[1],r,1/0),r},h.prototype.intersectsCoordinate=function(n){return this.containsXY(n[0],n[1])},h.prototype.computeExtent=function(n){return jr()},h.prototype.getExtent=function(n){if(this.extentRevision_!=this.getRevision()){var u=this.computeExtent(this.extent_);(isNaN(u[0])||isNaN(u[1]))&&$p(u),this.extentRevision_=this.getRevision()}return Uv(this.extent_,n)},h.prototype.rotate=function(n,u){jr()},h.prototype.scale=function(n,u,r){jr()},h.prototype.simplify=function(n){return this.getSimplifiedGeometry(n*n)},h.prototype.getSimplifiedGeometry=function(n){return jr()},h.prototype.getType=function(){return jr()},h.prototype.applyTransform=function(n){jr()},h.prototype.intersectsExtent=function(n){return jr()},h.prototype.translate=function(n,u){jr()},h.prototype.transform=function(n,u){var r=ya(n),s=r.getUnits()==sc.TILE_PIXELS?function(P,z,F){var V=r.getExtent(),N=r.getWorldExtent(),me=Tu(N)/Tu(V);return vs(ax,N[0],N[3],me,-me,0,0,0),_l(P,0,P.length,F,ax,z),Jf(r,u)(P,z,F)}:Jf(r,u);return this.applyTransform(s),this},h}(ko),qm=Pb;var Pn={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"};var Mb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),kb=function(y){Mb(h,y);function h(){var n=y.call(this)||this;return n.layout=Pn.XY,n.stride=2,n.flatCoordinates=null,n}return h.prototype.computeExtent=function(n){return Om(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},h.prototype.getCoordinates=function(){return jr()},h.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},h.prototype.getFlatCoordinates=function(){return this.flatCoordinates},h.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},h.prototype.getLayout=function(){return this.layout},h.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var u=this.getSimplifiedGeometryInternal(n),r=u.getFlatCoordinates();return r.length<this.flatCoordinates.length?u:(this.simplifiedGeometryMaxMinSquaredTolerance=n,this)},h.prototype.getSimplifiedGeometryInternal=function(n){return this},h.prototype.getStride=function(){return this.stride},h.prototype.setFlatCoordinates=function(n,u){this.stride=sx(n),this.layout=n,this.flatCoordinates=u},h.prototype.setCoordinates=function(n,u){jr()},h.prototype.setLayout=function(n,u,r){var s;if(n)s=sx(n);else{for(var P=0;P<r;++P)if(u.length===0){this.layout=Pn.XY,this.stride=2;return}else u=u[0];s=u.length,n=Lb(s)}this.layout=n,this.stride=s},h.prototype.applyTransform=function(n){this.flatCoordinates&&(n(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},h.prototype.rotate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();jm(r,0,r.length,s,n,u,r),this.changed()}},h.prototype.scale=function(n,u,r){var s=u;s===void 0&&(s=n);var P=r;P||(P=$h(this.getExtent()));var z=this.getFlatCoordinates();if(z){var F=this.getStride();nx(z,0,z.length,F,n,s,P,z),this.changed()}},h.prototype.translate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();ox(r,0,r.length,s,n,u,r),this.changed()}},h}(qm);function Lb(y){var h;return y==2?h=Pn.XY:y==3?h=Pn.XYZ:y==4&&(h=Pn.XYZM),h}function sx(y){var h;return y==Pn.XY?h=2:y==Pn.XYZ||y==Pn.XYM?h=3:y==Pn.XYZM&&(h=4),h}function lx(y,h,n){var u=y.getFlatCoordinates();if(u){var r=y.getStride();return _l(u,0,u.length,r,h,n)}else return null}var ws=kb;function ux(y,h,n,u){for(var r=0,s=n.length;r<s;++r)y[h++]=n[r];return h}function Hh(y,h,n,u){for(var r=0,s=n.length;r<s;++r)for(var P=n[r],z=0;z<u;++z)y[h++]=P[z];return h}function td(y,h,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var V=Hh(y,h,n[z],u);s[P++]=V,h=V}return s.length=P,s}function cx(y,h,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var V=td(y,h,n[z],u,s[P]);s[P++]=V,h=V[V.length-1]}return s.length=P,s}var Rb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),zb=function(y){Rb(h,y);function h(n){var u=y.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return h.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Mo),this.changeEventsKeys_.length=0},h.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(lo(this.geometries_[n],en.CHANGE,this.changed,this))},h.prototype.clone=function(){var n=new h(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.geometries_,z=0,F=P.length;z<F;++z)s=P[z].closestPointXY(n,u,r,s);return s},h.prototype.containsXY=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(n,u))return!0;return!1},h.prototype.computeExtent=function(n){$p(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)Ov(n,u[r].getExtent());return n},h.prototype.getGeometries=function(){return hx(this.geometries_)},h.prototype.getGeometriesArray=function(){return this.geometries_},h.prototype.getGeometriesArrayRecursive=function(){for(var n=[],u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].getType()===this.getType()?n=n.concat(u[r].getGeometriesArrayRecursive()):n.push(u[r]);return n},h.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var u=[],r=this.geometries_,s=!1,P=0,z=r.length;P<z;++P){var F=r[P],V=F.getSimplifiedGeometry(n);u.push(V),V!==F&&(s=!0)}if(s){var N=new h(null);return N.setGeometriesArray(u),N}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},h.prototype.getType=function(){return Ot.GEOMETRY_COLLECTION},h.prototype.intersectsExtent=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)if(u[r].intersectsExtent(n))return!0;return!1},h.prototype.isEmpty=function(){return this.geometries_.length===0},h.prototype.rotate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(n,u);this.changed()},h.prototype.scale=function(n,u,r){var s=r;s||(s=$h(this.getExtent()));for(var P=this.geometries_,z=0,F=P.length;z<F;++z)P[z].scale(n,u,s);this.changed()},h.prototype.setGeometries=function(n){this.setGeometriesArray(hx(n))},h.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},h.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},h.prototype.translate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(n,u);this.changed()},h.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},h}(qm);function hx(y){for(var h=[],n=0,u=y.length;n<u;++n)h.push(y[n].clone());return h}var px=zb;function fx(y,h,n,u,r,s,P){var z=y[h],F=y[h+1],V=y[n]-z,N=y[n+1]-F,me;if(V===0&&N===0)me=h;else{var ve=((r-z)*V+(s-F)*N)/(V*V+N*N);if(ve>1)me=n;else if(ve>0){for(var Se=0;Se<u;++Se)P[Se]=yl(y[h+Se],y[n+Se],ve);P.length=u;return}else me=h}for(var Se=0;Se<u;++Se)P[Se]=y[me+Se];P.length=u}function rd(y,h,n,u,r){var s=y[h],P=y[h+1];for(h+=u;h<n;h+=u){var z=y[h],F=y[h+1],V=ql(s,P,z,F);V>r&&(r=V),s=z,P=F}return r}function id(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=rd(y,h,z,u,r),h=z}return r}function dx(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=id(y,h,z,u,r),h=z[z.length-1]}return r}function nd(y,h,n,u,r,s,P,z,F,V,N){if(h==n)return V;var me,ve;if(r===0)if(ve=ql(P,z,y[h],y[h+1]),ve<V){for(me=0;me<u;++me)F[me]=y[h+me];return F.length=u,ve}else return V;for(var Se=N||[NaN,NaN],Ue=h+u;Ue<n;)if(fx(y,Ue-u,Ue,u,P,z,Se),ve=ql(P,z,Se[0],Se[1]),ve<V){for(V=ve,me=0;me<u;++me)F[me]=Se[me];F.length=u,Ue+=u}else Ue+=u*Math.max((Math.sqrt(ve)-Math.sqrt(V))/r|0,1);if(s&&(fx(y,n-u,h,u,P,z,Se),ve=ql(P,z,Se[0],Se[1]),ve<V)){for(V=ve,me=0;me<u;++me)F[me]=Se[me];F.length=u}return V}function od(y,h,n,u,r,s,P,z,F,V,N){for(var me=N||[NaN,NaN],ve=0,Se=n.length;ve<Se;++ve){var Ue=n[ve];V=nd(y,h,Ue,u,r,s,P,z,F,V,me),h=Ue}return V}function mx(y,h,n,u,r,s,P,z,F,V,N){for(var me=N||[NaN,NaN],ve=0,Se=n.length;ve<Se;++ve){var Ue=n[ve];V=od(y,h,Ue,u,r,s,P,z,F,V,me),h=Ue[Ue.length-1]}return V}function ad(y,h,n,u,r,s,P){var z=(n-h)/u;if(z<3){for(;h<n;h+=u)s[P++]=y[h],s[P++]=y[h+1];return P}var F=new Array(z);F[0]=1,F[z-1]=1;for(var V=[h,n-u],N=0;V.length>0;){for(var me=V.pop(),ve=V.pop(),Se=0,Ue=y[ve],et=y[ve+1],Ie=y[me],Ne=y[me+1],He=ve+u;He<me;He+=u){var nt=y[He],mt=y[He+1],ht=qv(nt,mt,Ue,et,Ie,Ne);ht>Se&&(N=He,Se=ht)}Se>r&&(F[(N-h)/u]=1,ve+u<N&&V.push(ve,N),N+u<me&&V.push(N,me))}for(var He=0;He<z;++He)F[He]&&(s[P++]=y[h+He*u],s[P++]=y[h+He*u+1]);return P}function gx(y,h,n,u,r,s,P,z){for(var F=0,V=n.length;F<V;++F){var N=n[F];P=ad(y,h,N,u,r,s,P),z.push(P),h=N}return P}function ch(y,h){return h*Math.round(y/h)}function Db(y,h,n,u,r,s,P){if(h==n)return P;var z=ch(y[h],r),F=ch(y[h+1],r);h+=u,s[P++]=z,s[P++]=F;var V,N;do if(V=ch(y[h],r),N=ch(y[h+1],r),h+=u,h==n)return s[P++]=V,s[P++]=N,P;while(V==z&&N==F);for(;h<n;){var me=ch(y[h],r),ve=ch(y[h+1],r);if(h+=u,!(me==V&&ve==N)){var Se=V-z,Ue=N-F,et=me-z,Ie=ve-F;if(Se*Ie==Ue*et&&(Se<0&&et<Se||Se==et||Se>0&&et>Se)&&(Ue<0&&Ie<Ue||Ue==Ie||Ue>0&&Ie>Ue)){V=me,N=ve;continue}s[P++]=V,s[P++]=N,z=V,F=N,V=me,N=ve}}return s[P++]=V,s[P++]=N,P}function Cy(y,h,n,u,r,s,P,z){for(var F=0,V=n.length;F<V;++F){var N=n[F];P=Db(y,h,N,u,r,s,P),z.push(P),h=N}return P}function yx(y,h,n,u,r,s,P,z){for(var F=0,V=n.length;F<V;++F){var N=n[F],me=[];P=Cy(y,h,N,u,r,s,P,me),z.push(me),h=N[N.length-1]}return P}function vl(y,h,n,u,r){for(var s=r!==void 0?r:[],P=0,z=h;z<n;z+=u)s[P++]=y.slice(z,z+u);return s.length=P,s}function hh(y,h,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var V=n[z];s[P++]=vl(y,h,V,u,s[P]),h=V}return s.length=P,s}function sd(y,h,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var V=n[z];s[P++]=hh(y,h,V,u,s[P]),h=V[V.length-1]}return s.length=P,s}function Ay(y,h,n,u){for(var r=0,s=y[n-u],P=y[n-u+1];h<n;h+=u){var z=y[h],F=y[h+1];r+=P*z-s*F,s=z,P=F}return r/2}function Py(y,h,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Ay(y,h,z,u),h=z}return r}function _x(y,h,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Py(y,h,z,u),h=z[z.length-1]}return r}var Ob=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Fb=function(y){Ob(h,y);function h(n,u){var r=y.call(this)||this;return r.maxDelta_=-1,r.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return h.prototype.clone=function(){return new h(this.flatCoordinates.slice(),this.layout)},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,n,u,r,s))},h.prototype.getArea=function(){return Ay(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=ad(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new h(u,Pn.XY)},h.prototype.getType=function(){return Ot.LINEAR_RING},h.prototype.intersectsExtent=function(n){return!1},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Hh(this.flatCoordinates,0,n,this.stride),this.changed()},h}(ws),My=Fb;function Zm(y,h,n,u,r){var s;for(h+=u;h<n;h+=u)if(s=r(y.slice(h-u,h),y.slice(h,h+u)),s)return s;return!1}function Wm(y,h,n,u,r,s,P){var z,F,V=(n-h)/u;if(V===1)z=h;else if(V===2)z=h,F=r;else if(V!==0){for(var N=y[h],me=y[h+1],ve=0,Se=[0],Ue=h+u;Ue<n;Ue+=u){var et=y[Ue],Ie=y[Ue+1];ve+=Math.sqrt((et-N)*(et-N)+(Ie-me)*(Ie-me)),Se.push(ve),N=et,me=Ie}var Ne=r*ve,He=_v(Se,Ne);He<0?(F=(Ne-Se[-He-2])/(Se[-He-1]-Se[-He-2]),z=h+(-He-2)*u):z=h+He*u}for(var nt=P>1?P:2,mt=s||new Array(nt),Ue=0;Ue<nt;++Ue)mt[Ue]=z===void 0?NaN:F===void 0?y[z+Ue]:yl(y[z+Ue],y[z+u+Ue],F);return mt}function Xm(y,h,n,u,r,s){if(n==h)return null;var P;if(r<y[h+u-1])return s?(P=y.slice(h,h+u),P[u-1]=r,P):null;if(y[n-1]<r)return s?(P=y.slice(n-u,n),P[u-1]=r,P):null;if(r==y[h+u-1])return y.slice(h,h+u);for(var z=h/u,F=n/u;z<F;){var V=z+F>>1;r<y[(V+1)*u-1]?F=V:z=V+1}var N=y[z*u-1];if(r==N)return y.slice((z-1)*u,(z-1)*u+u);var me=y[(z+1)*u-1],ve=(r-N)/(me-N);P=[];for(var Se=0;Se<u-1;++Se)P.push(yl(y[(z-1)*u+Se],y[z*u+Se],ve));return P.push(r),P}function vx(y,h,n,u,r,s,P){if(P)return Xm(y,h,n[n.length-1],u,r,s);var z;if(r<y[u-1])return s?(z=y.slice(0,u),z[u-1]=r,z):null;if(y[y.length-1]<r)return s?(z=y.slice(y.length-u),z[u-1]=r,z):null;for(var F=0,V=n.length;F<V;++F){var N=n[F];if(h!=N){if(r<y[h+u-1])return null;if(r<=y[N-1])return Xm(y,h,N,u,r,!1);h=N}}return null}function xx(y,h,n,u,r){var s=Fv(r,function(P){return!ph(y,h,n,u,P[0],P[1])});return!s}function ph(y,h,n,u,r,s){for(var P=0,z=y[n-u],F=y[n-u+1];h<n;h+=u){var V=y[h],N=y[h+1];F<=s?N>s&&(V-z)*(s-F)-(r-z)*(N-F)>0&&P++:N<=s&&(V-z)*(s-F)-(r-z)*(N-F)<0&&P--,z=V,F=N}return P!==0}function ld(y,h,n,u,r,s){if(n.length===0||!ph(y,h,n[0],u,r,s))return!1;for(var P=1,z=n.length;P<z;++P)if(ph(y,n[P-1],n[P],u,r,s))return!1;return!0}function bx(y,h,n,u,r,s){if(n.length===0)return!1;for(var P=0,z=n.length;P<z;++P){var F=n[P];if(ld(y,h,F,u,r,s))return!0;h=F[F.length-1]}return!1}function ud(y,h,n,u,r){var s=dy(Ya(),y,h,n,u);return Ro(r,s)?lc(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Zm(y,h,n,u,function(P,z){return Nv(r,P,z)}):!1}function wx(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){if(ud(y,h,n[s],u,r))return!0;h=n[s]}return!1}function Bb(y,h,n,u,r){return!!(ud(y,h,n,u,r)||ph(y,h,n,u,r[0],r[1])||ph(y,h,n,u,r[0],r[3])||ph(y,h,n,u,r[2],r[1])||ph(y,h,n,u,r[2],r[3]))}function ky(y,h,n,u,r){if(!Bb(y,h,n[0],u,r))return!1;if(n.length===1)return!0;for(var s=1,P=n.length;s<P;++s)if(xx(y,n[s-1],n[s],u,r)&&!ud(y,n[s-1],n[s],u,r))return!1;return!0}function Ex(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(ky(y,h,z,u,r))return!0;h=z[z.length-1]}return!1}function $m(y,h,n,u){for(var r=y[h],s=y[h+1],P=0,z=h+u;z<n;z+=u){var F=y[z],V=y[z+1];P+=Math.sqrt((F-r)*(F-r)+(V-s)*(V-s)),r=F,s=V}return P}var Ub=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Nb=function(y){Ub(h,y);function h(n,u){var r=y.call(this)||this;return r.flatMidpoint_=null,r.flatMidpointRevision_=-1,r.maxDelta_=-1,r.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return h.prototype.appendCoordinate=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n):this.flatCoordinates=n.slice(),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,n,u,r,s))},h.prototype.forEachSegment=function(n){return Zm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},h.prototype.getCoordinateAtM=function(n,u){if(this.layout!=Pn.XYM&&this.layout!=Pn.XYZM)return null;var r=u!==void 0?u:!1;return Xm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,r)},h.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getCoordinateAt=function(n,u){return Wm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,this.stride)},h.prototype.getLength=function(){return $m(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getFlatMidpoint=function(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=ad(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new h(u,Pn.XY)},h.prototype.getType=function(){return Ot.LINE_STRING},h.prototype.intersectsExtent=function(n){return ud(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Hh(this.flatCoordinates,0,n,this.stride),this.changed()},h}(ws),Wl=Nb;var Vb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Gb=function(y){Vb(h,y);function h(n,u,r){var s=y.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(n[0]))s.setCoordinates(n,u);else if(u!==void 0&&r)s.setFlatCoordinates(u,n),s.ends_=r;else{for(var P=s.getLayout(),z=n,F=[],V=[],N=0,me=z.length;N<me;++N){var ve=z[N];N===0&&(P=ve.getLayout()),Ka(F,ve.getFlatCoordinates()),V.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=V}return s}return h.prototype.appendLineString=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates().slice()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(id(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),od(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},h.prototype.getCoordinateAtM=function(n,u,r){if(this.layout!=Pn.XYM&&this.layout!=Pn.XYZM||this.flatCoordinates.length===0)return null;var s=u!==void 0?u:!1,P=r!==void 0?r:!1;return vx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},h.prototype.getCoordinates=function(){return hh(this.flatCoordinates,0,this.ends_,this.stride)},h.prototype.getEnds=function(){return this.ends_},h.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new Wl(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},h.prototype.getLineStrings=function(){for(var n=this.flatCoordinates,u=this.ends_,r=this.layout,s=[],P=0,z=0,F=u.length;z<F;++z){var V=u[z],N=new Wl(n.slice(P,V),r);s.push(N),P=V}return s},h.prototype.getFlatMidpoints=function(){for(var n=[],u=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,z=0,F=s.length;z<F;++z){var V=s[z],N=Wm(u,r,V,P,.5);Ka(n,N),r=V}return n},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=gx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new h(u,Pn.XY,r)},h.prototype.getType=function(){return Ot.MULTI_LINE_STRING},h.prototype.intersectsExtent=function(n){return wx(this.flatCoordinates,0,this.ends_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=td(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},h}(ws),Tx=Gb;var jb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),qb=function(y){jb(h,y);function h(n,u){var r=y.call(this)||this;return r.setCoordinates(n,u),r}return h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){var P=this.flatCoordinates,z=ql(n,u,P[0],P[1]);if(z<s){for(var F=this.stride,V=0;V<F;++V)r[V]=P[V];return r.length=F,z}else return s},h.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},h.prototype.computeExtent=function(n){return Kp(this.flatCoordinates,n)},h.prototype.getType=function(){return Ot.POINT},h.prototype.intersectsExtent=function(n){return Kf(n,this.flatCoordinates[0],this.flatCoordinates[1])},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ux(this.flatCoordinates,0,n,this.stride),this.changed()},h}(ws),_a=qb;var Zb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Xb=function(y){Zb(h,y);function h(n,u){var r=y.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return h.prototype.appendPoint=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.flatCoordinates,z=this.stride,F=0,V=P.length;F<V;F+=z){var N=ql(n,u,P[F],P[F+1]);if(N<s){s=N;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},h.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getPoint=function(n){var u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return n<0||u<=n?null:new _a(this.flatCoordinates.slice(n*this.stride,(n+1)*this.stride),this.layout)},h.prototype.getPoints=function(){for(var n=this.flatCoordinates,u=this.layout,r=this.stride,s=[],P=0,z=n.length;P<z;P+=r){var F=new _a(n.slice(P,P+r),u);s.push(F)}return s},h.prototype.getType=function(){return Ot.MULTI_POINT},h.prototype.intersectsExtent=function(n){for(var u=this.flatCoordinates,r=this.stride,s=0,P=u.length;s<P;s+=r){var z=u[s],F=u[s+1];if(Kf(n,z,F))return!0}return!1},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Hh(this.flatCoordinates,0,n,this.stride),this.changed()},h}(ws),Km=Xb;function Ly(y,h,n,u,r,s,P){for(var z,F,V,N,me,ve,Se,Ue=r[s+1],et=[],Ie=0,Ne=n.length;Ie<Ne;++Ie){var He=n[Ie];for(N=y[He-u],ve=y[He-u+1],z=h;z<He;z+=u)me=y[z],Se=y[z+1],(Ue<=ve&&Se<=Ue||ve<=Ue&&Ue<=Se)&&(V=(Ue-ve)/(Se-ve)*(me-N)+N,et.push(V)),N=me,ve=Se}var nt=NaN,mt=-1/0;for(et.sort(rh),N=et[0],z=1,F=et.length;z<F;++z){me=et[z];var ht=Math.abs(me-N);ht>mt&&(V=(N+me)/2,ld(y,h,n,u,V,Ue)&&(nt=V,mt=ht)),N=me}return isNaN(nt)&&(nt=r[s]),P?(P.push(nt,Ue,mt),P):[nt,Ue,mt]}function Sx(y,h,n,u,r){for(var s=[],P=0,z=n.length;P<z;++P){var F=n[P];s=Ly(y,h,F,u,r,2*P,s),h=F[F.length-1]}return s}function Ix(y,h,n,u){for(;h<n-u;){for(var r=0;r<u;++r){var s=y[h+r];y[h+r]=y[n-u+r],y[n-u+r]=s}h+=u,n-=u}}function Cx(y,h,n,u){for(var r=0,s=y[n-u],P=y[n-u+1];h<n;h+=u){var z=y[h],F=y[h+1];r+=(z-s)*(F+P),s=z,P=F}return r===0?void 0:r>0}function Ry(y,h,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],V=Cx(y,h,F,u);if(P===0){if(s&&V||!s&&!V)return!1}else if(s&&!V||!s&&V)return!1;h=F}return!0}function Ax(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(!Ry(y,h,z,u,r))return!1;z.length&&(h=z[z.length-1])}return!0}function Hm(y,h,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],V=Cx(y,h,F,u),N=P===0?s&&V||!s&&!V:s&&!V||!s&&V;N&&Ix(y,h,F,u),h=F}return h}function zy(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s)h=Hm(y,h,n[s],u,r);return h}var Wb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Px=function(y){Wb(h,y);function h(n,u,r){var s=y.call(this)||this;return s.ends_=[],s.flatInteriorPointRevision_=-1,s.flatInteriorPoint_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,u!==void 0&&r?(s.setFlatCoordinates(u,n),s.ends_=r):s.setCoordinates(n,u),s}return h.prototype.appendLinearRing=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(id(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),od(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,n,u,r,s))},h.prototype.containsXY=function(n,u){return ld(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,u)},h.prototype.getArea=function(){return Py(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},h.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Hm(u,0,this.ends_,this.stride,n)):u=this.flatCoordinates,hh(u,0,this.ends_,this.stride)},h.prototype.getEnds=function(){return this.ends_},h.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var n=$h(this.getExtent());this.flatInteriorPoint_=Ly(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},h.prototype.getInteriorPoint=function(){return new _a(this.getFlatInteriorPoint(),Pn.XYM)},h.prototype.getLinearRingCount=function(){return this.ends_.length},h.prototype.getLinearRing=function(n){return n<0||this.ends_.length<=n?null:new My(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},h.prototype.getLinearRings=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.ends_,s=[],P=0,z=0,F=r.length;z<F;++z){var V=r[z],N=new My(u.slice(P,V),n);s.push(N),P=V}return s},h.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Ry(n,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Hm(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Cy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(n),u,0,r),new h(u,Pn.XY,r)},h.prototype.getType=function(){return Ot.POLYGON},h.prototype.intersectsExtent=function(n){return ky(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=td(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},h}(ws),cd=Px;function Dy(y,h,n){for(var u=h||32,r=y.getStride(),s=y.getLayout(),P=y.getCenter(),z=r*(u+1),F=new Array(z),V=0;V<z;V+=r){F[V]=0,F[V+1]=0;for(var N=2;N<r;N++)F[V+N]=P[N]}var me=[F.length],ve=new Px(F,s,me);return $b(ve,P,y.getRadius(),n),ve}function $b(y,h,n,u){for(var r=y.getFlatCoordinates(),s=y.getStride(),P=r.length/s-1,z=u||0,F=0;F<=P;++F){var V=F*s,N=z+Um(F,P)*2*Math.PI/P;r[V]=h[0]+n*Math.cos(N),r[V+1]=h[1]+n*Math.sin(N)}y.changed()}function Mx(y,h,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Om(y,h,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),h=F[F.length-1]}return r}var Kb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Hb=function(y){Kb(h,y);function h(n,u,r){var s=y.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(n[0])){for(var P=s.getLayout(),z=n,F=[],V=[],N=0,me=z.length;N<me;++N){var ve=z[N];N===0&&(P=ve.getLayout());for(var Se=F.length,Ue=ve.getEnds(),et=0,Ie=Ue.length;et<Ie;++et)Ue[et]+=Se;Ka(F,ve.getFlatCoordinates()),V.push(Ue)}u=P,n=F,r=V}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return h.prototype.appendPolygon=function(n){var u;if(!this.flatCoordinates)this.flatCoordinates=n.getFlatCoordinates().slice(),u=n.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ka(this.flatCoordinates,n.getFlatCoordinates()),u=n.getEnds().slice();for(var s=0,P=u.length;s<P;++s)u[s]+=r}this.endss_.push(u),this.changed()},h.prototype.clone=function(){for(var n=this.endss_.length,u=new Array(n),r=0;r<n;++r)u[r]=this.endss_[r].slice();var s=new h(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(dx(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),mx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},h.prototype.containsXY=function(n,u){return bx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},h.prototype.getArea=function(){return _x(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},h.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),zy(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,sd(u,0,this.endss_,this.stride)},h.prototype.getEndss=function(){return this.endss_},h.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=Mx(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Sx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},h.prototype.getInteriorPoints=function(){return new Km(this.getFlatInteriorPoints().slice(),Pn.XYM)},h.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Ax(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=zy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=yx(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new h(u,Pn.XY,r)},h.prototype.getPolygon=function(n){if(n<0||this.endss_.length<=n)return null;var u;if(n===0)u=0;else{var r=this.endss_[n-1];u=r[r.length-1]}var s=this.endss_[n].slice(),P=s[s.length-1];if(u!==0)for(var z=0,F=s.length;z<F;++z)s[z]-=u;return new cd(this.flatCoordinates.slice(u,P),this.layout,s)},h.prototype.getPolygons=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.endss_,s=[],P=0,z=0,F=r.length;z<F;++z){var V=r[z].slice(),N=V[V.length-1];if(P!==0)for(var me=0,ve=V.length;me<ve;++me)V[me]-=P;var Se=new cd(u.slice(P,N),n,V);s.push(Se),P=N}return s},h.prototype.getType=function(){return Ot.MULTI_POLYGON},h.prototype.intersectsExtent=function(n){return Ex(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=cx(this.flatCoordinates,0,n,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},h}(ws),kx=Hb;var Yb=(y,h,n)=>{let{time_intervals:u,olGeometry:r,coordinate:s}=h.properties,{type:P,coordinates:z}=h.geometry,F=r,V,N;if(n&&s)V=s;else if(P==="Point")V=z;else if(P==="LineString"){F||(F=new Wl(z));let me=u||[[]],ve=me[0],Se=me[me.length-1];if(y<ve[0])[,,N]=ve,V=F.getFirstCoordinate();else if(y>Se[0])[,,N]=Se,V=F.getLastCoordinate();else for(let Ue=0;Ue<me.length-1;Ue+=1){let[et,Ie]=me[Ue],[Ne,He]=me[Ue+1];if(et<=y&&y<=Ne){let mt=Math.min((y-et)/(Ne-et),1)*(He-Ie)+Ie;V=F.getCoordinateAt(mt),[,,N]=me[Ue];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",F);return{coord:V,rotation:N}},Lx=Yb;var Jb=(y,h,n,u,r)=>{if(!y)return{renderedTrajectories:[]};let{time:s=Date.now(),size:P=[],center:z,resolution:F,rotation:V=0,pixelRatio:N=1}=u;if(!F||!z)return{renderedTrajectories:[]};let{noInterpolate:me=!1,hoverVehicleId:ve,selectedVehicleId:Se,filter:Ue,getScreenPixel:et=(Pt,Qt)=>(Qt.zoom||0)<12?Pt.map(Ft=>Math.floor(Ft)):Pt}=r,Ie=y.getContext("2d");Ie?.clearRect(0,0,y.width,y.height);let[Ne,He]=P;Ne&&He&&(y.width!==Ne||y.height!==He)&&([y.width,y.height]=[Ne*N,He*N]);let nt=vs(za(),P[0]/2,P[1]/2,1/F,-1/F,-V,-z[0],-z[1]);y.style&&(y.style.width=`${y.width/N}px`,y.style.height=`${y.height/N}px`);let mt,ht,pt,Tt,It=[];for(let Pt=h.length-1;Pt>=0;Pt-=1){let Qt=h[Pt];if(Ue&&!Ue(Qt))continue;let{train_id:Ft,timeOffset:er}=Qt.properties,{coord:hr,rotation:kt}=Lx(s-(er||0),Qt,me);if(h[Pt].properties.coordinate=hr,h[Pt].properties.rotation=kt,!hr)continue;let mr=bo(nt,[...hr]);if(!mr||(mr=mr.map(Lr=>Lr*N),mr[0]<0||mr[0]>y.width||mr[1]<0||mr[1]>y.height))continue;let vr=n(Qt,u,r);if(!!vr){if(ve!==Ft&&Se!==Ft){let[Lr,Ar]=et([mr[0]-vr.width/2,mr[1]-vr.height/2],u);Ie?.drawImage(vr,Lr,Ar)}ve&&ve===Ft&&(mt=vr,ht=mr),Se&&Se===Ft&&(pt=vr,Tt=mr),It.push(Qt)}}return pt&&Tt&&Ie?.drawImage(pt,Math.floor(Tt[0]-pt.width/2),Math.floor(Tt[1]-pt.height/2)),mt&&ht&&Ie?.drawImage(mt,Math.floor(ht[0]-mt.width/2),Math.floor(ht[1]-mt.height/2)),{renderedTrajectories:It}},hd=Jb;function tf(y){let h;return n=>{let{map:u,mbMap:r,olLayer:s}=y;if(!u||!r)return h||(h=document.createElement("div")),h;let P=r.getCanvas(),{viewState:z}=n,F=s?.getOpacity()||1;return P.style.opacity=`${F}`,r.jumpTo({center:lh(z.center),zoom:z.zoom-1,bearing:Zv(-z.rotation)}),P.isConnected?(P.width!==n.size[0]||P.height!==n.size[1])&&r.resize():u.render(),r.redraw(),r.getContainer()}}function rf(y){let h;return n=>{let{map:u,mbMap:r,renderState:s,olLayer:P}=y;if(!u||!r)return h||(h=document.createElement("div")),h;let z=!1,F=r.getCanvas(),{viewState:V}=n,N=P?.getVisible();s&&s?.visible!==N&&(F.style.display=N?"block":"none",s.visible=N,F.style.position="absolute");let me=P?.getOpacity();F&&s&&s.opacity!==me&&(F.style.opacity=me,s.opacity=me);let{rotation:ve}=V;s&&s.rotation!==ve&&(r.rotateTo(-(ve||0)*180/Math.PI,{animate:!1}),z=!0,s.rotation=ve),s&&s.center&&(s.zoom!==V.zoom||s.center[0]!==V.center[0]||s.center[1]!==V.center[1])&&(r.jumpTo({center:lh(V.center),zoom:V.zoom-1}),z=!0,s.zoom=V.zoom,s.center=V.center);let Se=u.getSize()||[0,0];if(s&&s.size&&(s.size[0]!==Se[0]||s.size[1]!==Se[1])&&(z=!0,s.size=Se),r&&r.style&&r.isStyleLoaded()&&z)try{r._frame&&(r._frame.cancel(),r._frame=null),r._render()}catch(Ue){console.warn(Ue)}return r.getContainer()}}var Qb=(y,h,n=!1)=>{let u=["HIDDEN","LEAVING","BOARDING"],r=y.has_fzo&&u.indexOf(y.state)>-1,s=h.has_fzo&&u.indexOf(h.state)>-1;if(r||s){if(r!==s)return r?-1:1;if(y.state!==h.state)return u.indexOf(y.state)-u.indexOf(h.state)}let P=null,z=null,F=Date.now();return n?(P=new Date(y.min_arrival_time||y.time).getTime()-F,z=new Date(h.min_arrival_time||h.time).getTime()-F):(P=new Date(y.time).getTime()-F,z=new Date(h.time).getTime()-F),P-z},pd=Qb;var ew=(y,h=!1,n=30)=>{let u=Object.keys(y).map(me=>y[me]);u.sort((me,ve)=>pd(me,ve,h));let r=new Date;r.setMinutes(r.getMinutes()+n);let s=r.getTime(),P=new Date;P.setMinutes(P.getMinutes()-n);let z=P.getTime(),F=[],V=[],N=null;for(let me=u.length-1;me>=0;me-=1){let ve={...u[me]},Se=new Date(ve.time).getTime();Se>z&&Se<s&&(ve.state==="BOARDING"&&(V.includes(ve.platform)?ve.state="HIDDEN":V.push(ve.platform)),N&&ve.to[0]===N.to[0]&&Math.abs(Se-N.time)<1e3&&ve.line.name===N.line.name&&(ve.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(ve.state)&&(ve.cancelled=!0),N=ve,N.time=Se,F.unshift(ve))}return F},fd=ew;var tw=(y,h=!1,n=30,u=100)=>{let r={},s={};return P=>{let{source:z,content:F}=P;r[z]&&window.clearTimeout(r[z]),s[F.call_id]=F,r[z]=window.setTimeout(()=>{let V=fd(s,h||!1,n);y(V)},u)}},Oy=tw;var nf={};oy(nf,{bgColors:()=>zx,getBgColor:()=>nw,getDelayColor:()=>sw,getDelayText:()=>lw,getRadius:()=>iw,getTextColor:()=>ow,getTextSize:()=>aw,getTypeIndex:()=>Ym,textColors:()=>Dx,types:()=>Rx});var rw=[[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]],Rx=[/^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],zx=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],Dx=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],Ym=y=>typeof y=="string"?Rx.findIndex(h=>h.test(y)):y,iw=(y,h)=>{try{let n=Ym(y||0);return rw[n][h]}catch{return 1}},nw=y=>{try{let h=Ym(y);return zx[h]}catch{return"#ffffff"}},ow=y=>{try{let h=Ym(y);return Dx[h]}catch{return"#ffffff"}},aw=(y,h,n,u)=>{if(!y)return 0;y.font=`bold ${u}px Arial`;let r=y.measureText(n),s=25,P=0;for(;r.width>h-6&&P<s;)u-=.5,y.font=`bold ${u}px arial, sans-serif`,r=y.measureText(n),P+=1;return u},sw=(y,h,n)=>h?n?"#ff0000":"#a0a0a0":y===null?"#a0a0a0":y>=36e5?"#ed004c":y>=5e5?"#e80000":y>=3e5?"#ff4a00":y>=18e4?"#f7bf00":"#00a00c",lw=(y,h)=>h?String.fromCodePoint(215):y>36e5?`+${Math.round(y/36e5)}h`:y>59e3?`+${Math.round(y/6e4)}m`:y>0?`+${y}s`:"";var uw=(y,h)=>{let n=null;return typeof window>"u"?null:(typeof document<"u"&&document?.createElement?(n=document.createElement("canvas"),n.width=y,n.height=h):OffscreenCanvas?n=new OffscreenCanvas(y,h):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),n)},fh=uw;var Fy={},Gy=(y,h,n)=>{let u=`${y}, ${h}, ${n}`;if(!Fy[u]){let r=fh(y*2,y*2);if(r){let s=r.getContext("2d");if(!s)return null;s.beginPath(),s.arc(y,y,h,0,2*Math.PI,!1),s.fillStyle=n,s.filter="blur(1px)",s.fill(),Fy[u]=r}}return Fy[u]},By={},jy=(y,h,n,u,r="#000",s=1)=>{let P=`${y}, ${n}, ${u}, ${r}, ${s}`;if(!By[P]){let z=fh(Math.ceil(y.length*h),Math.ceil(h+8*s));if(z){let F=z.getContext("2d");if(!F)return null;F.font=n,F.textAlign="left",F.textBaseline="middle",F.font=n,F.fillStyle=u,F.strokeStyle=r,F.lineWidth=1.5*s,F.strokeText(y,0,h),F.fillText(y,0,h),By[P]=z}}return By[P]},Uy={},qy=(y,h,n,u,r,s)=>{let P=`${y}, ${h}, ${n}, ${u}, ${r}, ${s}`;if(!Uy[P]){let z=fh(y*2,y*2);if(z){let F=z.getContext("2d");if(!F)return null;F.fillStyle=n,u&&(F.lineWidth=1*s,F.strokeStyle="#000000"),F.beginPath(),F.arc(y,y,h,0,2*Math.PI,!1),F.fill(),r&&F.setLineDash([5,3]),u&&F.stroke(),Uy[P]=z}}return Uy[P]},Ny={},Zy=(y,h,n,u,r,s,P)=>{let z=`${y}, ${h}, ${n}, ${u},${r}, ${s}, ${P}`;if(!Ny[z]){let F=fh(h*2,h*2);if(F){let V=F.getContext("2d");if(!V)return null;s&&(V.save(),V.textBaseline="middle",V.textAlign="center",V.font=`bold ${n+2}px Arial`,V.strokeStyle=r,V.strokeText(y,h,h),V.restore()),V.textBaseline="middle",V.textAlign="center",V.fillStyle=u,V.font=`bold ${n}px Arial`,V.strokeStyle=r,V.strokeText(y,h,h),V.fillText(y,h,h),Ny[z]=F}}return Ny[z]},Vy={},cw=(y,h,n)=>{let{hoverVehicleId:u,selectedVehicleId:r,useDelayStyle:s,delayOutlineColor:P="#000",delayDisplay:z=3e5,getRadius:F=()=>0,getBgColor:V=()=>"#000",getDelayColor:N=()=>"#000",getDelayText:me=()=>null,getTextColor:ve=()=>"#000",getTextSize:Se=()=>0,getMaxRadiusForText:Ue=()=>10,getMaxRadiusForStrokeAndDelay:et=()=>7}=n,{zoom:Ie,pixelRatio:Ne=1}=h,{type:He}=y.properties,{train_id:nt,line:mt,delay:ht,state:pt,operator_provides_realtime_journey:Tt}=y.properties,{name:It,text_color:Pt,color:Qt}=mt||{},Ft=pt==="JOURNEY_CANCELLED";He||(He="Rail"),It||(It="I"),Pt||(Pt="#000000"),Qt&&Qt[0]!=="#"&&(Qt=`#${Qt}`),Pt[0]!=="#"&&(Pt=`#${Pt}`);let er=Math.min(Math.floor(Ie||1),16),hr=!!(u&&u===nt),kt=!!(r&&r===nt),mr=F(He,er)*Ne,vr=mr>=et()*Ne;(hr||kt)&&(mr=vr?mr+5*Ne:14*Ne);let Lr=mr>Ue()*Ne,Ar=`${mr}${hr||kt}`;if(s?(Ar+=`${Tt}${ht}`,vr&&(Ar+=`${Ft}`)):(Ar+=`${Qt||He}`,vr&&(Ar+=`${Ft}${ht}`)),Lr&&(Ar+=`${It}${Pt}`),!Vy[Ar]){if(mr===0)return null;let Rr=1*Ne,Sr=mr+2,vi=mr*2,jt=Sr*2+Rr*2,ei=jt/2,bi=null;vr&&ht!==null&&(bi=Gy(ei,Sr,N(ht,Ft)));let ai=null,zi=0;if(vr&&(hr||(ht||0)>=z||Ft)){zi=Math.max(Ft?19:14,Math.min(Ft?19:17,mr*1.2))*Ne;let di=me(ht,Ft);di&&(ai=jy(di,zi,`bold ${zi}px arial, sans-serif`,N(ht,Ft,!0),P,Ne))}let Or;s?Or=N(ht,Ft):Or=Qt||V(He);let Xi=qy(ei,mr,Or,vr||hr||kt,!!vr&&!!s&&ht===null&&Tt==="yes",Ne),Pr=jt+(ai?.width||0)*2,Mi=fh(Pr,jt);if(Mi){let di=Mi.getContext("2d");if(!di)return null;let $n=ai?.width||0;bi&&di.drawImage(bi,$n,0),Xi&&di.drawImage(Xi,$n,0);let mn=null;if(Lr){let Xr=Math.max(mr,10),Wi=Se(di,vi,It,Xr),kn=s?"#000000":Pt||ve(He);mn=Zy(It,ei,Wi,kn,Or,!!s&&ht===null&&Tt==="yes",Ne)}mn&&di.drawImage(mn,$n,0),ai&&di.drawImage(ai,$n+Math.ceil(ei+Sr)+Rr,Math.ceil(ei-zi)),Vy[Ar]=Mi}}return Vy[Ar]},Yh=cw;var hw=(y,h,n)=>Yh(y,h,{...n,useDelayStyle:!0}),Xy=hw;var Jm,pw=()=>{if(!Jm){Jm=fh(15,15);let y=Jm?.getContext("2d");y&&(y.arc(8,8,5,0,2*Math.PI,!1),y.fillStyle="#8ED6FF",y.fill(),y.lineWidth=3,y.strokeStyle="black",y.stroke(),y.lineWidth=3)}return Jm},Wy=pw;var tn={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 fw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),dw=function(y){fw(h,y);function h(n){var u=y.call(this)||this;u.on,u.once,u.un,u.background_=n.background;var r=Ra({},n);return typeof n.properties=="object"&&(delete r.properties,Ra(r,n.properties)),r[tn.OPACITY]=n.opacity!==void 0?n.opacity:1,En(typeof r[tn.OPACITY]=="number",64),r[tn.VISIBLE]=n.visible!==void 0?n.visible:!0,r[tn.Z_INDEX]=n.zIndex,r[tn.MAX_RESOLUTION]=n.maxResolution!==void 0?n.maxResolution:1/0,r[tn.MIN_RESOLUTION]=n.minResolution!==void 0?n.minResolution:0,r[tn.MIN_ZOOM]=n.minZoom!==void 0?n.minZoom:-1/0,r[tn.MAX_ZOOM]=n.maxZoom!==void 0?n.maxZoom:1/0,u.className_=r.className!==void 0?r.className:"ol-layer",delete r.className,u.setProperties(r),u.state_=null,u}return h.prototype.getBackground=function(){return this.background_},h.prototype.getClassName=function(){return this.className_},h.prototype.getLayerState=function(n){var u=this.state_||{layer:this,managed:n===void 0?!0:n},r=this.getZIndex();return u.opacity=jl(Math.round(this.getOpacity()*100)/100,0,1),u.visible=this.getVisible(),u.extent=this.getExtent(),u.zIndex=r===void 0&&!u.managed?1/0:r,u.maxResolution=this.getMaxResolution(),u.minResolution=Math.max(this.getMinResolution(),0),u.minZoom=this.getMinZoom(),u.maxZoom=this.getMaxZoom(),this.state_=u,u},h.prototype.getLayersArray=function(n){return jr()},h.prototype.getLayerStatesArray=function(n){return jr()},h.prototype.getExtent=function(){return this.get(tn.EXTENT)},h.prototype.getMaxResolution=function(){return this.get(tn.MAX_RESOLUTION)},h.prototype.getMinResolution=function(){return this.get(tn.MIN_RESOLUTION)},h.prototype.getMinZoom=function(){return this.get(tn.MIN_ZOOM)},h.prototype.getMaxZoom=function(){return this.get(tn.MAX_ZOOM)},h.prototype.getOpacity=function(){return this.get(tn.OPACITY)},h.prototype.getSourceState=function(){return jr()},h.prototype.getVisible=function(){return this.get(tn.VISIBLE)},h.prototype.getZIndex=function(){return this.get(tn.Z_INDEX)},h.prototype.setBackground=function(n){this.background_=n,this.changed()},h.prototype.setExtent=function(n){this.set(tn.EXTENT,n)},h.prototype.setMaxResolution=function(n){this.set(tn.MAX_RESOLUTION,n)},h.prototype.setMinResolution=function(n){this.set(tn.MIN_RESOLUTION,n)},h.prototype.setMaxZoom=function(n){this.set(tn.MAX_ZOOM,n)},h.prototype.setMinZoom=function(n){this.set(tn.MIN_ZOOM,n)},h.prototype.setOpacity=function(n){En(typeof n=="number",64),this.set(tn.OPACITY,n)},h.prototype.setVisible=function(n){this.set(tn.VISIBLE,n)},h.prototype.setZIndex=function(n){this.set(tn.Z_INDEX,n)},h.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),y.prototype.disposeInternal.call(this)},h}(ko),Qm=dw;var dd={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Iu={UNDEFINED:"undefined",LOADING:"loading",READY:"ready",ERROR:"error"};var mw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),gw=function(y){mw(h,y);function h(n){var u=this,r=Ra({},n);delete r.source,u=y.call(this,r)||this,u.on,u.once,u.un,u.mapPrecomposeKey_=null,u.mapRenderKey_=null,u.sourceChangeKey_=null,u.renderer_=null,u.rendered=!1,n.render&&(u.render=n.render),n.map&&u.setMap(n.map),u.addChangeListener(tn.SOURCE,u.handleSourcePropertyChange_);var s=n.source?n.source:null;return u.setSource(s),u}return h.prototype.getLayersArray=function(n){var u=n||[];return u.push(this),u},h.prototype.getLayerStatesArray=function(n){var u=n||[];return u.push(this.getLayerState()),u},h.prototype.getSource=function(){return this.get(tn.SOURCE)||null},h.prototype.getRenderSource=function(){return this.getSource()},h.prototype.getSourceState=function(){var n=this.getSource();return n?n.getState():Iu.UNDEFINED},h.prototype.handleSourceChange_=function(){this.changed()},h.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(Mo(this.sourceChangeKey_),this.sourceChangeKey_=null);var n=this.getSource();n&&(this.sourceChangeKey_=lo(n,en.CHANGE,this.handleSourceChange_,this)),this.changed()},h.prototype.getFeatures=function(n){return this.renderer_?this.renderer_.getFeatures(n):new Promise(function(u){return u([])})},h.prototype.getData=function(n){return!this.renderer_||!this.rendered?null:this.renderer_.getData(n)},h.prototype.render=function(n,u){var r=this.getRenderer();if(r.prepareFrame(n))return this.rendered=!0,r.renderFrame(n,u)},h.prototype.unrender=function(){this.rendered=!1},h.prototype.setMapInternal=function(n){n||this.unrender(),this.set(tn.MAP,n)},h.prototype.getMapInternal=function(){return this.get(tn.MAP)},h.prototype.setMap=function(n){this.mapPrecomposeKey_&&(Mo(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),n||this.changed(),this.mapRenderKey_&&(Mo(this.mapRenderKey_),this.mapRenderKey_=null),n&&(this.mapPrecomposeKey_=lo(n,dd.PRECOMPOSE,function(u){var r=u,s=r.frameState.layerStatesArray,P=this.getLayerState(!1);En(!s.some(function(z){return z.layer===P.layer}),67),s.push(P)},this),this.mapRenderKey_=lo(this,en.CHANGE,n.render,n),this.changed())},h.prototype.setSource=function(n){this.set(tn.SOURCE,n)},h.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},h.prototype.hasRenderer=function(){return!!this.renderer_},h.prototype.createRenderer=function(){return null},h.prototype.disposeInternal=function(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),y.prototype.disposeInternal.call(this)},h}(Qm);function Ox(y,h){if(!y.visible)return!1;var n=h.resolution;if(n<y.minResolution||n>=y.maxResolution)return!1;var u=h.zoom;return u>y.minZoom&&u<=y.maxZoom}var Jh=gw;var $y=class extends ko{constructor(n={}){super(n);this.defineProperties(n);let{active:u}={active:n.active!==!1,...n};this.active=u}defineProperties(n){let{target:u,element:r,render:s}={...n};Object.defineProperties(this,{active:{get:()=>this.get("active"),set:P=>{this.set("active",P),P?this.activate():this.deactivate(),this.render()}},map:{get:()=>this.get("map"),set:P=>{if(this.map&&this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.deactivate(),this.set("map",P),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:u},element:{value:r,writable:!0},render:{value:s||this.render,writable:!0}})}attachToMap(n){this.map=n}detachFromMap(){this.map=void 0}activate(){this.deactivate()}deactivate(){console.error("The function deactivate() must be implemented in subclasses")}render(n){console.error("The function render() must be implemented in subclasses")}createDefaultElement(){console.error("The function createDefaultElement() must be implemented in subclasses")}},of=$y;var Ky=class extends of{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),[]}},eg=Ky;var Hy=class extends eg{constructor(n){super(n);this.onPostRender=this.onPostRender.bind(this)}getCopyrights(){if(!this.frameState)return[];let n=[];return this.frameState?.layerStatesArray.forEach(u=>{let{layer:r}=u;this.frameState&&Ox(u,this.frameState.viewState)&&r&&r.getSource&&r.getSource()&&r.getSource().getAttributions()&&(n=n.concat(r.getSource().getAttributions()(this.frameState)))}),Wh(n)}activate(){super.activate(),this.map&&this.map.on("postrender",this.onPostRender)}deactivate(){this.map&&this.map.un("postrender",this.onPostRender)}onPostRender(n){this.map&&this.element&&(this.frameState=n.frameState||void 0,this.render())}},Fx=Hy;var Es={ADD:"add",REMOVE:"remove"};var Ux=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Bx={LENGTH:"length"},tg=function(y){Ux(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.element=u,s.index=r,s}return h}(ln);var yw=function(y){Ux(h,y);function h(n,u){var r=y.call(this)||this;r.on,r.once,r.un;var s=u||{};if(r.unique_=!!s.unique,r.array_=n||[],r.unique_)for(var P=0,z=r.array_.length;P<z;++P)r.assertUnique_(r.array_[P],P);return r.updateLength_(),r}return h.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},h.prototype.extend=function(n){for(var u=0,r=n.length;u<r;++u)this.push(n[u]);return this},h.prototype.forEach=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)n(u[r],r,u)},h.prototype.getArray=function(){return this.array_},h.prototype.item=function(n){return this.array_[n]},h.prototype.getLength=function(){return this.get(Bx.LENGTH)},h.prototype.insertAt=function(n,u){this.unique_&&this.assertUnique_(u),this.array_.splice(n,0,u),this.updateLength_(),this.dispatchEvent(new tg(Es.ADD,u,n))},h.prototype.pop=function(){return this.removeAt(this.getLength()-1)},h.prototype.push=function(n){this.unique_&&this.assertUnique_(n);var u=this.getLength();return this.insertAt(u,n),this.getLength()},h.prototype.remove=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)if(u[r]===n)return this.removeAt(r)},h.prototype.removeAt=function(n){var u=this.array_[n];return this.array_.splice(n,1),this.updateLength_(),this.dispatchEvent(new tg(Es.REMOVE,u,n)),u},h.prototype.setAt=function(n,u){var r=this.getLength();if(n<r){this.unique_&&this.assertUnique_(u,n);var s=this.array_[n];this.array_[n]=u,this.dispatchEvent(new tg(Es.REMOVE,s,n)),this.dispatchEvent(new tg(Es.ADD,u,n))}else{for(var P=r;P<n;++P)this.insertAt(P,void 0);this.insertAt(n,u)}},h.prototype.updateLength_=function(){this.set(Bx.LENGTH,this.array_.length)},h.prototype.assertUnique_=function(n,u){for(var r=0,s=this.array_.length;r<s;++r)if(this.array_[r]===n&&r!==u)throw new zm(58)},h}(ko),dh=yw;var _w=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vw=function(y){_w(h,y);function h(n){var u=y.call(this)||this;if(u.on,u.once,u.un,u.id_=void 0,u.geometryName_="geometry",u.style_=null,u.styleFunction_=void 0,u.geometryChangeKey_=null,u.addChangeListener(u.geometryName_,u.handleGeometryChanged_),n)if(typeof n.getSimplifiedGeometry=="function"){var r=n;u.setGeometry(r)}else{var s=n;u.setProperties(s)}return u}return h.prototype.clone=function(){var n=new h(this.hasProperties()?this.getProperties():null);n.setGeometryName(this.getGeometryName());var u=this.getGeometry();u&&n.setGeometry(u.clone());var r=this.getStyle();return r&&n.setStyle(r),n},h.prototype.getGeometry=function(){return this.get(this.geometryName_)},h.prototype.getId=function(){return this.id_},h.prototype.getGeometryName=function(){return this.geometryName_},h.prototype.getStyle=function(){return this.style_},h.prototype.getStyleFunction=function(){return this.styleFunction_},h.prototype.handleGeometryChange_=function(){this.changed()},h.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(Mo(this.geometryChangeKey_),this.geometryChangeKey_=null);var n=this.getGeometry();n&&(this.geometryChangeKey_=lo(n,en.CHANGE,this.handleGeometryChange_,this)),this.changed()},h.prototype.setGeometry=function(n){this.set(this.geometryName_,n)},h.prototype.setStyle=function(n){this.style_=n,this.styleFunction_=n?xw(n):void 0,this.changed()},h.prototype.setId=function(n){this.id_=n,this.changed()},h.prototype.setGeometryName=function(n){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=n,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()},h}(ko);function xw(y){if(typeof y=="function")return y;var h;if(Array.isArray(y))h=y;else{En(typeof y.getZIndex=="function",41);var n=y;h=[n]}return function(){return h}}var uc=vw;var bw=function(){function y(h){var n=h||{};this.color_=n.color!==void 0?n.color:null}return y.prototype.clone=function(){var h=this.getColor();return new y({color:Array.isArray(h)?h.slice():h||void 0})},y.prototype.getColor=function(){return this.color_},y.prototype.setColor=function(h){this.color_=h},y}(),Ks=bw;var ww=function(){function y(h){var n=h||{};this.color_=n.color!==void 0?n.color:null,this.lineCap_=n.lineCap,this.lineDash_=n.lineDash!==void 0?n.lineDash:null,this.lineDashOffset_=n.lineDashOffset,this.lineJoin_=n.lineJoin,this.miterLimit_=n.miterLimit,this.width_=n.width}return y.prototype.clone=function(){var h=this.getColor();return new y({color:Array.isArray(h)?h.slice():h||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()})},y.prototype.getColor=function(){return this.color_},y.prototype.getLineCap=function(){return this.lineCap_},y.prototype.getLineDash=function(){return this.lineDash_},y.prototype.getLineDashOffset=function(){return this.lineDashOffset_},y.prototype.getLineJoin=function(){return this.lineJoin_},y.prototype.getMiterLimit=function(){return this.miterLimit_},y.prototype.getWidth=function(){return this.width_},y.prototype.setColor=function(h){this.color_=h},y.prototype.setLineCap=function(h){this.lineCap_=h},y.prototype.setLineDash=function(h){this.lineDash_=h},y.prototype.setLineDashOffset=function(h){this.lineDashOffset_=h},y.prototype.setLineJoin=function(h){this.lineJoin_=h},y.prototype.setMiterLimit=function(h){this.miterLimit_=h},y.prototype.setWidth=function(h){this.width_=h},y}(),va=ww;var Zi={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Yy(y,h){return Array.isArray(y)?y:(h===void 0?h=[y,y]:(h[0]=y,h[1]=y),h)}var Ew=function(){function y(h){this.opacity_=h.opacity,this.rotateWithView_=h.rotateWithView,this.rotation_=h.rotation,this.scale_=h.scale,this.scaleArray_=Yy(h.scale),this.displacement_=h.displacement}return y.prototype.clone=function(){var h=this.getScale();return new y({opacity:this.getOpacity(),scale:Array.isArray(h)?h.slice():h,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},y.prototype.getOpacity=function(){return this.opacity_},y.prototype.getRotateWithView=function(){return this.rotateWithView_},y.prototype.getRotation=function(){return this.rotation_},y.prototype.getScale=function(){return this.scale_},y.prototype.getScaleArray=function(){return this.scaleArray_},y.prototype.getDisplacement=function(){return this.displacement_},y.prototype.getAnchor=function(){return jr()},y.prototype.getImage=function(h){return jr()},y.prototype.getHitDetectionImage=function(){return jr()},y.prototype.getPixelRatio=function(h){return 1},y.prototype.getImageState=function(){return jr()},y.prototype.getImageSize=function(){return jr()},y.prototype.getOrigin=function(){return jr()},y.prototype.getSize=function(){return jr()},y.prototype.setDisplacement=function(h){this.displacement_=h},y.prototype.setOpacity=function(h){this.opacity_=h},y.prototype.setRotateWithView=function(h){this.rotateWithView_=h},y.prototype.setRotation=function(h){this.rotation_=h},y.prototype.setScale=function(h){this.scale_=h,this.scaleArray_=Yy(h)},y.prototype.listenImageChange=function(h){jr()},y.prototype.load=function(){jr()},y.prototype.unlistenImageChange=function(h){jr()},y}(),rg=Ew;var Tw=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Sw=/^([a-z]*)$|^hsla?\(.*\)$/i;function ig(y){return typeof y=="string"?y:Jy(y)}function Iw(y){var h=document.createElement("div");if(h.style.color=y,h.style.color!==""){document.body.appendChild(h);var n=getComputedStyle(h).color;return document.body.removeChild(h),n}else return""}var Cw=function(){var y=1024,h={},n=0;return function(u){var r;if(h.hasOwnProperty(u))r=h[u];else{if(n>=y){var s=0;for(var P in h)(s++&3)===0&&(delete h[P],--n)}r=Aw(u),h[u]=r,++n}return r}}();function Qh(y){return Array.isArray(y)?y:Cw(y)}function Aw(y){var h,n,u,r,s;if(Sw.exec(y)&&(y=Iw(y)),Tw.exec(y)){var P=y.length-1,z=void 0;P<=4?z=1:z=2;var F=P===4||P===8;h=parseInt(y.substr(1+0*z,z),16),n=parseInt(y.substr(1+1*z,z),16),u=parseInt(y.substr(1+2*z,z),16),F?r=parseInt(y.substr(1+3*z,z),16):r=255,z==1&&(h=(h<<4)+h,n=(n<<4)+n,u=(u<<4)+u,F&&(r=(r<<4)+r)),s=[h,n,u,r/255]}else y.indexOf("rgba(")==0?(s=y.slice(5,-1).split(",").map(Number),Nx(s)):y.indexOf("rgb(")==0?(s=y.slice(4,-1).split(",").map(Number),s.push(1),Nx(s)):En(!1,14);return s}function Nx(y){return y[0]=jl(y[0]+.5|0,0,255),y[1]=jl(y[1]+.5|0,0,255),y[2]=jl(y[2]+.5|0,0,255),y[3]=jl(y[3],0,1),y}function Jy(y){var h=y[0];h!=(h|0)&&(h=h+.5|0);var n=y[1];n!=(n|0)&&(n=n+.5|0);var u=y[2];u!=(u|0)&&(u=u+.5|0);var r=y[3]===void 0?1:Math.round(y[3]*100)/100;return"rgba("+h+","+n+","+u+","+r+")"}function Ts(y){return Array.isArray(y)?Jy(y):y}function Ja(y,h,n,u){var r;return n&&n.length?r=n.shift():ah?r=new OffscreenCanvas(y||300,h||300):r=document.createElement("canvas"),y&&(r.width=y),h&&(r.height=h),r.getContext("2d",u)}var Pw=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"),Vx=["style","variant","weight","size","lineHeight","family"],Qy=function(y){var h=y.match(Pw);if(!h)return null;for(var n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},u=0,r=Vx.length;u<r;++u){var s=h[u+1];s!==void 0&&(n[Vx[u]]=s)}return n.families=n.family.split(/,\s?/),n};function Gx(y){return y===1?"":String(Math.round(y*100)/100)}var og="10px sans-serif",Ss="#000",ep="round",cc=[],hc=0,Cu="round",pc=10,fc="#000",gh="center",tp="middle",dc=[0,0,0,0],mc=1,mh=new ko,Mw=new nh;Mw.setSize=function(){console.warn("labelCache is deprecated.")};var af=null,e_,t_={},jx=function(){var y=100,h="32px ",n=["monospace","serif"],u=n.length,r="wmytzilWMYTZIL@#/&?$%10\uF013",s,P;function z(V,N,me){for(var ve=!0,Se=0;Se<u;++Se){var Ue=n[Se];if(P=ng(V+" "+N+" "+h+Ue,r),me!=Ue){var et=ng(V+" "+N+" "+h+me+","+Ue,r);ve=ve&&et!=P}}return!!ve}function F(){for(var V=!0,N=mh.getKeys(),me=0,ve=N.length;me<ve;++me){var Se=N[me];mh.get(Se)<y&&(z.apply(this,Se.split(`
1075
+ `,document.addEventListener("keydown",x=>{x.key===i&&(this._metaPress=!0)}),document.addEventListener("keyup",x=>{x.key===i&&(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(E,i,d){this._canvas.width=d*E,this._canvas.height=d*i,this._canvas.style.width=`${E}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let E=s.extend({},P.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl",E)||this._canvas.getContext("experimental-webgl",E);i?(this.painter=new iu(i,this.transform),s.exported$1.testSupport(i)):this.fire(new s.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(E){E.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.Event("webglcontextlost",{originalEvent:E}))}_contextRestored(E){this._setupPainter(),this.resize(),this._update(),this.fire(new s.Event("webglcontextrestored",{originalEvent:E}))}_onMapScroll(E){if(E.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(E,i,d){return!i&&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(E){return this.style?(this._styleDirty=this._styleDirty||E,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(E){return this._update(),this._renderTaskQueue.add(E)}_cancelRenderFrame(E){this._renderTaskQueue.remove(E)}_render(E){let i,d=0,x=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=x.createQueryEXT(),x.beginQueryEXT(x.TIME_ELAPSED_EXT,i),d=s.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(E),this._removed)return;let T=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let U=this.transform.zoom,q=s.exported.now();this.style.zoomHistory.update(U,q);let W=new s.EvaluationParameters(U,{now:q,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Y=W.crossFadingFactor();Y===1&&Y===this._crossFadingFactor||(T=!0,this._crossFadingFactor=Y),this.style.update(W)}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 s.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.PerformanceUtils.mark(s.PerformanceMarkers.load),this.fire(new s.Event("load"))),this.style&&(this.style.hasTransitions()||T)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){let U=s.exported.now()-d;x.endQueryEXT(x.TIME_ELAPSED_EXT,i),setTimeout(()=>{let q=x.getQueryObjectEXT(i,x.QUERY_RESULT_EXT)/1e6;x.deleteQueryEXT(i),this.fire(new s.Event("gpu-timing-frame",{cpuTime:U,gpuTime:q}))},50)}if(this.listens("gpu-timing-layer")){let U=this.painter.collectGpuTimers();setTimeout(()=>{let q=this.painter.queryGpuTimers(U);this.fire(new s.Event("gpu-timing-layer",{layerTimes:q}))},50)}let M=this._sourcesDirty||this._styleDirty||this._placementDirty;return M||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new s.Event("idle")),!this._loaded||this._fullyLoaded||M||(this._fullyLoaded=!0,s.PerformanceUtils.mark(s.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 i of this._controls)i.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 E=this.painter.context.gl.getExtension("WEBGL_lose_context");E&&E.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),N.remove(this._canvasContainer),N.remove(this._controlContainer),this._cooperativeGestures&&N.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),s.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new s.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=s.exported.frame(E=>{s.PerformanceUtils.frame(E),this._frame=null,this._render(E)}))}_onWindowOnline(){this._update()}_onWindowResize(E){this._trackResize&&this.resize({originalEvent:E})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(E){this._showTileBoundaries!==E&&(this._showTileBoundaries=E,this._update())}get showPadding(){return!!this._showPadding}set showPadding(E){this._showPadding!==E&&(this._showPadding=E,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(E){this._showCollisionBoxes!==E&&(this._showCollisionBoxes=E,E?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(E){this._showOverdrawInspector!==E&&(this._showOverdrawInspector=E,this._update())}get repaint(){return!!this._repaint}set repaint(E){this._repaint!==E&&(this._repaint=E,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(E){this._vertices=E,this._update()}_setCacheLimits(E,i){s.setCacheLimits(E,i)}get version(){return"2.4.0"}},NavigationControl:class{constructor(E){this.options=s.extend({},No,E),this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(s.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),N.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",i=>this._map.zoomOut({},{originalEvent:i})),N.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=N.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let E=this._map.getZoom(),i=E===this._map.getMaxZoom(),d=E===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())}_rotateCompassArrow(){let E=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=E}onAdd(E){return this._map=E,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 Ur(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){N.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(E,i){let d=N.create("button",E,this._container);return d.type="button",d.addEventListener("click",i),d}_setButtonTitle(E,i){let d=this._map._getUIString(`NavigationControl.${i}`);E.title=d,E.setAttribute("aria-label",d)}},GeolocateControl:class extends s.Evented{constructor(E){super(),this.options=s.extend({},Aa,E),s.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(E){var i;return this._map=E,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),i=this._setupUI,jn!==void 0?i(jn):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{jn=d.state!=="denied",i(jn)}):(jn=!!window.navigator.geolocation,i(jn)),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(),N.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xi=0,Qo=!1}_isOutOfMapMaxBounds(E){let i=this._map.getMaxBounds(),d=E.coords;return i&&(d.longitude<i.getWest()||d.longitude>i.getEast()||d.latitude<i.getSouth()||d.latitude>i.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(E){if(this._map){if(this._isOutOfMapMaxBounds(E))return this._setErrorState(),this.fire(new s.Event("outofmaxbounds",E)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=E,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(E),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(E),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new s.Event("geolocate",E)),this._finish()}}_updateCamera(E){let i=new s.LngLat(E.coords.longitude,E.coords.latitude),d=E.coords.accuracy,x=this._map.getBearing(),T=s.extend({bearing:x},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(d),T,{geolocateSource:!0})}_updateMarker(E){if(E){let i=new s.LngLat(E.coords.longitude,E.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=E.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let E=this._map._container.clientHeight/2,i=this._map.unproject([0,E]),d=this._map.unproject([1,E]),x=i.distanceTo(d),T=Math.ceil(2*this._accuracy/x);this._circleElement.style.width=`${T}px`,this._circleElement.style.height=`${T}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(E){if(this._map){if(this.options.trackUserLocation)if(E.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 i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(E.code===3&&Qo)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 s.Event("error",E)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(E){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=N.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),N.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",E===!1){s.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=N.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Jo(this._dotElement),this._circleElement=N.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Jo({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",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.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 s.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return s.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 s.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xi--,Qo=!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 s.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 s.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 E;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),xi++,xi>1?(E={maximumAge:6e5,timeout:0},Qo=!0):(E=this.options.positionOptions,Qo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,E)}}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:ll,LogoControl:us,ScaleControl:class{constructor(E){this.options=s.extend({},ur,E),s.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){lr(this._map,this._container,this.options)}onAdd(E){return this._map=E,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",E.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){N.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(E){this.options.unit=E,lr(this._map,this._container,this.options)}},FullscreenControl:class{constructor(E){this._fullscreen=!1,E&&E.container&&(E.container instanceof HTMLElement?this._container=E.container:s.warnOnce("Full screen control 'container' must be a DOM element.")),s.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(E){return this._map=E,this._container||(this._container=this._map.getContainer()),this._controlContainer=N.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){N.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 E=this._fullscreenButton=N.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);N.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",E).setAttribute("aria-hidden","true"),E.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let E=this._getTitle();this._fullscreenButton.setAttribute("aria-label",E),this._fullscreenButton.title=E}_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(E){this.options=E,s.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(E){return this._map=E,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=N.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),N.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(){N.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 s.Evented{constructor(E){super(),this.options=s.extend(Object.create(si),E),s.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(E){return this._map&&this.remove(),this._map=E,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 s.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&N.remove(this._content),this._container&&(N.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 s.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(E){return this._lngLat=s.LngLat.convert(E),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(E){return this.setDOMContent(document.createTextNode(E))}setHTML(E){let i=document.createDocumentFragment(),d=document.createElement("body"),x;for(d.innerHTML=E;x=d.firstChild,x;)i.appendChild(x);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(E){return this.options.maxWidth=E,this._update(),this}setDOMContent(E){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=N.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(E),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(E){this._container&&this._container.classList.add(E)}removeClassName(E){this._container&&this._container.classList.remove(E)}setOffset(E){return this.options.offset=E,this._update(),this}toggleClassName(E){if(this._container)return this._container.classList.toggle(E)}_createCloseButton(){this.options.closeButton&&(this._closeButton=N.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(E){this._update(E.point)}_onMouseMove(E){this._update(E.point)}_onDrag(E){this._update(E.point)}_update(E){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=N.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=N.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(M=>this._container.classList.add(M)),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&&!E))return;let i=this._pos=this._trackPointer&&E?E:this._map.project(this._lngLat),d=this.options.anchor,x=Cn(this.options.offset);if(!d){let M=this._container.offsetWidth,U=this._container.offsetHeight,q;q=i.y+x.bottom.y<U?["top"]:i.y>this._map.transform.height-U?["bottom"]:[],i.x<M/2?q.push("left"):i.x>this._map.transform.width-M/2&&q.push("right"),d=q.length===0?"bottom":q.join("-")}let T=i.add(x[d]).round();N.setTransform(this._container,`${sr[d]} translate(${T.x}px,${T.y}px)`),cr(this._container,d,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let E=this._container.querySelector(Ii);E&&E.focus()}_onClose(){this.remove()}},Marker:Jo,Style:In,LngLat:s.LngLat,LngLatBounds:s.LngLatBounds,Point:s.pointGeometry,MercatorCoordinate:s.MercatorCoordinate,Evented:s.Evented,AJAXError:s.AJAXError,config:s.config,CanvasSource:Rr,GeoJSONSource:mr,ImageSource:Lr,RasterDEMTileSource:kt,RasterTileSource:er,VectorTileSource:Ft,VideoSource:Ar,prewarm:function(){di().acquire(Xi)},clearPrewarmedResources:function(){let E=Mi;E&&(E.isPreloaded()&&E.numActive()===1?(E.release(Xi),Mi=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 Pr.workerCount},set workerCount(E){Pr.workerCount=E},get maxParallelImageRequests(){return s.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(E){s.config.MAX_PARALLEL_IMAGE_REQUESTS=E},clearStorage(E){s.clearTileCache(E)},workerUrl:"",addProtocol(E,i){s.config.REGISTERED_PROTOCOLS[E]=i},removeProtocol(E){delete s.config.REGISTERED_PROTOCOLS[E]}};return Ji.extend(ao,{isSafari:s.isSafari,getPerformanceMetrics:s.PerformanceUtils.getPerformanceMetrics}),ao});var r=n;return r})});var a1=jf((_B,o1)=>{var EE="Expected a function",i1=NaN,TE="[object Symbol]",SE=/^\s+|\s+$/g,IE=/^[-+]0x[0-9a-f]+$/i,CE=/^0b[01]+$/i,AE=/^0o[0-7]+$/i,PE=parseInt,ME=typeof global=="object"&&global&&global.Object===Object&&global,kE=typeof self=="object"&&self&&self.Object===Object&&self,LE=ME||kE||Function("return this")(),RE=Object.prototype,zE=RE.toString,DE=Math.max,OE=Math.min,F_=function(){return LE.Date.now()};function FE(y,h,n){var u,r,s,P,z,F,V=0,N=!1,me=!1,ve=!0;if(typeof y!="function")throw new TypeError(EE);h=n1(h)||0,B_(n)&&(N=!!n.leading,me="maxWait"in n,s=me?DE(n1(n.maxWait)||0,h):s,ve="trailing"in n?!!n.trailing:ve);function Se(pt){var Tt=u,It=r;return u=r=void 0,V=pt,P=y.apply(It,Tt),P}function Ue(pt){return V=pt,z=setTimeout(Ne,h),N?Se(pt):P}function et(pt){var Tt=pt-F,It=pt-V,Pt=h-Tt;return me?OE(Pt,s-It):Pt}function Ie(pt){var Tt=pt-F,It=pt-V;return F===void 0||Tt>=h||Tt<0||me&&It>=s}function Ne(){var pt=F_();if(Ie(pt))return He(pt);z=setTimeout(Ne,et(pt))}function He(pt){return z=void 0,ve&&u?Se(pt):(u=r=void 0,P)}function nt(){z!==void 0&&clearTimeout(z),V=0,u=F=r=z=void 0}function mt(){return z===void 0?P:He(F_())}function ht(){var pt=F_(),Tt=Ie(pt);if(u=arguments,r=this,F=pt,Tt){if(z===void 0)return Ue(F);if(me)return z=setTimeout(Ne,h),Se(F)}return z===void 0&&(z=setTimeout(Ne,h)),P}return ht.cancel=nt,ht.flush=mt,ht}function B_(y){var h=typeof y;return!!y&&(h=="object"||h=="function")}function BE(y){return!!y&&typeof y=="object"}function UE(y){return typeof y=="symbol"||BE(y)&&zE.call(y)==TE}function n1(y){if(typeof y=="number")return y;if(UE(y))return i1;if(B_(y)){var h=typeof y.valueOf=="function"?y.valueOf():y;y=B_(h)?h+"":h}if(typeof y!="string")return y===0?y:+y;y=y.replace(SE,"");var n=CE.test(y);return n||AE.test(y)?PE(y.slice(2),n?2:8):IE.test(y)?i1:+y}o1.exports=FE});var h1=jf((vB,c1)=>{var u1="Expected a function",s1=NaN,NE="[object Symbol]",VE=/^\s+|\s+$/g,GE=/^[-+]0x[0-9a-f]+$/i,jE=/^0b[01]+$/i,qE=/^0o[0-7]+$/i,ZE=parseInt,XE=typeof global=="object"&&global&&global.Object===Object&&global,WE=typeof self=="object"&&self&&self.Object===Object&&self,$E=XE||WE||Function("return this")(),KE=Object.prototype,HE=KE.toString,YE=Math.max,JE=Math.min,U_=function(){return $E.Date.now()};function QE(y,h,n){var u,r,s,P,z,F,V=0,N=!1,me=!1,ve=!0;if(typeof y!="function")throw new TypeError(u1);h=l1(h)||0,dg(n)&&(N=!!n.leading,me="maxWait"in n,s=me?YE(l1(n.maxWait)||0,h):s,ve="trailing"in n?!!n.trailing:ve);function Se(pt){var Tt=u,It=r;return u=r=void 0,V=pt,P=y.apply(It,Tt),P}function Ue(pt){return V=pt,z=setTimeout(Ne,h),N?Se(pt):P}function et(pt){var Tt=pt-F,It=pt-V,Pt=h-Tt;return me?JE(Pt,s-It):Pt}function Ie(pt){var Tt=pt-F,It=pt-V;return F===void 0||Tt>=h||Tt<0||me&&It>=s}function Ne(){var pt=U_();if(Ie(pt))return He(pt);z=setTimeout(Ne,et(pt))}function He(pt){return z=void 0,ve&&u?Se(pt):(u=r=void 0,P)}function nt(){z!==void 0&&clearTimeout(z),V=0,u=F=r=z=void 0}function mt(){return z===void 0?P:He(U_())}function ht(){var pt=U_(),Tt=Ie(pt);if(u=arguments,r=this,F=pt,Tt){if(z===void 0)return Ue(F);if(me)return z=setTimeout(Ne,h),Se(F)}return z===void 0&&(z=setTimeout(Ne,h)),P}return ht.cancel=nt,ht.flush=mt,ht}function eT(y,h,n){var u=!0,r=!0;if(typeof y!="function")throw new TypeError(u1);return dg(n)&&(u="leading"in n?!!n.leading:u,r="trailing"in n?!!n.trailing:r),QE(y,h,{leading:u,maxWait:h,trailing:r})}function dg(y){var h=typeof y;return!!y&&(h=="object"||h=="function")}function tT(y){return!!y&&typeof y=="object"}function rT(y){return typeof y=="symbol"||tT(y)&&HE.call(y)==NE}function l1(y){if(typeof y=="number")return y;if(rT(y))return s1;if(dg(y)){var h=typeof y.valueOf=="function"?y.valueOf():y;y=dg(h)?h+"":h}if(typeof y!="string")return y===0?y:+y;y=y.replace(VE,"");var n=jE.test(y);return n||qE.test(y)?ZE(y.slice(2),n?2:8):GE.test(y)?s1:+y}c1.exports=eT});var yg={};oy(yg,{CopyrightControl:()=>Fx,Layer:()=>Is,MapboxLayer:()=>op,MapboxStyleLayer:()=>r1,MaplibreLayer:()=>ap,RealtimeAPI:()=>Wf,RealtimeLayer:()=>f1,RealtimeModes:()=>qo,RoutingAPI:()=>qf,RoutingControl:()=>$0,RoutingLayer:()=>hg,StopFinderControl:()=>H0,StopsAPI:()=>Zf,VectorLayer:()=>d1,WMSLayer:()=>m1,compareDepartures:()=>pd,createRealtimeFilters:()=>cy,debounceDeparturesMessages:()=>Oy,debounceWebsocketMessages:()=>Xf,fullTrajectoryDelayStyle:()=>p1,fullTrajectoryStyle:()=>gg,getCircleCanvas:()=>qy,getDelayBgCanvas:()=>Gy,getDelayTextCanvas:()=>jy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>ac,getMapboxRender:()=>rf,getMaplibreRender:()=>tf,getTextCanvas:()=>Zy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Xh,pad:()=>Rm,realtimeConfig:()=>nf,realtimeDefaultStyle:()=>Yh,realtimeDelayStyle:()=>Xy,realtimeSimpleStyle:()=>Wy,removeDuplicate:()=>Wh,renderTrajectories:()=>hd,sortAndFilterDepartures:()=>fd,sortByDelay:()=>hy});var $1=function(){function y(h){this.propagationStopped,this.defaultPrevented,this.type=h,this.target=null}return y.prototype.preventDefault=function(){this.defaultPrevented=!0},y.prototype.stopPropagation=function(){this.propagationStopped=!0},y}();var ln=$1;var qp={PROPERTYCHANGE:"propertychange"};var K1=function(){function y(){this.disposed=!1}return y.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},y.prototype.disposeInternal=function(){},y}(),yv=K1;function _v(y,h,n){for(var u,r,s=n||rh,P=0,z=y.length,F=!1;P<z;)u=P+(z-P>>1),r=+s(y[u],h),r<0?P=u+1:(z=u,F=!r);return F?P:~P}function rh(y,h){return y>h?1:y<h?-1:0}function vv(y,h){return y.indexOf(h)>=0}function xv(y,h,n){for(;h<n;){var u=y[h];y[h]=y[n],y[n]=u,++h,--n}}function Ka(y,h){for(var n=Array.isArray(h)?h:[h],u=n.length,r=0;r<u;r++)y[y.length]=n[r]}function _s(y,h){var n=y.length;if(n!==h.length)return!1;for(var u=0;u<n;u++)if(y[u]!==h[u])return!1;return!0}function Cm(){return!0}function Zh(){}function bv(y){var h=!1,n,u,r;return function(){var s=Array.prototype.slice.call(arguments);return(!h||this!==r||!_s(s,u))&&(h=!0,r=this,u=s,n=y.apply(this,arguments)),n}}var Ra=typeof Object.assign=="function"?Object.assign:function(y,h){if(y==null)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(y),u=1,r=arguments.length;u<r;++u){var s=arguments[u];if(s!=null)for(var P in s)s.hasOwnProperty(P)&&(n[P]=s[P])}return n};function ih(y){for(var h in y)delete y[h]}var Am=typeof Object.values=="function"?Object.values:function(y){var h=[];for(var n in y)h.push(y[n]);return h};function Vl(y){var h;for(h in y)return!1;return!h}var H1=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y1=function(y){H1(h,y);function h(n){var u=y.call(this)||this;return u.eventTarget_=n,u.pendingRemovals_=null,u.dispatching_=null,u.listeners_=null,u}return h.prototype.addEventListener=function(n,u){if(!(!n||!u)){var r=this.listeners_||(this.listeners_={}),s=r[n]||(r[n]=[]);s.indexOf(u)===-1&&s.push(u)}},h.prototype.dispatchEvent=function(n){var u=typeof n=="string",r=u?n:n.type,s=this.listeners_&&this.listeners_[r];if(!!s){var P=u?new ln(n):n;P.target||(P.target=this.eventTarget_||this);var z=this.dispatching_||(this.dispatching_={}),F=this.pendingRemovals_||(this.pendingRemovals_={});r in z||(z[r]=0,F[r]=0),++z[r];for(var V,N=0,me=s.length;N<me;++N)if("handleEvent"in s[N]?V=s[N].handleEvent(P):V=s[N].call(this,P),V===!1||P.propagationStopped){V=!1;break}if(--z[r]===0){var ve=F[r];for(delete F[r];ve--;)this.removeEventListener(r,Zh);delete z[r]}return V}},h.prototype.disposeInternal=function(){this.listeners_&&ih(this.listeners_)},h.prototype.getListeners=function(n){return this.listeners_&&this.listeners_[n]||void 0},h.prototype.hasListener=function(n){return this.listeners_?n?n in this.listeners_:Object.keys(this.listeners_).length>0:!1},h.prototype.removeEventListener=function(n,u){var r=this.listeners_&&this.listeners_[n];if(r){var s=r.indexOf(u);s!==-1&&(this.pendingRemovals_&&n in this.pendingRemovals_?(r[s]=Zh,++this.pendingRemovals_[n]):(r.splice(s,1),r.length===0&&delete this.listeners_[n]))}},h}(yv),nh=Y1;var en={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 lo(y,h,n,u,r){if(u&&u!==y&&(n=n.bind(u)),r){var s=n;n=function(){y.removeEventListener(h,n),s.apply(this,arguments)}}var P={target:y,type:h,listener:n};return y.addEventListener(h,n),P}function Zp(y,h,n,u){return lo(y,h,n,u,!0)}function Mo(y){y&&y.target&&(y.target.removeEventListener(y.type,y.listener),ih(y))}var J1=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Pm=function(y){J1(h,y);function h(){var n=y.call(this)||this;return n.on=n.onInternal,n.once=n.onceInternal,n.un=n.unInternal,n.revision_=0,n}return h.prototype.changed=function(){++this.revision_,this.dispatchEvent(en.CHANGE)},h.prototype.getRevision=function(){return this.revision_},h.prototype.onInternal=function(n,u){if(Array.isArray(n)){for(var r=n.length,s=new Array(r),P=0;P<r;++P)s[P]=lo(this,n[P],u);return s}else return lo(this,n,u)},h.prototype.onceInternal=function(n,u){var r;if(Array.isArray(n)){var s=n.length;r=new Array(s);for(var P=0;P<s;++P)r[P]=Zp(this,n[P],u)}else r=Zp(this,n,u);return u.ol_key=r,r},h.prototype.unInternal=function(n,u){var r=u.ol_key;if(r)Ha(r);else if(Array.isArray(n))for(var s=0,P=n.length;s<P;++s)this.removeEventListener(n[s],u);else this.removeEventListener(n,u)},h}(nh);Pm.prototype.on;Pm.prototype.once;Pm.prototype.un;function Ha(y){if(Array.isArray(y))for(var h=0,n=y.length;h<n;++h)Mo(y[h]);else Mo(y)}var Mm=Pm;function jr(){return function(){throw new Error("Unimplemented abstract method.")}()}var Q1=0;function Pi(y){return y.ol_uid||(y.ol_uid=String(++Q1))}var km="6.14.1";var Ev=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),wv=function(y){Ev(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.key=u,s.oldValue=r,s}return h}(ln);var eb=function(y){Ev(h,y);function h(n){var u=y.call(this)||this;return u.on,u.once,u.un,Pi(u),u.values_=null,n!==void 0&&u.setProperties(n),u}return h.prototype.get=function(n){var u;return this.values_&&this.values_.hasOwnProperty(n)&&(u=this.values_[n]),u},h.prototype.getKeys=function(){return this.values_&&Object.keys(this.values_)||[]},h.prototype.getProperties=function(){return this.values_&&Ra({},this.values_)||{}},h.prototype.hasProperties=function(){return!!this.values_},h.prototype.notify=function(n,u){var r;r="change:".concat(n),this.hasListener(r)&&this.dispatchEvent(new wv(r,n,u)),r=qp.PROPERTYCHANGE,this.hasListener(r)&&this.dispatchEvent(new wv(r,n,u))},h.prototype.addChangeListener=function(n,u){this.addEventListener("change:".concat(n),u)},h.prototype.removeChangeListener=function(n,u){this.removeEventListener("change:".concat(n),u)},h.prototype.set=function(n,u,r){var s=this.values_||(this.values_={});if(r)s[n]=u;else{var P=s[n];s[n]=u,P!==u&&this.notify(n,P)}},h.prototype.setProperties=function(n,u){for(var r in n)this.set(r,n[r],u)},h.prototype.applyProperties=function(n){!n.values_||Ra(this.values_||(this.values_={}),n.values_)},h.prototype.unset=function(n,u){if(this.values_&&n in this.values_){var r=this.values_[n];delete this.values_[n],Vl(this.values_)&&(this.values_=null),u||this.notify(n,r)}},h}(Mm),ko=eb;var tb=(y,h)=>{let n=new URL(y);return Object.entries(h||{}).forEach(([r,s])=>{s!=null&&n.searchParams.set(r,s)}),n},Xh=tb;var ay=class extends ko{constructor(n){super();this.url=n.url,this.apiKey=n.apiKey}fetch(n,u,r){if(!this.url)return Promise.reject(new Error(`No url defined for request to ${this.url}/${n}`));if(!this.url&&!this.apiKey&&!/key=/.test(this.url))return Promise.reject(new Error(`No apiKey defined for request to ${this.url}`));let s=u||{},P=Xh(`${this.url}${n||""}`,{key:this.apiKey,...s});return fetch(P.toString(),r).then(z=>{try{return z.json().then(F=>{if(F.error)throw new Error(F.error);return F})}catch(F){return Promise.reject(new Error(F))}})}},Lm=ay;var sy=class extends Lm{constructor(h={}){super({url:"https://api.geops.io/routing/v1/",...h})}route(h,n){return this.fetch("",h,n)}},qf=sy;var ly=class extends Lm{constructor(h={}){super({url:"https://api.geops.io/stops/v1/",...h})}search(h,n){return this.fetch("",h,n)}},Zf=ly;var Xp=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(h,n={}){let u=`${h} ${n.channel}`;return u+=n.args?` ${n.args}`:"",u+=n.id?` ${n.id}`:"",u.trim()}connect(h,n=()=>{}){if(this.websocket&&!this.closed){if(!this.closing&&this.websocket.url!==h)this.websocket.close();else if(this.connecting)return}this.websocket=new WebSocket(h),this.open?(n(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{n(),this.subscribePreviousSubscriptions()})}close(){this.websocket&&(this.open||this.connecting)&&(this.websocket.onclose=()=>{},this.websocket.close(),this.messagesOnOpen=[])}send(h){if(!this.websocket)return;let n=()=>{this.websocket?.send(h)};this.open?this.messagesOnOpen.includes(h)||n():this.messagesOnOpen.includes(h)||(this.messagesOnOpen.push(h),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],n()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}addEvents(h,n){this.websocket&&(this.websocket.addEventListener("message",h),n&&(this.websocket.addEventListener("error",n),this.websocket.addEventListener("close",n)))}removeEvents(h,n){this.websocket&&(this.websocket.removeEventListener("message",h),n&&(this.websocket.removeEventListener("error",n),this.websocket.removeEventListener("close",n)))}listen(h,n,u){this.unlisten(h,n);let r=s=>{let P;try{P=JSON.parse(s.data)}catch(V){console.error("WebSocket: unable to parse JSON data",V,s.data);return}let z=h.channel;z+=h.args?` ${h.args}`:"";let F;P.source==="buffer"?F=P.content:F=[P],F.forEach(V=>{V?.source===z&&(!h.id||h.id===P.client_reference)&&n(V)})};return this.addEvents(r,u),{onMessageCb:r,onErrorCb:u}}unlisten(h,n){[...this.subscriptions||[],...this.requests||[]].filter(u=>u.params.channel===h.channel&&(!n||u.cb===n)).forEach(({onMessageCb:u,onErrorCb:r})=>{this.removeEvents(u,r)})}get(h,n,u){let r=Xp.getRequestString("GET",h);this.send(r);let s=N=>(...me)=>{N(...me);let ve=this.requests.findIndex(et=>r===et.requestString&&n===et.cb),{onMessageCb:Se,onErrorCb:Ue}=this.requests[ve];this.removeEvents(Se,Ue),this.requests.splice(ve,1)},{onMessageCb:P,onErrorCb:z}=this.listen(h,s(n),u&&s(u));this.requests||(this.requests=[]);let F=this.requests.findIndex(N=>r===N.requestString&&n===N.cb),V={params:h,requestString:r,cb:n,errorCb:u,onMessageCb:P,onErrorCb:z};F>-1?this.requests[F]=V:this.requests.push(V)}subscribe(h,n,u,r=!1){let{onMessageCb:s,onErrorCb:P}=this.listen(h,n,u),z=Xp.getRequestString("",h),F=this.subscriptions.findIndex(N=>h.channel===N.params.channel&&n===N.cb),V={params:h,cb:n,errorCb:u,onMessageCb:s,onErrorCb:P,quiet:r};F>-1?this.subscriptions[F]=V:this.subscriptions.push(V),this.subscribed[z]||(V.quiet||(this.send(`GET ${z}`),this.send(`SUB ${z}`)),this.subscribed[z]=!0)}unsubscribe(h,n){let u=this.subscriptions.filter(r=>r.params.channel===h&&(!n||r.cb===n));u.forEach(({onMessageCb:r,onErrorCb:s})=>{this.removeEvents(r,s)}),this.subscriptions=this.subscriptions.filter(r=>r.params.channel!==h||n&&r.cb!==n),h&&this.subscribed[h]&&!this.subscriptions.find(r=>r.params.channel===h)&&u.find(r=>!r.quiet)&&(this.send(`DEL ${h}`),this.subscribed[h]=!1)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(h=>{this.subscribed[h]=!1}),[...this.subscriptions].forEach(h=>{this.subscribe(h.params,h.cb,h.errorCb,h.quiet)})}},Tv=Xp;var rb=(y,h,n=100)=>{let u={},r={},s=[];return P=>{let{source:z,content:F}=P;u[z]&&window.clearTimeout(u[z]),h?r[h(F)]=F:s.push(F),u[z]=window.setTimeout(()=>{let V=h?Object.values(r):s;y(V)},n)}},Xf=rb;var ib=(y,h,n)=>{let u=["","schematic"];return n&&u.push(n),y===h.SCHEMATIC?u.join("_"):""},bu=ib;var qo={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},uy=class{constructor(h={}){this.defineProperties(h),this.tenant=h.tenant,this.onOpen=this.onOpen.bind(this)}defineProperties(h){let n=h;typeof h=="string"&&(n={url:h});let{apiKey:u}=n,{url:r,projection:s,bbox:P,buffer:z=[100,100]}=n,F=new Tv;r||(r="wss://api.geops.io/tracker-ws/v1/"),u&&(r=`${r}?key=${u}`),Object.defineProperties(this,{url:{get:()=>r,set:V=>{r=V,this.open()}},projection:{get:()=>s,set:V=>{V!==s&&(s=V,this.wsApi&&this.wsApi.send(`PROJECTION ${s}`))}},bbox:{get:()=>P,set:V=>{JSON.stringify(V)!==JSON.stringify(P)&&(P=V,this.wsApi&&P&&this.wsApi.send(`BBOX ${P.join(" ")}`))}},buffer:{get:()=>z,set:V=>{JSON.stringify(V)!==JSON.stringify(z)&&(z=V,this.wsApi&&this.wsApi.send(`BUFFER ${z.join(" ")}`))}},wsApi:{value:F,writable:!0},pingIntervalMs:{value:h.pingIntervalMs||1e4,writable:!0},reconnectTimeoutMs:{value:h.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(h,n,u=()=>{},r=!1){!h||!n||this.wsApi.subscribe({channel:h},n,u,r)}unsubscribe(h,n="",u){let r=bu(qo.SCHEMATIC,qo,this.tenant),s=bu(qo.TOPOGRAPHIC,qo,this.tenant);this.wsApi.unsubscribe(`${h}${r}${n||""}`,u),this.wsApi.unsubscribe(`${h}${s}${n||""}`,u)}subscribeDepartures(h,n,u=()=>{},r=!1){this.subscribe(`timetable_${h}`,n,u,r)}unsubscribeDepartures(h,n){this.unsubscribe(`timetable_${h}`,"",n)}subscribeDisruptions(h,n=()=>{},u=!1){let r=[this.tenant,"newsticker"];this.subscribe(r.join("_"),h,n,u)}unsubscribeDisruptions(h){let n=[this.tenant,"newsticker"];this.unsubscribe(n.join("_"),"",h)}getStation(h,n){let u={channel:`station${bu(n,qo,this.tenant)}`,args:h};return new Promise((r,s)=>{this.wsApi.get(u,r,s)})}getStations(h,n=100){return new Promise(u=>{this.wsApi.get({channel:`station${bu(h,qo,this.tenant)}`},Xf(u,void 0,n))})}subscribeStations(h,n,u=()=>{},r=!1){this.subscribe(`station${bu(h,qo,this.tenant)}`,n,u,r)}unsubscribeStations(h){this.unsubscribe("station","",h)}subscribeExtraGeoms(h,n=()=>{},u=!1){this.subscribe("extra_geoms",h,n,u)}unsubscribeExtraGeoms(h){this.unsubscribe("extra_geoms","",h)}subscribeTrajectory(h,n,u=()=>{},r=!1){this.unsubscribeTrajectory(n),this.subscribe(`trajectory${bu(h,qo,this.tenant)}`,n,u,r)}unsubscribeTrajectory(h){this.unsubscribe("trajectory","",h)}subscribeDeletedVehicles(h,n,u=()=>{},r=!1){this.unsubscribeDeletedVehicles(n),this.subscribe(`deleted_vehicles${bu(h,qo,this.tenant)}`,n,u,r)}unsubscribeDeletedVehicles(h){this.unsubscribe("deleted_vehicles","",h)}getFullTrajectory(h,n,u){let r=[`full_trajectory${bu(n,qo)}`];h&&r.push(h),(!n||n===qo.TOPOGRAPHIC)&&u&&r.push(`gen${u}`);let s={channel:r.join("_")};return new Promise((P,z)=>{this.wsApi.get(s,P,z)})}subscribeFullTrajectory(h,n,u,r=()=>{},s=!1){this.subscribe(`full_trajectory${bu(n,qo)}_${h}`,u,r,s)}unsubscribeFullTrajectory(h,n){this.unsubscribe("full_trajectory",`_${h}`,n)}getStopSequence(h){return new Promise((n,u)=>{this.wsApi.get({channel:`stopsequence_${h}`},n,u)})}subscribeStopSequence(h,n,u=()=>{},r=!1){this.subscribe(`stopsequence_${h}`,n,u,r)}unsubscribeStopSequence(h,n){this.unsubscribe("stopsequence",`_${h}`,n)}subscribeHealthCheck(h,n=()=>{},u=!1){this.subscribe("healthcheck",h,n,u)}unsubscribeHealthCheck(h){this.unsubscribe("healthcheck","",h)}},Wf=uy;var nb=y=>{let h=y.filter(s=>s!=null&&s.trim&&s.trim()),n=h.map(s=>s.toLowerCase());return[...new Set(n)].map(s=>h.find(P=>P.toLowerCase()===s))},Wh=nb;var ob=y=>{if(!y)return[];let{style:h}=y;if(!h)return[];let{sourceCaches:n}=h,u=[];return Object.values(n).forEach(r=>{if(r.used){let s=r.getSource(),P=s.attribution||s.options&&s.options.attribution;P&&(u=u.concat(P.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),Wh(u)},ac=ob;var ab=(y,h,n,u)=>{let r=[];if(!y&&!h&&!n&&!u)return null;if(u){let s=typeof u=="string"?[u]:u,P=z=>{let F=z.properties.name||z.properties.line&&z.properties.line.name||"";return F?s.some(V=>new RegExp(V,"i").test(F)):!1};r.push(P)}if(y){let P=(typeof y=="string"?y.split(","):y).map(F=>F.replace(/\s+/g,"").toUpperCase()),z=F=>{let{line:V,name:N}=F.properties,me=(N||V&&V.name||"").toUpperCase();return me?P.includes(me):!1};r.push(z)}if(h){let P=(typeof h=="string"?h.split(","):h).map(F=>parseInt(F,10)),z=F=>{let V=F.properties.route_identifier||F.properties.routeIdentifier||"",N=parseInt(V.split(".")[0],10);return P.includes(N)};r.push(z)}if(n){let s=typeof n=="string"?[n]:n,P=z=>s.some(F=>{let V=z.properties.operator||z.properties.tenant||"";return new RegExp(F,"i").test(V)});r.push(P)}return r.length?s=>{for(let P=0;P<r.length;P+=1)if(!r[P](s))return!1;return!0}:null},cy=ab;var Sv=y=>{let h=y;Array.isArray(h)||(h=[y]);let n=[];return h.forEach(u=>{n.push(u);let{children:r}=u;n=n.concat(Sv(r||[]))}),n},$f=Sv;var Iv=(y=new Date)=>{let h=(y.getUTCMonth()+1).toString();h=h.length===1?`0${h}`:h;let n=y.getUTCDate().toString();return n=n.length===1?`0${n}`:n,[y.getUTCFullYear(),h,n].join("")},Cv=y=>[y.getUTCHours(),y.getUTCMinutes(),`${y.getUTCSeconds()}.${y.getUTCMilliseconds()}`].join(":"),Rm=y=>y<10?`0${y}`:`${y}`,Av=y=>{if(!y||y<=0)return"";let h=new Date(y);return`${Rm(h.getHours())}:${Rm(h.getMinutes())}`};var sb=(y,h)=>{let n=y.properties,u=h.properties;return n.delay===null&&u.delay!==null?1:u.delay===null&&n.delay!==null?-1:n.cancelled&&!u.cancelled?u.delay<18e4?-1:1:u.cancelled&&!n.cancelled?n.delay<18e4?1:-1:u.delay-n.delay},hy=sb;var oh=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",TS=oh.indexOf("firefox")!==-1,lb=oh.indexOf("safari")!==-1&&oh.indexOf("chrom")==-1,SS=lb&&!!(oh.indexOf("version/15.4")>=0||oh.match(/cpu (os|iphone os) 15_4 like mac os x/)),IS=oh.indexOf("webkit")!==-1&&oh.indexOf("edge")==-1,CS=oh.indexOf("macintosh")!==-1;var ah=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Pv=typeof Image<"u"&&Image.prototype.decode,AS=function(){var y=!1;try{var h=Object.defineProperty({},"passive",{get:function(){y=!0}});window.addEventListener("_",null,h),window.removeEventListener("_",null,h)}catch{}return y}();var ub=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),cb=function(y){ub(h,y);function h(n){var u=this,r=km==="latest"?km:"v"+km.split("-")[0],s="Assertion failed. See https://openlayers.org/en/"+r+"/doc/errors/#"+n+" for details.";return u=y.call(this,s)||this,u.code=n,u.name="AssertionError",u.message=s,u}return h}(Error),zm=cb;function En(y,h){if(!y)throw new zm(h)}var OS=new Array(6);function za(){return[1,0,0,1,0,0]}function hb(y,h,n,u,r,s,P){return y[0]=h,y[1]=n,y[2]=u,y[3]=r,y[4]=s,y[5]=P,y}function kv(y,h){return y[0]=h[0],y[1]=h[1],y[2]=h[2],y[3]=h[3],y[4]=h[4],y[5]=h[5],y}function bo(y,h){var n=h[0],u=h[1];return h[0]=y[0]*n+y[2]*u+y[4],h[1]=y[1]*n+y[3]*u+y[5],h}function Lv(y,h,n){return hb(y,h,0,0,n,0,0)}function vs(y,h,n,u,r,s,P,z){var F=Math.sin(s),V=Math.cos(s);return y[0]=u*V,y[1]=r*F,y[2]=-u*F,y[3]=r*V,y[4]=P*u*V-z*u*F+h,y[5]=P*r*F+z*r*V+n,y}function Rv(y,h,n,u,r,s,P){return py(vs(za(),y,h,n,u,r,s,P))}function zv(y,h){var n=pb(h);En(n!==0,32);var u=h[0],r=h[1],s=h[2],P=h[3],z=h[4],F=h[5];return y[0]=P/n,y[1]=-r/n,y[2]=-s/n,y[3]=u/n,y[4]=(s*F-P*z)/n,y[5]=-(u*F-r*z)/n,y}function pb(y){return y[0]*y[3]-y[1]*y[2]}var Mv;function py(y){var h="matrix("+y.join(", ")+")";if(ah)return h;var n=Mv||(Mv=document.createElement("div"));return n.style.transform=h,n.style.transform}var Ot={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"};var Gl={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},US={9001:Gl.METERS,9002:Gl.FEET,9003:Gl.USFEET,9101:Gl.RADIANS,9102:Gl.DEGREES};var wu={};wu[Gl.RADIANS]=6370997/(2*Math.PI);wu[Gl.DEGREES]=2*Math.PI*6370997/360;wu[Gl.FEET]=.3048;wu[Gl.METERS]=1;wu[Gl.USFEET]=1200/3937;var sc=Gl;var Lo={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Eu(y){for(var h=Ya(),n=0,u=y.length;n<u;++n)fy(h,y[n]);return h}function fb(y,h,n){var u=Math.min.apply(null,y),r=Math.min.apply(null,h),s=Math.max.apply(null,y),P=Math.max.apply(null,h);return sh(u,r,s,P,n)}function gl(y,h,n){return n?(n[0]=y[0]-h,n[1]=y[1]-h,n[2]=y[2]+h,n[3]=y[3]+h,n):[y[0]-h,y[1]-h,y[2]+h,y[3]+h]}function Dv(y,h){return h?(h[0]=y[0],h[1]=y[1],h[2]=y[2],h[3]=y[3],h):y.slice()}function xs(y,h,n){var u,r;return h<y[0]?u=y[0]-h:y[2]<h?u=h-y[2]:u=0,n<y[1]?r=y[1]-n:y[3]<n?r=n-y[3]:r=0,u*u+r*r}function Wp(y,h){return Kf(y,h[0],h[1])}function lc(y,h){return y[0]<=h[0]&&h[2]<=y[2]&&y[1]<=h[1]&&h[3]<=y[3]}function Kf(y,h,n){return y[0]<=h&&h<=y[2]&&y[1]<=n&&n<=y[3]}function Dm(y,h){var n=y[0],u=y[1],r=y[2],s=y[3],P=h[0],z=h[1],F=Lo.UNKNOWN;return P<n?F=F|Lo.LEFT:P>r&&(F=F|Lo.RIGHT),z<u?F=F|Lo.BELOW:z>s&&(F=F|Lo.ABOVE),F===Lo.UNKNOWN&&(F=Lo.INTERSECTING),F}function Ya(){return[1/0,1/0,-1/0,-1/0]}function sh(y,h,n,u,r){return r?(r[0]=y,r[1]=h,r[2]=n,r[3]=u,r):[y,h,n,u]}function $p(y){return sh(1/0,1/0,-1/0,-1/0,y)}function Kp(y,h){var n=y[0],u=y[1];return sh(n,u,n,u,h)}function Om(y,h,n,u,r){var s=$p(r);return dy(s,y,h,n,u)}function Fm(y,h){return y[0]==h[0]&&y[2]==h[2]&&y[1]==h[1]&&y[3]==h[3]}function Ov(y,h){return h[0]<y[0]&&(y[0]=h[0]),h[2]>y[2]&&(y[2]=h[2]),h[1]<y[1]&&(y[1]=h[1]),h[3]>y[3]&&(y[3]=h[3]),y}function fy(y,h){h[0]<y[0]&&(y[0]=h[0]),h[0]>y[2]&&(y[2]=h[0]),h[1]<y[1]&&(y[1]=h[1]),h[1]>y[3]&&(y[3]=h[1])}function dy(y,h,n,u,r){for(;n<u;n+=r)db(y,h[n],h[n+1]);return y}function db(y,h,n){y[0]=Math.min(y[0],h),y[1]=Math.min(y[1],n),y[2]=Math.max(y[2],h),y[3]=Math.max(y[3],n)}function Fv(y,h){var n;return n=h(my(y)),n||(n=h(gy(y)),n)||(n=h(_y(y)),n)||(n=h(yy(y)),n)?n:!1}function my(y){return[y[0],y[1]]}function gy(y){return[y[2],y[1]]}function $h(y){return[(y[0]+y[2])/2,(y[1]+y[3])/2]}function Tu(y){return y[3]-y[1]}function Bv(y,h,n){var u=n||Ya();return Ro(y,h)?(y[0]>h[0]?u[0]=y[0]:u[0]=h[0],y[1]>h[1]?u[1]=y[1]:u[1]=h[1],y[2]<h[2]?u[2]=y[2]:u[2]=h[2],y[3]<h[3]?u[3]=y[3]:u[3]=h[3]):$p(u),u}function yy(y){return[y[0],y[3]]}function _y(y){return[y[2],y[3]]}function bs(y){return y[2]-y[0]}function Ro(y,h){return y[0]<=h[2]&&y[2]>=h[0]&&y[1]<=h[3]&&y[3]>=h[1]}function Uv(y,h){return h?(h[0]=y[0],h[1]=y[1],h[2]=y[2],h[3]=y[3],h):y}function Nv(y,h,n){var u=!1,r=Dm(y,h),s=Dm(y,n);if(r===Lo.INTERSECTING||s===Lo.INTERSECTING)u=!0;else{var P=y[0],z=y[1],F=y[2],V=y[3],N=h[0],me=h[1],ve=n[0],Se=n[1],Ue=(Se-me)/(ve-N),et=void 0,Ie=void 0;!!(s&Lo.ABOVE)&&!(r&Lo.ABOVE)&&(et=ve-(Se-V)/Ue,u=et>=P&&et<=F),!u&&!!(s&Lo.RIGHT)&&!(r&Lo.RIGHT)&&(Ie=Se-(ve-F)*Ue,u=Ie>=z&&Ie<=V),!u&&!!(s&Lo.BELOW)&&!(r&Lo.BELOW)&&(et=ve-(Se-z)/Ue,u=et>=P&&et<=F),!u&&!!(s&Lo.LEFT)&&!(r&Lo.LEFT)&&(Ie=Se-(ve-P)*Ue,u=Ie>=z&&Ie<=V)}return u}function Vv(y,h,n,u){var r=[];if(u>1)for(var s=y[2]-y[0],P=y[3]-y[1],z=0;z<u;++z)r.push(y[0]+s*z/u,y[1],y[2],y[1]+P*z/u,y[2]-s*z/u,y[3],y[0],y[3]-P*z/u);else r=[y[0],y[1],y[2],y[1],y[2],y[3],y[0],y[3]];h(r,r,2);for(var F=[],V=[],z=0,N=r.length;z<N;z+=2)F.push(r[z]),V.push(r[z+1]);return fb(F,V,n)}function Gv(y,h){var n=h.getExtent(),u=$h(y);if(h.canWrapX()&&(u[0]<n[0]||u[0]>=n[2])){var r=bs(n),s=Math.floor((u[0]-n[0])/r),P=s*r;y[0]-=P,y[2]-=P}return y}var mb=function(){function y(h){this.code_=h.code,this.units_=h.units,this.extent_=h.extent!==void 0?h.extent:null,this.worldExtent_=h.worldExtent!==void 0?h.worldExtent:null,this.axisOrientation_=h.axisOrientation!==void 0?h.axisOrientation:"enu",this.global_=h.global!==void 0?h.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=h.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=h.metersPerUnit}return y.prototype.canWrapX=function(){return this.canWrapX_},y.prototype.getCode=function(){return this.code_},y.prototype.getExtent=function(){return this.extent_},y.prototype.getUnits=function(){return this.units_},y.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||wu[this.units_]},y.prototype.getWorldExtent=function(){return this.worldExtent_},y.prototype.getAxisOrientation=function(){return this.axisOrientation_},y.prototype.isGlobal=function(){return this.global_},y.prototype.setGlobal=function(h){this.global_=h,this.canWrapX_=!!(h&&this.extent_)},y.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},y.prototype.setDefaultTileGrid=function(h){this.defaultTileGrid_=h},y.prototype.setExtent=function(h){this.extent_=h,this.canWrapX_=!!(this.global_&&h)},y.prototype.setWorldExtent=function(h){this.worldExtent_=h},y.prototype.setGetPointResolution=function(h){this.getPointResolutionFunc_=h},y.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},y}(),Bm=mb;function jl(y,h,n){return Math.min(Math.max(y,h),n)}var jv=function(){var y;return"cosh"in Math?y=Math.cosh:y=function(h){var n=Math.exp(h);return(n+1/n)/2},y}(),XS=function(){var y;return"log2"in Math?y=Math.log2:y=function(h){return Math.log(h)*Math.LOG2E},y}();function qv(y,h,n,u,r,s){var P=r-n,z=s-u;if(P!==0||z!==0){var F=((y-n)*P+(h-u)*z)/(P*P+z*z);F>1?(n=r,u=s):F>0&&(n+=P*F,u+=z*F)}return ql(y,h,n,u)}function ql(y,h,n,u){var r=n-y,s=u-h;return r*r+s*s}function Zv(y){return y*180/Math.PI}function Um(y,h){var n=y%h;return n*h<0?n+h:n}function yl(y,h,n){return y+n*(h-y)}var gb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Hf=6378137,Yp=Math.PI*Hf,yb=[-Yp,-Yp,Yp,Yp],_b=[-180,-85,180,85],Nm=Hf*Math.log(Math.tan(Math.PI/2)),Hp=function(y){gb(h,y);function h(n){return y.call(this,{code:n,units:sc.METERS,extent:yb,global:!0,worldExtent:_b,getPointResolution:function(u,r){return u/jv(r[1]/Hf)}})||this}return h}(Bm),vy=[new Hp("EPSG:3857"),new Hp("EPSG:102100"),new Hp("EPSG:102113"),new Hp("EPSG:900913"),new Hp("http://www.opengis.net/def/crs/EPSG/0/3857"),new Hp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Xv(y,h,n){var u=y.length,r=n>1?n:2,s=h;s===void 0&&(r>2?s=y.slice():s=new Array(u));for(var P=0;P<u;P+=r){s[P]=Yp*y[P]/180;var z=Hf*Math.log(Math.tan(Math.PI*(+y[P+1]+90)/360));z>Nm?z=Nm:z<-Nm&&(z=-Nm),s[P+1]=z}return s}function Wv(y,h,n){var u=y.length,r=n>1?n:2,s=h;s===void 0&&(r>2?s=y.slice():s=new Array(u));for(var P=0;P<u;P+=r)s[P]=180*y[P]/Yp,s[P+1]=360*Math.atan(Math.exp(y[P+1]/Hf))/Math.PI-90;return s}var vb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xb=6378137,$v=[-180,-90,180,90],bb=Math.PI*xb/180,Kh=function(y){vb(h,y);function h(n,u){return y.call(this,{code:n,units:sc.DEGREES,extent:$v,axisOrientation:u,global:!0,metersPerUnit:bb,worldExtent:$v})||this}return h}(Bm),xy=[new Kh("CRS:84"),new Kh("EPSG:4326","neu"),new Kh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Kh("urn:ogc:def:crs:OGC:2:84"),new Kh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Kh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Kh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var by={};function Kv(y){return by[y]||by[y.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Hv(y,h){by[y]=h}var Jp={};function Yf(y,h,n){var u=y.getCode(),r=h.getCode();u in Jp||(Jp[u]={}),Jp[u][r]=n}function Yv(y,h){var n;return y in Jp&&h in Jp[y]&&(n=Jp[y][h]),n}function wy(y,h){var n=y[0],u=y[1],r=h[0],s=h[1],P=r[0],z=r[1],F=s[0],V=s[1],N=F-P,me=V-z,ve=N===0&&me===0?0:(N*(n-P)+me*(u-z))/(N*N+me*me||0),Se,Ue;return ve<=0?(Se=P,Ue=z):ve>=1?(Se=F,Ue=V):(Se=P+ve*N,Ue=z+ve*me),[Se,Ue]}function Su(y,h){for(var n=!0,u=y.length-1;u>=0;--u)if(y[u]!=h[u]){n=!1;break}return n}function Qp(y,h){var n=y[0]-h[0],u=y[1]-h[1];return n*n+u*u}function Ey(y,h){return Math.sqrt(Qp(y,h))}function Jv(y,h){return Qp(y,wy(y,h))}function Qv(y,h){if(h.canWrapX()){var n=bs(h.getExtent()),u=ex(y,h,n);u&&(y[0]-=u*n)}return y}function ex(y,h,n){var u=h.getExtent(),r=0;if(h.canWrapX()&&(y[0]<u[0]||y[0]>u[2])){var s=n||bs(u);r=Math.floor((y[0]-u[0])/s)}return r}var Ty=!0;function wb(y){var h=y===void 0?!0:y;Ty=!h}function Sy(y,h,n){var u;if(h!==void 0){for(var r=0,s=y.length;r<s;++r)h[r]=y[r];u=h}else u=y.slice();return u}function Eb(y,h,n){if(h!==void 0&&y!==h){for(var u=0,r=y.length;u<r;++u)h[u]=y[u];y=h}return y}function Tb(y){Hv(y.getCode(),y),Yf(y,y,Sy)}function Sb(y){y.forEach(Tb)}function ya(y){return typeof y=="string"?Kv(y):y||null}function tx(y){Sb(y),y.forEach(function(h){y.forEach(function(n){h!==n&&Yf(h,n,Sy)})})}function Ib(y,h,n,u){y.forEach(function(r){h.forEach(function(s){Yf(r,s,n),Yf(s,r,u)})})}function uo(y,h){return wb(),Gm(y,"EPSG:4326",h!==void 0?h:"EPSG:3857")}function lh(y,h){var n=Gm(y,h!==void 0?h:"EPSG:3857","EPSG:4326"),u=n[0];return(u<-180||u>180)&&(n[0]=Um(u+180,360)-180),n}function rx(y,h){if(y===h)return!0;var n=y.getUnits()===h.getUnits();if(y.getCode()===h.getCode())return n;var u=Vm(y,h);return u===Sy&&n}function Vm(y,h){var n=y.getCode(),u=h.getCode(),r=Yv(n,u);return r||(r=Eb),r}function Jf(y,h){var n=ya(y),u=ya(h);return Vm(n,u)}function Gm(y,h,n){var u=Jf(h,n);return u(y,void 0,y.length)}function Qf(y,h,n,u){var r=Jf(h,n);return Vv(y,r,void 0,u)}var Zl=null;function uh(){return Zl}function Iy(y,h){return Zl?Gm(y,h,Zl):y}function Xl(y,h){return Zl?Gm(y,Zl,h):(Ty&&!Su(y,[0,0])&&y[0]>=-180&&y[0]<=180&&y[1]>=-90&&y[1]<=90&&(Ty=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),y)}function ef(y,h){return Zl?Qf(y,h,Zl):y}function ed(y,h){return Zl?Qf(y,Zl,h):y}function ix(y,h){if(!Zl)return y;var n=ya(h).getUnits(),u=Zl.getUnits();return n&&u?y*wu[n]/wu[u]:y}function Cb(){tx(vy),tx(xy),Ib(xy,vy,Xv,Wv)}Cb();function _l(y,h,n,u,r,s){for(var P=s||[],z=0,F=h;F<n;F+=u){var V=y[F],N=y[F+1];P[z++]=r[0]*V+r[2]*N+r[4],P[z++]=r[1]*V+r[3]*N+r[5]}return s&&P.length!=z&&(P.length=z),P}function jm(y,h,n,u,r,s,P){for(var z=P||[],F=Math.cos(r),V=Math.sin(r),N=s[0],me=s[1],ve=0,Se=h;Se<n;Se+=u){var Ue=y[Se]-N,et=y[Se+1]-me;z[ve++]=N+Ue*F-et*V,z[ve++]=me+Ue*V+et*F;for(var Ie=Se+2;Ie<Se+u;++Ie)z[ve++]=y[Ie]}return P&&z.length!=ve&&(z.length=ve),z}function nx(y,h,n,u,r,s,P,z){for(var F=z||[],V=P[0],N=P[1],me=0,ve=h;ve<n;ve+=u){var Se=y[ve]-V,Ue=y[ve+1]-N;F[me++]=V+r*Se,F[me++]=N+s*Ue;for(var et=ve+2;et<ve+u;++et)F[me++]=y[et]}return z&&F.length!=me&&(F.length=me),F}function ox(y,h,n,u,r,s,P){for(var z=P||[],F=0,V=h;V<n;V+=u){z[F++]=y[V]+r,z[F++]=y[V+1]+s;for(var N=V+2;N<V+u;++N)z[F++]=y[N]}return P&&z.length!=F&&(z.length=F),z}var Ab=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),ax=za(),Pb=function(y){Ab(h,y);function h(){var n=y.call(this)||this;return n.extent_=Ya(),n.extentRevision_=-1,n.simplifiedGeometryMaxMinSquaredTolerance=0,n.simplifiedGeometryRevision=0,n.simplifyTransformedInternal=bv(function(u,r,s){if(!s)return this.getSimplifiedGeometry(r);var P=this.clone();return P.applyTransform(s),P.getSimplifiedGeometry(r)}),n}return h.prototype.simplifyTransformed=function(n,u){return this.simplifyTransformedInternal(this.getRevision(),n,u)},h.prototype.clone=function(){return jr()},h.prototype.closestPointXY=function(n,u,r,s){return jr()},h.prototype.containsXY=function(n,u){var r=this.getClosestPoint([n,u]);return r[0]===n&&r[1]===u},h.prototype.getClosestPoint=function(n,u){var r=u||[NaN,NaN];return this.closestPointXY(n[0],n[1],r,1/0),r},h.prototype.intersectsCoordinate=function(n){return this.containsXY(n[0],n[1])},h.prototype.computeExtent=function(n){return jr()},h.prototype.getExtent=function(n){if(this.extentRevision_!=this.getRevision()){var u=this.computeExtent(this.extent_);(isNaN(u[0])||isNaN(u[1]))&&$p(u),this.extentRevision_=this.getRevision()}return Uv(this.extent_,n)},h.prototype.rotate=function(n,u){jr()},h.prototype.scale=function(n,u,r){jr()},h.prototype.simplify=function(n){return this.getSimplifiedGeometry(n*n)},h.prototype.getSimplifiedGeometry=function(n){return jr()},h.prototype.getType=function(){return jr()},h.prototype.applyTransform=function(n){jr()},h.prototype.intersectsExtent=function(n){return jr()},h.prototype.translate=function(n,u){jr()},h.prototype.transform=function(n,u){var r=ya(n),s=r.getUnits()==sc.TILE_PIXELS?function(P,z,F){var V=r.getExtent(),N=r.getWorldExtent(),me=Tu(N)/Tu(V);return vs(ax,N[0],N[3],me,-me,0,0,0),_l(P,0,P.length,F,ax,z),Jf(r,u)(P,z,F)}:Jf(r,u);return this.applyTransform(s),this},h}(ko),qm=Pb;var Pn={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"};var Mb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),kb=function(y){Mb(h,y);function h(){var n=y.call(this)||this;return n.layout=Pn.XY,n.stride=2,n.flatCoordinates=null,n}return h.prototype.computeExtent=function(n){return Om(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},h.prototype.getCoordinates=function(){return jr()},h.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},h.prototype.getFlatCoordinates=function(){return this.flatCoordinates},h.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},h.prototype.getLayout=function(){return this.layout},h.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var u=this.getSimplifiedGeometryInternal(n),r=u.getFlatCoordinates();return r.length<this.flatCoordinates.length?u:(this.simplifiedGeometryMaxMinSquaredTolerance=n,this)},h.prototype.getSimplifiedGeometryInternal=function(n){return this},h.prototype.getStride=function(){return this.stride},h.prototype.setFlatCoordinates=function(n,u){this.stride=sx(n),this.layout=n,this.flatCoordinates=u},h.prototype.setCoordinates=function(n,u){jr()},h.prototype.setLayout=function(n,u,r){var s;if(n)s=sx(n);else{for(var P=0;P<r;++P)if(u.length===0){this.layout=Pn.XY,this.stride=2;return}else u=u[0];s=u.length,n=Lb(s)}this.layout=n,this.stride=s},h.prototype.applyTransform=function(n){this.flatCoordinates&&(n(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},h.prototype.rotate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();jm(r,0,r.length,s,n,u,r),this.changed()}},h.prototype.scale=function(n,u,r){var s=u;s===void 0&&(s=n);var P=r;P||(P=$h(this.getExtent()));var z=this.getFlatCoordinates();if(z){var F=this.getStride();nx(z,0,z.length,F,n,s,P,z),this.changed()}},h.prototype.translate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();ox(r,0,r.length,s,n,u,r),this.changed()}},h}(qm);function Lb(y){var h;return y==2?h=Pn.XY:y==3?h=Pn.XYZ:y==4&&(h=Pn.XYZM),h}function sx(y){var h;return y==Pn.XY?h=2:y==Pn.XYZ||y==Pn.XYM?h=3:y==Pn.XYZM&&(h=4),h}function lx(y,h,n){var u=y.getFlatCoordinates();if(u){var r=y.getStride();return _l(u,0,u.length,r,h,n)}else return null}var ws=kb;function ux(y,h,n,u){for(var r=0,s=n.length;r<s;++r)y[h++]=n[r];return h}function Hh(y,h,n,u){for(var r=0,s=n.length;r<s;++r)for(var P=n[r],z=0;z<u;++z)y[h++]=P[z];return h}function td(y,h,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var V=Hh(y,h,n[z],u);s[P++]=V,h=V}return s.length=P,s}function cx(y,h,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var V=td(y,h,n[z],u,s[P]);s[P++]=V,h=V[V.length-1]}return s.length=P,s}var Rb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),zb=function(y){Rb(h,y);function h(n){var u=y.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return h.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Mo),this.changeEventsKeys_.length=0},h.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(lo(this.geometries_[n],en.CHANGE,this.changed,this))},h.prototype.clone=function(){var n=new h(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.geometries_,z=0,F=P.length;z<F;++z)s=P[z].closestPointXY(n,u,r,s);return s},h.prototype.containsXY=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(n,u))return!0;return!1},h.prototype.computeExtent=function(n){$p(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)Ov(n,u[r].getExtent());return n},h.prototype.getGeometries=function(){return hx(this.geometries_)},h.prototype.getGeometriesArray=function(){return this.geometries_},h.prototype.getGeometriesArrayRecursive=function(){for(var n=[],u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].getType()===this.getType()?n=n.concat(u[r].getGeometriesArrayRecursive()):n.push(u[r]);return n},h.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var u=[],r=this.geometries_,s=!1,P=0,z=r.length;P<z;++P){var F=r[P],V=F.getSimplifiedGeometry(n);u.push(V),V!==F&&(s=!0)}if(s){var N=new h(null);return N.setGeometriesArray(u),N}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},h.prototype.getType=function(){return Ot.GEOMETRY_COLLECTION},h.prototype.intersectsExtent=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)if(u[r].intersectsExtent(n))return!0;return!1},h.prototype.isEmpty=function(){return this.geometries_.length===0},h.prototype.rotate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(n,u);this.changed()},h.prototype.scale=function(n,u,r){var s=r;s||(s=$h(this.getExtent()));for(var P=this.geometries_,z=0,F=P.length;z<F;++z)P[z].scale(n,u,s);this.changed()},h.prototype.setGeometries=function(n){this.setGeometriesArray(hx(n))},h.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},h.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},h.prototype.translate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(n,u);this.changed()},h.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},h}(qm);function hx(y){for(var h=[],n=0,u=y.length;n<u;++n)h.push(y[n].clone());return h}var px=zb;function fx(y,h,n,u,r,s,P){var z=y[h],F=y[h+1],V=y[n]-z,N=y[n+1]-F,me;if(V===0&&N===0)me=h;else{var ve=((r-z)*V+(s-F)*N)/(V*V+N*N);if(ve>1)me=n;else if(ve>0){for(var Se=0;Se<u;++Se)P[Se]=yl(y[h+Se],y[n+Se],ve);P.length=u;return}else me=h}for(var Se=0;Se<u;++Se)P[Se]=y[me+Se];P.length=u}function rd(y,h,n,u,r){var s=y[h],P=y[h+1];for(h+=u;h<n;h+=u){var z=y[h],F=y[h+1],V=ql(s,P,z,F);V>r&&(r=V),s=z,P=F}return r}function id(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=rd(y,h,z,u,r),h=z}return r}function dx(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=id(y,h,z,u,r),h=z[z.length-1]}return r}function nd(y,h,n,u,r,s,P,z,F,V,N){if(h==n)return V;var me,ve;if(r===0)if(ve=ql(P,z,y[h],y[h+1]),ve<V){for(me=0;me<u;++me)F[me]=y[h+me];return F.length=u,ve}else return V;for(var Se=N||[NaN,NaN],Ue=h+u;Ue<n;)if(fx(y,Ue-u,Ue,u,P,z,Se),ve=ql(P,z,Se[0],Se[1]),ve<V){for(V=ve,me=0;me<u;++me)F[me]=Se[me];F.length=u,Ue+=u}else Ue+=u*Math.max((Math.sqrt(ve)-Math.sqrt(V))/r|0,1);if(s&&(fx(y,n-u,h,u,P,z,Se),ve=ql(P,z,Se[0],Se[1]),ve<V)){for(V=ve,me=0;me<u;++me)F[me]=Se[me];F.length=u}return V}function od(y,h,n,u,r,s,P,z,F,V,N){for(var me=N||[NaN,NaN],ve=0,Se=n.length;ve<Se;++ve){var Ue=n[ve];V=nd(y,h,Ue,u,r,s,P,z,F,V,me),h=Ue}return V}function mx(y,h,n,u,r,s,P,z,F,V,N){for(var me=N||[NaN,NaN],ve=0,Se=n.length;ve<Se;++ve){var Ue=n[ve];V=od(y,h,Ue,u,r,s,P,z,F,V,me),h=Ue[Ue.length-1]}return V}function ad(y,h,n,u,r,s,P){var z=(n-h)/u;if(z<3){for(;h<n;h+=u)s[P++]=y[h],s[P++]=y[h+1];return P}var F=new Array(z);F[0]=1,F[z-1]=1;for(var V=[h,n-u],N=0;V.length>0;){for(var me=V.pop(),ve=V.pop(),Se=0,Ue=y[ve],et=y[ve+1],Ie=y[me],Ne=y[me+1],He=ve+u;He<me;He+=u){var nt=y[He],mt=y[He+1],ht=qv(nt,mt,Ue,et,Ie,Ne);ht>Se&&(N=He,Se=ht)}Se>r&&(F[(N-h)/u]=1,ve+u<N&&V.push(ve,N),N+u<me&&V.push(N,me))}for(var He=0;He<z;++He)F[He]&&(s[P++]=y[h+He*u],s[P++]=y[h+He*u+1]);return P}function gx(y,h,n,u,r,s,P,z){for(var F=0,V=n.length;F<V;++F){var N=n[F];P=ad(y,h,N,u,r,s,P),z.push(P),h=N}return P}function ch(y,h){return h*Math.round(y/h)}function Db(y,h,n,u,r,s,P){if(h==n)return P;var z=ch(y[h],r),F=ch(y[h+1],r);h+=u,s[P++]=z,s[P++]=F;var V,N;do if(V=ch(y[h],r),N=ch(y[h+1],r),h+=u,h==n)return s[P++]=V,s[P++]=N,P;while(V==z&&N==F);for(;h<n;){var me=ch(y[h],r),ve=ch(y[h+1],r);if(h+=u,!(me==V&&ve==N)){var Se=V-z,Ue=N-F,et=me-z,Ie=ve-F;if(Se*Ie==Ue*et&&(Se<0&&et<Se||Se==et||Se>0&&et>Se)&&(Ue<0&&Ie<Ue||Ue==Ie||Ue>0&&Ie>Ue)){V=me,N=ve;continue}s[P++]=V,s[P++]=N,z=V,F=N,V=me,N=ve}}return s[P++]=V,s[P++]=N,P}function Cy(y,h,n,u,r,s,P,z){for(var F=0,V=n.length;F<V;++F){var N=n[F];P=Db(y,h,N,u,r,s,P),z.push(P),h=N}return P}function yx(y,h,n,u,r,s,P,z){for(var F=0,V=n.length;F<V;++F){var N=n[F],me=[];P=Cy(y,h,N,u,r,s,P,me),z.push(me),h=N[N.length-1]}return P}function vl(y,h,n,u,r){for(var s=r!==void 0?r:[],P=0,z=h;z<n;z+=u)s[P++]=y.slice(z,z+u);return s.length=P,s}function hh(y,h,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var V=n[z];s[P++]=vl(y,h,V,u,s[P]),h=V}return s.length=P,s}function sd(y,h,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var V=n[z];s[P++]=hh(y,h,V,u,s[P]),h=V[V.length-1]}return s.length=P,s}function Ay(y,h,n,u){for(var r=0,s=y[n-u],P=y[n-u+1];h<n;h+=u){var z=y[h],F=y[h+1];r+=P*z-s*F,s=z,P=F}return r/2}function Py(y,h,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Ay(y,h,z,u),h=z}return r}function _x(y,h,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Py(y,h,z,u),h=z[z.length-1]}return r}var Ob=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Fb=function(y){Ob(h,y);function h(n,u){var r=y.call(this)||this;return r.maxDelta_=-1,r.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return h.prototype.clone=function(){return new h(this.flatCoordinates.slice(),this.layout)},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,n,u,r,s))},h.prototype.getArea=function(){return Ay(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=ad(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new h(u,Pn.XY)},h.prototype.getType=function(){return Ot.LINEAR_RING},h.prototype.intersectsExtent=function(n){return!1},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Hh(this.flatCoordinates,0,n,this.stride),this.changed()},h}(ws),My=Fb;function Zm(y,h,n,u,r){var s;for(h+=u;h<n;h+=u)if(s=r(y.slice(h-u,h),y.slice(h,h+u)),s)return s;return!1}function Wm(y,h,n,u,r,s,P){var z,F,V=(n-h)/u;if(V===1)z=h;else if(V===2)z=h,F=r;else if(V!==0){for(var N=y[h],me=y[h+1],ve=0,Se=[0],Ue=h+u;Ue<n;Ue+=u){var et=y[Ue],Ie=y[Ue+1];ve+=Math.sqrt((et-N)*(et-N)+(Ie-me)*(Ie-me)),Se.push(ve),N=et,me=Ie}var Ne=r*ve,He=_v(Se,Ne);He<0?(F=(Ne-Se[-He-2])/(Se[-He-1]-Se[-He-2]),z=h+(-He-2)*u):z=h+He*u}for(var nt=P>1?P:2,mt=s||new Array(nt),Ue=0;Ue<nt;++Ue)mt[Ue]=z===void 0?NaN:F===void 0?y[z+Ue]:yl(y[z+Ue],y[z+u+Ue],F);return mt}function Xm(y,h,n,u,r,s){if(n==h)return null;var P;if(r<y[h+u-1])return s?(P=y.slice(h,h+u),P[u-1]=r,P):null;if(y[n-1]<r)return s?(P=y.slice(n-u,n),P[u-1]=r,P):null;if(r==y[h+u-1])return y.slice(h,h+u);for(var z=h/u,F=n/u;z<F;){var V=z+F>>1;r<y[(V+1)*u-1]?F=V:z=V+1}var N=y[z*u-1];if(r==N)return y.slice((z-1)*u,(z-1)*u+u);var me=y[(z+1)*u-1],ve=(r-N)/(me-N);P=[];for(var Se=0;Se<u-1;++Se)P.push(yl(y[(z-1)*u+Se],y[z*u+Se],ve));return P.push(r),P}function vx(y,h,n,u,r,s,P){if(P)return Xm(y,h,n[n.length-1],u,r,s);var z;if(r<y[u-1])return s?(z=y.slice(0,u),z[u-1]=r,z):null;if(y[y.length-1]<r)return s?(z=y.slice(y.length-u),z[u-1]=r,z):null;for(var F=0,V=n.length;F<V;++F){var N=n[F];if(h!=N){if(r<y[h+u-1])return null;if(r<=y[N-1])return Xm(y,h,N,u,r,!1);h=N}}return null}function xx(y,h,n,u,r){var s=Fv(r,function(P){return!ph(y,h,n,u,P[0],P[1])});return!s}function ph(y,h,n,u,r,s){for(var P=0,z=y[n-u],F=y[n-u+1];h<n;h+=u){var V=y[h],N=y[h+1];F<=s?N>s&&(V-z)*(s-F)-(r-z)*(N-F)>0&&P++:N<=s&&(V-z)*(s-F)-(r-z)*(N-F)<0&&P--,z=V,F=N}return P!==0}function ld(y,h,n,u,r,s){if(n.length===0||!ph(y,h,n[0],u,r,s))return!1;for(var P=1,z=n.length;P<z;++P)if(ph(y,n[P-1],n[P],u,r,s))return!1;return!0}function bx(y,h,n,u,r,s){if(n.length===0)return!1;for(var P=0,z=n.length;P<z;++P){var F=n[P];if(ld(y,h,F,u,r,s))return!0;h=F[F.length-1]}return!1}function ud(y,h,n,u,r){var s=dy(Ya(),y,h,n,u);return Ro(r,s)?lc(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Zm(y,h,n,u,function(P,z){return Nv(r,P,z)}):!1}function wx(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){if(ud(y,h,n[s],u,r))return!0;h=n[s]}return!1}function Bb(y,h,n,u,r){return!!(ud(y,h,n,u,r)||ph(y,h,n,u,r[0],r[1])||ph(y,h,n,u,r[0],r[3])||ph(y,h,n,u,r[2],r[1])||ph(y,h,n,u,r[2],r[3]))}function ky(y,h,n,u,r){if(!Bb(y,h,n[0],u,r))return!1;if(n.length===1)return!0;for(var s=1,P=n.length;s<P;++s)if(xx(y,n[s-1],n[s],u,r)&&!ud(y,n[s-1],n[s],u,r))return!1;return!0}function Ex(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(ky(y,h,z,u,r))return!0;h=z[z.length-1]}return!1}function $m(y,h,n,u){for(var r=y[h],s=y[h+1],P=0,z=h+u;z<n;z+=u){var F=y[z],V=y[z+1];P+=Math.sqrt((F-r)*(F-r)+(V-s)*(V-s)),r=F,s=V}return P}var Ub=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Nb=function(y){Ub(h,y);function h(n,u){var r=y.call(this)||this;return r.flatMidpoint_=null,r.flatMidpointRevision_=-1,r.maxDelta_=-1,r.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return h.prototype.appendCoordinate=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n):this.flatCoordinates=n.slice(),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,n,u,r,s))},h.prototype.forEachSegment=function(n){return Zm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},h.prototype.getCoordinateAtM=function(n,u){if(this.layout!=Pn.XYM&&this.layout!=Pn.XYZM)return null;var r=u!==void 0?u:!1;return Xm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,r)},h.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getCoordinateAt=function(n,u){return Wm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,this.stride)},h.prototype.getLength=function(){return $m(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getFlatMidpoint=function(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=ad(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new h(u,Pn.XY)},h.prototype.getType=function(){return Ot.LINE_STRING},h.prototype.intersectsExtent=function(n){return ud(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Hh(this.flatCoordinates,0,n,this.stride),this.changed()},h}(ws),Wl=Nb;var Vb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Gb=function(y){Vb(h,y);function h(n,u,r){var s=y.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(n[0]))s.setCoordinates(n,u);else if(u!==void 0&&r)s.setFlatCoordinates(u,n),s.ends_=r;else{for(var P=s.getLayout(),z=n,F=[],V=[],N=0,me=z.length;N<me;++N){var ve=z[N];N===0&&(P=ve.getLayout()),Ka(F,ve.getFlatCoordinates()),V.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=V}return s}return h.prototype.appendLineString=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates().slice()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(id(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),od(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},h.prototype.getCoordinateAtM=function(n,u,r){if(this.layout!=Pn.XYM&&this.layout!=Pn.XYZM||this.flatCoordinates.length===0)return null;var s=u!==void 0?u:!1,P=r!==void 0?r:!1;return vx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},h.prototype.getCoordinates=function(){return hh(this.flatCoordinates,0,this.ends_,this.stride)},h.prototype.getEnds=function(){return this.ends_},h.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new Wl(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},h.prototype.getLineStrings=function(){for(var n=this.flatCoordinates,u=this.ends_,r=this.layout,s=[],P=0,z=0,F=u.length;z<F;++z){var V=u[z],N=new Wl(n.slice(P,V),r);s.push(N),P=V}return s},h.prototype.getFlatMidpoints=function(){for(var n=[],u=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,z=0,F=s.length;z<F;++z){var V=s[z],N=Wm(u,r,V,P,.5);Ka(n,N),r=V}return n},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=gx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new h(u,Pn.XY,r)},h.prototype.getType=function(){return Ot.MULTI_LINE_STRING},h.prototype.intersectsExtent=function(n){return wx(this.flatCoordinates,0,this.ends_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=td(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},h}(ws),Tx=Gb;var jb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),qb=function(y){jb(h,y);function h(n,u){var r=y.call(this)||this;return r.setCoordinates(n,u),r}return h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){var P=this.flatCoordinates,z=ql(n,u,P[0],P[1]);if(z<s){for(var F=this.stride,V=0;V<F;++V)r[V]=P[V];return r.length=F,z}else return s},h.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},h.prototype.computeExtent=function(n){return Kp(this.flatCoordinates,n)},h.prototype.getType=function(){return Ot.POINT},h.prototype.intersectsExtent=function(n){return Kf(n,this.flatCoordinates[0],this.flatCoordinates[1])},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ux(this.flatCoordinates,0,n,this.stride),this.changed()},h}(ws),_a=qb;var Zb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Xb=function(y){Zb(h,y);function h(n,u){var r=y.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return h.prototype.appendPoint=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.flatCoordinates,z=this.stride,F=0,V=P.length;F<V;F+=z){var N=ql(n,u,P[F],P[F+1]);if(N<s){s=N;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},h.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},h.prototype.getPoint=function(n){var u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return n<0||u<=n?null:new _a(this.flatCoordinates.slice(n*this.stride,(n+1)*this.stride),this.layout)},h.prototype.getPoints=function(){for(var n=this.flatCoordinates,u=this.layout,r=this.stride,s=[],P=0,z=n.length;P<z;P+=r){var F=new _a(n.slice(P,P+r),u);s.push(F)}return s},h.prototype.getType=function(){return Ot.MULTI_POINT},h.prototype.intersectsExtent=function(n){for(var u=this.flatCoordinates,r=this.stride,s=0,P=u.length;s<P;s+=r){var z=u[s],F=u[s+1];if(Kf(n,z,F))return!0}return!1},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Hh(this.flatCoordinates,0,n,this.stride),this.changed()},h}(ws),Km=Xb;function Ly(y,h,n,u,r,s,P){for(var z,F,V,N,me,ve,Se,Ue=r[s+1],et=[],Ie=0,Ne=n.length;Ie<Ne;++Ie){var He=n[Ie];for(N=y[He-u],ve=y[He-u+1],z=h;z<He;z+=u)me=y[z],Se=y[z+1],(Ue<=ve&&Se<=Ue||ve<=Ue&&Ue<=Se)&&(V=(Ue-ve)/(Se-ve)*(me-N)+N,et.push(V)),N=me,ve=Se}var nt=NaN,mt=-1/0;for(et.sort(rh),N=et[0],z=1,F=et.length;z<F;++z){me=et[z];var ht=Math.abs(me-N);ht>mt&&(V=(N+me)/2,ld(y,h,n,u,V,Ue)&&(nt=V,mt=ht)),N=me}return isNaN(nt)&&(nt=r[s]),P?(P.push(nt,Ue,mt),P):[nt,Ue,mt]}function Sx(y,h,n,u,r){for(var s=[],P=0,z=n.length;P<z;++P){var F=n[P];s=Ly(y,h,F,u,r,2*P,s),h=F[F.length-1]}return s}function Ix(y,h,n,u){for(;h<n-u;){for(var r=0;r<u;++r){var s=y[h+r];y[h+r]=y[n-u+r],y[n-u+r]=s}h+=u,n-=u}}function Cx(y,h,n,u){for(var r=0,s=y[n-u],P=y[n-u+1];h<n;h+=u){var z=y[h],F=y[h+1];r+=(z-s)*(F+P),s=z,P=F}return r===0?void 0:r>0}function Ry(y,h,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],V=Cx(y,h,F,u);if(P===0){if(s&&V||!s&&!V)return!1}else if(s&&!V||!s&&V)return!1;h=F}return!0}function Ax(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(!Ry(y,h,z,u,r))return!1;z.length&&(h=z[z.length-1])}return!0}function Hm(y,h,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],V=Cx(y,h,F,u),N=P===0?s&&V||!s&&!V:s&&!V||!s&&V;N&&Ix(y,h,F,u),h=F}return h}function zy(y,h,n,u,r){for(var s=0,P=n.length;s<P;++s)h=Hm(y,h,n[s],u,r);return h}var Wb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Px=function(y){Wb(h,y);function h(n,u,r){var s=y.call(this)||this;return s.ends_=[],s.flatInteriorPointRevision_=-1,s.flatInteriorPoint_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,u!==void 0&&r?(s.setFlatCoordinates(u,n),s.ends_=r):s.setCoordinates(n,u),s}return h.prototype.appendLinearRing=function(n){this.flatCoordinates?Ka(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},h.prototype.clone=function(){var n=new h(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(id(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),od(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,n,u,r,s))},h.prototype.containsXY=function(n,u){return ld(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,u)},h.prototype.getArea=function(){return Py(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},h.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Hm(u,0,this.ends_,this.stride,n)):u=this.flatCoordinates,hh(u,0,this.ends_,this.stride)},h.prototype.getEnds=function(){return this.ends_},h.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var n=$h(this.getExtent());this.flatInteriorPoint_=Ly(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},h.prototype.getInteriorPoint=function(){return new _a(this.getFlatInteriorPoint(),Pn.XYM)},h.prototype.getLinearRingCount=function(){return this.ends_.length},h.prototype.getLinearRing=function(n){return n<0||this.ends_.length<=n?null:new My(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},h.prototype.getLinearRings=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.ends_,s=[],P=0,z=0,F=r.length;z<F;++z){var V=r[z],N=new My(u.slice(P,V),n);s.push(N),P=V}return s},h.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Ry(n,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Hm(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Cy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(n),u,0,r),new h(u,Pn.XY,r)},h.prototype.getType=function(){return Ot.POLYGON},h.prototype.intersectsExtent=function(n){return ky(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=td(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},h}(ws),cd=Px;function Dy(y,h,n){for(var u=h||32,r=y.getStride(),s=y.getLayout(),P=y.getCenter(),z=r*(u+1),F=new Array(z),V=0;V<z;V+=r){F[V]=0,F[V+1]=0;for(var N=2;N<r;N++)F[V+N]=P[N]}var me=[F.length],ve=new Px(F,s,me);return $b(ve,P,y.getRadius(),n),ve}function $b(y,h,n,u){for(var r=y.getFlatCoordinates(),s=y.getStride(),P=r.length/s-1,z=u||0,F=0;F<=P;++F){var V=F*s,N=z+Um(F,P)*2*Math.PI/P;r[V]=h[0]+n*Math.cos(N),r[V+1]=h[1]+n*Math.sin(N)}y.changed()}function Mx(y,h,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Om(y,h,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),h=F[F.length-1]}return r}var Kb=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Hb=function(y){Kb(h,y);function h(n,u,r){var s=y.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(n[0])){for(var P=s.getLayout(),z=n,F=[],V=[],N=0,me=z.length;N<me;++N){var ve=z[N];N===0&&(P=ve.getLayout());for(var Se=F.length,Ue=ve.getEnds(),et=0,Ie=Ue.length;et<Ie;++et)Ue[et]+=Se;Ka(F,ve.getFlatCoordinates()),V.push(Ue)}u=P,n=F,r=V}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return h.prototype.appendPolygon=function(n){var u;if(!this.flatCoordinates)this.flatCoordinates=n.getFlatCoordinates().slice(),u=n.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ka(this.flatCoordinates,n.getFlatCoordinates()),u=n.getEnds().slice();for(var s=0,P=u.length;s<P;++s)u[s]+=r}this.endss_.push(u),this.changed()},h.prototype.clone=function(){for(var n=this.endss_.length,u=new Array(n),r=0;r<n;++r)u[r]=this.endss_[r].slice();var s=new h(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},h.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(dx(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),mx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},h.prototype.containsXY=function(n,u){return bx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},h.prototype.getArea=function(){return _x(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},h.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),zy(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,sd(u,0,this.endss_,this.stride)},h.prototype.getEndss=function(){return this.endss_},h.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=Mx(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Sx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},h.prototype.getInteriorPoints=function(){return new Km(this.getFlatInteriorPoints().slice(),Pn.XYM)},h.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Ax(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=zy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},h.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=yx(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new h(u,Pn.XY,r)},h.prototype.getPolygon=function(n){if(n<0||this.endss_.length<=n)return null;var u;if(n===0)u=0;else{var r=this.endss_[n-1];u=r[r.length-1]}var s=this.endss_[n].slice(),P=s[s.length-1];if(u!==0)for(var z=0,F=s.length;z<F;++z)s[z]-=u;return new cd(this.flatCoordinates.slice(u,P),this.layout,s)},h.prototype.getPolygons=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.endss_,s=[],P=0,z=0,F=r.length;z<F;++z){var V=r[z].slice(),N=V[V.length-1];if(P!==0)for(var me=0,ve=V.length;me<ve;++me)V[me]-=P;var Se=new cd(u.slice(P,N),n,V);s.push(Se),P=N}return s},h.prototype.getType=function(){return Ot.MULTI_POLYGON},h.prototype.intersectsExtent=function(n){return Ex(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},h.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=cx(this.flatCoordinates,0,n,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},h}(ws),kx=Hb;var Yb=(y,h,n)=>{let{time_intervals:u,olGeometry:r,coordinate:s}=h.properties,{coordinates:P}=h.geometry,{type:z}=h.geometry,F=r,V,N;if(r&&(z=F.getType()),n&&s)V=s;else if(z==="Point")V=P;else if(z==="LineString"){F||(F=new Wl(P));let me=u||[[]],ve=me[0],Se=me[me.length-1];if(y<ve[0])[,,N]=ve,V=F.getFirstCoordinate();else if(y>Se[0])[,,N]=Se,V=F.getLastCoordinate();else for(let Ue=0;Ue<me.length-1;Ue+=1){let[et,Ie]=me[Ue],[Ne,He]=me[Ue+1];if(et<=y&&y<=Ne){let mt=Math.min((y-et)/(Ne-et),1)*(He-Ie)+Ie;V=F.getCoordinateAt(mt),[,,N]=me[Ue];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",F);return{coord:V,rotation:N}},Lx=Yb;var Jb=(y,h,n,u,r)=>{if(!y)return{renderedTrajectories:[]};let{time:s=Date.now(),size:P=[],center:z,resolution:F,rotation:V=0,pixelRatio:N=1}=u;if(!F||!z)return{renderedTrajectories:[]};let{noInterpolate:me=!1,hoverVehicleId:ve,selectedVehicleId:Se,filter:Ue,getScreenPixel:et=(Pt,Qt)=>(Qt.zoom||0)<12?Pt.map(Ft=>Math.floor(Ft)):Pt}=r,Ie=y.getContext("2d");Ie?.clearRect(0,0,y.width,y.height);let[Ne,He]=P;Ne&&He&&(y.width!==Ne||y.height!==He)&&([y.width,y.height]=[Ne*N,He*N]);let nt=vs(za(),P[0]/2,P[1]/2,1/F,-1/F,-V,-z[0],-z[1]);y.style&&(y.style.width=`${y.width/N}px`,y.style.height=`${y.height/N}px`);let mt,ht,pt,Tt,It=[];for(let Pt=h.length-1;Pt>=0;Pt-=1){let Qt=h[Pt];if(Ue&&!Ue(Qt))continue;let{train_id:Ft,timeOffset:er}=Qt.properties,{coord:hr,rotation:kt}=Lx(s-(er||0),Qt,me);if(h[Pt].properties.coordinate=hr,h[Pt].properties.rotation=kt,!hr)continue;let mr=bo(nt,[...hr]);if(!mr||(mr=mr.map(Lr=>Lr*N),mr[0]<0||mr[0]>y.width||mr[1]<0||mr[1]>y.height))continue;let vr=n(Qt,u,r);if(!!vr){if(ve!==Ft&&Se!==Ft){let[Lr,Ar]=et([mr[0]-vr.width/2,mr[1]-vr.height/2],u);Ie?.drawImage(vr,Lr,Ar)}ve&&ve===Ft&&(mt=vr,ht=mr),Se&&Se===Ft&&(pt=vr,Tt=mr),It.push(Qt)}}return pt&&Tt&&Ie?.drawImage(pt,Math.floor(Tt[0]-pt.width/2),Math.floor(Tt[1]-pt.height/2)),mt&&ht&&Ie?.drawImage(mt,Math.floor(ht[0]-mt.width/2),Math.floor(ht[1]-mt.height/2)),{renderedTrajectories:It}},hd=Jb;function tf(y){let h;return n=>{let{map:u,mbMap:r,olLayer:s}=y;if(!u||!r)return h||(h=document.createElement("div")),h;let P=r.getCanvas(),{viewState:z}=n,F=s?.getOpacity()||1;return P.style.opacity=`${F}`,r.jumpTo({center:lh(z.center),zoom:z.zoom-1,bearing:Zv(-z.rotation)}),P.isConnected?(P.width!==n.size[0]||P.height!==n.size[1])&&r.resize():u.render(),r.redraw(),r.getContainer()}}function rf(y){let h;return n=>{let{map:u,mbMap:r,renderState:s,olLayer:P}=y;if(!u||!r)return h||(h=document.createElement("div")),h;let z=!1,F=r.getCanvas(),{viewState:V}=n,N=P?.getVisible();s&&s?.visible!==N&&(F.style.display=N?"block":"none",s.visible=N,F.style.position="absolute");let me=P?.getOpacity();F&&s&&s.opacity!==me&&(F.style.opacity=me,s.opacity=me);let{rotation:ve}=V;s&&s.rotation!==ve&&(r.rotateTo(-(ve||0)*180/Math.PI,{animate:!1}),z=!0,s.rotation=ve),s&&s.center&&(s.zoom!==V.zoom||s.center[0]!==V.center[0]||s.center[1]!==V.center[1])&&(r.jumpTo({center:lh(V.center),zoom:V.zoom-1}),z=!0,s.zoom=V.zoom,s.center=V.center);let Se=u.getSize()||[0,0];if(s&&s.size&&(s.size[0]!==Se[0]||s.size[1]!==Se[1])&&(z=!0,s.size=Se),r&&r.style&&r.isStyleLoaded()&&z)try{r._frame&&(r._frame.cancel(),r._frame=null),r._render()}catch(Ue){console.warn(Ue)}return r.getContainer()}}var Qb=(y,h,n=!1)=>{let u=["HIDDEN","LEAVING","BOARDING"],r=y.has_fzo&&u.indexOf(y.state)>-1,s=h.has_fzo&&u.indexOf(h.state)>-1;if(r||s){if(r!==s)return r?-1:1;if(y.state!==h.state)return u.indexOf(y.state)-u.indexOf(h.state)}let P=null,z=null,F=Date.now();return n?(P=new Date(y.min_arrival_time||y.time).getTime()-F,z=new Date(h.min_arrival_time||h.time).getTime()-F):(P=new Date(y.time).getTime()-F,z=new Date(h.time).getTime()-F),P-z},pd=Qb;var ew=(y,h=!1,n=30)=>{let u=Object.keys(y).map(me=>y[me]);u.sort((me,ve)=>pd(me,ve,h));let r=new Date;r.setMinutes(r.getMinutes()+n);let s=r.getTime(),P=new Date;P.setMinutes(P.getMinutes()-n);let z=P.getTime(),F=[],V=[],N=null;for(let me=u.length-1;me>=0;me-=1){let ve={...u[me]},Se=new Date(ve.time).getTime();Se>z&&Se<s&&(ve.state==="BOARDING"&&(V.includes(ve.platform)?ve.state="HIDDEN":V.push(ve.platform)),N&&ve.to[0]===N.to[0]&&Math.abs(Se-N.time)<1e3&&ve.line.name===N.line.name&&(ve.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(ve.state)&&(ve.cancelled=!0),N=ve,N.time=Se,F.unshift(ve))}return F},fd=ew;var tw=(y,h=!1,n=30,u=100)=>{let r={},s={};return P=>{let{source:z,content:F}=P;r[z]&&window.clearTimeout(r[z]),s[F.call_id]=F,r[z]=window.setTimeout(()=>{let V=fd(s,h||!1,n);y(V)},u)}},Oy=tw;var nf={};oy(nf,{bgColors:()=>zx,getBgColor:()=>nw,getDelayColor:()=>sw,getDelayText:()=>lw,getRadius:()=>iw,getTextColor:()=>ow,getTextSize:()=>aw,getTypeIndex:()=>Ym,textColors:()=>Dx,types:()=>Rx});var rw=[[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]],Rx=[/^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],zx=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],Dx=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],Ym=y=>typeof y=="string"?Rx.findIndex(h=>h.test(y)):y,iw=(y,h)=>{try{let n=Ym(y||0);return rw[n][h]}catch{return 1}},nw=y=>{try{let h=Ym(y);return zx[h]}catch{return"#ffffff"}},ow=y=>{try{let h=Ym(y);return Dx[h]}catch{return"#ffffff"}},aw=(y,h,n,u)=>{if(!y)return 0;y.font=`bold ${u}px Arial`;let r=y.measureText(n),s=25,P=0;for(;r.width>h-6&&P<s;)u-=.5,y.font=`bold ${u}px arial, sans-serif`,r=y.measureText(n),P+=1;return u},sw=(y,h,n)=>h?n?"#ff0000":"#a0a0a0":y===null?"#a0a0a0":y>=36e5?"#ed004c":y>=5e5?"#e80000":y>=3e5?"#ff4a00":y>=18e4?"#f7bf00":"#00a00c",lw=(y,h)=>h?String.fromCodePoint(215):y>36e5?`+${Math.round(y/36e5)}h`:y>59e3?`+${Math.round(y/6e4)}m`:y>0?`+${y}s`:"";var uw=(y,h)=>{let n=null;return typeof window>"u"?null:(typeof document<"u"&&document?.createElement?(n=document.createElement("canvas"),n.width=y,n.height=h):OffscreenCanvas?n=new OffscreenCanvas(y,h):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),n)},fh=uw;var Fy={},Gy=(y,h,n)=>{let u=`${y}, ${h}, ${n}`;if(!Fy[u]){let r=fh(y*2,y*2);if(r){let s=r.getContext("2d");if(!s)return null;s.beginPath(),s.arc(y,y,h,0,2*Math.PI,!1),s.fillStyle=n,s.filter="blur(1px)",s.fill(),Fy[u]=r}}return Fy[u]},By={},jy=(y,h,n,u,r="#000",s=1)=>{let P=`${y}, ${n}, ${u}, ${r}, ${s}`;if(!By[P]){let z=fh(Math.ceil(y.length*h),Math.ceil(h+8*s));if(z){let F=z.getContext("2d");if(!F)return null;F.font=n,F.textAlign="left",F.textBaseline="middle",F.font=n,F.fillStyle=u,F.strokeStyle=r,F.lineWidth=1.5*s,F.strokeText(y,0,h),F.fillText(y,0,h),By[P]=z}}return By[P]},Uy={},qy=(y,h,n,u,r,s)=>{let P=`${y}, ${h}, ${n}, ${u}, ${r}, ${s}`;if(!Uy[P]){let z=fh(y*2,y*2);if(z){let F=z.getContext("2d");if(!F)return null;F.fillStyle=n,u&&(F.lineWidth=1*s,F.strokeStyle="#000000"),F.beginPath(),F.arc(y,y,h,0,2*Math.PI,!1),F.fill(),r&&F.setLineDash([5,3]),u&&F.stroke(),Uy[P]=z}}return Uy[P]},Ny={},Zy=(y,h,n,u,r,s,P)=>{let z=`${y}, ${h}, ${n}, ${u},${r}, ${s}, ${P}`;if(!Ny[z]){let F=fh(h*2,h*2);if(F){let V=F.getContext("2d");if(!V)return null;s&&(V.save(),V.textBaseline="middle",V.textAlign="center",V.font=`bold ${n+2}px Arial`,V.strokeStyle=r,V.strokeText(y,h,h),V.restore()),V.textBaseline="middle",V.textAlign="center",V.fillStyle=u,V.font=`bold ${n}px Arial`,V.strokeStyle=r,V.strokeText(y,h,h),V.fillText(y,h,h),Ny[z]=F}}return Ny[z]},Vy={},cw=(y,h,n)=>{let{hoverVehicleId:u,selectedVehicleId:r,useDelayStyle:s,delayOutlineColor:P="#000",delayDisplay:z=3e5,getRadius:F=()=>0,getBgColor:V=()=>"#000",getDelayColor:N=()=>"#000",getDelayText:me=()=>null,getTextColor:ve=()=>"#000",getTextSize:Se=()=>0,getMaxRadiusForText:Ue=()=>10,getMaxRadiusForStrokeAndDelay:et=()=>7}=n,{zoom:Ie,pixelRatio:Ne=1}=h,{type:He}=y.properties,{train_id:nt,line:mt,delay:ht,state:pt,operator_provides_realtime_journey:Tt}=y.properties,{name:It,text_color:Pt,color:Qt}=mt||{},Ft=pt==="JOURNEY_CANCELLED";He||(He="Rail"),It||(It="I"),Pt||(Pt="#000000"),Qt&&Qt[0]!=="#"&&(Qt=`#${Qt}`),Pt[0]!=="#"&&(Pt=`#${Pt}`);let er=Math.min(Math.floor(Ie||1),16),hr=!!(u&&u===nt),kt=!!(r&&r===nt),mr=F(He,er)*Ne,vr=mr>=et()*Ne;(hr||kt)&&(mr=vr?mr+5*Ne:14*Ne);let Lr=mr>Ue()*Ne,Ar=`${mr}${hr||kt}`;if(s?(Ar+=`${Tt}${ht}`,vr&&(Ar+=`${Ft}`)):(Ar+=`${Qt||He}`,vr&&(Ar+=`${Ft}${ht}`)),Lr&&(Ar+=`${It}${Pt}`),!Vy[Ar]){if(mr===0)return null;let Rr=1*Ne,Sr=mr+2,vi=mr*2,jt=Sr*2+Rr*2,ei=jt/2,bi=null;vr&&ht!==null&&(bi=Gy(ei,Sr,N(ht,Ft)));let ai=null,zi=0;if(vr&&(hr||(ht||0)>=z||Ft)){zi=Math.max(Ft?19:14,Math.min(Ft?19:17,mr*1.2))*Ne;let di=me(ht,Ft);di&&(ai=jy(di,zi,`bold ${zi}px arial, sans-serif`,N(ht,Ft,!0),P,Ne))}let Or;s?Or=N(ht,Ft):Or=Qt||V(He);let Xi=qy(ei,mr,Or,vr||hr||kt,!!vr&&!!s&&ht===null&&Tt==="yes",Ne),Pr=jt+(ai?.width||0)*2,Mi=fh(Pr,jt);if(Mi){let di=Mi.getContext("2d");if(!di)return null;let $n=ai?.width||0;bi&&di.drawImage(bi,$n,0),Xi&&di.drawImage(Xi,$n,0);let mn=null;if(Lr){let Xr=Math.max(mr,10),Wi=Se(di,vi,It,Xr),kn=s?"#000000":Pt||ve(He);mn=Zy(It,ei,Wi,kn,Or,!!s&&ht===null&&Tt==="yes",Ne)}mn&&di.drawImage(mn,$n,0),ai&&di.drawImage(ai,$n+Math.ceil(ei+Sr)+Rr,Math.ceil(ei-zi)),Vy[Ar]=Mi}}return Vy[Ar]},Yh=cw;var hw=(y,h,n)=>Yh(y,h,{...n,useDelayStyle:!0}),Xy=hw;var Jm,pw=()=>{if(!Jm){Jm=fh(15,15);let y=Jm?.getContext("2d");y&&(y.arc(8,8,5,0,2*Math.PI,!1),y.fillStyle="#8ED6FF",y.fill(),y.lineWidth=3,y.strokeStyle="black",y.stroke(),y.lineWidth=3)}return Jm},Wy=pw;var tn={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 fw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),dw=function(y){fw(h,y);function h(n){var u=y.call(this)||this;u.on,u.once,u.un,u.background_=n.background;var r=Ra({},n);return typeof n.properties=="object"&&(delete r.properties,Ra(r,n.properties)),r[tn.OPACITY]=n.opacity!==void 0?n.opacity:1,En(typeof r[tn.OPACITY]=="number",64),r[tn.VISIBLE]=n.visible!==void 0?n.visible:!0,r[tn.Z_INDEX]=n.zIndex,r[tn.MAX_RESOLUTION]=n.maxResolution!==void 0?n.maxResolution:1/0,r[tn.MIN_RESOLUTION]=n.minResolution!==void 0?n.minResolution:0,r[tn.MIN_ZOOM]=n.minZoom!==void 0?n.minZoom:-1/0,r[tn.MAX_ZOOM]=n.maxZoom!==void 0?n.maxZoom:1/0,u.className_=r.className!==void 0?r.className:"ol-layer",delete r.className,u.setProperties(r),u.state_=null,u}return h.prototype.getBackground=function(){return this.background_},h.prototype.getClassName=function(){return this.className_},h.prototype.getLayerState=function(n){var u=this.state_||{layer:this,managed:n===void 0?!0:n},r=this.getZIndex();return u.opacity=jl(Math.round(this.getOpacity()*100)/100,0,1),u.visible=this.getVisible(),u.extent=this.getExtent(),u.zIndex=r===void 0&&!u.managed?1/0:r,u.maxResolution=this.getMaxResolution(),u.minResolution=Math.max(this.getMinResolution(),0),u.minZoom=this.getMinZoom(),u.maxZoom=this.getMaxZoom(),this.state_=u,u},h.prototype.getLayersArray=function(n){return jr()},h.prototype.getLayerStatesArray=function(n){return jr()},h.prototype.getExtent=function(){return this.get(tn.EXTENT)},h.prototype.getMaxResolution=function(){return this.get(tn.MAX_RESOLUTION)},h.prototype.getMinResolution=function(){return this.get(tn.MIN_RESOLUTION)},h.prototype.getMinZoom=function(){return this.get(tn.MIN_ZOOM)},h.prototype.getMaxZoom=function(){return this.get(tn.MAX_ZOOM)},h.prototype.getOpacity=function(){return this.get(tn.OPACITY)},h.prototype.getSourceState=function(){return jr()},h.prototype.getVisible=function(){return this.get(tn.VISIBLE)},h.prototype.getZIndex=function(){return this.get(tn.Z_INDEX)},h.prototype.setBackground=function(n){this.background_=n,this.changed()},h.prototype.setExtent=function(n){this.set(tn.EXTENT,n)},h.prototype.setMaxResolution=function(n){this.set(tn.MAX_RESOLUTION,n)},h.prototype.setMinResolution=function(n){this.set(tn.MIN_RESOLUTION,n)},h.prototype.setMaxZoom=function(n){this.set(tn.MAX_ZOOM,n)},h.prototype.setMinZoom=function(n){this.set(tn.MIN_ZOOM,n)},h.prototype.setOpacity=function(n){En(typeof n=="number",64),this.set(tn.OPACITY,n)},h.prototype.setVisible=function(n){this.set(tn.VISIBLE,n)},h.prototype.setZIndex=function(n){this.set(tn.Z_INDEX,n)},h.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),y.prototype.disposeInternal.call(this)},h}(ko),Qm=dw;var dd={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Iu={UNDEFINED:"undefined",LOADING:"loading",READY:"ready",ERROR:"error"};var mw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),gw=function(y){mw(h,y);function h(n){var u=this,r=Ra({},n);delete r.source,u=y.call(this,r)||this,u.on,u.once,u.un,u.mapPrecomposeKey_=null,u.mapRenderKey_=null,u.sourceChangeKey_=null,u.renderer_=null,u.rendered=!1,n.render&&(u.render=n.render),n.map&&u.setMap(n.map),u.addChangeListener(tn.SOURCE,u.handleSourcePropertyChange_);var s=n.source?n.source:null;return u.setSource(s),u}return h.prototype.getLayersArray=function(n){var u=n||[];return u.push(this),u},h.prototype.getLayerStatesArray=function(n){var u=n||[];return u.push(this.getLayerState()),u},h.prototype.getSource=function(){return this.get(tn.SOURCE)||null},h.prototype.getRenderSource=function(){return this.getSource()},h.prototype.getSourceState=function(){var n=this.getSource();return n?n.getState():Iu.UNDEFINED},h.prototype.handleSourceChange_=function(){this.changed()},h.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(Mo(this.sourceChangeKey_),this.sourceChangeKey_=null);var n=this.getSource();n&&(this.sourceChangeKey_=lo(n,en.CHANGE,this.handleSourceChange_,this)),this.changed()},h.prototype.getFeatures=function(n){return this.renderer_?this.renderer_.getFeatures(n):new Promise(function(u){return u([])})},h.prototype.getData=function(n){return!this.renderer_||!this.rendered?null:this.renderer_.getData(n)},h.prototype.render=function(n,u){var r=this.getRenderer();if(r.prepareFrame(n))return this.rendered=!0,r.renderFrame(n,u)},h.prototype.unrender=function(){this.rendered=!1},h.prototype.setMapInternal=function(n){n||this.unrender(),this.set(tn.MAP,n)},h.prototype.getMapInternal=function(){return this.get(tn.MAP)},h.prototype.setMap=function(n){this.mapPrecomposeKey_&&(Mo(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),n||this.changed(),this.mapRenderKey_&&(Mo(this.mapRenderKey_),this.mapRenderKey_=null),n&&(this.mapPrecomposeKey_=lo(n,dd.PRECOMPOSE,function(u){var r=u,s=r.frameState.layerStatesArray,P=this.getLayerState(!1);En(!s.some(function(z){return z.layer===P.layer}),67),s.push(P)},this),this.mapRenderKey_=lo(this,en.CHANGE,n.render,n),this.changed())},h.prototype.setSource=function(n){this.set(tn.SOURCE,n)},h.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},h.prototype.hasRenderer=function(){return!!this.renderer_},h.prototype.createRenderer=function(){return null},h.prototype.disposeInternal=function(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),y.prototype.disposeInternal.call(this)},h}(Qm);function Ox(y,h){if(!y.visible)return!1;var n=h.resolution;if(n<y.minResolution||n>=y.maxResolution)return!1;var u=h.zoom;return u>y.minZoom&&u<=y.maxZoom}var Jh=gw;var $y=class extends ko{constructor(n={}){super(n);this.defineProperties(n);let{active:u}={active:n.active!==!1,...n};this.active=u}defineProperties(n){let{target:u,element:r,render:s}={...n};Object.defineProperties(this,{active:{get:()=>this.get("active"),set:P=>{this.set("active",P),P?this.activate():this.deactivate(),this.render()}},map:{get:()=>this.get("map"),set:P=>{if(this.map&&this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.deactivate(),this.set("map",P),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:u},element:{value:r,writable:!0},render:{value:s||this.render,writable:!0}})}attachToMap(n){this.map=n}detachFromMap(){this.map=void 0}activate(){this.deactivate()}deactivate(){console.error("The function deactivate() must be implemented in subclasses")}render(n){console.error("The function render() must be implemented in subclasses")}createDefaultElement(){console.error("The function createDefaultElement() must be implemented in subclasses")}},of=$y;var Ky=class extends of{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),[]}},eg=Ky;var Hy=class extends eg{constructor(n){super(n);this.onPostRender=this.onPostRender.bind(this)}getCopyrights(){if(!this.frameState)return[];let n=[];return this.frameState?.layerStatesArray.forEach(u=>{let{layer:r}=u;this.frameState&&Ox(u,this.frameState.viewState)&&r&&r.getSource&&r.getSource()&&r.getSource().getAttributions()&&(n=n.concat(r.getSource().getAttributions()(this.frameState)))}),Wh(n)}activate(){super.activate(),this.map&&this.map.on("postrender",this.onPostRender)}deactivate(){this.map&&this.map.un("postrender",this.onPostRender)}onPostRender(n){this.map&&this.element&&(this.frameState=n.frameState||void 0,this.render())}},Fx=Hy;var Es={ADD:"add",REMOVE:"remove"};var Ux=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Bx={LENGTH:"length"},tg=function(y){Ux(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.element=u,s.index=r,s}return h}(ln);var yw=function(y){Ux(h,y);function h(n,u){var r=y.call(this)||this;r.on,r.once,r.un;var s=u||{};if(r.unique_=!!s.unique,r.array_=n||[],r.unique_)for(var P=0,z=r.array_.length;P<z;++P)r.assertUnique_(r.array_[P],P);return r.updateLength_(),r}return h.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},h.prototype.extend=function(n){for(var u=0,r=n.length;u<r;++u)this.push(n[u]);return this},h.prototype.forEach=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)n(u[r],r,u)},h.prototype.getArray=function(){return this.array_},h.prototype.item=function(n){return this.array_[n]},h.prototype.getLength=function(){return this.get(Bx.LENGTH)},h.prototype.insertAt=function(n,u){this.unique_&&this.assertUnique_(u),this.array_.splice(n,0,u),this.updateLength_(),this.dispatchEvent(new tg(Es.ADD,u,n))},h.prototype.pop=function(){return this.removeAt(this.getLength()-1)},h.prototype.push=function(n){this.unique_&&this.assertUnique_(n);var u=this.getLength();return this.insertAt(u,n),this.getLength()},h.prototype.remove=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)if(u[r]===n)return this.removeAt(r)},h.prototype.removeAt=function(n){var u=this.array_[n];return this.array_.splice(n,1),this.updateLength_(),this.dispatchEvent(new tg(Es.REMOVE,u,n)),u},h.prototype.setAt=function(n,u){var r=this.getLength();if(n<r){this.unique_&&this.assertUnique_(u,n);var s=this.array_[n];this.array_[n]=u,this.dispatchEvent(new tg(Es.REMOVE,s,n)),this.dispatchEvent(new tg(Es.ADD,u,n))}else{for(var P=r;P<n;++P)this.insertAt(P,void 0);this.insertAt(n,u)}},h.prototype.updateLength_=function(){this.set(Bx.LENGTH,this.array_.length)},h.prototype.assertUnique_=function(n,u){for(var r=0,s=this.array_.length;r<s;++r)if(this.array_[r]===n&&r!==u)throw new zm(58)},h}(ko),dh=yw;var _w=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vw=function(y){_w(h,y);function h(n){var u=y.call(this)||this;if(u.on,u.once,u.un,u.id_=void 0,u.geometryName_="geometry",u.style_=null,u.styleFunction_=void 0,u.geometryChangeKey_=null,u.addChangeListener(u.geometryName_,u.handleGeometryChanged_),n)if(typeof n.getSimplifiedGeometry=="function"){var r=n;u.setGeometry(r)}else{var s=n;u.setProperties(s)}return u}return h.prototype.clone=function(){var n=new h(this.hasProperties()?this.getProperties():null);n.setGeometryName(this.getGeometryName());var u=this.getGeometry();u&&n.setGeometry(u.clone());var r=this.getStyle();return r&&n.setStyle(r),n},h.prototype.getGeometry=function(){return this.get(this.geometryName_)},h.prototype.getId=function(){return this.id_},h.prototype.getGeometryName=function(){return this.geometryName_},h.prototype.getStyle=function(){return this.style_},h.prototype.getStyleFunction=function(){return this.styleFunction_},h.prototype.handleGeometryChange_=function(){this.changed()},h.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(Mo(this.geometryChangeKey_),this.geometryChangeKey_=null);var n=this.getGeometry();n&&(this.geometryChangeKey_=lo(n,en.CHANGE,this.handleGeometryChange_,this)),this.changed()},h.prototype.setGeometry=function(n){this.set(this.geometryName_,n)},h.prototype.setStyle=function(n){this.style_=n,this.styleFunction_=n?xw(n):void 0,this.changed()},h.prototype.setId=function(n){this.id_=n,this.changed()},h.prototype.setGeometryName=function(n){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=n,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()},h}(ko);function xw(y){if(typeof y=="function")return y;var h;if(Array.isArray(y))h=y;else{En(typeof y.getZIndex=="function",41);var n=y;h=[n]}return function(){return h}}var uc=vw;var bw=function(){function y(h){var n=h||{};this.color_=n.color!==void 0?n.color:null}return y.prototype.clone=function(){var h=this.getColor();return new y({color:Array.isArray(h)?h.slice():h||void 0})},y.prototype.getColor=function(){return this.color_},y.prototype.setColor=function(h){this.color_=h},y}(),Ks=bw;var ww=function(){function y(h){var n=h||{};this.color_=n.color!==void 0?n.color:null,this.lineCap_=n.lineCap,this.lineDash_=n.lineDash!==void 0?n.lineDash:null,this.lineDashOffset_=n.lineDashOffset,this.lineJoin_=n.lineJoin,this.miterLimit_=n.miterLimit,this.width_=n.width}return y.prototype.clone=function(){var h=this.getColor();return new y({color:Array.isArray(h)?h.slice():h||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()})},y.prototype.getColor=function(){return this.color_},y.prototype.getLineCap=function(){return this.lineCap_},y.prototype.getLineDash=function(){return this.lineDash_},y.prototype.getLineDashOffset=function(){return this.lineDashOffset_},y.prototype.getLineJoin=function(){return this.lineJoin_},y.prototype.getMiterLimit=function(){return this.miterLimit_},y.prototype.getWidth=function(){return this.width_},y.prototype.setColor=function(h){this.color_=h},y.prototype.setLineCap=function(h){this.lineCap_=h},y.prototype.setLineDash=function(h){this.lineDash_=h},y.prototype.setLineDashOffset=function(h){this.lineDashOffset_=h},y.prototype.setLineJoin=function(h){this.lineJoin_=h},y.prototype.setMiterLimit=function(h){this.miterLimit_=h},y.prototype.setWidth=function(h){this.width_=h},y}(),va=ww;var Zi={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Yy(y,h){return Array.isArray(y)?y:(h===void 0?h=[y,y]:(h[0]=y,h[1]=y),h)}var Ew=function(){function y(h){this.opacity_=h.opacity,this.rotateWithView_=h.rotateWithView,this.rotation_=h.rotation,this.scale_=h.scale,this.scaleArray_=Yy(h.scale),this.displacement_=h.displacement}return y.prototype.clone=function(){var h=this.getScale();return new y({opacity:this.getOpacity(),scale:Array.isArray(h)?h.slice():h,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},y.prototype.getOpacity=function(){return this.opacity_},y.prototype.getRotateWithView=function(){return this.rotateWithView_},y.prototype.getRotation=function(){return this.rotation_},y.prototype.getScale=function(){return this.scale_},y.prototype.getScaleArray=function(){return this.scaleArray_},y.prototype.getDisplacement=function(){return this.displacement_},y.prototype.getAnchor=function(){return jr()},y.prototype.getImage=function(h){return jr()},y.prototype.getHitDetectionImage=function(){return jr()},y.prototype.getPixelRatio=function(h){return 1},y.prototype.getImageState=function(){return jr()},y.prototype.getImageSize=function(){return jr()},y.prototype.getOrigin=function(){return jr()},y.prototype.getSize=function(){return jr()},y.prototype.setDisplacement=function(h){this.displacement_=h},y.prototype.setOpacity=function(h){this.opacity_=h},y.prototype.setRotateWithView=function(h){this.rotateWithView_=h},y.prototype.setRotation=function(h){this.rotation_=h},y.prototype.setScale=function(h){this.scale_=h,this.scaleArray_=Yy(h)},y.prototype.listenImageChange=function(h){jr()},y.prototype.load=function(){jr()},y.prototype.unlistenImageChange=function(h){jr()},y}(),rg=Ew;var Tw=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Sw=/^([a-z]*)$|^hsla?\(.*\)$/i;function ig(y){return typeof y=="string"?y:Jy(y)}function Iw(y){var h=document.createElement("div");if(h.style.color=y,h.style.color!==""){document.body.appendChild(h);var n=getComputedStyle(h).color;return document.body.removeChild(h),n}else return""}var Cw=function(){var y=1024,h={},n=0;return function(u){var r;if(h.hasOwnProperty(u))r=h[u];else{if(n>=y){var s=0;for(var P in h)(s++&3)===0&&(delete h[P],--n)}r=Aw(u),h[u]=r,++n}return r}}();function Qh(y){return Array.isArray(y)?y:Cw(y)}function Aw(y){var h,n,u,r,s;if(Sw.exec(y)&&(y=Iw(y)),Tw.exec(y)){var P=y.length-1,z=void 0;P<=4?z=1:z=2;var F=P===4||P===8;h=parseInt(y.substr(1+0*z,z),16),n=parseInt(y.substr(1+1*z,z),16),u=parseInt(y.substr(1+2*z,z),16),F?r=parseInt(y.substr(1+3*z,z),16):r=255,z==1&&(h=(h<<4)+h,n=(n<<4)+n,u=(u<<4)+u,F&&(r=(r<<4)+r)),s=[h,n,u,r/255]}else y.indexOf("rgba(")==0?(s=y.slice(5,-1).split(",").map(Number),Nx(s)):y.indexOf("rgb(")==0?(s=y.slice(4,-1).split(",").map(Number),s.push(1),Nx(s)):En(!1,14);return s}function Nx(y){return y[0]=jl(y[0]+.5|0,0,255),y[1]=jl(y[1]+.5|0,0,255),y[2]=jl(y[2]+.5|0,0,255),y[3]=jl(y[3],0,1),y}function Jy(y){var h=y[0];h!=(h|0)&&(h=h+.5|0);var n=y[1];n!=(n|0)&&(n=n+.5|0);var u=y[2];u!=(u|0)&&(u=u+.5|0);var r=y[3]===void 0?1:Math.round(y[3]*100)/100;return"rgba("+h+","+n+","+u+","+r+")"}function Ts(y){return Array.isArray(y)?Jy(y):y}function Ja(y,h,n,u){var r;return n&&n.length?r=n.shift():ah?r=new OffscreenCanvas(y||300,h||300):r=document.createElement("canvas"),y&&(r.width=y),h&&(r.height=h),r.getContext("2d",u)}var Pw=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"),Vx=["style","variant","weight","size","lineHeight","family"],Qy=function(y){var h=y.match(Pw);if(!h)return null;for(var n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},u=0,r=Vx.length;u<r;++u){var s=h[u+1];s!==void 0&&(n[Vx[u]]=s)}return n.families=n.family.split(/,\s?/),n};function Gx(y){return y===1?"":String(Math.round(y*100)/100)}var og="10px sans-serif",Ss="#000",ep="round",cc=[],hc=0,Cu="round",pc=10,fc="#000",gh="center",tp="middle",dc=[0,0,0,0],mc=1,mh=new ko,Mw=new nh;Mw.setSize=function(){console.warn("labelCache is deprecated.")};var af=null,e_,t_={},jx=function(){var y=100,h="32px ",n=["monospace","serif"],u=n.length,r="wmytzilWMYTZIL@#/&?$%10\uF013",s,P;function z(V,N,me){for(var ve=!0,Se=0;Se<u;++Se){var Ue=n[Se];if(P=ng(V+" "+N+" "+h+Ue,r),me!=Ue){var et=ng(V+" "+N+" "+h+me+","+Ue,r);ve=ve&&et!=P}}return!!ve}function F(){for(var V=!0,N=mh.getKeys(),me=0,ve=N.length;me<ve;++me){var Se=N[me];mh.get(Se)<y&&(z.apply(this,Se.split(`
1076
1076
  `))?(ih(t_),af=null,e_=void 0,mh.set(Se,y)):(mh.set(Se,mh.get(Se)+1,!0),V=!1))}V&&(clearInterval(s),s=void 0)}return function(V){var N=Qy(V);if(!!N)for(var me=N.families,ve=0,Se=me.length;ve<Se;++ve){var Ue=me[ve],et=N.style+`
1077
1077
  `+N.weight+`
1078
1078
  `+Ue;mh.get(et)===void 0&&(mh.set(et,y,!0),z(N.style,N.weight,Ue)||(mh.set(et,0,!0),s===void 0&&(s=setInterval(F,32))))}}}(),kw=function(){var y;return function(h){var n=t_[h];if(n==null){if(ah){var u=Qy(h),r=qx(h,"\u017Dg"),s=isNaN(Number(u.lineHeight))?1.2:Number(u.lineHeight);n=s*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else y||(y=document.createElement("div"),y.innerHTML="M",y.style.minHeight="0",y.style.maxHeight="none",y.style.height="auto",y.style.padding="0",y.style.border="none",y.style.position="absolute",y.style.display="block",y.style.left="-99999px"),y.style.font=h,document.body.appendChild(y),n=y.offsetHeight,document.body.removeChild(y);t_[h]=n}return n}}();function qx(y,h){return af||(af=Ja(1,1)),y!=e_&&(af.font=y,e_=af.font),af.measureText(h)}function ng(y,h){return qx(y,h).width}function r_(y,h,n){if(h in n)return n[h];var u=ng(y,h);return n[h]=u,u}function Zx(y,h){for(var n=[],u=[],r=[],s=0,P=0,z=0,F=0,V=0,N=h.length;V<=N;V+=2){var me=h[V];if(me===`
1079
1079
  `||V===N){s=Math.max(s,P),r.push(P),P=0,z+=F;continue}var ve=h[V+1]||y.font,Se=ng(ve,me);n.push(Se),P+=Se;var Ue=kw(ve);u.push(Ue),F=Math.max(F,Ue)}return{width:s,height:z,widths:n,heights:u,lineWidths:r}}function Xx(y,h,n,u,r,s,P,z,F,V,N){y.save(),n!==1&&(y.globalAlpha*=n),h&&y.setTransform.apply(y,h),u.contextInstructions?(y.translate(F,V),y.scale(N[0],N[1]),Lw(u,y)):N[0]<0||N[1]<0?(y.translate(F,V),y.scale(N[0],N[1]),y.drawImage(u,r,s,P,z,0,0,P,z)):y.drawImage(u,r,s,P,z,F,V,P*N[0],z*N[1]),y.restore()}function Lw(y,h){for(var n=y.contextInstructions,u=0,r=n.length;u<r;u+=2)Array.isArray(n[u+1])?h[n[u]].apply(h,n[u+1]):h[n[u]]=n[u+1]}var Rw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),zw=function(y){Rw(h,y);function h(n){var u=this,r=n.rotateWithView!==void 0?n.rotateWithView:!1;return u=y.call(this,{opacity:1,rotateWithView:r,rotation:n.rotation!==void 0?n.rotation:0,scale:n.scale!==void 0?n.scale:1,displacement:n.displacement!==void 0?n.displacement:[0,0]})||this,u.canvas_=void 0,u.hitDetectionCanvas_=null,u.fill_=n.fill!==void 0?n.fill:null,u.origin_=[0,0],u.points_=n.points,u.radius_=n.radius!==void 0?n.radius:n.radius1,u.radius2_=n.radius2,u.angle_=n.angle!==void 0?n.angle:0,u.stroke_=n.stroke!==void 0?n.stroke:null,u.size_=null,u.renderOptions_=null,u.render(),u}return h.prototype.clone=function(){var n=this.getScale(),u=new h({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(n)?n.slice():n,displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},h.prototype.getAnchor=function(){var n=this.size_;if(!n)return null;var u=this.getDisplacement();return[n[0]/2-u[0],n[1]/2+u[1]]},h.prototype.getAngle=function(){return this.angle_},h.prototype.getFill=function(){return this.fill_},h.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_},h.prototype.getImage=function(n){var u=this.canvas_[n];if(!u){var r=this.renderOptions_,s=Ja(r.size*n,r.size*n);this.draw_(r,s,n),u=s.canvas,this.canvas_[n]=u}return u},h.prototype.getPixelRatio=function(n){return n},h.prototype.getImageSize=function(){return this.size_},h.prototype.getImageState=function(){return Zi.LOADED},h.prototype.getOrigin=function(){return this.origin_},h.prototype.getPoints=function(){return this.points_},h.prototype.getRadius=function(){return this.radius_},h.prototype.getRadius2=function(){return this.radius2_},h.prototype.getSize=function(){return this.size_},h.prototype.getStroke=function(){return this.stroke_},h.prototype.listenImageChange=function(n){},h.prototype.load=function(){},h.prototype.unlistenImageChange=function(n){},h.prototype.calculateLineJoinSize_=function(n,u,r){if(u===0||this.points_===1/0||n!=="bevel"&&n!=="miter")return u;var s=this.radius_,P=this.radius2_===void 0?s:this.radius2_;if(s<P){var z=s;s=P,P=z}var F=this.radius2_===void 0?this.points_:this.points_*2,V=2*Math.PI/F,N=P*Math.sin(V),me=Math.sqrt(P*P-N*N),ve=s-me,Se=Math.sqrt(N*N+ve*ve),Ue=Se/N;if(n==="miter"&&Ue<=r)return Ue*u;var et=u/2/Ue,Ie=u/2*(ve/Se),Ne=Math.sqrt((s+et)*(s+et)+Ie*Ie),He=Ne-s;if(this.radius2_===void 0||n==="bevel")return He*2;var nt=s*Math.sin(V),mt=Math.sqrt(s*s-nt*nt),ht=P-mt,pt=Math.sqrt(nt*nt+ht*ht),Tt=pt/nt;if(Tt<=r){var It=Tt*u/2-P-s;return 2*Math.max(He,It)}return He*2},h.prototype.createRenderOptions=function(){var n=Cu,u=0,r=null,s=0,P,z=0;this.stroke_&&(P=this.stroke_.getColor(),P===null&&(P=fc),P=Ts(P),z=this.stroke_.getWidth(),z===void 0&&(z=mc),r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),n=this.stroke_.getLineJoin(),n===void 0&&(n=Cu),u=this.stroke_.getMiterLimit(),u===void 0&&(u=pc));var F=this.calculateLineJoinSize_(n,z,u),V=Math.max(this.radius_,this.radius2_||0),N=Math.ceil(2*V+F);return{strokeStyle:P,strokeWidth:z,size:N,lineDash:r,lineDashOffset:s,lineJoin:n,miterLimit:u}},h.prototype.render=function(){this.renderOptions_=this.createRenderOptions();var n=this.renderOptions_.size;this.canvas_={},this.size_=[n,n]},h.prototype.draw_=function(n,u,r){if(u.scale(r,r),u.translate(n.size/2,n.size/2),this.createPath_(u),this.fill_){var s=this.fill_.getColor();s===null&&(s=Ss),u.fillStyle=Ts(s),u.fill()}this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,u.setLineDash&&n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},h.prototype.createHitDetectionCanvas_=function(n){if(this.fill_){var u=this.fill_.getColor(),r=0;if(typeof u=="string"&&(u=Qh(u)),u===null?r=1:Array.isArray(u)&&(r=u.length===4?u[3]:1),r===0){var s=Ja(n.size,n.size);this.hitDetectionCanvas_=s.canvas,this.drawHitDetectionCanvas_(n,s)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))},h.prototype.createPath_=function(n){var u=this.points_,r=this.radius_;if(u===1/0)n.arc(0,0,r,0,2*Math.PI);else{var s=this.radius2_===void 0?r:this.radius2_;this.radius2_!==void 0&&(u*=2);for(var P=this.angle_-Math.PI/2,z=2*Math.PI/u,F=0;F<u;F++){var V=P+F*z,N=F%2===0?r:s;n.lineTo(N*Math.cos(V),N*Math.sin(V))}n.closePath()}},h.prototype.drawHitDetectionCanvas_=function(n,u){u.translate(n.size/2,n.size/2),this.createPath_(u),u.fillStyle=Ss,u.fill(),this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},h}(rg),Wx=zw;var Dw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Ow=function(y){Dw(h,y);function h(n){var u=n||{};return y.call(this,{points:1/0,fill:u.fill,radius:u.radius,stroke:u.stroke,scale:u.scale!==void 0?u.scale:1,rotation:u.rotation!==void 0?u.rotation:0,rotateWithView:u.rotateWithView!==void 0?u.rotateWithView:!1,displacement:u.displacement!==void 0?u.displacement:[0,0]})||this}return h.prototype.clone=function(){var n=this.getScale(),u=new h({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(n)?n.slice():n,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},h.prototype.setRadius=function(n){this.radius_=n,this.render()},h}(Wx),xl=Ow;var sf=function(){function y(h){var n=h||{};this.geometry_=null,this.geometryFunction_=$x,n.geometry!==void 0&&this.setGeometry(n.geometry),this.fill_=n.fill!==void 0?n.fill:null,this.image_=n.image!==void 0?n.image:null,this.renderer_=n.renderer!==void 0?n.renderer:null,this.hitDetectionRenderer_=n.hitDetectionRenderer!==void 0?n.hitDetectionRenderer:null,this.stroke_=n.stroke!==void 0?n.stroke:null,this.text_=n.text!==void 0?n.text:null,this.zIndex_=n.zIndex}return y.prototype.clone=function(){var h=this.getGeometry();return h&&typeof h=="object"&&(h=h.clone()),new y({geometry:h,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()})},y.prototype.getRenderer=function(){return this.renderer_},y.prototype.setRenderer=function(h){this.renderer_=h},y.prototype.setHitDetectionRenderer=function(h){this.hitDetectionRenderer_=h},y.prototype.getHitDetectionRenderer=function(){return this.hitDetectionRenderer_},y.prototype.getGeometry=function(){return this.geometry_},y.prototype.getGeometryFunction=function(){return this.geometryFunction_},y.prototype.getFill=function(){return this.fill_},y.prototype.setFill=function(h){this.fill_=h},y.prototype.getImage=function(){return this.image_},y.prototype.setImage=function(h){this.image_=h},y.prototype.getStroke=function(){return this.stroke_},y.prototype.setStroke=function(h){this.stroke_=h},y.prototype.getText=function(){return this.text_},y.prototype.setText=function(h){this.text_=h},y.prototype.getZIndex=function(){return this.zIndex_},y.prototype.setGeometry=function(h){typeof h=="function"?this.geometryFunction_=h:typeof h=="string"?this.geometryFunction_=function(n){return n.get(h)}:h?h!==void 0&&(this.geometryFunction_=function(){return h}):this.geometryFunction_=$x,this.geometry_=h},y.prototype.setZIndex=function(h){this.zIndex_=h},y}();function Kx(y){var h;if(typeof y=="function")h=y;else{var n;if(Array.isArray(y))n=y;else{En(typeof y.getZIndex=="function",41);var u=y;n=[u]}h=function(){return n}}return h}var i_=null;function Hx(y,h){if(!i_){var n=new Ks({color:"rgba(255,255,255,0.4)"}),u=new va({color:"#3399CC",width:1.25});i_=[new sf({image:new xl({fill:n,stroke:u,radius:5}),fill:n,stroke:u})]}return i_}function Yx(){var y={},h=[255,255,255,1],n=[0,153,255,1],u=3;return y[Ot.POLYGON]=[new sf({fill:new Ks({color:[255,255,255,.5]})})],y[Ot.MULTI_POLYGON]=y[Ot.POLYGON],y[Ot.LINE_STRING]=[new sf({stroke:new va({color:h,width:u+2})}),new sf({stroke:new va({color:n,width:u})})],y[Ot.MULTI_LINE_STRING]=y[Ot.LINE_STRING],y[Ot.CIRCLE]=y[Ot.POLYGON].concat(y[Ot.LINE_STRING]),y[Ot.POINT]=[new sf({image:new xl({radius:u*2,fill:new Ks({color:n}),stroke:new va({color:h,width:u/2})}),zIndex:1/0})],y[Ot.MULTI_POINT]=y[Ot.POINT],y[Ot.GEOMETRY_COLLECTION]=y[Ot.POLYGON].concat(y[Ot.LINE_STRING],y[Ot.POINT]),y}function $x(y){return y.getGeometry()}var $l=sf;var Jx={POINT:"point",LINE:"line"};var e0=jp(a_(),1);var Fw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Qx={RENDER_ORDER:"renderOrder"},Bw=function(y){Fw(h,y);function h(n){var u=this,r=n||{},s=Ra({},r);return delete s.style,delete s.renderBuffer,delete s.updateWhileAnimating,delete s.updateWhileInteracting,u=y.call(this,s)||this,u.declutter_=r.declutter!==void 0?r.declutter:!1,u.renderBuffer_=r.renderBuffer!==void 0?r.renderBuffer:100,u.style_=null,u.styleFunction_=void 0,u.setStyle(r.style),u.updateWhileAnimating_=r.updateWhileAnimating!==void 0?r.updateWhileAnimating:!1,u.updateWhileInteracting_=r.updateWhileInteracting!==void 0?r.updateWhileInteracting:!1,u}return h.prototype.getDeclutter=function(){return this.declutter_},h.prototype.getFeatures=function(n){return y.prototype.getFeatures.call(this,n)},h.prototype.getRenderBuffer=function(){return this.renderBuffer_},h.prototype.getRenderOrder=function(){return this.get(Qx.RENDER_ORDER)},h.prototype.getStyle=function(){return this.style_},h.prototype.getStyleFunction=function(){return this.styleFunction_},h.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},h.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},h.prototype.renderDeclutter=function(n){n.declutterTree||(n.declutterTree=new e0.default(9)),this.getRenderer().renderDeclutter(n)},h.prototype.setRenderOrder=function(n){this.set(Qx.RENDER_ORDER,n)},h.prototype.setStyle=function(n){this.style_=n!==void 0?n:Hx,this.styleFunction_=n===null?void 0:Kx(this.style_),this.changed()},h}(Jh),t0=Bw;var md={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},gd=[md.FILL],Au=[md.STROKE],gc=[md.BEGIN_PATH],s_=[md.CLOSE_PATH],qr=md;var Uw=function(){function y(){}return y.prototype.drawCustom=function(h,n,u,r){},y.prototype.drawGeometry=function(h){},y.prototype.setStyle=function(h){},y.prototype.drawCircle=function(h,n){},y.prototype.drawFeature=function(h,n){},y.prototype.drawGeometryCollection=function(h,n){},y.prototype.drawLineString=function(h,n){},y.prototype.drawMultiLineString=function(h,n){},y.prototype.drawMultiPoint=function(h,n){},y.prototype.drawMultiPolygon=function(h,n){},y.prototype.drawPoint=function(h,n){},y.prototype.drawPolygon=function(h,n){},y.prototype.drawText=function(h,n){},y.prototype.setFillStrokeStyle=function(h,n){},y.prototype.setImageStyle=function(h,n){},y.prototype.setTextStyle=function(h,n){},y}(),ag=Uw;var Nw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Vw=function(y){Nw(h,y);function h(n,u,r,s){var P=y.call(this)||this;return P.tolerance=n,P.maxExtent=u,P.pixelRatio=s,P.maxLineWidth=0,P.resolution=r,P.beginGeometryInstruction1_=null,P.beginGeometryInstruction2_=null,P.bufferedMaxExtent_=null,P.instructions=[],P.coordinates=[],P.tmpCoordinate_=[],P.hitDetectionInstructions=[],P.state={},P}return h.prototype.applyPixelRatio=function(n){var u=this.pixelRatio;return u==1?n:n.map(function(r){return r*u})},h.prototype.appendFlatPointCoordinates=function(n,u){for(var r=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,P=this.coordinates,z=P.length,F=0,V=n.length;F<V;F+=u)s[0]=n[F],s[1]=n[F+1],Wp(r,s)&&(P[z++]=s[0],P[z++]=s[1]);return z},h.prototype.appendFlatLineCoordinates=function(n,u,r,s,P,z){var F=this.coordinates,V=F.length,N=this.getBufferedMaxExtent();z&&(u+=s);var me=n[u],ve=n[u+1],Se=this.tmpCoordinate_,Ue=!0,et,Ie,Ne;for(et=u+s;et<r;et+=s)Se[0]=n[et],Se[1]=n[et+1],Ne=Dm(N,Se),Ne!==Ie?(Ue&&(F[V++]=me,F[V++]=ve,Ue=!1),F[V++]=Se[0],F[V++]=Se[1]):Ne===Lo.INTERSECTING?(F[V++]=Se[0],F[V++]=Se[1],Ue=!1):Ue=!0,me=Se[0],ve=Se[1],Ie=Ne;return(P&&Ue||et===u+s)&&(F[V++]=me,F[V++]=ve),V},h.prototype.drawCustomCoordinates_=function(n,u,r,s,P){for(var z=0,F=r.length;z<F;++z){var V=r[z],N=this.appendFlatLineCoordinates(n,u,V,s,!1,!1);P.push(N),u=V}return u},h.prototype.drawCustom=function(n,u,r,s){this.beginGeometry(n,u);var P=n.getType(),z=n.getStride(),F=this.coordinates.length,V,N,me,ve,Se;switch(P){case Ot.MULTI_POLYGON:V=n.getOrientedFlatCoordinates(),ve=[];var Ue=n.getEndss();Se=0;for(var et=0,Ie=Ue.length;et<Ie;++et){var Ne=[];Se=this.drawCustomCoordinates_(V,Se,Ue[et],z,Ne),ve.push(Ne)}this.instructions.push([qr.CUSTOM,F,ve,n,r,sd]),this.hitDetectionInstructions.push([qr.CUSTOM,F,ve,n,s||r,sd]);break;case Ot.POLYGON:case Ot.MULTI_LINE_STRING:me=[],V=P==Ot.POLYGON?n.getOrientedFlatCoordinates():n.getFlatCoordinates(),Se=this.drawCustomCoordinates_(V,0,n.getEnds(),z,me),this.instructions.push([qr.CUSTOM,F,me,n,r,hh]),this.hitDetectionInstructions.push([qr.CUSTOM,F,me,n,s||r,hh]);break;case Ot.LINE_STRING:case Ot.CIRCLE:V=n.getFlatCoordinates(),N=this.appendFlatLineCoordinates(V,0,V.length,z,!1,!1),this.instructions.push([qr.CUSTOM,F,N,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,N,n,s||r,vl]);break;case Ot.MULTI_POINT:V=n.getFlatCoordinates(),N=this.appendFlatPointCoordinates(V,z),N>F&&(this.instructions.push([qr.CUSTOM,F,N,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,N,n,s||r,vl]));break;case Ot.POINT:V=n.getFlatCoordinates(),this.coordinates.push(V[0],V[1]),N=this.coordinates.length,this.instructions.push([qr.CUSTOM,F,N,n,r]),this.hitDetectionInstructions.push([qr.CUSTOM,F,N,n,s||r]);break;default:}this.endGeometry(u)},h.prototype.beginGeometry=function(n,u){this.beginGeometryInstruction1_=[qr.BEGIN_GEOMETRY,u,0,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[qr.BEGIN_GEOMETRY,u,0,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},h.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},h.prototype.reverseHitDetectionInstructions=function(){var n=this.hitDetectionInstructions;n.reverse();var u,r=n.length,s,P,z=-1;for(u=0;u<r;++u)s=n[u],P=s[0],P==qr.END_GEOMETRY?z=u:P==qr.BEGIN_GEOMETRY&&(s[2]=u,xv(this.hitDetectionInstructions,z,u),z=-1)},h.prototype.setFillStrokeStyle=function(n,u){var r=this.state;if(n){var s=n.getColor();r.fillStyle=Ts(s||Ss)}else r.fillStyle=void 0;if(u){var P=u.getColor();r.strokeStyle=Ts(P||fc);var z=u.getLineCap();r.lineCap=z!==void 0?z:ep;var F=u.getLineDash();r.lineDash=F?F.slice():cc;var V=u.getLineDashOffset();r.lineDashOffset=V||hc;var N=u.getLineJoin();r.lineJoin=N!==void 0?N:Cu;var me=u.getWidth();r.lineWidth=me!==void 0?me:mc;var ve=u.getMiterLimit();r.miterLimit=ve!==void 0?ve:pc,r.lineWidth>this.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},h.prototype.createFill=function(n){var u=n.fillStyle,r=[qr.SET_FILL_STYLE,u];return typeof u!="string"&&r.push(!0),r},h.prototype.applyStroke=function(n){this.instructions.push(this.createStroke(n))},h.prototype.createStroke=function(n){return[qr.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth*this.pixelRatio,n.lineCap,n.lineJoin,n.miterLimit,this.applyPixelRatio(n.lineDash),n.lineDashOffset*this.pixelRatio]},h.prototype.updateFillStyle=function(n,u){var r=n.fillStyle;(typeof r!="string"||n.currentFillStyle!=r)&&(r!==void 0&&this.instructions.push(u.call(this,n)),n.currentFillStyle=r)},h.prototype.updateStrokeStyle=function(n,u){var r=n.strokeStyle,s=n.lineCap,P=n.lineDash,z=n.lineDashOffset,F=n.lineJoin,V=n.lineWidth,N=n.miterLimit;(n.currentStrokeStyle!=r||n.currentLineCap!=s||P!=n.currentLineDash&&!_s(n.currentLineDash,P)||n.currentLineDashOffset!=z||n.currentLineJoin!=F||n.currentLineWidth!=V||n.currentMiterLimit!=N)&&(r!==void 0&&u.call(this,n),n.currentStrokeStyle=r,n.currentLineCap=s,n.currentLineDash=P,n.currentLineDashOffset=z,n.currentLineJoin=F,n.currentLineWidth=V,n.currentMiterLimit=N)},h.prototype.endGeometry=function(n){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var u=[qr.END_GEOMETRY,n];this.instructions.push(u),this.hitDetectionInstructions.push(u)},h.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Dv(this.maxExtent),this.maxLineWidth>0)){var n=this.resolution*(this.maxLineWidth+1)/2;gl(this.bufferedMaxExtent_,n,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},h}(ag),Pu=Vw;var Gw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),jw=function(y){Gw(h,y);function h(n,u,r,s){var P=y.call(this,n,u,r,s)||this;return P.hitDetectionImage_=null,P.image_=null,P.imagePixelRatio_=void 0,P.anchorX_=void 0,P.anchorY_=void 0,P.height_=void 0,P.opacity_=void 0,P.originX_=void 0,P.originY_=void 0,P.rotateWithView_=void 0,P.rotation_=void 0,P.scale_=void 0,P.width_=void 0,P.declutterImageWithText_=void 0,P}return h.prototype.drawPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,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.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},h.prototype.drawMultiPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,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.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},h.prototype.finish=function(){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,y.prototype.finish.call(this)},h.prototype.setImageStyle=function(n,u){var r=n.getAnchor(),s=n.getSize(),P=n.getHitDetectionImage(),z=n.getImage(this.pixelRatio),F=n.getOrigin();this.imagePixelRatio_=n.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=P,this.image_=z,this.height_=s[1],this.opacity_=n.getOpacity(),this.originX_=F[0]*this.imagePixelRatio_,this.originY_=F[1]*this.imagePixelRatio_,this.rotateWithView_=n.getRotateWithView(),this.rotation_=n.getRotation(),this.scale_=n.getScaleArray(),this.width_=s[0],this.declutterImageWithText_=u},h}(Pu),r0=jw;var qw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Zw=function(y){qw(h,y);function h(n,u,r,s){return y.call(this,n,u,r,s)||this}return h.prototype.drawFlatCoordinates_=function(n,u,r,s){var P=this.coordinates.length,z=this.appendFlatLineCoordinates(n,u,r,s,!1,!1),F=[qr.MOVE_TO_LINE_TO,P,z];return this.instructions.push(F),this.hitDetectionInstructions.push(F),r},h.prototype.drawLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,cc,hc],gc);var z=n.getFlatCoordinates(),F=n.getStride();this.drawFlatCoordinates_(z,0,z.length,F),this.hitDetectionInstructions.push(Au),this.endGeometry(u)}},h.prototype.drawMultiLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],gc);for(var z=n.getEnds(),F=n.getFlatCoordinates(),V=n.getStride(),N=0,me=0,ve=z.length;me<ve;++me)N=this.drawFlatCoordinates_(F,N,z[me],V);this.hitDetectionInstructions.push(Au),this.endGeometry(u)}},h.prototype.finish=function(){var n=this.state;return n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&this.instructions.push(Au),this.reverseHitDetectionInstructions(),this.state=null,y.prototype.finish.call(this)},h.prototype.applyStroke=function(n){n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&(this.instructions.push(Au),n.lastStroke=this.coordinates.length),n.lastStroke=0,y.prototype.applyStroke.call(this,n),this.instructions.push(gc)},h}(Pu),i0=Zw;var Xw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Ww=function(y){Xw(h,y);function h(n,u,r,s){return y.call(this,n,u,r,s)||this}return h.prototype.drawFlatCoordinatess_=function(n,u,r,s){var P=this.state,z=P.fillStyle!==void 0,F=P.strokeStyle!==void 0,V=r.length;this.instructions.push(gc),this.hitDetectionInstructions.push(gc);for(var N=0;N<V;++N){var me=r[N],ve=this.coordinates.length,Se=this.appendFlatLineCoordinates(n,u,me,s,!0,!F),Ue=[qr.MOVE_TO_LINE_TO,ve,Se];this.instructions.push(Ue),this.hitDetectionInstructions.push(Ue),F&&(this.instructions.push(s_),this.hitDetectionInstructions.push(s_)),u=me}return z&&(this.instructions.push(gd),this.hitDetectionInstructions.push(gd)),F&&(this.instructions.push(Au),this.hitDetectionInstructions.push(Au)),u},h.prototype.drawCircle=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getFlatCoordinates(),F=n.getStride(),V=this.coordinates.length;this.appendFlatLineCoordinates(z,0,z.length,F,!1,!1);var N=[qr.CIRCLE,V];this.instructions.push(gc,N),this.hitDetectionInstructions.push(gc,N),r.fillStyle!==void 0&&(this.instructions.push(gd),this.hitDetectionInstructions.push(gd)),r.strokeStyle!==void 0&&(this.instructions.push(Au),this.hitDetectionInstructions.push(Au)),this.endGeometry(u)}},h.prototype.drawPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getEnds(),F=n.getOrientedFlatCoordinates(),V=n.getStride();this.drawFlatCoordinatess_(F,0,z,V),this.endGeometry(u)}},h.prototype.drawMultiPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);for(var z=n.getEndss(),F=n.getOrientedFlatCoordinates(),V=n.getStride(),N=0,me=0,ve=z.length;me<ve;++me)N=this.drawFlatCoordinatess_(F,N,z[me],V);this.endGeometry(u)}},h.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var n=this.tolerance;if(n!==0)for(var u=this.coordinates,r=0,s=u.length;r<s;++r)u[r]=ch(u[r],n);return y.prototype.finish.call(this)},h.prototype.setFillStrokeStyles_=function(){var n=this.state,u=n.fillStyle;u!==void 0&&this.updateFillStyle(n,this.createFill),n.strokeStyle!==void 0&&this.updateStrokeStyle(n,this.applyStroke)},h}(Pu),l_=Ww;function n0(y,h,n,u,r){var s=n,P=n,z=0,F=0,V=n,N,me,ve,Se,Ue,et,Ie,Ne,He,nt;for(me=n;me<u;me+=r){var mt=h[me],ht=h[me+1];Ue!==void 0&&(He=mt-Ue,nt=ht-et,Se=Math.sqrt(He*He+nt*nt),Ie!==void 0&&(F+=ve,N=Math.acos((Ie*He+Ne*nt)/(ve*Se)),N>y&&(F>z&&(z=F,s=V,P=me),F=0,V=me-r)),ve=Se,Ie=He,Ne=nt),Ue=mt,et=ht}return F+=Se,F>z?[V,me]:[s,P]}var $w=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),yd={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Kw=function(y){$w(h,y);function h(n,u,r,s){var P=y.call(this,n,u,r,s)||this;return P.labels_=null,P.text_="",P.textOffsetX_=0,P.textOffsetY_=0,P.textRotateWithView_=void 0,P.textRotation_=0,P.textFillState_=null,P.fillStates={},P.textStrokeState_=null,P.strokeStates={},P.textState_={},P.textStates={},P.textKey_="",P.fillKey_="",P.strokeKey_="",P.declutterImageWithText_=void 0,P}return h.prototype.finish=function(){var n=y.prototype.finish.call(this);return n.textStates=this.textStates,n.fillStates=this.fillStates,n.strokeStates=this.strokeStates,n},h.prototype.drawText=function(n,u){var r=this.textFillState_,s=this.textStrokeState_,P=this.textState_;if(!(this.text_===""||!P||!r&&!s)){var z=this.coordinates,F=z.length,V=n.getType(),N=null,me=n.getStride();if(P.placement===Jx.LINE&&(V==Ot.LINE_STRING||V==Ot.MULTI_LINE_STRING||V==Ot.POLYGON||V==Ot.MULTI_POLYGON)){if(!Ro(this.getBufferedMaxExtent(),n.getExtent()))return;var ve=void 0;if(N=n.getFlatCoordinates(),V==Ot.LINE_STRING)ve=[N.length];else if(V==Ot.MULTI_LINE_STRING)ve=n.getEnds();else if(V==Ot.POLYGON)ve=n.getEnds().slice(0,1);else if(V==Ot.MULTI_POLYGON){var Se=n.getEndss();ve=[];for(var Ue=0,et=Se.length;Ue<et;++Ue)ve.push(Se[Ue][0])}this.beginGeometry(n,u);for(var Ie=P.textAlign,Ne=0,He=void 0,nt=0,mt=ve.length;nt<mt;++nt){if(Ie==null){var ht=n0(P.maxAngle,N,Ne,ve[nt],me);Ne=ht[0],He=ht[1]}else He=ve[nt];for(var Ue=Ne;Ue<He;Ue+=me)z.push(N[Ue],N[Ue+1]);var pt=z.length;Ne=ve[nt],this.drawChars_(F,pt),F=pt}this.endGeometry(u)}else{var Tt=P.overflow?null:[];switch(V){case Ot.POINT:case Ot.MULTI_POINT:N=n.getFlatCoordinates();break;case Ot.LINE_STRING:N=n.getFlatMidpoint();break;case Ot.CIRCLE:N=n.getCenter();break;case Ot.MULTI_LINE_STRING:N=n.getFlatMidpoints(),me=2;break;case Ot.POLYGON:N=n.getFlatInteriorPoint(),P.overflow||Tt.push(N[2]/this.resolution),me=3;break;case Ot.MULTI_POLYGON:var It=n.getFlatInteriorPoints();N=[];for(var Ue=0,et=It.length;Ue<et;Ue+=3)P.overflow||Tt.push(It[Ue+2]/this.resolution),N.push(It[Ue],It[Ue+1]);if(N.length===0)return;me=2;break;default:}var pt=this.appendFlatPointCoordinates(N,me);if(pt===F)return;if(Tt&&(pt-F)/2!==N.length/me){var Pt=F/2;Tt=Tt.filter(function(Ar,Rr){var Sr=z[(Pt+Rr)*2]===N[Rr*me]&&z[(Pt+Rr)*2+1]===N[Rr*me+1];return Sr||--Pt,Sr})}this.saveTextStates_(),(P.backgroundFill||P.backgroundStroke)&&(this.setFillStrokeStyle(P.backgroundFill,P.backgroundStroke),P.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),P.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(n,u);var Qt=P.padding;if(Qt!=dc&&(P.scale[0]<0||P.scale[1]<0)){var Ft=P.padding[0],er=P.padding[1],hr=P.padding[2],kt=P.padding[3];P.scale[0]<0&&(er=-er,kt=-kt),P.scale[1]<0&&(Ft=-Ft,hr=-hr),Qt=[Ft,er,hr,kt]}var mr=this.pixelRatio;this.instructions.push([qr.DRAW_IMAGE,F,pt,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterImageWithText_,Qt==dc?dc:Qt.map(function(Ar){return Ar*mr}),!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]);var vr=1/mr;this.hitDetectionInstructions.push([qr.DRAW_IMAGE,F,pt,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[vr,vr],NaN,this.declutterImageWithText_,Qt,!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]),this.endGeometry(u)}}},h.prototype.saveTextStates_=function(){var n=this.textStrokeState_,u=this.textState_,r=this.textFillState_,s=this.strokeKey_;n&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:n.strokeStyle,lineCap:n.lineCap,lineDashOffset:n.lineDashOffset,lineWidth:n.lineWidth,lineJoin:n.lineJoin,miterLimit:n.miterLimit,lineDash:n.lineDash}));var P=this.textKey_;P in this.textStates||(this.textStates[P]={font:u.font,textAlign:u.textAlign||gh,textBaseline:u.textBaseline||tp,scale:u.scale});var z=this.fillKey_;r&&(z in this.fillStates||(this.fillStates[z]={fillStyle:r.fillStyle}))},h.prototype.drawChars_=function(n,u){var r=this.textStrokeState_,s=this.textState_,P=this.strokeKey_,z=this.textKey_,F=this.fillKey_;this.saveTextStates_();var V=this.pixelRatio,N=yd[s.textBaseline],me=this.textOffsetY_*V,ve=this.text_,Se=r?r.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([qr.DRAW_CHARS,n,u,N,s.overflow,F,s.maxAngle,V,me,P,Se*V,ve,z,1]),this.hitDetectionInstructions.push([qr.DRAW_CHARS,n,u,N,s.overflow,F,s.maxAngle,1,me,P,Se,ve,z,1/V])},h.prototype.setTextStyle=function(n,u){var r,s,P;if(!n)this.text_="";else{var z=n.getFill();z?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=Ts(z.getColor()||Ss)):(s=null,this.textFillState_=s);var F=n.getStroke();if(!F)P=null,this.textStrokeState_=P;else{P=this.textStrokeState_,P||(P={},this.textStrokeState_=P);var V=F.getLineDash(),N=F.getLineDashOffset(),me=F.getWidth(),ve=F.getMiterLimit();P.lineCap=F.getLineCap()||ep,P.lineDash=V?V.slice():cc,P.lineDashOffset=N===void 0?hc:N,P.lineJoin=F.getLineJoin()||Cu,P.lineWidth=me===void 0?mc:me,P.miterLimit=ve===void 0?pc:ve,P.strokeStyle=Ts(F.getColor()||fc)}r=this.textState_;var Se=n.getFont()||og;jx(Se);var Ue=n.getScaleArray();r.overflow=n.getOverflow(),r.font=Se,r.maxAngle=n.getMaxAngle(),r.placement=n.getPlacement(),r.textAlign=n.getTextAlign(),r.textBaseline=n.getTextBaseline()||tp,r.backgroundFill=n.getBackgroundFill(),r.backgroundStroke=n.getBackgroundStroke(),r.padding=n.getPadding()||dc,r.scale=Ue===void 0?[1,1]:Ue;var et=n.getOffsetX(),Ie=n.getOffsetY(),Ne=n.getRotateWithView(),He=n.getRotation();this.text_=n.getText()||"",this.textOffsetX_=et===void 0?0:et,this.textOffsetY_=Ie===void 0?0:Ie,this.textRotateWithView_=Ne===void 0?!1:Ne,this.textRotation_=He===void 0?0:He,this.strokeKey_=P?(typeof P.strokeStyle=="string"?P.strokeStyle:Pi(P.strokeStyle))+P.lineCap+P.lineDashOffset+"|"+P.lineWidth+P.lineJoin+P.miterLimit+"["+P.lineDash.join()+"]":"",this.textKey_=r.font+r.scale+(r.textAlign||"?")+(r.textBaseline||"?"),this.fillKey_=s?typeof s.fillStyle=="string"?s.fillStyle:"|"+Pi(s.fillStyle):""}this.declutterImageWithText_=u},h}(Pu),o0=Kw;var Hw={Circle:l_,Default:Pu,Image:r0,LineString:i0,Polygon:l_,Text:o0},Yw=function(){function y(h,n,u,r){this.tolerance_=h,this.maxExtent_=n,this.pixelRatio_=r,this.resolution_=u,this.buildersByZIndex_={}}return y.prototype.finish=function(){var h={};for(var n in this.buildersByZIndex_){h[n]=h[n]||{};var u=this.buildersByZIndex_[n];for(var r in u){var s=u[r].finish();h[n][r]=s}}return h},y.prototype.getBuilder=function(h,n){var u=h!==void 0?h.toString():"0",r=this.buildersByZIndex_[u];r===void 0&&(r={},this.buildersByZIndex_[u]=r);var s=r[n];if(s===void 0){var P=Hw[n];s=new P(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[n]=s}return s},y}(),u_=Yw;var Jw=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Qw=function(y){Jw(h,y);function h(n){var u=y.call(this)||this;return u.ready=!0,u.boundHandleImageChange_=u.handleImageChange_.bind(u),u.layer_=n,u.declutterExecutorGroup=null,u}return h.prototype.getFeatures=function(n){return jr()},h.prototype.getData=function(n){return null},h.prototype.prepareFrame=function(n){return jr()},h.prototype.renderFrame=function(n,u){return jr()},h.prototype.loadedTileCallback=function(n,u,r){n[u]||(n[u]={}),n[u][r.tileCoord.toString()]=r},h.prototype.createLoadedTileFinder=function(n,u,r){return function(s,P){var z=this.loadedTileCallback.bind(this,r,s);return n.forEachLoadedTile(u,s,P,z)}.bind(this)},h.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){},h.prototype.getDataAtPixel=function(n,u,r){return null},h.prototype.getLayer=function(){return this.layer_},h.prototype.handleFontsChanged=function(){},h.prototype.handleImageChange_=function(n){var u=n.target;u.getState()===Zi.LOADED&&this.renderIfReadyAndVisible()},h.prototype.loadImage=function(n){var u=n.getState();return u!=Zi.LOADED&&u!=Zi.ERROR&&n.addEventListener(en.CHANGE,this.boundHandleImageChange_),u==Zi.IDLE&&(n.load(),u=n.getState()),u==Zi.LOADED},h.prototype.renderIfReadyAndVisible=function(){var n=this.getLayer();n.getVisible()&&n.getSourceState()==Iu.READY&&n.changed()},h.prototype.disposeInternal=function(){delete this.layer_,y.prototype.disposeInternal.call(this)},h}(Mm),a0=Qw;var e2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),t2=function(y){e2(h,y);function h(n,u,r,s){var P=y.call(this,n)||this;return P.inversePixelTransform=u,P.frameState=r,P.context=s,P}return h}(ln),s0=t2;var r2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),_d=null;function i2(){var y=document.createElement("canvas");y.width=1,y.height=1,_d=y.getContext("2d")}var n2=function(y){r2(h,y);function h(n){var u=y.call(this,n)||this;return u.container=null,u.renderedResolution,u.tempTransform=za(),u.pixelTransform=za(),u.inversePixelTransform=za(),u.context=null,u.containerReused=!1,u.pixelContext_=null,u.frameState=null,u}return h.prototype.getImageData=function(n,u,r){_d||i2(),_d.clearRect(0,0,1,1);var s;try{_d.drawImage(n,u,r,1,1,0,0,1,1),s=_d.getImageData(0,0,1,1).data}catch{return null}return s},h.prototype.getBackground=function(n){var u=this.getLayer(),r=u.getBackground();return typeof r=="function"&&(r=r(n.viewState.resolution)),r||void 0},h.prototype.useContainer=function(n,u,r,s){var P=this.getLayer().getClassName(),z,F;if(n&&n.className===P&&n.style.opacity===""&&r===1&&(!s||n.style.backgroundColor&&_s(Qh(n.style.backgroundColor),Qh(s)))){var V=n.firstElementChild;V instanceof HTMLCanvasElement&&(F=V.getContext("2d"))}if(F&&F.canvas.style.transform===u?(this.container=n,this.context=F,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){z=document.createElement("div"),z.className=P;var N=z.style;N.position="absolute",N.width="100%",N.height="100%",s&&(N.backgroundColor=s),F=Ja();var V=F.canvas;z.appendChild(V),N=V.style,N.position="absolute",N.left="0",N.transformOrigin="top left",this.container=z,this.context=F}},h.prototype.clipUnrotated=function(n,u,r){var s=yy(r),P=_y(r),z=gy(r),F=my(r);bo(u.coordinateToPixelTransform,s),bo(u.coordinateToPixelTransform,P),bo(u.coordinateToPixelTransform,z),bo(u.coordinateToPixelTransform,F);var V=this.inversePixelTransform;bo(V,s),bo(V,P),bo(V,z),bo(V,F),n.save(),n.beginPath(),n.moveTo(Math.round(s[0]),Math.round(s[1])),n.lineTo(Math.round(P[0]),Math.round(P[1])),n.lineTo(Math.round(z[0]),Math.round(z[1])),n.lineTo(Math.round(F[0]),Math.round(F[1])),n.clip()},h.prototype.dispatchRenderEvent_=function(n,u,r){var s=this.getLayer();if(s.hasListener(n)){var P=new s0(n,this.inversePixelTransform,r,u);s.dispatchEvent(P)}},h.prototype.preRender=function(n,u){this.frameState=u,this.dispatchRenderEvent_(dd.PRERENDER,n,u)},h.prototype.postRender=function(n,u){this.dispatchRenderEvent_(dd.POSTRENDER,n,u)},h.prototype.getRenderTransform=function(n,u,r,s,P,z,F){var V=P/2,N=z/2,me=s/u,ve=-me,Se=-n[0]+F,Ue=-n[1];return vs(this.tempTransform,V,N,me,ve,-r,Se,Ue)},h.prototype.getDataAtPixel=function(n,u,r){var s=bo(this.inversePixelTransform,n.slice()),P=this.context,z=this.getLayer(),F=z.getExtent();if(F){var V=bo(u.pixelToCoordinateTransform,n.slice());if(!Wp(F,V))return null}var N=Math.round(s[0]),me=Math.round(s[1]),ve=this.pixelContext_;if(!ve){var Se=document.createElement("canvas");Se.width=1,Se.height=1,ve=Se.getContext("2d"),this.pixelContext_=ve}ve.clearRect(0,0,1,1);var Ue;try{ve.drawImage(P.canvas,N,me,1,1,0,0,1,1),Ue=ve.getImageData(0,0,1,1).data}catch(et){return et.name==="SecurityError"?(this.pixelContext_=null,new Uint8Array):Ue}return Ue[3]===0?null:Ue},h.prototype.disposeInternal=function(){delete this.frameState,y.prototype.disposeInternal.call(this)},h}(a0),l0=n2;var Fn={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function u0(y,h,n,u,r,s,P,z,F,V,N,me){var ve=y[h],Se=y[h+1],Ue=0,et=0,Ie=0,Ne=0;function He(){Ue=ve,et=Se,h+=u,ve=y[h],Se=y[h+1],Ne+=Ie,Ie=Math.sqrt((ve-Ue)*(ve-Ue)+(Se-et)*(Se-et))}do He();while(h<n-u&&Ne+Ie<s);for(var nt=Ie===0?0:(s-Ne)/Ie,mt=yl(Ue,ve,nt),ht=yl(et,Se,nt),pt=h-u,Tt=Ne,It=s+z*F(V,r,N);h<n-u&&Ne+Ie<It;)He();nt=Ie===0?0:(It-Ne)/Ie;var Pt=yl(Ue,ve,nt),Qt=yl(et,Se,nt),Ft;if(me){var er=[mt,ht,Pt,Qt];jm(er,0,4,2,me,er,er),Ft=er[0]>er[2]}else Ft=mt>Pt;var hr=Math.PI,kt=[],mr=pt+u===h;h=pt,Ie=0,Ne=Tt,ve=y[h],Se=y[h+1];var vr;if(mr){He(),vr=Math.atan2(Se-et,ve-Ue),Ft&&(vr+=vr>0?-hr:hr);var Lr=(Pt+mt)/2,Ar=(Qt+ht)/2;return kt[0]=[Lr,Ar,(It-s)/2,vr,r],kt}for(var Rr=0,Sr=r.length;Rr<Sr;){He();var vi=Math.atan2(Se-et,ve-Ue);if(Ft&&(vi+=vi>0?-hr:hr),vr!==void 0){var jt=vi-vr;if(jt+=jt>hr?-2*hr:jt<-hr?2*hr:0,Math.abs(jt)>P)return null}vr=vi;for(var ei=Rr,bi=0;Rr<Sr;++Rr){var ai=Ft?Sr-Rr-1:Rr,zi=z*F(V,r[ai],N);if(h+u<n&&Ne+Ie<s+bi+zi/2)break;bi+=zi}if(Rr!==ei){var Or=Ft?r.substring(Sr-ei,Sr-Rr):r.substring(ei,Rr);nt=Ie===0?0:(s+bi/2-Ne)/Ie;var Lr=yl(Ue,ve,nt),Ar=yl(et,Se,nt);kt.push([Lr,Ar,bi/2,vi,Or]),s+=bi}}return kt}var lf=Ya(),yh=[],yc=[],_c=[],_h=[];function c0(y){return y[3].declutterBox}var o2=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 h0(y,h){return(h==="start"||h==="end")&&!o2.test(y)&&(h=h==="start"?"left":"right"),yd[h]}function a2(y,h,n){return n>0&&y.push(`
1080
1080
  `,""),y.push(h,""),y}var s2=function(){function y(h,n,u,r){this.overlaps=u,this.pixelRatio=n,this.resolution=h,this.alignFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=za(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={}}return y.prototype.createLabel=function(h,n,u,r){var s=h+n+u+r;if(this.labels_[s])return this.labels_[s];var P=r?this.strokeStates[r]:null,z=u?this.fillStates[u]:null,F=this.textStates[n],V=this.pixelRatio,N=[F.scale[0]*V,F.scale[1]*V],me=Array.isArray(h),ve=h0(me?h[0]:h,F.textAlign||gh),Se=r&&P.lineWidth?P.lineWidth:0,Ue=me?h:h.split(`
1081
1081
  `).reduce(a2,[]),et=Zx(F,Ue),Ie=et.width,Ne=et.height,He=et.widths,nt=et.heights,mt=et.lineWidths,ht=Ie+Se,pt=[],Tt=(ht+2)*N[0],It=(Ne+Se)*N[1],Pt={width:Tt<0?Math.floor(Tt):Math.ceil(Tt),height:It<0?Math.floor(It):Math.ceil(It),contextInstructions:pt};if((N[0]!=1||N[1]!=1)&&pt.push("scale",N),r){pt.push("strokeStyle",P.strokeStyle),pt.push("lineWidth",Se),pt.push("lineCap",P.lineCap),pt.push("lineJoin",P.lineJoin),pt.push("miterLimit",P.miterLimit);var Qt=ah?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D;Qt.prototype.setLineDash&&(pt.push("setLineDash",[P.lineDash]),pt.push("lineDashOffset",P.lineDashOffset))}u&&pt.push("fillStyle",z.fillStyle),pt.push("textBaseline","middle"),pt.push("textAlign","center");for(var Ft=.5-ve,er=ve*ht+Ft*Se,hr=[],kt=[],mr=0,vr=0,Lr=0,Ar=0,Rr,Sr=0,vi=Ue.length;Sr<vi;Sr+=2){var jt=Ue[Sr];if(jt===`
1082
- `){vr+=mr,mr=0,er=ve*ht+Ft*Se,++Ar;continue}var ei=Ue[Sr+1]||F.font;ei!==Rr&&(r&&hr.push("font",ei),u&&kt.push("font",ei),Rr=ei),mr=Math.max(mr,nt[Lr]);var bi=[jt,er+Ft*He[Lr]+ve*(He[Lr]-mt[Ar]),.5*(Se+mr)+vr];er+=He[Lr],r&&hr.push("strokeText",bi),u&&kt.push("fillText",bi),++Lr}return Array.prototype.push.apply(pt,hr),Array.prototype.push.apply(pt,kt),this.labels_[s]=Pt,Pt},y.prototype.replayTextBackground_=function(h,n,u,r,s,P,z){h.beginPath(),h.moveTo.apply(h,n),h.lineTo.apply(h,u),h.lineTo.apply(h,r),h.lineTo.apply(h,s),h.lineTo.apply(h,n),P&&(this.alignFill_=P[2],this.fill_(h)),z&&(this.setStrokeStyle_(h,z),h.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(h,n,u,r,s,P,z,F,V,N,me,ve,Se,Ue,et,Ie){z*=ve[0],F*=ve[1];var Ne=u-z,He=r-F,nt=s+V>h?h-V:s,mt=P+N>n?n-N:P,ht=Ue[3]+nt*ve[0]+Ue[1],pt=Ue[0]+mt*ve[1]+Ue[2],Tt=Ne-Ue[3],It=He-Ue[0];(et||me!==0)&&(yh[0]=Tt,_h[0]=Tt,yh[1]=It,yc[1]=It,yc[0]=Tt+ht,_c[0]=yc[0],_c[1]=It+pt,_h[1]=_c[1]);var Pt;return me!==0?(Pt=vs(za(),u,r,1,1,me,-u,-r),bo(Pt,yh),bo(Pt,yc),bo(Pt,_c),bo(Pt,_h),sh(Math.min(yh[0],yc[0],_c[0],_h[0]),Math.min(yh[1],yc[1],_c[1],_h[1]),Math.max(yh[0],yc[0],_c[0],_h[0]),Math.max(yh[1],yc[1],_c[1],_h[1]),lf)):sh(Math.min(Tt,Tt+ht),Math.min(It,It+pt),Math.max(Tt,Tt+ht),Math.max(It,It+pt),lf),Se&&(Ne=Math.round(Ne),He=Math.round(He)),{drawImageX:Ne,drawImageY:He,drawImageW:nt,drawImageH:mt,originX:V,originY:N,declutterBox:{minX:lf[0],minY:lf[1],maxX:lf[2],maxY:lf[3],value:Ie},canvasTransform:Pt,scale:ve}},y.prototype.replayImageOrLabel_=function(h,n,u,r,s,P,z){var F=!!(P||z),V=r.declutterBox,N=h.canvas,me=z?z[2]*r.scale[0]/2:0,ve=V.minX-me<=N.width/n&&V.maxX+me>=0&&V.minY-me<=N.height/n&&V.maxY+me>=0;return ve&&(F&&this.replayTextBackground_(h,yh,yc,_c,_h,P,z),Xx(h,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(h){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;h.save(),h.translate(n[0]%u,n[1]%u),h.rotate(this.viewRotation_)}h.fill(),this.alignFill_&&h.restore()},y.prototype.setStrokeStyle_=function(h,n){h.strokeStyle=n[1],h.lineWidth=n[2],h.lineCap=n[3],h.lineJoin=n[4],h.miterLimit=n[5],h.setLineDash&&(h.lineDashOffset=n[7],h.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(h,n,u,r){var s=this.textStates[n],P=this.createLabel(h,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,V=h0(Array.isArray(h)?h[0]:h,s.textAlign||gh),N=yd[s.textBaseline||tp],me=z&&z.lineWidth?z.lineWidth:0,ve=P.width/F-2*s.scale[0],Se=V*ve+2*(.5-V)*me,Ue=N*P.height/F+2*(.5-N)*me;return{label:P,anchorX:Se,anchorY:Ue}},y.prototype.execute_=function(h,n,u,r,s,P,z,F){var V;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?V=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),V=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),kv(this.renderedTransform_,u));for(var N=0,me=r.length,ve=0,Se,Ue,et,Ie,Ne,He,nt,mt,ht,pt,Tt,It,Pt=0,Qt=0,Ft=null,er=null,hr=this.coordinateCache_,kt=this.viewRotation_,mr=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,vr={context:h,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:kt},Lr=this.instructions!=r||this.overlaps?0:200,Ar,Rr,Sr,vi;N<me;){var jt=r[N],ei=jt[0];switch(ei){case qr.BEGIN_GEOMETRY:Ar=jt[1],vi=jt[3],Ar.getGeometry()?z!==void 0&&!Ro(z,vi.getExtent())?N=jt[2]+1:++N:N=jt[2];break;case qr.BEGIN_PATH:Pt>Lr&&(this.fill_(h),Pt=0),Qt>Lr&&(h.stroke(),Qt=0),!Pt&&!Qt&&(h.beginPath(),Ie=NaN,Ne=NaN),++N;break;case qr.CIRCLE:ve=jt[1];var bi=V[ve],ai=V[ve+1],zi=V[ve+2],Or=V[ve+3],Mn=zi-bi,wo=Or-ai,Xi=Math.sqrt(Mn*Mn+wo*wo);h.moveTo(bi+Xi,ai),h.arc(bi,ai,Xi,0,2*Math.PI,!0),++N;break;case qr.CLOSE_PATH:h.closePath(),++N;break;case qr.CUSTOM:ve=jt[1],Se=jt[2];var Pr=jt[3],co=jt[4],Mi=jt.length==6?jt[5]:void 0;vr.geometry=Pr,vr.feature=Ar,N in hr||(hr[N]=[]);var di=hr[N];Mi?Mi(V,ve,Se,2,di):(di[0]=V[ve],di[1]=V[ve+1],di.length=2),co(di,vr),++N;break;case qr.DRAW_IMAGE:ve=jt[1],Se=jt[2],mt=jt[3],Ue=jt[4],et=jt[5];var $n=jt[6],mn=jt[7],Xr=jt[8],Wi=jt[9],kn=jt[10],Bn=jt[11],Un=jt[12],$i=jt[13],gn=jt[14];if(!mt&&jt.length>=19){ht=jt[18],pt=jt[19],Tt=jt[20],It=jt[21];var Tn=this.drawLabelWithPointPlacement_(ht,pt,Tt,It);mt=Tn.label,jt[3]=mt;var Eo=jt[22];Ue=(Tn.anchorX-Eo)*this.pixelRatio,jt[4]=Ue;var wt=jt[23];et=(Tn.anchorY-wt)*this.pixelRatio,jt[5]=et,$n=mt.height,jt[6]=$n,$i=mt.width,jt[13]=$i}var Wt=void 0;jt.length>24&&(Wt=jt[24]);var ho=void 0,yn=void 0,Wr=void 0;jt.length>16?(ho=jt[15],yn=jt[16],Wr=jt[17]):(ho=dc,yn=!1,Wr=!1),kn&&mr?Bn+=kt:!kn&&!mr&&(Bn-=kt);for(var Ln=0;ve<Se;ve+=2)if(!(Wt&&Wt[Ln++]<$i/this.pixelRatio)){var Bi=this.calculateImageOrLabelDimensions_(mt.width,mt.height,V[ve],V[ve+1],$i,$n,Ue,et,Xr,Wi,Bn,Un,s,ho,yn||Wr,Ar),fn=[h,n,mt,Bi,mn,yn?Ft:null,Wr?er:null],Kn=void 0,Zt=void 0;if(F&&gn){var Nr=Se-ve;if(!gn[Nr]){gn[Nr]=fn;continue}if(Kn=gn[Nr],delete gn[Nr],Zt=c0(Kn),F.collides(Zt))continue}F&&F.collides(Bi.declutterBox)||(Kn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Kn)),F&&F.insert(Bi.declutterBox),this.replayImageOrLabel_.apply(this,fn))}++N;break;case qr.DRAW_CHARS:var Fr=jt[1],Gi=jt[2],Sn=jt[3],Ir=jt[4];It=jt[5];var to=jt[6],Ki=jt[7],wi=jt[8];Tt=jt[9];var te=jt[10];ht=jt[11],pt=jt[12];var he=[jt[13],jt[13]],de=this.textStates[pt],Te=de.font,Le=[de.scale[0]*Ki,de.scale[1]*Ki],We=void 0;Te in this.widths_?We=this.widths_[Te]:(We={},this.widths_[Te]=We);var Je=$m(V,Fr,Gi,2),we=Math.abs(Le[0])*r_(Te,ht,We);if(Ir||we<=Je){var Ve=this.textStates[pt].textAlign,ie=(Je-we)*yd[Ve],X=u0(V,Fr,Gi,2,ht,ie,to,Math.abs(Le[0]),r_,Te,We,mr?0:this.viewRotation_);e:if(X){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,pt,"",Tt),Ue=ge[2]+(Le[0]<0?-te:te),et=Sn*ke.height+(.5-Sn)*2*te*Le[1]/Le[0]-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,et,0,0,ge[3],he,!1,dc,!1,Ar);if(F&&F.collides(Bi.declutterBox))break e;J.push([h,n,ke,Bi,1,null,null])}if(It)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,pt,It,""),Ue=ge[2],et=Sn*ke.height-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,et,0,0,ge[3],he,!1,dc,!1,Ar);if(F&&F.collides(Bi.declutterBox))break e;J.push([h,n,ke,Bi,1,null,null])}F&&F.load(J.map(c0));for(var Ce=0,Re=J.length;Ce<Re;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++N;break;case qr.END_GEOMETRY:if(P!==void 0){Ar=jt[1];var Ke=P(Ar,vi);if(Ke)return Ke}++N;break;case qr.FILL:Lr?Pt++:this.fill_(h),++N;break;case qr.MOVE_TO_LINE_TO:for(ve=jt[1],Se=jt[2],Rr=V[ve],Sr=V[ve+1],He=Rr+.5|0,nt=Sr+.5|0,(He!==Ie||nt!==Ne)&&(h.moveTo(Rr,Sr),Ie=He,Ne=nt),ve+=2;ve<Se;ve+=2)Rr=V[ve],Sr=V[ve+1],He=Rr+.5|0,nt=Sr+.5|0,(ve==Se-2||He!==Ie||nt!==Ne)&&(h.lineTo(Rr,Sr),Ie=He,Ne=nt);++N;break;case qr.SET_FILL_STYLE:Ft=jt,this.alignFill_=jt[2],Pt&&(this.fill_(h),Pt=0,Qt&&(h.stroke(),Qt=0)),h.fillStyle=jt[1],++N;break;case qr.SET_STROKE_STYLE:er=jt,Qt&&(h.stroke(),Qt=0),this.setStrokeStyle_(h,jt),++N;break;case qr.STROKE:Lr?Qt++:h.stroke(),++N;break;default:++N;break}}Pt&&this.fill_(h),Qt&&h.stroke()},y.prototype.execute=function(h,n,u,r,s,P){this.viewRotation_=r,this.execute_(h,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(h,n,u,r,s){return this.viewRotation_=u,this.execute_(h,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),p0=s2;var c_=[Fn.POLYGON,Fn.CIRCLE,Fn.LINE_STRING,Fn.IMAGE,Fn.TEXT,Fn.DEFAULT],l2=function(){function y(h,n,u,r,s,P){this.maxExtent_=h,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(h,n){var u=this.getClipCoords(n);h.beginPath(),h.moveTo(u[0],u[1]),h.lineTo(u[2],u[3]),h.lineTo(u[4],u[5]),h.lineTo(u[6],u[7]),h.clip()},y.prototype.createExecutors_=function(h){for(var n in h){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=h[n];for(var s in r){var P=r[s];u[s]=new p0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(h){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=h.length;r<s;++r)if(h[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(h,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-h[0],-h[1]),V=!this.hitDetectionContext_;V&&(this.hitDetectionContext_=Ja(z,z));var N=this.hitDetectionContext_;N.canvas.width!==z||N.canvas.height!==z?(N.canvas.width=z,N.canvas.height=z):V||N.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),fy(me,h),gl(me,n*(this.renderBuffer_+r),me));var ve=u2(r),Se;function Ue(pt,Tt){for(var It=N.getImageData(0,0,z,z).data,Pt=0,Qt=ve.length;Pt<Qt;Pt++)if(It[ve[Pt]]>0){if(!P||Se!==Fn.IMAGE&&Se!==Fn.TEXT||P.indexOf(pt)!==-1){var Ft=(ve[Pt]-3)/4,er=r-Ft%z,hr=r-(Ft/z|0),kt=s(pt,Tt,er*er+hr*hr);if(kt)return kt}N.clearRect(0,0,z,z);break}}var et=Object.keys(this.executorsByZIndex_).map(Number);et.sort(rh);var Ie,Ne,He,nt,mt;for(Ie=et.length-1;Ie>=0;--Ie){var ht=et[Ie].toString();for(He=this.executorsByZIndex_[ht],Ne=c_.length-1;Ne>=0;--Ne)if(Se=c_[Ne],nt=He[Se],nt!==void 0&&(mt=nt.executeHitDetection(N,F,u,Ue,me),mt))return mt}},y.prototype.getClipCoords=function(h){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,h,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(h,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(h.save(),this.clip(h,u));var V=P||c_,N,me,ve,Se,Ue,et;for(z&&F.reverse(),N=0,me=F.length;N<me;++N){var Ie=F[N].toString();for(Ue=this.executorsByZIndex_[Ie],ve=0,Se=V.length;ve<Se;++ve){var Ne=V[ve];et=Ue[Ne],et!==void 0&&et.execute(h,n,u,r,s,z)}}this.maxExtent_&&h.restore()},y}(),h_={};function u2(y){if(h_[y]!==void 0)return h_[y];for(var h=y*2+1,n=y*y,u=new Array(n+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((y+r)*h+(y+s))*4+3),r>0&&z.push(((y-r)*h+(y+s))*4+3),s>0&&(z.push(((y+r)*h+(y-s))*4+3),r>0&&z.push(((y-r)*h+(y-s))*4+3))}for(var F=[],r=0,V=u.length;r<V;++r)u[r]&&F.push.apply(F,u[r]);return h_[y]=F,F}var p_=l2;var vd={ANIMATING:0,INTERACTING:1};var c2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),h2=function(y){c2(h,y);function h(n,u,r,s,P,z,F){var V=y.call(this)||this;return V.context_=n,V.pixelRatio_=u,V.extent_=r,V.transform_=s,V.viewRotation_=P,V.squaredTolerance_=z,V.userTransform_=F,V.contextFillState_=null,V.contextStrokeState_=null,V.contextTextState_=null,V.fillState_=null,V.strokeState_=null,V.image_=null,V.imageAnchorX_=0,V.imageAnchorY_=0,V.imageHeight_=0,V.imageOpacity_=0,V.imageOriginX_=0,V.imageOriginY_=0,V.imageRotateWithView_=!1,V.imageRotation_=0,V.imageScale_=[0,0],V.imageWidth_=0,V.text_="",V.textOffsetX_=0,V.textOffsetY_=0,V.textRotateWithView_=!1,V.textRotation_=0,V.textScale_=[0,0],V.textFillState_=null,V.textStrokeState_=null,V.textState_=null,V.pixelCoordinates_=[],V.tmpLocalTransform_=za(),V}return h.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,V=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=V*this.imageOpacity_);var N=this.imageRotation_;this.imageRotateWithView_&&(N+=this.viewRotation_);for(var me=0,ve=P.length;me<ve;me+=2){var Se=P[me]-this.imageAnchorX_,Ue=P[me+1]-this.imageAnchorY_;if(N!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var et=Se+this.imageAnchorX_,Ie=Ue+this.imageAnchorY_;vs(F,et,Ie,1,1,N,-et,-Ie),z.setTransform.apply(z,F),z.translate(et,Ie),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ue,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=V)}},h.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var V=P[u]+this.textOffsetX_,N=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,V,N,1,1,F,-V,-N);z.setTransform.apply(z,me),z.translate(V,N),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,V,N),this.textFillState_&&z.fillText(this.text_,V,N)}}},h.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var V=F.length;P&&(V-=2);for(var N=2;N<V;N+=2)z.lineTo(F[N],F[N+1]);return P&&z.closePath(),r},h.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},h.prototype.drawCircle=function(n){if(!!Ro(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=lx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},h.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},h.prototype.setTransform=function(n){this.transform_=n},h.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Ot.POINT:this.drawPoint(n);break;case Ot.LINE_STRING:this.drawLineString(n);break;case Ot.POLYGON:this.drawPolygon(n);break;case Ot.MULTI_POINT:this.drawMultiPoint(n);break;case Ot.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Ot.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Ot.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Ot.CIRCLE:this.drawCircle(n);break;default:}},h.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Ro(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},h.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},h.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},h.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},h.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},h.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Ro(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var V=0,N=z.length;V<N;++V)P=this.moveToLineTo_(s,P,z[V],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},h.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},h.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,V=P.length;F<V;++F){var N=P[F];s=this.drawRings_(r,s,N,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},h.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},h.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},h.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:gh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},h.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),V=u.getLineDashOffset(),N=u.getLineJoin(),me=u.getWidth(),ve=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:ep,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ue){return Ue*r.pixelRatio_}),lineDashOffset:(V||hc)*this.pixelRatio_,lineJoin:N!==void 0?N:Cu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:ve!==void 0?ve:pc,strokeStyle:Ts(P||fc)}}},h.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},h.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),V=s.getLineDashOffset(),N=s.getLineJoin(),me=s.getWidth(),ve=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:ep,lineDash:F||cc,lineDashOffset:V||hc,lineJoin:N!==void 0?N:Cu,lineWidth:me!==void 0?me:mc,miterLimit:ve!==void 0?ve:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ue=n.getOffsetX(),et=n.getOffsetY(),Ie=n.getRotateWithView(),Ne=n.getRotation(),He=n.getScaleArray(),nt=n.getText(),mt=n.getTextAlign(),ht=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:og,textAlign:mt!==void 0?mt:gh,textBaseline:ht!==void 0?ht:tp},this.text_=nt!==void 0?Array.isArray(nt)?nt.reduce(function(pt,Tt,It){return pt+=It%2?" ":Tt},""):nt:"",this.textOffsetX_=Ue!==void 0?this.pixelRatio_*Ue:0,this.textOffsetY_=et!==void 0?this.pixelRatio_*et:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ne!==void 0?Ne:0,this.textScale_=[this.pixelRatio_*He[0],this.pixelRatio_*He[1]]}},h}(ag),f0=h2;var Mu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var p2=function(){function y(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return y.prototype.clear=function(){this.cache_={},this.cacheSize_=0},y.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},y.prototype.expire=function(){if(this.canExpireCache()){var h=0;for(var n in this.cache_){var u=this.cache_[n];(h++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(h,n,u){var r=d0(h,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(h,n,u,r){var s=d0(h,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(h){this.maxCacheSize_=h,this.expire()},y}();function d0(y,h,n){var u=n?ig(n):"null";return h+":"+y+":"+u}var f_=new p2;var f2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),d2=function(y){f2(h,y);function h(n,u,r,s){var P=y.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return h.prototype.changed=function(){this.dispatchEvent(en.CHANGE)},h.prototype.getExtent=function(){return this.extent},h.prototype.getImage=function(){return jr()},h.prototype.getPixelRatio=function(){return this.pixelRatio_},h.prototype.getResolution=function(){return this.resolution},h.prototype.getState=function(){return this.state},h.prototype.load=function(){jr()},h}(nh),m0=d2;var m2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),sR=function(y){m2(h,y);function h(n,u,r,s,P,z){var F=y.call(this,n,u,r,Zi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=Zi.IDLE,F.imageLoadFunction_=z,F}return h.prototype.getImage=function(){return this.image_},h.prototype.handleImageError_=function(){this.state=Zi.ERROR,this.unlistenImage_(),this.changed()},h.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Tu(this.extent)/this.image_.height),this.state=Zi.LOADED,this.unlistenImage_(),this.changed()},h.prototype.load=function(){(this.state==Zi.IDLE||this.state==Zi.ERROR)&&(this.state=Zi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},h.prototype.setImage=function(n){this.image_=n,this.resolution=Tu(this.extent)/this.image_.height},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(m0);function d_(y,h,n){var u=y,r=!0,s=!1,P=!1,z=[Zp(u,en.LOAD,function(){P=!0,s||h()})];return u.src&&Pv?(s=!0,u.decode().then(function(){r&&h()}).catch(function(F){r&&(P?h():n())})):z.push(Zp(u,en.ERROR,n)),function(){r=!1,z.forEach(Mo)}}var g2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xd=null,y2=function(y){g2(h,y);function h(n,u,r,s,P,z){var F=y.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return h.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===Zi.LOADED){xd||(xd=Ja(1,1)),xd.drawImage(this.image_,0,0);try{xd.getImageData(0,0,1,1),this.tainted_=!1}catch{xd=null,this.tainted_=!0}}return this.tainted_===!0},h.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(en.CHANGE)},h.prototype.handleImageError_=function(){this.imageState_=Zi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},h.prototype.handleImageLoad_=function(){this.imageState_=Zi.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_()},h.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},h.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},h.prototype.getImageState=function(){return this.imageState_},h.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},h.prototype.getSize=function(){return this.size_},h.prototype.getSrc=function(){return this.src_},h.prototype.load=function(){if(this.imageState_==Zi.IDLE){this.imageState_=Zi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},h.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==Zi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=ig(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,V=this.color_[2]/255,N=this.color_[3],me=0,ve=P.length;me<ve;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=V,P[me+3]*=N;r.putImageData(s,0,0)}}},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(nh);function g0(y,h,n,u,r,s){var P=f_.get(h,u,s);return P||(P=new y2(y,h,n,u,r,s),f_.set(h,u,s,P)),P}var _2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),v2=function(y){_2(h,y);function h(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=y.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Mu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Mu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var V=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var N=r.src;En(!(N!==void 0&&V),4),En(!V||V&&u.imgSize_,5),(N===void 0||N.length===0)&&V&&(N=V.src||Pi(V)),En(N!==void 0&&N.length>0,6);var me=r.src!==void 0?Zi.IDLE:Zi.LOADED;return u.color_=r.color!==void 0?Qh(r.color):null,u.iconImage_=g0(V,N,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return h.prototype.clone=function(){var n=this.getScale();return new h({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:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},h.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Mu.FRACTION||this.anchorYUnits_==Mu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Mu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Mu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},h.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},h.prototype.getColor=function(){return this.color_},h.prototype.getImage=function(n){return this.iconImage_.getImage(n)},h.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},h.prototype.getImageSize=function(){return this.iconImage_.getSize()},h.prototype.getImageState=function(){return this.iconImage_.getImageState()},h.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},h.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},h.prototype.getSrc=function(){return this.iconImage_.getSrc()},h.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},h.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(en.CHANGE,n)},h.prototype.load=function(){this.iconImage_.load()},h.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(en.CHANGE,n)},h}(rg),m_=v2;var Kl=.5;function y0(y,h,n,u,r,s,P){var z=y[0]*Kl,F=y[1]*Kl,V=Ja(z,F);V.imageSmoothingEnabled=!1;for(var N=V.canvas,me=new f0(V,Kl,r,null,P),ve=n.length,Se=Math.floor((256*256*256-1)/ve),Ue={},et=1;et<=ve;++et){var Ie=n[et-1],Ne=Ie.getStyleFunction()||u;if(!!u){var He=Ne(Ie,s);if(!!He){Array.isArray(He)||(He=[He]);for(var nt=et*Se,mt="#"+("000000"+nt.toString(16)).slice(-6),ht=0,pt=He.length;ht<pt;++ht){var Tt=He[ht],It=Tt.getGeometryFunction()(Ie);if(!(!It||!Ro(r,It.getExtent()))){var Pt=Tt.clone(),Qt=Pt.getFill();Qt&&Qt.setColor(mt);var Ft=Pt.getStroke();Ft&&(Ft.setColor(mt),Ft.setLineDash(null)),Pt.setText(void 0);var er=Tt.getImage();if(er&&er.getOpacity()!==0){var hr=er.getImageSize();if(!hr)continue;var kt=Ja(hr[0],hr[1],void 0,{alpha:!1}),mr=kt.canvas;kt.fillStyle=mt,kt.fillRect(0,0,mr.width,mr.height),Pt.setImage(new m_({img:mr,imgSize:hr,anchor:er.getAnchor(),anchorXUnits:Mu.PIXELS,anchorYUnits:Mu.PIXELS,offset:er.getOrigin(),opacity:1,size:er.getSize(),scale:er.getScale(),rotation:er.getRotation(),rotateWithView:er.getRotateWithView()}))}var vr=Pt.getZIndex()||0,Lr=Ue[vr];Lr||(Lr={},Ue[vr]=Lr,Lr[Ot.POLYGON]=[],Lr[Ot.CIRCLE]=[],Lr[Ot.LINE_STRING]=[],Lr[Ot.POINT]=[]),Lr[It.getType().replace("Multi","")].push(It,Pt)}}}}}for(var Ar=Object.keys(Ue).map(Number).sort(rh),et=0,Rr=Ar.length;et<Rr;++et){var Lr=Ue[Ar[et]];for(var Sr in Lr)for(var vi=Lr[Sr],ht=0,pt=vi.length;ht<pt;ht+=2){me.setStyle(vi[ht+1]);for(var jt=0,ei=h.length;jt<ei;++jt)me.setTransform(h[jt]),me.drawGeometry(vi[ht])}}return V.getImageData(0,0,N.width,N.height)}function _0(y,h,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*Kl),s=Math.floor(Math.round(y[1])*Kl),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],V=n.data[P+2],N=V+256*(F+256*z),me=Math.floor((256*256*256-1)/h.length);N&&N%me===0&&u.push(h[N/me-1])}return u}var x2=.5,v0={Point:C2,LineString:T2,Polygon:P2,MultiPoint:A2,MultiLineString:S2,MultiPolygon:I2,GeometryCollection:E2,Circle:b2};function x0(y,h){return parseInt(Pi(y),10)-parseInt(Pi(h),10)}function b0(y,h){var n=sg(y,h);return n*n}function sg(y,h){return x2*y/h}function b2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Fn.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}function g_(y,h,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var V=F.getImageState();V==Zi.LOADED||V==Zi.ERROR?F.unlistenImageChange(r):(V==Zi.IDLE&&F.load(),V=F.getImageState(),F.listenImageChange(r),z=!0)}return w2(y,h,n,u,s,P),z}function w2(y,h,n,u,r,s){var P=n.getGeometryFunction()(h);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)w0(y,z,n,h);else{var V=v0[z.getType()];V(y,z,n,h,s)}}}function w0(y,h,n,u){if(h.getType()==Ot.GEOMETRY_COLLECTION){for(var r=h.getGeometries(),s=0,P=r.length;s<P;++s)w0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),Fn.DEFAULT);z.drawCustom(h,u,n.getRenderer(),n.getHitDetectionRenderer())}function E2(y,h,n,u,r){var s=h.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=v0[s[P].getType()];F(y,s[P],n,u,r)}}function T2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Fn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function S2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Fn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function I2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),Fn.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}function C2(y,h,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=Zi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Fn.IMAGE);F.setImageStyle(s,z),F.drawPoint(h,u)}if(P&&P.getText()){var V=y.getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(P,z),V.drawText(h,u)}}function A2(y,h,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=Zi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Fn.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(h,u)}if(P&&P.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(P,z),V.drawText(h,u)}}function P2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Fn.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}var M2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),k2=function(y){M2(h,y);function h(n){var u=y.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return h.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,V=P.projection,N=P.rotation,me=V.getExtent(),ve=this.getLayer().getSource(),Se=u.pixelRatio,Ue=u.viewHints,et=!(Ue[vd.ANIMATING]||Ue[vd.INTERACTING]),Ie=this.context,Ne=Math.round(u.size[0]*Se),He=Math.round(u.size[1]*Se),nt=ve.getWrapX()&&V.canWrapX(),mt=nt?bs(me):null,ht=nt?Math.ceil((s[2]-me[2])/mt)+1:1,pt=nt?Math.floor((s[0]-me[0])/mt):0;do{var Tt=this.getRenderTransform(z,F,N,Se,Ne,He,pt*mt);n.execute(Ie,1,Tt,N,et,void 0,r)}while(++pt<ht)},h.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},h.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];Lv(this.pixelTransform,1/r,1/r),zv(this.inversePixelTransform,this.pixelTransform);var P=py(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,V=this.replayGroup_,N=this.declutterExecutorGroup;if((!V||V.isEmpty())&&(!N||N.isEmpty()))return null;var me=Math.round(n.size[0]*r),ve=Math.round(n.size[1]*r);F.width!=me||F.height!=ve?(F.width=me,F.height=ve,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,ve),this.preRender(z,n);var Se=n.viewState,Ue=Se.projection,et=!1,Ie=!0;if(s.extent&&this.clipping){var Ne=ed(s.extent,Ue);Ie=Ro(Ne,n.extent),et=Ie&&!lc(Ne,n.extent),et&&this.clipUnrotated(z,n,Ne)}Ie&&this.renderWorlds(V,n),et&&z.restore(),this.postRender(z,n);var He=Gx(s.opacity),nt=this.container;return He!==nt.style.opacity&&(nt.style.opacity=He),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},h.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];bo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,V=this.wrappedRenderedExtent_,N=this.getLayer(),me=[],ve=r[0]*Kl,Se=r[1]*Kl;me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,0).slice());var Ue=N.getSource(),et=F.getExtent();if(Ue.getWrapX()&&F.canWrapX()&&!lc(et,V)){for(var Ie=V[0],Ne=bs(et),He=0,nt=void 0;Ie<et[0];)--He,nt=Ne*He,me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,nt).slice()),Ie+=Ne;for(He=0,Ie=V[2];Ie>et[2];)++He,nt=Ne*He,me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,nt).slice()),Ie-=Ne}this.hitDetectionImageData_=y0(r,me,this.renderedFeatures_,N.getStyleFunction(),V,P,z)}u(_0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},h.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,V=u.viewState.rotation,N=this.getLayer(),me={},ve=function(et,Ie,Ne){var He=Pi(et),nt=me[He];if(nt){if(nt!==!0&&Ne<nt.distanceSq){if(Ne===0)return me[He]=!0,P.splice(P.lastIndexOf(nt),1),s(et,N,Ie);nt.geometry=Ie,nt.distanceSq=Ne}}else{if(Ne===0)return me[He]=!0,s(et,N,Ie);P.push(me[He]={feature:et,layer:N,geometry:Ie,distanceSq:Ne,callback:s})}},Se,Ue=[this.replayGroup_];return this.declutterExecutorGroup&&Ue.push(this.declutterExecutorGroup),Ue.some(function(et){return Se=et.forEachFeatureAtCoordinate(n,F,V,r,ve,et===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},h.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},h.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},h.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[vd.ANIMATING],P=n.viewHints[vd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var V=n.extent,N=n.viewState,me=N.projection,ve=N.resolution,Se=n.pixelRatio,Ue=u.getRevision(),et=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=x0);var Ne=N.center.slice(),He=gl(V,et*ve),nt=He.slice(),mt=[He.slice()],ht=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!lc(ht,n.extent)){var pt=bs(ht),Tt=Math.max(bs(He)/2,pt);He[0]=ht[0]-Tt,He[2]=ht[2]+Tt,Qv(Ne,me);var It=Gv(mt[0],me);It[0]<ht[0]&&It[2]<ht[2]?mt.push([It[0]+pt,It[1],It[2]+pt,It[3]]):It[0]>ht[0]&&It[2]>ht[2]&&mt.push([It[0]-pt,It[1],It[2]-pt,It[3]])}if(!this.dirty_&&this.renderedResolution_==ve&&this.renderedRevision_==Ue&&this.renderedRenderOrder_==Ie&&lc(this.wrappedRenderedExtent_,He))return _s(this.renderedExtent_,nt)||(this.hitDetectionImageData_=null,this.renderedExtent_=nt),this.renderedCenter_=Ne,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Pt=new u_(sg(ve,Se),He,ve,Se),Qt;this.getLayer().getDeclutter()&&(Qt=new u_(sg(ve,Se),He,ve,Se));var Ft=uh(),er;if(Ft){for(var hr=0,kt=mt.length;hr<kt;++hr){var mr=mt[hr],vr=ef(mr,me);r.loadFeatures(vr,ix(ve,me),Ft)}er=Vm(Ft,me)}else for(var hr=0,kt=mt.length;hr<kt;++hr)r.loadFeatures(mt[hr],ve,me);var Lr=b0(ve,Se),Ar=function(ei){var bi,ai=ei.getStyleFunction()||u.getStyleFunction();if(ai&&(bi=ai(ei,ve)),bi){var zi=this.renderFeature(ei,Lr,bi,Pt,er,Qt);this.dirty_=this.dirty_||zi}}.bind(this),Rr=ef(He,me),Sr=r.getFeaturesInExtent(Rr);Ie&&Sr.sort(Ie);for(var hr=0,kt=Sr.length;hr<kt;++hr)Ar(Sr[hr]);this.renderedFeatures_=Sr;var vi=Pt.finish(),jt=new p_(He,ve,Se,r.getOverlaps(),vi,u.getRenderBuffer());return Qt&&(this.declutterExecutorGroup=new p_(He,ve,Se,r.getOverlaps(),Qt.finish(),u.getRenderBuffer())),this.renderedResolution_=ve,this.renderedRevision_=Ue,this.renderedRenderOrder_=Ie,this.renderedExtent_=nt,this.wrappedRenderedExtent_=He,this.renderedCenter_=Ne,this.renderedProjection_=me,this.replayGroup_=jt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},h.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var V=0,N=r.length;V<N;++V)F=g_(s,n,r[V],u,this.boundHandleStyleImageChange_,P,z)||F;else F=g_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},h}(l0),E0=k2;var L2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),R2=function(y){L2(h,y);function h(n){return y.call(this,n)||this}return h.prototype.createRenderer=function(){return new E0(this)},h}(t0),rp=R2;var T0=jp(a_(),1);var z2=function(){function y(h){this.rbush_=new T0.default(h),this.items_={}}return y.prototype.insert=function(h,n){var u={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3],value:n};this.rbush_.insert(u),this.items_[Pi(n)]=u},y.prototype.load=function(h,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=h[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Pi(z)]=F}this.rbush_.load(u)},y.prototype.remove=function(h){var n=Pi(h),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(h,n){var u=this.items_[Pi(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Fm(r,h)||(this.remove(n),this.insert(h,n))},y.prototype.getAll=function(){var h=this.rbush_.all();return h.map(function(n){return n.value})},y.prototype.getInExtent=function(h){var n={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(h){return this.forEach_(this.getAll(),h)},y.prototype.forEachInExtent=function(h,n){return this.forEach_(this.getInExtent(h),n)},y.prototype.forEach_=function(h,n){for(var u,r=0,s=h.length;r<s;r++)if(u=n(h[r]),u)return u;return u},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(h){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,h)},y.prototype.concat=function(h){this.rbush_.load(h.rbush_.all());for(var n in h.items_)this.items_[n]=h.items_[n]},y}(),bd=z2;var D2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(h,y);function h(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=S0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Iu.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return h.prototype.getAttributions=function(){return this.attributions_},h.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},h.prototype.getProjection=function(){return this.projection},h.prototype.getResolutions=function(){return jr()},h.prototype.getView=function(){return this.viewPromise_},h.prototype.getState=function(){return this.state_},h.prototype.getWrapX=function(){return this.wrapX_},h.prototype.getInterpolate=function(){return this.interpolate_},h.prototype.refresh=function(){this.changed()},h.prototype.setAttributions=function(n){this.attributions_=S0(n),this.changed()},h.prototype.setState=function(n){this.state_=n,this.changed()},h}(ko);function S0(y){return y?Array.isArray(y)?function(h){return y}:typeof y=="function"?y:function(h){return[y]}:null}var uf=O2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function I0(y,h){return[[-1/0,-1/0,1/0,1/0]]}var vh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var F2=!1;function B2(y,h,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),h.getType()==vh.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=F2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var V=h.getType(),N=void 0;V==vh.JSON||V==vh.TEXT?N=z.responseText:V==vh.XML?(N=z.responseXML,N||(N=new DOMParser().parseFromString(z.responseText,"application/xml"))):V==vh.ARRAY_BUFFER&&(N=z.response),N?s(h.readFeatures(N,{extent:n,featureProjection:r}),h.readProjection(N)):P()}else P()},z.onerror=P,z.send()}function y_(y,h){return function(n,u,r,s,P){var z=this;B2(y,h,n,u,r,function(F,V){z.addFeatures(F),s!==void 0&&s(F)},P||Zh)}}var C0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xh=function(y){C0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return h}(ln);var U2=function(y){C0(h,y);function h(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Iu.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=Zh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(En(u.format_,7),u.loader_=y_(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:I0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new bd:null,u.loadedExtentsRtree_=new bd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new dh(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return h.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},h.prototype.addFeatureInternal=function(n){var u=Pi(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new xh(Qa.ADDFEATURE,n))},h.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[lo(u,en.CHANGE,this.handleFeatureChange_,this),lo(u,qp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},h.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(En(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},h.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},h.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],V=Pi(F);this.addToIndex_(V,F)&&r.push(F)}for(var P=0,N=r.length;P<N;P++){var F=r[P],V=Pi(F);this.setupChangeEvents_(V,F);var me=F.getGeometry();if(me){var ve=me.getExtent();u.push(ve),s.push(F)}else this.nullGeometryFeatures_[V]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new xh(Qa.ADDFEATURE,r[P]))},h.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(Es.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(Es.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},h.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Mo)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new xh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},h.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},h.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},h.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},h.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},h.prototype.getFeaturesCollection=function(){return this.featuresCollection_},h.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(n,Am(this.nullGeometryFeatures_))),n},h.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},h.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},h.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,V=[-1/0,-1/0,1/0,1/0],N=u||Cm;return this.featuresRtree_.forEachInExtent(V,function(me){if(N(me)){var ve=me.getGeometry(),Se=F;if(F=ve.closestPointXY(r,s,z,F),F<Se){P=me;var Ue=Math.sqrt(F);V[0]=r-Ue,V[1]=s-Ue,V[2]=r+Ue,V[3]=s+Ue}}}),P},h.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},h.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},h.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},h.prototype.getFormat=function(){return this.format_},h.prototype.getOverlaps=function(){return this.overlaps_},h.prototype.getUrl=function(){return this.url_},h.prototype.handleFeatureChange_=function(n){var u=n.target,r=Pi(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new xh(Qa.CHANGEFEATURE,u))},h.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Pi(n)in this.uidIndex_},h.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},h.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,ve){var Se=P[me],Ue=s.forEachInExtent(Se,function(et){return lc(et.extent,Se)});Ue||(++F.loadingExtentsCount_,F.dispatchEvent(new xh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(et){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADEND,void 0,et))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,V=0,N=P.length;V<N;++V)z(V,N);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},h.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},h.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Fm(s.extent,n))return r=s,!0}),r&&u.remove(r)},h.prototype.removeFeature=function(n){if(!!n){var u=Pi(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},h.prototype.removeFeatureInternal=function(n){var u=Pi(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Mo),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new xh(Qa.REMOVEFEATURE,n)),n}},h.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},h.prototype.setLoader=function(n){this.loader_=n},h.prototype.setUrl=function(n){En(this.format_,7),this.url_=n,this.setLoader(y_(n,this.format_))},h}(uf),ip=U2;var A0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),cf=function(y){A0(h,y);function h(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return h}(ln);var __={LAYERS:"layers"},N2=function(y){A0(h,y);function h(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=y.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(__.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new dh(P.slice(),{unique:!0}):En(typeof P.getArray=="function",43):P=new dh(void 0,{unique:!0}),u.setLayers(P),u}return h.prototype.handleLayerChange_=function(){this.changed()},h.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Mo),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(lo(n,Es.ADD,this.handleLayersAdd_,this),lo(n,Es.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Mo);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new cf("addlayer",z))}this.changed()},h.prototype.registerLayerListeners_=function(n){var u=[lo(n,qp.PROPERTYCHANGE,this.handleLayerChange_,this),lo(n,en.CHANGE,this.handleLayerChange_,this)];n instanceof h&&u.push(lo(n,"addlayer",this.handleLayerGroupAdd_,this),lo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Pi(n)]=u},h.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new cf("addlayer",n.layer))},h.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new cf("removelayer",n.layer))},h.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new cf("addlayer",u)),this.changed()},h.prototype.handleLayersRemove_=function(n){var u=n.element,r=Pi(u);this.listenerKeys_[r].forEach(Mo),delete this.listenerKeys_[r],this.dispatchEvent(new cf("removelayer",u)),this.changed()},h.prototype.getLayers=function(){return this.get(__.LAYERS)},h.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new cf("removelayer",r[s]));this.set(__.LAYERS,n)},h.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},h.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(N){N.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var V=u[z];V.opacity*=s.opacity,V.visible=V.visible&&s.visible,V.maxResolution=Math.min(V.maxResolution,s.maxResolution),V.minResolution=Math.max(V.minResolution,s.minResolution),V.minZoom=Math.max(V.minZoom,s.minZoom),V.maxZoom=Math.min(V.maxZoom,s.maxZoom),s.extent!==void 0&&(V.extent!==void 0?V.extent=Bv(V.extent,s.extent):V.extent=s.extent),V.zIndex===void 0&&(V.zIndex=P)}return u},h.prototype.getSourceState=function(){return Iu.READY},h}(Qm),v_=N2;var na={SINGLECLICK:"singleclick",CLICK:en.CLICK,DBLCLICK:en.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var x_={ACTIVE:"active"};var V2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),G2=function(y){V2(h,y);function h(n){var u=y.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return h.prototype.getActive=function(){return this.get(x_.ACTIVE)},h.prototype.getMap=function(){return this.map_},h.prototype.handleEvent=function(n){return!0},h.prototype.setActive=function(n){this.set(x_.ACTIVE,n)},h.prototype.setMap=function(n){this.map_=n},h}(ko);var P0=G2;var j2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),q2=function(y){j2(h,y);function h(n){var u=this,r=n||{};return u=y.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return h.prototype.getPointerCount=function(){return this.targetPointers.length},h.prototype.handleDownEvent=function(n){return!1},h.prototype.handleDragEvent=function(n){},h.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==na.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==na.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==na.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==na.POINTERMOVE&&this.handleMoveEvent(n);return!u},h.prototype.handleMoveEvent=function(n){},h.prototype.handleUpEvent=function(n){return!1},h.prototype.stopDown=function(n){return n},h.prototype.updateTrackedPointers_=function(n){if(Z2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==na.POINTERUP?delete this.trackedPointers_[r]:n.type==na.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Am(this.trackedPointers_)}},h}(P0);function Z2(y){var h=y.type;return h===na.POINTERDOWN||h===na.POINTERDRAG||h===na.POINTERUP}var M0=q2;var k0=function(y){var h=y.originalEvent;return h.altKey&&!(h.metaKey||h.ctrlKey)&&!h.shiftKey};var L0=Cm,R0=function(y){return y.type==na.CLICK};var z0=function(y){return y.type==na.SINGLECLICK};var D0=function(y){var h=y.originalEvent;return En(h!==void 0,56),h.isPrimary&&h.button===0};var N0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O0=0,wd=1,F0=[0,0,0,0],hf=[],b_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},w_=function(y){N0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return h}(ln);var X2=function(y){N0(h,y);function h(n){var u=y.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:D0,u.defaultDeleteCondition_=function(s){return k0(s)&&z0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:L0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new bd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new rp({source:new ip({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:$2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new dh(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(Es.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(Es.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return h.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(en.CHANGE,this.boundHandleFeatureChange_)},h.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new dh;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,V=z.length;F<V;++F){var N=z[F].feature;N&&r.indexOf(N)===-1&&this.featuresBeingModified_.push(N)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new w_(b_.MODIFYSTART,this.featuresBeingModified_,n))}},h.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(en.CHANGE,this.boundHandleFeatureChange_)},h.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},h.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},h.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},h.prototype.getOverlay=function(){return this.overlay_},h.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},h.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},h.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},h.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},h.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},h.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},h.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},h.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(Eu(z),F)}},h.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,V=z.length-1;F<V;++F){var N=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:N};this.rBush_.insert(Eu(N),me)}},h.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,V=z.length-1;F<V;++F){var N=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:N};this.rBush_.insert(Eu(N),me)}},h.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,V=z.length;F<V;++F)for(var N=z[F],me=0,ve=N.length-1;me<ve;++me){var Se=N.slice(me,me+2),Ue={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(Eu(Se),Ue)}},h.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:O0,segment:[r,r]},P={feature:n,geometry:u,index:wd,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Kp(r),s);var F=u,V=uh();if(V&&this.getMap()){var N=this.getMap().getView().getProjection();F=F.clone().transform(V,N),F=Dy(F).transform(N,V)}this.rBush_.insert(F.getExtent(),P)},h.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},h.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new uc(new _a(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},h.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==na.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=na.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==na.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,n)&&!u},h.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],V=F[0],N=V.feature;r.indexOf(N)===-1&&r.push(N);var me=V.geometry;s.indexOf(me)===-1&&s.push(me);for(var ve=V.depth,Se=void 0,Ue=V.segment,et=F[1];u.length<me.getStride();)u.push(Ue[et][u.length]);switch(me.getType()){case Ot.POINT:Se=u,Ue[0]=u,Ue[1]=u;break;case Ot.MULTI_POINT:Se=me.getCoordinates(),Se[V.index]=u,Ue[0]=u,Ue[1]=u;break;case Ot.LINE_STRING:Se=me.getCoordinates(),Se[V.index+et]=u,Ue[et]=u;break;case Ot.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.POLYGON:Se=me.getCoordinates(),Se[ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.MULTI_POLYGON:Se=me.getCoordinates(),Se[ve[1]][ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.CIRCLE:if(Ue[0]=u,Ue[1]=u,V.index===O0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ne=Ey(Xl(me.getCenter(),Ie),Xl(u,Ie)),He=uh();if(He){var nt=me.clone().transform(He,Ie);nt.setRadius(Ne),Ne=nt.transform(Ie,He).getRadius()}me.setRadius(Ne),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},h.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=Eu([z]),V=this.rBush_.getInExtent(F),N={};V.sort(W2);for(var me=0,ve=V.length;me<ve;++me){var Se=V[me],Ue=Se.segment,et=Pi(Se.geometry),Ie=Se.depth;if(Ie&&(et+="-"+Ie.join("-")),N[et]||(N[et]=new Array(2)),Se.geometry.getType()===Ot.CIRCLE&&Se.index===wd){var Ne=U0(u,Se,s);Su(Ne,z)&&!N[et][0]&&(this.dragSegments_.push([Se,0]),N[et][0]=Se);continue}if(Su(Ue[0],z)&&!N[et][0]){this.dragSegments_.push([Se,0]),N[et][0]=Se;continue}if(Su(Ue[1],z)&&!N[et][1]){if((Se.geometry.getType()===Ot.LINE_STRING||Se.geometry.getType()===Ot.MULTI_LINE_STRING)&&N[et][0]&&N[et][0].index===0)continue;this.dragSegments_.push([Se,1]),N[et][1]=Se;continue}Pi(Ue)in this.vertexSegments_&&!N[et][0]&&!N[et][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var He=P.length-1;He>=0;--He)this.insertVertex_(P[He],z)}return!!this.vertexFeature_},h.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Ot.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Kp(P),z);var V=s,N=uh();if(N){var me=n.map.getView().getProjection();V=V.clone().transform(N,me),V=Dy(V).transform(me,N)}this.rBush_.update(V.getExtent(),F)}else this.rBush_.update(Eu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},h.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},h.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(kt,mr){return B0(P,kt,z)-B0(P,mr,z)},V,N;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(kt){return kt===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(kt,mr,vr){if(vr=vr||kt.getGeometry(),vr.getType()===Ot.POINT&&vv(s.features_.getArray(),kt)){N=vr;var Lr=vr.getFlatCoordinates().slice(0,2);V=[{feature:kt,geometry:vr,segment:[Lr,Lr]}]}return!0},{layerFilter:me})}if(!V){var ve=ed(Kp(P,F0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ue=ef(gl(ve,Se,F0),z);V=this.rBush_.getInExtent(Ue)}if(V&&V.length>0){var et=V.sort(F)[0],Ie=et.segment,Ne=U0(P,et,z),He=u.getPixelFromCoordinate(Ne),nt=Ey(n,He);if(N||nt<=this.pixelTolerance_){var mt={};if(mt[Pi(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ne[0]-P[0],this.delta_[1]=Ne[1]-P[1]),et.geometry.getType()===Ot.CIRCLE&&et.index===wd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ne,[et.feature],[et.geometry]);else{var ht=u.getPixelFromCoordinate(Ie[0]),pt=u.getPixelFromCoordinate(Ie[1]),Tt=Qp(He,ht),It=Qp(He,pt);nt=Math.sqrt(Math.min(Tt,It)),this.snappedToVertex_=nt<=this.pixelTolerance_,this.snappedToVertex_&&(Ne=Tt>It?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ne,[et.feature],[et.geometry]);var Pt={};Pt[Pi(et.geometry)]=!0;for(var Qt=1,Ft=V.length;Qt<Ft;++Qt){var er=V[Qt].segment;if(Su(Ie[0],er[0])&&Su(Ie[1],er[1])||Su(Ie[0],er[1])&&Su(Ie[1],er[0])){var hr=Pi(V[Qt].geometry);hr in Pt||(Pt[hr]=!0,mt[Pi(er)]=!0)}else break}}this.vertexSegments_=mt;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},h.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,V;u.length<P.getStride();)u.push(0);switch(P.getType()){case Ot.MULTI_LINE_STRING:V=P.getCoordinates(),V[z[0]].splice(F+1,0,u);break;case Ot.POLYGON:V=P.getCoordinates(),V[z[0]].splice(F+1,0,u);break;case Ot.MULTI_POLYGON:V=P.getCoordinates(),V[z[1]][z[0]].splice(F+1,0,u);break;case Ot.LINE_STRING:V=P.getCoordinates(),V.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,V);var N=this.rBush_;N.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};N.insert(Eu(me.segment),me),this.dragSegments_.push([me,1]);var ve={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};N.insert(Eu(ve.segment),ve),this.dragSegments_.push([ve,0]),this.ignoreNextSingleClick_=!0},h.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=na.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},h.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,V,N,me,ve,Se,Ue,et;for(V=n.length-1;V>=0;--V)z=n[V],Ue=z[0],et=Pi(Ue.feature),Ue.depth&&(et+="-"+Ue.depth.join("-")),et in u||(u[et]={}),z[1]===0?(u[et].right=Ue,u[et].index=Ue.index):z[1]==1&&(u[et].left=Ue,u[et].index=Ue.index+1);for(et in u){switch(Se=u[et].right,me=u[et].left,N=u[et].index,ve=N-1,me!==void 0?Ue=me:Ue=Se,ve<0&&(ve=0),F=Ue.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Ot.MULTI_LINE_STRING:P[Ue.depth[0]].length>2&&(P[Ue.depth[0]].splice(N,1),r=!0);break;case Ot.LINE_STRING:P.length>2&&(P.splice(N,1),r=!0);break;case Ot.MULTI_POLYGON:s=s[Ue.depth[1]];case Ot.POLYGON:s=s[Ue.depth[0]],s.length>4&&(N==s.length-1&&(N=0),s.splice(N,1),r=!0,N===0&&(s.pop(),s.push(s[0]),ve=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ne={depth:Ue.depth,feature:Ue.feature,geometry:Ue.geometry,index:ve,segment:Ie};this.rBush_.insert(Eu(Ne.segment),Ne)}this.updateSegmentIndices_(F,N,Ue.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},h.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},h.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},h}(M0);function W2(y,h){return y.index-h.index}function B0(y,h,n){var u=h.geometry;if(u.getType()===Ot.CIRCLE){var r=u;if(h.index===wd){var s=uh();s&&(r=r.clone().transform(s,n));var P=Qp(r.getCenter(),Xl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Xl(y,n);return hf[0]=Xl(h.segment[0],n),hf[1]=Xl(h.segment[1],n),Jv(F,hf)}function U0(y,h,n){var u=h.geometry;if(u.getType()===Ot.CIRCLE&&h.index===wd){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Iy(r.getClosestPoint(Xl(y,n)),n)}var P=Xl(y,n);return hf[0]=Xl(h.segment[0],n),hf[1]=Xl(h.segment[1],n),Iy(wy(P,hf),n)}function $2(){var y=Yx();return function(h,n){return y[Ot.POINT]}}var E_=X2;var K2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(h,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(h);n.extent&&r&&r.getUnits()===sc.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(h){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},h)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(h,n){return jr()},y.prototype.readFeatures=function(h,n){return jr()},y.prototype.readGeometry=function(h,n){return jr()},y.prototype.readProjection=function(h){return jr()},y.prototype.writeFeature=function(h,n){return jr()},y.prototype.writeFeatures=function(h,n){return jr()},y.prototype.writeGeometry=function(h,n){return jr()},y}(),V0=K2;function T_(y,h,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!rx(u,r)?s=(h?y.clone():y).transform(h?u:r,h?r:u):s=y,h&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var V=0,N=F.length;V<N;++V)F[V]=Math.round(F[V]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var H2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y2=function(y){H2(h,y);function h(){return y.call(this)||this}return h.prototype.getType=function(){return vh.JSON},h.prototype.readFeature=function(n,u){return this.readFeatureFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readFeatureFromObject=function(n,u){return jr()},h.prototype.readFeaturesFromObject=function(n,u){return jr()},h.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readGeometryFromObject=function(n,u){return jr()},h.prototype.readProjection=function(n){return this.readProjectionFromObject(lg(n))},h.prototype.readProjectionFromObject=function(n){return jr()},h.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},h.prototype.writeFeatureObject=function(n,u){return jr()},h.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},h.prototype.writeFeaturesObject=function(n,u){return jr()},h.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},h.prototype.writeGeometryObject=function(n,u){return jr()},h}(V0);function lg(y){if(typeof y=="string"){var h=JSON.parse(y);return h||null}else return y!==null?y:null}var G0=Y2;var J2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(h,y);function h(n){var u=this,r=n||{};return u=y.call(this)||this,u.dataProjection=ya(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ya(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return h.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=S_(r.geometry,u),P=new uc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},h.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,V=z.length;F<V;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},h.prototype.readGeometryFromObject=function(n,u){return S_(n,u)},h.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ya(u.properties.name):u.type==="EPSG"?r=ya("EPSG:"+u.properties.code):En(!1,36):r=this.dataProjection,r},h.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=I_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},h.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},h.prototype.writeGeometryObject=function(n,u){return I_(n,this.adaptOptions(u))},h}(G0);function S_(y,h){if(!y)return null;var n;switch(y.type){case Ot.POINT:{n=tE(y);break}case Ot.LINE_STRING:{n=rE(y);break}case Ot.POLYGON:{n=aE(y);break}case Ot.MULTI_POINT:{n=nE(y);break}case Ot.MULTI_LINE_STRING:{n=iE(y);break}case Ot.MULTI_POLYGON:{n=oE(y);break}case Ot.GEOMETRY_COLLECTION:{n=eE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return T_(n,!1,h)}function eE(y,h){var n=y.geometries.map(function(u){return S_(u,h)});return new px(n)}function tE(y){return new _a(y.coordinates)}function rE(y){return new Wl(y.coordinates)}function iE(y){return new Tx(y.coordinates)}function nE(y){return new Km(y.coordinates)}function oE(y){return new kx(y.coordinates)}function aE(y){return new cd(y.coordinates)}function I_(y,h){y=T_(y,!0,h);var n=y.getType(),u;switch(n){case Ot.POINT:{u=pE(y,h);break}case Ot.LINE_STRING:{u=lE(y,h);break}case Ot.POLYGON:{u=fE(y,h);break}case Ot.MULTI_POINT:{u=cE(y,h);break}case Ot.MULTI_LINE_STRING:{u=uE(y,h);break}case Ot.MULTI_POLYGON:{u=hE(y,h);break}case Ot.GEOMETRY_COLLECTION:{u=sE(y,h);break}case Ot.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function sE(y,h){var n=y.getGeometriesArray().map(function(u){var r=Ra({},h);return delete r.featureProjection,I_(u,r)});return{type:"GeometryCollection",geometries:n}}function lE(y,h){return{type:"LineString",coordinates:y.getCoordinates()}}function uE(y,h){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function cE(y,h){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function hE(y,h){var n;return h&&(n=h.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function pE(y,h){return{type:"Point",coordinates:y.getCoordinates()}}function fE(y,h){var n;return h&&(n=h.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=Q2;var ug,dE=new Uint8Array(16);function C_(){if(!ug&&(ug=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ug))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ug(dE)}var xa=[];for(let y=0;y<256;++y)xa.push((y+256).toString(16).slice(1));function j0(y,h=0){return(xa[y[h+0]]+xa[y[h+1]]+xa[y[h+2]]+xa[y[h+3]]+"-"+xa[y[h+4]]+xa[y[h+5]]+"-"+xa[y[h+6]]+xa[y[h+7]]+"-"+xa[y[h+8]]+xa[y[h+9]]+"-"+xa[y[h+10]]+xa[y[h+11]]+xa[y[h+12]]+xa[y[h+13]]+xa[y[h+14]]+xa[y[h+15]]).toLowerCase()}var mE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),A_={randomUUID:mE};function gE(y,h,n){if(A_.randomUUID&&!h&&!y)return A_.randomUUID();y=y||{};let u=y.random||(y.rng||C_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,h){n=n||0;for(let r=0;r<16;++r)h[n+r]=u[r];return h}return j0(u)}var P_=gE;var np=class extends ko{constructor(n={}){super();this.properties={};this.options={};this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.options=n,this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=P_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let V=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",V||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(V=>V.visible)&&this.children.forEach(V=>{V.visible=!0}),this.parent&&this.group){let V=this.parent;for(;V.parent;)V=V.parent;let N=new ln("change:visible:group");N.target=this,V.dispatchEvent(N)}}else this.visible||(this.children&&this.children.forEach(V=>{V.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(V=>V.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(V=>{V.parent=void 0}),Array.isArray(F)&&F.forEach(V=>{V.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return $f(this)}};function yE(y){return class extends y{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),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(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new ln("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new ln("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var cg=yE;var Ed=class extends cg(np){constructor(n){super(n);this.olLayer?.setVisible(this.visible)}defineProperties(n){super.defineProperties(n),Object.defineProperties(this,{olLayer:{value:n.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!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.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ha(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(){Ha([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new Ed({...this.options,...n})}},Is=Ed;var q0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),_E=new $l({stroke:new va({color:[0,0,0,1],width:5})}),vE=new $l({image:q0,stroke:new va({color:[255,0,0,1],width:3})}),xE=new $l({image:q0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),bE=(y,h)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=h<=n&&h>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[_E,vE]:[xE]},Td=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new rp({source:new ip,style:n.style||bE})}clone(n){return new Td({...this.options,...n})}},hg=Td;var wE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,Z0=/^([\d.]+),([\d.]+)$/,X0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,pg="stop-fetch",W0=y=>{let h=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&h.push(...u)}),h},Sd=class extends of{constructor(n={}){super(n);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 bl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:u=>{u&&(this.set("mot",u),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:u=>{this.set("loading",u)}},modify:{get:()=>this.get("modify"),set:u=>{this.set("modify",u)}}}),this.loading=!1,this.graphs=n.graphs||[["osm",0,99]],this.mot=n.mot||"bus",this.modify=n.modify!==!1,this.routingApiParams=n.routingApiParams,this.useRawViaPoints=n.useRawViaPoints||!1,this.snapToClosestStation=n.snapToClosestStation||!1,this.apiKey=n.apiKey,this.stopsApiKey=n.stopsApiKey||this.apiKey,this.stopsApiUrl=n.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new qf({...n}),this.routingLayer=n.routingLayer||new hg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new ln("change:route")),this.reset(),console.error(u)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(n,u){let r=u.getView();return n.map(([,s,P])=>[r.getResolutionForZoom(s),r.getResolutionForZoom(P||s+1)])}addViaPoint(n,u=-1,r=0){this.viaPoints.splice(u===-1?this.viaPoints.length:u,r,n),this.drawRoute(),this.dispatchEvent(new ln("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new ln("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new ln("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new ln("change:route"))}abortRequests(){this.graphs.forEach(n=>{let u=n[0];this.abortControllers[u]&&this.abortControllers[u].abort(),this.abortControllers[u]=new AbortController}),this.abortControllers[pg]?.abort(),this.abortControllers[pg]=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[pg]);let n=this.viaPoints.map(u=>{if(Array.isArray(u)){let r=this.map?.getView().getProjection(),[s,P]=lh(u,r);return this.snapToClosestStation?[`@${P}`,s]:[P,s]}return this.useRawViaPoints?u:`!${u}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((u,r)=>this.drawViaPoint(u,r,this.abortControllers[pg])),Promise.all(this.graphs.map(([u],r)=>{let{signal:s}=this.abortControllers[u];return this.api?this.api.route({graph:u,via:`${n.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:s}).then(P=>{if(this.segments=this.format.readFeatures(P),this.mot==="foot"){let V=this.segments.reduce((N,me)=>{let ve=me.get("trg");return N.find(Se=>Se[0]===ve[0]&&Se[1]===ve[1])?N:[...N,ve]},[]);this.segments=V.map(N=>{let me=this.segments.filter(Se=>{let Ue=Se.get("trg");return Ue[0]===N[0]&&Ue[1]===N[1]}),ve=W0(me);return new uc({geometry:new Wl(ve)})})}let z=W0(this.segments),F=new uc({geometry:new Wl(z)});F.set("graph",u),F.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[r]?.length>=2&&(F.set("minResolution",this.graphsResolutions[r][0]),F.set("maxResolution",this.graphsResolutions[r][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(F),this.loading=!1}).catch(P=>{P.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new ln("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new uc;if(s.set("viaPointIdx",u),Array.isArray(n))return s.setGeometry(new _a(n)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s);if(!this.useRawViaPoints||X0.test(n)){let N,me;return this.useRawViaPoints?[,N,,me]=X0.exec(n)||[]:[N,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${N}?key=${this.stopsApiKey}`,{signal:r.signal}).then(ve=>ve.json()).then(ve=>{let{coordinates:Se}=ve.features[0].geometry;return this.cacheStationData[n]=uo(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(uo(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(ve=>{ve.name!=="AbortError"&&(this.dispatchEvent(new ln("error")),this.onRouteError(ve,this),this.loading=!1)})}if(this.useRawViaPoints&&Z0.test(n)){let[N,me]=Z0.exec(n)||[],ve=uo([parseFloat(me),parseFloat(N)],this.map?.getView().getProjection());return s.setGeometry(new _a(ve)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,V]=wE.exec(n)||[];if(F&&z){let N=uo([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",V),s.setGeometry(new _a(N)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}return P?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${P}&limit=1`,{signal:r.signal}).then(N=>N.json()).then(N=>{let{coordinates:me}=N.features[0].geometry;return this.cacheStationData[n]=uo(me),s.set("viaPointTrack",V),s.setGeometry(new _a(uo(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(N=>(this.dispatchEvent(new ln("error")),this.onRouteError(N,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()==="Point"&&s.get("viaPointIdx")!==void 0);if(r){this.removeViaPoint(r.get("viaPointIdx"));return}this.addViaPoint(n.coordinate)}onModifyStart(n){let u=-1,r=n.features.getArray().find(P=>P.getGeometry()?.getType()==="LineString");if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=gl(new _a(r.getGeometry()?.getClosestPoint(n.mapBrowserEvent.coordinate)).getExtent(),.001);u=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(P))}let s=(n.features.getArray().filter(P=>P.getGeometry()?.getType()==="Point")||[])[0];this.initialRouteDrag={viaPoint:s,oldRoute:r&&r.clone(),segmentIndex:u}}onModifyEnd(n){let u=n.mapBrowserEvent.coordinate,{oldRoute:r,viaPoint:s,segmentIndex:P}=this.initialRouteDrag||{};return s?this.addViaPoint(u,s.get("viaPointIdx"),1):r?P===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(u,(P||0)+1):this.addViaPoint(u,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 E_({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:n=>{let r=n.target.getFeaturesAtPixel(n.pixel,{hitTolerance:5}).find(s=>s.getGeometry()?.getType()==="Point"&&s.get("index"));return R0(n)&&r?(this.removeViaPoint(r.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&&Ha(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Sd.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(){}},$0=Sd;var M_=class extends of{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s,placeholder:P}=n||{};this.apiParams={limit:20,...u||{}},this.placeholder=P||"Search for a stop...";let z={apiKey:r};s&&(z.url=s),this.api=new Zf(z),this.abortController=new AbortController}deactivate(){}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}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=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.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(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},K0=M_;var k_=class extends K0{onSuggestionClick(h){let n=uo(h.geometry.coordinates);this.map.getView().setCenter(n)}},H0=k_;var J0=jp(Y0());var z_=class extends Is{constructor(n){super(n);this.olLayer=new Jh({source:new uf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({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 n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.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 u=this.getMapboxMapClass();this.mbMap=new u({style:Xh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new ln("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=ac(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},fg=z_;var op=class extends fg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],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=ac(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return rf(this)}getMapboxMapClass(){return J0.Map}clone(n){return new op({...this.options,...n})}};var t1=jp(e1());var ap=class extends fg{getOlLayerRender(){return tf(this)}getMapboxMapClass(){return t1.Map}clone(n){return new ap({...this.options,...n})}};var Id=class extends Is{constructor(n){super(n);this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=u=>!!this.styleLayers?.find(r=>u.id===r.id))}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.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.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none",F=P.layers||[];for(let V=0;V<F.length;V+=1){let N=F[V];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Id({...this.options,...n})}},r1=Id;var N_=jp(a1()),V_=jp(h1());function iT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||qo.TOPOGRAPHIC,this.api=u.api||new Wf(u),this.tenant=u.tenant||"",this.minZoomInterpolation=u.minZoomInterpolation||8,this.format=new bl;let r=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"],s=["rail"],P=["tram","subway","rail","bus"];this.motsByZoom=u.motsByZoom||[s,s,s,s,s,s,s,s,s,P,P,r,r,r,r],this.getMotsByZoom=z=>u.getMotsByZoom&&u.getMotsByZoom(z,this.motsByZoom)||this.motsByZoom[z]||this.motsByZoom[this.motsByZoom.length-1],this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=z=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(z,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[z],this.renderTimeIntervalByZoom=u.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=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(z,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[z],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,N_.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(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:V,sort:N,time:me,live:ve,canvas:Se,styleOptions:Ue,mode:et}=u,Ie=Se,Ne=s||1,He=me||new Date,nt=et||qo.TOPOGRAPHIC,mt=r||Yh;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{get:()=>(Ie||(Ie=document.createElement("canvas")),Ie),set:ht=>{Ie=ht}},mode:{get:()=>nt,set:ht=>{ht!==nt&&(nt=ht,this.api?.wsApi?.open&&(this.stop(),this.start()))}},style:{get:()=>mt,set:ht=>{mt=ht,this.renderTrajectories()}},styleOptions:{value:{...nf,...Ue||{}}},speed:{get:()=>Ne,set:ht=>{Ne=ht,this.start()}},filter:{value:V,writable:!0},sort:{value:N,writable:!0},live:{value:ve===!1?ve:!0,writable:!0},time:{get:()=>He,set:ht=>{He=ht&&ht.getTime?ht:new Date(ht),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas){let u=this.canvas.getContext("2d");u&&u.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()}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()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=hd(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{filter:this.filter,noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(r),this.mots&&s.push(`mots=${this.mots}`)),this.api.bbox=s}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=gl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let V=[];for(let N=0;N<F.length&&(F[N].properties.coordinate&&Wp(z,F[N].properties.coordinate)&&V.push(F[N]),V.length!==P);N+=1);return Promise.resolve({layer:this,features:V.map(N=>this.format.readFeature(N)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([u,r])=>{let s=r?.properties?.time_intervals;this.time&&s.length&&s[s.length-1][0]<this.time&&this.removeTrajectory(u)})}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Ro(r,z)||this.mots&&!this.mots.includes(P)?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?(this.stop(),this.trajectories={}):this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===qo.TOPOGRAPHIC&&F?r.properties.olGeometry=this.format.readGeometry({type:"Point",coordinates:uo(F,this.map.getView().getProjection())}):r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var mg=iT;var nT=new $l({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),oT=(y,h,n)=>{let u="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[nT,new $l({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},gg=oT;var aT=new $l({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),sT=new $l({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),lT=()=>[aT,sT],p1=lT;var uT=new bl,Cd=class extends mg(Is){constructor(n){super({...n});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!n.allowRenderWhenAnimating,this.olLayer=n.olLayer||new v_({layers:[new rp({source:new ip({features:[]}),style:(u,r)=>(n.fullTrajectoryStyle||gg)(u,r,this.styleOptions)}),new Jh({source:new uf({}),render:u=>{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:r,resolution:s,rotation:P}=u.viewState,{center:z,resolution:F,rotation:V}=this.renderedViewState;if(F/s>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let N=this.map.getPixelFromCoordinate(z),me=this.map.getPixelFromCoordinate(r);this.transformContainer.style.transform=Rv(N[0]-me[0],N[1]-me[1],F/s,F/s,P-V,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],u=>{let r=(u.map||u.target).getView();if(r.getAnimating()||r.getInteracting())return;let s=r.getZoom();this.currentZoom!==s&&this.onZoomEnd(),this.currentZoom=s,this.onMoveEnd(u)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(n){if(this.map&&this.canvas){let u=this.canvas.getContext("2d",{willReadFrequently:!0}),r=this.map.getPixelFromCoordinate(n);return!!u?.getImageData(r[0]*(this.pixelRatio||1),r[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(n){if(!this.map)return;let u=this.map.getView();!u.getCenter()||super.renderTrajectories({size:this.map.getSize(),center:u.getCenter(),extent:u.calculateExtent(),resolution:u.getResolution(),rotation:u.getRotation(),zoom:u.getZoom(),pixelRatio:this.pixelRatio},n)}renderTrajectoriesInternal(n,u){if(!this.map)return!1;let r=!1;return r=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(n,u),r&&(this.renderedViewState={...n},this.transformContainer&&(this.transformContainer.style.transform="")),r}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(n,u={}){if(!this.map||!this.map.getView())return Promise.resolve({layer:this,features:[],coordinate:n});let r=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(n,{resolution:r,...u})}onMoveEnd(n){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(n,u,r){super.onFeatureHover(n,u,r),this.map.getTargetElement().style.cursor=n.length?"pointer":"auto"}onFeatureClick(n,u,r){super.onFeatureClick(n,u,r),!n.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(n,u,r){let s=this.map.getView().getCenter();return!u&&!s?!1:super.purgeTrajectory(n,u||this.map.getView().calculateExtent(),r||this.map.getView().getZoom())}setBbox(n,u){let r=n,s=u;!r&&this.isUpdateBboxOnMoveEnd&&(r=n||this.map.getView().calculateExtent(),s=Math.floor(this.map.getView().getZoom())),super.setBbox(r,s)}highlightTrajectory(n){this.api.getFullTrajectory(n,this.mode,this.generalizationLevel).then(u=>{let r=u.content;if(this.vectorLayer.getSource().clear(),!r||!r.features||!r.features.length)return;let s=uT.readFeatures(r);this.vectorLayer.getSource().addFeatures(s)})}clone(n){return new Cd({...this.options,...n})}},f1=Cd;var Ad=class extends Is{getFeatureInfoAtCoordinate(h){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(h);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:h})}clone(h){return new Ad({...this.options,...h})}},d1=Ad;var Pd=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Pd({...this.options,...n})}},m1=Pd;var bg={};oy(bg,{CopyrightControl:()=>g1,Layer:()=>_g,RealtimeAPI:()=>Wf,RealtimeLayer:()=>M1,RealtimeModes:()=>qo,RoutingAPI:()=>qf,StopsAPI:()=>Zf,compareDepartures:()=>pd,createRealtimeFilters:()=>cy,debounceDeparturesMessages:()=>Oy,debounceWebsocketMessages:()=>Xf,getCircleCanvas:()=>qy,getDelayBgCanvas:()=>Gy,getDelayTextCanvas:()=>jy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>ac,getMapboxRender:()=>rf,getMaplibreRender:()=>tf,getMercatorResolution:()=>xg,getSourceCoordinates:()=>Ld,getTextCanvas:()=>Zy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Xh,pad:()=>Rm,realtimeConfig:()=>nf,realtimeDefaultStyle:()=>Yh,realtimeDelayStyle:()=>Xy,realtimeSimpleStyle:()=>Wy,removeDuplicate:()=>Wh,renderTrajectories:()=>hd,sortAndFilterDepartures:()=>fd,sortByDelay:()=>hy});var G_=class extends eg{constructor(h){super(h),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 ac(this.map)}},g1=G_;var Md=class extends cg(np){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ha(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 n=this.map.getBounds().toArray();return Qf([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new Md({...this.options,...n})}},_g=Md;var Zo=63710088e-1,y1={centimeters:Zo*100,centimetres:Zo*100,degrees:Zo/111325,feet:Zo*3.28084,inches:Zo*39.37,kilometers:Zo/1e3,kilometres:Zo/1e3,meters:Zo,metres:Zo,miles:Zo/1609.344,millimeters:Zo*1e3,millimetres:Zo*1e3,nauticalmiles:Zo/1852,radians:1,yards:Zo*1.0936},T5={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/Zo,yards:1.0936133};function _1(y,h,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=h||{},u.geometry=y,u}function bh(y,h,n){if(n===void 0&&(n={}),!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!j_(y[0])||!j_(y[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:y};return _1(u,h,n)}function cT(y,h){h===void 0&&(h="kilometers");var n=y1[h];if(!n)throw new Error(h+" units is invalid");return y*n}function hT(y,h){h===void 0&&(h="kilometers");var n=y1[h];if(!n)throw new Error(h+" units is invalid");return y/n}function v1(y){var h=y%(2*Math.PI);return h*180/Math.PI}function sp(y){var h=y%360;return h*Math.PI/180}function vg(y,h,n){if(h===void 0&&(h="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return cT(hT(y,h),n)}function j_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function q_(y){return!!y&&y.constructor===Object}function kd(y,h,n){if(y!==null)for(var u,r,s,P,z,F,V,N=0,me=0,ve,Se=y.type,Ue=Se==="FeatureCollection",et=Se==="Feature",Ie=Ue?y.features.length:1,Ne=0;Ne<Ie;Ne++){V=Ue?y.features[Ne].geometry:et?y.geometry:y,ve=V?V.type==="GeometryCollection":!1,z=ve?V.geometries.length:1;for(var He=0;He<z;He++){var nt=0,mt=0;if(P=ve?V.geometries[He]:V,P!==null){F=P.coordinates;var ht=P.type;switch(N=n&&(ht==="Polygon"||ht==="MultiPolygon")?1:0,ht){case null:break;case"Point":if(h(F,me,Ne,nt,mt)===!1)return!1;me++,nt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(h(F[u],me,Ne,nt,mt)===!1)return!1;me++,ht==="MultiPoint"&&nt++}ht==="LineString"&&nt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-N;r++){if(h(F[u][r],me,Ne,nt,mt)===!1)return!1;me++}ht==="MultiLineString"&&nt++,ht==="Polygon"&&mt++}ht==="Polygon"&&nt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(mt=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-N;s++){if(h(F[u][r][s],me,Ne,nt,mt)===!1)return!1;me++}mt++}nt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(kd(P.geometries[u],h,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function pT(y,h){h===void 0&&(h={});var n=0,u=0,r=0;return kd(y,function(s){n+=s[0],u+=s[1],r++},!0),bh([n/r,u/r],h.properties)}var x1=pT;function ku(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function b1(y){if(Array.isArray(y))return y;if(y.type==="Feature"){if(y.geometry!==null)return y.geometry.coordinates}else if(y.coordinates)return y.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function fT(y,h,n){n===void 0&&(n={});var u;n.final?u=w1(ku(h),ku(y)):u=w1(ku(y),ku(h));var r=u>180?-(360-u):u;return r}function w1(y,h){var n=sp(y[1]),u=sp(h[1]),r=sp(h[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(v1(P)+360)%360}var E1=fT;function dT(y,h,n){n===void 0&&(n={});var u=ku(y),r=ku(h);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=mT(u,r),P=vg(s,"meters",n.units);return P}function mT(y,h,n){n=n===void 0?Zo:Number(n);var u=n,r=y[1]*Math.PI/180,s=h[1]*Math.PI/180,P=s-r,z=Math.abs(h[0]-y[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),V=Math.abs(F)>1e-11?P/F:Math.cos(r),N=Math.sqrt(P*P+V*V*z*z),me=N*u;return me}var T1=dT;function gT(y,h,n,u){u===void 0&&(u={});var r=h<0,s=vg(Math.abs(h),u.units,"meters");r&&(s=-Math.abs(s));var P=ku(y),z=yT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,bh(z,u.properties)}function yT(y,h,n,u){u=u===void 0?Zo:Number(u);var r=h/u,s=y[0]*Math.PI/180,P=sp(y[1]),z=sp(n),F=r*Math.cos(z),V=P+F;Math.abs(V)>Math.PI/2&&(V=V>0?Math.PI-V:-Math.PI-V);var N=Math.log(Math.tan(V/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(N)>1e-11?F/N:Math.cos(P),ve=r*Math.sin(z)/me,Se=s+ve;return[(Se*180/Math.PI+540)%360-180,V*180/Math.PI]}var S1=gT;function _T(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return I1(y);case"FeatureCollection":return vT(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Z_(y);default:throw new Error("unknown GeoJSON type")}}function I1(y){var h={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:h[n]=y[n]}}),h.properties=C1(y.properties),h.geometry=Z_(y.geometry),h}function C1(y){var h={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?h[n]=null:Array.isArray(u)?h[n]=u.map(function(r){return r}):h[n]=C1(u):h[n]=u}),h}function vT(y){var h={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:h[n]=y[n]}}),h.features=y.features.map(function(n){return I1(n)}),h}function Z_(y){var h={type:y.type};return y.bbox&&(h.bbox=y.bbox),y.type==="GeometryCollection"?(h.geometries=y.geometries.map(function(n){return Z_(n)}),h):(h.coordinates=A1(y.coordinates),h)}function A1(y){var h=y;return typeof h[0]!="object"?h.slice():h.map(function(n){return A1(n)})}var P1=_T;function xT(y,h,n){if(n=n||{},!q_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!y)throw new Error("geojson is required");if(h==null||isNaN(h))throw new Error("angle is required");return h===0||(u||(u=x1(y)),(r===!1||r===void 0)&&(y=P1(y)),kd(y,function(s){var P=E1(u,s),z=P+h,F=T1(u,s),V=b1(S1(u,F,z));s[0]=V[0],s[1]=V[1]})),y}var X_=xT;var bT=(y,h=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/h}),P=y.unproject({x:n/h,y:u/h}),z=y.unproject({x:n/h,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Ld=bT;var wT=y=>{let h=y.getBounds().toArray(),n=uo(h[0]),u=uo(h[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Tu(r)/P;return Math.max(z,F)},xg=wT;var W_=class extends mg(_g){constructor(h={}){super({...h}),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(h,n){!h||(super.attachToMap(h),this.source={type:"canvas",canvas:this.canvas,coordinates:Ld(h,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,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"}},h.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(h=>{Ha(h)}),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(h){super.onUserMoveCallback({coordinate:uo(h.lngLat.toArray()),...h})}renderTrajectories(h=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=X_(bh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=X_(bh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,V=[...uo(z),...uo(F)],N=bs(V)/(n/this.pixelRatio),me=Tu(V)/(u/this.pixelRatio),ve=Math.max(N,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:uo([r.lng,r.lat]),extent:V,resolution:ve,zoom:this.getOlZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,h)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(h,n={}){let u=xg(this.map);return super.getFeatureInfoAtCoordinate(h,{resolution:u,...n})}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(h,n,u){return super.purgeTrajectory(h,n||this.getMercatorExtent(),u||Math.floor(this.getOlZoom()))}setBbox(h,n){let u=h,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=h||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(h,n=!1){let u=super.renderTrajectoriesInternal(h,n);if(u&&this.map.style){let r=Ld(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(h,n,u){super.onFeatureHover(h,n,u),this.map.getCanvasContainer().style.cursor=h.length?"pointer":"auto"}},M1=W_;var $_={ol:yg,mapbox:bg};typeof window<"u"&&(window.mbt=$_);var S3=$_;})();
1082
+ `){vr+=mr,mr=0,er=ve*ht+Ft*Se,++Ar;continue}var ei=Ue[Sr+1]||F.font;ei!==Rr&&(r&&hr.push("font",ei),u&&kt.push("font",ei),Rr=ei),mr=Math.max(mr,nt[Lr]);var bi=[jt,er+Ft*He[Lr]+ve*(He[Lr]-mt[Ar]),.5*(Se+mr)+vr];er+=He[Lr],r&&hr.push("strokeText",bi),u&&kt.push("fillText",bi),++Lr}return Array.prototype.push.apply(pt,hr),Array.prototype.push.apply(pt,kt),this.labels_[s]=Pt,Pt},y.prototype.replayTextBackground_=function(h,n,u,r,s,P,z){h.beginPath(),h.moveTo.apply(h,n),h.lineTo.apply(h,u),h.lineTo.apply(h,r),h.lineTo.apply(h,s),h.lineTo.apply(h,n),P&&(this.alignFill_=P[2],this.fill_(h)),z&&(this.setStrokeStyle_(h,z),h.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(h,n,u,r,s,P,z,F,V,N,me,ve,Se,Ue,et,Ie){z*=ve[0],F*=ve[1];var Ne=u-z,He=r-F,nt=s+V>h?h-V:s,mt=P+N>n?n-N:P,ht=Ue[3]+nt*ve[0]+Ue[1],pt=Ue[0]+mt*ve[1]+Ue[2],Tt=Ne-Ue[3],It=He-Ue[0];(et||me!==0)&&(yh[0]=Tt,_h[0]=Tt,yh[1]=It,yc[1]=It,yc[0]=Tt+ht,_c[0]=yc[0],_c[1]=It+pt,_h[1]=_c[1]);var Pt;return me!==0?(Pt=vs(za(),u,r,1,1,me,-u,-r),bo(Pt,yh),bo(Pt,yc),bo(Pt,_c),bo(Pt,_h),sh(Math.min(yh[0],yc[0],_c[0],_h[0]),Math.min(yh[1],yc[1],_c[1],_h[1]),Math.max(yh[0],yc[0],_c[0],_h[0]),Math.max(yh[1],yc[1],_c[1],_h[1]),lf)):sh(Math.min(Tt,Tt+ht),Math.min(It,It+pt),Math.max(Tt,Tt+ht),Math.max(It,It+pt),lf),Se&&(Ne=Math.round(Ne),He=Math.round(He)),{drawImageX:Ne,drawImageY:He,drawImageW:nt,drawImageH:mt,originX:V,originY:N,declutterBox:{minX:lf[0],minY:lf[1],maxX:lf[2],maxY:lf[3],value:Ie},canvasTransform:Pt,scale:ve}},y.prototype.replayImageOrLabel_=function(h,n,u,r,s,P,z){var F=!!(P||z),V=r.declutterBox,N=h.canvas,me=z?z[2]*r.scale[0]/2:0,ve=V.minX-me<=N.width/n&&V.maxX+me>=0&&V.minY-me<=N.height/n&&V.maxY+me>=0;return ve&&(F&&this.replayTextBackground_(h,yh,yc,_c,_h,P,z),Xx(h,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(h){if(this.alignFill_){var n=bo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;h.save(),h.translate(n[0]%u,n[1]%u),h.rotate(this.viewRotation_)}h.fill(),this.alignFill_&&h.restore()},y.prototype.setStrokeStyle_=function(h,n){h.strokeStyle=n[1],h.lineWidth=n[2],h.lineCap=n[3],h.lineJoin=n[4],h.miterLimit=n[5],h.setLineDash&&(h.lineDashOffset=n[7],h.setLineDash(n[6]))},y.prototype.drawLabelWithPointPlacement_=function(h,n,u,r){var s=this.textStates[n],P=this.createLabel(h,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,V=h0(Array.isArray(h)?h[0]:h,s.textAlign||gh),N=yd[s.textBaseline||tp],me=z&&z.lineWidth?z.lineWidth:0,ve=P.width/F-2*s.scale[0],Se=V*ve+2*(.5-V)*me,Ue=N*P.height/F+2*(.5-N)*me;return{label:P,anchorX:Se,anchorY:Ue}},y.prototype.execute_=function(h,n,u,r,s,P,z,F){var V;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?V=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),V=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),kv(this.renderedTransform_,u));for(var N=0,me=r.length,ve=0,Se,Ue,et,Ie,Ne,He,nt,mt,ht,pt,Tt,It,Pt=0,Qt=0,Ft=null,er=null,hr=this.coordinateCache_,kt=this.viewRotation_,mr=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,vr={context:h,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:kt},Lr=this.instructions!=r||this.overlaps?0:200,Ar,Rr,Sr,vi;N<me;){var jt=r[N],ei=jt[0];switch(ei){case qr.BEGIN_GEOMETRY:Ar=jt[1],vi=jt[3],Ar.getGeometry()?z!==void 0&&!Ro(z,vi.getExtent())?N=jt[2]+1:++N:N=jt[2];break;case qr.BEGIN_PATH:Pt>Lr&&(this.fill_(h),Pt=0),Qt>Lr&&(h.stroke(),Qt=0),!Pt&&!Qt&&(h.beginPath(),Ie=NaN,Ne=NaN),++N;break;case qr.CIRCLE:ve=jt[1];var bi=V[ve],ai=V[ve+1],zi=V[ve+2],Or=V[ve+3],Mn=zi-bi,wo=Or-ai,Xi=Math.sqrt(Mn*Mn+wo*wo);h.moveTo(bi+Xi,ai),h.arc(bi,ai,Xi,0,2*Math.PI,!0),++N;break;case qr.CLOSE_PATH:h.closePath(),++N;break;case qr.CUSTOM:ve=jt[1],Se=jt[2];var Pr=jt[3],co=jt[4],Mi=jt.length==6?jt[5]:void 0;vr.geometry=Pr,vr.feature=Ar,N in hr||(hr[N]=[]);var di=hr[N];Mi?Mi(V,ve,Se,2,di):(di[0]=V[ve],di[1]=V[ve+1],di.length=2),co(di,vr),++N;break;case qr.DRAW_IMAGE:ve=jt[1],Se=jt[2],mt=jt[3],Ue=jt[4],et=jt[5];var $n=jt[6],mn=jt[7],Xr=jt[8],Wi=jt[9],kn=jt[10],Bn=jt[11],Un=jt[12],$i=jt[13],gn=jt[14];if(!mt&&jt.length>=19){ht=jt[18],pt=jt[19],Tt=jt[20],It=jt[21];var Tn=this.drawLabelWithPointPlacement_(ht,pt,Tt,It);mt=Tn.label,jt[3]=mt;var Eo=jt[22];Ue=(Tn.anchorX-Eo)*this.pixelRatio,jt[4]=Ue;var wt=jt[23];et=(Tn.anchorY-wt)*this.pixelRatio,jt[5]=et,$n=mt.height,jt[6]=$n,$i=mt.width,jt[13]=$i}var Wt=void 0;jt.length>24&&(Wt=jt[24]);var ho=void 0,yn=void 0,Wr=void 0;jt.length>16?(ho=jt[15],yn=jt[16],Wr=jt[17]):(ho=dc,yn=!1,Wr=!1),kn&&mr?Bn+=kt:!kn&&!mr&&(Bn-=kt);for(var Ln=0;ve<Se;ve+=2)if(!(Wt&&Wt[Ln++]<$i/this.pixelRatio)){var Bi=this.calculateImageOrLabelDimensions_(mt.width,mt.height,V[ve],V[ve+1],$i,$n,Ue,et,Xr,Wi,Bn,Un,s,ho,yn||Wr,Ar),fn=[h,n,mt,Bi,mn,yn?Ft:null,Wr?er:null],Kn=void 0,Zt=void 0;if(F&&gn){var Nr=Se-ve;if(!gn[Nr]){gn[Nr]=fn;continue}if(Kn=gn[Nr],delete gn[Nr],Zt=c0(Kn),F.collides(Zt))continue}F&&F.collides(Bi.declutterBox)||(Kn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Kn)),F&&F.insert(Bi.declutterBox),this.replayImageOrLabel_.apply(this,fn))}++N;break;case qr.DRAW_CHARS:var Fr=jt[1],Gi=jt[2],Sn=jt[3],Ir=jt[4];It=jt[5];var to=jt[6],Ki=jt[7],wi=jt[8];Tt=jt[9];var te=jt[10];ht=jt[11],pt=jt[12];var he=[jt[13],jt[13]],de=this.textStates[pt],Te=de.font,Le=[de.scale[0]*Ki,de.scale[1]*Ki],We=void 0;Te in this.widths_?We=this.widths_[Te]:(We={},this.widths_[Te]=We);var Je=$m(V,Fr,Gi,2),we=Math.abs(Le[0])*r_(Te,ht,We);if(Ir||we<=Je){var Ve=this.textStates[pt].textAlign,ie=(Je-we)*yd[Ve],X=u0(V,Fr,Gi,2,ht,ie,to,Math.abs(Le[0]),r_,Te,We,mr?0:this.viewRotation_);e:if(X){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,pt,"",Tt),Ue=ge[2]+(Le[0]<0?-te:te),et=Sn*ke.height+(.5-Sn)*2*te*Le[1]/Le[0]-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,et,0,0,ge[3],he,!1,dc,!1,Ar);if(F&&F.collides(Bi.declutterBox))break e;J.push([h,n,ke,Bi,1,null,null])}if(It)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,pt,It,""),Ue=ge[2],et=Sn*ke.height-wi;var Bi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ue,et,0,0,ge[3],he,!1,dc,!1,Ar);if(F&&F.collides(Bi.declutterBox))break e;J.push([h,n,ke,Bi,1,null,null])}F&&F.load(J.map(c0));for(var Ce=0,Re=J.length;Ce<Re;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++N;break;case qr.END_GEOMETRY:if(P!==void 0){Ar=jt[1];var Ke=P(Ar,vi);if(Ke)return Ke}++N;break;case qr.FILL:Lr?Pt++:this.fill_(h),++N;break;case qr.MOVE_TO_LINE_TO:for(ve=jt[1],Se=jt[2],Rr=V[ve],Sr=V[ve+1],He=Rr+.5|0,nt=Sr+.5|0,(He!==Ie||nt!==Ne)&&(h.moveTo(Rr,Sr),Ie=He,Ne=nt),ve+=2;ve<Se;ve+=2)Rr=V[ve],Sr=V[ve+1],He=Rr+.5|0,nt=Sr+.5|0,(ve==Se-2||He!==Ie||nt!==Ne)&&(h.lineTo(Rr,Sr),Ie=He,Ne=nt);++N;break;case qr.SET_FILL_STYLE:Ft=jt,this.alignFill_=jt[2],Pt&&(this.fill_(h),Pt=0,Qt&&(h.stroke(),Qt=0)),h.fillStyle=jt[1],++N;break;case qr.SET_STROKE_STYLE:er=jt,Qt&&(h.stroke(),Qt=0),this.setStrokeStyle_(h,jt),++N;break;case qr.STROKE:Lr?Qt++:h.stroke(),++N;break;default:++N;break}}Pt&&this.fill_(h),Qt&&h.stroke()},y.prototype.execute=function(h,n,u,r,s,P){this.viewRotation_=r,this.execute_(h,n,u,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(h,n,u,r,s){return this.viewRotation_=u,this.execute_(h,1,n,this.hitDetectionInstructions,!0,r,s)},y}(),p0=s2;var c_=[Fn.POLYGON,Fn.CIRCLE,Fn.LINE_STRING,Fn.IMAGE,Fn.TEXT,Fn.DEFAULT],l2=function(){function y(h,n,u,r,s,P){this.maxExtent_=h,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(h,n){var u=this.getClipCoords(n);h.beginPath(),h.moveTo(u[0],u[1]),h.lineTo(u[2],u[3]),h.lineTo(u[4],u[5]),h.lineTo(u[6],u[7]),h.clip()},y.prototype.createExecutors_=function(h){for(var n in h){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=h[n];for(var s in r){var P=r[s];u[s]=new p0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(h){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=h.length;r<s;++r)if(h[r]in u)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(h,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-h[0],-h[1]),V=!this.hitDetectionContext_;V&&(this.hitDetectionContext_=Ja(z,z));var N=this.hitDetectionContext_;N.canvas.width!==z||N.canvas.height!==z?(N.canvas.width=z,N.canvas.height=z):V||N.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),fy(me,h),gl(me,n*(this.renderBuffer_+r),me));var ve=u2(r),Se;function Ue(pt,Tt){for(var It=N.getImageData(0,0,z,z).data,Pt=0,Qt=ve.length;Pt<Qt;Pt++)if(It[ve[Pt]]>0){if(!P||Se!==Fn.IMAGE&&Se!==Fn.TEXT||P.indexOf(pt)!==-1){var Ft=(ve[Pt]-3)/4,er=r-Ft%z,hr=r-(Ft/z|0),kt=s(pt,Tt,er*er+hr*hr);if(kt)return kt}N.clearRect(0,0,z,z);break}}var et=Object.keys(this.executorsByZIndex_).map(Number);et.sort(rh);var Ie,Ne,He,nt,mt;for(Ie=et.length-1;Ie>=0;--Ie){var ht=et[Ie].toString();for(He=this.executorsByZIndex_[ht],Ne=c_.length-1;Ne>=0;--Ne)if(Se=c_[Ne],nt=He[Se],nt!==void 0&&(mt=nt.executeHitDetection(N,F,u,Ue,me),mt))return mt}},y.prototype.getClipCoords=function(h){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,h,z),z},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(h,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(h.save(),this.clip(h,u));var V=P||c_,N,me,ve,Se,Ue,et;for(z&&F.reverse(),N=0,me=F.length;N<me;++N){var Ie=F[N].toString();for(Ue=this.executorsByZIndex_[Ie],ve=0,Se=V.length;ve<Se;++ve){var Ne=V[ve];et=Ue[Ne],et!==void 0&&et.execute(h,n,u,r,s,z)}}this.maxExtent_&&h.restore()},y}(),h_={};function u2(y){if(h_[y]!==void 0)return h_[y];for(var h=y*2+1,n=y*y,u=new Array(n+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((y+r)*h+(y+s))*4+3),r>0&&z.push(((y-r)*h+(y+s))*4+3),s>0&&(z.push(((y+r)*h+(y-s))*4+3),r>0&&z.push(((y-r)*h+(y-s))*4+3))}for(var F=[],r=0,V=u.length;r<V;++r)u[r]&&F.push.apply(F,u[r]);return h_[y]=F,F}var p_=l2;var vd={ANIMATING:0,INTERACTING:1};var c2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),h2=function(y){c2(h,y);function h(n,u,r,s,P,z,F){var V=y.call(this)||this;return V.context_=n,V.pixelRatio_=u,V.extent_=r,V.transform_=s,V.viewRotation_=P,V.squaredTolerance_=z,V.userTransform_=F,V.contextFillState_=null,V.contextStrokeState_=null,V.contextTextState_=null,V.fillState_=null,V.strokeState_=null,V.image_=null,V.imageAnchorX_=0,V.imageAnchorY_=0,V.imageHeight_=0,V.imageOpacity_=0,V.imageOriginX_=0,V.imageOriginY_=0,V.imageRotateWithView_=!1,V.imageRotation_=0,V.imageScale_=[0,0],V.imageWidth_=0,V.text_="",V.textOffsetX_=0,V.textOffsetY_=0,V.textRotateWithView_=!1,V.textRotation_=0,V.textScale_=[0,0],V.textFillState_=null,V.textStrokeState_=null,V.textState_=null,V.pixelCoordinates_=[],V.tmpLocalTransform_=za(),V}return h.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,V=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=V*this.imageOpacity_);var N=this.imageRotation_;this.imageRotateWithView_&&(N+=this.viewRotation_);for(var me=0,ve=P.length;me<ve;me+=2){var Se=P[me]-this.imageAnchorX_,Ue=P[me+1]-this.imageAnchorY_;if(N!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var et=Se+this.imageAnchorX_,Ie=Ue+this.imageAnchorY_;vs(F,et,Ie,1,1,N,-et,-Ie),z.setTransform.apply(z,F),z.translate(et,Ie),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ue,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=V)}},h.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var V=P[u]+this.textOffsetX_,N=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,V,N,1,1,F,-V,-N);z.setTransform.apply(z,me),z.translate(V,N),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,V,N),this.textFillState_&&z.fillText(this.text_,V,N)}}},h.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var V=F.length;P&&(V-=2);for(var N=2;N<V;N+=2)z.lineTo(F[N],F[N+1]);return P&&z.closePath(),r},h.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},h.prototype.drawCircle=function(n){if(!!Ro(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=lx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},h.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},h.prototype.setTransform=function(n){this.transform_=n},h.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Ot.POINT:this.drawPoint(n);break;case Ot.LINE_STRING:this.drawLineString(n);break;case Ot.POLYGON:this.drawPolygon(n);break;case Ot.MULTI_POINT:this.drawMultiPoint(n);break;case Ot.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Ot.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Ot.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Ot.CIRCLE:this.drawCircle(n);break;default:}},h.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!Ro(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},h.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},h.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},h.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},h.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},h.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!Ro(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var V=0,N=z.length;V<N;++V)P=this.moveToLineTo_(s,P,z[V],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},h.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},h.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ro(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,V=P.length;F<V;++F){var N=P[F];s=this.drawRings_(r,s,N,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},h.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},h.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},h.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:gh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},h.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),V=u.getLineDashOffset(),N=u.getLineJoin(),me=u.getWidth(),ve=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:ep,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ue){return Ue*r.pixelRatio_}),lineDashOffset:(V||hc)*this.pixelRatio_,lineJoin:N!==void 0?N:Cu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:ve!==void 0?ve:pc,strokeStyle:Ts(P||fc)}}},h.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},h.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),V=s.getLineDashOffset(),N=s.getLineJoin(),me=s.getWidth(),ve=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:ep,lineDash:F||cc,lineDashOffset:V||hc,lineJoin:N!==void 0?N:Cu,lineWidth:me!==void 0?me:mc,miterLimit:ve!==void 0?ve:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ue=n.getOffsetX(),et=n.getOffsetY(),Ie=n.getRotateWithView(),Ne=n.getRotation(),He=n.getScaleArray(),nt=n.getText(),mt=n.getTextAlign(),ht=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:og,textAlign:mt!==void 0?mt:gh,textBaseline:ht!==void 0?ht:tp},this.text_=nt!==void 0?Array.isArray(nt)?nt.reduce(function(pt,Tt,It){return pt+=It%2?" ":Tt},""):nt:"",this.textOffsetX_=Ue!==void 0?this.pixelRatio_*Ue:0,this.textOffsetY_=et!==void 0?this.pixelRatio_*et:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ne!==void 0?Ne:0,this.textScale_=[this.pixelRatio_*He[0],this.pixelRatio_*He[1]]}},h}(ag),f0=h2;var Mu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var p2=function(){function y(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return y.prototype.clear=function(){this.cache_={},this.cacheSize_=0},y.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},y.prototype.expire=function(){if(this.canExpireCache()){var h=0;for(var n in this.cache_){var u=this.cache_[n];(h++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},y.prototype.get=function(h,n,u){var r=d0(h,n,u);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(h,n,u,r){var s=d0(h,n,u);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(h){this.maxCacheSize_=h,this.expire()},y}();function d0(y,h,n){var u=n?ig(n):"null";return h+":"+y+":"+u}var f_=new p2;var f2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),d2=function(y){f2(h,y);function h(n,u,r,s){var P=y.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return h.prototype.changed=function(){this.dispatchEvent(en.CHANGE)},h.prototype.getExtent=function(){return this.extent},h.prototype.getImage=function(){return jr()},h.prototype.getPixelRatio=function(){return this.pixelRatio_},h.prototype.getResolution=function(){return this.resolution},h.prototype.getState=function(){return this.state},h.prototype.load=function(){jr()},h}(nh),m0=d2;var m2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),sR=function(y){m2(h,y);function h(n,u,r,s,P,z){var F=y.call(this,n,u,r,Zi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=Zi.IDLE,F.imageLoadFunction_=z,F}return h.prototype.getImage=function(){return this.image_},h.prototype.handleImageError_=function(){this.state=Zi.ERROR,this.unlistenImage_(),this.changed()},h.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Tu(this.extent)/this.image_.height),this.state=Zi.LOADED,this.unlistenImage_(),this.changed()},h.prototype.load=function(){(this.state==Zi.IDLE||this.state==Zi.ERROR)&&(this.state=Zi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},h.prototype.setImage=function(n){this.image_=n,this.resolution=Tu(this.extent)/this.image_.height},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(m0);function d_(y,h,n){var u=y,r=!0,s=!1,P=!1,z=[Zp(u,en.LOAD,function(){P=!0,s||h()})];return u.src&&Pv?(s=!0,u.decode().then(function(){r&&h()}).catch(function(F){r&&(P?h():n())})):z.push(Zp(u,en.ERROR,n)),function(){r=!1,z.forEach(Mo)}}var g2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xd=null,y2=function(y){g2(h,y);function h(n,u,r,s,P,z){var F=y.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return h.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===Zi.LOADED){xd||(xd=Ja(1,1)),xd.drawImage(this.image_,0,0);try{xd.getImageData(0,0,1,1),this.tainted_=!1}catch{xd=null,this.tainted_=!0}}return this.tainted_===!0},h.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(en.CHANGE)},h.prototype.handleImageError_=function(){this.imageState_=Zi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},h.prototype.handleImageLoad_=function(){this.imageState_=Zi.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_()},h.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},h.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},h.prototype.getImageState=function(){return this.imageState_},h.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},h.prototype.getSize=function(){return this.size_},h.prototype.getSrc=function(){return this.src_},h.prototype.load=function(){if(this.imageState_==Zi.IDLE){this.imageState_=Zi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=d_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},h.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==Zi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=ig(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,V=this.color_[2]/255,N=this.color_[3],me=0,ve=P.length;me<ve;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=V,P[me+3]*=N;r.putImageData(s,0,0)}}},h.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},h}(nh);function g0(y,h,n,u,r,s){var P=f_.get(h,u,s);return P||(P=new y2(y,h,n,u,r,s),f_.set(h,u,s,P)),P}var _2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),v2=function(y){_2(h,y);function h(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=y.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Mu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Mu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var V=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var N=r.src;En(!(N!==void 0&&V),4),En(!V||V&&u.imgSize_,5),(N===void 0||N.length===0)&&V&&(N=V.src||Pi(V)),En(N!==void 0&&N.length>0,6);var me=r.src!==void 0?Zi.IDLE:Zi.LOADED;return u.color_=r.color!==void 0?Qh(r.color):null,u.iconImage_=g0(V,N,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return h.prototype.clone=function(){var n=this.getScale();return new h({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:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},h.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Mu.FRACTION||this.anchorYUnits_==Mu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Mu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Mu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},h.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},h.prototype.getColor=function(){return this.color_},h.prototype.getImage=function(n){return this.iconImage_.getImage(n)},h.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},h.prototype.getImageSize=function(){return this.iconImage_.getSize()},h.prototype.getImageState=function(){return this.iconImage_.getImageState()},h.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},h.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},h.prototype.getSrc=function(){return this.iconImage_.getSrc()},h.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},h.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(en.CHANGE,n)},h.prototype.load=function(){this.iconImage_.load()},h.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(en.CHANGE,n)},h}(rg),m_=v2;var Kl=.5;function y0(y,h,n,u,r,s,P){var z=y[0]*Kl,F=y[1]*Kl,V=Ja(z,F);V.imageSmoothingEnabled=!1;for(var N=V.canvas,me=new f0(V,Kl,r,null,P),ve=n.length,Se=Math.floor((256*256*256-1)/ve),Ue={},et=1;et<=ve;++et){var Ie=n[et-1],Ne=Ie.getStyleFunction()||u;if(!!u){var He=Ne(Ie,s);if(!!He){Array.isArray(He)||(He=[He]);for(var nt=et*Se,mt="#"+("000000"+nt.toString(16)).slice(-6),ht=0,pt=He.length;ht<pt;++ht){var Tt=He[ht],It=Tt.getGeometryFunction()(Ie);if(!(!It||!Ro(r,It.getExtent()))){var Pt=Tt.clone(),Qt=Pt.getFill();Qt&&Qt.setColor(mt);var Ft=Pt.getStroke();Ft&&(Ft.setColor(mt),Ft.setLineDash(null)),Pt.setText(void 0);var er=Tt.getImage();if(er&&er.getOpacity()!==0){var hr=er.getImageSize();if(!hr)continue;var kt=Ja(hr[0],hr[1],void 0,{alpha:!1}),mr=kt.canvas;kt.fillStyle=mt,kt.fillRect(0,0,mr.width,mr.height),Pt.setImage(new m_({img:mr,imgSize:hr,anchor:er.getAnchor(),anchorXUnits:Mu.PIXELS,anchorYUnits:Mu.PIXELS,offset:er.getOrigin(),opacity:1,size:er.getSize(),scale:er.getScale(),rotation:er.getRotation(),rotateWithView:er.getRotateWithView()}))}var vr=Pt.getZIndex()||0,Lr=Ue[vr];Lr||(Lr={},Ue[vr]=Lr,Lr[Ot.POLYGON]=[],Lr[Ot.CIRCLE]=[],Lr[Ot.LINE_STRING]=[],Lr[Ot.POINT]=[]),Lr[It.getType().replace("Multi","")].push(It,Pt)}}}}}for(var Ar=Object.keys(Ue).map(Number).sort(rh),et=0,Rr=Ar.length;et<Rr;++et){var Lr=Ue[Ar[et]];for(var Sr in Lr)for(var vi=Lr[Sr],ht=0,pt=vi.length;ht<pt;ht+=2){me.setStyle(vi[ht+1]);for(var jt=0,ei=h.length;jt<ei;++jt)me.setTransform(h[jt]),me.drawGeometry(vi[ht])}}return V.getImageData(0,0,N.width,N.height)}function _0(y,h,n){var u=[];if(n){var r=Math.floor(Math.round(y[0])*Kl),s=Math.floor(Math.round(y[1])*Kl),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],V=n.data[P+2],N=V+256*(F+256*z),me=Math.floor((256*256*256-1)/h.length);N&&N%me===0&&u.push(h[N/me-1])}return u}var x2=.5,v0={Point:C2,LineString:T2,Polygon:P2,MultiPoint:A2,MultiLineString:S2,MultiPolygon:I2,GeometryCollection:E2,Circle:b2};function x0(y,h){return parseInt(Pi(y),10)-parseInt(Pi(h),10)}function b0(y,h){var n=sg(y,h);return n*n}function sg(y,h){return x2*y/h}function b2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Fn.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}function g_(y,h,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var V=F.getImageState();V==Zi.LOADED||V==Zi.ERROR?F.unlistenImageChange(r):(V==Zi.IDLE&&F.load(),V=F.getImageState(),F.listenImageChange(r),z=!0)}return w2(y,h,n,u,s,P),z}function w2(y,h,n,u,r,s){var P=n.getGeometryFunction()(h);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)w0(y,z,n,h);else{var V=v0[z.getType()];V(y,z,n,h,s)}}}function w0(y,h,n,u){if(h.getType()==Ot.GEOMETRY_COLLECTION){for(var r=h.getGeometries(),s=0,P=r.length;s<P;++s)w0(y,r[s],n,u);return}var z=y.getBuilder(n.getZIndex(),Fn.DEFAULT);z.drawCustom(h,u,n.getRenderer(),n.getHitDetectionRenderer())}function E2(y,h,n,u,r){var s=h.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=v0[s[P].getType()];F(y,s[P],n,u,r)}}function T2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Fn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function S2(y,h,n,u,r){var s=n.getStroke();if(s){var P=y.getBuilder(n.getZIndex(),Fn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(h,u)}var z=n.getText();if(z&&z.getText()){var F=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);F.setTextStyle(z),F.drawText(h,u)}}function I2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=y.getBuilder(n.getZIndex(),Fn.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}function C2(y,h,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=Zi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Fn.IMAGE);F.setImageStyle(s,z),F.drawPoint(h,u)}if(P&&P.getText()){var V=y.getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(P,z),V.drawText(h,u)}}function A2(y,h,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(y=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=Zi.LOADED)return;var F=y.getBuilder(n.getZIndex(),Fn.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(h,u)}if(P&&P.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(P,z),V.drawText(h,u)}}function P2(y,h,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=y.getBuilder(n.getZIndex(),Fn.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(h,u)}var F=n.getText();if(F&&F.getText()){var V=(r||y).getBuilder(n.getZIndex(),Fn.TEXT);V.setTextStyle(F),V.drawText(h,u)}}var M2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),k2=function(y){M2(h,y);function h(n){var u=y.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return h.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,V=P.projection,N=P.rotation,me=V.getExtent(),ve=this.getLayer().getSource(),Se=u.pixelRatio,Ue=u.viewHints,et=!(Ue[vd.ANIMATING]||Ue[vd.INTERACTING]),Ie=this.context,Ne=Math.round(u.size[0]*Se),He=Math.round(u.size[1]*Se),nt=ve.getWrapX()&&V.canWrapX(),mt=nt?bs(me):null,ht=nt?Math.ceil((s[2]-me[2])/mt)+1:1,pt=nt?Math.floor((s[0]-me[0])/mt):0;do{var Tt=this.getRenderTransform(z,F,N,Se,Ne,He,pt*mt);n.execute(Ie,1,Tt,N,et,void 0,r)}while(++pt<ht)},h.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},h.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];Lv(this.pixelTransform,1/r,1/r),zv(this.inversePixelTransform,this.pixelTransform);var P=py(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,V=this.replayGroup_,N=this.declutterExecutorGroup;if((!V||V.isEmpty())&&(!N||N.isEmpty()))return null;var me=Math.round(n.size[0]*r),ve=Math.round(n.size[1]*r);F.width!=me||F.height!=ve?(F.width=me,F.height=ve,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,ve),this.preRender(z,n);var Se=n.viewState,Ue=Se.projection,et=!1,Ie=!0;if(s.extent&&this.clipping){var Ne=ed(s.extent,Ue);Ie=Ro(Ne,n.extent),et=Ie&&!lc(Ne,n.extent),et&&this.clipUnrotated(z,n,Ne)}Ie&&this.renderWorlds(V,n),et&&z.restore(),this.postRender(z,n);var He=Gx(s.opacity),nt=this.container;return He!==nt.style.opacity&&(nt.style.opacity=He),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},h.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];bo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,V=this.wrappedRenderedExtent_,N=this.getLayer(),me=[],ve=r[0]*Kl,Se=r[1]*Kl;me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,0).slice());var Ue=N.getSource(),et=F.getExtent();if(Ue.getWrapX()&&F.canWrapX()&&!lc(et,V)){for(var Ie=V[0],Ne=bs(et),He=0,nt=void 0;Ie<et[0];)--He,nt=Ne*He,me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,nt).slice()),Ie+=Ne;for(He=0,Ie=V[2];Ie>et[2];)++He,nt=Ne*He,me.push(this.getRenderTransform(s,P,z,Kl,ve,Se,nt).slice()),Ie-=Ne}this.hitDetectionImageData_=y0(r,me,this.renderedFeatures_,N.getStyleFunction(),V,P,z)}u(_0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},h.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,V=u.viewState.rotation,N=this.getLayer(),me={},ve=function(et,Ie,Ne){var He=Pi(et),nt=me[He];if(nt){if(nt!==!0&&Ne<nt.distanceSq){if(Ne===0)return me[He]=!0,P.splice(P.lastIndexOf(nt),1),s(et,N,Ie);nt.geometry=Ie,nt.distanceSq=Ne}}else{if(Ne===0)return me[He]=!0,s(et,N,Ie);P.push(me[He]={feature:et,layer:N,geometry:Ie,distanceSq:Ne,callback:s})}},Se,Ue=[this.replayGroup_];return this.declutterExecutorGroup&&Ue.push(this.declutterExecutorGroup),Ue.some(function(et){return Se=et.forEachFeatureAtCoordinate(n,F,V,r,ve,et===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},h.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},h.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},h.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[vd.ANIMATING],P=n.viewHints[vd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var V=n.extent,N=n.viewState,me=N.projection,ve=N.resolution,Se=n.pixelRatio,Ue=u.getRevision(),et=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=x0);var Ne=N.center.slice(),He=gl(V,et*ve),nt=He.slice(),mt=[He.slice()],ht=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!lc(ht,n.extent)){var pt=bs(ht),Tt=Math.max(bs(He)/2,pt);He[0]=ht[0]-Tt,He[2]=ht[2]+Tt,Qv(Ne,me);var It=Gv(mt[0],me);It[0]<ht[0]&&It[2]<ht[2]?mt.push([It[0]+pt,It[1],It[2]+pt,It[3]]):It[0]>ht[0]&&It[2]>ht[2]&&mt.push([It[0]-pt,It[1],It[2]-pt,It[3]])}if(!this.dirty_&&this.renderedResolution_==ve&&this.renderedRevision_==Ue&&this.renderedRenderOrder_==Ie&&lc(this.wrappedRenderedExtent_,He))return _s(this.renderedExtent_,nt)||(this.hitDetectionImageData_=null,this.renderedExtent_=nt),this.renderedCenter_=Ne,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Pt=new u_(sg(ve,Se),He,ve,Se),Qt;this.getLayer().getDeclutter()&&(Qt=new u_(sg(ve,Se),He,ve,Se));var Ft=uh(),er;if(Ft){for(var hr=0,kt=mt.length;hr<kt;++hr){var mr=mt[hr],vr=ef(mr,me);r.loadFeatures(vr,ix(ve,me),Ft)}er=Vm(Ft,me)}else for(var hr=0,kt=mt.length;hr<kt;++hr)r.loadFeatures(mt[hr],ve,me);var Lr=b0(ve,Se),Ar=function(ei){var bi,ai=ei.getStyleFunction()||u.getStyleFunction();if(ai&&(bi=ai(ei,ve)),bi){var zi=this.renderFeature(ei,Lr,bi,Pt,er,Qt);this.dirty_=this.dirty_||zi}}.bind(this),Rr=ef(He,me),Sr=r.getFeaturesInExtent(Rr);Ie&&Sr.sort(Ie);for(var hr=0,kt=Sr.length;hr<kt;++hr)Ar(Sr[hr]);this.renderedFeatures_=Sr;var vi=Pt.finish(),jt=new p_(He,ve,Se,r.getOverlaps(),vi,u.getRenderBuffer());return Qt&&(this.declutterExecutorGroup=new p_(He,ve,Se,r.getOverlaps(),Qt.finish(),u.getRenderBuffer())),this.renderedResolution_=ve,this.renderedRevision_=Ue,this.renderedRenderOrder_=Ie,this.renderedExtent_=nt,this.wrappedRenderedExtent_=He,this.renderedCenter_=Ne,this.renderedProjection_=me,this.replayGroup_=jt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},h.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var V=0,N=r.length;V<N;++V)F=g_(s,n,r[V],u,this.boundHandleStyleImageChange_,P,z)||F;else F=g_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},h}(l0),E0=k2;var L2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),R2=function(y){L2(h,y);function h(n){return y.call(this,n)||this}return h.prototype.createRenderer=function(){return new E0(this)},h}(t0),rp=R2;var T0=jp(a_(),1);var z2=function(){function y(h){this.rbush_=new T0.default(h),this.items_={}}return y.prototype.insert=function(h,n){var u={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3],value:n};this.rbush_.insert(u),this.items_[Pi(n)]=u},y.prototype.load=function(h,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=h[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Pi(z)]=F}this.rbush_.load(u)},y.prototype.remove=function(h){var n=Pi(h),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},y.prototype.update=function(h,n){var u=this.items_[Pi(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Fm(r,h)||(this.remove(n),this.insert(h,n))},y.prototype.getAll=function(){var h=this.rbush_.all();return h.map(function(n){return n.value})},y.prototype.getInExtent=function(h){var n={minX:h[0],minY:h[1],maxX:h[2],maxY:h[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},y.prototype.forEach=function(h){return this.forEach_(this.getAll(),h)},y.prototype.forEachInExtent=function(h,n){return this.forEach_(this.getInExtent(h),n)},y.prototype.forEach_=function(h,n){for(var u,r=0,s=h.length;r<s;r++)if(u=n(h[r]),u)return u;return u},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(h){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,h)},y.prototype.concat=function(h){this.rbush_.load(h.rbush_.all());for(var n in h.items_)this.items_[n]=h.items_[n]},y}(),bd=z2;var D2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O2=function(y){D2(h,y);function h(n){var u=y.call(this)||this;u.projection=ya(n.projection),u.attributions_=S0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Iu.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return h.prototype.getAttributions=function(){return this.attributions_},h.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},h.prototype.getProjection=function(){return this.projection},h.prototype.getResolutions=function(){return jr()},h.prototype.getView=function(){return this.viewPromise_},h.prototype.getState=function(){return this.state_},h.prototype.getWrapX=function(){return this.wrapX_},h.prototype.getInterpolate=function(){return this.interpolate_},h.prototype.refresh=function(){this.changed()},h.prototype.setAttributions=function(n){this.attributions_=S0(n),this.changed()},h.prototype.setState=function(n){this.state_=n,this.changed()},h}(ko);function S0(y){return y?Array.isArray(y)?function(h){return y}:typeof y=="function"?y:function(h){return[y]}:null}var uf=O2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function I0(y,h){return[[-1/0,-1/0,1/0,1/0]]}var vh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var F2=!1;function B2(y,h,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof y=="function"?y(n,u,r):y,!0),h.getType()==vh.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=F2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var V=h.getType(),N=void 0;V==vh.JSON||V==vh.TEXT?N=z.responseText:V==vh.XML?(N=z.responseXML,N||(N=new DOMParser().parseFromString(z.responseText,"application/xml"))):V==vh.ARRAY_BUFFER&&(N=z.response),N?s(h.readFeatures(N,{extent:n,featureProjection:r}),h.readProjection(N)):P()}else P()},z.onerror=P,z.send()}function y_(y,h){return function(n,u,r,s,P){var z=this;B2(y,h,n,u,r,function(F,V){z.addFeatures(F),s!==void 0&&s(F)},P||Zh)}}var C0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),xh=function(y){C0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.feature=u,s.features=r,s}return h}(ln);var U2=function(y){C0(h,y);function h(n){var u=this,r=n||{};u=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Iu.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=Zh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(En(u.format_,7),u.loader_=y_(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:I0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new bd:null,u.loadedExtentsRtree_=new bd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new dh(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return h.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},h.prototype.addFeatureInternal=function(n){var u=Pi(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new xh(Qa.ADDFEATURE,n))},h.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[lo(u,en.CHANGE,this.handleFeatureChange_,this),lo(u,qp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},h.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(En(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},h.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},h.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],V=Pi(F);this.addToIndex_(V,F)&&r.push(F)}for(var P=0,N=r.length;P<N;P++){var F=r[P],V=Pi(F);this.setupChangeEvents_(V,F);var me=F.getGeometry();if(me){var ve=me.getExtent();u.push(ve),s.push(F)}else this.nullGeometryFeatures_[V]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new xh(Qa.ADDFEATURE,r[P]))},h.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(Es.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(Es.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},h.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Mo)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new xh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},h.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},h.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},h.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},h.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},h.prototype.getFeaturesCollection=function(){return this.featuresCollection_},h.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(n,Am(this.nullGeometryFeatures_))),n},h.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},h.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},h.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,V=[-1/0,-1/0,1/0,1/0],N=u||Cm;return this.featuresRtree_.forEachInExtent(V,function(me){if(N(me)){var ve=me.getGeometry(),Se=F;if(F=ve.closestPointXY(r,s,z,F),F<Se){P=me;var Ue=Math.sqrt(F);V[0]=r-Ue,V[1]=s-Ue,V[2]=r+Ue,V[3]=s+Ue}}}),P},h.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},h.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},h.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},h.prototype.getFormat=function(){return this.format_},h.prototype.getOverlaps=function(){return this.overlaps_},h.prototype.getUrl=function(){return this.url_},h.prototype.handleFeatureChange_=function(n){var u=n.target,r=Pi(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new xh(Qa.CHANGEFEATURE,u))},h.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Pi(n)in this.uidIndex_},h.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},h.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,ve){var Se=P[me],Ue=s.forEachInExtent(Se,function(et){return lc(et.extent,Se)});Ue||(++F.loadingExtentsCount_,F.dispatchEvent(new xh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(et){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADEND,void 0,et))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,V=0,N=P.length;V<N;++V)z(V,N);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},h.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},h.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Fm(s.extent,n))return r=s,!0}),r&&u.remove(r)},h.prototype.removeFeature=function(n){if(!!n){var u=Pi(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},h.prototype.removeFeatureInternal=function(n){var u=Pi(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Mo),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new xh(Qa.REMOVEFEATURE,n)),n}},h.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},h.prototype.setLoader=function(n){this.loader_=n},h.prototype.setUrl=function(n){En(this.format_,7),this.url_=n,this.setLoader(y_(n,this.format_))},h}(uf),ip=U2;var A0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),cf=function(y){A0(h,y);function h(n,u){var r=y.call(this,n)||this;return r.layer=u,r}return h}(ln);var __={LAYERS:"layers"},N2=function(y){A0(h,y);function h(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=y.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(__.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new dh(P.slice(),{unique:!0}):En(typeof P.getArray=="function",43):P=new dh(void 0,{unique:!0}),u.setLayers(P),u}return h.prototype.handleLayerChange_=function(){this.changed()},h.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Mo),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(lo(n,Es.ADD,this.handleLayersAdd_,this),lo(n,Es.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Mo);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new cf("addlayer",z))}this.changed()},h.prototype.registerLayerListeners_=function(n){var u=[lo(n,qp.PROPERTYCHANGE,this.handleLayerChange_,this),lo(n,en.CHANGE,this.handleLayerChange_,this)];n instanceof h&&u.push(lo(n,"addlayer",this.handleLayerGroupAdd_,this),lo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Pi(n)]=u},h.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new cf("addlayer",n.layer))},h.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new cf("removelayer",n.layer))},h.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new cf("addlayer",u)),this.changed()},h.prototype.handleLayersRemove_=function(n){var u=n.element,r=Pi(u);this.listenerKeys_[r].forEach(Mo),delete this.listenerKeys_[r],this.dispatchEvent(new cf("removelayer",u)),this.changed()},h.prototype.getLayers=function(){return this.get(__.LAYERS)},h.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new cf("removelayer",r[s]));this.set(__.LAYERS,n)},h.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},h.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(N){N.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var V=u[z];V.opacity*=s.opacity,V.visible=V.visible&&s.visible,V.maxResolution=Math.min(V.maxResolution,s.maxResolution),V.minResolution=Math.max(V.minResolution,s.minResolution),V.minZoom=Math.max(V.minZoom,s.minZoom),V.maxZoom=Math.min(V.maxZoom,s.maxZoom),s.extent!==void 0&&(V.extent!==void 0?V.extent=Bv(V.extent,s.extent):V.extent=s.extent),V.zIndex===void 0&&(V.zIndex=P)}return u},h.prototype.getSourceState=function(){return Iu.READY},h}(Qm),v_=N2;var na={SINGLECLICK:"singleclick",CLICK:en.CLICK,DBLCLICK:en.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var x_={ACTIVE:"active"};var V2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),G2=function(y){V2(h,y);function h(n){var u=y.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return h.prototype.getActive=function(){return this.get(x_.ACTIVE)},h.prototype.getMap=function(){return this.map_},h.prototype.handleEvent=function(n){return!0},h.prototype.setActive=function(n){this.set(x_.ACTIVE,n)},h.prototype.setMap=function(n){this.map_=n},h}(ko);var P0=G2;var j2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),q2=function(y){j2(h,y);function h(n){var u=this,r=n||{};return u=y.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return h.prototype.getPointerCount=function(){return this.targetPointers.length},h.prototype.handleDownEvent=function(n){return!1},h.prototype.handleDragEvent=function(n){},h.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==na.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==na.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==na.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==na.POINTERMOVE&&this.handleMoveEvent(n);return!u},h.prototype.handleMoveEvent=function(n){},h.prototype.handleUpEvent=function(n){return!1},h.prototype.stopDown=function(n){return n},h.prototype.updateTrackedPointers_=function(n){if(Z2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==na.POINTERUP?delete this.trackedPointers_[r]:n.type==na.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Am(this.trackedPointers_)}},h}(P0);function Z2(y){var h=y.type;return h===na.POINTERDOWN||h===na.POINTERDRAG||h===na.POINTERUP}var M0=q2;var k0=function(y){var h=y.originalEvent;return h.altKey&&!(h.metaKey||h.ctrlKey)&&!h.shiftKey};var L0=Cm,R0=function(y){return y.type==na.CLICK};var z0=function(y){return y.type==na.SINGLECLICK};var D0=function(y){var h=y.originalEvent;return En(h!==void 0,56),h.isPrimary&&h.button===0};var N0=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),O0=0,wd=1,F0=[0,0,0,0],hf=[],b_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},w_=function(y){N0(h,y);function h(n,u,r){var s=y.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return h}(ln);var X2=function(y){N0(h,y);function h(n){var u=y.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:D0,u.defaultDeleteCondition_=function(s){return k0(s)&&z0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:L0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new bd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new rp({source:new ip({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:$2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new dh(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(Es.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(Es.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return h.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(en.CHANGE,this.boundHandleFeatureChange_)},h.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new dh;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,V=z.length;F<V;++F){var N=z[F].feature;N&&r.indexOf(N)===-1&&this.featuresBeingModified_.push(N)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new w_(b_.MODIFYSTART,this.featuresBeingModified_,n))}},h.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(en.CHANGE,this.boundHandleFeatureChange_)},h.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},h.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,n)},h.prototype.setMap=function(n){this.overlay_.setMap(n),y.prototype.setMap.call(this,n)},h.prototype.getOverlay=function(){return this.overlay_},h.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},h.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},h.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},h.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},h.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},h.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},h.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},h.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(Eu(z),F)}},h.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,V=z.length-1;F<V;++F){var N=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:N};this.rBush_.insert(Eu(N),me)}},h.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,V=z.length-1;F<V;++F){var N=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:N};this.rBush_.insert(Eu(N),me)}},h.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,V=z.length;F<V;++F)for(var N=z[F],me=0,ve=N.length-1;me<ve;++me){var Se=N.slice(me,me+2),Ue={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(Eu(Se),Ue)}},h.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:O0,segment:[r,r]},P={feature:n,geometry:u,index:wd,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Kp(r),s);var F=u,V=uh();if(V&&this.getMap()){var N=this.getMap().getView().getProjection();F=F.clone().transform(V,N),F=Dy(F).transform(N,V)}this.rBush_.insert(F.getExtent(),P)},h.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},h.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new uc(new _a(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},h.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==na.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=na.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==na.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,n)&&!u},h.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],V=F[0],N=V.feature;r.indexOf(N)===-1&&r.push(N);var me=V.geometry;s.indexOf(me)===-1&&s.push(me);for(var ve=V.depth,Se=void 0,Ue=V.segment,et=F[1];u.length<me.getStride();)u.push(Ue[et][u.length]);switch(me.getType()){case Ot.POINT:Se=u,Ue[0]=u,Ue[1]=u;break;case Ot.MULTI_POINT:Se=me.getCoordinates(),Se[V.index]=u,Ue[0]=u,Ue[1]=u;break;case Ot.LINE_STRING:Se=me.getCoordinates(),Se[V.index+et]=u,Ue[et]=u;break;case Ot.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.POLYGON:Se=me.getCoordinates(),Se[ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.MULTI_POLYGON:Se=me.getCoordinates(),Se[ve[1]][ve[0]][V.index+et]=u,Ue[et]=u;break;case Ot.CIRCLE:if(Ue[0]=u,Ue[1]=u,V.index===O0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ne=Ey(Xl(me.getCenter(),Ie),Xl(u,Ie)),He=uh();if(He){var nt=me.clone().transform(He,Ie);nt.setRadius(Ne),Ne=nt.transform(Ie,He).getRadius()}me.setRadius(Ne),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},h.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=Eu([z]),V=this.rBush_.getInExtent(F),N={};V.sort(W2);for(var me=0,ve=V.length;me<ve;++me){var Se=V[me],Ue=Se.segment,et=Pi(Se.geometry),Ie=Se.depth;if(Ie&&(et+="-"+Ie.join("-")),N[et]||(N[et]=new Array(2)),Se.geometry.getType()===Ot.CIRCLE&&Se.index===wd){var Ne=U0(u,Se,s);Su(Ne,z)&&!N[et][0]&&(this.dragSegments_.push([Se,0]),N[et][0]=Se);continue}if(Su(Ue[0],z)&&!N[et][0]){this.dragSegments_.push([Se,0]),N[et][0]=Se;continue}if(Su(Ue[1],z)&&!N[et][1]){if((Se.geometry.getType()===Ot.LINE_STRING||Se.geometry.getType()===Ot.MULTI_LINE_STRING)&&N[et][0]&&N[et][0].index===0)continue;this.dragSegments_.push([Se,1]),N[et][1]=Se;continue}Pi(Ue)in this.vertexSegments_&&!N[et][0]&&!N[et][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var He=P.length-1;He>=0;--He)this.insertVertex_(P[He],z)}return!!this.vertexFeature_},h.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Ot.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Kp(P),z);var V=s,N=uh();if(N){var me=n.map.getView().getProjection();V=V.clone().transform(N,me),V=Dy(V).transform(me,N)}this.rBush_.update(V.getExtent(),F)}else this.rBush_.update(Eu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},h.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},h.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(kt,mr){return B0(P,kt,z)-B0(P,mr,z)},V,N;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(kt){return kt===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(kt,mr,vr){if(vr=vr||kt.getGeometry(),vr.getType()===Ot.POINT&&vv(s.features_.getArray(),kt)){N=vr;var Lr=vr.getFlatCoordinates().slice(0,2);V=[{feature:kt,geometry:vr,segment:[Lr,Lr]}]}return!0},{layerFilter:me})}if(!V){var ve=ed(Kp(P,F0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ue=ef(gl(ve,Se,F0),z);V=this.rBush_.getInExtent(Ue)}if(V&&V.length>0){var et=V.sort(F)[0],Ie=et.segment,Ne=U0(P,et,z),He=u.getPixelFromCoordinate(Ne),nt=Ey(n,He);if(N||nt<=this.pixelTolerance_){var mt={};if(mt[Pi(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ne[0]-P[0],this.delta_[1]=Ne[1]-P[1]),et.geometry.getType()===Ot.CIRCLE&&et.index===wd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ne,[et.feature],[et.geometry]);else{var ht=u.getPixelFromCoordinate(Ie[0]),pt=u.getPixelFromCoordinate(Ie[1]),Tt=Qp(He,ht),It=Qp(He,pt);nt=Math.sqrt(Math.min(Tt,It)),this.snappedToVertex_=nt<=this.pixelTolerance_,this.snappedToVertex_&&(Ne=Tt>It?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ne,[et.feature],[et.geometry]);var Pt={};Pt[Pi(et.geometry)]=!0;for(var Qt=1,Ft=V.length;Qt<Ft;++Qt){var er=V[Qt].segment;if(Su(Ie[0],er[0])&&Su(Ie[1],er[1])||Su(Ie[0],er[1])&&Su(Ie[1],er[0])){var hr=Pi(V[Qt].geometry);hr in Pt||(Pt[hr]=!0,mt[Pi(er)]=!0)}else break}}this.vertexSegments_=mt;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},h.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,V;u.length<P.getStride();)u.push(0);switch(P.getType()){case Ot.MULTI_LINE_STRING:V=P.getCoordinates(),V[z[0]].splice(F+1,0,u);break;case Ot.POLYGON:V=P.getCoordinates(),V[z[0]].splice(F+1,0,u);break;case Ot.MULTI_POLYGON:V=P.getCoordinates(),V[z[1]][z[0]].splice(F+1,0,u);break;case Ot.LINE_STRING:V=P.getCoordinates(),V.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,V);var N=this.rBush_;N.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};N.insert(Eu(me.segment),me),this.dragSegments_.push([me,1]);var ve={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};N.insert(Eu(ve.segment),ve),this.dragSegments_.push([ve,0]),this.ignoreNextSingleClick_=!0},h.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=na.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new w_(b_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},h.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,V,N,me,ve,Se,Ue,et;for(V=n.length-1;V>=0;--V)z=n[V],Ue=z[0],et=Pi(Ue.feature),Ue.depth&&(et+="-"+Ue.depth.join("-")),et in u||(u[et]={}),z[1]===0?(u[et].right=Ue,u[et].index=Ue.index):z[1]==1&&(u[et].left=Ue,u[et].index=Ue.index+1);for(et in u){switch(Se=u[et].right,me=u[et].left,N=u[et].index,ve=N-1,me!==void 0?Ue=me:Ue=Se,ve<0&&(ve=0),F=Ue.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Ot.MULTI_LINE_STRING:P[Ue.depth[0]].length>2&&(P[Ue.depth[0]].splice(N,1),r=!0);break;case Ot.LINE_STRING:P.length>2&&(P.splice(N,1),r=!0);break;case Ot.MULTI_POLYGON:s=s[Ue.depth[1]];case Ot.POLYGON:s=s[Ue.depth[0]],s.length>4&&(N==s.length-1&&(N=0),s.splice(N,1),r=!0,N===0&&(s.pop(),s.push(s[0]),ve=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ne={depth:Ue.depth,feature:Ue.feature,geometry:Ue.geometry,index:ve,segment:Ie};this.rBush_.insert(Eu(Ne.segment),Ne)}this.updateSegmentIndices_(F,N,Ue.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},h.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},h.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},h}(M0);function W2(y,h){return y.index-h.index}function B0(y,h,n){var u=h.geometry;if(u.getType()===Ot.CIRCLE){var r=u;if(h.index===wd){var s=uh();s&&(r=r.clone().transform(s,n));var P=Qp(r.getCenter(),Xl(y,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Xl(y,n);return hf[0]=Xl(h.segment[0],n),hf[1]=Xl(h.segment[1],n),Jv(F,hf)}function U0(y,h,n){var u=h.geometry;if(u.getType()===Ot.CIRCLE&&h.index===wd){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Iy(r.getClosestPoint(Xl(y,n)),n)}var P=Xl(y,n);return hf[0]=Xl(h.segment[0],n),hf[1]=Xl(h.segment[1],n),Iy(wy(P,hf),n)}function $2(){var y=Yx();return function(h,n){return y[Ot.POINT]}}var E_=X2;var K2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(h,n){var u;if(n){var r=n.dataProjection?ya(n.dataProjection):this.readProjection(h);n.extent&&r&&r.getUnits()===sc.TILE_PIXELS&&(r=ya(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},y.prototype.adaptOptions=function(h){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},h)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(h,n){return jr()},y.prototype.readFeatures=function(h,n){return jr()},y.prototype.readGeometry=function(h,n){return jr()},y.prototype.readProjection=function(h){return jr()},y.prototype.writeFeature=function(h,n){return jr()},y.prototype.writeFeatures=function(h,n){return jr()},y.prototype.writeGeometry=function(h,n){return jr()},y}(),V0=K2;function T_(y,h,n){var u=n?ya(n.featureProjection):null,r=n?ya(n.dataProjection):null,s;if(u&&r&&!rx(u,r)?s=(h?y.clone():y).transform(h?u:r,h?r:u):s=y,h&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var V=0,N=F.length;V<N;++V)F[V]=Math.round(F[V]*P)/P;return F};s===y&&(s=y.clone()),s.applyTransform(z)}return s}var H2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y2=function(y){H2(h,y);function h(){return y.call(this)||this}return h.prototype.getType=function(){return vh.JSON},h.prototype.readFeature=function(n,u){return this.readFeatureFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readFeatureFromObject=function(n,u){return jr()},h.prototype.readFeaturesFromObject=function(n,u){return jr()},h.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(lg(n),this.getReadOptions(n,u))},h.prototype.readGeometryFromObject=function(n,u){return jr()},h.prototype.readProjection=function(n){return this.readProjectionFromObject(lg(n))},h.prototype.readProjectionFromObject=function(n){return jr()},h.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},h.prototype.writeFeatureObject=function(n,u){return jr()},h.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},h.prototype.writeFeaturesObject=function(n,u){return jr()},h.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},h.prototype.writeGeometryObject=function(n,u){return jr()},h}(V0);function lg(y){if(typeof y=="string"){var h=JSON.parse(y);return h||null}else return y!==null?y:null}var G0=Y2;var J2=function(){var y=function(h,n){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},y(h,n)};return function(h,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");y(h,n);function u(){this.constructor=h}h.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Q2=function(y){J2(h,y);function h(n){var u=this,r=n||{};return u=y.call(this)||this,u.dataProjection=ya(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ya(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return h.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=S_(r.geometry,u),P=new uc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},h.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,V=z.length;F<V;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},h.prototype.readGeometryFromObject=function(n,u){return S_(n,u)},h.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ya(u.properties.name):u.type==="EPSG"?r=ya("EPSG:"+u.properties.code):En(!1,36):r=this.dataProjection,r},h.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=I_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},h.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},h.prototype.writeGeometryObject=function(n,u){return I_(n,this.adaptOptions(u))},h}(G0);function S_(y,h){if(!y)return null;var n;switch(y.type){case Ot.POINT:{n=tE(y);break}case Ot.LINE_STRING:{n=rE(y);break}case Ot.POLYGON:{n=aE(y);break}case Ot.MULTI_POINT:{n=nE(y);break}case Ot.MULTI_LINE_STRING:{n=iE(y);break}case Ot.MULTI_POLYGON:{n=oE(y);break}case Ot.GEOMETRY_COLLECTION:{n=eE(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return T_(n,!1,h)}function eE(y,h){var n=y.geometries.map(function(u){return S_(u,h)});return new px(n)}function tE(y){return new _a(y.coordinates)}function rE(y){return new Wl(y.coordinates)}function iE(y){return new Tx(y.coordinates)}function nE(y){return new Km(y.coordinates)}function oE(y){return new kx(y.coordinates)}function aE(y){return new cd(y.coordinates)}function I_(y,h){y=T_(y,!0,h);var n=y.getType(),u;switch(n){case Ot.POINT:{u=pE(y,h);break}case Ot.LINE_STRING:{u=lE(y,h);break}case Ot.POLYGON:{u=fE(y,h);break}case Ot.MULTI_POINT:{u=cE(y,h);break}case Ot.MULTI_LINE_STRING:{u=uE(y,h);break}case Ot.MULTI_POLYGON:{u=hE(y,h);break}case Ot.GEOMETRY_COLLECTION:{u=sE(y,h);break}case Ot.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function sE(y,h){var n=y.getGeometriesArray().map(function(u){var r=Ra({},h);return delete r.featureProjection,I_(u,r)});return{type:"GeometryCollection",geometries:n}}function lE(y,h){return{type:"LineString",coordinates:y.getCoordinates()}}function uE(y,h){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function cE(y,h){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function hE(y,h){var n;return h&&(n=h.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(n)}}function pE(y,h){return{type:"Point",coordinates:y.getCoordinates()}}function fE(y,h){var n;return h&&(n=h.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(n)}}var bl=Q2;var ug,dE=new Uint8Array(16);function C_(){if(!ug&&(ug=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ug))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ug(dE)}var xa=[];for(let y=0;y<256;++y)xa.push((y+256).toString(16).slice(1));function j0(y,h=0){return(xa[y[h+0]]+xa[y[h+1]]+xa[y[h+2]]+xa[y[h+3]]+"-"+xa[y[h+4]]+xa[y[h+5]]+"-"+xa[y[h+6]]+xa[y[h+7]]+"-"+xa[y[h+8]]+xa[y[h+9]]+"-"+xa[y[h+10]]+xa[y[h+11]]+xa[y[h+12]]+xa[y[h+13]]+xa[y[h+14]]+xa[y[h+15]]).toLowerCase()}var mE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),A_={randomUUID:mE};function gE(y,h,n){if(A_.randomUUID&&!h&&!y)return A_.randomUUID();y=y||{};let u=y.random||(y.rng||C_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,h){n=n||0;for(let r=0;r<16;++r)h[n+r]=u[r];return h}return j0(u)}var P_=gE;var np=class extends ko{constructor(n={}){super();this.properties={};this.options={};this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.options=n,this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=P_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let V=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",V||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(V=>V.visible)&&this.children.forEach(V=>{V.visible=!0}),this.parent&&this.group){let V=this.parent;for(;V.parent;)V=V.parent;let N=new ln("change:visible:group");N.target=this,V.dispatchEvent(N)}}else this.visible||(this.children&&this.children.forEach(V=>{V.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(V=>V.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(V=>{V.parent=void 0}),Array.isArray(F)&&F.forEach(V=>{V.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return $f(this)}};function yE(y){return class extends y{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),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(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new ln("user:click");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>{let P=new ln("user:hover");return P.target=s,this.dispatchEvent(P),s}).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var cg=yE;var Ed=class extends cg(np){constructor(n){super(n);this.olLayer?.setVisible(this.visible)}defineProperties(n){super.defineProperties(n),Object.defineProperties(this,{olLayer:{value:n.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!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.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ha(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(){Ha([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new Ed({...this.options,...n})}},Is=Ed;var q0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new va({color:[0,0,0,1],width:1})}),_E=new $l({stroke:new va({color:[0,0,0,1],width:5})}),vE=new $l({image:q0,stroke:new va({color:[255,0,0,1],width:3})}),xE=new $l({image:q0,stroke:new va({color:[255,0,0,1],width:3,lineDash:[1,10]})}),bE=(y,h)=>{let n=y.get("minResolution"),u=y.get("maxResolution"),r=h<=n&&h>u;return n&&u&&!r?[]:y.get("mot")!=="foot"?[_E,vE]:[xE]},Td=class extends Is{constructor(n){super(n);this.options={};this.olLayer=n.olLayer||new rp({source:new ip,style:n.style||bE})}clone(n){return new Td({...this.options,...n})}},hg=Td;var wE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,Z0=/^([\d.]+),([\d.]+)$/,X0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,pg="stop-fetch",W0=y=>{let h=[];return y.forEach(n=>{let u=n.getGeometry()?.getCoordinates();u?.length&&h.push(...u)}),h},Sd=class extends of{constructor(n={}){super(n);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 bl({featureProjection:"EPSG:3857"});this.initialRouteDrag={};Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:u=>{u&&(this.set("mot",u),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:u=>{this.set("loading",u)}},modify:{get:()=>this.get("modify"),set:u=>{this.set("modify",u)}}}),this.loading=!1,this.graphs=n.graphs||[["osm",0,99]],this.mot=n.mot||"bus",this.modify=n.modify!==!1,this.routingApiParams=n.routingApiParams,this.useRawViaPoints=n.useRawViaPoints||!1,this.snapToClosestStation=n.snapToClosestStation||!1,this.apiKey=n.apiKey,this.stopsApiKey=n.stopsApiKey||this.apiKey,this.stopsApiUrl=n.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new qf({...n}),this.routingLayer=n.routingLayer||new hg({name:"routing-layer",style:n.style}),this.onRouteError=n.onRouteError||(u=>{this.dispatchEvent(new ln("change:route")),this.reset(),console.error(u)}),this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.createModifyInteraction()}static getGraphsResolutions(n,u){let r=u.getView();return n.map(([,s,P])=>[r.getResolutionForZoom(s),r.getResolutionForZoom(P||s+1)])}addViaPoint(n,u=-1,r=0){this.viaPoints.splice(u===-1?this.viaPoints.length:u,r,n),this.drawRoute(),this.dispatchEvent(new ln("change:route"))}removeViaPoint(n=(this.viaPoints||[]).length-1){this.viaPoints.length&&this.viaPoints[n]&&this.viaPoints.splice(n,1),this.drawRoute(),this.dispatchEvent(new ln("change:route"))}setViaPoints(n){this.viaPoints=[...n],this.drawRoute(),this.dispatchEvent(new ln("change:route"))}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer?.olLayer?.getSource()?.clear(),this.dispatchEvent(new ln("change:route"))}abortRequests(){this.graphs.forEach(n=>{let u=n[0];this.abortControllers[u]&&this.abortControllers[u].abort(),this.abortControllers[u]=new AbortController}),this.abortControllers[pg]?.abort(),this.abortControllers[pg]=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[pg]);let n=this.viaPoints.map(u=>{if(Array.isArray(u)){let r=this.map?.getView().getProjection(),[s,P]=lh(u,r);return this.snapToClosestStation?[`@${P}`,s]:[P,s]}return this.useRawViaPoints?u:`!${u}`});return this.loading=!0,this.routingLayer?.olLayer?.getSource()?.clear(),this.viaPoints.forEach((u,r)=>this.drawViaPoint(u,r,this.abortControllers[pg])),Promise.all(this.graphs.map(([u],r)=>{let{signal:s}=this.abortControllers[u];return this.api?this.api.route({graph:u,via:`${n.join("|")}`,mot:this.mot,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams||{}},{signal:s}).then(P=>{if(this.segments=this.format.readFeatures(P),this.mot==="foot"){let V=this.segments.reduce((N,me)=>{let ve=me.get("trg");return N.find(Se=>Se[0]===ve[0]&&Se[1]===ve[1])?N:[...N,ve]},[]);this.segments=V.map(N=>{let me=this.segments.filter(Se=>{let Ue=Se.get("trg");return Ue[0]===N[0]&&Ue[1]===N[1]}),ve=W0(me);return new uc({geometry:new Wl(ve)})})}let z=W0(this.segments),F=new uc({geometry:new Wl(z)});F.set("graph",u),F.set("mot",this.mot),this.graphsResolutions&&this.graphsResolutions[r]?.length>=2&&(F.set("minResolution",this.graphsResolutions[r][0]),F.set("maxResolution",this.graphsResolutions[r][1])),this.routingLayer?.olLayer?.getSource()?.addFeature(F),this.loading=!1}).catch(P=>{P.name!=="AbortError"&&(this.segments=[],this.dispatchEvent(new ln("error")),this.onRouteError(P,this),this.loading=!1)}):Promise.resolve([])}))}drawViaPoint(n,u,r){let s=new uc;if(s.set("viaPointIdx",u),Array.isArray(n))return s.setGeometry(new _a(n)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s);if(!this.useRawViaPoints||X0.test(n)){let N,me;return this.useRawViaPoints?[,N,,me]=X0.exec(n)||[]:[N,me]=n.split("$"),fetch(`${this.stopsApiUrl}lookup/${N}?key=${this.stopsApiKey}`,{signal:r.signal}).then(ve=>ve.json()).then(ve=>{let{coordinates:Se}=ve.features[0].geometry;return this.cacheStationData[n]=uo(Se),s.set("viaPointTrack",me),s.setGeometry(new _a(uo(Se))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(ve=>{ve.name!=="AbortError"&&(this.dispatchEvent(new ln("error")),this.onRouteError(ve,this),this.loading=!1)})}if(this.useRawViaPoints&&Z0.test(n)){let[N,me]=Z0.exec(n)||[],ve=uo([parseFloat(me),parseFloat(N)],this.map?.getView().getProjection());return s.setGeometry(new _a(ve)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}let[,P,,z,F,,V]=wE.exec(n)||[];if(F&&z){let N=uo([parseFloat(F),parseFloat(z)],this.map?.getView().getProjection());return s.set("viaPointTrack",V),s.setGeometry(new _a(N)),this.routingLayer?.olLayer?.getSource()?.addFeature(s),Promise.resolve(s)}return P?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${P}&limit=1`,{signal:r.signal}).then(N=>N.json()).then(N=>{let{coordinates:me}=N.features[0].geometry;return this.cacheStationData[n]=uo(me),s.set("viaPointTrack",V),s.setGeometry(new _a(uo(me))),this.routingLayer?.olLayer?.getSource()?.addFeature(s),s}).catch(N=>(this.dispatchEvent(new ln("error")),this.onRouteError(N,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(n){let r=n.target.getFeaturesAtPixel(n.pixel).find(s=>s.getGeometry()?.getType()==="Point"&&s.get("viaPointIdx")!==void 0);if(r){this.removeViaPoint(r.get("viaPointIdx"));return}this.addViaPoint(n.coordinate)}onModifyStart(n){let u=-1,r=n.features.getArray().find(P=>P.getGeometry()?.getType()==="LineString");if(r&&r.getGeometry()&&n.mapBrowserEvent.coordinate){let P=gl(new _a(r.getGeometry()?.getClosestPoint(n.mapBrowserEvent.coordinate)).getExtent(),.001);u=this.segments.findIndex(z=>z.getGeometry()?.intersectsExtent(P))}let s=(n.features.getArray().filter(P=>P.getGeometry()?.getType()==="Point")||[])[0];this.initialRouteDrag={viaPoint:s,oldRoute:r&&r.clone(),segmentIndex:u}}onModifyEnd(n){let u=n.mapBrowserEvent.coordinate,{oldRoute:r,viaPoint:s,segmentIndex:P}=this.initialRouteDrag||{};return s?this.addViaPoint(u,s.get("viaPointIdx"),1):r?P===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(u,(P||0)+1):this.addViaPoint(u,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 E_({source:this.routingLayer?.olLayer?.getSource()||void 0,pixelTolerance:4,hitDetection:this.routingLayer?.olLayer,deleteCondition:n=>{let r=n.target.getFeaturesAtPixel(n.pixel,{hitTolerance:5}).find(s=>s.getGeometry()?.getType()==="Point"&&s.get("index"));return R0(n)&&r?(this.removeViaPoint(r.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&&Ha(this.onMapClickKey)}activate(){super.activate(),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Sd.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(){}},$0=Sd;var M_=class extends of{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s,placeholder:P}=n||{};this.apiParams={limit:20,...u||{}},this.placeholder=P||"Search for a stop...";let z={apiKey:r};s&&(z.url=s),this.api=new Zf(z),this.abortController=new AbortController}deactivate(){}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}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=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.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(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},K0=M_;var k_=class extends K0{onSuggestionClick(h){let n=uo(h.geometry.coordinates);this.map.getView().setCenter(n)}},H0=k_;var J0=jp(Y0());var z_=class extends Is{constructor(n){super(n);this.olLayer=new Jh({source:new uf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({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 n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.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 u=this.getMapboxMapClass();this.mbMap=new u({style:Xh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new ln("load"))}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=ac(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},fg=z_;var op=class extends fg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],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=ac(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return rf(this)}getMapboxMapClass(){return J0.Map}clone(n){return new op({...this.options,...n})}};var t1=jp(e1());var ap=class extends fg{getOlLayerRender(){return tf(this)}getMapboxMapClass(){return t1.Map}clone(n){return new ap({...this.options,...n})}};var Id=class extends Is{constructor(n){super(n);this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers&&(this.styleLayersFilter=u=>!!this.styleLayers?.find(r=>u.id===r.id))}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.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.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none",F=P.layers||[];for(let V=0;V<F.length;V+=1){let N=F[V];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Id({...this.options,...n})}},r1=Id;var N_=jp(a1()),V_=jp(h1());function iT(y){return class extends y{constructor(u){super({hitTolerance:10,...u});this.minZoomInterpolation=8;this.debug=u.debug||!1,this.mode=u.mode||qo.TOPOGRAPHIC,this.api=u.api||new Wf(u),this.tenant=u.tenant||"",Number.isNaN(u.minZoomInterpolation)||(this.minZoomInterpolation=u.minZoomInterpolation||0),this.format=new bl;let r=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"],s=["rail"],P=["tram","subway","rail","bus"];this.motsByZoom=u.motsByZoom||[s,s,s,s,s,s,s,s,s,P,P,r,r,r,r],this.getMotsByZoom=z=>u.getMotsByZoom&&u.getMotsByZoom(z,this.motsByZoom)||this.motsByZoom[z]||this.motsByZoom[this.motsByZoom.length-1],this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=z=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(z,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[z],this.renderTimeIntervalByZoom=u.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=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(z,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[z],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,N_.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(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:V,sort:N,time:me,live:ve,canvas:Se,styleOptions:Ue,mode:et}=u,Ie=Se,Ne=s||1,He=me||new Date,nt=et||qo.TOPOGRAPHIC,mt=r||Yh;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{get:()=>(Ie||(Ie=document.createElement("canvas")),Ie),set:ht=>{Ie=ht}},mode:{get:()=>nt,set:ht=>{ht!==nt&&(nt=ht,this.api?.wsApi?.open&&(this.stop(),this.start()))}},style:{get:()=>mt,set:ht=>{mt=ht,this.renderTrajectories()}},styleOptions:{value:{...nf,...Ue||{}}},speed:{get:()=>Ne,set:ht=>{Ne=ht,this.start()}},filter:{value:V,writable:!0},sort:{value:N,writable:!0},live:{value:ve===!1?ve:!0,writable:!0},time:{get:()=>He,set:ht=>{He=ht&&ht.getTime?ht:new Date(ht),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas){let u=this.canvas.getContext("2d");u&&u.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()}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()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=hd(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{filter:this.filter,noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(r),this.mots&&s.push(`mots=${this.mots}`)),this.api.bbox=s}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,V_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,N_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=gl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let V=[];for(let N=0;N<F.length&&(F[N].properties.coordinate&&Wp(z,F[N].properties.coordinate)&&V.push(F[N]),V.length!==P);N+=1);return Promise.resolve({layer:this,features:V.map(N=>this.format.readFeature(N)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([u,r])=>{let s=r?.properties?.time_intervals;this.time&&s.length&&s[s.length-1][0]<this.time&&this.removeTrajectory(u)})}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!Ro(r,z)||this.mots&&!this.mots.includes(P)?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?(this.stop(),this.trajectories={}):this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===qo.TOPOGRAPHIC&&F?r.properties.olGeometry=this.format.readGeometry({type:"Point",coordinates:uo(F,this.map.getView().getProjection())}):r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var mg=iT;var nT=new $l({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),oT=(y,h,n)=>{let u="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[nT,new $l({zIndex:3,image:new xl({radius:4,fill:new Ks({color:u})}),stroke:new va({color:u,width:4})})]},gg=oT;var aT=new $l({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new va({color:"#000000",width:6})}),sT=new $l({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new va({color:"#a0a0a0",width:4})}),lT=()=>[aT,sT],p1=lT;var uT=new bl,Cd=class extends mg(Is){constructor(n){super({...n});this.allowRenderWhenAnimating=!1;this.allowRenderWhenAnimating=!!n.allowRenderWhenAnimating,this.olLayer=n.olLayer||new v_({layers:[new rp({source:new ip({features:[]}),style:(u,r)=>(n.fullTrajectoryStyle||gg)(u,r,this.styleOptions)}),new Jh({source:new uf({}),render:u=>{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:r,resolution:s,rotation:P}=u.viewState,{center:z,resolution:F,rotation:V}=this.renderedViewState;if(F/s>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let N=this.map.getPixelFromCoordinate(z),me=this.map.getPixelFromCoordinate(r);this.transformContainer.style.transform=Rv(N[0]-me[0],N[1]-me[1],F/s,F/s,P-V,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],u=>{let r=(u.map||u.target).getView();if(r.getAnimating()||r.getInteracting())return;let s=r.getZoom();this.currentZoom!==s&&this.onZoomEnd(),this.currentZoom=s,this.onMoveEnd(u)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(n){if(this.map&&this.canvas){let u=this.canvas.getContext("2d",{willReadFrequently:!0}),r=this.map.getPixelFromCoordinate(n);return!!u?.getImageData(r[0]*(this.pixelRatio||1),r[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(n){if(!this.map)return;let u=this.map.getView();!u.getCenter()||super.renderTrajectories({size:this.map.getSize(),center:u.getCenter(),extent:u.calculateExtent(),resolution:u.getResolution(),rotation:u.getRotation(),zoom:u.getZoom(),pixelRatio:this.pixelRatio},n)}renderTrajectoriesInternal(n,u){if(!this.map)return!1;let r=!1;return r=(this.allowRenderWhenAnimating?!1:this.map.getView().getAnimating()||this.map.getView().getInteracting())?!1:super.renderTrajectoriesInternal(n,u),r&&(this.renderedViewState={...n},this.transformContainer&&(this.transformContainer.style.transform="")),r}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(n,u={}){if(!this.map||!this.map.getView())return Promise.resolve({layer:this,features:[],coordinate:n});let r=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(n,{resolution:r,...u})}onMoveEnd(n){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(n,u,r){super.onFeatureHover(n,u,r),this.map.getTargetElement().style.cursor=n.length?"pointer":"auto"}onFeatureClick(n,u,r){super.onFeatureClick(n,u,r),!n.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(n,u,r){let s=this.map.getView().getCenter();return!u&&!s?!1:super.purgeTrajectory(n,u||this.map.getView().calculateExtent(),r||this.map.getView().getZoom())}setBbox(n,u){let r=n,s=u;!r&&this.isUpdateBboxOnMoveEnd&&(r=n||this.map.getView().calculateExtent(),s=Math.floor(this.map.getView().getZoom())),super.setBbox(r,s)}highlightTrajectory(n){return this.api.getFullTrajectory(n,this.mode,this.generalizationLevel).then(u=>{let r=u.content;if(this.vectorLayer.getSource().clear(),!r||!r.features||!r.features.length)return;let s=uT.readFeatures(r);return this.vectorLayer.getSource().addFeatures(s),s})}clone(n){return new Cd({...this.options,...n})}},f1=Cd;var Ad=class extends Is{getFeatureInfoAtCoordinate(h){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(h);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:h})}clone(h){return new Ad({...this.options,...h})}},d1=Ad;var Pd=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Pd({...this.options,...n})}},m1=Pd;var bg={};oy(bg,{CopyrightControl:()=>g1,Layer:()=>_g,RealtimeAPI:()=>Wf,RealtimeLayer:()=>M1,RealtimeModes:()=>qo,RoutingAPI:()=>qf,StopsAPI:()=>Zf,compareDepartures:()=>pd,createRealtimeFilters:()=>cy,debounceDeparturesMessages:()=>Oy,debounceWebsocketMessages:()=>Xf,getCircleCanvas:()=>qy,getDelayBgCanvas:()=>Gy,getDelayTextCanvas:()=>jy,getHoursAndMinutes:()=>Av,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>ac,getMapboxRender:()=>rf,getMaplibreRender:()=>tf,getMercatorResolution:()=>xg,getSourceCoordinates:()=>Ld,getTextCanvas:()=>Zy,getUTCDateString:()=>Iv,getUTCTimeString:()=>Cv,getUrlWithParams:()=>Xh,pad:()=>Rm,realtimeConfig:()=>nf,realtimeDefaultStyle:()=>Yh,realtimeDelayStyle:()=>Xy,realtimeSimpleStyle:()=>Wy,removeDuplicate:()=>Wh,renderTrajectories:()=>hd,sortAndFilterDepartures:()=>fd,sortByDelay:()=>hy});var G_=class extends eg{constructor(h){super(h),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 ac(this.map)}},g1=G_;var Md=class extends cg(np){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ha(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 n=this.map.getBounds().toArray();return Qf([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new Md({...this.options,...n})}},_g=Md;var Zo=63710088e-1,y1={centimeters:Zo*100,centimetres:Zo*100,degrees:Zo/111325,feet:Zo*3.28084,inches:Zo*39.37,kilometers:Zo/1e3,kilometres:Zo/1e3,meters:Zo,metres:Zo,miles:Zo/1609.344,millimeters:Zo*1e3,millimetres:Zo*1e3,nauticalmiles:Zo/1852,radians:1,yards:Zo*1.0936},T5={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/Zo,yards:1.0936133};function _1(y,h,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=h||{},u.geometry=y,u}function bh(y,h,n){if(n===void 0&&(n={}),!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!j_(y[0])||!j_(y[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:y};return _1(u,h,n)}function cT(y,h){h===void 0&&(h="kilometers");var n=y1[h];if(!n)throw new Error(h+" units is invalid");return y*n}function hT(y,h){h===void 0&&(h="kilometers");var n=y1[h];if(!n)throw new Error(h+" units is invalid");return y/n}function v1(y){var h=y%(2*Math.PI);return h*180/Math.PI}function sp(y){var h=y%360;return h*Math.PI/180}function vg(y,h,n){if(h===void 0&&(h="kilometers"),n===void 0&&(n="kilometers"),!(y>=0))throw new Error("length must be a positive number");return cT(hT(y,h),n)}function j_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function q_(y){return!!y&&y.constructor===Object}function kd(y,h,n){if(y!==null)for(var u,r,s,P,z,F,V,N=0,me=0,ve,Se=y.type,Ue=Se==="FeatureCollection",et=Se==="Feature",Ie=Ue?y.features.length:1,Ne=0;Ne<Ie;Ne++){V=Ue?y.features[Ne].geometry:et?y.geometry:y,ve=V?V.type==="GeometryCollection":!1,z=ve?V.geometries.length:1;for(var He=0;He<z;He++){var nt=0,mt=0;if(P=ve?V.geometries[He]:V,P!==null){F=P.coordinates;var ht=P.type;switch(N=n&&(ht==="Polygon"||ht==="MultiPolygon")?1:0,ht){case null:break;case"Point":if(h(F,me,Ne,nt,mt)===!1)return!1;me++,nt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(h(F[u],me,Ne,nt,mt)===!1)return!1;me++,ht==="MultiPoint"&&nt++}ht==="LineString"&&nt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-N;r++){if(h(F[u][r],me,Ne,nt,mt)===!1)return!1;me++}ht==="MultiLineString"&&nt++,ht==="Polygon"&&mt++}ht==="Polygon"&&nt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(mt=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-N;s++){if(h(F[u][r][s],me,Ne,nt,mt)===!1)return!1;me++}mt++}nt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(kd(P.geometries[u],h,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function pT(y,h){h===void 0&&(h={});var n=0,u=0,r=0;return kd(y,function(s){n+=s[0],u+=s[1],r++},!0),bh([n/r,u/r],h.properties)}var x1=pT;function ku(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function b1(y){if(Array.isArray(y))return y;if(y.type==="Feature"){if(y.geometry!==null)return y.geometry.coordinates}else if(y.coordinates)return y.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function fT(y,h,n){n===void 0&&(n={});var u;n.final?u=w1(ku(h),ku(y)):u=w1(ku(y),ku(h));var r=u>180?-(360-u):u;return r}function w1(y,h){var n=sp(y[1]),u=sp(h[1]),r=sp(h[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(v1(P)+360)%360}var E1=fT;function dT(y,h,n){n===void 0&&(n={});var u=ku(y),r=ku(h);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=mT(u,r),P=vg(s,"meters",n.units);return P}function mT(y,h,n){n=n===void 0?Zo:Number(n);var u=n,r=y[1]*Math.PI/180,s=h[1]*Math.PI/180,P=s-r,z=Math.abs(h[0]-y[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),V=Math.abs(F)>1e-11?P/F:Math.cos(r),N=Math.sqrt(P*P+V*V*z*z),me=N*u;return me}var T1=dT;function gT(y,h,n,u){u===void 0&&(u={});var r=h<0,s=vg(Math.abs(h),u.units,"meters");r&&(s=-Math.abs(s));var P=ku(y),z=yT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,bh(z,u.properties)}function yT(y,h,n,u){u=u===void 0?Zo:Number(u);var r=h/u,s=y[0]*Math.PI/180,P=sp(y[1]),z=sp(n),F=r*Math.cos(z),V=P+F;Math.abs(V)>Math.PI/2&&(V=V>0?Math.PI-V:-Math.PI-V);var N=Math.log(Math.tan(V/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(N)>1e-11?F/N:Math.cos(P),ve=r*Math.sin(z)/me,Se=s+ve;return[(Se*180/Math.PI+540)%360-180,V*180/Math.PI]}var S1=gT;function _T(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return I1(y);case"FeatureCollection":return vT(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Z_(y);default:throw new Error("unknown GeoJSON type")}}function I1(y){var h={type:"Feature"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:h[n]=y[n]}}),h.properties=C1(y.properties),h.geometry=Z_(y.geometry),h}function C1(y){var h={};return y&&Object.keys(y).forEach(function(n){var u=y[n];typeof u=="object"?u===null?h[n]=null:Array.isArray(u)?h[n]=u.map(function(r){return r}):h[n]=C1(u):h[n]=u}),h}function vT(y){var h={type:"FeatureCollection"};return Object.keys(y).forEach(function(n){switch(n){case"type":case"features":return;default:h[n]=y[n]}}),h.features=y.features.map(function(n){return I1(n)}),h}function Z_(y){var h={type:y.type};return y.bbox&&(h.bbox=y.bbox),y.type==="GeometryCollection"?(h.geometries=y.geometries.map(function(n){return Z_(n)}),h):(h.coordinates=A1(y.coordinates),h)}function A1(y){var h=y;return typeof h[0]!="object"?h.slice():h.map(function(n){return A1(n)})}var P1=_T;function xT(y,h,n){if(n=n||{},!q_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!y)throw new Error("geojson is required");if(h==null||isNaN(h))throw new Error("angle is required");return h===0||(u||(u=x1(y)),(r===!1||r===void 0)&&(y=P1(y)),kd(y,function(s){var P=E1(u,s),z=P+h,F=T1(u,s),V=b1(S1(u,F,z));s[0]=V[0],s[1]=V[1]})),y}var X_=xT;var bT=(y,h=1)=>{let{width:n,height:u}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:u/h}),P=y.unproject({x:n/h,y:u/h}),z=y.unproject({x:n/h,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Ld=bT;var wT=y=>{let h=y.getBounds().toArray(),n=uo(h[0]),u=uo(h[1]),r=[...n,...u],{width:s,height:P}=y.getCanvas(),z=bs(r)/s,F=Tu(r)/P;return Math.max(z,F)},xg=wT;var W_=class extends mg(_g){constructor(h={}){super({...h}),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(h,n){!h||(super.attachToMap(h),this.source={type:"canvas",canvas:this.canvas,coordinates:Ld(h,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,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"}},h.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(h=>{Ha(h)}),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(h){super.onUserMoveCallback({coordinate:uo(h.lngLat.toArray()),...h})}renderTrajectories(h=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=X_(bh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=X_(bh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,V=[...uo(z),...uo(F)],N=bs(V)/(n/this.pixelRatio),me=Tu(V)/(u/this.pixelRatio),ve=Math.max(N,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:uo([r.lng,r.lat]),extent:V,resolution:ve,zoom:this.getOlZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,h)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(h,n={}){let u=xg(this.map);return super.getFeatureInfoAtCoordinate(h,{resolution:u,...n})}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(h,n,u){return super.purgeTrajectory(h,n||this.getMercatorExtent(),u||Math.floor(this.getOlZoom()))}setBbox(h,n){let u=h,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=h||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(h,n=!1){let u=super.renderTrajectoriesInternal(h,n);if(u&&this.map.style){let r=Ld(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(h,n,u){super.onFeatureHover(h,n,u),this.map.getCanvasContainer().style.cursor=h.length?"pointer":"auto"}},M1=W_;var $_={ol:yg,mapbox:bg};typeof window<"u"&&(window.mbt=$_);var S3=$_;})();
1083
1083
  //# sourceMappingURL=mbt.min.js.map