mobility-toolbox-js 2.0.0-beta.75 → 2.0.0-beta.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mbt.min.js CHANGED
@@ -1072,7 +1072,7 @@ uniform ${se} ${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,{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(`
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||this.closed||this.closing)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,{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===`